@elaraai/e3-cloud-files 1.0.97 → 1.1.0
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/README.md +145 -58
- package/dist/src/authoring.d.ts +42 -11
- package/dist/src/authoring.d.ts.map +1 -1
- package/dist/src/authoring.js +41 -9
- package/dist/src/authoring.js.map +1 -1
- package/dist/src/index.d.ts +5 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/storage/index.d.ts +13 -1
- package/dist/src/storage/index.d.ts.map +1 -1
- package/dist/src/storage/index.js +133 -4
- package/dist/src/storage/index.js.map +1 -1
- package/dist/src/sync/engine.d.ts +7 -1
- package/dist/src/sync/engine.d.ts.map +1 -1
- package/dist/src/sync/engine.js +6 -0
- package/dist/src/sync/engine.js.map +1 -1
- package/dist/test/decode.examples.d.ts +9 -4
- package/dist/test/decode.examples.d.ts.map +1 -1
- package/dist/test/decode.examples.js +15 -3
- package/dist/test/decode.examples.js.map +1 -1
- package/dist/test/typed.examples.d.ts +97 -4
- package/dist/test/typed.examples.d.ts.map +1 -1
- package/dist/test/typed.examples.js +80 -13
- package/dist/test/typed.examples.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -13,27 +13,31 @@ changed, the same way on a local repository and on a deployed workspace.
|
|
|
13
13
|
East's JSON, as CSV, or as text. Or, named with a **type**, a beast2 file
|
|
14
14
|
arrives as the value it holds, an input of that type with no task in
|
|
15
15
|
between, a collection of any size.
|
|
16
|
-
- **Records are seeded and fed from files.** A record
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
- **Records are seeded and fed from files.** A record may be seeded from a
|
|
17
|
+
file (`upload.record`): pending until its file arrives, which is its
|
|
18
|
+
first state, and in its history the seed names the file. A record's
|
|
19
|
+
mutation may be fed by files: each new file is the mutation's one
|
|
20
|
+
argument, applied once.
|
|
20
21
|
- **Push from disk.** `e3-cloud files push` puts files from your machine
|
|
21
22
|
into a source and takes them in, with your e3 login alone where the source
|
|
22
23
|
is the deployment's own bucket.
|
|
23
24
|
- **Nothing polls.** A sync runs when someone asks for it, and reads only the
|
|
24
25
|
files that changed since the last one.
|
|
25
26
|
|
|
26
|
-
Its version is
|
|
27
|
-
|
|
27
|
+
Its version is e3 cloud's own, shared by every `@elaraai/e3-cloud-*` package.
|
|
28
|
+
Each release is built with one release of east and e3, which its peers name
|
|
29
|
+
exactly.
|
|
28
30
|
|
|
29
31
|
## Install
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
|
-
npm install @elaraai/e3-cloud-files@<
|
|
34
|
+
npm install @elaraai/e3-cloud-files@<release>
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
`
|
|
37
|
+
Install the release built with the e3 your deployment runs, beside its peers
|
|
38
|
+
at the versions it names (`npm view @elaraai/e3-cloud-files@<release>
|
|
39
|
+
peerDependencies`): `@elaraai/east` and `@elaraai/e3`. The `e3-cloud` CLI
|
|
40
|
+
(`@elaraai/e3-cloud-cli`) of the same release deploys and syncs.
|
|
37
41
|
|
|
38
42
|
## Declaring the files
|
|
39
43
|
|
|
@@ -68,6 +72,7 @@ export default Files.manifest([upload]);
|
|
|
68
72
|
| `latest(input, { prefix, include?, type })` | The greatest key, a beast2 file of `type` | `type` | as a typed `file` |
|
|
69
73
|
| `folder(input, { prefix, include? })` | Every key under the prefix that matches, by its path under the prefix | `Dict<String, Blob>` | 64 MiB less 64 KiB each |
|
|
70
74
|
| `listing(input, { prefix, include? })` | The same keys' size, time and ETag, without their bytes | `Dict<String, Struct{size, modified, etag}>` | none |
|
|
75
|
+
| `record(name, type, { key } \| { prefix, include? }, parts?)` | One key, or the greatest under a prefix: a beast2 file of `type`, the record's first state and, while unmutated, its state again | the record's (`e3.record(name, type, parts)`: its indexes, mutations and migrations, no initial value) | as a typed `file` |
|
|
71
76
|
| `mutation(def, { key } \| { prefix, include? })` | One key, or every file under a prefix its glob matches, each new one in key order: a beast2 file of the mutation's one argument's type | (the mutation's, as declared) | 1 GiB |
|
|
72
77
|
|
|
73
78
|
- **Each shape returns an ordinary `e3.input`.** It has no default, so it
|
|
@@ -88,27 +93,17 @@ export default Files.manifest([upload]);
|
|
|
88
93
|
in `Files.manifest` two sources of one name or two shapes filling one
|
|
89
94
|
target.
|
|
90
95
|
|
|
91
|
-
##
|
|
96
|
+
## A typed file
|
|
92
97
|
|
|
93
|
-
A
|
|
94
|
-
|
|
95
|
-
all write it. A `file` or `latest` that names a `type` is an input of that
|
|
96
|
-
type, and the sync takes the file in as the value it holds, with no task in
|
|
97
|
-
between:
|
|
98
|
+
A `file` or `latest` that names a `type` is an input of that type, and the
|
|
99
|
+
sync takes the file in as the value it holds, with no task in between:
|
|
98
100
|
|
|
99
101
|
```ts
|
|
100
102
|
// src/package.ts
|
|
101
103
|
export const Price = StructType({ sku: StringType, price: FloatType });
|
|
102
104
|
export const prices = upload.file('prices', { key: 'prices.beast2', type: ArrayType(Price) }); // an input of Array<Price>
|
|
103
105
|
export const stock = upload.latest('stock', { prefix: 'stock/', type: ArrayType(Stock) }); // the greatest key, typed
|
|
104
|
-
|
|
105
|
-
export const priceBook = e3.record('price_book', DictType(StringType, FloatType), new Map());
|
|
106
|
-
export const loadPrices = e3.mutation.reduce('load_prices', priceBook, East.function([PriceBook, ArrayType(Price)], PriceBook, …));
|
|
107
|
-
export const summary = e3.task('price_summary', [prices, priceBook], …); // used as any dataset
|
|
108
|
-
|
|
109
|
-
// src/files.ts
|
|
110
|
-
upload.mutation(loadPrices, { prefix: 'deltas/', include: '*.beast2' }); // each new delta file calls load_prices with its value
|
|
111
|
-
export default Files.manifest([upload]);
|
|
106
|
+
export const summary = e3.task('price_summary', [prices], …); // used as any dataset
|
|
112
107
|
```
|
|
113
108
|
|
|
114
109
|
- **The header first.** The sync reads a typed file's beast2 header before
|
|
@@ -123,21 +118,125 @@ export default Files.manifest([upload]);
|
|
|
123
118
|
the fix (write it again with a current writer).
|
|
124
119
|
- **The same bytes again change nothing.** A file re-uploaded unchanged (a
|
|
125
120
|
new ETag, the same SHA-256) gives the same value: nothing downstream runs.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
121
|
+
The report counts it `changed`, not `updated`.
|
|
122
|
+
|
|
123
|
+
## A record seeded from a file
|
|
124
|
+
|
|
125
|
+
`upload.record(name, type, { key }, parts)` (or `{ prefix, include }`, the
|
|
126
|
+
greatest key) declares `e3.record(name, type, parts)` with no initial value,
|
|
127
|
+
and returns the record, used in tasks as any record. A record is declared
|
|
128
|
+
whole, so its indexes, mutations and migrations are its `parts`, as
|
|
129
|
+
`e3.record` takes them; an initial value is refused, since its file is its
|
|
130
|
+
first state:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
// src/package.ts
|
|
134
|
+
export const Customer = StructType({ name: StringType, tier: IntegerType });
|
|
135
|
+
export const CustomerBook = DictType(StringType, Customer);
|
|
136
|
+
export const customers = upload.record('customers', CustomerBook, { key: 'customers.beast2' }, {
|
|
137
|
+
mutations: (mutation) => ({
|
|
138
|
+
set_tier: mutation.reduce(East.function([CustomerBook, StringType, IntegerType], CustomerBook, …)),
|
|
139
|
+
}),
|
|
140
|
+
});
|
|
141
|
+
export const customerCount = e3.task('customer_count', [customers], …);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
- **Pending until its file.** The record has no state until its file
|
|
145
|
+
arrives, which is its first state (`$init`): nothing runs on an empty
|
|
146
|
+
state first, and the tasks over it wait as they wait on an unset input,
|
|
147
|
+
the run completing without them. The workspace page shows it **Pending**,
|
|
148
|
+
its own page says what seeds it, and `files status` prints `pending`.
|
|
149
|
+
- **Seeded again while unmutated.** A changed file while nothing has mutated
|
|
150
|
+
the record since its seed is its state again (`$seed`). Once mutated the
|
|
151
|
+
record is kept (the report says how many mutations since the seed), until
|
|
152
|
+
`files sync --reset <record>` (or `files push --reset <record>`) takes the
|
|
153
|
+
file as its state over whatever was done.
|
|
154
|
+
- **In its history** the seed reads as any commit, through the `files`
|
|
155
|
+
channel: "Initialised from customers.beast2 (12,004 rows)", "Seeded again
|
|
156
|
+
from customers.beast2 (12,100 rows)", on the record's page and in
|
|
157
|
+
`e3-cloud records history`. A rollback to an earlier seed brings its state
|
|
158
|
+
back, as to any commit.
|
|
159
|
+
- **A deploy that cannot keep the record** (its type changed) under
|
|
160
|
+
`--schema reset` unassigns it: pending again, seeded by the next version's
|
|
161
|
+
file once the new declarations are deployed.
|
|
162
|
+
- The file is taken in as a typed input is (by pieces, resumable), then
|
|
163
|
+
committed as a system commit with the file's key, ETag and SHA-256 as its
|
|
164
|
+
arguments, under one hold of the repository's running work.
|
|
165
|
+
|
|
166
|
+
## A record fed through a mutation
|
|
167
|
+
|
|
168
|
+
`upload.mutation(def, { key })` or `{ prefix, include }` feeds a record's
|
|
169
|
+
mutation: `def` is one the record declares, `record.mutations.<name>`, a
|
|
170
|
+
`reduce` or an `edit` taking exactly one argument (a `patch` cannot be fed),
|
|
171
|
+
and each file is that argument:
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
// src/package.ts
|
|
175
|
+
export const PriceBook = DictType(StringType, FloatType);
|
|
176
|
+
export const priceBook = e3.record('price_book', PriceBook, {
|
|
177
|
+
initial: new Map(),
|
|
178
|
+
mutations: (mutation) => ({
|
|
179
|
+
load_prices: mutation.reduce(East.function([PriceBook, ArrayType(Price)], PriceBook, …)),
|
|
180
|
+
}),
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// src/files.ts
|
|
184
|
+
upload.mutation(priceBook.mutations.load_prices, { prefix: 'deltas/', include: '*.beast2' }); // each new delta file calls load_prices with its value
|
|
185
|
+
export default Files.manifest([upload]);
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- **Once per file.** Every new file the mapping selects is applied, in key
|
|
189
|
+
order, once by its bytes' hash: a sync run again applies nothing twice,
|
|
190
|
+
and the same bytes under another name are applied no more.
|
|
191
|
+
- **The record's rules decide.** A file the mutation refuses (`invalid`,
|
|
192
|
+
`failed`, `timed_out`) is reported with what it said and tried again only
|
|
193
|
+
once the file changes, and the files after it wait; a feed of a record
|
|
194
|
+
with no state yet, or one busy, waits for the next sync. Its commit reads
|
|
195
|
+
in the record's history as any mutation's, through the `files` channel,
|
|
196
|
+
naming the file it was fed.
|
|
197
|
+
|
|
198
|
+
## Pushing files from disk
|
|
199
|
+
|
|
200
|
+
`e3-cloud files push` puts files from your machine into a source and takes
|
|
201
|
+
them in: put, then one sync of what was put, idempotent and safe to repeat.
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
$ e3-cloud files push https://e3.example.com/repos/acme dev ./data/prices.beast2 ./data/deltas/2026-10-19.beast2
|
|
205
|
+
upload s3://acme-files/acme/dev/
|
|
206
|
+
prices.beast2 → prices Array<Struct{sku, price}> 38 MiB put taken in 412,310 rows
|
|
207
|
+
2026-10-19.beast2 → mutation:price_book.load_prices load_prices 1 MiB put committed 9f2c1a0b7e3d
|
|
208
|
+
Next: e3 dataflow run https://e3.example.com/repos/acme dev
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
- **Each file is matched to the mapping that takes it**: a `file` by its
|
|
212
|
+
name, a `latest` under its prefix (a greater key there would shadow it:
|
|
213
|
+
refused `not_latest`), a directory to the `folder`; or `--as <target>`
|
|
214
|
+
names one for every file (`orders`, `record:customers`,
|
|
215
|
+
`mutation:price_book.load_prices`). A file no mapping takes, or several
|
|
216
|
+
would, is refused naming them.
|
|
217
|
+
- **Checked before it is put**: against the mapping's type (the file's
|
|
218
|
+
header is read) and its limit.
|
|
219
|
+
- **The deployment's own bucket needs no credentials of yours**: the
|
|
220
|
+
platform signs the upload, bound to the file's SHA-256, one PUT up to
|
|
221
|
+
5 GiB or a multipart upload in 64 MiB parts. A bucket the deployment lists
|
|
222
|
+
as a source is written with your own credentials (`--profile`); a local
|
|
223
|
+
repository's sources, with the binding's profile.
|
|
224
|
+
- **Unchanged once it is there**: a file the source holds already, by its
|
|
225
|
+
hash and ETag, is `unchanged`, and running the command again puts only
|
|
226
|
+
what is not there. `--dry-run` plans and puts nothing.
|
|
227
|
+
- The output is a row per file: the file, its target and kind, its size,
|
|
228
|
+
`put`, `unchanged` or `refused`, and what the sync did (`taken in` with
|
|
229
|
+
the rows, `$init`/`$seed` or the mutation with its commit, `kept`, or the
|
|
230
|
+
refusal). The command exits 1 when any file was refused or failed.
|
|
231
|
+
|
|
232
|
+
## Making a beast2 file
|
|
233
|
+
|
|
234
|
+
A beast2 file already is an East value. The East SDK writes one from a value
|
|
235
|
+
(`encodeBeast2For(T)(value)`), or a collection of any size by elements
|
|
236
|
+
(`Beast2ElementWriter`, which the platform's own tests use for files of a
|
|
237
|
+
gibibyte); east-py writes one from Python; `e3 convert` converts a file of
|
|
238
|
+
another format; `e3 dataset get -f beast2` writes any dataset of a workspace
|
|
239
|
+
as one. A typed mapping takes it as it stands, its header saying its type.
|
|
141
240
|
|
|
142
241
|
## Decoding in a task
|
|
143
242
|
|
|
@@ -213,28 +312,12 @@ e3 dataflow run ./repo dev
|
|
|
213
312
|
what a sync would take and takes nothing. A sync doesn't run the dataflow:
|
|
214
313
|
`e3 dataflow run` does, and the sync prints the command when anything
|
|
215
314
|
changed.
|
|
216
|
-
- **`files push`** puts files from disk into a source and takes them in
|
|
217
|
-
|
|
218
|
-
`latest` under its prefix, a directory to the `folder`; or `--as <target>`
|
|
219
|
-
names one for every file), checked against the mapping's type and limit,
|
|
220
|
-
put where the source is bound (with your e3 login alone where that is the
|
|
221
|
-
deployment's own bucket: the platform signs the upload, bound to the
|
|
222
|
-
file's SHA-256; with your own credentials, `--profile`, elsewhere), then
|
|
223
|
-
one sync of what was put. A file the source holds already is `unchanged`;
|
|
224
|
-
`--dry-run` plans and puts nothing. Running it again puts only what is
|
|
225
|
-
not there.
|
|
315
|
+
- **`files push`** puts files from disk into a source and takes them in
|
|
316
|
+
(Pushing files from disk, above).
|
|
226
317
|
- **`files status`** shows each mapping with its shape, its type, the file
|
|
227
318
|
it holds and the commit it made (or `pending` for a record not yet
|
|
228
319
|
seeded), where each source is bound, and the last sync.
|
|
229
320
|
|
|
230
|
-
```
|
|
231
|
-
$ e3-cloud files push https://e3.example.com/repos/acme dev ./data/prices.beast2 ./data/deltas/2026-10-19.beast2
|
|
232
|
-
upload s3://acme-files/acme/dev/
|
|
233
|
-
prices.beast2 → prices Array<Struct{sku, price}> 38 MiB put taken in 412,310 rows
|
|
234
|
-
2026-10-19.beast2 → mutation:price_book.load_prices load_prices 1 MiB put committed 9f2c1a0b7e3d
|
|
235
|
-
Next: e3 dataflow run https://e3.example.com/repos/acme dev
|
|
236
|
-
```
|
|
237
|
-
|
|
238
321
|
A sync is safe to repeat and to stop. Each input is remembered only once it
|
|
239
322
|
is written, so a sync that stops part way takes the rest next time.
|
|
240
323
|
|
|
@@ -370,8 +453,12 @@ In `@elaraai/e3-cloud-types`, re-exported here:
|
|
|
370
453
|
- `FilesStatusType` (each mapping with what it holds and whether its record
|
|
371
454
|
is pending), `FilesProblemType`, the push's `FilesPushRequestType` and
|
|
372
455
|
`FilesPushPlanType`.
|
|
373
|
-
- Values stored by the first version (mappings by input
|
|
374
|
-
|
|
456
|
+
- Values stored by the first version (mappings by input, a refusal as one
|
|
457
|
+
text) are read by their header's type and lifted
|
|
458
|
+
(`@elaraai/e3-cloud-files/compat`): declarations, ledgers and reports a
|
|
459
|
+
workspace stored before this version read as they were, and are written
|
|
460
|
+
again in the current form on their next write. A local repository's state
|
|
461
|
+
file says its version (`version: 2`).
|
|
375
462
|
- The inputs' types: `FilesFileType` (`Blob`), `FilesFolderType`
|
|
376
463
|
(`Dict<String, Blob>`), `FilesListingType`.
|
|
377
464
|
|
package/dist/src/authoring.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* export const orders = upload.file('orders', { key: 'orders.beast2', type: ArrayType(Order) }); // an Array<Order>
|
|
13
13
|
* export const stock = upload.latest('stock', { prefix: 'stock/', type: ArrayType(Stock) });
|
|
14
14
|
* export const files = upload.folder('invoices', { prefix: 'invoices/', include: '*.pdf' });
|
|
15
|
-
* upload.mutation(
|
|
15
|
+
* upload.mutation(priceBook.mutations.load_prices, { key: 'prices.beast2' }); // each new file calls it
|
|
16
16
|
* export default Files.manifest([upload]);
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
@@ -21,20 +21,33 @@
|
|
|
21
21
|
* them; until the first, they are unassigned. A `file` or `latest` that
|
|
22
22
|
* names a `type` is an input of that type, filled with the beast2 value the
|
|
23
23
|
* file holds; one that names none is a `Blob`, filled with the file's
|
|
24
|
-
* bytes. A
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* bytes. A record seeded here is an `e3.record` with no initial value,
|
|
25
|
+
* declared whole with its indexes, mutations and migrations. A mutation fed
|
|
26
|
+
* here is one a record of the package declares, a `reduce` or an `edit`
|
|
27
|
+
* taking one argument (`record.mutations.<name>`): a sync calls it once with
|
|
28
|
+
* each new file's value. What each source's files fill is the
|
|
29
|
+
* {@link Files.manifest}, which `e3-cloud files deploy` deploys beside the
|
|
30
|
+
* package.
|
|
28
31
|
*
|
|
29
32
|
* @packageDocumentation
|
|
30
33
|
*/
|
|
31
|
-
import e3, { type MutationDef } from '@elaraai/e3';
|
|
34
|
+
import e3, { type IndexDraft, type MutationDef, type MutationDraft, type RecordConfig } from '@elaraai/e3';
|
|
32
35
|
import { type EastType } from '@elaraai/east';
|
|
33
36
|
import { FilesFileType, FilesFolderType, FilesListingType, type FilesManifest, type FilesMapping, type FilesProblem } from '@elaraai/e3-cloud-types';
|
|
34
37
|
/** The input a declaration makes: an `e3.input` of its type, with no default. */
|
|
35
38
|
export type FilesInput<Name extends string, T extends EastType> = ReturnType<typeof e3.input<Name, T>>;
|
|
36
|
-
/** The mutation a feed declaration hands back:
|
|
39
|
+
/** The mutation a feed declaration hands back: its record's definition, as it was given. */
|
|
37
40
|
export type FilesMutation<M extends MutationDef> = M;
|
|
41
|
+
/**
|
|
42
|
+
* What a record seeded from a file is declared with beside its file: its
|
|
43
|
+
* indexes, mutations and migrations, as `e3.record` takes them, and never an
|
|
44
|
+
* initial value, since its file is its first state.
|
|
45
|
+
*
|
|
46
|
+
* @typeParam T - The record's state type
|
|
47
|
+
* @typeParam I - Its indexes, as `indexes` returns them
|
|
48
|
+
* @typeParam M - Its mutations, as `mutations` returns them
|
|
49
|
+
*/
|
|
50
|
+
export type FilesRecordParts<T extends EastType, I extends object, M extends object> = Omit<RecordConfig<T, I, M>, 'initial'>;
|
|
38
51
|
/** One file, by its key relative to where the workspace binds the source. */
|
|
39
52
|
export interface FilesKeySpec {
|
|
40
53
|
readonly key: string;
|
|
@@ -113,14 +126,32 @@ export declare class FilesSource {
|
|
|
113
126
|
* @returns The input, for tasks to take
|
|
114
127
|
*/
|
|
115
128
|
listing<Name extends string>(input: Name, spec: FilesSelection): FilesInput<Name, typeof FilesListingType>;
|
|
129
|
+
/**
|
|
130
|
+
* A record seeded from a file: declared with no initial value, so it is
|
|
131
|
+
* pending until its file arrives, which is its first state (`$init`;
|
|
132
|
+
* nothing runs on an empty state first, and its dependents wait as they
|
|
133
|
+
* wait on an unset input); seeded again (`$seed`) while nothing has
|
|
134
|
+
* mutated it since, or when a sync is asked to reset it; kept otherwise.
|
|
135
|
+
* It is declared whole, as any record is: its indexes, mutations and
|
|
136
|
+
* migrations are given here, as `e3.record` takes them.
|
|
137
|
+
*
|
|
138
|
+
* @param name - The record's name
|
|
139
|
+
* @param type - Its state's type, which the file must hold
|
|
140
|
+
* @param spec - One file (`key`), or the newest under a prefix (`prefix`, `include`)
|
|
141
|
+
* @param parts - Its indexes, mutations and migrations, as `e3.record` takes them; none when omitted
|
|
142
|
+
* @returns The record, for tasks to take and its mutations to be fed: `e3.record(name, type, parts)`
|
|
143
|
+
* @throws {FilesDeclarationError} When the name is one e3 refuses, or the spec is
|
|
144
|
+
* @throws {Error} When `parts` holds an initial value, or holds what `e3.record` refuses, naming it
|
|
145
|
+
*/
|
|
146
|
+
record<Name extends string, T extends EastType, I extends Readonly<Record<string, IndexDraft>> = Record<never, never>, M extends Readonly<Record<string, MutationDraft>> = Record<never, never>>(name: Name, type: T, spec: FilesKeySpec | FilesSelection, parts?: FilesRecordParts<T, I, M>): ReturnType<typeof e3.record<Name, T, I, M>>;
|
|
116
147
|
/**
|
|
117
148
|
* A record's mutation, fed: a sync calls it once with each new file's
|
|
118
149
|
* value, which must be of the mutation's one argument's type. The
|
|
119
|
-
* mutation is the package
|
|
120
|
-
* one argument; a `patch` mutation takes a patch,
|
|
121
|
-
* cannot be fed.
|
|
150
|
+
* mutation is one a record of the package declares, a `reduce` or an
|
|
151
|
+
* `edit` taking exactly one argument; a `patch` mutation takes a patch,
|
|
152
|
+
* not a value, so it cannot be fed.
|
|
122
153
|
*
|
|
123
|
-
* @param def - The mutation: `
|
|
154
|
+
* @param def - The mutation, as its record holds it: `record.mutations.<name>`, a `mutation.reduce(...)` or `mutation.edit(...)` of its declaration
|
|
124
155
|
* @param spec - One file (`key`), or the newest under a prefix (`prefix`, `include`)
|
|
125
156
|
* @returns The mutation, as given
|
|
126
157
|
* @throws {FilesDeclarationError} When the mutation takes other than one argument, or is a `patch`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../../src/authoring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../../src/authoring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,EAAE,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,Y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AAI,EAAE,IAAI,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,gBAAgB,CAAC;IAI1G;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CACJ,IAAI,SAAS,MAAM,EACnB,CAAC,SAAS,QAAQ,EAClB,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACrE,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACxE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,cAAc,EAAE,KAAK,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAY3I;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,CAAC,SAAS,WAAW,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,cAAc,GAAG,aAAa,CAAC,CAAC,CAAC;CAW/F;AAED,uBAAuB;AACvB,eAAO,MAAM,KAAK;IAChB;;;;;;OAMG;iBACU,MAAM,GAAG,WAAW;IAIjC;;;;;;;;OAQG;sBACe,SAAS,WAAW,EAAE,GAAG,aAAa;CAmBzD,CAAC"}
|
package/dist/src/authoring.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* export const orders = upload.file('orders', { key: 'orders.beast2', type: ArrayType(Order) }); // an Array<Order>
|
|
13
13
|
* export const stock = upload.latest('stock', { prefix: 'stock/', type: ArrayType(Stock) });
|
|
14
14
|
* export const files = upload.folder('invoices', { prefix: 'invoices/', include: '*.pdf' });
|
|
15
|
-
* upload.mutation(
|
|
15
|
+
* upload.mutation(priceBook.mutations.load_prices, { key: 'prices.beast2' }); // each new file calls it
|
|
16
16
|
* export default Files.manifest([upload]);
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
@@ -21,10 +21,13 @@
|
|
|
21
21
|
* them; until the first, they are unassigned. A `file` or `latest` that
|
|
22
22
|
* names a `type` is an input of that type, filled with the beast2 value the
|
|
23
23
|
* file holds; one that names none is a `Blob`, filled with the file's
|
|
24
|
-
* bytes. A
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* bytes. A record seeded here is an `e3.record` with no initial value,
|
|
25
|
+
* declared whole with its indexes, mutations and migrations. A mutation fed
|
|
26
|
+
* here is one a record of the package declares, a `reduce` or an `edit`
|
|
27
|
+
* taking one argument (`record.mutations.<name>`): a sync calls it once with
|
|
28
|
+
* each new file's value. What each source's files fill is the
|
|
29
|
+
* {@link Files.manifest}, which `e3-cloud files deploy` deploys beside the
|
|
30
|
+
* package.
|
|
28
31
|
*
|
|
29
32
|
* @packageDocumentation
|
|
30
33
|
*/
|
|
@@ -151,14 +154,43 @@ export class FilesSource {
|
|
|
151
154
|
listing(input, spec) {
|
|
152
155
|
return this.#input(input, FilesListingType, variant('listing', selected(spec)), selectionProblems(variant('input', input), spec));
|
|
153
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* A record seeded from a file: declared with no initial value, so it is
|
|
159
|
+
* pending until its file arrives, which is its first state (`$init`;
|
|
160
|
+
* nothing runs on an empty state first, and its dependents wait as they
|
|
161
|
+
* wait on an unset input); seeded again (`$seed`) while nothing has
|
|
162
|
+
* mutated it since, or when a sync is asked to reset it; kept otherwise.
|
|
163
|
+
* It is declared whole, as any record is: its indexes, mutations and
|
|
164
|
+
* migrations are given here, as `e3.record` takes them.
|
|
165
|
+
*
|
|
166
|
+
* @param name - The record's name
|
|
167
|
+
* @param type - Its state's type, which the file must hold
|
|
168
|
+
* @param spec - One file (`key`), or the newest under a prefix (`prefix`, `include`)
|
|
169
|
+
* @param parts - Its indexes, mutations and migrations, as `e3.record` takes them; none when omitted
|
|
170
|
+
* @returns The record, for tasks to take and its mutations to be fed: `e3.record(name, type, parts)`
|
|
171
|
+
* @throws {FilesDeclarationError} When the name is one e3 refuses, or the spec is
|
|
172
|
+
* @throws {Error} When `parts` holds an initial value, or holds what `e3.record` refuses, naming it
|
|
173
|
+
*/
|
|
174
|
+
record(name, type, spec, parts) {
|
|
175
|
+
const target = variant('record', name);
|
|
176
|
+
refuse(nameProblems('record', name));
|
|
177
|
+
// Built before its mapping is recorded, so a part e3 refuses leaves the source as it was
|
|
178
|
+
const record = e3.record(name, type, parts);
|
|
179
|
+
// `default` is where a record keeps its initial value, there whether a value or a function that makes one (never called here)
|
|
180
|
+
if ('default' in record)
|
|
181
|
+
throw new Error(`record ${name}: a record seeded from a file declares no initial value, since its file is its first state`);
|
|
182
|
+
const { shape, problems } = oneFileShape(target, spec, type);
|
|
183
|
+
this.#declare(target, shape, problems);
|
|
184
|
+
return record;
|
|
185
|
+
}
|
|
154
186
|
/**
|
|
155
187
|
* A record's mutation, fed: a sync calls it once with each new file's
|
|
156
188
|
* value, which must be of the mutation's one argument's type. The
|
|
157
|
-
* mutation is the package
|
|
158
|
-
* one argument; a `patch` mutation takes a patch,
|
|
159
|
-
* cannot be fed.
|
|
189
|
+
* mutation is one a record of the package declares, a `reduce` or an
|
|
190
|
+
* `edit` taking exactly one argument; a `patch` mutation takes a patch,
|
|
191
|
+
* not a value, so it cannot be fed.
|
|
160
192
|
*
|
|
161
|
-
* @param def - The mutation: `
|
|
193
|
+
* @param def - The mutation, as its record holds it: `record.mutations.<name>`, a `mutation.reduce(...)` or `mutation.edit(...)` of its declaration
|
|
162
194
|
* @param spec - One file (`key`), or the newest under a prefix (`prefix`, `include`)
|
|
163
195
|
* @returns The mutation, as given
|
|
164
196
|
* @throws {FilesDeclarationError} When the mutation takes other than one argument, or is a `patch`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.js","sourceRoot":"","sources":["../../src/authoring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"authoring.js","sourceRoot":"","sources":["../../src/authoring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAgF,MAAM,aAAa,CAAC;AAC3G,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAiB,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAChD,gBAAgB,EAAE,eAAe,GAElC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AA0CvE,0EAA0E;AAC1E,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,oBAAoB;IACX,QAAQ,CAA0B;IAE3C,YAAY,QAAiC;QAC3C,KAAK,CAAC,gDAAgD,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACtH,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED,sDAAsD;AACtD,SAAS,MAAM,CAAC,QAAiC;IAC/C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AACrE,CAAC;AAED,8DAA8D;AAC9D,SAAS,YAAY,CAAC,IAAgD,EAAE,IAAY;IAClF,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,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AAC,MAAM,CAAC,CAAC;oBAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;gBACpI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC7B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QACD,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjB,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACF,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* - `Files.source(name)`: a source, which each workspace binds to a bucket
|
|
10
10
|
* and a prefix; its `file`, `latest`, `folder` and `listing` declare the
|
|
11
11
|
* inputs its files fill, each an ordinary `e3.input`, a `file` or `latest`
|
|
12
|
-
* typed when it names a `type`; its `
|
|
13
|
-
*
|
|
12
|
+
* typed when it names a `type`; its `record` declares a record seeded
|
|
13
|
+
* from a file, an `e3.record` with no initial value and its parts as
|
|
14
|
+
* `e3.record` takes them; its `mutation` names a record's mutation fed by
|
|
15
|
+
* its files.
|
|
14
16
|
* - `Files.manifest(sources)`: the declarations `e3-cloud files deploy`
|
|
15
17
|
* deploys beside the package.
|
|
16
18
|
* - `checkFiles`, `checkBindings`, `readPackageSurface`: the checks a deploy
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
*
|
|
24
26
|
* @packageDocumentation
|
|
25
27
|
*/
|
|
26
|
-
export { Files, FilesSource, FilesDeclarationError, type FilesInput, type FilesMutation, type FilesSelection, type FilesKeySpec, type FilesTypedKeySpec, type FilesTypedSelection, } from './authoring.js';
|
|
28
|
+
export { Files, FilesSource, FilesDeclarationError, type FilesInput, type FilesMutation, type FilesRecordParts, type FilesSelection, type FilesKeySpec, type FilesTypedKeySpec, type FilesTypedSelection, } from './authoring.js';
|
|
27
29
|
export { checkFiles, checkBindings, readPackageInputs, readPackageSurface, shapeType, type PackageInput, type PackageRecord, type PackageMutation, type PackageSurface, type ObjectReader, type BindingPolicy, } from './check.js';
|
|
28
30
|
export { globMatcher, parseBucketUrl, keyProblem, prefixProblem, includeProblem, type BucketLocation } from './paths.js';
|
|
29
31
|
export { FilesManifestType, FilesMappingType, FilesShapeType, FilesTargetType, FilesBindingType, FilesSyncReportType, FilesMappingReportType, FilesRefusalReasonType, FilesStatusType, FilesProblemType, FilesListingRowType, FilesFileType, FilesFolderType, FilesListingType, FILES_FILE_MAX_BYTES, FILES_FOLDER_ENTRY_MAX_BYTES, FILES_TYPED_VALUE_MAX_BYTES, FILES_SEGMENT_MAX_BYTES, filesProblemText, filesRefusalText, filesTargetText, parseFilesTarget, sameFilesTarget, type FilesManifest, type FilesMapping, type FilesShape, type FilesTarget, type FilesBinding, type FilesSyncReport, type FilesMappingReport, type FilesRefusalReason, type FilesStatus, type FilesProblem, type FilesListingRow, } from '@elaraai/e3-cloud-types';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,KAAK,EAAE,WAAW,EAAE,qBAAqB,EACzC,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,mBAAmB,GACrJ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACzH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,2BAA2B,EAC3B,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* - `Files.source(name)`: a source, which each workspace binds to a bucket
|
|
10
10
|
* and a prefix; its `file`, `latest`, `folder` and `listing` declare the
|
|
11
11
|
* inputs its files fill, each an ordinary `e3.input`, a `file` or `latest`
|
|
12
|
-
* typed when it names a `type`; its `
|
|
13
|
-
*
|
|
12
|
+
* typed when it names a `type`; its `record` declares a record seeded
|
|
13
|
+
* from a file, an `e3.record` with no initial value and its parts as
|
|
14
|
+
* `e3.record` takes them; its `mutation` names a record's mutation fed by
|
|
15
|
+
* its files.
|
|
14
16
|
* - `Files.manifest(sources)`: the declarations `e3-cloud files deploy`
|
|
15
17
|
* deploys beside the package.
|
|
16
18
|
* - `checkFiles`, `checkBindings`, `readPackageSurface`: the checks a deploy
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,KAAK,EAAE,WAAW,EAAE,qBAAqB,GAE1C,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,GAOV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAuB,MAAM,YAAY,CAAC;AACzH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,EAC5B,2BAA2B,EAC3B,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,GAYhB,MAAM,yBAAyB,CAAC"}
|
|
@@ -25,6 +25,16 @@ export interface StorageWriterOptions {
|
|
|
25
25
|
* @returns The refusal, or null
|
|
26
26
|
*/
|
|
27
27
|
export declare function doorRefusal(err: unknown): FilesRefusalReason | null;
|
|
28
|
+
/**
|
|
29
|
+
* What a failed mutation said, from the runner's stderr: its last lines that
|
|
30
|
+
* are no stack frame (a runtime error prints its message, then where it was
|
|
31
|
+
* raised), at most three, as one line. What a refusal of a feed or a seed
|
|
32
|
+
* carries (`mutation {outcome: 'failed', message}`).
|
|
33
|
+
*
|
|
34
|
+
* @param stderr - The runner's stderr
|
|
35
|
+
* @returns The words
|
|
36
|
+
*/
|
|
37
|
+
export declare function failureWords(stderr: string): string;
|
|
28
38
|
/**
|
|
29
39
|
* The sync's writer over an e3 store, for one workspace.
|
|
30
40
|
*
|
|
@@ -73,7 +83,9 @@ export interface CloudWriterOptions extends Omit<StorageWriterOptions, 'scratchD
|
|
|
73
83
|
* typed file taken in through the platform's staging and e3's door for a
|
|
74
84
|
* delivery the store holds (`datasetAdoptObject`), so no byte of it passes
|
|
75
85
|
* through a disk (D7), and an intake the round's deadline stops resumes in
|
|
76
|
-
* the next round with the pieces it finished remembered
|
|
86
|
+
* the next round with the pieces it finished remembered; a record seeded
|
|
87
|
+
* from a staged file the same way (`deliveryAdoptStored`, then the
|
|
88
|
+
* record's `$init` or `$seed` commit).
|
|
77
89
|
*
|
|
78
90
|
* @param storage - The platform's storage
|
|
79
91
|
* @param repo - The repository, as the storage names it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+CH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+CH,OAAO,EAmBL,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAA0E,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC1I,OAAO,EAEkE,KAAK,WAAW,EAExF,MAAM,mBAAmB,CAAC;AAwD3B,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACnC,oLAAoL;IACpL,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7B,iJAAiJ;IACjJ,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,iEAAiE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