@aventara/testing 1.0.0-rc.1 → 1.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +138 -1
- package/README.md +10 -5
- package/dist/protocol/corpus-contract.fixture.d.ts +139 -366
- package/dist/protocol/corpus-contract.fixture.js +71 -17
- package/dist/protocol/in-process.driver.d.ts +5 -2
- package/dist/protocol/in-process.driver.js +14 -0
- package/dist/protocol/per-route.driver.d.ts +2 -1
- package/dist/protocol/per-route.driver.js +5 -0
- package/dist/protocol/protocol-conformance.d.ts +3 -2
- package/dist/protocol/protocol-conformance.js +5 -1
- package/dist/protocol/protocol-corpus.d.ts +4 -1
- package/dist/protocol/protocol-fixtures.js +480 -1
- package/dist/protocol/protocol-fixtures.json-codec.d.ts +2 -1
- package/dist/protocol/protocol-fixtures.json-codec.js +9 -1
- package/fixtures/protocol-v1.json +141 -100
- package/package.json +3 -3
|
@@ -1,284 +1,5 @@
|
|
|
1
|
-
import type { AvContext, AvFramework } from "@aventara/core";
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
4
|
-
* The corpus's adapter model:
|
|
5
|
-
*
|
|
6
|
-
* - `authors`: every standard operation; its `secret` field is hidden at
|
|
7
|
-
* client scope;
|
|
8
|
-
* - `books`: references `authors`, and deleting an author cascades into it
|
|
9
|
-
* ({@link CORPUS_REFERENTIAL_ACTIONS}; a plan's `V1019`); the client scope
|
|
10
|
-
* defines a computed `label` the client alone sees ({@link CORPUS_RESOURCES});
|
|
11
|
-
* - `secrets`: its one operation restricted away at client scope;
|
|
12
|
-
* - `hiddenRes`: hidden at client scope;
|
|
13
|
-
* - `samples`: one field of each scalar whose wire form is not its runtime
|
|
14
|
-
* form (`bigint`, `datetime`, `decimal`, `bytes`).
|
|
15
|
-
*/
|
|
16
|
-
export declare const CORPUS_MODEL: {
|
|
17
|
-
readonly transactions: "interactive";
|
|
18
|
-
readonly scalars: {
|
|
19
|
-
readonly string: {
|
|
20
|
-
readonly builtin: true;
|
|
21
|
-
};
|
|
22
|
-
readonly bigint: {
|
|
23
|
-
readonly builtin: true;
|
|
24
|
-
};
|
|
25
|
-
readonly datetime: {
|
|
26
|
-
readonly builtin: true;
|
|
27
|
-
};
|
|
28
|
-
readonly decimal: {
|
|
29
|
-
readonly builtin: true;
|
|
30
|
-
};
|
|
31
|
-
readonly bytes: {
|
|
32
|
-
readonly builtin: true;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
readonly enums: {};
|
|
36
|
-
readonly resources: {
|
|
37
|
-
readonly authors: {
|
|
38
|
-
readonly fields: {
|
|
39
|
-
readonly id: {
|
|
40
|
-
readonly kind: "scalar";
|
|
41
|
-
readonly type: {
|
|
42
|
-
readonly scalar: "string";
|
|
43
|
-
};
|
|
44
|
-
readonly nullable: false;
|
|
45
|
-
readonly list: false;
|
|
46
|
-
readonly lifecycle: readonly [];
|
|
47
|
-
readonly capabilities: {
|
|
48
|
-
readonly select: true;
|
|
49
|
-
readonly filter: readonly ["equals"];
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
readonly name: {
|
|
53
|
-
readonly capabilities: {
|
|
54
|
-
readonly select: true;
|
|
55
|
-
readonly filter: readonly ["equals"];
|
|
56
|
-
readonly create: readonly [];
|
|
57
|
-
readonly update: readonly [];
|
|
58
|
-
};
|
|
59
|
-
readonly kind: "scalar";
|
|
60
|
-
readonly type: {
|
|
61
|
-
readonly scalar: "string";
|
|
62
|
-
};
|
|
63
|
-
readonly nullable: false;
|
|
64
|
-
readonly list: false;
|
|
65
|
-
readonly lifecycle: readonly [];
|
|
66
|
-
};
|
|
67
|
-
readonly secret: {
|
|
68
|
-
readonly kind: "scalar";
|
|
69
|
-
readonly type: {
|
|
70
|
-
readonly scalar: "string";
|
|
71
|
-
};
|
|
72
|
-
readonly nullable: false;
|
|
73
|
-
readonly list: false;
|
|
74
|
-
readonly lifecycle: readonly [];
|
|
75
|
-
readonly capabilities: {
|
|
76
|
-
readonly select: true;
|
|
77
|
-
readonly filter: readonly ["equals"];
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
readonly identifiers: readonly [readonly ["id"]];
|
|
82
|
-
readonly operations: {
|
|
83
|
-
readonly find: {
|
|
84
|
-
readonly first: true;
|
|
85
|
-
readonly unique: true;
|
|
86
|
-
readonly many: true;
|
|
87
|
-
readonly count: true;
|
|
88
|
-
};
|
|
89
|
-
readonly create: {
|
|
90
|
-
readonly one: true;
|
|
91
|
-
readonly many: true;
|
|
92
|
-
readonly count: true;
|
|
93
|
-
};
|
|
94
|
-
readonly update: {
|
|
95
|
-
readonly first: true;
|
|
96
|
-
readonly unique: true;
|
|
97
|
-
readonly many: true;
|
|
98
|
-
readonly count: true;
|
|
99
|
-
};
|
|
100
|
-
readonly delete: {
|
|
101
|
-
readonly first: true;
|
|
102
|
-
readonly unique: true;
|
|
103
|
-
readonly many: true;
|
|
104
|
-
readonly count: true;
|
|
105
|
-
};
|
|
106
|
-
readonly upsert: {
|
|
107
|
-
readonly unique: true;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
readonly books: {
|
|
112
|
-
readonly fields: {
|
|
113
|
-
readonly id: {
|
|
114
|
-
readonly kind: "scalar";
|
|
115
|
-
readonly type: {
|
|
116
|
-
readonly scalar: "string";
|
|
117
|
-
};
|
|
118
|
-
readonly nullable: false;
|
|
119
|
-
readonly list: false;
|
|
120
|
-
readonly lifecycle: readonly [];
|
|
121
|
-
readonly capabilities: {
|
|
122
|
-
readonly select: true;
|
|
123
|
-
readonly filter: readonly ["equals"];
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
readonly authorId: {
|
|
127
|
-
readonly kind: "scalar";
|
|
128
|
-
readonly type: {
|
|
129
|
-
readonly scalar: "string";
|
|
130
|
-
};
|
|
131
|
-
readonly nullable: false;
|
|
132
|
-
readonly list: false;
|
|
133
|
-
readonly lifecycle: readonly [];
|
|
134
|
-
readonly capabilities: {
|
|
135
|
-
readonly select: true;
|
|
136
|
-
readonly filter: readonly ["equals"];
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
readonly identifiers: readonly [readonly ["id"]];
|
|
141
|
-
readonly operations: {
|
|
142
|
-
readonly find: {
|
|
143
|
-
readonly many: true;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
readonly secrets: {
|
|
148
|
-
readonly fields: {
|
|
149
|
-
readonly id: {
|
|
150
|
-
readonly kind: "scalar";
|
|
151
|
-
readonly type: {
|
|
152
|
-
readonly scalar: "string";
|
|
153
|
-
};
|
|
154
|
-
readonly nullable: false;
|
|
155
|
-
readonly list: false;
|
|
156
|
-
readonly lifecycle: readonly [];
|
|
157
|
-
readonly capabilities: {
|
|
158
|
-
readonly select: true;
|
|
159
|
-
readonly filter: readonly ["equals"];
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
readonly identifiers: readonly [readonly ["id"]];
|
|
164
|
-
readonly operations: {
|
|
165
|
-
readonly find: {
|
|
166
|
-
readonly many: true;
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
readonly hiddenRes: {
|
|
171
|
-
readonly fields: {
|
|
172
|
-
readonly id: {
|
|
173
|
-
readonly kind: "scalar";
|
|
174
|
-
readonly type: {
|
|
175
|
-
readonly scalar: "string";
|
|
176
|
-
};
|
|
177
|
-
readonly nullable: false;
|
|
178
|
-
readonly list: false;
|
|
179
|
-
readonly lifecycle: readonly [];
|
|
180
|
-
readonly capabilities: {
|
|
181
|
-
readonly select: true;
|
|
182
|
-
readonly filter: readonly ["equals"];
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
readonly identifiers: readonly [readonly ["id"]];
|
|
187
|
-
readonly operations: {
|
|
188
|
-
readonly find: {
|
|
189
|
-
readonly many: true;
|
|
190
|
-
};
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
readonly samples: {
|
|
194
|
-
readonly fields: {
|
|
195
|
-
readonly id: {
|
|
196
|
-
readonly kind: "scalar";
|
|
197
|
-
readonly type: {
|
|
198
|
-
readonly scalar: "string";
|
|
199
|
-
};
|
|
200
|
-
readonly nullable: false;
|
|
201
|
-
readonly list: false;
|
|
202
|
-
readonly lifecycle: readonly [];
|
|
203
|
-
readonly capabilities: {
|
|
204
|
-
readonly select: true;
|
|
205
|
-
readonly filter: readonly ["equals"];
|
|
206
|
-
};
|
|
207
|
-
};
|
|
208
|
-
readonly count: {
|
|
209
|
-
readonly kind: "scalar";
|
|
210
|
-
readonly type: {
|
|
211
|
-
readonly scalar: "bigint" | "datetime" | "decimal" | "bytes";
|
|
212
|
-
};
|
|
213
|
-
readonly nullable: false;
|
|
214
|
-
readonly list: false;
|
|
215
|
-
readonly lifecycle: readonly [];
|
|
216
|
-
readonly capabilities: {
|
|
217
|
-
readonly select: true;
|
|
218
|
-
readonly create: readonly [];
|
|
219
|
-
};
|
|
220
|
-
};
|
|
221
|
-
readonly at: {
|
|
222
|
-
readonly kind: "scalar";
|
|
223
|
-
readonly type: {
|
|
224
|
-
readonly scalar: "bigint" | "datetime" | "decimal" | "bytes";
|
|
225
|
-
};
|
|
226
|
-
readonly nullable: false;
|
|
227
|
-
readonly list: false;
|
|
228
|
-
readonly lifecycle: readonly [];
|
|
229
|
-
readonly capabilities: {
|
|
230
|
-
readonly select: true;
|
|
231
|
-
readonly create: readonly [];
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
readonly amount: {
|
|
235
|
-
readonly kind: "scalar";
|
|
236
|
-
readonly type: {
|
|
237
|
-
readonly scalar: "bigint" | "datetime" | "decimal" | "bytes";
|
|
238
|
-
};
|
|
239
|
-
readonly nullable: false;
|
|
240
|
-
readonly list: false;
|
|
241
|
-
readonly lifecycle: readonly [];
|
|
242
|
-
readonly capabilities: {
|
|
243
|
-
readonly select: true;
|
|
244
|
-
readonly create: readonly [];
|
|
245
|
-
};
|
|
246
|
-
};
|
|
247
|
-
readonly blob: {
|
|
248
|
-
readonly kind: "scalar";
|
|
249
|
-
readonly type: {
|
|
250
|
-
readonly scalar: "bigint" | "datetime" | "decimal" | "bytes";
|
|
251
|
-
};
|
|
252
|
-
readonly nullable: false;
|
|
253
|
-
readonly list: false;
|
|
254
|
-
readonly lifecycle: readonly [];
|
|
255
|
-
readonly capabilities: {
|
|
256
|
-
readonly select: true;
|
|
257
|
-
readonly create: readonly [];
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
};
|
|
261
|
-
readonly identifiers: readonly [readonly ["id"]];
|
|
262
|
-
readonly operations: {
|
|
263
|
-
readonly find: {
|
|
264
|
-
readonly unique: true;
|
|
265
|
-
};
|
|
266
|
-
readonly create: {
|
|
267
|
-
readonly one: true;
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
};
|
|
272
|
-
};
|
|
273
|
-
/** Deleting an author cascades into its books (an edge under `books`). */
|
|
274
|
-
export declare const CORPUS_REFERENTIAL_ACTIONS: {
|
|
275
|
-
readonly books: readonly [{
|
|
276
|
-
readonly field: "author";
|
|
277
|
-
readonly target: "authors";
|
|
278
|
-
readonly references: readonly ["authorId"];
|
|
279
|
-
readonly onDelete: "cascade";
|
|
280
|
-
}];
|
|
281
|
-
};
|
|
1
|
+
import type { AvAdapterModel, AvContext, AvFramework, AvPrebuiltContracts } from "@aventara/core";
|
|
2
|
+
import type { AvAdapterOperation } from "@aventara/core/internal";
|
|
282
3
|
/**
|
|
283
4
|
* The `where.id` a row sends to make the corpus Framework fail one way:
|
|
284
5
|
*
|
|
@@ -313,95 +34,40 @@ declare function corpusGuard(context: AvContext): boolean;
|
|
|
313
34
|
* `A3004` trigger, and then adds a filter on a field the server does not have.
|
|
314
35
|
*/
|
|
315
36
|
declare function corpusPipe(args: unknown): unknown;
|
|
316
|
-
/**
|
|
317
|
-
* The corpus's root `resources` tree: `books.label`, a VIRTUAL field computed on
|
|
318
|
-
* read from `id`.
|
|
319
|
-
*/
|
|
320
|
-
export declare const CORPUS_RESOURCES: {
|
|
321
|
-
readonly books: {
|
|
322
|
-
readonly fields: {
|
|
323
|
-
readonly label: {
|
|
324
|
-
readonly definition: {
|
|
325
|
-
readonly type: {
|
|
326
|
-
readonly scalar: "string";
|
|
327
|
-
};
|
|
328
|
-
readonly nullable: false;
|
|
329
|
-
readonly list: false;
|
|
330
|
-
readonly lifecycle: readonly ["VIRTUAL"];
|
|
331
|
-
};
|
|
332
|
-
readonly pipelines: {
|
|
333
|
-
readonly compute: {
|
|
334
|
-
readonly read: {
|
|
335
|
-
readonly dependsOn: readonly ["id"];
|
|
336
|
-
readonly compute: ({ record, }: {
|
|
337
|
-
readonly record: Readonly<Record<string, unknown>>;
|
|
338
|
-
}) => string;
|
|
339
|
-
};
|
|
340
|
-
};
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
};
|
|
345
|
-
};
|
|
346
|
-
/** The corpus's application layer: `books.label` is the client's only. */
|
|
347
|
-
export declare const CORPUS_APPLICATION_CONFIG: {
|
|
348
|
-
readonly exposed: true;
|
|
349
|
-
readonly exemptions: {
|
|
350
|
-
readonly resources: {
|
|
351
|
-
readonly books: {
|
|
352
|
-
readonly fields: {
|
|
353
|
-
readonly label: true;
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
|
-
};
|
|
357
|
-
};
|
|
358
|
-
};
|
|
359
|
-
/**
|
|
360
|
-
* The corpus's client layer: what the ClientContract hides or restricts, and
|
|
361
|
-
* the client's own guard and pipe.
|
|
362
|
-
*/
|
|
363
|
-
export declare const CORPUS_CLIENT_CONFIG: {
|
|
364
|
-
readonly pipelines: {
|
|
365
|
-
readonly guards: readonly [typeof corpusGuard];
|
|
366
|
-
readonly pipes: readonly [typeof corpusPipe];
|
|
367
|
-
};
|
|
368
|
-
readonly exposed: true;
|
|
369
|
-
readonly exemptions: {
|
|
370
|
-
readonly resources: {
|
|
371
|
-
readonly authors: {
|
|
372
|
-
readonly fields: {
|
|
373
|
-
readonly secret: true;
|
|
374
|
-
};
|
|
375
|
-
};
|
|
376
|
-
readonly secrets: {
|
|
377
|
-
readonly operations: {
|
|
378
|
-
readonly find: readonly ["many"];
|
|
379
|
-
};
|
|
380
|
-
};
|
|
381
|
-
readonly hiddenRes: true;
|
|
382
|
-
};
|
|
383
|
-
};
|
|
384
|
-
};
|
|
385
37
|
/** The corpus Framework's mount point; every row's path is relative to it. */
|
|
386
38
|
export declare const CORPUS_ENTRYPOINT = "/api";
|
|
387
39
|
/**
|
|
388
40
|
* The corpus ClientContract's hash: what a generated client for it sends as
|
|
389
41
|
* `Aventara-Contract-Hash`. A literal, as a generated client holds it.
|
|
390
42
|
*/
|
|
391
|
-
export declare const CORPUS_CLIENT_CONTRACT_HASH = "sha256:
|
|
43
|
+
export declare const CORPUS_CLIENT_CONTRACT_HASH = "sha256:e0f996802a6a8f1ac9954796ae3f48e0892c9d1a2e691b5cd831098f4b78d7f5";
|
|
392
44
|
/**
|
|
393
45
|
* The corpus ClientContract as `GET /_contract` serves it: its JCS-canonical
|
|
394
46
|
* bytes, `protocol.hash` included. A literal, as a host must serve it byte for
|
|
395
47
|
* byte.
|
|
396
48
|
*/
|
|
397
|
-
export declare const CORPUS_CLIENT_CONTRACT_DOCUMENT = "{\"enums\":{},\"limits\":{\"maxBooleanNodes\":50,\"maxJsonDepth\":64,\"maxListLimit\":250,\"maxNestingDepth\":12,\"maxRequestBytes\":1048576,\"maxTransactionOperations\":20},\"protocol\":{\"hash\":\"sha256:
|
|
49
|
+
export declare const CORPUS_CLIENT_CONTRACT_DOCUMENT = "{\"enums\":{},\"limits\":{\"maxAll\":10,\"maxAllConcurrency\":4,\"maxBooleanNodes\":50,\"maxJsonDepth\":64,\"maxListLimit\":250,\"maxNestingDepth\":12,\"maxRequestBytes\":1048576,\"maxTransactionOperations\":20},\"protocol\":{\"hash\":\"sha256:e0f996802a6a8f1ac9954796ae3f48e0892c9d1a2e691b5cd831098f4b78d7f5\",\"version\":1},\"resources\":{\"authors\":{\"fields\":{\"id\":{\"capabilities\":{\"filter\":[\"equals\"],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"string\"}},\"name\":{\"capabilities\":{\"create\":[],\"filter\":[\"equals\"],\"select\":true,\"update\":[]},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"string\"}}},\"identifiers\":[[\"id\"]],\"operations\":{\"create\":{\"count\":true,\"many\":true,\"one\":true},\"delete\":{\"count\":true,\"first\":true,\"many\":true,\"unique\":true},\"find\":{\"count\":true,\"first\":true,\"many\":true,\"unique\":true},\"update\":{\"count\":true,\"first\":true,\"many\":true,\"unique\":true},\"upsert\":{\"unique\":true}}},\"books\":{\"fields\":{\"authorId\":{\"capabilities\":{\"filter\":[\"equals\"],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"string\"}},\"id\":{\"capabilities\":{\"filter\":[\"equals\"],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"string\"}},\"label\":{\"capabilities\":{\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[\"COMPUTED_ON_READ\",\"VIRTUAL\"],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"string\"}}},\"identifiers\":[[\"id\"]],\"operations\":{\"find\":{\"many\":true}}},\"samples\":{\"fields\":{\"amount\":{\"capabilities\":{\"create\":[],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"decimal\"}},\"at\":{\"capabilities\":{\"create\":[],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"datetime\"}},\"blob\":{\"capabilities\":{\"create\":[],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"bytes\"}},\"count\":{\"capabilities\":{\"create\":[],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"bigint\"}},\"id\":{\"capabilities\":{\"filter\":[\"equals\"],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"string\"}}},\"identifiers\":[[\"id\"]],\"operations\":{\"create\":{\"one\":true},\"find\":{\"unique\":true}}},\"secrets\":{\"fields\":{\"id\":{\"capabilities\":{\"filter\":[\"equals\"],\"select\":true},\"kind\":\"scalar\",\"lifecycle\":[],\"list\":false,\"nullable\":false,\"type\":{\"scalar\":\"string\"}}},\"identifiers\":[[\"id\"]],\"operations\":{}}},\"scalars\":{\"bigint\":{\"builtin\":true},\"bytes\":{\"builtin\":true},\"datetime\":{\"builtin\":true},\"decimal\":{\"builtin\":true},\"string\":{\"builtin\":true}},\"transactions\":\"interactive\"}";
|
|
398
50
|
/**
|
|
399
51
|
* The hash of the corpus's second ClientContract: the same model and
|
|
400
52
|
* configuration with `transactions: "none"` (the `/_transactions` absence
|
|
401
53
|
* rows). A row targets it by sending this hash, exactly as a client generated
|
|
402
54
|
* against it would.
|
|
403
55
|
*/
|
|
404
|
-
export declare const CORPUS_NONE_CLIENT_CONTRACT_HASH = "sha256:
|
|
56
|
+
export declare const CORPUS_NONE_CLIENT_CONTRACT_HASH = "sha256:34a73fd521d186350252a9bf905a9a627465f8267e0051ba4efe0441510e164a";
|
|
57
|
+
/**
|
|
58
|
+
* The hash of the corpus's third ClientContract: the same model and
|
|
59
|
+
* configuration with the framework's `access` option ({@link CORPUS_ACCESS}),
|
|
60
|
+
* so it carries the `access` section and its `POST /_access/can` route.
|
|
61
|
+
*/
|
|
62
|
+
export declare const CORPUS_ACCESS_CLIENT_CONTRACT_HASH = "sha256:ee098756b61a2081f92c7c065816c9f77782561aef572c117d2ee7e18389db0b";
|
|
63
|
+
/**
|
|
64
|
+
* The hash of the corpus's fourth ClientContract: the same model and
|
|
65
|
+
* configuration with `cache` stages on reads ({@link CORPUS_CACHE_RESOURCES}),
|
|
66
|
+
* so it marks them cacheable and serves each a `GET` route. A cached-read row
|
|
67
|
+
* targets it by sending this hash as its query's `v`, exactly as a client
|
|
68
|
+
* generated against it would.
|
|
69
|
+
*/
|
|
70
|
+
export declare const CORPUS_CACHE_CLIENT_CONTRACT_HASH = "sha256:d82386747eef41809c28721bc513e70db59884b5bd85ca1535038ce32127fd99";
|
|
405
71
|
/** The one record the corpus Adapter knows. */
|
|
406
72
|
export declare const CORPUS_AUTHOR: {
|
|
407
73
|
readonly id: "a1";
|
|
@@ -410,24 +76,131 @@ export declare const CORPUS_AUTHOR: {
|
|
|
410
76
|
/** The `where.id` that matches nothing. */
|
|
411
77
|
export declare const CORPUS_NOBODY = "nobody";
|
|
412
78
|
/**
|
|
413
|
-
* The
|
|
414
|
-
*
|
|
79
|
+
* The corpus Framework's configuration, over a fresh corpus Adapter, and the
|
|
80
|
+
* count of operations that Adapter has been handed so far. `contractHash`
|
|
81
|
+
* selects which corpus ClientContract it compiles to: the `transactions:
|
|
82
|
+
* "none"` one when it is {@link CORPUS_NONE_CLIENT_CONTRACT_HASH}, the one with
|
|
83
|
+
* `access` when it is {@link CORPUS_ACCESS_CLIENT_CONTRACT_HASH}, the one with
|
|
84
|
+
* cached reads when it is {@link CORPUS_CACHE_CLIENT_CONTRACT_HASH}, the main one
|
|
85
|
+
* otherwise (a stale or absent hash included).
|
|
415
86
|
*/
|
|
416
|
-
export declare
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
87
|
+
export declare function corpusConfiguration(contractHash?: string): {
|
|
88
|
+
config: {
|
|
89
|
+
access?: {
|
|
90
|
+
state: () => {
|
|
91
|
+
me: null;
|
|
92
|
+
};
|
|
93
|
+
policy: {
|
|
94
|
+
can: ({ resource }: {
|
|
95
|
+
readonly principal: unknown;
|
|
96
|
+
readonly origin: import("@aventara/core").AvRequestOrigin;
|
|
97
|
+
readonly resource: string;
|
|
98
|
+
} & {
|
|
99
|
+
readonly action: "read" | "create" | "update" | "delete";
|
|
100
|
+
readonly row?: Readonly<Record<string, unknown>>;
|
|
101
|
+
readonly before?: Readonly<Record<string, unknown>>;
|
|
102
|
+
readonly beforeGrants?: readonly string[];
|
|
103
|
+
readonly exists: (resource: string, where: import("@aventara/core").AvPolicyWhere) => Promise<boolean>;
|
|
104
|
+
}) => true;
|
|
105
|
+
scopeOf: ({ resource, action }: {
|
|
106
|
+
readonly principal: unknown;
|
|
107
|
+
readonly origin: import("@aventara/core").AvRequestOrigin;
|
|
108
|
+
readonly resource: string;
|
|
109
|
+
} & {
|
|
110
|
+
readonly action: "read" | "update" | "delete";
|
|
111
|
+
}) => boolean;
|
|
112
|
+
fieldsOf: () => {
|
|
113
|
+
always: "all";
|
|
114
|
+
perRow: {};
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
api: string;
|
|
119
|
+
adapter: import("@aventara/core").AvAdapter<AvAdapterModel> & {
|
|
120
|
+
readonly operations: readonly AvAdapterOperation<AvAdapterModel>[];
|
|
121
|
+
readonly transactions: readonly import("../adapters/fake-adapter.js").AvFakeTransactionTrace<AvAdapterModel>[];
|
|
122
|
+
} & {
|
|
123
|
+
transaction?: <T>(work: (executor: import("@aventara/core/internal").AvAdapterTransactionExecutor<AvAdapterModel>) => Promise<T>) => Promise<T>;
|
|
124
|
+
referentialActions: {
|
|
125
|
+
readonly books: readonly [{
|
|
126
|
+
readonly field: "author";
|
|
127
|
+
readonly target: "authors";
|
|
128
|
+
readonly references: readonly ["authorId"];
|
|
129
|
+
readonly onDelete: "cascade";
|
|
130
|
+
}];
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
resources: {
|
|
134
|
+
readonly books: {
|
|
135
|
+
readonly fields: {
|
|
136
|
+
readonly label: {
|
|
137
|
+
readonly definition: {
|
|
138
|
+
readonly type: {
|
|
139
|
+
readonly scalar: "string";
|
|
140
|
+
};
|
|
141
|
+
readonly nullable: false;
|
|
142
|
+
readonly list: false;
|
|
143
|
+
readonly lifecycle: readonly ["VIRTUAL"];
|
|
144
|
+
};
|
|
145
|
+
readonly pipelines: {
|
|
146
|
+
readonly compute: {
|
|
147
|
+
readonly read: {
|
|
148
|
+
readonly dependsOn: readonly ["id"];
|
|
149
|
+
readonly compute: ({ record, }: {
|
|
150
|
+
readonly record: Readonly<Record<string, unknown>>;
|
|
151
|
+
}) => string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
application: {
|
|
160
|
+
readonly exposed: true;
|
|
161
|
+
readonly exemptions: {
|
|
162
|
+
readonly resources: {
|
|
163
|
+
readonly books: {
|
|
164
|
+
readonly fields: {
|
|
165
|
+
readonly label: true;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
client: {
|
|
172
|
+
readonly pipelines: {
|
|
173
|
+
readonly guards: readonly [typeof corpusGuard];
|
|
174
|
+
readonly pipes: readonly [typeof corpusPipe];
|
|
175
|
+
};
|
|
176
|
+
readonly exposed: true;
|
|
177
|
+
readonly exemptions: {
|
|
178
|
+
readonly resources: {
|
|
179
|
+
readonly authors: {
|
|
180
|
+
readonly fields: {
|
|
181
|
+
readonly secret: true;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
readonly secrets: {
|
|
185
|
+
readonly operations: {
|
|
186
|
+
readonly find: readonly ["many"];
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
readonly hiddenRes: true;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
adapterCalls: () => number;
|
|
422
195
|
};
|
|
423
196
|
/**
|
|
424
197
|
* A fresh corpus Framework, and the count of operations its Adapter has been
|
|
425
|
-
* handed so far — a row's `adapterCalls` is read from it. `contractHash`
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
198
|
+
* handed so far — a row's `adapterCalls` is read from it. `contractHash` selects
|
|
199
|
+
* which corpus ClientContract it serves ({@link corpusConfiguration}). With
|
|
200
|
+
* `prebuilt`, its Contracts are loaded from that file when it matches, as a
|
|
201
|
+
* serverless deployment's would be.
|
|
429
202
|
*/
|
|
430
|
-
export declare function createCorpusFramework(contractHash?: string): Promise<{
|
|
203
|
+
export declare function createCorpusFramework(contractHash?: string, prebuilt?: AvPrebuiltContracts): Promise<{
|
|
431
204
|
readonly framework: AvFramework;
|
|
432
205
|
readonly adapterCalls: () => number;
|
|
433
206
|
}>;
|