@elaraai/e3-cloud-files 1.0.91-alpha.0 → 1.0.92
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 +69 -10
- package/dist/src/authoring.d.ts +1 -1
- package/dist/src/authoring.d.ts.map +1 -1
- package/dist/src/paths.d.ts +13 -2
- package/dist/src/paths.d.ts.map +1 -1
- package/dist/src/paths.js +118 -27
- package/dist/src/paths.js.map +1 -1
- package/dist/src/s3/index.d.ts +12 -5
- package/dist/src/s3/index.d.ts.map +1 -1
- package/dist/src/s3/index.js +76 -14
- package/dist/src/s3/index.js.map +1 -1
- package/dist/src/storage/index.d.ts.map +1 -1
- package/dist/src/storage/index.js +4 -1
- package/dist/src/storage/index.js.map +1 -1
- package/dist/src/sync/engine.d.ts +60 -5
- package/dist/src/sync/engine.d.ts.map +1 -1
- package/dist/src/sync/engine.js +189 -53
- package/dist/src/sync/engine.js.map +1 -1
- package/dist/src/sync/index.d.ts +1 -1
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/index.js +1 -1
- package/dist/src/sync/index.js.map +1 -1
- package/dist/src/sync/memory.d.ts +11 -1
- package/dist/src/sync/memory.d.ts.map +1 -1
- package/dist/src/sync/memory.js +35 -7
- package/dist/src/sync/memory.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -53,9 +53,9 @@ export default Files.manifest([upload]);
|
|
|
53
53
|
|
|
54
54
|
| Shape | Selects | The input's type | Largest file |
|
|
55
55
|
|---|---|---|---|
|
|
56
|
-
| `file(input, { key })` | One key | `Blob` | 1 GiB |
|
|
57
|
-
| `latest(input, { prefix, include? })` | The greatest key under the prefix that matches | `Blob` | 1 GiB |
|
|
58
|
-
| `folder(input, { prefix, include? })` | Every key under the prefix that matches, by its path under the prefix | `Dict<String, Blob>` | 64 MiB each |
|
|
56
|
+
| `file(input, { key })` | One key | `Blob` | 1 GiB less 64 KiB |
|
|
57
|
+
| `latest(input, { prefix, include? })` | The greatest key under the prefix that matches | `Blob` | 1 GiB less 64 KiB |
|
|
58
|
+
| `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 |
|
|
59
59
|
| `listing(input, { prefix, include? })` | The same keys' size, time and ETag, without their bytes | `Dict<String, Struct{size, modified, etag}>` | none |
|
|
60
60
|
|
|
61
61
|
- **Each shape returns an ordinary `e3.input`.** It has no default, so it
|
|
@@ -65,9 +65,11 @@ export default Files.manifest([upload]);
|
|
|
65
65
|
- **Keys and prefixes are relative to the binding.** The code never names a
|
|
66
66
|
bucket. A prefix is `''` (everything the binding holds) or ends with `/`.
|
|
67
67
|
- **`include` is a glob** over each file's path under the prefix: `*` matches
|
|
68
|
-
within one folder, `**` across folders, `?` one character
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
within one folder, `**` across folders, `?` one character, `[abc]` or
|
|
69
|
+
`[a-z]` one of a set (`[!abc]` any but those), and `{csv,json}` any of its
|
|
70
|
+
alternatives, each a glob itself (`*.{csv,json}`). `*.json` takes only the
|
|
71
|
+
prefix's own files, and lists only its own folder; `**/*.json` takes its
|
|
72
|
+
subfolders' too, their paths naming the subfolder (`2026/10/a.json`).
|
|
71
73
|
- **Mistakes are refused as they are declared** (`FilesDeclarationError`, one
|
|
72
74
|
line per problem): a name e3 refuses, a key that isn't relative, a glob
|
|
73
75
|
that can't match, and in `Files.manifest` two sources of one name or two
|
|
@@ -120,7 +122,7 @@ e3 workspace deploy ./repo dev --from-source src/package.ts
|
|
|
120
122
|
e3-cloud files deploy ./repo dev src/files.ts
|
|
121
123
|
e3-cloud files bind ./repo dev upload s3://partner-drop/orders-team/ --profile partner --latest 30
|
|
122
124
|
e3-cloud files sync ./repo dev
|
|
123
|
-
e3
|
|
125
|
+
e3 dataflow run ./repo dev
|
|
124
126
|
```
|
|
125
127
|
|
|
126
128
|
- **`<repo>` is a local repository's path or a repository URL**
|
|
@@ -139,7 +141,7 @@ e3 start ./repo dev
|
|
|
139
141
|
input took last, by ETag and size. It reads only what is new or changed,
|
|
140
142
|
writes only the inputs whose files changed, and says what it did per input.
|
|
141
143
|
`--input` syncs only those inputs; `--dry-run` lists what a sync would take
|
|
142
|
-
and takes nothing. A sync doesn't run the dataflow: `e3
|
|
144
|
+
and takes nothing. A sync doesn't run the dataflow: `e3 dataflow run` does, and the
|
|
143
145
|
sync prints the command when anything changed.
|
|
144
146
|
- **`files status`** shows the declarations, where each source is bound, and
|
|
145
147
|
the last sync.
|
|
@@ -150,14 +152,71 @@ is written, so a sync that stops part way takes the rest next time.
|
|
|
150
152
|
### What a sync takes again whole
|
|
151
153
|
|
|
152
154
|
A sync trusts what an input took last only while the input still holds the
|
|
153
|
-
value the sync wrote
|
|
155
|
+
value the sync wrote, and its declaration and binding are the ones it was
|
|
156
|
+
taken under, which it remembers with it. It takes an input's files again
|
|
157
|
+
whole when:
|
|
154
158
|
|
|
155
159
|
- a deploy reset the input, or someone set it by hand. A package deploy resets
|
|
156
160
|
inputs unless told to keep them: `e3 workspace deploy … --inputs
|
|
157
161
|
keep-edited` keeps synced inputs while their type is unchanged;
|
|
158
|
-
- the input's declaration changed (`files deploy` says which)
|
|
162
|
+
- the input's declaration changed (`files deploy` says which), even when a
|
|
163
|
+
sync under the old one was still writing it;
|
|
159
164
|
- its source was bound somewhere else (`files bind` says which).
|
|
160
165
|
|
|
166
|
+
### Files a sync can't read
|
|
167
|
+
|
|
168
|
+
A file that can't be read is refused, named in the report, and the sync goes
|
|
169
|
+
on with the rest: a file archived to a storage class that must be restored
|
|
170
|
+
first, one encrypted with a key the reader may not use, one that changed or
|
|
171
|
+
went between the listing and its read. The input keeps what it held of it,
|
|
172
|
+
and the next sync tries it again. Any other failure (the bucket unreachable,
|
|
173
|
+
throttled) stops the sync, which is safe to run again.
|
|
174
|
+
|
|
175
|
+
### Staging and production
|
|
176
|
+
|
|
177
|
+
On a deployment, a workspace may have a staging: another workspace where
|
|
178
|
+
changes are tried before they go live (`e3-cloud staging`). The declarations
|
|
179
|
+
are part of the solution's code, so they travel as its package and apps do.
|
|
180
|
+
Where the files are is each workspace's own.
|
|
181
|
+
|
|
182
|
+
- **A release** (`e3-cloud release <url> <staging> <production>`) gives
|
|
183
|
+
production the staging's declarations, with its package and apps. Its plan
|
|
184
|
+
says what happens to each input: added, changed, unchanged or removed. The
|
|
185
|
+
release is refused while the declarations don't fit the package production
|
|
186
|
+
will run, or read a source production hasn't bound. Production's next sync
|
|
187
|
+
takes an input whose declaration changed again whole. A release syncs
|
|
188
|
+
nothing: sync production after it.
|
|
189
|
+
- **Production's bindings are its own**: a release never changes them. Bind a
|
|
190
|
+
new source in production before the release that brings the declarations
|
|
191
|
+
reading it; `files bind` takes a source no declaration reads yet.
|
|
192
|
+
- **A protected workspace refuses `files deploy`**: its declarations change
|
|
193
|
+
only by a release from its staging, or by a rollback. In an emergency an
|
|
194
|
+
admin can force a deploy past it (`--force`). Its history records the
|
|
195
|
+
force, and the next release from staging undoes it.
|
|
196
|
+
- **A rollback** (`e3-cloud rollback <url> <production>`) restores the
|
|
197
|
+
declarations of the entry it goes back to, with that entry's package and
|
|
198
|
+
apps.
|
|
199
|
+
- **A copy** of production, such as a staging started from it, gives the
|
|
200
|
+
target everything production has of its Files. That is its declarations,
|
|
201
|
+
its bindings, its last sync and what each input took. So a staging
|
|
202
|
+
rehearses on production's files, and its first sync takes only what
|
|
203
|
+
changed since production's.
|
|
204
|
+
- The workspace's history (`e3-cloud history`) lists every deploy of
|
|
205
|
+
declarations, every binding moved, and every forced change.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Try a change on staging
|
|
209
|
+
e3-cloud files deploy https://e3.example.com/repos/acme staging src/files.ts
|
|
210
|
+
e3-cloud files sync https://e3.example.com/repos/acme staging
|
|
211
|
+
e3 dataflow run https://e3.example.com/repos/acme staging
|
|
212
|
+
|
|
213
|
+
# Then production: bind any new source first, release, then sync
|
|
214
|
+
e3-cloud files bind https://e3.example.com/repos/acme production invoices s3://drop/acme/invoices/
|
|
215
|
+
e3-cloud release https://e3.example.com/repos/acme staging production
|
|
216
|
+
e3-cloud files sync https://e3.example.com/repos/acme production
|
|
217
|
+
e3 dataflow run https://e3.example.com/repos/acme production
|
|
218
|
+
```
|
|
219
|
+
|
|
161
220
|
### Large folders
|
|
162
221
|
|
|
163
222
|
A folder is stored as e3 stores any large collection, in pieces each holding
|
package/dist/src/authoring.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export type FilesInput<Name extends string, T extends EastType> = ReturnType<typ
|
|
|
30
30
|
export interface FilesSelection {
|
|
31
31
|
/** The folder, relative to where the workspace binds the source: `''` for all of it, else ending with `/` */
|
|
32
32
|
readonly prefix: string;
|
|
33
|
-
/** A glob over paths relative to the prefix: `*` within a segment, `**` across segments, `?` one character */
|
|
33
|
+
/** A glob over paths relative to the prefix: `*` within a segment, `**` across segments, `?` one character, `[a-z]` one of a set, `{csv,json}` any of its alternatives */
|
|
34
34
|
readonly include?: string;
|
|
35
35
|
}
|
|
36
36
|
/** Thrown when declarations are not well-formed, naming every problem. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../../src/authoring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACL,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAEhD,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EACzD,MAAM,yBAAyB,CAAC;AAGjC,yFAAyF;AACzF,MAAM,MAAM,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC,SAAS,QAAQ,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvG,u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AE,IAAI,EAAE,IAAI,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,aAAa,CAAC;IAM9G;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,aAAa,CAAC;IAItG;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,eAAe,CAAC;IAIxG;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,EAAE,OAAO,gBAAgB,CAAC;CAG3G;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/paths.d.ts
CHANGED
|
@@ -35,13 +35,24 @@ export declare function prefixProblem(prefix: string): string | null;
|
|
|
35
35
|
export declare function includeProblem(include: string): string | null;
|
|
36
36
|
/**
|
|
37
37
|
* A glob's matcher over paths relative to a prefix: `*` matches within one
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* folder of the path, `**` across folders, `?` one character but `/`,
|
|
39
|
+
* `[abc]`, `[a-z]` and `[!abc]` one character of a set but `/`, and
|
|
40
|
+
* `{csv,json}` any of its alternatives, each a glob itself. Every other
|
|
41
|
+
* character matches itself. No glob matches every path.
|
|
40
42
|
*
|
|
41
43
|
* @param include - The glob, or `null` for every path
|
|
42
44
|
* @returns Whether a path matches
|
|
45
|
+
* @throws {Error} When the glob is malformed ({@link includeProblem} says how)
|
|
43
46
|
*/
|
|
44
47
|
export declare function globMatcher(include: string | null): (path: string) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether a glob matches only paths in the prefix's own folder, never in one
|
|
50
|
+
* under it: a listing of that folder alone holds every file it can match.
|
|
51
|
+
*
|
|
52
|
+
* @param include - The glob, or `null` for every path
|
|
53
|
+
* @returns Whether it names no `/` and no `**`
|
|
54
|
+
*/
|
|
55
|
+
export declare function matchesTopFolderOnly(include: string | null): boolean;
|
|
45
56
|
/** A binding's URL, read: its bucket, and the prefix under it, `''` or ending with `/`. */
|
|
46
57
|
export interface BucketLocation {
|
|
47
58
|
readonly bucket: string;
|
package/dist/src/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKrD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI3D;
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKrD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI3D;AAsFD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAY7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAI7E;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAEpE;AAED,2FAA2F;AAC3F,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAQzF"}
|
package/dist/src/paths.js
CHANGED
|
@@ -40,6 +40,99 @@ export function prefixProblem(prefix) {
|
|
|
40
40
|
return "doesn't end with /: a prefix names a folder";
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
|
+
/** Why a glob is malformed, completing "include '<include>' …". */
|
|
44
|
+
class GlobError extends Error {
|
|
45
|
+
}
|
|
46
|
+
/** A literal character, as a regular expression matches it. */
|
|
47
|
+
function literal(c) {
|
|
48
|
+
return c.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A `[…]` class at `glob[at.i]`, as a regular expression: one character of a
|
|
52
|
+
* segment, never `/`. `[!…]` and `[^…]` match any character but those named;
|
|
53
|
+
* a `]` first in the class is one of its characters; `a-z` is a range.
|
|
54
|
+
*/
|
|
55
|
+
function characterClass(glob, at) {
|
|
56
|
+
let i = at.i + 1;
|
|
57
|
+
let negate = false;
|
|
58
|
+
if (glob[i] === '!' || glob[i] === '^') {
|
|
59
|
+
negate = true;
|
|
60
|
+
i += 1;
|
|
61
|
+
}
|
|
62
|
+
let body = '';
|
|
63
|
+
for (let first = true;; first = false, i += 1) {
|
|
64
|
+
const c = glob[i];
|
|
65
|
+
if (c === undefined)
|
|
66
|
+
throw new GlobError('has a [ it never closes');
|
|
67
|
+
if (c === ']' && !first)
|
|
68
|
+
break;
|
|
69
|
+
if (c === '/')
|
|
70
|
+
throw new GlobError('has a / in a [...] class, which matches one character within a folder');
|
|
71
|
+
body += c === '\\' || c === ']' || c === '[' || c === '^' ? `\\${c}` : c;
|
|
72
|
+
}
|
|
73
|
+
at.i = i + 1;
|
|
74
|
+
return negate ? `[^/${body}]` : `[${body}]`;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A glob's pattern from `glob[at.i]`, as a regular expression, up to its end,
|
|
78
|
+
* or, inside braces, up to the `,` or `}` that ends an alternative.
|
|
79
|
+
*/
|
|
80
|
+
function translate(glob, at, inBraces) {
|
|
81
|
+
let pattern = '';
|
|
82
|
+
while (at.i < glob.length) {
|
|
83
|
+
const c = glob[at.i];
|
|
84
|
+
if (inBraces && (c === ',' || c === '}'))
|
|
85
|
+
return pattern;
|
|
86
|
+
if (c === '*' && glob[at.i + 1] === '*') {
|
|
87
|
+
// `**/` matches zero or more whole folders; a bare `**`, anything
|
|
88
|
+
if (glob[at.i + 2] === '/') {
|
|
89
|
+
pattern += '(?:.*/)?';
|
|
90
|
+
at.i += 3;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
pattern += '.*';
|
|
94
|
+
at.i += 2;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (c === '*') {
|
|
98
|
+
pattern += '[^/]*';
|
|
99
|
+
at.i += 1;
|
|
100
|
+
}
|
|
101
|
+
else if (c === '?') {
|
|
102
|
+
pattern += '[^/]';
|
|
103
|
+
at.i += 1;
|
|
104
|
+
}
|
|
105
|
+
else if (c === '[') {
|
|
106
|
+
pattern += characterClass(glob, at);
|
|
107
|
+
}
|
|
108
|
+
else if (c === '{') {
|
|
109
|
+
at.i += 1;
|
|
110
|
+
const alternatives = [];
|
|
111
|
+
for (;;) {
|
|
112
|
+
alternatives.push(translate(glob, at, true));
|
|
113
|
+
const end = glob[at.i];
|
|
114
|
+
if (end === undefined)
|
|
115
|
+
throw new GlobError('has a { it never closes');
|
|
116
|
+
at.i += 1;
|
|
117
|
+
if (end === '}')
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
pattern += `(?:${alternatives.join('|')})`;
|
|
121
|
+
}
|
|
122
|
+
else if (c === '}') {
|
|
123
|
+
throw new GlobError('has a } with no { before it');
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
pattern += literal(c);
|
|
127
|
+
at.i += 1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return pattern;
|
|
131
|
+
}
|
|
132
|
+
/** A glob, as the regular expression its matcher tests paths with. */
|
|
133
|
+
function globRegex(include) {
|
|
134
|
+
return new RegExp(`^${translate(include, { i: 0 }, false)}$`, 'su');
|
|
135
|
+
}
|
|
43
136
|
/**
|
|
44
137
|
* Why a glob cannot select files, or `null` when it can.
|
|
45
138
|
*
|
|
@@ -53,46 +146,44 @@ export function includeProblem(include) {
|
|
|
53
146
|
return 'begins with /: it matches paths relative to the prefix';
|
|
54
147
|
if (/\*{3,}/.test(include))
|
|
55
148
|
return 'has three or more * in a row';
|
|
149
|
+
try {
|
|
150
|
+
globRegex(include);
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
if (err instanceof GlobError)
|
|
154
|
+
return err.message;
|
|
155
|
+
// A class whose range runs backwards (`[z-a]`) is no pattern at all
|
|
156
|
+
return 'has a [...] class no character can match';
|
|
157
|
+
}
|
|
56
158
|
return null;
|
|
57
159
|
}
|
|
58
160
|
/**
|
|
59
161
|
* A glob's matcher over paths relative to a prefix: `*` matches within one
|
|
60
|
-
*
|
|
61
|
-
*
|
|
162
|
+
* folder of the path, `**` across folders, `?` one character but `/`,
|
|
163
|
+
* `[abc]`, `[a-z]` and `[!abc]` one character of a set but `/`, and
|
|
164
|
+
* `{csv,json}` any of its alternatives, each a glob itself. Every other
|
|
165
|
+
* character matches itself. No glob matches every path.
|
|
62
166
|
*
|
|
63
167
|
* @param include - The glob, or `null` for every path
|
|
64
168
|
* @returns Whether a path matches
|
|
169
|
+
* @throws {Error} When the glob is malformed ({@link includeProblem} says how)
|
|
65
170
|
*/
|
|
66
171
|
export function globMatcher(include) {
|
|
67
172
|
if (include === null)
|
|
68
173
|
return () => true;
|
|
69
|
-
|
|
70
|
-
for (let i = 0; i < include.length; i++) {
|
|
71
|
-
const c = include[i];
|
|
72
|
-
if (c === '*' && include[i + 1] === '*') {
|
|
73
|
-
// `**/` matches zero or more whole segments; a bare `**`, anything
|
|
74
|
-
if (include[i + 2] === '/') {
|
|
75
|
-
pattern += '(?:.*/)?';
|
|
76
|
-
i += 2;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
pattern += '.*';
|
|
80
|
-
i += 1;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else if (c === '*') {
|
|
84
|
-
pattern += '[^/]*';
|
|
85
|
-
}
|
|
86
|
-
else if (c === '?') {
|
|
87
|
-
pattern += '[^/]';
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
pattern += c.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const regex = new RegExp(`^${pattern}$`, 'su');
|
|
174
|
+
const regex = globRegex(include);
|
|
94
175
|
return (path) => regex.test(path);
|
|
95
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Whether a glob matches only paths in the prefix's own folder, never in one
|
|
179
|
+
* under it: a listing of that folder alone holds every file it can match.
|
|
180
|
+
*
|
|
181
|
+
* @param include - The glob, or `null` for every path
|
|
182
|
+
* @returns Whether it names no `/` and no `**`
|
|
183
|
+
*/
|
|
184
|
+
export function matchesTopFolderOnly(include) {
|
|
185
|
+
return include !== null && !include.includes('/') && !include.includes('**');
|
|
186
|
+
}
|
|
96
187
|
/**
|
|
97
188
|
* Reads a binding's URL, `s3://bucket/prefix/`.
|
|
98
189
|
*
|
package/dist/src/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,UAAU,CAAC;IAClC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,0EAA0E,CAAC;IAC3G,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,sDAAsD,CAAC;IACrF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,6EAA6E,CAAC;IACjH,IAAI,MAAM,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,6CAA6C,CAAC;IACjG,OAAO,IAAI,CAAC;AACd,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,UAAU,CAAC;IAClC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,0EAA0E,CAAC;IAC3G,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,sDAAsD,CAAC;IACrF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,6EAA6E,CAAC;IACjH,IAAI,MAAM,KAAK,EAAE,IAAI,CAAC,MAAM,CAA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AM,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,8CAA8C,EAAE,CAAC;IAC/G,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
package/dist/src/s3/index.d.ts
CHANGED
|
@@ -8,10 +8,17 @@
|
|
|
8
8
|
* the developer's own profile, the platform with a session scoped to the
|
|
9
9
|
* binding's bucket and prefix; both read through this.
|
|
10
10
|
*
|
|
11
|
-
* A listing is the bucket's, a page of 1,000 keys at a time, in key order
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* A listing is the bucket's, a page of 1,000 keys at a time, in key order;
|
|
12
|
+
* of a prefix's own folder alone (a delimiter), when the sync asks. An ETag is
|
|
13
|
+
* kept without the quotes the bucket wraps it in. One file's listing is a
|
|
14
|
+
* listing of its key alone, not a HEAD: a session that may list only under
|
|
15
|
+
* its binding's prefix is answered 403 for a HEAD of a key that isn't there,
|
|
16
|
+
* not 404. Credentials that may read the file but list nothing are asked by
|
|
17
|
+
* a HEAD instead, a 404 its absence. A file is read whole, at the version its listing gave (`If-Match`
|
|
18
|
+
* its ETag): at most 1 GiB for a `file` or `latest` input, 64 MiB for a
|
|
19
|
+
* folder's file. A file changed, archived, gone or closed to the reader since
|
|
20
|
+
* it was listed is refused (`FilesUnreadableError`), the sync going on with
|
|
21
|
+
* the rest; any other refusal is thrown.
|
|
15
22
|
*
|
|
16
23
|
* Needs `@aws-sdk/client-s3`, which a solution's own code never imports: the
|
|
17
24
|
* CLI and the platform do.
|
|
@@ -19,7 +26,7 @@
|
|
|
19
26
|
* @packageDocumentation
|
|
20
27
|
*/
|
|
21
28
|
import { type S3Client } from '@aws-sdk/client-s3';
|
|
22
|
-
import type
|
|
29
|
+
import { type FilesReader } from '../sync/engine.js';
|
|
23
30
|
/** Where a binding's files are: a bucket, and the prefix every key is relative to. */
|
|
24
31
|
export interface S3Location {
|
|
25
32
|
readonly bucket: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/s3/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/s3/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAiF,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAClI,OAAO,EAA0C,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE7F,sFAAsF;AACtF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAgCD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,GAAG,WAAW,CAgEjF"}
|
package/dist/src/s3/index.js
CHANGED
|
@@ -8,10 +8,17 @@
|
|
|
8
8
|
* the developer's own profile, the platform with a session scoped to the
|
|
9
9
|
* binding's bucket and prefix; both read through this.
|
|
10
10
|
*
|
|
11
|
-
* A listing is the bucket's, a page of 1,000 keys at a time, in key order
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* A listing is the bucket's, a page of 1,000 keys at a time, in key order;
|
|
12
|
+
* of a prefix's own folder alone (a delimiter), when the sync asks. An ETag is
|
|
13
|
+
* kept without the quotes the bucket wraps it in. One file's listing is a
|
|
14
|
+
* listing of its key alone, not a HEAD: a session that may list only under
|
|
15
|
+
* its binding's prefix is answered 403 for a HEAD of a key that isn't there,
|
|
16
|
+
* not 404. Credentials that may read the file but list nothing are asked by
|
|
17
|
+
* a HEAD instead, a 404 its absence. A file is read whole, at the version its listing gave (`If-Match`
|
|
18
|
+
* its ETag): at most 1 GiB for a `file` or `latest` input, 64 MiB for a
|
|
19
|
+
* folder's file. A file changed, archived, gone or closed to the reader since
|
|
20
|
+
* it was listed is refused (`FilesUnreadableError`), the sync going on with
|
|
21
|
+
* the rest; any other refusal is thrown.
|
|
15
22
|
*
|
|
16
23
|
* Needs `@aws-sdk/client-s3`, which a solution's own code never imports: the
|
|
17
24
|
* CLI and the platform do.
|
|
@@ -19,6 +26,7 @@
|
|
|
19
26
|
* @packageDocumentation
|
|
20
27
|
*/
|
|
21
28
|
import { GetObjectCommand, HeadObjectCommand, ListObjectsV2Command, S3ServiceException } from '@aws-sdk/client-s3';
|
|
29
|
+
import { FilesUnreadableError } from '../sync/engine.js';
|
|
22
30
|
/** An ETag without the quotes the bucket wraps it in. */
|
|
23
31
|
function bare(etag) {
|
|
24
32
|
return (etag ?? '').replace(/^"|"$/g, '');
|
|
@@ -27,6 +35,25 @@ function bare(etag) {
|
|
|
27
35
|
function missing(err) {
|
|
28
36
|
return err instanceof S3ServiceException && (err.name === 'NotFound' || err.name === 'NoSuchKey' || err.$metadata.httpStatusCode === 404);
|
|
29
37
|
}
|
|
38
|
+
/** Whether the bucket refused a request for want of access. */
|
|
39
|
+
function denied(err) {
|
|
40
|
+
return err instanceof S3ServiceException && (err.name === 'AccessDenied' || err.$metadata.httpStatusCode === 403);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Why the bucket refused to read one file, when the refusal is the file's
|
|
44
|
+
* own; `null` for any other, which the sync does not go on past.
|
|
45
|
+
*/
|
|
46
|
+
function unreadable(err) {
|
|
47
|
+
if (!(err instanceof S3ServiceException))
|
|
48
|
+
return null;
|
|
49
|
+
switch (err.name) {
|
|
50
|
+
case 'PreconditionFailed': return 'changed since it was listed: the next sync takes it';
|
|
51
|
+
case 'InvalidObjectState': return 'is archived: its storage class must be restored before it can be read';
|
|
52
|
+
case 'AccessDenied': return "can't be read with the binding's access: a key policy or the bucket's refuses it";
|
|
53
|
+
case 'NoSuchKey': return 'went while the sync read it';
|
|
54
|
+
default: return err.$metadata.httpStatusCode === 404 ? 'went while the sync read it' : null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
30
57
|
/**
|
|
31
58
|
* The reader of one bound source in its bucket.
|
|
32
59
|
*
|
|
@@ -37,10 +64,16 @@ function missing(err) {
|
|
|
37
64
|
export function s3FilesReader(client, location) {
|
|
38
65
|
const absolute = (key) => `${location.prefix}${key}`;
|
|
39
66
|
return {
|
|
40
|
-
async *list(prefix) {
|
|
67
|
+
async *list(prefix, options = {}) {
|
|
41
68
|
let token;
|
|
42
69
|
do {
|
|
43
|
-
const page = await client.send(new ListObjectsV2Command({
|
|
70
|
+
const page = await client.send(new ListObjectsV2Command({
|
|
71
|
+
Bucket: location.bucket,
|
|
72
|
+
Prefix: absolute(prefix),
|
|
73
|
+
ContinuationToken: token,
|
|
74
|
+
// The prefix's own folder: its subfolders are common prefixes, never listed
|
|
75
|
+
...(options.topFolderOnly === true && { Delimiter: '/' }),
|
|
76
|
+
}));
|
|
44
77
|
for (const object of page.Contents ?? []) {
|
|
45
78
|
if (object.Key === undefined)
|
|
46
79
|
continue;
|
|
@@ -55,20 +88,49 @@ export function s3FilesReader(client, location) {
|
|
|
55
88
|
} while (token !== undefined);
|
|
56
89
|
},
|
|
57
90
|
async stat(key) {
|
|
91
|
+
// The key's own listing comes first among those it begins: it is the
|
|
92
|
+
// shortest of them, and a listing is in key order
|
|
93
|
+
let page;
|
|
58
94
|
try {
|
|
59
|
-
|
|
60
|
-
return { key, size: head.ContentLength ?? 0, modified: head.LastModified ?? new Date(0), etag: bare(head.ETag) };
|
|
95
|
+
page = await client.send(new ListObjectsV2Command({ Bucket: location.bucket, Prefix: absolute(key), MaxKeys: 1 }));
|
|
61
96
|
}
|
|
62
97
|
catch (err) {
|
|
63
|
-
if (
|
|
64
|
-
|
|
65
|
-
|
|
98
|
+
if (!denied(err))
|
|
99
|
+
throw err;
|
|
100
|
+
// Credentials that may read the file and list nothing: a HEAD's 404 is its absence
|
|
101
|
+
try {
|
|
102
|
+
const head = await client.send(new HeadObjectCommand({ Bucket: location.bucket, Key: absolute(key) }));
|
|
103
|
+
return { key, size: head.ContentLength ?? 0, modified: head.LastModified ?? new Date(0), etag: bare(head.ETag) };
|
|
104
|
+
}
|
|
105
|
+
catch (headErr) {
|
|
106
|
+
if (missing(headErr))
|
|
107
|
+
return null;
|
|
108
|
+
throw headErr;
|
|
109
|
+
}
|
|
66
110
|
}
|
|
111
|
+
const object = page.Contents?.[0];
|
|
112
|
+
if (object?.Key !== absolute(key))
|
|
113
|
+
return null;
|
|
114
|
+
return { key, size: object.Size ?? 0, modified: object.LastModified ?? new Date(0), etag: bare(object.ETag) };
|
|
67
115
|
},
|
|
68
|
-
async read(
|
|
69
|
-
|
|
116
|
+
async read(file) {
|
|
117
|
+
let object;
|
|
118
|
+
try {
|
|
119
|
+
object = await client.send(new GetObjectCommand({ Bucket: location.bucket, Key: absolute(file.key), IfMatch: `"${file.etag}"` }));
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
const reason = unreadable(err);
|
|
123
|
+
if (reason !== null)
|
|
124
|
+
throw new FilesUnreadableError(file.key, reason);
|
|
125
|
+
throw err;
|
|
126
|
+
}
|
|
70
127
|
if (object.Body === undefined)
|
|
71
|
-
throw new Error(`s3://${location.bucket}/${absolute(key)} answered no bytes`);
|
|
128
|
+
throw new Error(`s3://${location.bucket}/${absolute(file.key)} answered no bytes`);
|
|
129
|
+
if (object.ContentLength !== undefined && object.ContentLength !== file.size) {
|
|
130
|
+
// Never buffered: its size was never checked
|
|
131
|
+
object.Body.destroy?.();
|
|
132
|
+
throw new FilesUnreadableError(file.key, `changed since it was listed (${object.ContentLength} bytes, not the ${file.size} listed): the next sync takes it`);
|
|
133
|
+
}
|
|
72
134
|
return object.Body.transformToByteArray();
|
|
73
135
|
},
|
|
74
136
|
};
|
package/dist/src/s3/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/s3/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/s3/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,kBAAkB,EAAiB,MAAM,oBAAoB,CAAC;AAClI,OAAO,EAAE,oBAAoB,EAAsC,MAAM,mBAAmB,CAAC;AAS7F,yDAAyD;AACzD,SAAS,IAAI,CAAC,IAAwB;IACpC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,6DAA6D;AAC7D,SAAS,OAAO,CAAC,GAAY;IAC3B,OAAO,GAAG,YAAY,kBAAkB,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,GAAG,CAAC,SAAS,CAAC,cAAc,KAAK,GAAG,CAAC,CAAC;AAC5I,CAAC;AAED,+DAA+D;AAC/D,SAAS,MAAM,CAAC,GAAY;IAC1B,OAAO,GAAG,YAAY,kBAAkB,IAAI,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,IAAI,GAAG,CAAC,SAAS,CAAC,cAAc,KAAK,GAAG,CAAC,CAAC;AACpH,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,GAAY;IAC9B,IAAI,CAAC,CAAC,GAAG,YAAY,kBAAkB,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,oBAAoB,CAAC,CAAC,OAAO,qDAAqD,CAAC;QACxF,KAAK,oBAAoB,CAAC,CAAC,OAAO,uEAAuE,CAAC;QAC1G,KAAK,cAAc,CAAC,CAAC,OAA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AC,OAAO,EAAE,EAAE,CAAC;gBACtD,MAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,gCAAgC,MAAM,CAAC,aAAa,mBAAmB,IAAI,CAAC,IAAI,kCAAkC,CAAC,CAAC;YAC/J,CAAC;YACD,OAAO,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,mBAAmB,CAAC;AAgDpE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,mBAAmB,CAAC;AAgDpE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAkC5F"}
|
|
@@ -105,7 +105,10 @@ export function storageWriter(storage, repo, ws) {
|
|
|
105
105
|
const sources = hash === null ? [{ elements: ordered(changes.set) }] : await folderSources(storage, repo, hash, changes);
|
|
106
106
|
const stored = await storeCollection(storage, repo, FilesFolderType, sources);
|
|
107
107
|
// The store knows the new folder as the manifest it is, so e3's door
|
|
108
|
-
// takes it in as the input's value, checked and versioned, reading
|
|
108
|
+
// takes it in as the input's value, checked and versioned, reading
|
|
109
|
+
// nothing. A memo of the manifest to itself, until e3-core has a door
|
|
110
|
+
// for a value the store holds (east-workspace#1314); gc drops it once
|
|
111
|
+
// the manifest is collected
|
|
109
112
|
await storage.refs.adoptionWrite(repo, stored, stored);
|
|
110
113
|
const adopted = await datasetAdoptKnown(storage, repo, ws, inputPath(input), stored);
|
|
111
114
|
if (adopted === null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GAGpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAwB,MAAM,yBAAyB,CAAC;AAGjH,0CAA0C;AAC1C,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,YAAY,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;AAEtD,iCAAiC;AACjC,SAAS,OAAO,CAAC,OAAgD;IAC/D,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAwB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,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