@elaraai/e3-cloud-files 1.0.94 → 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 +221 -28
- package/dist/src/authoring.d.ts +90 -22
- package/dist/src/authoring.d.ts.map +1 -1
- package/dist/src/authoring.js +122 -46
- package/dist/src/authoring.js.map +1 -1
- package/dist/src/check/index.d.ts +3 -4
- package/dist/src/check/index.d.ts.map +1 -1
- package/dist/src/check/index.js +3 -4
- package/dist/src/check/index.js.map +1 -1
- package/dist/src/check.d.ts +44 -9
- package/dist/src/check.d.ts.map +1 -1
- package/dist/src/check.js +130 -53
- package/dist/src/check.js.map +1 -1
- package/dist/src/compat.d.ts +384 -0
- package/dist/src/compat.d.ts.map +1 -0
- package/dist/src/compat.js +258 -0
- package/dist/src/compat.js.map +1 -0
- package/dist/src/index.d.ts +14 -9
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/s3/index.d.ts.map +1 -1
- package/dist/src/s3/index.js +34 -12
- package/dist/src/s3/index.js.map +1 -1
- package/dist/src/storage/index.d.ts +84 -3
- package/dist/src/storage/index.d.ts.map +1 -1
- package/dist/src/storage/index.js +387 -13
- package/dist/src/storage/index.js.map +1 -1
- package/dist/src/sync/engine.d.ts +288 -49
- package/dist/src/sync/engine.d.ts.map +1 -1
- package/dist/src/sync/engine.js +605 -110
- package/dist/src/sync/engine.js.map +1 -1
- package/dist/src/sync/index.d.ts +3 -2
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/index.js +3 -2
- package/dist/src/sync/index.js.map +1 -1
- package/dist/src/sync/memory.d.ts +67 -12
- package/dist/src/sync/memory.d.ts.map +1 -1
- package/dist/src/sync/memory.js +248 -18
- package/dist/src/sync/memory.js.map +1 -1
- package/dist/src/sync/push.d.ts +56 -0
- package/dist/src/sync/push.d.ts.map +1 -0
- package/dist/src/sync/push.js +205 -0
- package/dist/src/sync/push.js.map +1 -0
- 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 +142 -0
- package/dist/test/typed.examples.d.ts.map +1 -0
- package/dist/test/typed.examples.js +125 -0
- package/dist/test/typed.examples.js.map +1 -0
- package/package.json +10 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../../src/compat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAE5G,KAAK,QAAQ,EAAsB,KAAK,WAAW,EACpD,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAqB,KAAK,UAAU,EACzH,KAAK,YAAY,EAAE,KAAK,eAAe,EACxC,MAAM,yBAAyB,CAAC;AAEjC,gEAAgE;AAChE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;EAK3B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,yDAAyD;AACzD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;EAI7B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;EAG9B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,2DAA2D;AAC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
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `@elaraai/e3-cloud-files/compat`: Files' stored values as the first
|
|
7
|
+
* version wrote them, and their lift into the current types.
|
|
8
|
+
*
|
|
9
|
+
* The first version mapped a source's files to inputs alone: a mapping was
|
|
10
|
+
* `{input, source, shape}`, a `file` or `latest` shape named no type, a
|
|
11
|
+
* refusal's reason was a string, a sync was asked for `inputs`, and a ledger
|
|
12
|
+
* entry held an ETag and a size. The current types map to a target (an
|
|
13
|
+
* input, a record or a mutation), may name a type, tell refusals apart, ask
|
|
14
|
+
* for `targets` and `reset`, and remember a file's hash and the commit a
|
|
15
|
+
* seed or feed made.
|
|
16
|
+
*
|
|
17
|
+
* A store reads a stored value through {@link readFilesManifest},
|
|
18
|
+
* {@link readFilesSyncReport}, {@link readFilesLedger},
|
|
19
|
+
* {@link readFilesSyncJob} or {@link readFilesHistoryManifest}: each reads
|
|
20
|
+
* the root type the bytes' beast2 header declares, decodes a current value as
|
|
21
|
+
* it is, and decodes a first-version value with its own type and lifts it
|
|
22
|
+
* (`input` → `target: input(name)`, each `file`/`latest` shape `type: none`,
|
|
23
|
+
* a refusal's string `other(reason)`, the new fields none). A value is
|
|
24
|
+
* written at the current version on its next write. The lifts are pure, so
|
|
25
|
+
* the CLI lifts a local repository's state file through them too.
|
|
26
|
+
*
|
|
27
|
+
* The first version's types are kept here, and nowhere else, under their
|
|
28
|
+
* `V1` names.
|
|
29
|
+
*
|
|
30
|
+
* @packageDocumentation
|
|
31
|
+
*/
|
|
32
|
+
import { ArrayType, BooleanType, DateTimeType, DictType, IntegerType, OptionType, StringType, StructType, VariantType, decodeBeast2For, isTypeValueEqual, none, readBeast2Type, some, toEastTypeValue, variant, } from '@elaraai/east';
|
|
33
|
+
import { FilesLedgerType, FilesManifestType, FilesSyncJobType, FilesSyncReportType, FilesSyncStateType, } from '@elaraai/e3-cloud-types';
|
|
34
|
+
/** A `file` or `latest` shape of the first version: no type. */
|
|
35
|
+
export const FilesShapeTypeV1 = VariantType({
|
|
36
|
+
file: StructType({ key: StringType }),
|
|
37
|
+
latest: StructType({ prefix: StringType, include: OptionType(StringType) }),
|
|
38
|
+
folder: StructType({ prefix: StringType, include: OptionType(StringType) }),
|
|
39
|
+
listing: StructType({ prefix: StringType, include: OptionType(StringType) }),
|
|
40
|
+
});
|
|
41
|
+
/** A mapping of the first version: an input, by name. */
|
|
42
|
+
export const FilesMappingTypeV1 = StructType({
|
|
43
|
+
input: StringType,
|
|
44
|
+
source: StringType,
|
|
45
|
+
shape: FilesShapeTypeV1,
|
|
46
|
+
});
|
|
47
|
+
/** The declarations of the first version. */
|
|
48
|
+
export const FilesManifestTypeV1 = StructType({
|
|
49
|
+
sources: ArrayType(StringType),
|
|
50
|
+
mappings: ArrayType(FilesMappingTypeV1),
|
|
51
|
+
});
|
|
52
|
+
/** A refusal of the first version: its reason a string. */
|
|
53
|
+
export const FilesRefusalTypeV1 = StructType({ key: StringType, reason: StringType });
|
|
54
|
+
/** A mapping's report of the first version. */
|
|
55
|
+
export const FilesMappingReportTypeV1 = StructType({
|
|
56
|
+
input: StringType,
|
|
57
|
+
added: IntegerType,
|
|
58
|
+
changed: IntegerType,
|
|
59
|
+
removed: IntegerType,
|
|
60
|
+
unchanged: IntegerType,
|
|
61
|
+
refused: ArrayType(FilesRefusalTypeV1),
|
|
62
|
+
bytes: IntegerType,
|
|
63
|
+
updated: BooleanType,
|
|
64
|
+
});
|
|
65
|
+
/** A sync's report of the first version. */
|
|
66
|
+
export const FilesSyncReportTypeV1 = StructType({
|
|
67
|
+
started: DateTimeType,
|
|
68
|
+
finished: DateTimeType,
|
|
69
|
+
dryRun: BooleanType,
|
|
70
|
+
mappings: ArrayType(FilesMappingReportTypeV1),
|
|
71
|
+
});
|
|
72
|
+
/** A ledger of the first version: each file's ETag and size. */
|
|
73
|
+
export const FilesLedgerTypeV1 = StructType({
|
|
74
|
+
entries: DictType(StringType, StructType({ etag: StringType, size: IntegerType })),
|
|
75
|
+
value: OptionType(StringType),
|
|
76
|
+
under: OptionType(StringType),
|
|
77
|
+
});
|
|
78
|
+
/** A sync of the first version: asked for inputs. */
|
|
79
|
+
export const FilesSyncJobTypeV1 = StructType({
|
|
80
|
+
id: StringType,
|
|
81
|
+
workspace: StringType,
|
|
82
|
+
by: StringType,
|
|
83
|
+
dryRun: BooleanType,
|
|
84
|
+
inputs: OptionType(ArrayType(StringType)),
|
|
85
|
+
state: FilesSyncStateType,
|
|
86
|
+
startedAt: DateTimeType,
|
|
87
|
+
finishedAt: OptionType(DateTimeType),
|
|
88
|
+
report: OptionType(FilesSyncReportTypeV1),
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* A first-version shape as the current one: a `file` or `latest` names no type.
|
|
92
|
+
*
|
|
93
|
+
* @param shape - The shape
|
|
94
|
+
* @returns The current shape
|
|
95
|
+
*/
|
|
96
|
+
export function liftFilesShapeV1(shape) {
|
|
97
|
+
switch (shape.type) {
|
|
98
|
+
case 'file': return variant('file', { key: shape.value.key, type: none });
|
|
99
|
+
case 'latest': return variant('latest', { prefix: shape.value.prefix, include: shape.value.include, type: none });
|
|
100
|
+
case 'folder': return variant('folder', shape.value);
|
|
101
|
+
case 'listing': return variant('listing', shape.value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A first-version mapping as the current one: its input, as a target.
|
|
106
|
+
*
|
|
107
|
+
* @param mapping - The mapping
|
|
108
|
+
* @returns The current mapping
|
|
109
|
+
*/
|
|
110
|
+
export function liftFilesMappingV1(mapping) {
|
|
111
|
+
return { target: variant('input', mapping.input), source: mapping.source, shape: liftFilesShapeV1(mapping.shape) };
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* First-version declarations as the current ones.
|
|
115
|
+
*
|
|
116
|
+
* @param manifest - The declarations
|
|
117
|
+
* @returns The current declarations
|
|
118
|
+
*/
|
|
119
|
+
export function liftFilesManifestV1(manifest) {
|
|
120
|
+
return { sources: [...manifest.sources], mappings: manifest.mappings.map(liftFilesMappingV1) };
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A first-version mapping's report as the current one: its reasons kept as
|
|
124
|
+
* `other`, and nothing taken, committed, kept or waiting.
|
|
125
|
+
*
|
|
126
|
+
* @param report - The report
|
|
127
|
+
* @returns The current report
|
|
128
|
+
*/
|
|
129
|
+
export function liftFilesMappingReportV1(report) {
|
|
130
|
+
const refused = report.refused.map((r) => ({ key: r.key, reason: variant('other', r.reason) }));
|
|
131
|
+
return {
|
|
132
|
+
target: variant('input', report.input),
|
|
133
|
+
added: report.added,
|
|
134
|
+
changed: report.changed,
|
|
135
|
+
removed: report.removed,
|
|
136
|
+
unchanged: report.unchanged,
|
|
137
|
+
refused,
|
|
138
|
+
bytes: report.bytes,
|
|
139
|
+
updated: report.updated,
|
|
140
|
+
taken: none,
|
|
141
|
+
commit: none,
|
|
142
|
+
kept: none,
|
|
143
|
+
waiting: none,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* A first-version sync's report as the current one.
|
|
148
|
+
*
|
|
149
|
+
* @param report - The report
|
|
150
|
+
* @returns The current report
|
|
151
|
+
*/
|
|
152
|
+
export function liftFilesSyncReportV1(report) {
|
|
153
|
+
return { started: report.started, finished: report.finished, dryRun: report.dryRun, mappings: report.mappings.map(liftFilesMappingReportV1) };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* A first-version ledger as the current one: no hashes, no commit.
|
|
157
|
+
*
|
|
158
|
+
* @param ledger - The ledger
|
|
159
|
+
* @returns The current ledger
|
|
160
|
+
*/
|
|
161
|
+
export function liftFilesLedgerV1(ledger) {
|
|
162
|
+
return {
|
|
163
|
+
entries: new Map([...ledger.entries].map(([key, e]) => [key, { etag: e.etag, size: e.size, sha256: none, modified: none }])),
|
|
164
|
+
value: ledger.value,
|
|
165
|
+
under: ledger.under,
|
|
166
|
+
commit: none,
|
|
167
|
+
tried: none,
|
|
168
|
+
taking: none,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* A first-version sync as the current one: its inputs, as targets.
|
|
173
|
+
*
|
|
174
|
+
* @param job - The sync
|
|
175
|
+
* @returns The current sync
|
|
176
|
+
*/
|
|
177
|
+
export function liftFilesSyncJobV1(job) {
|
|
178
|
+
return {
|
|
179
|
+
id: job.id,
|
|
180
|
+
workspace: job.workspace,
|
|
181
|
+
by: job.by,
|
|
182
|
+
dryRun: job.dryRun,
|
|
183
|
+
targets: job.inputs.type === 'some' ? some(job.inputs.value.map((input) => variant('input', input))) : none,
|
|
184
|
+
reset: [],
|
|
185
|
+
state: job.state,
|
|
186
|
+
startedAt: job.startedAt,
|
|
187
|
+
finishedAt: job.finishedAt,
|
|
188
|
+
report: job.report.type === 'some' ? some(liftFilesSyncReportV1(job.report.value)) : none,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* A reader of a stored value at any version: the bytes' header type decides
|
|
193
|
+
* which type decodes them, and an older value is lifted.
|
|
194
|
+
*
|
|
195
|
+
* @param what - What the value is, for the error
|
|
196
|
+
* @param current - The current type
|
|
197
|
+
* @param older - Each older version, its type and lift
|
|
198
|
+
* @returns The reader
|
|
199
|
+
*/
|
|
200
|
+
function versioned(what, current, older) {
|
|
201
|
+
const decodeCurrent = decodeBeast2For(current);
|
|
202
|
+
const currentType = toEastTypeValue(current);
|
|
203
|
+
const olders = older.map((o) => ({ ...o, typeValue: toEastTypeValue(o.type), decode: decodeBeast2For(o.type) }));
|
|
204
|
+
return (bytes) => {
|
|
205
|
+
let header;
|
|
206
|
+
try {
|
|
207
|
+
header = readBeast2Type(bytes);
|
|
208
|
+
}
|
|
209
|
+
catch (err) {
|
|
210
|
+
throw new Error(`The stored ${what} is not a beast2 value: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
211
|
+
}
|
|
212
|
+
if (isTypeValueEqual(header, currentType))
|
|
213
|
+
return decodeCurrent(bytes);
|
|
214
|
+
for (const o of olders) {
|
|
215
|
+
if (isTypeValueEqual(header, o.typeValue))
|
|
216
|
+
return o.lift(o.decode(bytes));
|
|
217
|
+
}
|
|
218
|
+
throw new Error(`The stored ${what} is of a type this version does not read`);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
/** Reads stored declarations, at any version, as the current ones. */
|
|
222
|
+
export const readFilesManifest = versioned('Files declarations', FilesManifestType, [
|
|
223
|
+
{ type: FilesManifestTypeV1, lift: liftFilesManifestV1 },
|
|
224
|
+
]);
|
|
225
|
+
/** Reads a stored sync's report, at any version, as the current one. */
|
|
226
|
+
export const readFilesSyncReport = versioned('Files sync report', FilesSyncReportType, [
|
|
227
|
+
{ type: FilesSyncReportTypeV1, lift: liftFilesSyncReportV1 },
|
|
228
|
+
]);
|
|
229
|
+
/** Reads a stored ledger, at any version, as the current one. */
|
|
230
|
+
export const readFilesLedger = versioned('Files ledger', FilesLedgerType, [
|
|
231
|
+
{ type: FilesLedgerTypeV1, lift: liftFilesLedgerV1 },
|
|
232
|
+
]);
|
|
233
|
+
/** Reads a stored sync, at any version, as the current one. */
|
|
234
|
+
export const readFilesSyncJob = versioned('Files sync', FilesSyncJobType, [
|
|
235
|
+
{ type: FilesSyncJobTypeV1, lift: liftFilesSyncJobV1 },
|
|
236
|
+
]);
|
|
237
|
+
/** The declarations a workspace's history entry left: none, or the declarations. */
|
|
238
|
+
const HistoryManifestType = OptionType(FilesManifestType);
|
|
239
|
+
const HistoryManifestTypeV1 = OptionType(FilesManifestTypeV1);
|
|
240
|
+
/** Reads the declarations a history entry left (`Option<FilesManifest>`), at any version, as the current ones. */
|
|
241
|
+
export const readFilesHistoryManifest = versioned('Files declarations of a history entry', HistoryManifestType, [
|
|
242
|
+
{
|
|
243
|
+
type: HistoryManifestTypeV1,
|
|
244
|
+
lift: ((value) => (value.type === 'some' ? some(liftFilesManifestV1(value.value)) : none)),
|
|
245
|
+
},
|
|
246
|
+
]);
|
|
247
|
+
/** The stored versions of a workspace's declarations (`FILES/` `manifest`). */
|
|
248
|
+
export const FILES_MANIFEST_VERSIONS = { current: FilesManifestType, older: [{ type: FilesManifestTypeV1, lift: liftFilesManifestV1 }] };
|
|
249
|
+
/** The stored versions of a sync's report (`FILES/` `lastSync`, `FILESJOB/` `report`). */
|
|
250
|
+
export const FILES_REPORT_VERSIONS = { current: FilesSyncReportType, older: [{ type: FilesSyncReportTypeV1, lift: liftFilesSyncReportV1 }] };
|
|
251
|
+
/** The stored versions of a sync as filed (`FILESJOB/` `value`). */
|
|
252
|
+
export const FILES_JOB_VERSIONS = { current: FilesSyncJobType, older: [{ type: FilesSyncJobTypeV1, lift: liftFilesSyncJobV1 }] };
|
|
253
|
+
/** The stored versions of the declarations a history entry left (`RELEASE/` `files`). */
|
|
254
|
+
export const FILES_HISTORY_VERSIONS = {
|
|
255
|
+
current: HistoryManifestType,
|
|
256
|
+
older: [{ type: HistoryManifestTypeV1, lift: ((value) => (value.type === 'some' ? some(liftFilesManifestV1(value.value)) : none)) }],
|
|
257
|
+
};
|
|
258
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.js","sourceRoot":"","sources":["../../src/compat.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAC5G,eAAe,EAAE,gBAAgB,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,GAExF,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,GAG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AE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAC,KAAgD,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAA8B,EAAE,CAAC;CAC7M,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,24 +4,29 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* `@elaraai/e3-cloud-files`: a solution's inputs that come from files in a
|
|
7
|
-
* bucket.
|
|
7
|
+
* bucket, and its records seeded or fed from them.
|
|
8
8
|
*
|
|
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
|
-
* inputs its files fill, each an ordinary `e3.input
|
|
11
|
+
* inputs its files fill, each an ordinary `e3.input`, a `file` or `latest`
|
|
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.
|
|
12
16
|
* - `Files.manifest(sources)`: the declarations `e3-cloud files deploy`
|
|
13
17
|
* deploys beside the package.
|
|
14
|
-
* - `checkFiles`, `checkBindings`, `
|
|
15
|
-
* and a bind run.
|
|
18
|
+
* - `checkFiles`, `checkBindings`, `readPackageSurface`: the checks a deploy
|
|
19
|
+
* and a bind run, against the package's inputs, records and mutations.
|
|
16
20
|
*
|
|
17
|
-
* A file arrives as it is, a `Blob`; the solution decodes it in
|
|
18
|
-
*
|
|
21
|
+
* A file with no type arrives as it is, a `Blob`; the solution decodes it in
|
|
22
|
+
* East. A typed file arrives as the beast2 value it holds. The sync is
|
|
23
|
+
* `@elaraai/e3-cloud-files/sync`; the East types are
|
|
19
24
|
* `@elaraai/e3-cloud-types`'s `Files*`.
|
|
20
25
|
*
|
|
21
26
|
* @packageDocumentation
|
|
22
27
|
*/
|
|
23
|
-
export { Files, FilesSource, FilesDeclarationError, type FilesInput, type FilesSelection } from './authoring.js';
|
|
24
|
-
export { checkFiles, checkBindings, readPackageInputs, shapeType, type PackageInput, type ObjectReader, type BindingPolicy, } from './check.js';
|
|
28
|
+
export { Files, FilesSource, FilesDeclarationError, type FilesInput, type FilesMutation, type FilesRecordParts, type FilesSelection, type FilesKeySpec, type FilesTypedKeySpec, type FilesTypedSelection, } from './authoring.js';
|
|
29
|
+
export { checkFiles, checkBindings, readPackageInputs, readPackageSurface, shapeType, type PackageInput, type PackageRecord, type PackageMutation, type PackageSurface, type ObjectReader, type BindingPolicy, } from './check.js';
|
|
25
30
|
export { globMatcher, parseBucketUrl, keyProblem, prefixProblem, includeProblem, type BucketLocation } from './paths.js';
|
|
26
|
-
export { FilesManifestType, FilesMappingType, FilesShapeType, FilesBindingType, FilesSyncReportType, FilesMappingReportType, FilesStatusType, FilesProblemType, FilesListingRowType, FilesFileType, FilesFolderType, FilesListingType, FILES_FILE_MAX_BYTES, FILES_FOLDER_ENTRY_MAX_BYTES, filesProblemText, type FilesManifest, type FilesMapping, type FilesShape, type FilesBinding, type FilesSyncReport, type FilesMappingReport, type FilesStatus, type FilesProblem, type FilesListingRow, } from '@elaraai/e3-cloud-types';
|
|
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';
|
|
27
32
|
//# sourceMappingURL=index.d.ts.map
|
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
|
@@ -4,24 +4,29 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* `@elaraai/e3-cloud-files`: a solution's inputs that come from files in a
|
|
7
|
-
* bucket.
|
|
7
|
+
* bucket, and its records seeded or fed from them.
|
|
8
8
|
*
|
|
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
|
-
* inputs its files fill, each an ordinary `e3.input
|
|
11
|
+
* inputs its files fill, each an ordinary `e3.input`, a `file` or `latest`
|
|
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.
|
|
12
16
|
* - `Files.manifest(sources)`: the declarations `e3-cloud files deploy`
|
|
13
17
|
* deploys beside the package.
|
|
14
|
-
* - `checkFiles`, `checkBindings`, `
|
|
15
|
-
* and a bind run.
|
|
18
|
+
* - `checkFiles`, `checkBindings`, `readPackageSurface`: the checks a deploy
|
|
19
|
+
* and a bind run, against the package's inputs, records and mutations.
|
|
16
20
|
*
|
|
17
|
-
* A file arrives as it is, a `Blob`; the solution decodes it in
|
|
18
|
-
*
|
|
21
|
+
* A file with no type arrives as it is, a `Blob`; the solution decodes it in
|
|
22
|
+
* East. A typed file arrives as the beast2 value it holds. The sync is
|
|
23
|
+
* `@elaraai/e3-cloud-files/sync`; the East types are
|
|
19
24
|
* `@elaraai/e3-cloud-types`'s `Files*`.
|
|
20
25
|
*
|
|
21
26
|
* @packageDocumentation
|
|
22
27
|
*/
|
|
23
|
-
export { Files, FilesSource, FilesDeclarationError } from './authoring.js';
|
|
24
|
-
export { checkFiles, checkBindings, readPackageInputs, shapeType, } from './check.js';
|
|
28
|
+
export { Files, FilesSource, FilesDeclarationError, } from './authoring.js';
|
|
29
|
+
export { checkFiles, checkBindings, readPackageInputs, readPackageSurface, shapeType, } from './check.js';
|
|
25
30
|
export { globMatcher, parseBucketUrl, keyProblem, prefixProblem, includeProblem } from './paths.js';
|
|
26
|
-
export { FilesManifestType, FilesMappingType, FilesShapeType, FilesBindingType, FilesSyncReportType, FilesMappingReportType, FilesStatusType, FilesProblemType, FilesListingRowType, FilesFileType, FilesFolderType, FilesListingType, FILES_FILE_MAX_BYTES, FILES_FOLDER_ENTRY_MAX_BYTES, filesProblemText, } from '@elaraai/e3-cloud-types';
|
|
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, } from '@elaraai/e3-cloud-types';
|
|
27
32
|
//# sourceMappingURL=index.js.map
|
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"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAqFjF"}
|
package/dist/src/s3/index.js
CHANGED
|
@@ -63,6 +63,22 @@ function unreadable(err) {
|
|
|
63
63
|
*/
|
|
64
64
|
export function s3FilesReader(client, location) {
|
|
65
65
|
const absolute = (key) => `${location.prefix}${key}`;
|
|
66
|
+
/** A file, or a range of it, at the version its listing gave; a refusal of the file's own is unreadable. */
|
|
67
|
+
const get = async (file, range) => {
|
|
68
|
+
let object;
|
|
69
|
+
try {
|
|
70
|
+
object = await client.send(new GetObjectCommand({ Bucket: location.bucket, Key: absolute(file.key), IfMatch: `"${file.etag}"`, ...(range !== undefined && { Range: range }) }));
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
const reason = unreadable(err);
|
|
74
|
+
if (reason !== null)
|
|
75
|
+
throw new FilesUnreadableError(file.key, reason);
|
|
76
|
+
throw err;
|
|
77
|
+
}
|
|
78
|
+
if (object.Body === undefined)
|
|
79
|
+
throw new Error(`s3://${location.bucket}/${absolute(file.key)} answered no bytes`);
|
|
80
|
+
return object;
|
|
81
|
+
};
|
|
66
82
|
return {
|
|
67
83
|
async *list(prefix, options = {}) {
|
|
68
84
|
let token;
|
|
@@ -114,18 +130,7 @@ export function s3FilesReader(client, location) {
|
|
|
114
130
|
return { key, size: object.Size ?? 0, modified: object.LastModified ?? new Date(0), etag: bare(object.ETag) };
|
|
115
131
|
},
|
|
116
132
|
async read(file) {
|
|
117
|
-
|
|
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
|
-
}
|
|
127
|
-
if (object.Body === undefined)
|
|
128
|
-
throw new Error(`s3://${location.bucket}/${absolute(file.key)} answered no bytes`);
|
|
133
|
+
const object = await get(file);
|
|
129
134
|
if (object.ContentLength !== undefined && object.ContentLength !== file.size) {
|
|
130
135
|
// Never buffered: its size was never checked
|
|
131
136
|
object.Body.destroy?.();
|
|
@@ -133,6 +138,23 @@ export function s3FilesReader(client, location) {
|
|
|
133
138
|
}
|
|
134
139
|
return object.Body.transformToByteArray();
|
|
135
140
|
},
|
|
141
|
+
async readRange(file, start, end) {
|
|
142
|
+
if (end <= start)
|
|
143
|
+
return new Uint8Array(0);
|
|
144
|
+
// A range's end is inclusive to the bucket
|
|
145
|
+
const object = await get(file, `bytes=${start}-${end - 1}`);
|
|
146
|
+
return object.Body.transformToByteArray();
|
|
147
|
+
},
|
|
148
|
+
async open(file, options = {}) {
|
|
149
|
+
const start = options.start ?? 0;
|
|
150
|
+
const object = await get(file, start > 0 ? `bytes=${start}-` : undefined);
|
|
151
|
+
if (object.ContentLength !== undefined && object.ContentLength !== file.size - start) {
|
|
152
|
+
object.Body.destroy?.();
|
|
153
|
+
throw new FilesUnreadableError(file.key, `changed since it was listed (${object.ContentLength + start} bytes, not the ${file.size} listed): the next sync takes it`);
|
|
154
|
+
}
|
|
155
|
+
// A bucket's body is a stream of chunks
|
|
156
|
+
return object.Body;
|
|
157
|
+
},
|
|
136
158
|
};
|
|
137
159
|
}
|
|
138
160
|
//# sourceMappingURL=index.js.map
|
package/dist/src/s3/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../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CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC1E,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,IAAI,MAAM,CAAC,aAAa,KAAK,IAAI,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;gBACpF,MAAM,CAAC,IAAiC,CAAC,OAAO,EAAE,EAAE,CAAC;gBACtD,MAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,gCAAgC,MAAM,CAAC,aAAa,GAAG,KAAK,mBAAmB,IAAI,CAAC,IAAI,kCAAkC,CAAC,CAAC;YACvK,CAAC;YACD,wCAAwC;YACxC,OAAO,MAAM,CAAC,IAA4C,CAAC;QAC7D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -2,15 +2,96 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
-
import { type StorageBackend } from '@elaraai/e3-core';
|
|
6
|
-
import type
|
|
5
|
+
import { type StorageBackend, type TaskRunner } from '@elaraai/e3-core';
|
|
6
|
+
import { type FilesRefusalReason } from '@elaraai/e3-cloud-types';
|
|
7
|
+
import { type FilesWriter } from '../sync/engine.js';
|
|
8
|
+
/** What the writer is given beside the store. */
|
|
9
|
+
export interface StorageWriterOptions {
|
|
10
|
+
/** The runner that takes a typed collection in by pieces, and runs a fed mutation; without one, a typed file that is a collection the store does not know, or a feed, is refused */
|
|
11
|
+
readonly runner?: TaskRunner;
|
|
12
|
+
/** Where a typed file's bytes are streamed to before e3 takes them in: a directory of the caller's (default the system's temporary directory) */
|
|
13
|
+
readonly scratchDir?: string;
|
|
14
|
+
/** Who a feed's commit records as its actor (default `files`) */
|
|
15
|
+
readonly actor?: string;
|
|
16
|
+
/** How long a fed mutation may run, in ms (default e3's) */
|
|
17
|
+
readonly feedBudgetMs?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A refusal e3's door answered, as the sync reports it; null for an error the
|
|
21
|
+
* door did not refuse.
|
|
22
|
+
*
|
|
23
|
+
* @param err - What the door threw
|
|
24
|
+
* @param type - The mapping's type
|
|
25
|
+
* @returns The refusal, or null
|
|
26
|
+
*/
|
|
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;
|
|
7
38
|
/**
|
|
8
39
|
* The sync's writer over an e3 store, for one workspace.
|
|
9
40
|
*
|
|
10
41
|
* @param storage - The store: a local repository's (`LocalStorage`) or the platform's
|
|
11
42
|
* @param repo - The repository: a local repository's path, or the platform's repository name
|
|
12
43
|
* @param ws - The workspace
|
|
44
|
+
* @param options - The runner, the scratch directory and the actor
|
|
45
|
+
* @returns The writer
|
|
46
|
+
*/
|
|
47
|
+
export declare function storageWriter(storage: StorageBackend, repo: string, ws: string, options?: StorageWriterOptions): FilesWriter;
|
|
48
|
+
/**
|
|
49
|
+
* Stages a typed file's bytes in the object store as the object their
|
|
50
|
+
* SHA-256 names, hashing them as they stream: the platform's typed intake,
|
|
51
|
+
* never on a disk. A stage the signal stops keeps nothing: the next round
|
|
52
|
+
* starts the file again.
|
|
53
|
+
*/
|
|
54
|
+
export interface FilesStaging {
|
|
55
|
+
/**
|
|
56
|
+
* @param repo - The repository, as the storage names it
|
|
57
|
+
* @param open - The file's bytes, from a byte on: opened at 0, or where a stage left off
|
|
58
|
+
* @param size - The file's size, as its listing gave it
|
|
59
|
+
* @param options - The round's signal, and where an earlier stage of the same file stood (its `progress`)
|
|
60
|
+
* @returns The bytes' SHA-256, the object placed; or `aborted` when the
|
|
61
|
+
* signal stopped it, with where it stood for the next round to resume
|
|
62
|
+
* (null when nothing was kept)
|
|
63
|
+
*/
|
|
64
|
+
stage(repo: string, open: (start: number) => Promise<AsyncIterable<Uint8Array>>, size: number, options: {
|
|
65
|
+
readonly signal?: AbortSignal;
|
|
66
|
+
readonly resume?: string;
|
|
67
|
+
}): Promise<{
|
|
68
|
+
sha256: string;
|
|
69
|
+
} | {
|
|
70
|
+
aborted: true;
|
|
71
|
+
progress: string | null;
|
|
72
|
+
}>;
|
|
73
|
+
}
|
|
74
|
+
/** What the cloud's writer is given beside the store. */
|
|
75
|
+
export interface CloudWriterOptions extends Omit<StorageWriterOptions, 'scratchDir'> {
|
|
76
|
+
/** The round's runner: takes a typed collection in by pieces, runs a fed mutation */
|
|
77
|
+
readonly runner: TaskRunner;
|
|
78
|
+
/** Where a typed file's bytes are staged: the platform's object store */
|
|
79
|
+
readonly staging: FilesStaging;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The sync's writer for a deployed workspace: the store's writer, with a
|
|
83
|
+
* typed file taken in through the platform's staging and e3's door for a
|
|
84
|
+
* delivery the store holds (`datasetAdoptObject`), so no byte of it passes
|
|
85
|
+
* through a disk (D7), and an intake the round's deadline stops resumes in
|
|
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).
|
|
89
|
+
*
|
|
90
|
+
* @param storage - The platform's storage
|
|
91
|
+
* @param repo - The repository, as the storage names it
|
|
92
|
+
* @param ws - The workspace
|
|
93
|
+
* @param options - The runner, the staging, the actor
|
|
13
94
|
* @returns The writer
|
|
14
95
|
*/
|
|
15
|
-
export declare function
|
|
96
|
+
export declare function cloudWriter(storage: StorageBackend, repo: string, ws: string, options: CloudWriterOptions): FilesWriter;
|
|
16
97
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
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;IACjE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CASnE;AAID;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAkGD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,WAAW,CAoIhI;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,aAA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