@gaganref/confect-test 10.3.1-fork.92 → 10.3.1-fork.93

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 (36) hide show
  1. package/dist/TestConfect.d.ts +26 -0
  2. package/dist/TestConfect.d.ts.map +1 -1
  3. package/dist/TestConfect.js +9 -1
  4. package/dist/TestConfect.js.map +1 -1
  5. package/dist/internal/ConvexTest.d.ts +26 -1
  6. package/dist/internal/ConvexTest.d.ts.map +1 -1
  7. package/dist/internal/ConvexTest.js +55 -27
  8. package/dist/internal/ConvexTest.js.map +1 -1
  9. package/dist/internal/Execution.d.ts +138 -1
  10. package/dist/internal/Execution.d.ts.map +1 -1
  11. package/dist/internal/Execution.js +595 -182
  12. package/dist/internal/Execution.js.map +1 -1
  13. package/dist/internal/KernelRefusal.d.ts +134 -0
  14. package/dist/internal/KernelRefusal.d.ts.map +1 -1
  15. package/dist/internal/KernelRefusal.js +134 -1
  16. package/dist/internal/KernelRefusal.js.map +1 -1
  17. package/dist/internal/Redaction.d.ts +142 -0
  18. package/dist/internal/Redaction.d.ts.map +1 -0
  19. package/dist/internal/Redaction.js +448 -0
  20. package/dist/internal/Redaction.js.map +1 -0
  21. package/dist/internal/Snapshot.d.ts +298 -0
  22. package/dist/internal/Snapshot.d.ts.map +1 -0
  23. package/dist/internal/Snapshot.js +532 -0
  24. package/dist/internal/Snapshot.js.map +1 -0
  25. package/dist/internal/Subscriptions.d.ts +13 -0
  26. package/dist/internal/Subscriptions.d.ts.map +1 -1
  27. package/dist/internal/Subscriptions.js +27 -3
  28. package/dist/internal/Subscriptions.js.map +1 -1
  29. package/package.json +3 -3
  30. package/src/TestConfect.ts +63 -4
  31. package/src/internal/ConvexTest.ts +135 -38
  32. package/src/internal/Execution.ts +886 -287
  33. package/src/internal/KernelRefusal.ts +160 -0
  34. package/src/internal/Redaction.ts +730 -0
  35. package/src/internal/Snapshot.ts +945 -0
  36. package/src/internal/Subscriptions.ts +34 -4
@@ -98,5 +98,139 @@ export declare class UnknownStandingSource extends UnknownStandingSource_base {
98
98
  }
99
99
  export declare const requiresBinary: (operation: RequiresBinary["operation"]) => RequiresBinary;
100
100
  export declare const rowPending: (operation: string, row: number) => KernelRowPending;
101
+ declare const SnapshotMalformed_base: Schema.Class<SnapshotMalformed, Schema.TaggedStruct<"SnapshotMalformed", {
102
+ readonly reason: Schema.String;
103
+ readonly message: Schema.String;
104
+ }>, import("effect/Cause").YieldableError>;
105
+ /**
106
+ * Snapshot bytes are not a kernel snapshot this kernel reads: an unknown
107
+ * header, a body that is not the snapshot's JSON, or a value that does not
108
+ * decode.
109
+ */
110
+ export declare class SnapshotMalformed extends SnapshotMalformed_base {
111
+ }
112
+ declare const SnapshotDigestMismatch_base: Schema.Class<SnapshotDigestMismatch, Schema.TaggedStruct<"SnapshotDigestMismatch", {
113
+ readonly expected: Schema.String;
114
+ readonly actual: Schema.String;
115
+ readonly message: Schema.String;
116
+ }>, import("effect/Cause").YieldableError>;
117
+ /**
118
+ * A snapshot's body does not hash to the digest its header names, so its bytes
119
+ * changed after export.
120
+ */
121
+ export declare class SnapshotDigestMismatch extends SnapshotDigestMismatch_base {
122
+ }
123
+ declare const SnapshotComponentMismatch_base: Schema.Class<SnapshotComponentMismatch, Schema.TaggedStruct<"SnapshotComponentMismatch", {
124
+ readonly snapshot: Schema.$Array<Schema.String>;
125
+ readonly registered: Schema.$Array<Schema.String>;
126
+ readonly message: Schema.String;
127
+ }>, import("effect/Cause").YieldableError>;
128
+ /**
129
+ * A snapshot's components are not the components registered on the world
130
+ * restoring it.
131
+ */
132
+ export declare class SnapshotComponentMismatch extends SnapshotComponentMismatch_base {
133
+ }
134
+ declare const SnapshotWorldUnresolved_base: Schema.Class<SnapshotWorldUnresolved, Schema.TaggedStruct<"SnapshotWorldUnresolved", {
135
+ readonly name: Schema.String;
136
+ readonly reason: Schema.Literals<readonly ["missing", "ambiguous"]>;
137
+ readonly message: Schema.String;
138
+ }>, import("effect/Cause").YieldableError>;
139
+ /**
140
+ * A job's test world is named by no world, or by more than one, so the job
141
+ * could not run under the world that scheduled it.
142
+ */
143
+ export declare class SnapshotWorldUnresolved extends SnapshotWorldUnresolved_base {
144
+ }
145
+ declare const SnapshotWorldBusy_base: Schema.Class<SnapshotWorldBusy, Schema.TaggedStruct<"SnapshotWorldBusy", {
146
+ readonly version: Schema.Int;
147
+ readonly held: Schema.$Array<Schema.String>;
148
+ readonly message: Schema.String;
149
+ }>, import("effect/Cause").YieldableError>;
150
+ /**
151
+ * A world holds work a snapshot does not carry: attempts held for `apply`, or,
152
+ * when it restores, commits of its own.
153
+ */
154
+ export declare class SnapshotWorldBusy extends SnapshotWorldBusy_base {
155
+ }
156
+ declare const SnapshotSecretMissing_base: Schema.Class<SnapshotSecretMissing, Schema.TaggedStruct<"SnapshotSecretMissing", {
157
+ readonly ref: Schema.String;
158
+ readonly message: Schema.String;
159
+ }>, import("effect/Cause").YieldableError>;
160
+ /**
161
+ * A snapshot marks a secret the restore was not given, so the raw value its
162
+ * replay needs is not in memory.
163
+ */
164
+ export declare class SnapshotSecretMissing extends SnapshotSecretMissing_base {
165
+ }
166
+ declare const SnapshotWorldRunning_base: Schema.Class<SnapshotWorldRunning, Schema.TaggedStruct<"SnapshotWorldRunning", {
167
+ readonly registry: Schema.Literals<readonly ["running", "walks", "functions"]>;
168
+ readonly count: Schema.Int;
169
+ readonly message: Schema.String;
170
+ }>, import("effect/Cause").YieldableError>;
171
+ /**
172
+ * A world is running work a snapshot taken or restored now would split: calls
173
+ * from the test, scheduler walks, or function executions, nested and detached
174
+ * ones included.
175
+ */
176
+ export declare class SnapshotWorldRunning extends SnapshotWorldRunning_base {
177
+ }
178
+ declare const SnapshotSubscribed_base: Schema.Class<SnapshotSubscribed, Schema.TaggedStruct<"SnapshotSubscribed", {
179
+ readonly subscribers: Schema.Int;
180
+ readonly message: Schema.String;
181
+ }>, import("effect/Cause").YieldableError>;
182
+ /**
183
+ * A world has subscribers, whose identity versions a restore would rewind.
184
+ * Subscriptions are live client state, so a restore needs a world with none.
185
+ */
186
+ export declare class SnapshotSubscribed extends SnapshotSubscribed_base {
187
+ }
188
+ declare const SnapshotAllocatorBehind_base: Schema.Class<SnapshotAllocatorBehind, Schema.TaggedStruct<"SnapshotAllocatorBehind", {
189
+ readonly allocator: Schema.Literals<readonly ["nextDocumentId", "lastCreationTime", "nextAttemptId", "identityEpoch"]>;
190
+ readonly value: Schema.Finite;
191
+ readonly required: Schema.Finite;
192
+ readonly message: Schema.String;
193
+ }>, import("effect/Cause").YieldableError>;
194
+ /**
195
+ * A snapshot's identity counters stand at or behind an identity its state
196
+ * already holds, so the next allocation would reuse one.
197
+ */
198
+ export declare class SnapshotAllocatorBehind extends SnapshotAllocatorBehind_base {
199
+ }
200
+ declare const SnapshotRowInconsistent_base: Schema.Class<SnapshotRowInconsistent, Schema.TaggedStruct<"SnapshotRowInconsistent", {
201
+ readonly componentPath: Schema.String;
202
+ readonly id: Schema.String;
203
+ readonly reason: Schema.Literals<readonly ["id", "component", "log", "row", "systemFields", "duplicate"]>;
204
+ readonly message: Schema.String;
205
+ }>, import("effect/Cause").YieldableError>;
206
+ /**
207
+ * A snapshot's rows are not what its write log publishes: a row filed under
208
+ * another table or an unregistered component, a version the log does not give
209
+ * it, or a log change whose before value is not the row it replaced.
210
+ */
211
+ export declare class SnapshotRowInconsistent extends SnapshotRowInconsistent_base {
212
+ }
213
+ declare const SnapshotTimestampInconsistent_base: Schema.Class<SnapshotTimestampInconsistent, Schema.TaggedStruct<"SnapshotTimestampInconsistent", {
214
+ readonly version: Schema.Int;
215
+ readonly commitTs: Schema.String;
216
+ readonly message: Schema.String;
217
+ }>, import("effect/Cause").YieldableError>;
218
+ /**
219
+ * A snapshot's commit timestamps do not strictly increase through its write
220
+ * log, or its latest commit timestamp is not the log's last.
221
+ */
222
+ export declare class SnapshotTimestampInconsistent extends SnapshotTimestampInconsistent_base {
223
+ }
224
+ declare const SnapshotJobInconsistent_base: Schema.Class<SnapshotJobInconsistent, Schema.TaggedStruct<"SnapshotJobInconsistent", {
225
+ readonly id: Schema.String;
226
+ readonly reason: Schema.Literals<readonly ["row", "untargeted", "inProgress", "component", "function", "duplicate"]>;
227
+ readonly message: Schema.String;
228
+ }>, import("effect/Cause").YieldableError>;
229
+ /**
230
+ * A snapshot's jobs and job rows disagree: a job with no row, a row with no
231
+ * job, a job left running, or a target no registered component exports.
232
+ */
233
+ export declare class SnapshotJobInconsistent extends SnapshotJobInconsistent_base {
234
+ }
101
235
  export {};
102
236
  //# sourceMappingURL=KernelRefusal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"KernelRefusal.d.ts","sourceRoot":"","sources":["../../src/internal/KernelRefusal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;AAExC;;GAEG;AACH,qBAAa,cAAe,SAAQ,mBAMnC;CAAG;;;;;;AAEJ;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,qBAOrC;CAAG;;;;;AAEJ;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,wBAGxC;CAAG;;;;;AAEJ;;;GAGG;AACH,qBAAa,mCAAoC,SAAQ,wCAGxD;CAAG;;;;;AAEJ;;;GAGG;AACH,qBAAa,aAAc,SAAQ,kBAGlC;CAAG;;;;;AAEJ;;;GAGG;AACH,qBAAa,YAAa,SAAQ,iBAGjC;CAAG;;;;;;;AAEJ;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,0BAQ1C;CAAG;;;;;;;;;AAEJ;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,wBASxC;CAAG;;;;;;AAEJ;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,0BAG1C;CAAG;AAEJ,eAAO,MAAM,cAAc,cAAe,cAAc,CAAC,WAAW,CAAC,mBAIjE,CAAC;AAEL,eAAO,MAAM,UAAU,cAAe,MAAM,OAAO,MAAM,qBAKrD,CAAC"}
1
+ {"version":3,"file":"KernelRefusal.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C;CAAG;;;;;AAEJ;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,uBAGvC;CAAG;;;;;;;AAEJ;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,4BAa5C;CAAG;;;;;;;AAEJ;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,4BAe5C;CAAG;;;;;;AAEJ;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,kCAGlD;CAAG;;;;;;AAEJ;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,4BAc5C;CAAG"}
@@ -88,7 +88,140 @@ const rowPending = (operation, row) => new KernelRowPending({
88
88
  row,
89
89
  message: `The test kernel supplies ${operation} in build-order row ${row}.`
90
90
  });
91
+ /**
92
+ * Snapshot bytes are not a kernel snapshot this kernel reads: an unknown
93
+ * header, a body that is not the snapshot's JSON, or a value that does not
94
+ * decode.
95
+ */
96
+ var SnapshotMalformed = class extends Schema.TaggedError()("SnapshotMalformed", {
97
+ reason: Schema.String,
98
+ message: Schema.String
99
+ }) {};
100
+ /**
101
+ * A snapshot's body does not hash to the digest its header names, so its bytes
102
+ * changed after export.
103
+ */
104
+ var SnapshotDigestMismatch = class extends Schema.TaggedError()("SnapshotDigestMismatch", {
105
+ expected: Schema.String,
106
+ actual: Schema.String,
107
+ message: Schema.String
108
+ }) {};
109
+ /**
110
+ * A snapshot's components are not the components registered on the world
111
+ * restoring it.
112
+ */
113
+ var SnapshotComponentMismatch = class extends Schema.TaggedError()("SnapshotComponentMismatch", {
114
+ snapshot: Schema.Array(Schema.String),
115
+ registered: Schema.Array(Schema.String),
116
+ message: Schema.String
117
+ }) {};
118
+ /**
119
+ * A job's test world is named by no world, or by more than one, so the job
120
+ * could not run under the world that scheduled it.
121
+ */
122
+ var SnapshotWorldUnresolved = class extends Schema.TaggedError()("SnapshotWorldUnresolved", {
123
+ name: Schema.String,
124
+ reason: Schema.Literals(["missing", "ambiguous"]),
125
+ message: Schema.String
126
+ }) {};
127
+ /**
128
+ * A world holds work a snapshot does not carry: attempts held for `apply`, or,
129
+ * when it restores, commits of its own.
130
+ */
131
+ var SnapshotWorldBusy = class extends Schema.TaggedError()("SnapshotWorldBusy", {
132
+ version: Schema.Int,
133
+ held: Schema.Array(Schema.String),
134
+ message: Schema.String
135
+ }) {};
136
+ /**
137
+ * A snapshot marks a secret the restore was not given, so the raw value its
138
+ * replay needs is not in memory.
139
+ */
140
+ var SnapshotSecretMissing = class extends Schema.TaggedError()("SnapshotSecretMissing", {
141
+ ref: Schema.String,
142
+ message: Schema.String
143
+ }) {};
144
+ /**
145
+ * A world is running work a snapshot taken or restored now would split: calls
146
+ * from the test, scheduler walks, or function executions, nested and detached
147
+ * ones included.
148
+ */
149
+ var SnapshotWorldRunning = class extends Schema.TaggedError()("SnapshotWorldRunning", {
150
+ registry: Schema.Literals([
151
+ "running",
152
+ "walks",
153
+ "functions"
154
+ ]),
155
+ count: Schema.Int,
156
+ message: Schema.String
157
+ }) {};
158
+ /**
159
+ * A world has subscribers, whose identity versions a restore would rewind.
160
+ * Subscriptions are live client state, so a restore needs a world with none.
161
+ */
162
+ var SnapshotSubscribed = class extends Schema.TaggedError()("SnapshotSubscribed", {
163
+ subscribers: Schema.Int,
164
+ message: Schema.String
165
+ }) {};
166
+ /**
167
+ * A snapshot's identity counters stand at or behind an identity its state
168
+ * already holds, so the next allocation would reuse one.
169
+ */
170
+ var SnapshotAllocatorBehind = class extends Schema.TaggedError()("SnapshotAllocatorBehind", {
171
+ allocator: Schema.Literals([
172
+ "nextDocumentId",
173
+ "lastCreationTime",
174
+ "nextAttemptId",
175
+ "identityEpoch"
176
+ ]),
177
+ value: Schema.Finite,
178
+ required: Schema.Finite,
179
+ message: Schema.String
180
+ }) {};
181
+ /**
182
+ * A snapshot's rows are not what its write log publishes: a row filed under
183
+ * another table or an unregistered component, a version the log does not give
184
+ * it, or a log change whose before value is not the row it replaced.
185
+ */
186
+ var SnapshotRowInconsistent = class extends Schema.TaggedError()("SnapshotRowInconsistent", {
187
+ componentPath: Schema.String,
188
+ id: Schema.String,
189
+ reason: Schema.Literals([
190
+ "id",
191
+ "component",
192
+ "log",
193
+ "row",
194
+ "systemFields",
195
+ "duplicate"
196
+ ]),
197
+ message: Schema.String
198
+ }) {};
199
+ /**
200
+ * A snapshot's commit timestamps do not strictly increase through its write
201
+ * log, or its latest commit timestamp is not the log's last.
202
+ */
203
+ var SnapshotTimestampInconsistent = class extends Schema.TaggedError()("SnapshotTimestampInconsistent", {
204
+ version: Schema.Int,
205
+ commitTs: Schema.String,
206
+ message: Schema.String
207
+ }) {};
208
+ /**
209
+ * A snapshot's jobs and job rows disagree: a job with no row, a row with no
210
+ * job, a job left running, or a target no registered component exports.
211
+ */
212
+ var SnapshotJobInconsistent = class extends Schema.TaggedError()("SnapshotJobInconsistent", {
213
+ id: Schema.String,
214
+ reason: Schema.Literals([
215
+ "row",
216
+ "untargeted",
217
+ "inProgress",
218
+ "component",
219
+ "function",
220
+ "duplicate"
221
+ ]),
222
+ message: Schema.String
223
+ }) {};
91
224
  //#endregion
92
- export { ClosedAttempt, CommitTsNotIncreasing, DrainBudgetExceeded, KernelRowPending, OptimisticConcurrencyControlFailure, RegisteredAfterOpen, RequiresBinary, StaleAttempt, UnknownStandingSource, requiresBinary, rowPending };
225
+ export { ClosedAttempt, CommitTsNotIncreasing, DrainBudgetExceeded, KernelRowPending, OptimisticConcurrencyControlFailure, RegisteredAfterOpen, RequiresBinary, SnapshotAllocatorBehind, SnapshotComponentMismatch, SnapshotDigestMismatch, SnapshotJobInconsistent, SnapshotMalformed, SnapshotRowInconsistent, SnapshotSecretMissing, SnapshotSubscribed, SnapshotTimestampInconsistent, SnapshotWorldBusy, SnapshotWorldRunning, SnapshotWorldUnresolved, StaleAttempt, UnknownStandingSource, requiresBinary, rowPending };
93
226
 
94
227
  //# sourceMappingURL=KernelRefusal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KernelRefusal.js","names":[],"sources":["../../src/internal/KernelRefusal.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\n/**\n * The kernel never answers this operation in process. Only the binary does.\n */\nexport class RequiresBinary extends Schema.TaggedError<RequiresBinary>()(\n \"RequiresBinary\",\n {\n operation: Schema.Literals([\"textSearch\", \"vectorSearch\"]),\n message: Schema.String,\n },\n) {}\n\n/**\n * A later kernel row supplies this operation. Until then the kernel refuses it\n * rather than answer with convex-test's behaviour.\n */\nexport class KernelRowPending extends Schema.TaggedError<KernelRowPending>()(\n \"KernelRowPending\",\n {\n operation: Schema.String,\n row: Schema.Int,\n message: Schema.String,\n },\n) {}\n\n/**\n * A component was registered after the test backend opened, so its modules\n * would load after a function had already run.\n */\nexport class RegisteredAfterOpen extends Schema.TaggedError<RegisteredAfterOpen>()(\n \"RegisteredAfterOpen\",\n { componentPath: Schema.String, message: Schema.String },\n) {}\n\n/**\n * Every attempt of a mutation read data a commit changed before it could\n * publish. The kernel gives up on attempt 5.\n */\nexport class OptimisticConcurrencyControlFailure extends Schema.TaggedError<OptimisticConcurrencyControlFailure>()(\n \"OptimisticConcurrencyControlFailure\",\n { attempts: Schema.Int, message: Schema.String },\n) {}\n\n/**\n * A syscall reached a mutation's attempt after the mutation returned and its\n * syscalls drained, so the attempt was already held or published.\n */\nexport class ClosedAttempt extends Schema.TaggedError<ClosedAttempt>()(\n \"ClosedAttempt\",\n { operation: Schema.String, message: Schema.String },\n) {}\n\n/**\n * `apply` named an attempt the kernel does not hold: it was already applied, or\n * never prepared.\n */\nexport class StaleAttempt extends Schema.TaggedError<StaleAttempt>()(\n \"StaleAttempt\",\n { id: Schema.String, message: Schema.String },\n) {}\n\n/**\n * The runtime answered a commit timestamp no greater than the previous\n * commit's.\n */\nexport class CommitTsNotIncreasing extends Schema.TaggedError<CommitTsNotIncreasing>()(\n \"CommitTsNotIncreasing\",\n {\n version: Schema.Int,\n previous: Schema.BigInt,\n commitTs: Schema.BigInt,\n message: Schema.String,\n },\n) {}\n\n/**\n * Draining scheduled functions ran its budget of jobs and work still remained.\n * A self-rescheduling function keeps the drain from ending unless its kit\n * declares it standing.\n */\nexport class DrainBudgetExceeded extends Schema.TaggedError<DrainBudgetExceeded>()(\n \"DrainBudgetExceeded\",\n {\n budget: Schema.Int,\n pending: Schema.Array(\n Schema.Struct({ componentPath: Schema.String, name: Schema.String }),\n ),\n message: Schema.String,\n },\n) {}\n\n/**\n * A component declared a standing source its modules do not export.\n */\nexport class UnknownStandingSource extends Schema.TaggedError<UnknownStandingSource>()(\n \"UnknownStandingSource\",\n { componentPath: Schema.String, name: Schema.String, message: Schema.String },\n) {}\n\nexport const requiresBinary = (operation: RequiresBinary[\"operation\"]) =>\n new RequiresBinary({\n operation,\n message: `The test kernel does not simulate ${operation}. Run this case against the Convex binary.`,\n });\n\nexport const rowPending = (operation: string, row: number) =>\n new KernelRowPending({\n operation,\n row,\n message: `The test kernel supplies ${operation} in build-order row ${row}.`,\n });\n"],"mappings":";;;;;AAKA,IAAa,iBAAb,cAAoC,OAAO,YAA4B,CAAC,CACtE,kBACA;CACE,WAAW,OAAO,SAAS,CAAC,cAAc,cAAc,CAAC;CACzD,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,mBAAb,cAAsC,OAAO,YAA8B,CAAC,CAC1E,oBACA;CACE,WAAW,OAAO;CAClB,KAAK,OAAO;CACZ,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAChF,uBACA;CAAE,eAAe,OAAO;CAAQ,SAAS,OAAO;AAAO,CACzD,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,sCAAb,cAAyD,OAAO,YAAiD,CAAC,CAChH,uCACA;CAAE,UAAU,OAAO;CAAK,SAAS,OAAO;AAAO,CACjD,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CACpE,iBACA;CAAE,WAAW,OAAO;CAAQ,SAAS,OAAO;AAAO,CACrD,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAClE,gBACA;CAAE,IAAI,OAAO;CAAQ,SAAS,OAAO;AAAO,CAC9C,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,wBAAb,cAA2C,OAAO,YAAmC,CAAC,CACpF,yBACA;CACE,SAAS,OAAO;CAChB,UAAU,OAAO;CACjB,UAAU,OAAO;CACjB,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC;;;;;;AAOH,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAChF,uBACA;CACE,QAAQ,OAAO;CACf,SAAS,OAAO,MACd,OAAO,OAAO;EAAE,eAAe,OAAO;EAAQ,MAAM,OAAO;CAAO,CAAC,CACrE;CACA,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC;;;;AAKH,IAAa,wBAAb,cAA2C,OAAO,YAAmC,CAAC,CACpF,yBACA;CAAE,eAAe,OAAO;CAAQ,MAAM,OAAO;CAAQ,SAAS,OAAO;AAAO,CAC9E,CAAC,CAAC,CAAC;AAEH,MAAa,kBAAkB,cAC7B,IAAI,eAAe;CACjB;CACA,SAAS,qCAAqC,UAAU;AAC1D,CAAC;AAEH,MAAa,cAAc,WAAmB,QAC5C,IAAI,iBAAiB;CACnB;CACA;CACA,SAAS,4BAA4B,UAAU,sBAAsB,IAAI;AAC3E,CAAC"}
1
+ {"version":3,"file":"KernelRefusal.js","names":[],"sources":["../../src/internal/KernelRefusal.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\n/**\n * The kernel never answers this operation in process. Only the binary does.\n */\nexport class RequiresBinary extends Schema.TaggedError<RequiresBinary>()(\n \"RequiresBinary\",\n {\n operation: Schema.Literals([\"textSearch\", \"vectorSearch\"]),\n message: Schema.String,\n },\n) {}\n\n/**\n * A later kernel row supplies this operation. Until then the kernel refuses it\n * rather than answer with convex-test's behaviour.\n */\nexport class KernelRowPending extends Schema.TaggedError<KernelRowPending>()(\n \"KernelRowPending\",\n {\n operation: Schema.String,\n row: Schema.Int,\n message: Schema.String,\n },\n) {}\n\n/**\n * A component was registered after the test backend opened, so its modules\n * would load after a function had already run.\n */\nexport class RegisteredAfterOpen extends Schema.TaggedError<RegisteredAfterOpen>()(\n \"RegisteredAfterOpen\",\n { componentPath: Schema.String, message: Schema.String },\n) {}\n\n/**\n * Every attempt of a mutation read data a commit changed before it could\n * publish. The kernel gives up on attempt 5.\n */\nexport class OptimisticConcurrencyControlFailure extends Schema.TaggedError<OptimisticConcurrencyControlFailure>()(\n \"OptimisticConcurrencyControlFailure\",\n { attempts: Schema.Int, message: Schema.String },\n) {}\n\n/**\n * A syscall reached a mutation's attempt after the mutation returned and its\n * syscalls drained, so the attempt was already held or published.\n */\nexport class ClosedAttempt extends Schema.TaggedError<ClosedAttempt>()(\n \"ClosedAttempt\",\n { operation: Schema.String, message: Schema.String },\n) {}\n\n/**\n * `apply` named an attempt the kernel does not hold: it was already applied, or\n * never prepared.\n */\nexport class StaleAttempt extends Schema.TaggedError<StaleAttempt>()(\n \"StaleAttempt\",\n { id: Schema.String, message: Schema.String },\n) {}\n\n/**\n * The runtime answered a commit timestamp no greater than the previous\n * commit's.\n */\nexport class CommitTsNotIncreasing extends Schema.TaggedError<CommitTsNotIncreasing>()(\n \"CommitTsNotIncreasing\",\n {\n version: Schema.Int,\n previous: Schema.BigInt,\n commitTs: Schema.BigInt,\n message: Schema.String,\n },\n) {}\n\n/**\n * Draining scheduled functions ran its budget of jobs and work still remained.\n * A self-rescheduling function keeps the drain from ending unless its kit\n * declares it standing.\n */\nexport class DrainBudgetExceeded extends Schema.TaggedError<DrainBudgetExceeded>()(\n \"DrainBudgetExceeded\",\n {\n budget: Schema.Int,\n pending: Schema.Array(\n Schema.Struct({ componentPath: Schema.String, name: Schema.String }),\n ),\n message: Schema.String,\n },\n) {}\n\n/**\n * A component declared a standing source its modules do not export.\n */\nexport class UnknownStandingSource extends Schema.TaggedError<UnknownStandingSource>()(\n \"UnknownStandingSource\",\n { componentPath: Schema.String, name: Schema.String, message: Schema.String },\n) {}\n\nexport const requiresBinary = (operation: RequiresBinary[\"operation\"]) =>\n new RequiresBinary({\n operation,\n message: `The test kernel does not simulate ${operation}. Run this case against the Convex binary.`,\n });\n\nexport const rowPending = (operation: string, row: number) =>\n new KernelRowPending({\n operation,\n row,\n message: `The test kernel supplies ${operation} in build-order row ${row}.`,\n });\n\n/**\n * Snapshot bytes are not a kernel snapshot this kernel reads: an unknown\n * header, a body that is not the snapshot's JSON, or a value that does not\n * decode.\n */\nexport class SnapshotMalformed extends Schema.TaggedError<SnapshotMalformed>()(\n \"SnapshotMalformed\",\n { reason: Schema.String, message: Schema.String },\n) {}\n\n/**\n * A snapshot's body does not hash to the digest its header names, so its bytes\n * changed after export.\n */\nexport class SnapshotDigestMismatch extends Schema.TaggedError<SnapshotDigestMismatch>()(\n \"SnapshotDigestMismatch\",\n { expected: Schema.String, actual: Schema.String, message: Schema.String },\n) {}\n\n/**\n * A snapshot's components are not the components registered on the world\n * restoring it.\n */\nexport class SnapshotComponentMismatch extends Schema.TaggedError<SnapshotComponentMismatch>()(\n \"SnapshotComponentMismatch\",\n {\n snapshot: Schema.Array(Schema.String),\n registered: Schema.Array(Schema.String),\n message: Schema.String,\n },\n) {}\n\n/**\n * A job's test world is named by no world, or by more than one, so the job\n * could not run under the world that scheduled it.\n */\nexport class SnapshotWorldUnresolved extends Schema.TaggedError<SnapshotWorldUnresolved>()(\n \"SnapshotWorldUnresolved\",\n {\n name: Schema.String,\n reason: Schema.Literals([\"missing\", \"ambiguous\"]),\n message: Schema.String,\n },\n) {}\n\n/**\n * A world holds work a snapshot does not carry: attempts held for `apply`, or,\n * when it restores, commits of its own.\n */\nexport class SnapshotWorldBusy extends Schema.TaggedError<SnapshotWorldBusy>()(\n \"SnapshotWorldBusy\",\n {\n version: Schema.Int,\n held: Schema.Array(Schema.String),\n message: Schema.String,\n },\n) {}\n\n/**\n * A snapshot marks a secret the restore was not given, so the raw value its\n * replay needs is not in memory.\n */\nexport class SnapshotSecretMissing extends Schema.TaggedError<SnapshotSecretMissing>()(\n \"SnapshotSecretMissing\",\n { ref: Schema.String, message: Schema.String },\n) {}\n\n/**\n * A world is running work a snapshot taken or restored now would split: calls\n * from the test, scheduler walks, or function executions, nested and detached\n * ones included.\n */\nexport class SnapshotWorldRunning extends Schema.TaggedError<SnapshotWorldRunning>()(\n \"SnapshotWorldRunning\",\n {\n registry: Schema.Literals([\"running\", \"walks\", \"functions\"]),\n count: Schema.Int,\n message: Schema.String,\n },\n) {}\n\n/**\n * A world has subscribers, whose identity versions a restore would rewind.\n * Subscriptions are live client state, so a restore needs a world with none.\n */\nexport class SnapshotSubscribed extends Schema.TaggedError<SnapshotSubscribed>()(\n \"SnapshotSubscribed\",\n { subscribers: Schema.Int, message: Schema.String },\n) {}\n\n/**\n * A snapshot's identity counters stand at or behind an identity its state\n * already holds, so the next allocation would reuse one.\n */\nexport class SnapshotAllocatorBehind extends Schema.TaggedError<SnapshotAllocatorBehind>()(\n \"SnapshotAllocatorBehind\",\n {\n allocator: Schema.Literals([\n \"nextDocumentId\",\n \"lastCreationTime\",\n \"nextAttemptId\",\n \"identityEpoch\",\n ]),\n value: Schema.Finite,\n required: Schema.Finite,\n message: Schema.String,\n },\n) {}\n\n/**\n * A snapshot's rows are not what its write log publishes: a row filed under\n * another table or an unregistered component, a version the log does not give\n * it, or a log change whose before value is not the row it replaced.\n */\nexport class SnapshotRowInconsistent extends Schema.TaggedError<SnapshotRowInconsistent>()(\n \"SnapshotRowInconsistent\",\n {\n componentPath: Schema.String,\n id: Schema.String,\n reason: Schema.Literals([\n \"id\",\n \"component\",\n \"log\",\n \"row\",\n \"systemFields\",\n \"duplicate\",\n ]),\n message: Schema.String,\n },\n) {}\n\n/**\n * A snapshot's commit timestamps do not strictly increase through its write\n * log, or its latest commit timestamp is not the log's last.\n */\nexport class SnapshotTimestampInconsistent extends Schema.TaggedError<SnapshotTimestampInconsistent>()(\n \"SnapshotTimestampInconsistent\",\n { version: Schema.Int, commitTs: Schema.String, message: Schema.String },\n) {}\n\n/**\n * A snapshot's jobs and job rows disagree: a job with no row, a row with no\n * job, a job left running, or a target no registered component exports.\n */\nexport class SnapshotJobInconsistent extends Schema.TaggedError<SnapshotJobInconsistent>()(\n \"SnapshotJobInconsistent\",\n {\n id: Schema.String,\n reason: Schema.Literals([\n \"row\",\n \"untargeted\",\n \"inProgress\",\n \"component\",\n \"function\",\n \"duplicate\",\n ]),\n message: Schema.String,\n },\n) {}\n"],"mappings":";;;;;AAKA,IAAa,iBAAb,cAAoC,OAAO,YAA4B,CAAC,CACtE,kBACA;CACE,WAAW,OAAO,SAAS,CAAC,cAAc,cAAc,CAAC;CACzD,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,mBAAb,cAAsC,OAAO,YAA8B,CAAC,CAC1E,oBACA;CACE,WAAW,OAAO;CAClB,KAAK,OAAO;CACZ,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,sBAAb,cAAyC,OAAO,YAAiC,CAAC,CAChF,uBACA;CAAE,eAAe,OAAO;CAAQ,SAAS,OAAO;AAAO,CACzD,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,sCAAb,cAAyD,OAAO,YAAiD,CAAC,CAChH,uCACA;CAAE,UAAU,OAAO;CAAK,SAAS,OAAO;AAAO,CACjD,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CACpE,iBACA;CAAE,WAAW,OAAO;CAAQ,SAAS,OAAO;AAAO,CACrD,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAClE,gBACA;CAAE,IAAI,OAAO;CAAQ,SAAS,OAAO;AAAO,CAC9C,CAAC,CAAC,CAAC;;;;;AAMH,IAAa,wBAAb,cAA2C,OAAO,YAAmC,CAAC,CACpF,yBACA;CACE,SAAS,OAA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,0BAAb,cAA6C,OAAO,YAAqC,CAAC,CACxF,2BACA;CACE,IAAI,OAAO;CACX,QAAQ,OAAO,SAAS;EACtB;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,SAAS,OAAO;AAClB,CACF,CAAC,CAAC,CAAC"}
@@ -0,0 +1,142 @@
1
+ import * as DatabaseSchema from "@confect/server/DatabaseSchema";
2
+ import { type JSONValue, type Value } from "convex/values";
3
+ import * as Result from "effect/Result";
4
+ import type * as Schema from "effect/Schema";
5
+ import * as SchemaAST from "effect/SchemaAST";
6
+ import * as KernelRefusal from "./KernelRefusal.js";
7
+ import type { FunctionPath } from "./KernelValues.js";
8
+ /**
9
+ * What a marker writes in place of a secret in text and in values: a failure
10
+ * report, a diff, a read record.
11
+ */
12
+ export declare const marker = "[redacted]";
13
+ /**
14
+ * The key of a snapshot's marker object, `{ "$redacted": <ref> }`. Convex's
15
+ * encoded JSON allows no object key that starts with `$`, so no stored value
16
+ * reads as a marker.
17
+ */
18
+ export declare const markerKey = "$redacted";
19
+ /**
20
+ * Where a value may hold secrets: the type side of a schema's AST. A walk
21
+ * follows it through the encoded value, so the value bounds the walk.
22
+ */
23
+ export type Shape = SchemaAST.AST;
24
+ /**
25
+ * A shape placed at a path inside a value: a table's schema at a document's
26
+ * root, a job's target arguments at its row's `args.0`.
27
+ */
28
+ export interface Placement {
29
+ readonly at: ReadonlyArray<string>;
30
+ readonly shape: Shape;
31
+ }
32
+ /**
33
+ * Whether `shape` holds a secret anywhere beneath it.
34
+ */
35
+ export declare const hasSecret: (shape: Shape) => boolean;
36
+ /**
37
+ * Whether the field at `fieldPath` of a document of `shape` holds a secret, or
38
+ * sits under one.
39
+ */
40
+ export declare const sensitiveAt: (shape: Shape, fieldPath: ReadonlyArray<string>) => boolean;
41
+ /**
42
+ * Which values the kernel treats as secret: the shapes of a table's documents,
43
+ * of a function's arguments and of its return value.
44
+ */
45
+ export interface Policy {
46
+ readonly table: (componentPath: string, table: string) => Shape | undefined;
47
+ readonly args: (functionPath: FunctionPath) => Shape | undefined;
48
+ readonly returns: (functionPath: FunctionPath) => Shape | undefined;
49
+ }
50
+ /**
51
+ * A schema the policy builds the first time it needs it, as Confect's specs and
52
+ * tables keep theirs.
53
+ */
54
+ export type Lazy = () => Schema.Top;
55
+ /**
56
+ * The schemas a policy reads its secret nodes from, by component path, then
57
+ * table name or `module:export`. Row 8's codegen fills this from the Confect
58
+ * specs. A test that declares it by hand writes the same record.
59
+ */
60
+ export interface Declared {
61
+ readonly tables?: Readonly<Record<string, Readonly<Record<string, Lazy>>>>;
62
+ readonly functions?: Readonly<Record<string, Readonly<Record<string, {
63
+ readonly args?: Lazy;
64
+ readonly returns?: Lazy;
65
+ }>>>>;
66
+ }
67
+ /**
68
+ * A policy from `declared`'s schemas. Each schema is built the first time its
69
+ * shape is asked for.
70
+ */
71
+ export declare const policy: (declared: Declared) => Policy;
72
+ export declare const none: Policy;
73
+ /**
74
+ * Two declarations as one: `second`'s entries win where both name a table or
75
+ * function.
76
+ */
77
+ export declare const merge: (first: Declared, second: Declared) => Declared;
78
+ /**
79
+ * A Confect database schema's tables, as a policy's `tables` entry for one
80
+ * component. No table's schema is built until the kernel asks for its shape.
81
+ */
82
+ export declare const tablesOf: (databaseSchema: DatabaseSchema.AnyWithProps) => Readonly<Record<string, Lazy>>;
83
+ /**
84
+ * The raw secrets the kernel has seen under a secret node, in the order it
85
+ * first saw each, with every string a compound secret holds beneath it. This
86
+ * store is replay state: it lives in memory beside the world and is never
87
+ * written to an artifact. A snapshot's markers name entries here by position.
88
+ */
89
+ export declare class Secrets {
90
+ private readonly values;
91
+ private readonly refs;
92
+ private readonly texts;
93
+ /**
94
+ * Keep `value` and answer its position. A value kept before answers its first
95
+ * position.
96
+ */
97
+ keep(value: JSONValue): number;
98
+ raw(ref: number): JSONValue | undefined;
99
+ /**
100
+ * Every kept secret's text long enough to search free text for, longest
101
+ * first, so a secret inside another is never marked half.
102
+ */
103
+ searchable(): ReadonlyArray<string>;
104
+ copy(): Secrets;
105
+ }
106
+ /**
107
+ * Keep every secret of `value` that `placements` put there, before it is
108
+ * validated, so a validation error can already mark it.
109
+ */
110
+ export declare const keep: (value: unknown, placements: ReadonlyArray<Placement>, secrets: Secrets) => void;
111
+ /**
112
+ * `json`, a document bound for a snapshot, with every secret its placements put
113
+ * there, and every string holding a kept secret, replaced by a marker that
114
+ * names the raw value's position in `secrets`. The walk never enters a marker,
115
+ * so marking a marked value changes nothing.
116
+ */
117
+ export declare const mark: (json: JSONValue, placements: ReadonlyArray<Placement>, secrets: Secrets) => JSONValue;
118
+ /**
119
+ * `value` as an artifact other than a snapshot writes it: every secret its
120
+ * placements put there, and every string holding a kept secret, replaced by the
121
+ * marker text.
122
+ */
123
+ export declare const markValue: (value: Value, placements: ReadonlyArray<Placement>, secrets: Secrets) => Value;
124
+ /**
125
+ * `json` with each marker replaced by the raw value it names in `secrets`, or
126
+ * `SnapshotSecretMissing` for the first marker the store cannot answer.
127
+ */
128
+ export declare const unmark: (json: JSONValue, secrets: Secrets) => Result.Result<JSONValue, KernelRefusal.SnapshotSecretMissing>;
129
+ /**
130
+ * `text` with every kept secret, raw or as it appears inside a JSON string,
131
+ * replaced by the marker.
132
+ */
133
+ export declare const scrubText: (text: string, secrets: Secrets) => string;
134
+ /**
135
+ * A failure report for `thrown`, whatever was thrown: every kept secret in its
136
+ * text, its data and its causes marked. When nothing needs marking it is
137
+ * `thrown` itself. Otherwise it is a copy with the same prototype and fields,
138
+ * so its class and tag still read the same. `thrown` is never changed, so a
139
+ * subscription that keeps the raw error compares it as it was.
140
+ */
141
+ export declare const failure: (thrown: unknown, secrets: Secrets) => unknown;
142
+ //# sourceMappingURL=Redaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Redaction.d.ts","sourceRoot":"","sources":["../../src/internal/Redaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAGL,KAAK,SAAS,EACd,KAA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