@lunora/codegen 1.0.0-alpha.47 → 1.0.0-alpha.49

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-CpcoK10Y.mjs';
25
- export { emitApp } from './packem_shared/emitApp-DknqEU1p.mjs';
26
- export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-Cv4Mg1kd.mjs';
27
- export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-5mpS55nb.mjs';
28
- export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-Dx31MtBY.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-CzzrjVqH.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-G5dkcxPR.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-CpcoK10Y.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-CpcoK10Y.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-CpcoK10Y.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-DknqEU1p.mjs';
33
- import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-Cv4Mg1kd.mjs';
34
- import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-5mpS55nb.mjs';
32
+ import { emitApp } from './emitApp-CzzrjVqH.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-CpcoK10Y.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
 
@@ -3504,6 +3504,13 @@ ${facadeBlock}${paymentsBuild}
3504
3504
  const logFunctionPath = options.functionPath ?? "";
3505
3505
  const log = this.makeLogger(logFunctionPath, observability);
3506
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);
3513
+
3507
3514
  // \`ctx.now\`: the wall-clock instant (epoch ms) this function began,
3508
3515
  // captured ONCE so the whole handler body sees a single stable value.
3509
3516
  // Query/mutation handlers must be deterministic (they may be re-run on
@@ -3521,9 +3528,11 @@ ${facadeBlock}${paymentsBuild}
3521
3528
  fetch: globalThis.fetch.bind(globalThis),
3522
3529
  ip: this.getCurrentIp(),
3523
3530
  log,
3531
+ metrics,
3524
3532
  now,${ormContextField}
3525
3533
  scheduler,
3526
- storage,${vectorsContextField}${aiContextField}${everyContextField}${paymentsContextField}${containersContextField}${workflowsContextField}${queuesContextField}${agentsContextField}
3534
+ storage,
3535
+ trace,${vectorsContextField}${aiContextField}${everyContextField}${paymentsContextField}${containersContextField}${workflowsContextField}${queuesContextField}${agentsContextField}
3527
3536
  };
3528
3537
  ${isActionLine}${actionOnlyBlock}
3529
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-CpcoK10Y.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(
@@ -41,6 +41,7 @@ const buildImportLines = (options) => {
41
41
  const runtimeValueImports = [
42
42
  ...hasGlobal || hasHyperdriveGlobal ? ["createCrossShardRelationCapabilities"] : [],
43
43
  "createWorker",
44
+ "resolveLogArchiveFromEnv",
44
45
  ...hasFramework ? ["withFrameworkWorker"] : []
45
46
  ].join(", ");
46
47
  return [
@@ -351,6 +352,11 @@ const buildWorkerOptionLines = (options) => [
351
352
  // with no manual `createKvIntrospector` call. A deployment with no KV binding
352
353
  // yields an empty namespace list rather than crashing.
353
354
  ...options.hasKv ? [` options.kvIntrospector = createKvIntrospectorFromEnv(env);`] : [],
355
+ // The studio's Logs → Archive feed is wired zero-config: when the operator sets
356
+ // `LUNORA_LOG_ARCHIVE_TABLE` (the R2 Data Catalog table `pipelineLogSink` writes
357
+ // to), the durable archive becomes readable; unset ⇒ `undefined` ⇒ the feed
358
+ // reports "not configured". The R2 SQL credentials come from `R2_SQL_*` env vars.
359
+ ` options.logArchive = resolveLogArchiveFromEnv(env);`,
354
360
  ...options.hasAuth ? [
355
361
  ` if (this.authDeclaration) {
356
362
  options.authHandler = (request) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.47",
3
+ "version": "1.0.0-alpha.49",
4
4
  "description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -46,8 +46,8 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@lunora/advisor": "1.0.0-alpha.31",
50
- "@lunora/agent": "1.0.0-alpha.5",
49
+ "@lunora/advisor": "1.0.0-alpha.32",
50
+ "@lunora/agent": "1.0.0-alpha.6",
51
51
  "@lunora/container": "1.0.0-alpha.13",
52
52
  "@lunora/errors": "1.0.0-alpha.6",
53
53
  "@lunora/queue": "1.0.0-alpha.9",