@lunora/codegen 1.0.0-alpha.35 → 1.0.0-alpha.350

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 (124) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.mts +4354 -2174
  3. package/dist/index.d.ts +4354 -2174
  4. package/dist/index.mjs +1 -35
  5. package/dist/packem_shared/AGENTS_FILENAME-isdHqPIt.mjs +1 -0
  6. package/dist/packem_shared/CAPABILITY_PROBES-brcmKenl.mjs +25 -0
  7. package/dist/packem_shared/CONTAINERS_FILENAME-mK4cZpcz.mjs +1 -0
  8. package/dist/packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs +1 -0
  9. package/dist/packem_shared/DEFAULT_TARGET-3OLdJhTj.mjs +1 -0
  10. package/dist/packem_shared/FLAGS_FILENAME-BQk3SX8D.mjs +1 -0
  11. package/dist/packem_shared/GENERATED_HEADER-BXK9A_wP.mjs +1 -0
  12. package/dist/packem_shared/LUNORA_ERROR_CODES-CIAJQeKB.mjs +1 -0
  13. package/dist/packem_shared/MUTATORS_FILENAME-Cy9h3EVW.mjs +1 -0
  14. package/dist/packem_shared/NOTIFY_FILENAME-9to_l_Kh.mjs +1 -0
  15. package/dist/packem_shared/OPENRPC_VERSION-DfSmacMR.mjs +3 -0
  16. package/dist/packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs +1 -0
  17. package/dist/packem_shared/QUEUES_FILENAME-Civ-7SiI.mjs +1 -0
  18. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DYEopqtc.mjs +31 -0
  19. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-C7Um0EnM.mjs +2 -0
  20. package/dist/packem_shared/SHAPES_FILENAME-DVJbfDZ8.mjs +1 -0
  21. package/dist/packem_shared/SchemaSnapshotParseError-H9eQX4ui.mjs +18 -0
  22. package/dist/packem_shared/WORKFLOWS_FILENAME-kXq07aGl.mjs +1 -0
  23. package/dist/packem_shared/attribution-CG8-kUcl.mjs +1 -0
  24. package/dist/packem_shared/buildOpenApiDocument-DWdj2jvW.mjs +3 -0
  25. package/dist/packem_shared/capabilitiesUsedBy-DjRHg-Zk.mjs +1 -0
  26. package/dist/packem_shared/chain-74gjwZMP.mjs +1 -0
  27. package/dist/packem_shared/classify-procedure-call-BkaeM9Ej.mjs +1 -0
  28. package/dist/packem_shared/context-property-calls-dFjpeIlP.mjs +1 -0
  29. package/dist/packem_shared/context-root-CNR6TAsP.mjs +1 -0
  30. package/dist/packem_shared/createCodegenProject-ClPr_MXM.mjs +1 -0
  31. package/dist/packem_shared/database-calls-UPlhi3Ks.mjs +1 -0
  32. package/dist/packem_shared/declared-output-Iaar469J.mjs +1 -0
  33. package/dist/packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs +1 -0
  34. package/dist/packem_shared/discoverAuthApiCalls-CScPrUD-.mjs +1 -0
  35. package/dist/packem_shared/discoverCrons-B1_NUt19.mjs +1 -0
  36. package/dist/packem_shared/discoverFunctions-CJG4S6CK.mjs +1 -0
  37. package/dist/packem_shared/discoverHttpRoutes-DCDgDIYv.mjs +1 -0
  38. package/dist/packem_shared/discoverHyperdriveCalls-CL-d0IVo.mjs +1 -0
  39. package/dist/packem_shared/discoverInserts-BcoTjXqI.mjs +1 -0
  40. package/dist/packem_shared/discoverMaskProcedures-Bw-BOIbA.mjs +1 -0
  41. package/dist/packem_shared/discoverMigrations-BWxx8Wv9.mjs +1 -0
  42. package/dist/packem_shared/discoverNondeterministicCalls-mFJNU8qY.mjs +1 -0
  43. package/dist/packem_shared/discoverQueries-CxQRVuIV.mjs +1 -0
  44. package/dist/packem_shared/discoverR2sqlCalls-B4oeTYEM.mjs +1 -0
  45. package/dist/packem_shared/discoverRlsMetadata-D0B4nCmG.mjs +1 -0
  46. package/dist/packem_shared/discoverRlsProcedures-Cl6UKT7L.mjs +1 -0
  47. package/dist/packem_shared/discoverSandboxUsage--Z1vx7GM.mjs +1 -0
  48. package/dist/packem_shared/discoverSchema-Cwt-DQgh.mjs +1 -0
  49. package/dist/packem_shared/discoverStorageRulesMetadata-CitX6ziW.mjs +1 -0
  50. package/dist/packem_shared/dispatch-namespace-DwTjD7BU.mjs +1 -0
  51. package/dist/packem_shared/emitAgents--VDKoet4.mjs +1 -0
  52. package/dist/packem_shared/emitApi-zynTVppI.mjs +147 -0
  53. package/dist/packem_shared/emitApp-BcLO2eih.mjs +989 -0
  54. package/dist/packem_shared/emitCrons-lc-hnJYn.mjs +96 -0
  55. package/dist/packem_shared/emitDataModel-CuFqq97x.mjs +114 -0
  56. package/dist/packem_shared/emitDrizzleSchema-bct1OuH5.mjs +15 -0
  57. package/dist/packem_shared/emitFunctions-D7mopPiT.mjs +506 -0
  58. package/dist/packem_shared/emitServer-DqjvPPKJ.mjs +1 -0
  59. package/dist/packem_shared/emitShard-CFUBJcKw.mjs +1 -0
  60. package/dist/packem_shared/exported-procedure-chains-D1WlRfqJ.mjs +1 -0
  61. package/dist/packem_shared/fingerprintSchemaSources-BKXkgkj4.mjs +1 -0
  62. package/dist/packem_shared/formatAdvisories-BCVASH7N.mjs +2 -0
  63. package/dist/packem_shared/handler-reference-CClSR4bi.mjs +1 -0
  64. package/dist/packem_shared/index-CN8FVvr-.mjs +1 -0
  65. package/dist/packem_shared/isD1GlobalTable-udvHAAzD.mjs +1 -0
  66. package/dist/packem_shared/isTestPath-C3QumE88.mjs +1 -0
  67. package/dist/packem_shared/isTypedSchema-CDv3pJB6.mjs +4 -0
  68. package/dist/packem_shared/json-data-Chfs2Cz5.mjs +1 -0
  69. package/dist/packem_shared/loadProjectConfig-B7RmxIeD.mjs +1 -0
  70. package/dist/packem_shared/module-specifiers-BctA0m_p.mjs +1 -0
  71. package/dist/packem_shared/modules-l-Db0C4S.mjs +1 -0
  72. package/dist/packem_shared/parse-validator-iVTounLK.mjs +1 -0
  73. package/dist/packem_shared/platform-8oj7iXQy.mjs +1 -0
  74. package/dist/packem_shared/property-name-7cBlgK_O.mjs +1 -0
  75. package/dist/packem_shared/qualifiers-Bl5fSmav.mjs +1 -0
  76. package/dist/packem_shared/readPackageDependencies-RHhGiz0k.mjs +1 -0
  77. package/dist/packem_shared/readServiceBindings-BA49C6aN.mjs +1 -0
  78. package/dist/packem_shared/redact-Cy14LEnc.mjs +1 -0
  79. package/dist/packem_shared/reserved-words-CW1QFbTd.mjs +1 -0
  80. package/dist/packem_shared/schema-BgM8A3XV.mjs +1 -0
  81. package/dist/packem_shared/schemaFromIr-BWFnvCVg.mjs +1 -0
  82. package/dist/packem_shared/server-DlEPJi5i.mjs +369 -0
  83. package/dist/packem_shared/shard-6Xk0XLNG.mjs +1795 -0
  84. package/dist/packem_shared/shard-runtime-ByYXjCKY.mjs +333 -0
  85. package/dist/packem_shared/shared-8vTRkL2-.mjs +13 -0
  86. package/dist/packem_shared/unwrap-handler-return-CGdJGvGh.mjs +1 -0
  87. package/dist/sdk/index.d.mts +288 -0
  88. package/dist/sdk/index.d.ts +288 -0
  89. package/dist/sdk/index.mjs +372 -0
  90. package/package.json +21 -8
  91. package/dist/packem_shared/CONTAINERS_FILENAME-DjpXMqhp.mjs +0 -224
  92. package/dist/packem_shared/CodegenDiagnosticError-DyQ5FwkM.mjs +0 -24
  93. package/dist/packem_shared/FLAGS_FILENAME-BjpS5w08.mjs +0 -139
  94. package/dist/packem_shared/GENERATED_HEADER-CLwPlCQe.mjs +0 -3
  95. package/dist/packem_shared/LUNORA_ERROR_CODES-CySpQPD3.mjs +0 -61
  96. package/dist/packem_shared/MUTATORS_FILENAME-BZOfUhlY.mjs +0 -81
  97. package/dist/packem_shared/OPENRPC_VERSION-4YIeMkOI.mjs +0 -60
  98. package/dist/packem_shared/QUEUES_FILENAME-BF0iUmx7.mjs +0 -119
  99. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-C6Q0h0O5.mjs +0 -3425
  100. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs +0 -249
  101. package/dist/packem_shared/SHAPES_FILENAME-DOhPGi-6.mjs +0 -94
  102. package/dist/packem_shared/WORKFLOWS_FILENAME-CCC_42o3.mjs +0 -124
  103. package/dist/packem_shared/buildOpenApiDocument-bp1pYSV6.mjs +0 -183
  104. package/dist/packem_shared/discover-ast-CT6BgBr4.mjs +0 -13
  105. package/dist/packem_shared/discoverAuthApiCalls-URDoTADN.mjs +0 -62
  106. package/dist/packem_shared/discoverCrons-DdZOeroL.mjs +0 -257
  107. package/dist/packem_shared/discoverFunctions-BJdF7lRs.mjs +0 -514
  108. package/dist/packem_shared/discoverHttpRoutes-CcwP-Rkr.mjs +0 -131
  109. package/dist/packem_shared/discoverInserts-BpFhM32L.mjs +0 -61
  110. package/dist/packem_shared/discoverMaskProcedures-DT-v8wvj.mjs +0 -273
  111. package/dist/packem_shared/discoverMigrations-cG1idBVM.mjs +0 -97
  112. package/dist/packem_shared/discoverNondeterministicCalls-CEOjmfk4.mjs +0 -122
  113. package/dist/packem_shared/discoverQueries-DeVBQVAG.mjs +0 -62
  114. package/dist/packem_shared/discoverR2sqlCalls-CWCAU-xJ.mjs +0 -80
  115. package/dist/packem_shared/discoverRlsMetadata-BL0oukaK.mjs +0 -280
  116. package/dist/packem_shared/discoverSchema-CeXJWVKV.mjs +0 -874
  117. package/dist/packem_shared/discoverStorageRulesMetadata-CFHByjIl.mjs +0 -97
  118. package/dist/packem_shared/emit-CBwEvCXQ.mjs +0 -3451
  119. package/dist/packem_shared/emitApp-nQ2oC-8G.mjs +0 -668
  120. package/dist/packem_shared/formatAdvisories-DLIqHq5l.mjs +0 -114
  121. package/dist/packem_shared/parse-validator-D6zI2i85.mjs +0 -134
  122. package/dist/packem_shared/paths-BRd6JHuF.mjs +0 -11
  123. package/dist/packem_shared/redact-oTmsol5A.mjs +0 -33
  124. 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-BJdF7lRs.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 };