@lunora/codegen 1.0.0-alpha.44 → 1.0.0-alpha.45

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 CHANGED
@@ -122,8 +122,10 @@ 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 — reserved for a future incremental mode's delete-visibility lint; not on the typed `.source()` surface today. */
125
+ /** `true` when a `reconcileEveryMs` was given — one of the two incremental delete-visibility paths the `external_source_incremental_no_delete_path` lint checks. */
126
126
  hasReconcile?: boolean;
127
+ /** `true` when a `softDeleteColumn` was given — the other incremental delete-visibility path. */
128
+ hasSoftDelete?: boolean;
127
129
  /** `true` when a `tenantBy` mapper was given — the tenant-isolation boundary the `external_source_unscoped` lint checks. */
128
130
  hasTenantBy: boolean;
129
131
  /** The `idColumn` literal, when given (defaults to `"id"` at runtime). */
package/dist/index.d.ts CHANGED
@@ -122,8 +122,10 @@ 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 — reserved for a future incremental mode's delete-visibility lint; not on the typed `.source()` surface today. */
125
+ /** `true` when a `reconcileEveryMs` was given — one of the two incremental delete-visibility paths the `external_source_incremental_no_delete_path` lint checks. */
126
126
  hasReconcile?: boolean;
127
+ /** `true` when a `softDeleteColumn` was given — the other incremental delete-visibility path. */
128
+ hasSoftDelete?: boolean;
127
129
  /** `true` when a `tenantBy` mapper was given — the tenant-isolation boundary the `external_source_unscoped` lint checks. */
128
130
  hasTenantBy: boolean;
129
131
  /** The `idColumn` literal, when given (defaults to `"id"` at runtime). */
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { formatAdvisories, lintSchema } from './packem_shared/formatAdvisories-DRhEiJUz.mjs';
1
+ export { formatAdvisories, lintSchema } from './packem_shared/formatAdvisories-BmF7Mplc.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
4
  export { default as discoverAuthApiCalls } from './packem_shared/discoverAuthApiCalls-Dx3K42rk.mjs';
@@ -16,15 +16,15 @@ export { default as discoverQueries } from './packem_shared/discoverQueries-CJnn
16
16
  export { QUEUES_FILENAME, discoverQueues } from './packem_shared/QUEUES_FILENAME-Xv6Vy-Ku.mjs';
17
17
  export { default as discoverR2sqlCalls } from './packem_shared/discoverR2sqlCalls-pnpicWfz.mjs';
18
18
  export { discoverRlsMetadata, default as discoverRlsProcedures } from './packem_shared/discoverRlsMetadata-DppniPUH.mjs';
19
- export { default as discoverSchema } from './packem_shared/discoverSchema-DFWVgU5o.mjs';
19
+ export { default as discoverSchema } from './packem_shared/discoverSchema-BaSAvooG.mjs';
20
20
  export { SHAPES_FILENAME, discoverShapes } from './packem_shared/SHAPES_FILENAME-DOhPGi-6.mjs';
21
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-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';
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-Dyzron8Q.mjs';
24
+ export { emitApp } from './packem_shared/emitApp-D5-NY844.mjs';
25
+ export { buildOpenApiDocument, emitOpenApi, emitOpenApiModule } from './packem_shared/buildOpenApiDocument-D0MBRHyR.mjs';
26
+ export { OPENRPC_VERSION, buildOpenRpcDocument, emitOpenRpc, emitOpenRpcModule } from './packem_shared/OPENRPC_VERSION-BdFITigK.mjs';
27
+ export { SCHEMA_SNAPSHOT_FILENAME, createCodegenProject, refreshCodegenProject, runCodegen } from './packem_shared/SCHEMA_SNAPSHOT_FILENAME-CCsVXrsN.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,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-C_29WVlW.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-Dyzron8Q.mjs';
4
4
  import './paths-BRd6JHuF.mjs';
@@ -1,4 +1,4 @@
1
- import { G as GENERATED_HEADER } from './emit-C_29WVlW.mjs';
1
+ import { G as GENERATED_HEADER } from './emit-Dyzron8Q.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
 
@@ -3,14 +3,14 @@ import { join, dirname } from 'node:path';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { LunoraError } from '@lunora/errors';
5
5
  import { Node, SyntaxKind, Project } from 'ts-morph';
6
- import { lintSchema } from './formatAdvisories-DRhEiJUz.mjs';
6
+ import { lintSchema } from './formatAdvisories-BmF7Mplc.mjs';
7
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
9
  import discoverAuthApiCalls from './discoverAuthApiCalls-Dx3K42rk.mjs';
10
10
  import { discoverContainers } from './CONTAINERS_FILENAME-DjpXMqhp.mjs';
11
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-C_29WVlW.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-Dyzron8Q.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';
@@ -22,15 +22,15 @@ import discoverQueries from './discoverQueries-CJnnnLpd.mjs';
22
22
  import { discoverQueues } from './QUEUES_FILENAME-Xv6Vy-Ku.mjs';
23
23
  import discoverR2sqlCalls from './discoverR2sqlCalls-pnpicWfz.mjs';
24
24
  import discoverRlsProcedures, { discoverRlsMetadata } from './discoverRlsMetadata-DppniPUH.mjs';
25
- import discoverSchema from './discoverSchema-DFWVgU5o.mjs';
25
+ import discoverSchema from './discoverSchema-BaSAvooG.mjs';
26
26
  import { secretKindOf, redact } from './redact-oTmsol5A.mjs';
27
27
  import { discoverShapes } from './SHAPES_FILENAME-DOhPGi-6.mjs';
28
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-C9oljiZd.mjs';
32
- import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-saZ_-kl4.mjs';
33
- import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-Cyttekkt.mjs';
31
+ import { emitApp } from './emitApp-D5-NY844.mjs';
32
+ import { buildOpenApiDocument, emitOpenApiModule } from './buildOpenApiDocument-D0MBRHyR.mjs';
33
+ import { buildOpenRpcDocument, emitOpenRpcModule } from './OPENRPC_VERSION-BdFITigK.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"]);
@@ -1,4 +1,4 @@
1
- import { G as GENERATED_HEADER } from './emit-C_29WVlW.mjs';
1
+ import { G as GENERATED_HEADER } from './emit-Dyzron8Q.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
 
@@ -428,6 +428,7 @@ const parseSourceCall = (args) => {
428
428
  binding: stringPropertyOf(first, "binding") ?? "",
429
429
  columns: stringArrayPropertyOf(first, "columns"),
430
430
  hasReconcile: first.getProperty("reconcileEveryMs") !== void 0,
431
+ hasSoftDelete: first.getProperty("softDeleteColumn") !== void 0,
431
432
  hasTenantBy: first.getProperty("tenantBy") !== void 0,
432
433
  idColumn: stringPropertyOf(first, "idColumn"),
433
434
  mode: stringPropertyOf(first, "mode"),
@@ -2668,7 +2668,7 @@ const LUNORA_RLS_READ_REGISTRY = buildRlsReadRegistry(Object.values(LUNORA_FUNCT
2668
2668
  const shapeGuardImport = hasShapes ? "assertShapeShardable, " : "";
2669
2669
  const importLines = [
2670
2670
  `import type { ${doTypeImports.join(", ")} } from "${base.do}";`,
2671
- `import { applyCdcChanges, ${shapeGuardImport}createShardCtxDb, ${hasSourcedTables ? "isSourceDue, pullExternalSourceTick, " : ""}runDataMigration, runShardMigrations, ${relationFanout.importFragment}ShardDO as ShardDOBase } from "${base.do}";`,
2671
+ `import { applyCdcChanges, ${shapeGuardImport}createShardCtxDb, ${hasSourcedTables ? "isSourceDue, pullExternalSourceIncrementalTick, pullExternalSourceTick, " : ""}runDataMigration, runShardMigrations, ${relationFanout.importFragment}ShardDO as ShardDOBase } from "${base.do}";`,
2672
2672
  ...hasSourcedTables ? [`import type { ExternalSourceLike, SourceClientLike } from "${base.do}";`] : [],
2673
2673
  // `asBucketStorage` (the bucket-aware `ctx.storage` wrapper) and
2674
2674
  // `createSecrets` (the `ctx.secrets` core built-in) live in
@@ -2948,8 +2948,16 @@ const sourcePollAtCache = new WeakMap<object, Map<string, number>>();
2948
2948
  continue;
2949
2949
  }
2950
2950
 
2951
- // eslint-disable-next-line no-await-in-loop -- one sourced table at a time; slices are independent but small and sequential keeps the writer transaction simple
2952
- await pullExternalSourceTick(this.sql as SqlExec, writer, client, table, source, shardKey);
2951
+ if (source.mode === "incremental") {
2952
+ // Incremental (plan 136): pull only rows past the durable
2953
+ // watermark (or a full-pull seed/reconcile), upsert-only.
2954
+ // eslint-disable-next-line no-await-in-loop -- one sourced table at a time; sequential keeps the writer transaction simple
2955
+ await pullExternalSourceIncrementalTick(this.sql as SqlExec, writer, client, table, source, shardKey, now);
2956
+ } else {
2957
+ // eslint-disable-next-line no-await-in-loop -- one sourced table at a time; slices are independent but small and sequential keeps the writer transaction simple
2958
+ await pullExternalSourceTick(this.sql as SqlExec, writer, client, table, source, shardKey);
2959
+ }
2960
+
2953
2961
  polledAt.set(table, now);
2954
2962
  } catch (error) {
2955
2963
  this.recordExternalSourceError(table, error);
@@ -1,4 +1,4 @@
1
- import { A as APP_METHOD_CAPABILITIES, G as GENERATED_HEADER } from './emit-C_29WVlW.mjs';
1
+ import { A as APP_METHOD_CAPABILITIES, G as GENERATED_HEADER } from './emit-Dyzron8Q.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(
@@ -22,6 +22,7 @@ const toAdvisorSchema = (schema) => {
22
22
  externallyManaged: table.externallyManaged ?? false,
23
23
  externalSource: table.externalSource ? {
24
24
  hasReconcile: table.externalSource.hasReconcile ?? false,
25
+ hasSoftDelete: table.externalSource.hasSoftDelete ?? false,
25
26
  hasTenantBy: table.externalSource.hasTenantBy,
26
27
  mode: table.externalSource.mode,
27
28
  unanalyzable: table.externalSource.unanalyzable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.44",
3
+ "version": "1.0.0-alpha.45",
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.28",
50
- "@lunora/agent": "1.0.0-alpha.2",
49
+ "@lunora/advisor": "1.0.0-alpha.29",
50
+ "@lunora/agent": "1.0.0-alpha.3",
51
51
  "@lunora/container": "1.0.0-alpha.12",
52
52
  "@lunora/errors": "1.0.0-alpha.5",
53
53
  "@lunora/queue": "1.0.0-alpha.8",