MCPcopy Create free account
hub / github.com/instantdb/instant / permsTypescriptFileToCode

Function permsTypescriptFileToCode

client/packages/platform/src/perms.ts:66–81  ·  view source on GitHub ↗
(
  content: string,
  sourceFilename: string,
)

Source from the content-addressed store, hash-verified

64}
65
66export function permsTypescriptFileToCode(
67 content: string,
68 sourceFilename: string,
69) {
70 const ast = parse(content, {
71 sourceFilename,
72 sourceType: 'module',
73 errorRecovery: false,
74 plugins: ['typescript'],
75 });
76 if (ast.errors?.length) {
77 throw new Error(`Could not parse perms file. ${ast.errors[0].reasonCode}.`);
78 }
79
80 return astToPermsCode(ast);
81}

Callers 2

getRulesFunction · 0.90
perms.test.tsFile · 0.90

Calls 2

parseFunction · 0.85
astToPermsCodeFunction · 0.85

Tested by

no test coverage detected