@lunora/codegen 1.0.0-alpha.37 → 1.0.0-alpha.370
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.
- package/README.md +1 -1
- package/dist/index.d.mts +4370 -2174
- package/dist/index.d.ts +4370 -2174
- package/dist/index.mjs +1 -35
- package/dist/packem_shared/AGENTS_FILENAME-BedyJsOT.mjs +1 -0
- package/dist/packem_shared/CAPABILITY_PROBES-DKYJ2K4t.mjs +25 -0
- package/dist/packem_shared/CONTAINERS_FILENAME-T1v8pyHN.mjs +1 -0
- package/dist/packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs +1 -0
- package/dist/packem_shared/DEFAULT_TARGET-3OLdJhTj.mjs +1 -0
- package/dist/packem_shared/FLAGS_FILENAME-BEMyglH0.mjs +1 -0
- package/dist/packem_shared/GENERATED_HEADER-BPc7maFN.mjs +1 -0
- package/dist/packem_shared/LUNORA_ERROR_CODES-CIAJQeKB.mjs +1 -0
- package/dist/packem_shared/MUTATORS_FILENAME-PNPCtUl2.mjs +1 -0
- package/dist/packem_shared/NOTIFY_FILENAME-HXIKioYv.mjs +1 -0
- package/dist/packem_shared/OPENRPC_VERSION-CTR_g_IE.mjs +3 -0
- package/dist/packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs +1 -0
- package/dist/packem_shared/QUEUES_FILENAME-Dt5RG_P0.mjs +1 -0
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DDRbBN-I.mjs +31 -0
- package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-SplX7j_9.mjs +2 -0
- package/dist/packem_shared/SHAPES_FILENAME-mgEi072Z.mjs +1 -0
- package/dist/packem_shared/SchemaSnapshotParseError-CjKSMuex.mjs +18 -0
- package/dist/packem_shared/WORKFLOWS_FILENAME-VAXgqqP-.mjs +1 -0
- package/dist/packem_shared/attribution-DUbGYT4N.mjs +1 -0
- package/dist/packem_shared/buildOpenApiDocument-Cju685VK.mjs +3 -0
- package/dist/packem_shared/capabilitiesUsedBy-CN8HACEL.mjs +1 -0
- package/dist/packem_shared/chain-DuEHFGVW.mjs +1 -0
- package/dist/packem_shared/classify-procedure-call-DtqiTjPg.mjs +1 -0
- package/dist/packem_shared/context-property-calls-CDMYbegz.mjs +1 -0
- package/dist/packem_shared/context-root-Bd08qiVR.mjs +1 -0
- package/dist/packem_shared/createCodegenProject-DmXl8m_P.mjs +1 -0
- package/dist/packem_shared/database-calls-BSyvN1No.mjs +1 -0
- package/dist/packem_shared/declared-output-Iaar469J.mjs +1 -0
- package/dist/packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs +1 -0
- package/dist/packem_shared/discoverAuthApiCalls-Ce3BdKQr.mjs +1 -0
- package/dist/packem_shared/discoverCrons-D-vJXsgx.mjs +1 -0
- package/dist/packem_shared/discoverFunctions-BdEY3nbv.mjs +1 -0
- package/dist/packem_shared/discoverHttpRoutes-Hy2UrcrN.mjs +1 -0
- package/dist/packem_shared/discoverHyperdriveCalls-Cn3087D8.mjs +1 -0
- package/dist/packem_shared/discoverInserts-DIzIGlyG.mjs +1 -0
- package/dist/packem_shared/discoverMaskProcedures-B68Jryv8.mjs +1 -0
- package/dist/packem_shared/discoverMigrations-Bv8kNIgy.mjs +1 -0
- package/dist/packem_shared/discoverNondeterministicCalls-DZ_kIie5.mjs +1 -0
- package/dist/packem_shared/discoverQueries-KjOdhrk6.mjs +1 -0
- package/dist/packem_shared/discoverR2sqlCalls-B4N8iXlU.mjs +1 -0
- package/dist/packem_shared/discoverRlsMetadata-Dq6iSXnC.mjs +1 -0
- package/dist/packem_shared/discoverRlsProcedures-DhOEyJLg.mjs +1 -0
- package/dist/packem_shared/discoverSandboxUsage-CdGRnVU2.mjs +1 -0
- package/dist/packem_shared/discoverSchema-DmkjooXZ.mjs +1 -0
- package/dist/packem_shared/discoverStorageRulesMetadata-CJ7h6SPK.mjs +1 -0
- package/dist/packem_shared/dispatch-namespace-DwTjD7BU.mjs +1 -0
- package/dist/packem_shared/emitAgents-B6IWt2Gq.mjs +1 -0
- package/dist/packem_shared/emitApi-CCjh0ICg.mjs +147 -0
- package/dist/packem_shared/emitApp-CzDMr_iP.mjs +1058 -0
- package/dist/packem_shared/emitCrons-CY8IQfAI.mjs +123 -0
- package/dist/packem_shared/emitDataModel-Bba2y2yt.mjs +114 -0
- package/dist/packem_shared/emitDrizzleSchema-CD4hPtUP.mjs +15 -0
- package/dist/packem_shared/emitFunctions-C3WOlVN0.mjs +506 -0
- package/dist/packem_shared/emitServer-DEkbCE0n.mjs +1 -0
- package/dist/packem_shared/emitShard-N6sEBh_g.mjs +1 -0
- package/dist/packem_shared/exported-procedure-chains-BaCIhnJ7.mjs +1 -0
- package/dist/packem_shared/fingerprintSchemaSources-DIYx5eO0.mjs +1 -0
- package/dist/packem_shared/formatAdvisories-BCVASH7N.mjs +2 -0
- package/dist/packem_shared/handler-reference-D1wpw_qR.mjs +1 -0
- package/dist/packem_shared/index-Cm7HdvL5.mjs +1 -0
- package/dist/packem_shared/isD1GlobalTable-udvHAAzD.mjs +1 -0
- package/dist/packem_shared/isTestPath-JdN4KXhV.mjs +1 -0
- package/dist/packem_shared/isTypedSchema-CDv3pJB6.mjs +4 -0
- package/dist/packem_shared/json-data-Chfs2Cz5.mjs +1 -0
- package/dist/packem_shared/loadProjectConfig-B7RmxIeD.mjs +1 -0
- package/dist/packem_shared/module-specifiers-BctA0m_p.mjs +1 -0
- package/dist/packem_shared/modules-DEBCI7Gm.mjs +1 -0
- package/dist/packem_shared/parse-validator-CP5CL6Q7.mjs +1 -0
- package/dist/packem_shared/platform-8oj7iXQy.mjs +1 -0
- package/dist/packem_shared/property-name-7cBlgK_O.mjs +1 -0
- package/dist/packem_shared/qualifiers-vzi-FQv3.mjs +1 -0
- package/dist/packem_shared/readPackageDependencies-RHhGiz0k.mjs +1 -0
- package/dist/packem_shared/readServiceBindings-BA49C6aN.mjs +1 -0
- package/dist/packem_shared/redact-Cy14LEnc.mjs +1 -0
- package/dist/packem_shared/reserved-words-CW1QFbTd.mjs +1 -0
- package/dist/packem_shared/schema-BgM8A3XV.mjs +1 -0
- package/dist/packem_shared/schemaFromIr-CByOxuZb.mjs +1 -0
- package/dist/packem_shared/server-DC4PW_2M.mjs +369 -0
- package/dist/packem_shared/shard-D9_wgrV7.mjs +1803 -0
- package/dist/packem_shared/shard-runtime-B9K29SyO.mjs +343 -0
- package/dist/packem_shared/shared-Br_OnErI.mjs +13 -0
- package/dist/packem_shared/unwrap-handler-return-DTcee6Ng.mjs +1 -0
- package/dist/sdk/index.d.mts +288 -0
- package/dist/sdk/index.d.ts +288 -0
- package/dist/sdk/index.mjs +372 -0
- package/package.json +21 -8
- package/dist/packem_shared/CONTAINERS_FILENAME-DjpXMqhp.mjs +0 -224
- package/dist/packem_shared/CodegenDiagnosticError-DyQ5FwkM.mjs +0 -24
- package/dist/packem_shared/FLAGS_FILENAME-BjpS5w08.mjs +0 -139
- package/dist/packem_shared/GENERATED_HEADER-DPA3P7aE.mjs +0 -3
- package/dist/packem_shared/LUNORA_ERROR_CODES-CySpQPD3.mjs +0 -61
- package/dist/packem_shared/MUTATORS_FILENAME-BZOfUhlY.mjs +0 -81
- package/dist/packem_shared/OPENRPC_VERSION-BUv-bV3M.mjs +0 -60
- package/dist/packem_shared/QUEUES_FILENAME-BF0iUmx7.mjs +0 -119
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-CCiIKql3.mjs +0 -3425
- package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs +0 -249
- package/dist/packem_shared/SHAPES_FILENAME-DOhPGi-6.mjs +0 -94
- package/dist/packem_shared/WORKFLOWS_FILENAME-CCC_42o3.mjs +0 -124
- package/dist/packem_shared/buildOpenApiDocument-CYHG8Yuq.mjs +0 -183
- package/dist/packem_shared/discover-ast-CT6BgBr4.mjs +0 -13
- package/dist/packem_shared/discoverAuthApiCalls-URDoTADN.mjs +0 -62
- package/dist/packem_shared/discoverCrons-BNL5hAPv.mjs +0 -256
- package/dist/packem_shared/discoverFunctions-BJdF7lRs.mjs +0 -514
- package/dist/packem_shared/discoverHttpRoutes-CcwP-Rkr.mjs +0 -131
- package/dist/packem_shared/discoverInserts-BpFhM32L.mjs +0 -61
- package/dist/packem_shared/discoverMaskProcedures-DT-v8wvj.mjs +0 -273
- package/dist/packem_shared/discoverMigrations-cG1idBVM.mjs +0 -97
- package/dist/packem_shared/discoverNondeterministicCalls-CEOjmfk4.mjs +0 -122
- package/dist/packem_shared/discoverQueries-DeVBQVAG.mjs +0 -62
- package/dist/packem_shared/discoverR2sqlCalls-CWCAU-xJ.mjs +0 -80
- package/dist/packem_shared/discoverRlsMetadata-BL0oukaK.mjs +0 -280
- package/dist/packem_shared/discoverSchema-CeXJWVKV.mjs +0 -874
- package/dist/packem_shared/discoverStorageRulesMetadata-CFHByjIl.mjs +0 -97
- package/dist/packem_shared/emit-Bl3STBW9.mjs +0 -3424
- package/dist/packem_shared/emitApp-CPfFyx9U.mjs +0 -668
- package/dist/packem_shared/formatAdvisories-DLIqHq5l.mjs +0 -114
- package/dist/packem_shared/parse-validator-D6zI2i85.mjs +0 -134
- package/dist/packem_shared/paths-BRd6JHuF.mjs +0 -11
- package/dist/packem_shared/redact-oTmsol5A.mjs +0 -33
- 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 };
|