@lunora/codegen 1.0.0-alpha.27 → 1.0.0-alpha.270

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/index.d.mts +3890 -1254
  4. package/dist/index.d.ts +3890 -1254
  5. package/dist/index.mjs +1 -34
  6. package/dist/packem_shared/AGENTS_FILENAME-lBe4g_sU.mjs +1 -0
  7. package/dist/packem_shared/CAPABILITY_PROBES-DFsutD7g.mjs +25 -0
  8. package/dist/packem_shared/CONTAINERS_FILENAME-CY43AXXN.mjs +1 -0
  9. package/dist/packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs +1 -0
  10. package/dist/packem_shared/DEFAULT_TARGET-rlz3WdHe.mjs +1 -0
  11. package/dist/packem_shared/FLAGS_FILENAME-DXltN9DD.mjs +1 -0
  12. package/dist/packem_shared/GENERATED_HEADER-dFyrHgQ0.mjs +1 -0
  13. package/dist/packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs +1 -0
  14. package/dist/packem_shared/MUTATORS_FILENAME-BxRrG_s-.mjs +1 -0
  15. package/dist/packem_shared/NOTIFY_FILENAME-J5MGAkca.mjs +1 -0
  16. package/dist/packem_shared/OPENRPC_VERSION-B8RT1JYn.mjs +3 -0
  17. package/dist/packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs +1 -0
  18. package/dist/packem_shared/QUEUES_FILENAME-C6us1zjh.mjs +1 -0
  19. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-B3gunaV8.mjs +11 -0
  20. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs +2 -0
  21. package/dist/packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs +372 -0
  22. package/dist/packem_shared/SHAPES_FILENAME-CeBFuc8M.mjs +1 -0
  23. package/dist/packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs +18 -0
  24. package/dist/packem_shared/WORKFLOWS_FILENAME-B47AB5pc.mjs +1 -0
  25. package/dist/packem_shared/attribution-NRssTEkk.mjs +1 -0
  26. package/dist/packem_shared/buildOpenApiDocument-6VJGU6fU.mjs +3 -0
  27. package/dist/packem_shared/capabilitiesUsedBy-DKQfzdUf.mjs +1 -0
  28. package/dist/packem_shared/chain-6qc9c0JF.mjs +1 -0
  29. package/dist/packem_shared/classify-procedure-call-BBKuBvKg.mjs +1 -0
  30. package/dist/packem_shared/context-property-calls-tlnXE-wv.mjs +1 -0
  31. package/dist/packem_shared/context-root-IuI71QkK.mjs +1 -0
  32. package/dist/packem_shared/database-calls-BFY_pIUf.mjs +1 -0
  33. package/dist/packem_shared/declared-output-Iaar469J.mjs +1 -0
  34. package/dist/packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs +1 -0
  35. package/dist/packem_shared/discoverAuthApiCalls-TA2a8bZI.mjs +1 -0
  36. package/dist/packem_shared/discoverCrons-PQeDYVPc.mjs +1 -0
  37. package/dist/packem_shared/discoverFunctions-4sef11AC.mjs +1 -0
  38. package/dist/packem_shared/discoverHttpRoutes-CLGXL19M.mjs +1 -0
  39. package/dist/packem_shared/discoverHyperdriveCalls-imtma-ic.mjs +1 -0
  40. package/dist/packem_shared/discoverInserts-CKEO1mZZ.mjs +1 -0
  41. package/dist/packem_shared/discoverMaskProcedures-Cr6hDinL.mjs +1 -0
  42. package/dist/packem_shared/discoverMigrations-DYQbnqow.mjs +1 -0
  43. package/dist/packem_shared/discoverNondeterministicCalls-BfdM93-8.mjs +1 -0
  44. package/dist/packem_shared/discoverQueries-DEkIMaBP.mjs +1 -0
  45. package/dist/packem_shared/discoverR2sqlCalls-BRIyb8Cl.mjs +1 -0
  46. package/dist/packem_shared/discoverRlsMetadata-rpiO4wSi.mjs +1 -0
  47. package/dist/packem_shared/discoverRlsProcedures-BtT8-r93.mjs +1 -0
  48. package/dist/packem_shared/discoverSandboxUsage-B8P9QjWZ.mjs +1 -0
  49. package/dist/packem_shared/discoverSchema-BdmC-kO2.mjs +1 -0
  50. package/dist/packem_shared/discoverStorageRulesMetadata-C2hYksmI.mjs +1 -0
  51. package/dist/packem_shared/emitAgents-DjaEzoIa.mjs +1 -0
  52. package/dist/packem_shared/emitApi-xDIHPRPH.mjs +154 -0
  53. package/dist/packem_shared/emitApp-CT3NRUF_.mjs +864 -0
  54. package/dist/packem_shared/emitCrons-DKeoaeqU.mjs +96 -0
  55. package/dist/packem_shared/emitDataModel-DSk9AkJe.mjs +113 -0
  56. package/dist/packem_shared/emitDrizzleSchema-DohtnI8c.mjs +15 -0
  57. package/dist/packem_shared/emitFunctions-evl8Mx1a.mjs +249 -0
  58. package/dist/packem_shared/emitServer-DymRagL2.mjs +368 -0
  59. package/dist/packem_shared/emitShard-BGi5g8zQ.mjs +1 -0
  60. package/dist/packem_shared/exported-procedure-chains-DqU-ZCbG.mjs +1 -0
  61. package/dist/packem_shared/fingerprintSchemaSources-ChYfrghz.mjs +1 -0
  62. package/dist/packem_shared/formatAdvisories-DwmUKYuc.mjs +2 -0
  63. package/dist/packem_shared/handler-reference-B3coD2YR.mjs +1 -0
  64. package/dist/packem_shared/index-CRO3TRxd.mjs +1 -0
  65. package/dist/packem_shared/ir-DBSvhNa-.mjs +1 -0
  66. package/dist/packem_shared/isD1GlobalTable-udvHAAzD.mjs +1 -0
  67. package/dist/packem_shared/isTestPath-DCyIyPa7.mjs +1 -0
  68. package/dist/packem_shared/isTypedSchema-CKzc3ioR.mjs +4 -0
  69. package/dist/packem_shared/json-data-Chfs2Cz5.mjs +1 -0
  70. package/dist/packem_shared/loadProjectConfig-DGqGWOfa.mjs +1 -0
  71. package/dist/packem_shared/module-specifiers-WF8iAydP.mjs +1 -0
  72. package/dist/packem_shared/modules-6EEBTEDo.mjs +1 -0
  73. package/dist/packem_shared/parse-validator-DYdT7Hyf.mjs +1 -0
  74. package/dist/packem_shared/paths-C-9fwEgQ.mjs +1 -0
  75. package/dist/packem_shared/project-config-file-Bv2l-Kmm.mjs +1 -0
  76. package/dist/packem_shared/qualifiers-Cw8dEDbh.mjs +1 -0
  77. package/dist/packem_shared/readPackageDependencies-RHhGiz0k.mjs +1 -0
  78. package/dist/packem_shared/readServiceBindings-DuE9xlvV.mjs +1 -0
  79. package/dist/packem_shared/redact-Cy14LEnc.mjs +1 -0
  80. package/dist/packem_shared/reserved-words-CW1QFbTd.mjs +1 -0
  81. package/dist/packem_shared/schemaFromIr-BWFnvCVg.mjs +1 -0
  82. package/dist/packem_shared/shard-DTJX0sDf.mjs +1438 -0
  83. package/dist/packem_shared/shard-runtime-BXp-lUsd.mjs +325 -0
  84. package/dist/packem_shared/shared-BXUKWh7t.mjs +9 -0
  85. package/dist/packem_shared/unwrap-handler-return-Dy8h5-I6.mjs +1 -0
  86. package/package.json +17 -7
  87. package/dist/packem_shared/CONTAINERS_FILENAME-DlP6YM_Q.mjs +0 -224
  88. package/dist/packem_shared/CodegenDiagnosticError-DeblMkzO.mjs +0 -23
  89. package/dist/packem_shared/FLAGS_FILENAME-B1vE0LIo.mjs +0 -139
  90. package/dist/packem_shared/GENERATED_HEADER-CYaSI_qY.mjs +0 -3268
  91. package/dist/packem_shared/LUNORA_ERROR_CODES-CySpQPD3.mjs +0 -61
  92. package/dist/packem_shared/LUNORA_SOLUTION_RULES-BTejmZp-.mjs +0 -131
  93. package/dist/packem_shared/MUTATORS_FILENAME-BhqdPtKp.mjs +0 -81
  94. package/dist/packem_shared/OPENRPC_VERSION-CRe5l79E.mjs +0 -60
  95. package/dist/packem_shared/QUEUES_FILENAME-B5_eWCRe.mjs +0 -119
  96. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-B3TwY0JD.mjs +0 -1146
  97. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-wWGP2_5E.mjs +0 -245
  98. package/dist/packem_shared/SHAPES_FILENAME-ChV7MqgE.mjs +0 -94
  99. package/dist/packem_shared/WORKFLOWS_FILENAME-CCisG0Vy.mjs +0 -124
  100. package/dist/packem_shared/buildOpenApiDocument-BlpXQe2K.mjs +0 -183
  101. package/dist/packem_shared/discover-ast-CT6BgBr4.mjs +0 -13
  102. package/dist/packem_shared/discoverAuthApiCalls-CoirYbg6.mjs +0 -62
  103. package/dist/packem_shared/discoverCrons-Cev7RRAf.mjs +0 -257
  104. package/dist/packem_shared/discoverFunctions-BWMczzBx.mjs +0 -465
  105. package/dist/packem_shared/discoverHttpRoutes-CfP6cMzt.mjs +0 -131
  106. package/dist/packem_shared/discoverInserts-C7zxXkUf.mjs +0 -61
  107. package/dist/packem_shared/discoverMaskProcedures-Cm81kwrb.mjs +0 -217
  108. package/dist/packem_shared/discoverMigrations-Bi5nJ0mJ.mjs +0 -97
  109. package/dist/packem_shared/discoverNondeterministicCalls-C4M8AXmQ.mjs +0 -122
  110. package/dist/packem_shared/discoverQueries-B0wGT-xe.mjs +0 -62
  111. package/dist/packem_shared/discoverR2sqlCalls-BVNMd428.mjs +0 -80
  112. package/dist/packem_shared/discoverRlsMetadata-BS9GOGC5.mjs +0 -280
  113. package/dist/packem_shared/discoverSchema-KYq55qu3.mjs +0 -864
  114. package/dist/packem_shared/discoverStorageRulesMetadata-Da8BKXcI.mjs +0 -97
  115. package/dist/packem_shared/emitApp-C38fHt_1.mjs +0 -675
  116. package/dist/packem_shared/formatAdvisories-DdjK7sgh.mjs +0 -81
  117. package/dist/packem_shared/parse-validator-Cabb60UV.mjs +0 -133
  118. package/dist/packem_shared/paths-BRd6JHuF.mjs +0 -11
  119. package/dist/packem_shared/schemaFromIr-DTYsLBaA.mjs +0 -57
@@ -1,97 +0,0 @@
1
- import { Node } from 'ts-morph';
2
- import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-BWMczzBx.mjs';
3
-
4
- const STORAGE_OPERATIONS = /* @__PURE__ */ new Set(["delete", "list", "read", "write"]);
5
- const isStorageRulesCall = (node) => {
6
- if (!Node.isCallExpression(node)) {
7
- return false;
8
- }
9
- const callee = node.getExpression();
10
- if (Node.isIdentifier(callee)) {
11
- return callee.getText() === "storageRules";
12
- }
13
- return Node.isPropertyAccessExpression(callee) && callee.getName() === "storageRules";
14
- };
15
- const storageRulesCallsInChain = (receiver) => {
16
- const calls = [];
17
- let node = receiver;
18
- while (Node.isCallExpression(node)) {
19
- const chainCallee = node.getExpression();
20
- if (!Node.isPropertyAccessExpression(chainCallee)) {
21
- break;
22
- }
23
- if (chainCallee.getName() === "use") {
24
- const argument = node.getArguments()[0];
25
- if (argument && isStorageRulesCall(argument)) {
26
- calls.push(argument);
27
- }
28
- }
29
- node = chainCallee.getExpression();
30
- }
31
- return calls;
32
- };
33
- const stringPropertyOf = (object, name) => {
34
- if (!Node.isObjectLiteralExpression(object)) {
35
- return void 0;
36
- }
37
- const property = object.getProperty(name);
38
- if (!property || !Node.isPropertyAssignment(property)) {
39
- return void 0;
40
- }
41
- const initializer = property.getInitializer();
42
- return initializer && Node.isStringLiteral(initializer) ? initializer.getLiteralText() : void 0;
43
- };
44
- const extractRules = (call, file, procedure) => {
45
- const argument = call.getArguments()[0];
46
- if (!argument || !Node.isArrayLiteralExpression(argument)) {
47
- return [];
48
- }
49
- const rules = [];
50
- for (const element of argument.getElements()) {
51
- if (!Node.isObjectLiteralExpression(element)) {
52
- continue;
53
- }
54
- const on = stringPropertyOf(element, "on");
55
- if (on === void 0 || !STORAGE_OPERATIONS.has(on)) {
56
- continue;
57
- }
58
- const prefix = stringPropertyOf(element, "prefix");
59
- const rule = { bucket: stringPropertyOf(element, "bucket") ?? "", file, on, procedure };
60
- if (prefix !== void 0) {
61
- rule.prefix = prefix;
62
- }
63
- rules.push(rule);
64
- }
65
- return rules;
66
- };
67
- const exportedProcedureChains = (sourceFile) => {
68
- const chains = [];
69
- for (const statement of sourceFile.getVariableStatements()) {
70
- if (!statement.isExported()) {
71
- continue;
72
- }
73
- for (const declaration of statement.getDeclarations()) {
74
- const initializer = declaration.getInitializer();
75
- const classified = initializer && Node.isCallExpression(initializer) ? classifyProcedureCall(initializer) : void 0;
76
- if (classified?.receiver) {
77
- chains.push({ name: declaration.getName(), receiver: classified.receiver });
78
- }
79
- }
80
- }
81
- return chains;
82
- };
83
- const discoverStorageRulesMetadata = (project, lunoraDirectory) => {
84
- const rules = [];
85
- for (const filePath of listLunoraSourceFiles(lunoraDirectory)) {
86
- const sourceFile = project.getSourceFile(filePath) ?? project.addSourceFileAtPath(filePath);
87
- const relativePath = lunoraRelativePath(lunoraDirectory, filePath);
88
- for (const { name, receiver } of exportedProcedureChains(sourceFile)) {
89
- for (const call of storageRulesCallsInChain(receiver)) {
90
- rules.push(...extractRules(call, relativePath, name));
91
- }
92
- }
93
- }
94
- return { rules };
95
- };
96
-
97
- export { discoverStorageRulesMetadata as default };