@lunora/codegen 1.0.0-alpha.43 → 1.0.0-alpha.44
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/dist/index.d.mts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.mjs +18 -18
- package/dist/packem_shared/{FLAGS_FILENAME-fEZtzWXi.mjs → FLAGS_FILENAME-Dg4mKUuz.mjs} +1 -1
- package/dist/packem_shared/{GENERATED_HEADER-B-FzJ297.mjs → GENERATED_HEADER-7W9f2IG3.mjs} +1 -1
- package/dist/packem_shared/{OPENRPC_VERSION-DqTYxQ22.mjs → OPENRPC_VERSION-Cyttekkt.mjs} +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-BbF69nj9.mjs → SCHEMA_SNAPSHOT_FILENAME-CMjGZSa1.mjs} +18 -18
- package/dist/packem_shared/{buildOpenApiDocument-BrN41JMl.mjs → buildOpenApiDocument-saZ_-kl4.mjs} +1 -1
- package/dist/packem_shared/{discoverAuthApiCalls-WMx8L2FG.mjs → discoverAuthApiCalls-Dx3K42rk.mjs} +1 -1
- package/dist/packem_shared/{discoverCrons-DJJ3ZE5F.mjs → discoverCrons-_aosTRLr.mjs} +1 -1
- package/dist/packem_shared/{discoverFunctions-CZ91aenA.mjs → discoverFunctions-BJ-qR7Rg.mjs} +1 -1
- package/dist/packem_shared/{discoverHttpRoutes-DNZLDCmm.mjs → discoverHttpRoutes-daCzuTe8.mjs} +9 -1
- package/dist/packem_shared/{discoverInserts-DFRJhmCv.mjs → discoverInserts-DI4q5NxE.mjs} +1 -1
- package/dist/packem_shared/{discoverMaskProcedures-B5iFnZ-X.mjs → discoverMaskProcedures-BcTOEKNU.mjs} +1 -1
- package/dist/packem_shared/{discoverMigrations-CdKtMlBc.mjs → discoverMigrations-VNUFvCwr.mjs} +1 -1
- package/dist/packem_shared/{discoverNondeterministicCalls-C_PrQPkA.mjs → discoverNondeterministicCalls-S0N2xLCq.mjs} +1 -1
- package/dist/packem_shared/{discoverQueries-B8W9UPrt.mjs → discoverQueries-CJnnnLpd.mjs} +1 -1
- package/dist/packem_shared/{discoverR2sqlCalls-Bm7Rfnf4.mjs → discoverR2sqlCalls-pnpicWfz.mjs} +1 -1
- package/dist/packem_shared/{discoverRlsMetadata-B4GL4ZKm.mjs → discoverRlsMetadata-DppniPUH.mjs} +1 -1
- package/dist/packem_shared/{discoverStorageRulesMetadata-nosjYcvN.mjs → discoverStorageRulesMetadata-CnHl2rXD.mjs} +1 -1
- package/dist/packem_shared/{emit-DtherCpQ.mjs → emit-C_29WVlW.mjs} +48 -4
- package/dist/packem_shared/{emitApp-D7daY94X.mjs → emitApp-C9oljiZd.mjs} +1 -1
- package/package.json +9 -9
package/dist/index.d.mts
CHANGED
|
@@ -122,13 +122,13 @@ interface ExternalSourceIR {
|
|
|
122
122
|
binding: string;
|
|
123
123
|
/** Whether a `columns` projection allow-list was given. */
|
|
124
124
|
columns?: ReadonlyArray<string>;
|
|
125
|
-
/** `true` when a `reconcileEveryMs` was given
|
|
125
|
+
/** `true` when a `reconcileEveryMs` was given — reserved for a future incremental mode's delete-visibility lint; not on the typed `.source()` surface today. */
|
|
126
126
|
hasReconcile?: boolean;
|
|
127
127
|
/** `true` when a `tenantBy` mapper was given — the tenant-isolation boundary the `external_source_unscoped` lint checks. */
|
|
128
128
|
hasTenantBy: boolean;
|
|
129
129
|
/** The `idColumn` literal, when given (defaults to `"id"` at runtime). */
|
|
130
130
|
idColumn?: string;
|
|
131
|
-
/** Delete-detection mode literal, when given (`"full-pull"`
|
|
131
|
+
/** Delete-detection mode literal, when given (`"full-pull"` today). */
|
|
132
132
|
mode?: string;
|
|
133
133
|
/** The membership query literal, when statically knowable. */
|
|
134
134
|
query?: string;
|
|
@@ -870,6 +870,15 @@ interface StorageRulesMetadataIR {
|
|
|
870
870
|
interface HttpRouteIR {
|
|
871
871
|
/** `v.*` validators decoding the JSON request body (`.body({...})`), keyed by field. */
|
|
872
872
|
body: Record<string, ValidatorIR>;
|
|
873
|
+
/**
|
|
874
|
+
* Rendered TS type of one SSE chunk — the `R` the `.stream(handler)`
|
|
875
|
+
* handler yields — inferred from the handler via the type checker. Present
|
|
876
|
+
* only when {@link HttpRouteIR.stream} is `true`; `"unknown"` when the
|
|
877
|
+
* checker can't resolve enough context. Feeds the emitted
|
|
878
|
+
* `HttpStreamRef<Chunk, …>` so the chunk type flows to the client.
|
|
879
|
+
* @experimental Part of the HTTP-SSE stream surface (the `httpStreams.*` emission).
|
|
880
|
+
*/
|
|
881
|
+
chunkType?: string;
|
|
873
882
|
/** Export binding name of the route handler (used only for diagnostics / dedupe). */
|
|
874
883
|
exportName: string;
|
|
875
884
|
/** Path relative to `<projectRoot>/lunora/` without extension, e.g. "http". */
|
|
@@ -1968,6 +1977,8 @@ declare const emitDataModel: (schema: SchemaIR, useUmbrella?: boolean) => string
|
|
|
1968
1977
|
interface EmitApiOptions {
|
|
1969
1978
|
agents?: ReadonlyArray<AgentIR>;
|
|
1970
1979
|
functions: ReadonlyArray<FunctionIR>;
|
|
1980
|
+
/** Typed REST routes; only `.stream()` (SSE) routes emit a `httpStreams.*` reference. */
|
|
1981
|
+
httpRoutes?: ReadonlyArray<HttpRouteIR>;
|
|
1971
1982
|
useUmbrella?: boolean;
|
|
1972
1983
|
workflows?: ReadonlyArray<WorkflowIR>;
|
|
1973
1984
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -122,13 +122,13 @@ interface ExternalSourceIR {
|
|
|
122
122
|
binding: string;
|
|
123
123
|
/** Whether a `columns` projection allow-list was given. */
|
|
124
124
|
columns?: ReadonlyArray<string>;
|
|
125
|
-
/** `true` when a `reconcileEveryMs` was given
|
|
125
|
+
/** `true` when a `reconcileEveryMs` was given — reserved for a future incremental mode's delete-visibility lint; not on the typed `.source()` surface today. */
|
|
126
126
|
hasReconcile?: boolean;
|
|
127
127
|
/** `true` when a `tenantBy` mapper was given — the tenant-isolation boundary the `external_source_unscoped` lint checks. */
|
|
128
128
|
hasTenantBy: boolean;
|
|
129
129
|
/** The `idColumn` literal, when given (defaults to `"id"` at runtime). */
|
|
130
130
|
idColumn?: string;
|
|
131
|
-
/** Delete-detection mode literal, when given (`"full-pull"`
|
|
131
|
+
/** Delete-detection mode literal, when given (`"full-pull"` today). */
|
|
132
132
|
mode?: string;
|
|
133
133
|
/** The membership query literal, when statically knowable. */
|
|
134
134
|
query?: string;
|
|
@@ -870,6 +870,15 @@ interface StorageRulesMetadataIR {
|
|
|
870
870
|
interface HttpRouteIR {
|
|
871
871
|
/** `v.*` validators decoding the JSON request body (`.body({...})`), keyed by field. */
|
|
872
872
|
body: Record<string, ValidatorIR>;
|
|
873
|
+
/**
|
|
874
|
+
* Rendered TS type of one SSE chunk — the `R` the `.stream(handler)`
|
|
875
|
+
* handler yields — inferred from the handler via the type checker. Present
|
|
876
|
+
* only when {@link HttpRouteIR.stream} is `true`; `"unknown"` when the
|
|
877
|
+
* checker can't resolve enough context. Feeds the emitted
|
|
878
|
+
* `HttpStreamRef<Chunk, …>` so the chunk type flows to the client.
|
|
879
|
+
* @experimental Part of the HTTP-SSE stream surface (the `httpStreams.*` emission).
|
|
880
|
+
*/
|
|
881
|
+
chunkType?: string;
|
|
873
882
|
/** Export binding name of the route handler (used only for diagnostics / dedupe). */
|
|
874
883
|
exportName: string;
|
|
875
884
|
/** Path relative to `<projectRoot>/lunora/` without extension, e.g. "http". */
|
|
@@ -1968,6 +1977,8 @@ declare const emitDataModel: (schema: SchemaIR, useUmbrella?: boolean) => string
|
|
|
1968
1977
|
interface EmitApiOptions {
|
|
1969
1978
|
agents?: ReadonlyArray<AgentIR>;
|
|
1970
1979
|
functions: ReadonlyArray<FunctionIR>;
|
|
1980
|
+
/** Typed REST routes; only `.stream()` (SSE) routes emit a `httpStreams.*` reference. */
|
|
1981
|
+
httpRoutes?: ReadonlyArray<HttpRouteIR>;
|
|
1971
1982
|
useUmbrella?: boolean;
|
|
1972
1983
|
workflows?: ReadonlyArray<WorkflowIR>;
|
|
1973
1984
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
export { formatAdvisories, lintSchema } from './packem_shared/formatAdvisories-DRhEiJUz.mjs';
|
|
2
2
|
export { CodegenDiagnosticError, diagnosticAt } from './packem_shared/CodegenDiagnosticError-DyQ5FwkM.mjs';
|
|
3
3
|
export { AGENTS_FILENAME, discoverAgents } from './packem_shared/AGENTS_FILENAME-BksnAJgx.mjs';
|
|
4
|
-
export { default as discoverAuthApiCalls } from './packem_shared/discoverAuthApiCalls-
|
|
4
|
+
export { default as discoverAuthApiCalls } from './packem_shared/discoverAuthApiCalls-Dx3K42rk.mjs';
|
|
5
5
|
export { CONTAINERS_FILENAME, discoverContainers } from './packem_shared/CONTAINERS_FILENAME-DjpXMqhp.mjs';
|
|
6
|
-
export { default as discoverCrons } from './packem_shared/discoverCrons-
|
|
7
|
-
export { FLAGS_FILENAME, discoverFlags } from './packem_shared/FLAGS_FILENAME-
|
|
8
|
-
export { discoverFunctions } from './packem_shared/discoverFunctions-
|
|
9
|
-
export { default as discoverHttpRoutes } from './packem_shared/discoverHttpRoutes-
|
|
10
|
-
export { default as discoverInserts } from './packem_shared/discoverInserts-
|
|
11
|
-
export { default as discoverMaskProcedures } from './packem_shared/discoverMaskProcedures-
|
|
12
|
-
export { default as discoverMigrations } from './packem_shared/discoverMigrations-
|
|
6
|
+
export { default as discoverCrons } from './packem_shared/discoverCrons-_aosTRLr.mjs';
|
|
7
|
+
export { FLAGS_FILENAME, discoverFlags } from './packem_shared/FLAGS_FILENAME-Dg4mKUuz.mjs';
|
|
8
|
+
export { discoverFunctions } from './packem_shared/discoverFunctions-BJ-qR7Rg.mjs';
|
|
9
|
+
export { default as discoverHttpRoutes } from './packem_shared/discoverHttpRoutes-daCzuTe8.mjs';
|
|
10
|
+
export { default as discoverInserts } from './packem_shared/discoverInserts-DI4q5NxE.mjs';
|
|
11
|
+
export { default as discoverMaskProcedures } from './packem_shared/discoverMaskProcedures-BcTOEKNU.mjs';
|
|
12
|
+
export { default as discoverMigrations } from './packem_shared/discoverMigrations-VNUFvCwr.mjs';
|
|
13
13
|
export { MUTATORS_FILENAME, discoverMutators } from './packem_shared/MUTATORS_FILENAME-BZOfUhlY.mjs';
|
|
14
|
-
export { default as discoverNondeterministicCalls } from './packem_shared/discoverNondeterministicCalls-
|
|
15
|
-
export { default as discoverQueries } from './packem_shared/discoverQueries-
|
|
14
|
+
export { default as discoverNondeterministicCalls } from './packem_shared/discoverNondeterministicCalls-S0N2xLCq.mjs';
|
|
15
|
+
export { default as discoverQueries } from './packem_shared/discoverQueries-CJnnnLpd.mjs';
|
|
16
16
|
export { QUEUES_FILENAME, discoverQueues } from './packem_shared/QUEUES_FILENAME-Xv6Vy-Ku.mjs';
|
|
17
|
-
export { default as discoverR2sqlCalls } from './packem_shared/discoverR2sqlCalls-
|
|
18
|
-
export { discoverRlsMetadata, default as discoverRlsProcedures } from './packem_shared/discoverRlsMetadata-
|
|
17
|
+
export { default as discoverR2sqlCalls } from './packem_shared/discoverR2sqlCalls-pnpicWfz.mjs';
|
|
18
|
+
export { discoverRlsMetadata, default as discoverRlsProcedures } from './packem_shared/discoverRlsMetadata-DppniPUH.mjs';
|
|
19
19
|
export { default as discoverSchema } from './packem_shared/discoverSchema-DFWVgU5o.mjs';
|
|
20
20
|
export { SHAPES_FILENAME, discoverShapes } from './packem_shared/SHAPES_FILENAME-DOhPGi-6.mjs';
|
|
21
|
-
export { default as discoverStorageRulesMetadata } from './packem_shared/discoverStorageRulesMetadata-
|
|
21
|
+
export { default as discoverStorageRulesMetadata } from './packem_shared/discoverStorageRulesMetadata-CnHl2rXD.mjs';
|
|
22
22
|
export { WORKFLOWS_FILENAME, discoverWorkflows } from './packem_shared/WORKFLOWS_FILENAME-B2By8S4s.mjs';
|
|
23
|
-
export { G as GENERATED_HEADER, e as emitAgents, a as emitApi, b as emitCollections, c as emitContainers, d as emitCrons, f as emitDataModel, g as emitDrizzleSchema, h as emitFunctions, i as emitServer, j as emitShard, k as emitVectors, l as emitWorkflows, m as emitWranglerCronTriggers } from './packem_shared/emit-
|
|
24
|
-
export { emitApp } from './packem_shared/emitApp-
|
|
25
|
-
export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-
|
|
26
|
-
export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-
|
|
27
|
-
export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-
|
|
23
|
+
export { G as GENERATED_HEADER, e as emitAgents, a as emitApi, b as emitCollections, c as emitContainers, d as emitCrons, f as emitDataModel, g as emitDrizzleSchema, h as emitFunctions, i as emitServer, j as emitShard, k as emitVectors, l as emitWorkflows, m as emitWranglerCronTriggers } from './packem_shared/emit-C_29WVlW.mjs';
|
|
24
|
+
export { emitApp } from './packem_shared/emitApp-C9oljiZd.mjs';
|
|
25
|
+
export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-saZ_-kl4.mjs';
|
|
26
|
+
export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-Cyttekkt.mjs';
|
|
27
|
+
export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-CMjGZSa1.mjs';
|
|
28
28
|
export { SCHEMA_SNAPSHOT_VERSION, SchemaSnapshotParseError, buildSchemaSnapshot, diffSchemaSnapshots, evaluateSchemaDrift, parseSchemaSnapshot, serializeSchemaSnapshot } from './packem_shared/SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
|
|
29
29
|
export { schemaFromIr } from './packem_shared/schemaFromIr-DTYsLBaA.mjs';
|
|
30
30
|
export { LUNORA_ERROR_CODES, validatorIrToJsonSchema } from './packem_shared/LUNORA_ERROR_CODES-DvTLozCu.mjs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { SyntaxKind, Node } from 'ts-morph';
|
|
4
|
-
import { listLunoraSourceFiles } from './discoverFunctions-
|
|
4
|
+
import { listLunoraSourceFiles } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
5
5
|
|
|
6
6
|
const FLAGS_FILENAME = "flags.ts";
|
|
7
7
|
const FLAG_TYPES = /* @__PURE__ */ new Set(["boolean", "number", "object", "string"]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '@lunora/agent/component';
|
|
2
2
|
import '@lunora/errors';
|
|
3
|
-
export { G as GENERATED_HEADER, n as buildStorageColumns, e as emitAgents, a as emitApi, b as emitCollections, c as emitContainers, d as emitCrons, f as emitDataModel, g as emitDrizzleSchema, h as emitFunctions, o as emitQueues, p as emitSeed, i as emitServer, j as emitShard, k as emitVectors, l as emitWorkflows, m as emitWranglerCronTriggers } from './emit-
|
|
3
|
+
export { G as GENERATED_HEADER, n as buildStorageColumns, e as emitAgents, a as emitApi, b as emitCollections, c as emitContainers, d as emitCrons, f as emitDataModel, g as emitDrizzleSchema, h as emitFunctions, o as emitQueues, p as emitSeed, i as emitServer, j as emitShard, k as emitVectors, l as emitWorkflows, m as emitWranglerCronTriggers } from './emit-C_29WVlW.mjs';
|
|
4
4
|
import './paths-BRd6JHuF.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GENERATED_HEADER } from './emit-
|
|
1
|
+
import { G as GENERATED_HEADER } from './emit-C_29WVlW.mjs';
|
|
2
2
|
import { s as sanitizeNamespace } from './paths-BRd6JHuF.mjs';
|
|
3
3
|
import { argsObjectSchema, LUNORA_ERROR_CODES } from './LUNORA_ERROR_CODES-DvTLozCu.mjs';
|
|
4
4
|
|
|
@@ -4,33 +4,33 @@ import { performance } from 'node:perf_hooks';
|
|
|
4
4
|
import { LunoraError } from '@lunora/errors';
|
|
5
5
|
import { Node, SyntaxKind, Project } from 'ts-morph';
|
|
6
6
|
import { lintSchema } from './formatAdvisories-DRhEiJUz.mjs';
|
|
7
|
-
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall, inlineHandler as inlineHandler$1, procedureHandler, chainUsesWrappedCall, isDatabaseAccessor, chainHasStep, discoverFunctions } from './discoverFunctions-
|
|
7
|
+
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall, inlineHandler as inlineHandler$1, procedureHandler, chainUsesWrappedCall, isDatabaseAccessor, chainHasStep, discoverFunctions } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
8
8
|
import { discoverAgents } from './AGENTS_FILENAME-BksnAJgx.mjs';
|
|
9
|
-
import discoverAuthApiCalls from './discoverAuthApiCalls-
|
|
9
|
+
import discoverAuthApiCalls from './discoverAuthApiCalls-Dx3K42rk.mjs';
|
|
10
10
|
import { discoverContainers } from './CONTAINERS_FILENAME-DjpXMqhp.mjs';
|
|
11
|
-
import discoverCrons from './discoverCrons-
|
|
11
|
+
import discoverCrons from './discoverCrons-_aosTRLr.mjs';
|
|
12
12
|
import { diagnosticAt } from './CodegenDiagnosticError-DyQ5FwkM.mjs';
|
|
13
|
-
import { C as CAPABILITIES, n as buildStorageColumns, f as emitDataModel, a as emitApi, i as emitServer, h as emitFunctions, j as emitShard, b as emitCollections, c as emitContainers, l as emitWorkflows, e as emitAgents, o as emitQueues, d as emitCrons, k as emitVectors, g as emitDrizzleSchema, p as emitSeed, m as emitWranglerCronTriggers } from './emit-
|
|
14
|
-
import { discoverFlagKeys } from './FLAGS_FILENAME-
|
|
15
|
-
import discoverHttpRoutes from './discoverHttpRoutes-
|
|
16
|
-
import discoverInserts from './discoverInserts-
|
|
17
|
-
import discoverMaskProcedures, { discoverMaskStrategies, discoverMaskMetadata } from './discoverMaskProcedures-
|
|
18
|
-
import discoverMigrations from './discoverMigrations-
|
|
13
|
+
import { C as CAPABILITIES, n as buildStorageColumns, f as emitDataModel, a as emitApi, i as emitServer, h as emitFunctions, j as emitShard, b as emitCollections, c as emitContainers, l as emitWorkflows, e as emitAgents, o as emitQueues, d as emitCrons, k as emitVectors, g as emitDrizzleSchema, p as emitSeed, m as emitWranglerCronTriggers } from './emit-C_29WVlW.mjs';
|
|
14
|
+
import { discoverFlagKeys } from './FLAGS_FILENAME-Dg4mKUuz.mjs';
|
|
15
|
+
import discoverHttpRoutes from './discoverHttpRoutes-daCzuTe8.mjs';
|
|
16
|
+
import discoverInserts from './discoverInserts-DI4q5NxE.mjs';
|
|
17
|
+
import discoverMaskProcedures, { discoverMaskStrategies, discoverMaskMetadata } from './discoverMaskProcedures-BcTOEKNU.mjs';
|
|
18
|
+
import discoverMigrations from './discoverMigrations-VNUFvCwr.mjs';
|
|
19
19
|
import { MUTATORS_FILENAME, isDefineMutatorCallee, discoverMutators } from './MUTATORS_FILENAME-BZOfUhlY.mjs';
|
|
20
|
-
import discoverNondeterministicCalls from './discoverNondeterministicCalls-
|
|
21
|
-
import discoverQueries from './discoverQueries-
|
|
20
|
+
import discoverNondeterministicCalls from './discoverNondeterministicCalls-S0N2xLCq.mjs';
|
|
21
|
+
import discoverQueries from './discoverQueries-CJnnnLpd.mjs';
|
|
22
22
|
import { discoverQueues } from './QUEUES_FILENAME-Xv6Vy-Ku.mjs';
|
|
23
|
-
import discoverR2sqlCalls from './discoverR2sqlCalls-
|
|
24
|
-
import discoverRlsProcedures, { discoverRlsMetadata } from './discoverRlsMetadata-
|
|
23
|
+
import discoverR2sqlCalls from './discoverR2sqlCalls-pnpicWfz.mjs';
|
|
24
|
+
import discoverRlsProcedures, { discoverRlsMetadata } from './discoverRlsMetadata-DppniPUH.mjs';
|
|
25
25
|
import discoverSchema from './discoverSchema-DFWVgU5o.mjs';
|
|
26
26
|
import { secretKindOf, redact } from './redact-oTmsol5A.mjs';
|
|
27
27
|
import { discoverShapes } from './SHAPES_FILENAME-DOhPGi-6.mjs';
|
|
28
|
-
import discoverStorageRulesMetadata from './discoverStorageRulesMetadata-
|
|
28
|
+
import discoverStorageRulesMetadata from './discoverStorageRulesMetadata-CnHl2rXD.mjs';
|
|
29
29
|
import { e as enclosingExportName$2 } from './discover-ast-CT6BgBr4.mjs';
|
|
30
30
|
import { discoverWorkflows } from './WORKFLOWS_FILENAME-B2By8S4s.mjs';
|
|
31
|
-
import { emitApp } from './emitApp-
|
|
32
|
-
import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-
|
|
33
|
-
import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-
|
|
31
|
+
import { emitApp } from './emitApp-C9oljiZd.mjs';
|
|
32
|
+
import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-saZ_-kl4.mjs';
|
|
33
|
+
import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-Cyttekkt.mjs';
|
|
34
34
|
import { buildSchemaSnapshot, serializeSchemaSnapshot } from './SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
|
|
35
35
|
|
|
36
36
|
const HTTP_VERBS$1 = /* @__PURE__ */ new Set(["delete", "get", "head", "options", "patch", "post", "put"]);
|
|
@@ -3288,7 +3288,7 @@ const runCodegen = (options) => {
|
|
|
3288
3288
|
const useUmbrella = dependencies.has("lunorash");
|
|
3289
3289
|
const emitStartedAt = timingEnabled ? performance.now() : 0;
|
|
3290
3290
|
const dataModelContent = emitDataModel(schema, useUmbrella);
|
|
3291
|
-
const apiContent = emitApi({ agents, functions, useUmbrella, workflows });
|
|
3291
|
+
const apiContent = emitApi({ agents, functions, httpRoutes, useUmbrella, workflows });
|
|
3292
3292
|
const serverContent = emitServer({
|
|
3293
3293
|
agents,
|
|
3294
3294
|
containers,
|
package/dist/packem_shared/{buildOpenApiDocument-BrN41JMl.mjs → buildOpenApiDocument-saZ_-kl4.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GENERATED_HEADER } from './emit-
|
|
1
|
+
import { G as GENERATED_HEADER } from './emit-C_29WVlW.mjs';
|
|
2
2
|
import { s as sanitizeNamespace } from './paths-BRd6JHuF.mjs';
|
|
3
3
|
import { LUNORA_ERROR_CODES, objectSchema, argsObjectSchema, validatorIrToJsonSchema } from './LUNORA_ERROR_CODES-DvTLozCu.mjs';
|
|
4
4
|
|
package/dist/packem_shared/{discoverAuthApiCalls-WMx8L2FG.mjs → discoverAuthApiCalls-Dx3K42rk.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relative, sep } from 'node:path';
|
|
2
2
|
import { SyntaxKind, Node } from 'ts-morph';
|
|
3
3
|
import { T as TS_EXTENSION_RE, e as enclosingExportName } from './discover-ast-CT6BgBr4.mjs';
|
|
4
|
-
import { listLunoraSourceFiles } from './discoverFunctions-
|
|
4
|
+
import { listLunoraSourceFiles } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
5
5
|
|
|
6
6
|
const isAuthApiCall = (call) => {
|
|
7
7
|
const callee = call.getExpression();
|
|
@@ -2,7 +2,7 @@ import { LunoraError } from '@lunora/errors';
|
|
|
2
2
|
import { isValidCronExpression, compileCronSchedule, CRON_SCHEDULE_KINDS } from '@lunora/scheduler';
|
|
3
3
|
import { SyntaxKind, Node } from 'ts-morph';
|
|
4
4
|
import { diagnosticAt } from './CodegenDiagnosticError-DyQ5FwkM.mjs';
|
|
5
|
-
import { listLunoraSourceFiles } from './discoverFunctions-
|
|
5
|
+
import { listLunoraSourceFiles } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
6
6
|
import { s as sanitizeNamespace } from './paths-BRd6JHuF.mjs';
|
|
7
7
|
|
|
8
8
|
const CRON_METHODS = /* @__PURE__ */ new Set([...CRON_SCHEDULE_KINDS, "cron"]);
|
package/dist/packem_shared/{discoverFunctions-CZ91aenA.mjs → discoverFunctions-BJ-qR7Rg.mjs}
RENAMED
|
@@ -515,4 +515,4 @@ const discoverFunctions = (project, lunoraDirectory) => {
|
|
|
515
515
|
return functions;
|
|
516
516
|
};
|
|
517
517
|
|
|
518
|
-
export { chainHasStep, chainUsesWrappedCall, classifyProcedureCall, discoverFunctions, inlineHandler, isDatabaseAccessor, listLunoraSourceFiles, lunoraRelativePath, procedureHandler };
|
|
518
|
+
export { chainHasStep, chainUsesWrappedCall, classifyProcedureCall, discoverFunctions, inlineHandler, isDatabaseAccessor, listLunoraSourceFiles, lunoraRelativePath, procedureHandler, unwrapHandlerReturn };
|
package/dist/packem_shared/{discoverHttpRoutes-DNZLDCmm.mjs → discoverHttpRoutes-daCzuTe8.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { relative, sep } from 'node:path';
|
|
2
2
|
import { Node } from 'ts-morph';
|
|
3
|
-
import { listLunoraSourceFiles } from './discoverFunctions-
|
|
3
|
+
import { listLunoraSourceFiles, unwrapHandlerReturn } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
4
4
|
import { p as parseValidator, a as parseObjectShape } from './parse-validator-BSJo1HGP.mjs';
|
|
5
5
|
|
|
6
6
|
const TS_EXTENSION_RE = /\.ts$/u;
|
|
@@ -72,6 +72,13 @@ const walkRouteChain = (terminalCall, terminalStep) => {
|
|
|
72
72
|
state.path = root.path;
|
|
73
73
|
return state;
|
|
74
74
|
};
|
|
75
|
+
const chunkTypeFromStreamTerminal = (call) => {
|
|
76
|
+
const handler = call.getArguments()[0];
|
|
77
|
+
if (!handler || !(Node.isArrowFunction(handler) || Node.isFunctionExpression(handler))) {
|
|
78
|
+
return "unknown";
|
|
79
|
+
}
|
|
80
|
+
return unwrapHandlerReturn(handler);
|
|
81
|
+
};
|
|
75
82
|
const routeFromTerminal = (call, callee, exportName, filePath) => {
|
|
76
83
|
const step = callee.getName();
|
|
77
84
|
if (!TERMINAL_STEPS.has(step)) {
|
|
@@ -90,6 +97,7 @@ const routeFromTerminal = (call, callee, exportName, filePath) => {
|
|
|
90
97
|
path: state.path,
|
|
91
98
|
searchParams: state.searchParams,
|
|
92
99
|
stream: state.stream,
|
|
100
|
+
...state.stream ? { chunkType: chunkTypeFromStreamTerminal(call) } : {},
|
|
93
101
|
...state.output ? { output: state.output } : {}
|
|
94
102
|
};
|
|
95
103
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SyntaxKind, Node } from 'ts-morph';
|
|
2
2
|
import { e as enclosingExportName } from './discover-ast-CT6BgBr4.mjs';
|
|
3
|
-
import { listLunoraSourceFiles, lunoraRelativePath } from './discoverFunctions-
|
|
3
|
+
import { listLunoraSourceFiles, lunoraRelativePath } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
4
4
|
|
|
5
5
|
const isDatabaseInsertCall = (call) => {
|
|
6
6
|
const callee = call.getExpression();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, SyntaxKind } from 'ts-morph';
|
|
2
|
-
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-
|
|
2
|
+
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
3
3
|
|
|
4
4
|
const isMaskCall = (node) => {
|
|
5
5
|
if (!Node.isCallExpression(node)) {
|
package/dist/packem_shared/{discoverMigrations-CdKtMlBc.mjs → discoverMigrations-VNUFvCwr.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { relative, sep } from 'node:path';
|
|
2
2
|
import { SyntaxKind, Node } from 'ts-morph';
|
|
3
3
|
import { diagnosticAt } from './CodegenDiagnosticError-DyQ5FwkM.mjs';
|
|
4
|
-
import { listLunoraSourceFiles } from './discoverFunctions-
|
|
4
|
+
import { listLunoraSourceFiles } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
5
5
|
|
|
6
6
|
const TS_EXTENSION_RE = /\.ts$/u;
|
|
7
7
|
const isDefineMigration = (identifier) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, SyntaxKind } from 'ts-morph';
|
|
2
|
-
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-
|
|
2
|
+
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
3
3
|
|
|
4
4
|
const PROPERTY_CALLS = {
|
|
5
5
|
"crypto.getRandomValues": "crypto.getRandomValues",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SyntaxKind, Node } from 'ts-morph';
|
|
2
|
-
import { listLunoraSourceFiles, lunoraRelativePath } from './discoverFunctions-
|
|
2
|
+
import { listLunoraSourceFiles, lunoraRelativePath } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
3
3
|
|
|
4
4
|
const INDEX_METHODS = /* @__PURE__ */ new Set(["withIndex", "withSearchIndex"]);
|
|
5
5
|
const isDatabaseQueryCall = (call) => {
|
package/dist/packem_shared/{discoverR2sqlCalls-Bm7Rfnf4.mjs → discoverR2sqlCalls-pnpicWfz.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, SyntaxKind } from 'ts-morph';
|
|
2
|
-
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-
|
|
2
|
+
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
3
3
|
|
|
4
4
|
const handlerOf = (call, receiver) => {
|
|
5
5
|
if (receiver) {
|
package/dist/packem_shared/{discoverRlsMetadata-B4GL4ZKm.mjs → discoverRlsMetadata-DppniPUH.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, SyntaxKind } from 'ts-morph';
|
|
2
|
-
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-
|
|
2
|
+
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
3
3
|
|
|
4
4
|
const isRlsCall = (node) => {
|
|
5
5
|
if (!Node.isCallExpression(node)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node } from 'ts-morph';
|
|
2
|
-
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-
|
|
2
|
+
import { listLunoraSourceFiles, lunoraRelativePath, classifyProcedureCall } from './discoverFunctions-BJ-qR7Rg.mjs';
|
|
3
3
|
|
|
4
4
|
const STORAGE_OPERATIONS = /* @__PURE__ */ new Set(["delete", "list", "read", "write"]);
|
|
5
5
|
const isStorageRulesCall = (node) => {
|
|
@@ -865,15 +865,58 @@ const syntheticAgentApiFunctions = (agents, functions) => {
|
|
|
865
865
|
}
|
|
866
866
|
return definitions.filter((definition) => !taken.has(definition.exportName));
|
|
867
867
|
};
|
|
868
|
+
const renderHttpStreamsRef = (httpRoutes) => {
|
|
869
|
+
const streams = httpRoutes.filter((route) => route.stream);
|
|
870
|
+
if (streams.length === 0) {
|
|
871
|
+
return { block: "", body: "" };
|
|
872
|
+
}
|
|
873
|
+
const namespaces = /* @__PURE__ */ new Map();
|
|
874
|
+
for (const route of streams) {
|
|
875
|
+
const list = namespaces.get(route.filePath) ?? [];
|
|
876
|
+
list.push(route);
|
|
877
|
+
namespaces.set(route.filePath, list);
|
|
878
|
+
}
|
|
879
|
+
const sortedNamespaces = [...namespaces.entries()].toSorted(([a], [b]) => a.localeCompare(b));
|
|
880
|
+
const typeBody = sortedNamespaces.map(([file, list]) => {
|
|
881
|
+
const members = list.map((route) => {
|
|
882
|
+
const chunkType = relocateGeneratedImports(route.chunkType ?? "unknown");
|
|
883
|
+
return ` ${renderPropertyKey(route.exportName)}: HttpStreamRef<${chunkType}, ${renderArgsType(route.searchParams)}, ${renderArgsType(route.params)}>;`;
|
|
884
|
+
}).join("\n");
|
|
885
|
+
return ` ${renderPropertyKey(sanitizeNamespace(file))}: {
|
|
886
|
+
${members}
|
|
887
|
+
};`;
|
|
888
|
+
}).join("\n");
|
|
889
|
+
const valueBody = sortedNamespaces.map(([file, list]) => {
|
|
890
|
+
const members = list.map(
|
|
891
|
+
(route) => ` ${renderPropertyKey(route.exportName)}: { method: ${JSON.stringify(route.method)}, path: ${JSON.stringify(route.path)} },`
|
|
892
|
+
).join("\n");
|
|
893
|
+
return ` ${renderPropertyKey(sanitizeNamespace(file))}: {
|
|
894
|
+
${members}
|
|
895
|
+
},`;
|
|
896
|
+
}).join("\n");
|
|
897
|
+
const block = `
|
|
898
|
+
/** This project's HTTP-SSE stream routes (\`httpRoute.<verb>(path).stream()\`), addressable as typed references for \`client.httpStream\` / \`useHttpStream\`. */
|
|
899
|
+
export interface HttpStreamsRef {
|
|
900
|
+
${typeBody}
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
export const httpStreams: HttpStreamsRef = {
|
|
904
|
+
${valueBody}
|
|
905
|
+
};
|
|
906
|
+
`;
|
|
907
|
+
return { block, body: typeBody };
|
|
908
|
+
};
|
|
868
909
|
const emitApi = (options) => {
|
|
869
|
-
const { agents = [], functions, useUmbrella = false, workflows = [] } = options;
|
|
910
|
+
const { agents = [], functions, httpRoutes = [], useUmbrella = false, workflows = [] } = options;
|
|
870
911
|
const base = baseSpecifiers(useUmbrella);
|
|
871
912
|
const publicFunctions = [...functions.filter((definition) => definition.visibility !== "internal"), ...syntheticAgentApiFunctions(agents, functions)];
|
|
872
913
|
const internalFunctions = functions.filter((definition) => definition.visibility === "internal");
|
|
873
914
|
const publicBody = renderApiBody(publicFunctions);
|
|
874
915
|
const internalBody = renderApiBody(internalFunctions);
|
|
916
|
+
const httpStreamsRef = renderHttpStreamsRef(httpRoutes);
|
|
875
917
|
const combinedBody = `${publicBody}
|
|
876
|
-
${internalBody}
|
|
918
|
+
${internalBody}
|
|
919
|
+
${httpStreamsRef.body}`;
|
|
877
920
|
const dataModelImports = referencedDataModelImports(combinedBody);
|
|
878
921
|
const dataModelImportLine = dataModelImports.length > 0 ? `
|
|
879
922
|
import type { ${dataModelImports.join(", ")} } from "./dataModel.js";
|
|
@@ -885,8 +928,9 @@ ${publicBody}
|
|
|
885
928
|
${internalBody}
|
|
886
929
|
` : "";
|
|
887
930
|
const schedulerReferences = renderSchedulerReferences(workflows, agents);
|
|
931
|
+
const clientImports = httpStreamsRef.block === "" ? "FunctionReference" : "FunctionReference, HttpStreamRef";
|
|
888
932
|
return `${GENERATED_HEADER}import { anyApi } from "${base.serverTypes}";
|
|
889
|
-
import type {
|
|
933
|
+
import type { ${clientImports} } from "${base.client}";
|
|
890
934
|
${schedulerReferences.importLine}${dataModelImportLine}
|
|
891
935
|
export interface ApiTypes {${apiBlock}}
|
|
892
936
|
|
|
@@ -896,7 +940,7 @@ export const api = anyApi as unknown as ApiTypes;
|
|
|
896
940
|
export interface InternalApiTypes {${internalBlock}}
|
|
897
941
|
|
|
898
942
|
export const internal = anyApi as unknown as InternalApiTypes;
|
|
899
|
-
${schedulerReferences.block}`;
|
|
943
|
+
${schedulerReferences.block}${httpStreamsRef.block}`;
|
|
900
944
|
};
|
|
901
945
|
const emitSeed = (enabled) => {
|
|
902
946
|
if (!enabled) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as APP_METHOD_CAPABILITIES, G as GENERATED_HEADER } from './emit-
|
|
1
|
+
import { A as APP_METHOD_CAPABILITIES, G as GENERATED_HEADER } from './emit-C_29WVlW.mjs';
|
|
2
2
|
|
|
3
3
|
const hasFlagKey = (key) => `has${key.charAt(0).toUpperCase()}${key.slice(1)}`;
|
|
4
4
|
const LONG_TAIL = APP_METHOD_CAPABILITIES.map(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/codegen",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.44",
|
|
4
4
|
"description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
50
|
-
"@lunora/agent": "1.0.0-alpha.
|
|
51
|
-
"@lunora/container": "1.0.0-alpha.
|
|
52
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
53
|
-
"@lunora/queue": "1.0.0-alpha.
|
|
54
|
-
"@lunora/scheduler": "1.0.0-alpha.
|
|
55
|
-
"@lunora/values": "1.0.0-alpha.
|
|
56
|
-
"@lunora/workflow": "1.0.0-alpha.
|
|
49
|
+
"@lunora/advisor": "1.0.0-alpha.28",
|
|
50
|
+
"@lunora/agent": "1.0.0-alpha.2",
|
|
51
|
+
"@lunora/container": "1.0.0-alpha.12",
|
|
52
|
+
"@lunora/errors": "1.0.0-alpha.5",
|
|
53
|
+
"@lunora/queue": "1.0.0-alpha.8",
|
|
54
|
+
"@lunora/scheduler": "1.0.0-alpha.10",
|
|
55
|
+
"@lunora/values": "1.0.0-alpha.8",
|
|
56
|
+
"@lunora/workflow": "1.0.0-alpha.10",
|
|
57
57
|
"ts-morph": "^28.0.0"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|