@vibeorm/runtime 2.0.0-alpha.9 → 2.0.1

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.
Files changed (76) hide show
  1. package/README.md +2 -2
  2. package/dist/adapter.d.ts +102 -4
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/bulk-upsert.d.ts +282 -0
  5. package/dist/bulk-upsert.d.ts.map +1 -0
  6. package/dist/client.d.ts +42 -18
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/codecs.d.ts +12 -0
  9. package/dist/codecs.d.ts.map +1 -1
  10. package/dist/diagnostics/index.d.ts +12 -0
  11. package/dist/diagnostics/index.d.ts.map +1 -0
  12. package/dist/diagnostics/insight.d.ts +63 -0
  13. package/dist/diagnostics/insight.d.ts.map +1 -0
  14. package/dist/diagnostics/plan.d.ts +88 -0
  15. package/dist/diagnostics/plan.d.ts.map +1 -0
  16. package/dist/diagnostics/preview.d.ts +43 -0
  17. package/dist/diagnostics/preview.d.ts.map +1 -0
  18. package/dist/diagnostics/types.d.ts +223 -0
  19. package/dist/diagnostics/types.d.ts.map +1 -0
  20. package/dist/diagnostics/workload.d.ts +32 -0
  21. package/dist/diagnostics/workload.d.ts.map +1 -0
  22. package/dist/index.d.ts +22 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +9465 -4591
  25. package/dist/index.js.map +35 -16
  26. package/dist/keyset-iterator.d.ts +73 -0
  27. package/dist/keyset-iterator.d.ts.map +1 -0
  28. package/dist/keyset.d.ts +121 -0
  29. package/dist/keyset.d.ts.map +1 -0
  30. package/dist/lateral-projection.d.ts +25 -0
  31. package/dist/lateral-projection.d.ts.map +1 -0
  32. package/dist/model-meta.d.ts +18 -2
  33. package/dist/model-meta.d.ts.map +1 -1
  34. package/dist/nested-writes.d.ts +0 -33
  35. package/dist/nested-writes.d.ts.map +1 -1
  36. package/dist/policy-operation.d.ts +14 -0
  37. package/dist/policy-operation.d.ts.map +1 -0
  38. package/dist/policy.d.ts +5 -28
  39. package/dist/policy.d.ts.map +1 -1
  40. package/dist/query-builder.d.ts +28 -28
  41. package/dist/query-builder.d.ts.map +1 -1
  42. package/dist/relation-key.d.ts +23 -0
  43. package/dist/relation-key.d.ts.map +1 -0
  44. package/dist/relation-loader.d.ts +2 -31
  45. package/dist/relation-loader.d.ts.map +1 -1
  46. package/dist/relation-plan.d.ts +45 -7
  47. package/dist/relation-plan.d.ts.map +1 -1
  48. package/dist/render-cache.d.ts.map +1 -1
  49. package/dist/rls-context.d.ts +14 -0
  50. package/dist/rls-context.d.ts.map +1 -0
  51. package/dist/rls-readiness.d.ts +114 -0
  52. package/dist/rls-readiness.d.ts.map +1 -0
  53. package/dist/scoped.d.ts +5 -32
  54. package/dist/scoped.d.ts.map +1 -1
  55. package/dist/strict-args.d.ts +47 -0
  56. package/dist/strict-args.d.ts.map +1 -0
  57. package/dist/telemetry/collector.d.ts +53 -0
  58. package/dist/telemetry/collector.d.ts.map +1 -0
  59. package/dist/telemetry/config.d.ts +53 -0
  60. package/dist/telemetry/config.d.ts.map +1 -0
  61. package/dist/telemetry/fingerprint.d.ts +38 -0
  62. package/dist/telemetry/fingerprint.d.ts.map +1 -0
  63. package/dist/telemetry/index.d.ts +18 -0
  64. package/dist/telemetry/index.d.ts.map +1 -0
  65. package/dist/telemetry/recorder.d.ts +93 -0
  66. package/dist/telemetry/recorder.d.ts.map +1 -0
  67. package/dist/telemetry/statement.d.ts +53 -0
  68. package/dist/telemetry/statement.d.ts.map +1 -0
  69. package/dist/telemetry/types.d.ts +265 -0
  70. package/dist/telemetry/types.d.ts.map +1 -0
  71. package/dist/validators.d.ts +5 -3
  72. package/dist/validators.d.ts.map +1 -1
  73. package/dist/views.d.ts.map +1 -1
  74. package/dist/write-scope.d.ts +14 -0
  75. package/dist/write-scope.d.ts.map +1 -0
  76. package/package.json +4 -4
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Bounded-memory export: a sequential async iterator over keyset pages.
3
+ *
4
+ * One page is held at a time and the next one is fetched only when the
5
+ * consumer asks for a row the buffer cannot serve. There is no prefetch, no
6
+ * look-ahead and no unbounded accumulation — `pagesFetched()` is the receipt.
7
+ *
8
+ * What this deliberately is NOT:
9
+ * - **not a snapshot.** No transaction is opened, so the traversal is a LIVE
10
+ * view: concurrent inserts, deletes and sort-key updates change what a
11
+ * later page sees. A row that moves behind the position is missed; one
12
+ * that moves ahead of it is seen twice. A consistent export means running
13
+ * the whole iteration inside `$transaction` at an explicit isolation
14
+ * level, paying its connection and deadline cost — never a secretly
15
+ * long-lived transaction.
16
+ * - **not exactly-once.** `checkpoint()` records the last row the consumer
17
+ * came BACK for, so a `break` or an exception leaves the in-flight row
18
+ * uncheckpointed and resuming re-delivers it. At-least-once. The consumer
19
+ * owns acknowledgement and de-duplication; this is not a durable job
20
+ * engine.
21
+ * - **not statement cancellation.** Aborting the signal stops FUTURE page
22
+ * fetches. A page query already in flight keeps running: per EPIC 6 only
23
+ * `adapter-pg` / `adapter-bun` can cancel a running statement, and only
24
+ * inside a transaction carrying a deadline — which this iterator does not
25
+ * open.
26
+ */
27
+ import type { SqlDialect } from "@vibeorm/sql";
28
+ import type { KeysetTimestampPrecision } from "./keyset.ts";
29
+ import type { RuntimeMeta } from "./model-meta.ts";
30
+ /** The one method this iterator needs — a model delegate satisfies it. */
31
+ export type KeysetPageSource = {
32
+ readonly findMany: (args: Record<string, unknown>) => Promise<Record<string, unknown>[]>;
33
+ };
34
+ export type KeysetIterateOptions = {
35
+ readonly source: KeysetPageSource;
36
+ readonly meta: RuntimeMeta;
37
+ readonly dialect: SqlDialect;
38
+ readonly model: string;
39
+ readonly orderBy: unknown;
40
+ /** Bounded and required, 1…{@link KEYSET_MAX_PAGE_SIZE}. There is no unbounded default. */
41
+ readonly pageSize: number;
42
+ readonly where?: Record<string, unknown>;
43
+ readonly select?: Record<string, unknown>;
44
+ readonly omit?: Record<string, unknown>;
45
+ readonly include?: Record<string, unknown>;
46
+ /** Resume from a checkpoint minted by a previous run over the SAME ordering. */
47
+ readonly after?: string;
48
+ /** Consumer cancellation: stops future page fetches; ends iteration cleanly. */
49
+ readonly signal?: AbortSignal;
50
+ readonly timestampPrecision?: KeysetTimestampPrecision;
51
+ };
52
+ export type KeysetIterator = AsyncIterableIterator<Record<string, unknown>> & {
53
+ /** Always present: `break` and an exception both have to be able to release the traversal. */
54
+ readonly return: (value?: unknown) => Promise<IteratorResult<Record<string, unknown>>>;
55
+ readonly throw: (error?: unknown) => Promise<IteratorResult<Record<string, unknown>>>;
56
+ /** Token for the last SUCCESSFULLY CONSUMED row; `null` before the first one settles. */
57
+ readonly checkpoint: () => string | null;
58
+ /** Pages fetched so far — the bounded-fetch receipt. */
59
+ readonly pagesFetched: () => number;
60
+ /** True when the signal aborted the traversal. */
61
+ readonly cancelled: () => boolean;
62
+ };
63
+ /**
64
+ * Iterate a model in keyset order, one bounded page at a time.
65
+ *
66
+ * @example
67
+ * const rows = iterateKeyset({ source: db.$models.product, meta, dialect,
68
+ * model: "Product", orderBy: [{ price: "asc" }, { id: "asc" }], pageSize: 500 });
69
+ * for await (const row of rows) { … }
70
+ * const resumeFrom = rows.checkpoint();
71
+ */
72
+ export declare function iterateKeyset(options: KeysetIterateOptions): KeysetIterator;
73
+ //# sourceMappingURL=keyset-iterator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyset-iterator.d.ts","sourceRoot":"","sources":["../src/keyset-iterator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS/C,OAAO,KAAK,EAAmB,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKnD,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,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,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACtF,yFAAyF;IACzF,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACzC,wDAAwD;IACxD,QAAQ,CAAC,YAAY,EAAE,MAAM,MAAM,CAAC;IACpC,kDAAkD;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC;CACnC,CAAC;AAuCF;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CA2I3E"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Sort-aware keyset pagination — the order plan and the opaque position token.
3
+ *
4
+ * A keyset position describes ORDERING VALUES plus a unique tie-breaker, not
5
+ * the identity of one row: the row a token was minted from may since have been
6
+ * deleted or had its sort key changed, and traversal still continues from the
7
+ * right place. That is the whole difference from the legacy `cursor`, which
8
+ * addresses a row by a unique key and is left untouched by this module.
9
+ *
10
+ * Two rules this module exists to enforce:
11
+ * - a position is only meaningful against ONE effective ordering, so the
12
+ * token carries that ordering's signature and a mismatch is refused loudly
13
+ * rather than silently paginating the wrong sequence;
14
+ * - a position's values are encoded LOSSLESSLY per scalar type — never
15
+ * through a float64 detour and never from a rounded display value.
16
+ *
17
+ * The token is ENCODED, not encrypted: anyone holding it can read the ordering
18
+ * values inside. It is also NOT an authorization credential — it selects a
19
+ * position, never a row; every query consuming one still compiles the caller's
20
+ * own `where` and keeps its `$scoped` / `$withPolicy` / RLS filters.
21
+ */
22
+ import type { SqlDialect } from "@vibeorm/sql";
23
+ import type { FieldMeta, ModelMeta } from "./model-meta.ts";
24
+ export type KeysetDirection = "asc" | "desc";
25
+ export type KeysetNulls = "first" | "last";
26
+ /**
27
+ * The caller's assertion that every `DateTime` ordering column holds
28
+ * millisecond-exact values. See {@link compileKeysetOrderPlan}.
29
+ */
30
+ export type KeysetTimestampPrecision = "milliseconds";
31
+ /** One order term, already resolved by the query builder. */
32
+ export type KeysetOrderInput = {
33
+ readonly field: FieldMeta;
34
+ readonly direction: KeysetDirection;
35
+ /** Resolved NULL placement: the explicit request, else the dialect's native one. */
36
+ readonly nulls: KeysetNulls;
37
+ };
38
+ /** One key of the effective keyset order. */
39
+ export type KeysetOrderKey = {
40
+ readonly field: FieldMeta;
41
+ readonly direction: KeysetDirection;
42
+ readonly nulls: KeysetNulls;
43
+ readonly tag: KeysetValueTag;
44
+ };
45
+ /** The effective order a token is bound to. */
46
+ export type KeysetOrderPlan = {
47
+ readonly model: string;
48
+ readonly keys: readonly KeysetOrderKey[];
49
+ /** Plain-text order signature carried inside the token. */
50
+ readonly signature: string;
51
+ };
52
+ /** Per-scalar lossless encoding tag stored in the token. */
53
+ export type KeysetValueTag = "s" | "i" | "b" | "f" | "c" | "t" | "o" | "y";
54
+ /** Token version. A token from another version is refused, never guessed at. */
55
+ export declare const KEYSET_TOKEN_VERSION: number;
56
+ /** Token prefix — `vk` for "vibe keyset", then the version. */
57
+ export declare const KEYSET_TOKEN_PREFIX: string;
58
+ /** Upper bound on an iterator page — memory is bounded by construction, not by hope. */
59
+ export declare const KEYSET_MAX_PAGE_SIZE: number;
60
+ /**
61
+ * Compile and VALIDATE the effective keyset order.
62
+ *
63
+ * Refuses, at build time and before any statement runs: list/Json/Bytes order
64
+ * keys, an order with no unique tie-breaker, and a `DateTime` key on a dialect
65
+ * that may store sub-millisecond values unless the caller passes
66
+ * `timestampPrecision: "milliseconds"` — the caller's explicit assertion that
67
+ * the column is millisecond-exact. That assertion is NOT safe for a
68
+ * `@default(now())` column on postgres, which is microsecond-precise: a
69
+ * truncated cursor value re-admits rows already delivered in that same
70
+ * millisecond, i.e. duplicates.
71
+ */
72
+ export declare function compileKeysetOrderPlan(params: {
73
+ model: ModelMeta;
74
+ dialect: SqlDialect;
75
+ terms: readonly KeysetOrderInput[];
76
+ timestampPrecision?: KeysetTimestampPrecision;
77
+ }): KeysetOrderPlan;
78
+ /**
79
+ * Is `row` strictly after `position` in this ordering? `null` means the
80
+ * comparison is inconclusive in JavaScript (a collated string key), never
81
+ * "yes".
82
+ *
83
+ * Used as a LIVENESS guard, not as a filter: the SQL bound does the real work,
84
+ * and this only catches a traversal that fails to advance — which happens when
85
+ * an ordering is not actually total, or when a cursor value was lossy (a
86
+ * truncated sub-millisecond timestamp being the case this codebase can
87
+ * demonstrate). Without it that situation is an infinite page loop.
88
+ */
89
+ export declare function keysetRowIsAfter(params: {
90
+ keys: readonly KeysetOrderKey[];
91
+ row: readonly unknown[];
92
+ position: readonly unknown[];
93
+ }): boolean | null;
94
+ /** Read a row's ordering values in plan order. */
95
+ export declare function keysetRowValues(params: {
96
+ plan: KeysetOrderPlan;
97
+ row: Readonly<Record<string, unknown>>;
98
+ }): readonly unknown[];
99
+ /**
100
+ * Mint a continuation token from a row that carries every ordering value.
101
+ *
102
+ * The row must contain each ordering field — a missing one is refused rather
103
+ * than encoded as a null, because a silently null position paginates the wrong
104
+ * sequence. Callers that project a subset (`select`) fetch the ordering
105
+ * columns HIDDEN and strip them from the payload; see `keyset-iterator.ts`.
106
+ */
107
+ export declare function encodeKeysetToken(params: {
108
+ plan: KeysetOrderPlan;
109
+ row: Readonly<Record<string, unknown>>;
110
+ }): string;
111
+ /**
112
+ * Read a token back into ordering values, validating version, model and the
113
+ * effective order. A token minted under a different ordering (or for another
114
+ * model, or by a future version) is refused with a precise, non-guessing
115
+ * error — never used to paginate a sequence it does not describe.
116
+ */
117
+ export declare function decodeKeysetToken(params: {
118
+ plan: KeysetOrderPlan;
119
+ token: string;
120
+ }): readonly unknown[];
121
+ //# sourceMappingURL=keyset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyset.d.ts","sourceRoot":"","sources":["../src/keyset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cA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C;AAuHnD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE;IAC7C,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;IACpB,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACnC,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;CAC/C,GAAG,eAAe,CA+ClB;AA0ID;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,IAAI,EAAE,SAAS,cAAc,EAAE,CAAC;IAChC,GAAG,EAAE,SAAS,OAAO,EAAE,CAAC;IACxB,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;CAC9B,GAAG,OAAO,GAAG,IAAI,CAmBjB;AAED,kDAAkD;AAClD,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,IAAI,EAAE,eAAe,CAAC;IACtB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACxC,GAAG,SAAS,OAAO,EAAE,CAGrB;AAID;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,IAAI,EAAE,eAAe,CAAC;IACtB,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACxC,GAAG,MAAM,CAcT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,OAAO,EAAE,CA8EtG"}
@@ -0,0 +1,25 @@
1
+ import type { ColRef } from "@vibeorm/sql";
2
+ import type { RelationTreeNode } from "./relation-plan.ts";
3
+ /** Child table qualifier, scoped independently inside each lateral. */
4
+ export declare const LATERAL_CHILD_ALIAS: string;
5
+ /** Shared SQL/decode descriptor. Its order is the resolved physical projection, never model order. */
6
+ export type LateralProjection = {
7
+ readonly columns: readonly ColRef[];
8
+ readonly hiddenOrder: readonly string[];
9
+ };
10
+ /** Build once per query node; the builder and loader receive this same immutable descriptor. */
11
+ export declare function lateralProjection(params: {
12
+ node: RelationTreeNode;
13
+ }): LateralProjection;
14
+ /**
15
+ * PG-3 (SQL review round 2): order fields the lateral subselect must project
16
+ * HIDDEN — the aggregate's explicit `ORDER BY "__sub".…` (N2) can only
17
+ * reference projected columns, and a per-relation orderBy on a field outside
18
+ * the child select otherwise left the aggregate relying on "usually preserves
19
+ * subquery order". The loader deletes these after parsing (the stitch-key
20
+ * pattern). Empty when the projection is full or no orderBy was given.
21
+ */
22
+ export declare function lateralHiddenOrderFields(params: {
23
+ node: RelationTreeNode;
24
+ }): string[];
25
+ //# sourceMappingURL=lateral-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lateral-projection.d.ts","sourceRoot":"","sources":["../src/lateral-projection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAM3D,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,EAAE,MAAgB,CAAC;AAEnD,sGAAsG;AACtG,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAIF,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,iBAAiB,CAiBvF;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAAG,MAAM,EAAE,CAgBrF"}
@@ -11,8 +11,8 @@
11
11
  * which is dialect-free by design: the id exists before the INSERT, which is
12
12
  * what lets dialects without RETURNING re-select the row they just wrote.
13
13
  */
14
- import type { ComputedConfig, DefaultValueIR, FieldType, RelationIR, ScalarType, SchemaIR } from "@vibeorm/schema";
15
- import type { SqlExpr } from "@vibeorm/sql";
14
+ import type { ComputedConfig, DefaultValueIR, EnumStorage, FieldType, RelationIR, ScalarType, SchemaIR } from "@vibeorm/schema";
15
+ import type { ScalarCodec, SqlExpr } from "@vibeorm/sql";
16
16
  /** Where a field's default value is produced. */
17
17
  export type DefaultOrigin = "app" | "database" | "none";
18
18
  /** A scalar or enum column, resolved for the runtime. */
@@ -23,11 +23,27 @@ export type FieldMeta = {
23
23
  readonly columnName: string;
24
24
  /** Explicit column collation (@collation, board #36) — mysql insensitive-filter rendering reads it. */
25
25
  readonly collation?: string;
26
+ /**
27
+ * The declared `@db.*` native column type, verbatim as Prisma writes it
28
+ * (`Uuid`, `VarChar(191)`, `Char(10)`, `Decimal(10, 2)`), or `undefined`
29
+ * when the field takes the dialect's canonical mapping.
30
+ *
31
+ * Carried because the physical type decides value equality on its own,
32
+ * before any collation: `char(n)` pads, `uuid` folds case, `timestamp(0)`
33
+ * truncates, `real` narrows a Float. `upsertMany`'s duplicate rule reads it
34
+ * (`conflictKeyComparisonOf` in bulk-upsert.ts). It is a schema claim, not a
35
+ * reading of the live column.
36
+ */
37
+ readonly nativeType?: string;
26
38
  readonly type: FieldType;
27
39
  /** The scalar type, or `null` when the field is an enum reference. */
28
40
  readonly scalarType: ScalarType | null;
29
41
  /** The enum name, or `null` when the field is a scalar. */
30
42
  readonly enumName: string | null;
43
+ /** Physical enum storage, or `null` for ordinary scalar fields. */
44
+ readonly enumStorage: EnumStorage | null;
45
+ /** Precomputed membership codec for string-backed enums only. */
46
+ readonly enumCodec: ScalarCodec | null;
31
47
  readonly isList: boolean;
32
48
  readonly isOptional: boolean;
33
49
  readonly isId: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"model-meta.d.ts","sourceRoot":"","sources":["../src/model-meta.ts"],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,GAAG,WAAW,CAwBrG;AAID,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAWpF;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAyBpG"}
@@ -1,36 +1,3 @@
1
- /**
2
- * Nested writes (Prisma-shaped, v1 parity plus implicit-M2M support):
3
- *
4
- * create data: relation: { create | connect | connectOrCreate }
5
- * update data: … plus { update | updateMany | upsert | set | disconnect |
6
- * delete | deleteMany }
7
- *
8
- * STATEMENT ORDER (deterministic, pinned by unit tests):
9
- * create: [owner-side to-one resolutions: SELECT/INSERT per verb] →
10
- * parent INSERT → [list/M2M ops in data-key order, item order;
11
- * each M2M child op is followed immediately by its join-row INSERT].
12
- * PLAIN multi-item FK-side `create` lists collapse into ONE
13
- * multi-row INSERT (v1 parity — one fewer round-trip per item) when
14
- * no item carries nested ops of its own and all items write the
15
- * same columns (so no NULL-vs-database-default drift can appear).
16
- * update: parent pre-SELECT (findUnique) → [owner-side to-one resolutions]
17
- * → parent UPDATE (scalars + FK changes, skipped when empty) →
18
- * [deferred owner-side child DELETEs] → [list/M2M ops in data-key
19
- * order] — the returned row is the UPDATE's result (or the
20
- * pre-SELECT when nothing on the parent changed).
21
- *
22
- * TRANSACTIONS: any nested write that produces more than one statement wraps
23
- * in `adapter.transaction` automatically; inside an outer `$transaction` that
24
- * nests as a savepoint (the adapter contract). A mid-write failure therefore
25
- * rolls the whole write back.
26
- *
27
- * Implicit M2M goes through the ONE shared join-table rule (`implicitJoinTable`
28
- * via relation-plan's link resolution); `connect` writes join rows with
29
- * conflict-skip, so re-connecting an existing pair is a no-op.
30
- *
31
- * Unknown verbs are loud: VIBE_VALIDATION naming the verb (v1 silently
32
- * ignored them — that was a bug class, not a feature).
33
- */
34
1
  import type { SqlDialect, SqlStatement } from "@vibeorm/sql";
35
2
  import type { ModelMeta, RuntimeMeta } from "./model-meta.ts";
36
3
  import type { QueryMethod } from "./query-builder.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"nested-writes.d.ts","sourceRoot":"","sources":["../src/nested-writes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAMtD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,WAAW,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,WAAW,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B,KAAK,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE;QAC1B,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,WAAW,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC/B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Aa,EAAE,CAAC,CAAC;CAChC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAC;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CACrF,CAAC;AAmCF,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAQpF;AA4eD;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC7C,GAAG,EAAE,YAAY,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,GAAG,OAAO,CAAC,aAAa,CAAC,CAOzB;AA0hBD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC7C,GAAG,EAAE,YAAY,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,GAAG,OAAO,CAAC,aAAa,CAAC,CAqCzB"}
@@ -0,0 +1,14 @@
1
+ import type { DynamicClient } from "./client.ts";
2
+ type PolicyOperationFactory = <T>(run: (client: DynamicClient) => Promise<T>) => Promise<T>;
3
+ /** Register the engine-owned deferred-operation factory without exposing it on clients. */
4
+ export declare function registerPolicyOperations(params: {
5
+ client: DynamicClient;
6
+ factory: PolicyOperationFactory;
7
+ }): void;
8
+ /** Defer the whole policy flow; its client is selected by the ordinary array-transaction runner. */
9
+ export declare function deferPolicyOperation<T>(params: {
10
+ client: DynamicClient;
11
+ run: (client: DynamicClient) => Promise<T>;
12
+ }): Promise<T>;
13
+ export {};
14
+ //# sourceMappingURL=policy-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-operation.d.ts","sourceRoot":"","sources":["../src/policy-operation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,sBAAsB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAG5F,2FAA2F;AAC3F,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,sBAAsB,CAAA;CAAE,GAAG,IAAI,CAEjH;AAED,oGAAoG;AACpG,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,GAAG,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAIjI"}
package/dist/policy.d.ts CHANGED
@@ -1,32 +1,5 @@
1
- /**
2
- * Policy scoping — `$withPolicy` / `$bypassPolicy` (EPIC 4b).
3
- *
4
- * Application-level ROW scoping for models declaring `@@policy`, implemented
5
- * as an args-rewriting layer over the built delegates (the views.ts pattern:
6
- * ZERO query-builder edits — every emitted statement is a shape the catalogs
7
- * already pin). Complements `$defineView` (COLUMN masking) and, on postgres,
8
- * database RLS (the defense-in-depth backstop; see docs/migrations.md).
9
- *
10
- * Semantics:
11
- * - FAIL CLOSED: on a client whose schema declares any @@policy, the base
12
- * delegates of policied models refuse every method until the caller binds
13
- * a context (`$withPolicy({ tenant })`) or bypasses deliberately
14
- * (`$bypassPolicy()` — explicit and greppable).
15
- * - Reads AND the policy predicate into `where` (findUnique rewrites to
16
- * findFirst over the flattened unique key). Policied CHILD models are
17
- * scoped inside include/select at any depth.
18
- * - `create`/`createMany` FORCE the context value into the data (a
19
- * conflicting explicit value is VIBE_VALIDATION). Nested `create` on a
20
- * policied child is forced too.
21
- * - `update`/`delete`/`upsert` run as lock-read (FOR UPDATE) + write-by-PK
22
- * inside one transaction; a cross-context target is VIBE_NOT_FOUND.
23
- * - Nested verbs REFERENCING existing rows of a policied child (connect,
24
- * connectOrCreate, set, disconnect, nested update/delete/upsert) are
25
- * REFUSED from a scoped client in this first cut — fail-closed beats a
26
- * silent hole. `$queryRaw`/`$executeRaw` are outside policy by design.
27
- */
28
1
  import type { RuntimeMeta } from "./model-meta.ts";
29
- import type { DynamicClient } from "./client.ts";
2
+ import type { DynamicClient, ModelDelegate } from "./client.ts";
30
3
  /** Values a policy context may bind — the scoping column's scalar shape. */
31
4
  export type PolicyContextValue = string | number | bigint;
32
5
  /**
@@ -36,5 +9,9 @@ export type PolicyContextValue = string | number | bigint;
36
9
  export declare function attachPolicy(params: {
37
10
  client: DynamicClient;
38
11
  meta: RuntimeMeta;
12
+ wrapDelegate?: (params: {
13
+ model: string;
14
+ delegate: ModelDelegate;
15
+ }) => ModelDelegate;
39
16
  }): void;
40
17
  //# sourceMappingURL=policy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAA0B,aAAa,EAAiB,MAAM,aAAa,CAAC;AAGxF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AA8O1D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,IAAI,CAiGvF"}
1
+ {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAA0B,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGxF,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAkrB1D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,aAAa,CAAA;KAAE,KAAK,aAAa,CAAC;CAAE,GAAG,IAAI,CAmK9K"}
@@ -1,23 +1,10 @@
1
- /**
2
- * The query builder: `{ model, method, args }` → a SQL AST statement, purely.
3
- *
4
- * Nothing here touches a database, a clock-free input always produces the same
5
- * statement, and every branch is reachable from the query catalog
6
- * (`tests/query-catalog/`) — which pins the rendered SQL for all three dialects
7
- * and exports it to the reviewable root `sql-catalog.md`.
8
- *
9
- * Division of labour:
10
- * - shapes and SQL text live in @vibeorm/sql (this file never writes SQL),
11
- * - value transport lives in codecs.ts (this file never coerces),
12
- * - dialect gaps become VIBE_UNSUPPORTED_CAPABILITY here, at build time,
13
- * which is the earliest knowable moment for a query-level feature,
14
- * - bad input becomes VIBE_VALIDATION naming the model, field and operator.
15
- */
1
+ export { lateralHiddenOrderFields } from "./lateral-projection.ts";
16
2
  import type { OrderByColumn, SqlDialect, SqlExpr, SqlStatement } from "@vibeorm/sql";
3
+ import type { KeysetOrderInput } from "./keyset.ts";
17
4
  import type { ModelMeta, RuntimeMeta } from "./model-meta.ts";
18
- import type { RelationSelection, RelationTreeNode } from "./relation-plan.ts";
5
+ import type { RelationSelection } from "./relation-plan.ts";
19
6
  /** Every ORM method the query builder builds SQL for. */
20
- export type QueryMethod = "findMany" | "findFirst" | "findUnique" | "create" | "createMany" | "createManyAndReturn" | "update" | "updateMany" | "upsert" | "delete" | "deleteMany" | "count" | "aggregate" | "groupBy";
7
+ export type QueryMethod = "findMany" | "findFirst" | "findUnique" | "create" | "createMany" | "createManyAndReturn" | "update" | "updateMany" | "updateManyAndReturn" | "upsert" | "upsertMany" | "delete" | "deleteMany" | "count" | "aggregate" | "groupBy";
21
8
  /** Client-level options that shape SQL (subset of ClientOptions the builder needs). */
22
9
  export type BuilderClientOptions = {
23
10
  /** Append the primary key to ORDER BY when no explicit orderBy was given (default false). */
@@ -106,6 +93,15 @@ export type QueryPlan = {
106
93
  * concatenating returned rows. Absent for single-statement calls.
107
94
  */
108
95
  readonly batch?: readonly SqlStatement[];
96
+ /**
97
+ * upsertMany only (EPIC 10): the number of rows this plan submits, summed
98
+ * across chunks. It IS the operation's affected count under the one
99
+ * cross-dialect definition — every submitted row is inserted or updated —
100
+ * and it is computed here because the drivers do not agree: mysql's ON
101
+ * DUPLICATE KEY scores an insert 1, a changed update 2 and an unchanged
102
+ * update 0, so its number is not a row count at all.
103
+ */
104
+ readonly upsertRowCount?: number;
109
105
  /** The caller's `select`, replayed on that re-select. */
110
106
  readonly selectArg: Readonly<Record<string, unknown>> | null;
111
107
  /** How to decode aggregate/groupBy/count-select rows; `null` elsewhere. */
@@ -199,21 +195,25 @@ export declare function upsertUsesNativeStatement(params: {
199
195
  model: ModelMeta;
200
196
  args: Record<string, unknown>;
201
197
  }): boolean;
198
+ /**
199
+ * Compile a raw `orderBy` argument into keyset order inputs — the ONE parsing
200
+ * path the iterator and the `after` bound share, so a token's signature can
201
+ * never drift from the ordering the statement carries.
202
+ */
203
+ export declare function compileKeysetOrderInputs(params: {
204
+ dialect: SqlDialect;
205
+ meta: RuntimeMeta;
206
+ model: ModelMeta;
207
+ orderBy: unknown;
208
+ }): KeysetOrderInput[];
202
209
  /** The column a relation's JSON payload is exposed under in the outer row. */
203
210
  export declare function lateralColumnAlias(params: {
204
211
  relation: string;
205
212
  }): string;
206
- /**
207
- * PG-3 (SQL review round 2): order fields the lateral subselect must project
208
- * HIDDEN — the aggregate's explicit `ORDER BY "__sub".…` (N2) can only
209
- * reference projected columns, and a per-relation orderBy on a field outside
210
- * the child select otherwise left the aggregate relying on "usually preserves
211
- * subquery order". The loader deletes these after parsing (the stitch-key
212
- * pattern). Empty when the projection is full or no orderBy was given.
213
- */
214
- export declare function lateralHiddenOrderFields(params: {
215
- node: RelationTreeNode;
216
- }): string[];
213
+ /** Internal count columns use the reserved result prefix; list order binds aliases to count nodes. */
214
+ export declare function lateralCountAlias(params: {
215
+ index: number;
216
+ }): string;
217
217
  /**
218
218
  * The relation selection + caller-visible field list for one call, WITHOUT
219
219
  * building a statement — the nested-write path orchestrates its own
@@ -1 +1 @@
1
- {"version":3,"file":"query-builder.d.ts","sourceRoot":"","sources":["../src/query-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAaH,OAAO,KAAK,EAOV,aAAa,EAKb,UAAU,EACV,OAAO,EACP,YAAY,EACb,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAa,SAAS,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAE1F,OAAO,KAAK,EAAgB,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI5F,yDAAyD;AACzD,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,YAAY,GACZ,qBAAqB,GACrB,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,OAAO,GACP,WAAW,GACX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GAAG,SAAS,CAkwBZ"}
@@ -0,0 +1,23 @@
1
+ /** Compare decoded relation keys by value, including DateTime milliseconds and binary bytes. */
2
+ export declare function relationValueKey(params: {
3
+ value: unknown;
4
+ }): unknown;
5
+ /**
6
+ * A collision-safe Map key for an ORDERED key tuple, or `null` when the tuple
7
+ * is INCOMPLETE (any member null/undefined) — an incomplete foreign key must
8
+ * never attach a parent, so it gets no key at all rather than a key that could
9
+ * collide with another incomplete tuple.
10
+ *
11
+ * The encoding is `JSON.stringify` over the per-member {@link relationValueKey}
12
+ * tags, NOT a separator join: JSON string escaping is injective, so a member
13
+ * containing the separator of a naive `a + "\u0000" + b` scheme (or `","`, or
14
+ * `"|"`) cannot forge another tuple's key.
15
+ *
16
+ * A member whose equality cannot be implemented faithfully — any object that is
17
+ * neither `Date` nor `Uint8Array`, where `String(value)` would be a lossy stand-in
18
+ * — is refused rather than silently mis-grouped.
19
+ */
20
+ export declare function relationTupleKey(params: {
21
+ values: readonly unknown[];
22
+ }): string | null;
23
+ //# sourceMappingURL=relation-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relation-key.d.ts","sourceRoot":"","sources":["../src/relation-key.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAqBpE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CAgBtF"}
@@ -1,32 +1,3 @@
1
- /**
2
- * Relation LOADING: attach included relations onto already-materialized rows.
3
- *
4
- * The portable "query" strategy (default, all dialects): one batched statement
5
- * per relation per level (`WHERE childKey IN (parent keys)`), grouped and
6
- * stitched in memory — never one query per parent. Implicit M2M loads in ONE
7
- * statement per level (board #12, v1's shape): children INNER JOINed to their
8
- * join-table membership rows, the join table's parent-key column projected
9
- * under a reserved alias and decoded through the PARENT key's codec (rule 6).
10
- * Deeper levels recurse over the level's loaded children.
11
- *
12
- * PER-PARENT take/skip MECHANISM (differs from v1's SQL, matches its
13
- * semantics): v1 windowed with `ROW_NUMBER() OVER (PARTITION BY fk)`; v2 loads
14
- * the batch fully ordered (the user's orderBy, or the child PK when paginating
15
- * without one) and applies each parent's skip/take at stitch time. Same
16
- * observable result for any deterministic ordering, no window functions in the
17
- * AST. The trade-off — overfetching children that fall outside a page — is
18
- * accepted for 2.0 and confined to this module.
19
- *
20
- * The "join" strategy's rows arrive with `__rel_<name>` JSON columns (built by
21
- * the query builder's lateral statement); `attachLateralRelations` parses,
22
- * DECODES (codecs on every child row — to_jsonb strings timestamps and drops
23
- * BigInt-ness, LEARNINGS) and stitches them, then recurses deeper levels
24
- * through the query strategy exactly like v1.
25
- *
26
- * Statements run SEQUENTIALLY in relation-declaration order, so the statement
27
- * stream is deterministic (scripted-adapter tests pin it; real adapters get
28
- * predictable logs).
29
- */
30
1
  import type { SelectStatement, SqlDialect, WireFidelity } from "@vibeorm/sql";
31
2
  import type { ModelMeta, RuntimeMeta } from "./model-meta.ts";
32
3
  import type { RelationSelection } from "./relation-plan.ts";
@@ -59,8 +30,8 @@ export declare function attachRelations(params: {
59
30
  /**
60
31
  * "join"-strategy post-processing: parse each row's `__rel_<name>` JSON
61
32
  * column, decode the children through the child model's codecs, stitch, then
62
- * recurse deeper levels through the query strategy (v1 semantics) and load
63
- * `_count` separately.
33
+ * recurse deeper levels through the query strategy (v1 semantics) and
34
+ * read the counts embedded in the parent statement.
64
35
  */
65
36
  export declare function attachLateralRelations(params: {
66
37
  dialect: SqlDialect;
@@ -1 +1 @@
1
- {"version":3,"file":"relation-loader.d.ts","sourceRoot":"","sources":["../src/relation-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAW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