@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 @@
1
+ {"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../src/telem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AAO,EAAE,MAAM,wBAAwB,CAAC;CAClD,CAAC;AAkCF;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,GAAG,iBAAiB,CAuThG"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The single statement-instrumentation seam.
3
+ *
4
+ * Every SQL execution in the client goes through here so that the legacy
5
+ * `onQuery` / `$on("query")` contract and the new telemetry path are reported
6
+ * from ONE place with unchanged semantics:
7
+ *
8
+ * - the legacy report still fires only after the adapter SUCCEEDS, before row
9
+ * materialization, with the same payload it always had;
10
+ * - telemetry additionally records FAILED statements, which the legacy path
11
+ * has never seen;
12
+ * - with neither observer present nothing is measured at all — no clock read,
13
+ * no allocation.
14
+ */
15
+ import type { TelemetryOperationScope } from "./recorder.ts";
16
+ import type { TelemetryStatementKind } from "./types.ts";
17
+ /**
18
+ * The legacy per-statement payload. Structurally identical to the client's
19
+ * `QueryEvent`; declared here so the telemetry module never imports the client
20
+ * (which imports this one).
21
+ */
22
+ export type StatementReport = {
23
+ readonly model: string | null;
24
+ readonly method: string;
25
+ readonly text: string;
26
+ readonly values: readonly unknown[];
27
+ readonly durationMs: number;
28
+ };
29
+ /** What `instrumentStatement` needs; `run` is the adapter call itself. */
30
+ export type InstrumentStatementInput<T> = {
31
+ readonly scope: TelemetryOperationScope | undefined;
32
+ /** Legacy `onQuery`/`$on` sink, or `undefined` when nobody is listening. */
33
+ readonly legacy: ((report: StatementReport) => void) | undefined;
34
+ readonly kind: TelemetryStatementKind;
35
+ readonly model: string | null;
36
+ readonly method: string;
37
+ readonly text: string;
38
+ readonly values: readonly unknown[];
39
+ readonly inTransaction: boolean;
40
+ /** Rendering time for this statement, when it was measured. */
41
+ readonly renderMs?: number;
42
+ /** Reads a known row count off the adapter result; return `undefined` when unknowable. */
43
+ readonly rowCount?: (value: T) => number | undefined;
44
+ readonly run: () => Promise<T>;
45
+ };
46
+ /**
47
+ * Run one statement with observation attached.
48
+ *
49
+ * The adapter's own result and its rejection are passed through untouched: an
50
+ * observer can never change what a query returns or whether it fails.
51
+ */
52
+ export declare function instrumentStatement<T>(params: InstrumentStatementInput<T>): Promise<T>;
53
+ //# sourceMappingURL=statement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statement.d.ts","sourceRoot":"","sources":["../../src/telemetry/statement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAA2B,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI;IACxC,QAAQ,CAAC,KAAK,EAAE,uBAAuB,GAAG,SAAS,CAAC;IACpD,4EAA4E;IAC5E,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACjE,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAAC;IACrD,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAmD5F"}
@@ -0,0 +1,265 @@
1
+ /**
2
+ * The vendor-neutral observability contract (EPIC 1).
3
+ *
4
+ * An OPERATION is one public ORM call (`user.findMany()`, `$queryRaw`, one
5
+ * `$transaction`, one extension mount call). A STATEMENT is one SQL execution
6
+ * inside it. VibeORM emits operations and statements to an exporter the HOST
7
+ * owns; it never owns a tracer, never starts a provider, and never shuts one
8
+ * down.
9
+ *
10
+ * Privacy defaults, deliberately conservative:
11
+ * - parameter VALUES are redacted (only `parameterCount` is reported),
12
+ * - rendered SQL text is not captured (it can embed literals and secrets),
13
+ * - error CAUSES are never serialized into attributes — only the stable
14
+ * `VibeError.code` travels.
15
+ * Both captures are separate opt-ins.
16
+ *
17
+ * Honesty rules encoded in these types: anything unknown or unavailable is
18
+ * ABSENT, never invented as zero. `rowCount`, `durationMs`, `statementDurationMs`
19
+ * and every `detail` subdivision are optional for that reason.
20
+ */
21
+ import type { Dialect, Provider, VibeErrorCode } from "@vibeorm/schema";
22
+ /** What kind of public call an operation represents. */
23
+ export type TelemetryOperationKind = "model" | "raw" | "transaction" | "extension";
24
+ /** Which execution path ran a statement. */
25
+ export type TelemetryStatementKind = "rows" | "affected" | "raw" | "extension";
26
+ /** Terminal result of an operation or statement. */
27
+ export type TelemetryOutcome = "success" | "failure";
28
+ /**
29
+ * Where an operation ended. `completed` is the only success stage; the rest name
30
+ * the phase that failed, so a consumer can tell a refusal before any SQL from a
31
+ * rollback failure after every statement succeeded.
32
+ */
33
+ export type TelemetryStage =
34
+ /** Never dispatched: refused before it could run (array-$transaction claim refusal, expired handle). */
35
+ "refused"
36
+ /** Failed before any SQL was sent: argument validation, planning, capability refusal. */
37
+ | "validation"
38
+ /** A statement failed at the adapter. */
39
+ | "statement"
40
+ /**
41
+ * Statements succeeded; the ORM failed while producing the result — row
42
+ * decoding, relation loading, computed fields, or an `OrThrow` miss.
43
+ */
44
+ | "decode"
45
+ /** Statements succeeded; the surrounding transaction failed to commit or roll back. */
46
+ | "transaction"
47
+ /** Everything succeeded. */
48
+ | "completed"
49
+ /** Failure that could not be attributed to a phase. */
50
+ | "unknown";
51
+ /** Which exporter callback a throw came out of. */
52
+ export type TelemetryExportPhase = "operation" | "statement" | "drop" | "flush" | "shutdown" | "sampler" | "context";
53
+ /**
54
+ * The host's parent context, captured SYNCHRONOUSLY at call time and carried
55
+ * back on the operation event. Opaque on purpose: an OpenTelemetry `Context`, a
56
+ * request object, a trace id — VibeORM never inspects it, never serializes it
57
+ * and never uses it as a metric label.
58
+ */
59
+ export type TelemetryParentContext = unknown;
60
+ /** One SQL execution inside an operation. */
61
+ export type TelemetryStatementEvent = {
62
+ readonly operationId: string;
63
+ /** 0-based position inside its operation. */
64
+ readonly index: number;
65
+ readonly kind: TelemetryStatementKind;
66
+ /** `null` for raw SQL, which has no model. */
67
+ readonly model: string | null;
68
+ readonly method: string;
69
+ readonly dialect: Dialect;
70
+ readonly provider: Provider;
71
+ /** Stable normalized grouping key — bounded, literal-free, safe as a metric label. */
72
+ readonly fingerprint: string;
73
+ readonly outcome: TelemetryOutcome;
74
+ /**
75
+ * Elapsed time of the adapter call. This includes networking and may include
76
+ * pool wait and driver-side decoding — it is NOT pure server execution time.
77
+ */
78
+ readonly durationMs: number;
79
+ /** How many bound parameters the statement carried. Values are not reported. */
80
+ readonly parameterCount: number;
81
+ readonly inTransaction: boolean;
82
+ /** Absent when this path cannot know the row count. */
83
+ readonly rowCount?: number;
84
+ /** Stable code of the failure; message text and cause are never attached. */
85
+ readonly errorCode?: VibeErrorCode;
86
+ /** True when `durationMs` crossed the configured slow-statement threshold. */
87
+ readonly slow?: boolean;
88
+ /** Rendered SQL — only with `captureSql: true`. */
89
+ readonly sql?: string;
90
+ /** Parameter values — only with `captureParameterValues: true`. */
91
+ readonly parameters?: readonly unknown[];
92
+ };
93
+ /** Optional timing subdivision; every member is absent when unavailable. */
94
+ export type TelemetryTimingDetail = {
95
+ /** Statement rendering (cache hit or real render) inside this operation. */
96
+ readonly renderMs?: number;
97
+ /** Summed adapter-call elapsed time — networking and possibly pool wait included. */
98
+ readonly adapterMs?: number;
99
+ /** Operation time not spent in the adapter: planning, decoding, relations, computed fields. */
100
+ readonly processingMs?: number;
101
+ };
102
+ /** One public ORM call, start to terminal outcome. Emitted exactly once. */
103
+ export type TelemetryOperationEvent = {
104
+ readonly operationId: string;
105
+ /** The enclosing transaction/extension operation, when there is one. */
106
+ readonly parentOperationId?: string;
107
+ /** The host context captured at call time, handed straight back. */
108
+ readonly context?: TelemetryParentContext;
109
+ readonly kind: TelemetryOperationKind;
110
+ readonly model: string | null;
111
+ readonly method: string;
112
+ readonly dialect: Dialect;
113
+ readonly provider: Provider;
114
+ readonly outcome: TelemetryOutcome;
115
+ readonly stage: TelemetryStage;
116
+ /** False when the operation was refused before it ever ran. */
117
+ readonly dispatched: boolean;
118
+ /** Epoch milliseconds at ACTUAL dispatch. Absent when never dispatched. */
119
+ readonly startedAt?: number;
120
+ /** Dispatch to terminal outcome. Absent when never dispatched. */
121
+ readonly durationMs?: number;
122
+ /**
123
+ * Creation to dispatch — the deferred-dispatch queue delay. Labelled
124
+ * separately and never folded into `durationMs`.
125
+ */
126
+ readonly queueWaitMs?: number;
127
+ readonly statementCount: number;
128
+ /** Summed statement elapsed time. Absent when no statement ran. */
129
+ readonly statementDurationMs?: number;
130
+ /** Rows the operation is known to have produced or affected. Absent when unknown. */
131
+ readonly rowCount?: number;
132
+ readonly errorCode?: VibeErrorCode;
133
+ readonly detail?: TelemetryTimingDetail;
134
+ readonly statements: readonly TelemetryStatementEvent[];
135
+ /** Statements observed beyond `maxStatementsPerOperation` (counted, not kept). */
136
+ readonly droppedStatements?: number;
137
+ /** True when `durationMs` crossed the configured slow-operation threshold. */
138
+ readonly slow?: boolean;
139
+ /** An emitted span is by definition a sampled span — see the metrics snapshot for totals. */
140
+ readonly sampled: true;
141
+ };
142
+ /** Something was counted but not delivered. */
143
+ export type TelemetryDropEvent = {
144
+ readonly reason: "buffer_full" | "statement_limit";
145
+ readonly count: number;
146
+ };
147
+ /**
148
+ * Where events go. Every callback is invoked inside a guard: a throw is routed
149
+ * to `onExporterError` and can never change a database outcome, a query's
150
+ * arguments or its results.
151
+ *
152
+ * `shutdown` is NEVER called by the client — `$disconnect()` flushes only,
153
+ * because the provider behind a shared exporter belongs to the host.
154
+ */
155
+ export type TelemetryExporter = {
156
+ readonly onOperation?: (event: TelemetryOperationEvent) => void;
157
+ readonly onStatement?: (event: TelemetryStatementEvent) => void;
158
+ readonly onDrop?: (event: TelemetryDropEvent) => void;
159
+ readonly flush?: () => void | Promise<void>;
160
+ readonly shutdown?: () => void | Promise<void>;
161
+ };
162
+ /** What a sampler is told, before any work is done. */
163
+ export type TelemetrySamplerInput = {
164
+ readonly kind: TelemetryOperationKind;
165
+ readonly model: string | null;
166
+ readonly method: string;
167
+ readonly context?: TelemetryParentContext;
168
+ };
169
+ /** How exported operations reach the exporter. */
170
+ export type TelemetryDelivery = "immediate" | "buffered";
171
+ /**
172
+ * The host's handle on this client's telemetry: complete counters (spans may be
173
+ * sampled, these are not) and EXPLICIT lifecycle. `shutdown` exists here and
174
+ * only here — the client itself never calls it.
175
+ */
176
+ export type TelemetryHandle = {
177
+ readonly metrics: () => TelemetryMetricsSnapshot;
178
+ readonly flush: () => Promise<void>;
179
+ readonly shutdown: () => Promise<void>;
180
+ };
181
+ /** Telemetry configuration — the single `ClientOptions.telemetry` value. */
182
+ export type TelemetryOptions = {
183
+ /** Where events go. Required. */
184
+ readonly exporter: TelemetryExporter;
185
+ /** Attach rendered SQL text to statement events. Default FALSE: raw text can embed secrets. */
186
+ readonly captureSql?: boolean;
187
+ /** Attach parameter VALUES. Default FALSE: values are redacted, only the count is reported. */
188
+ readonly captureParameterValues?: boolean;
189
+ /** Split render / adapter / processing time on the operation event. Default FALSE. */
190
+ readonly detailedTimings?: boolean;
191
+ /** Probability a span is kept, 0..1 (default 1). Counters still count every execution. */
192
+ readonly sampleRate?: number;
193
+ /** Deterministic sampling decision; takes precedence over `sampleRate`. */
194
+ readonly sampler?: (input: TelemetrySamplerInput) => boolean;
195
+ /**
196
+ * Read the host's current parent context. Called SYNCHRONOUSLY when the ORM
197
+ * call is created — before the deferred dispatch — so an application span
198
+ * survives the async boundary between call and execution.
199
+ */
200
+ readonly context?: () => TelemetryParentContext;
201
+ /** `"immediate"` (default) exports at settle; `"buffered"` holds until `flush()`. */
202
+ readonly delivery?: TelemetryDelivery;
203
+ /** Buffered-delivery ceiling; the oldest entries are dropped and counted. */
204
+ readonly maxBufferedOperations?: number;
205
+ /** Statements kept per operation; the rest are counted in `droppedStatements`. */
206
+ readonly maxStatementsPerOperation?: number;
207
+ /** `slow` marker threshold for a statement, in milliseconds. */
208
+ readonly slowStatementMs?: number;
209
+ /** `slow` marker threshold for an operation, in milliseconds. */
210
+ readonly slowOperationMs?: number;
211
+ /** Told when an exporter callback throws. Itself guarded; never rethrows into the query. */
212
+ readonly onExporterError?: (params: {
213
+ error: unknown;
214
+ phase: TelemetryExportPhase;
215
+ }) => void;
216
+ /**
217
+ * Called ONCE, synchronously, while the client is being built, with the
218
+ * handle that owns metrics and lifecycle. Take it if you want complete
219
+ * counters under sampling, or if you want to flush/shut down deliberately.
220
+ */
221
+ readonly onReady?: (handle: TelemetryHandle) => void;
222
+ };
223
+ /** A fixed-bucket latency histogram. */
224
+ export type TelemetryHistogram = {
225
+ /** Upper bucket bounds in milliseconds; the implicit last bucket is unbounded. */
226
+ readonly bounds: readonly number[];
227
+ /** One count per bound plus one overflow bucket. */
228
+ readonly counts: readonly number[];
229
+ readonly sum: number;
230
+ readonly count: number;
231
+ };
232
+ /**
233
+ * Counters and histograms.
234
+ *
235
+ * `countsRepresent: "all"` is a promise, not decoration: counters and histograms
236
+ * are updated for EVERY execution regardless of sampling, so they never pretend
237
+ * sampled spans are complete query counts. `sampledOperations` says how many of
238
+ * those also produced a span.
239
+ */
240
+ export type TelemetryMetricsSnapshot = {
241
+ readonly countsRepresent: "all";
242
+ readonly sampleRate: number;
243
+ readonly sampledOperations: number;
244
+ readonly operations: {
245
+ readonly total: number;
246
+ readonly failed: number;
247
+ readonly refused: number;
248
+ };
249
+ readonly statements: {
250
+ readonly total: number;
251
+ readonly failed: number;
252
+ };
253
+ /** `known` = operations whose row count was knowable; `total` = the sum of those. */
254
+ readonly rows: {
255
+ readonly known: number;
256
+ readonly total: number;
257
+ };
258
+ readonly operationLatencyMs: TelemetryHistogram;
259
+ readonly statementLatencyMs: TelemetryHistogram;
260
+ readonly dropped: {
261
+ readonly operations: number;
262
+ readonly statements: number;
263
+ };
264
+ };
265
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/telemetry/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIxE,wDAAwD;AACxD,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,KAAK,GAAG,aAAa,GAAG,WAAW,CAAC;AAEnF,4CAA4C;AAC5C,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,GAAG,WAAW,CAAC;AAE/E,oDAAoD;AACpD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAErD;;;;GAIG;AACH,MAAM,M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Q,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CAChF,CAAC"}
@@ -38,9 +38,11 @@ export type WriteValidators = {
38
38
  };
39
39
  /**
40
40
  * Validate one data row (create/update shape) for `model`, recursing into
41
- * nested `create`/`createMany`/`connectOrCreate.create`/`upsert.create` and
42
- * nested `update` bodies on related models that carry validators. Returns the
43
- * (possibly transformed) data — Standard Schema allows coercion.
41
+ * every nested write body on every related model. Returns the (possibly
42
+ * transformed) data — Standard Schema allows coercion.
43
+ *
44
+ * Traversal is UNCONDITIONAL (F09): it does not stop at a related model that
45
+ * configures no validators of its own, because a model further down may.
44
46
  */
45
47
  export declare function validateWriteData(params: {
46
48
  meta: RuntimeMeta;
@@ -1 +1 @@
1
- {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9D,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,WAAW,GAAG;QAAE,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;CAC5E,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK,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AM,CAAC,MAAM,EAAE,OAAO,CAAC,CAajC;CACF;AAkXD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,cAAc,CAAC;CAC5B,GAAG,eAAe,CAgBlB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;CACjD,GAAG,IAAI,CAKP"}
@@ -0,0 +1,14 @@
1
+ import type { VibeError } from "@vibeorm/schema";
2
+ /** Carry a protected field's required value through nested-write rewriting. */
3
+ export declare function protectWriteScope(params: {
4
+ data: Record<string, unknown>;
5
+ field: string;
6
+ value: unknown;
7
+ error: VibeError;
8
+ }): Record<string, unknown>;
9
+ /** Refuse a relation-derived assignment before it can overwrite a protected field. */
10
+ export declare function assertWriteScope(params: {
11
+ data: Record<string, unknown>;
12
+ assignments: Record<string, unknown>;
13
+ }): void;
14
+ //# sourceMappingURL=write-scope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write-scope.d.ts","sourceRoot":"","sources":["../src/write-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAWjD,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;CAClB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAG1B;AAED,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC,GAAG,IAAI,CAIP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibeorm/runtime",
3
- "version": "2.0.0-alpha.9",
3
+ "version": "2.0.1",
4
4
  "description": "Driver-agnostic query engine and client runtime for VibeORM v2",
5
5
  "keywords": [
6
6
  "orm",
@@ -41,12 +41,12 @@
41
41
  "bun": ">=1.2.0"
42
42
  },
43
43
  "dependencies": {
44
- "@vibeorm/schema": "2.0.0-alpha.7",
45
- "@vibeorm/sql": "2.0.0-alpha.7"
44
+ "@vibeorm/schema": "2.0.0",
45
+ "@vibeorm/sql": "2.0.1"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@electric-sql/pglite": "^0.5.4",
49
- "@vibeorm/scoped-conformance": "0.1.0-alpha.0"
49
+ "@vibeorm/scoped-conformance": "0.1.0"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"