@lunora/codegen 1.0.0-alpha.46 → 1.0.0-alpha.48

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.mjs CHANGED
@@ -21,11 +21,11 @@ export { default as discoverSchema } from './packem_shared/discoverSchema-BaSAvo
21
21
  export { SHAPES_FILENAME, discoverShapes } from './packem_shared/SHAPES_FILENAME-DOhPGi-6.mjs';
22
22
  export { default as discoverStorageRulesMetadata } from './packem_shared/discoverStorageRulesMetadata-CnHl2rXD.mjs';
23
23
  export { WORKFLOWS_FILENAME, discoverWorkflows } from './packem_shared/WORKFLOWS_FILENAME-Dtuzvluc.mjs';
24
- 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-DzOk6uuP.mjs';
25
- export { emitApp } from './packem_shared/emitApp-DDXi_E8N.mjs';
26
- export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-5t2Tpo16.mjs';
27
- export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-DYr4zeJA.mjs';
28
- export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-JnnVthcj.mjs';
24
+ 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-ClTbCLy4.mjs';
25
+ export { emitApp } from './packem_shared/emitApp-B6ophCIq.mjs';
26
+ export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-B7mEdzA2.mjs';
27
+ export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-7A2weq2u.mjs';
28
+ export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-D69m0Plv.mjs';
29
29
  export { SCHEMA_SNAPSHOT_VERSION, SchemaSnapshotParseError, buildSchemaSnapshot, diffSchemaSnapshots, evaluateSchemaDrift, parseSchemaSnapshot, serializeSchemaSnapshot } from './packem_shared/SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
30
30
  export { schemaFromIr } from './packem_shared/schemaFromIr-DTYsLBaA.mjs';
31
31
  export { LUNORA_ERROR_CODES, validatorIrToJsonSchema } from './packem_shared/LUNORA_ERROR_CODES-DvTLozCu.mjs';
@@ -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-DzOk6uuP.mjs';
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-ClTbCLy4.mjs';
4
4
  import './paths-BRd6JHuF.mjs';
@@ -1,4 +1,4 @@
1
- import { G as GENERATED_HEADER } from './emit-DzOk6uuP.mjs';
1
+ import { G as GENERATED_HEADER } from './emit-ClTbCLy4.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
 
@@ -10,7 +10,7 @@ import discoverAuthApiCalls from './discoverAuthApiCalls-Dx3K42rk.mjs';
10
10
  import { discoverContainers } from './CONTAINERS_FILENAME-DjpXMqhp.mjs';
11
11
  import discoverCrons from './discoverCrons-DvqkEWdx.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-DzOk6uuP.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-ClTbCLy4.mjs';
14
14
  import { discoverFlagKeys } from './FLAGS_FILENAME-Dg4mKUuz.mjs';
15
15
  import discoverHttpRoutes from './discoverHttpRoutes-daCzuTe8.mjs';
16
16
  import discoverInserts from './discoverInserts-DI4q5NxE.mjs';
@@ -29,9 +29,9 @@ import { discoverShapes } from './SHAPES_FILENAME-DOhPGi-6.mjs';
29
29
  import discoverStorageRulesMetadata from './discoverStorageRulesMetadata-CnHl2rXD.mjs';
30
30
  import { e as enclosingExportName$2 } from './discover-ast-CT6BgBr4.mjs';
31
31
  import { discoverWorkflows } from './WORKFLOWS_FILENAME-Dtuzvluc.mjs';
32
- import { emitApp } from './emitApp-DDXi_E8N.mjs';
33
- import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-5t2Tpo16.mjs';
34
- import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-DYr4zeJA.mjs';
32
+ import { emitApp } from './emitApp-B6ophCIq.mjs';
33
+ import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-B7mEdzA2.mjs';
34
+ import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-7A2weq2u.mjs';
35
35
  import { buildSchemaSnapshot, serializeSchemaSnapshot } from './SCHEMA_SNAPSHOT_VERSION-D0ARY6rL.mjs';
36
36
 
37
37
  const HTTP_VERBS$1 = /* @__PURE__ */ new Set(["delete", "get", "head", "options", "patch", "post", "put"]);
@@ -1,4 +1,4 @@
1
- import { G as GENERATED_HEADER } from './emit-DzOk6uuP.mjs';
1
+ import { G as GENERATED_HEADER } from './emit-ClTbCLy4.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
 
@@ -3496,19 +3496,20 @@ ${vectorsBuild}${aiBuild}${everyContextBuild}${containersBuild}${workflowsBuild}
3496
3496
  const storage = asBucketStorage(config.storage?.(env) ?? storageStub) as unknown as SystemReaderStorageLike;
3497
3497
  ${globalDatabaseLine} const db: DatabaseWriterLike = createShardCtxDb(${databaseOptions});
3498
3498
  ${facadeBlock}${paymentsBuild}
3499
- // \`ctx.log\`: each call is captured + attributed to the executing
3500
- // function and routed to the optional \`observability\` sink. The DO base
3501
- // also buffers it (studio Logs panel) and emits a structured console
3502
- // event the dev-server formats in the terminal.
3499
+ // \`ctx.log\`: the DO base builds the attributed logger (structured
3500
+ // fields + \`.with(...)\` child + trace correlation) and routes each call
3501
+ // to the optional \`observability\` sink. It also buffers the line (studio
3502
+ // Logs panel) and emits a structured console event the dev-server formats.
3503
3503
  const observability = config.observability?.(env);
3504
3504
  const logFunctionPath = options.functionPath ?? "";
3505
- const log = {
3506
- debug: (...args: unknown[]) => { this.recordUserLog(logFunctionPath, "debug", args, observability); },
3507
- error: (...args: unknown[]) => { this.recordUserLog(logFunctionPath, "error", args, observability); },
3508
- info: (...args: unknown[]) => { this.recordUserLog(logFunctionPath, "info", args, observability); },
3509
- log: (...args: unknown[]) => { this.recordUserLog(logFunctionPath, "log", args, observability); },
3510
- warn: (...args: unknown[]) => { this.recordUserLog(logFunctionPath, "warn", args, observability); },
3511
- };
3505
+ const log = this.makeLogger(logFunctionPath, observability);
3506
+
3507
+ // \`ctx.trace\` / \`ctx.metrics\`: spans and measurements to the same sink.
3508
+ // The trace anchor is threaded explicitly for the same reason \`identity\`
3509
+ // is a deferred caller (a subscription re-run) must not inherit the
3510
+ // writing mutation's trace from the shared per-request field.
3511
+ const trace = this.makeTracer(logFunctionPath, observability, options.identity ? undefined : this.getCurrentTrace());
3512
+ const metrics = this.makeMetrics(logFunctionPath, observability);
3512
3513
 
3513
3514
  // \`ctx.now\`: the wall-clock instant (epoch ms) this function began,
3514
3515
  // captured ONCE so the whole handler body sees a single stable value.
@@ -3527,9 +3528,11 @@ ${facadeBlock}${paymentsBuild}
3527
3528
  fetch: globalThis.fetch.bind(globalThis),
3528
3529
  ip: this.getCurrentIp(),
3529
3530
  log,
3531
+ metrics,
3530
3532
  now,${ormContextField}
3531
3533
  scheduler,
3532
- storage,${vectorsContextField}${aiContextField}${everyContextField}${paymentsContextField}${containersContextField}${workflowsContextField}${queuesContextField}${agentsContextField}
3534
+ storage,
3535
+ trace,${vectorsContextField}${aiContextField}${everyContextField}${paymentsContextField}${containersContextField}${workflowsContextField}${queuesContextField}${agentsContextField}
3533
3536
  };
3534
3537
  ${isActionLine}${actionOnlyBlock}
3535
3538
  ctx.runAction = (reference: FunctionReference, fnArgs: Record<string, unknown>) => dispatchRun("action", reference.__lunoraRef, fnArgs, ctx);
@@ -1,4 +1,4 @@
1
- import { A as APP_METHOD_CAPABILITIES, G as GENERATED_HEADER } from './emit-DzOk6uuP.mjs';
1
+ import { A as APP_METHOD_CAPABILITIES, G as GENERATED_HEADER } from './emit-ClTbCLy4.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.46",
3
+ "version": "1.0.0-alpha.48",
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.30",
50
- "@lunora/agent": "1.0.0-alpha.4",
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",
49
+ "@lunora/advisor": "1.0.0-alpha.32",
50
+ "@lunora/agent": "1.0.0-alpha.6",
51
+ "@lunora/container": "1.0.0-alpha.13",
52
+ "@lunora/errors": "1.0.0-alpha.6",
53
+ "@lunora/queue": "1.0.0-alpha.9",
54
+ "@lunora/scheduler": "1.0.0-alpha.11",
55
+ "@lunora/values": "1.0.0-alpha.9",
56
+ "@lunora/workflow": "1.0.0-alpha.11",
57
57
  "ts-morph": "^28.0.0"
58
58
  },
59
59
  "engines": {