@lunora/codegen 1.0.0-alpha.33 → 1.0.0-alpha.331

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 +4298 -2183
  3. package/dist/index.d.ts +4298 -2183
  4. package/dist/index.mjs +1 -35
  5. package/dist/packem_shared/AGENTS_FILENAME-B6-kjzM3.mjs +1 -0
  6. package/dist/packem_shared/CAPABILITY_PROBES-brcmKenl.mjs +25 -0
  7. package/dist/packem_shared/CONTAINERS_FILENAME-dFRtAyIe.mjs +1 -0
  8. package/dist/packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs +1 -0
  9. package/dist/packem_shared/DEFAULT_TARGET-BbWiB-rs.mjs +1 -0
  10. package/dist/packem_shared/FLAGS_FILENAME-Bf0MSlHH.mjs +1 -0
  11. package/dist/packem_shared/GENERATED_HEADER-Ck_WOHzE.mjs +1 -0
  12. package/dist/packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs +1 -0
  13. package/dist/packem_shared/MUTATORS_FILENAME-B_I0kkvJ.mjs +1 -0
  14. package/dist/packem_shared/NOTIFY_FILENAME-DOIxn0Qb.mjs +1 -0
  15. package/dist/packem_shared/OPENRPC_VERSION-CCY7xqSL.mjs +3 -0
  16. package/dist/packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs +1 -0
  17. package/dist/packem_shared/QUEUES_FILENAME-CsRy4VTF.mjs +1 -0
  18. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DdPW4JCi.mjs +31 -0
  19. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs +2 -0
  20. package/dist/packem_shared/SHAPES_FILENAME-D7Ifi5Ce.mjs +1 -0
  21. package/dist/packem_shared/SchemaSnapshotParseError-BRJT7c2k.mjs +18 -0
  22. package/dist/packem_shared/WORKFLOWS_FILENAME-CdeS224T.mjs +1 -0
  23. package/dist/packem_shared/attribution-hVBriwzy.mjs +1 -0
  24. package/dist/packem_shared/buildOpenApiDocument-DFv-RYZU.mjs +3 -0
  25. package/dist/packem_shared/capabilitiesUsedBy-CF7sUwa8.mjs +1 -0
  26. package/dist/packem_shared/chain-ZlTHdRo2.mjs +1 -0
  27. package/dist/packem_shared/classify-procedure-call-Bw5sia-K.mjs +1 -0
  28. package/dist/packem_shared/context-property-calls-Co_G3ENU.mjs +1 -0
  29. package/dist/packem_shared/context-root-BTW5XwVq.mjs +1 -0
  30. package/dist/packem_shared/createCodegenProject-V51_yBw3.mjs +1 -0
  31. package/dist/packem_shared/database-calls-D-GwIhWO.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-xs0ONfI-.mjs +1 -0
  35. package/dist/packem_shared/discoverCrons-B2SdRjRO.mjs +1 -0
  36. package/dist/packem_shared/discoverFunctions-C9Ra5XXH.mjs +1 -0
  37. package/dist/packem_shared/discoverHttpRoutes-WBAqBcfK.mjs +1 -0
  38. package/dist/packem_shared/discoverHyperdriveCalls-DfCAjBgd.mjs +1 -0
  39. package/dist/packem_shared/discoverInserts-T5ojinqL.mjs +1 -0
  40. package/dist/packem_shared/discoverMaskProcedures-DKd9fVDa.mjs +1 -0
  41. package/dist/packem_shared/discoverMigrations-ClgjUkaG.mjs +1 -0
  42. package/dist/packem_shared/discoverNondeterministicCalls-UCUCyCox.mjs +1 -0
  43. package/dist/packem_shared/discoverQueries-u2XNpxsn.mjs +1 -0
  44. package/dist/packem_shared/discoverR2sqlCalls-jz5KouxF.mjs +1 -0
  45. package/dist/packem_shared/discoverRlsMetadata-D2G3YAoe.mjs +1 -0
  46. package/dist/packem_shared/discoverRlsProcedures-BD8aG1BU.mjs +1 -0
  47. package/dist/packem_shared/discoverSandboxUsage-w6Q3RvxZ.mjs +1 -0
  48. package/dist/packem_shared/discoverSchema-BtsX-CN9.mjs +1 -0
  49. package/dist/packem_shared/discoverStorageRulesMetadata-C2ceH0ZO.mjs +1 -0
  50. package/dist/packem_shared/dispatch-namespace-DwTjD7BU.mjs +1 -0
  51. package/dist/packem_shared/emitAgents-CR2_X_ov.mjs +1 -0
  52. package/dist/packem_shared/emitApi-CDgIPAG2.mjs +147 -0
  53. package/dist/packem_shared/emitApp-DuJW6LKD.mjs +986 -0
  54. package/dist/packem_shared/emitCrons-BQW2lviZ.mjs +96 -0
  55. package/dist/packem_shared/emitDataModel-BskFt9Wv.mjs +114 -0
  56. package/dist/packem_shared/emitDrizzleSchema-DitcRZ1a.mjs +15 -0
  57. package/dist/packem_shared/emitFunctions-Cd0Tuw73.mjs +500 -0
  58. package/dist/packem_shared/emitServer-D1vA5_X1.mjs +1 -0
  59. package/dist/packem_shared/emitShard-DtfjUgjj.mjs +1 -0
  60. package/dist/packem_shared/exported-procedure-chains-CVzkVdq4.mjs +1 -0
  61. package/dist/packem_shared/fingerprintSchemaSources-eVG9aVt0.mjs +1 -0
  62. package/dist/packem_shared/formatAdvisories-BCVASH7N.mjs +2 -0
  63. package/dist/packem_shared/handler-reference-vIeqkhV_.mjs +1 -0
  64. package/dist/packem_shared/index-BPUxZYM5.mjs +1 -0
  65. package/dist/packem_shared/isD1GlobalTable-udvHAAzD.mjs +1 -0
  66. package/dist/packem_shared/isTestPath-B81lOULB.mjs +1 -0
  67. package/dist/packem_shared/isTypedSchema-CKzc3ioR.mjs +4 -0
  68. package/dist/packem_shared/json-data-Chfs2Cz5.mjs +1 -0
  69. package/dist/packem_shared/loadProjectConfig-NO0dVJSl.mjs +1 -0
  70. package/dist/packem_shared/module-specifiers-BctA0m_p.mjs +1 -0
  71. package/dist/packem_shared/modules-CjOcuQnK.mjs +1 -0
  72. package/dist/packem_shared/parse-validator-IDBKIT7M.mjs +1 -0
  73. package/dist/packem_shared/platform-8oj7iXQy.mjs +1 -0
  74. package/dist/packem_shared/project-config-file-BV7RR-l6.mjs +1 -0
  75. package/dist/packem_shared/qualifiers-DEdXn5wP.mjs +1 -0
  76. package/dist/packem_shared/readPackageDependencies-RHhGiz0k.mjs +1 -0
  77. package/dist/packem_shared/readServiceBindings-DvqIThzd.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-DAvi_bv_.mjs +368 -0
  83. package/dist/packem_shared/shard-CsfiXxV0.mjs +1635 -0
  84. package/dist/packem_shared/shard-runtime-BpoCV-aM.mjs +331 -0
  85. package/dist/packem_shared/shared-DnCokNcE.mjs +13 -0
  86. package/dist/packem_shared/unwrap-handler-return-CeaOifqX.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-C9FkE1cW.mjs +0 -3521
  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,119 +0,0 @@
1
- import { existsSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { queueDefaultName, queueBindingName } from '@lunora/queue';
4
- import { SyntaxKind, Node } from 'ts-morph';
5
- import { diagnosticAt } from './CodegenDiagnosticError-DyQ5FwkM.mjs';
6
-
7
- const QUEUES_FILENAME = "queues.ts";
8
- const isDefineQueue = (identifier) => {
9
- const symbol = identifier.getSymbol();
10
- if (!symbol) {
11
- return identifier.getText() === "defineQueue";
12
- }
13
- for (const declaration of symbol.getDeclarations()) {
14
- if (!Node.isImportSpecifier(declaration)) {
15
- continue;
16
- }
17
- if (declaration.getImportDeclaration().getModuleSpecifierValue() !== "@lunora/queue") {
18
- return false;
19
- }
20
- return declaration.getNameNode().getText() === "defineQueue";
21
- }
22
- return false;
23
- };
24
- const stringProperty = (expression, exportName, property) => {
25
- if (Node.isStringLiteral(expression) || Node.isNoSubstitutionTemplateLiteral(expression)) {
26
- return expression.getLiteralValue();
27
- }
28
- throw diagnosticAt(
29
- expression,
30
- `queue "${exportName}": \`${property}\` must be a static string literal — it is deploy configuration codegen writes into wrangler.jsonc`
31
- );
32
- };
33
- const numberProperty = (expression, exportName, property) => {
34
- if (Node.isNumericLiteral(expression)) {
35
- return expression.getLiteralValue();
36
- }
37
- throw diagnosticAt(
38
- expression,
39
- `queue "${exportName}": \`${property}\` must be a static numeric literal — it is deploy configuration codegen writes into wrangler.jsonc`
40
- );
41
- };
42
- const queueNameOverride = (argument, exportName) => {
43
- const nameProperty = argument.getProperty("name");
44
- if (!nameProperty || !Node.isPropertyAssignment(nameProperty)) {
45
- return void 0;
46
- }
47
- const name = stringProperty(nameProperty.getInitializerOrThrow(), exportName, "name");
48
- if (name.length === 0) {
49
- throw diagnosticAt(nameProperty, `queue "${exportName}": \`name\` must be a non-empty string when provided`);
50
- }
51
- return name;
52
- };
53
- const queueFromCall = (call, exportName) => {
54
- const argument = call.getArguments()[0];
55
- if (!argument || !Node.isObjectLiteralExpression(argument)) {
56
- throw diagnosticAt(call, `queue "${exportName}": defineQueue must be passed an inline object literal`);
57
- }
58
- const ir = {
59
- bindingName: queueBindingName(exportName),
60
- exportName,
61
- mode: "push",
62
- name: queueNameOverride(argument, exportName) ?? queueDefaultName(exportName),
63
- tuning: {}
64
- };
65
- const modeProperty = argument.getProperty("mode");
66
- if (modeProperty && Node.isPropertyAssignment(modeProperty)) {
67
- const mode = stringProperty(modeProperty.getInitializerOrThrow(), exportName, "mode");
68
- if (mode !== "push" && mode !== "pull") {
69
- throw diagnosticAt(modeProperty, `queue "${exportName}": \`mode\` must be "push" or "pull" (got ${JSON.stringify(mode)})`);
70
- }
71
- ir.mode = mode;
72
- }
73
- const dlqProperty = argument.getProperty("deadLetterQueue");
74
- if (dlqProperty && Node.isPropertyAssignment(dlqProperty)) {
75
- ir.tuning.deadLetterQueue = stringProperty(dlqProperty.getInitializerOrThrow(), exportName, "deadLetterQueue");
76
- }
77
- for (const property of ["maxBatchSize", "maxBatchTimeout", "maxRetries", "retryDelay"]) {
78
- const node = argument.getProperty(property);
79
- if (node && Node.isPropertyAssignment(node)) {
80
- ir.tuning[property] = numberProperty(node.getInitializerOrThrow(), exportName, property);
81
- }
82
- }
83
- return ir;
84
- };
85
- const queuesFromSource = (source) => {
86
- const queues = [];
87
- for (const declaration of source.getVariableDeclarations()) {
88
- if (!declaration.isExported()) {
89
- continue;
90
- }
91
- const initializer = declaration.getInitializer();
92
- if (initializer?.getKind() !== SyntaxKind.CallExpression) {
93
- continue;
94
- }
95
- const call = initializer;
96
- const callee = call.getExpression();
97
- if (!Node.isIdentifier(callee) || !isDefineQueue(callee)) {
98
- continue;
99
- }
100
- const nameNode = declaration.getNameNode();
101
- if (!Node.isIdentifier(nameNode)) {
102
- throw diagnosticAt(nameNode, "defineQueue exports must be plain named exports (no destructuring)");
103
- }
104
- queues.push(queueFromCall(call, nameNode.getText()));
105
- }
106
- return queues;
107
- };
108
- const discoverQueues = (project, lunoraDirectory) => {
109
- const queuesPath = join(lunoraDirectory, QUEUES_FILENAME);
110
- if (!existsSync(queuesPath)) {
111
- return [];
112
- }
113
- const source = project.getSourceFile(queuesPath) ?? project.addSourceFileAtPath(queuesPath);
114
- const queues = queuesFromSource(source);
115
- queues.sort((a, b) => a.exportName.localeCompare(b.exportName));
116
- return queues;
117
- };
118
-
119
- export { QUEUES_FILENAME, discoverQueues };