@elaraai/e3-types 1.0.75 → 1.0.77
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/dist/src/api.d.ts +25 -0
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/api.js +18 -0
- package/dist/src/api.js.map +1 -1
- package/dist/src/dataset-type.d.ts +71 -0
- package/dist/src/dataset-type.d.ts.map +1 -0
- package/dist/src/dataset-type.js +101 -0
- package/dist/src/dataset-type.js.map +1 -0
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/package.d.ts +33 -3
- package/dist/src/package.d.ts.map +1 -1
- package/dist/src/package.js +47 -8
- package/dist/src/package.js.map +1 -1
- package/dist/src/task.d.ts +24 -2
- package/dist/src/task.d.ts.map +1 -1
- package/dist/src/task.js +49 -2
- package/dist/src/task.js.map +1 -1
- package/dist/src/transfer.d.ts +70 -3
- package/dist/src/transfer.d.ts.map +1 -1
- package/dist/src/transfer.js +76 -3
- package/dist/src/transfer.js.map +1 -1
- package/dist/src/transfer.spec.d.ts +6 -0
- package/dist/src/transfer.spec.d.ts.map +1 -0
- package/dist/src/transfer.spec.js +75 -0
- package/dist/src/transfer.spec.js.map +1 -0
- package/package.json +2 -2
- package/src/api.ts +18 -0
- package/src/dataset-type.ts +134 -0
- package/src/index.ts +16 -0
- package/src/package.ts +50 -8
- package/src/task.ts +49 -3
- package/src/transfer.spec.ts +98 -0
- package/src/transfer.ts +84 -3
package/dist/src/package.js
CHANGED
|
@@ -60,6 +60,24 @@ export const PackageDatasetsType = PackageDataType;
|
|
|
60
60
|
* };
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
+
/**
|
|
64
|
+
* Where a dataset's initial value comes from, when it is not in the package.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* A package carries the DESCRIPTOR, never the bytes: `e3.input('table', T,
|
|
68
|
+
* variant('file', './TABLE.beast2'))` puts `{ file: { path } }` here and leaves
|
|
69
|
+
* the ref `unassigned`, and deploy resolves it — adopting the file into the
|
|
70
|
+
* object store by hash, so a new delivery under the same path is a new hash
|
|
71
|
+
* whose consumers re-run. An inline `variant('value', v)` needs no descriptor:
|
|
72
|
+
* its bytes are an object in the bundle like any other.
|
|
73
|
+
*
|
|
74
|
+
* A variant so that further source kinds can be appended later without a wire
|
|
75
|
+
* break; `file` is the only one today.
|
|
76
|
+
*/
|
|
77
|
+
export const DatasetSourceWireType = VariantType({
|
|
78
|
+
/** A path on the machine that DEPLOYS the package, resolved at deploy. */
|
|
79
|
+
file: StructType({ path: StringType }),
|
|
80
|
+
});
|
|
63
81
|
export const PackageObjectType = StructType({
|
|
64
82
|
/** Tasks defined in this package: name -> task object hash */
|
|
65
83
|
tasks: DictType(StringType, StringType),
|
|
@@ -71,6 +89,20 @@ export const PackageObjectType = StructType({
|
|
|
71
89
|
* BEAST2 encodes struct fields positionally in declaration order, so new
|
|
72
90
|
* fields MUST be appended LAST — never inserted between existing fields. */
|
|
73
91
|
records: DictType(StringType, StringType),
|
|
92
|
+
/** Unresolved dataset sources: refPath (e.g. "inputs/table") -> descriptor.
|
|
93
|
+
* Appended LAST, per the positional rule above. */
|
|
94
|
+
sources: DictType(StringType, DatasetSourceWireType),
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* The pre-`sources` package object wire shape (tasks, data, functions,
|
|
98
|
+
* records), kept only so {@link decodePackageObject} can read packages exported
|
|
99
|
+
* before path-initialised inputs existed.
|
|
100
|
+
*/
|
|
101
|
+
const RecordsEraPackageObjectType = StructType({
|
|
102
|
+
tasks: DictType(StringType, StringType),
|
|
103
|
+
data: PackageDataType,
|
|
104
|
+
functions: DictType(StringType, StringType),
|
|
105
|
+
records: DictType(StringType, StringType),
|
|
74
106
|
});
|
|
75
107
|
/**
|
|
76
108
|
* The pre-`records` package object wire shape (tasks, data, functions), kept
|
|
@@ -92,16 +124,17 @@ const LegacyPackageObjectType = StructType({
|
|
|
92
124
|
data: PackageDataType,
|
|
93
125
|
});
|
|
94
126
|
const decodeCurrent = decodeBeast2For(PackageObjectType);
|
|
127
|
+
const decodeRecordsEra = decodeBeast2For(RecordsEraPackageObjectType);
|
|
95
128
|
const decodeFunctionsEra = decodeBeast2For(FunctionsEraPackageObjectType);
|
|
96
129
|
const decodeLegacy = decodeBeast2For(LegacyPackageObjectType);
|
|
97
130
|
/**
|
|
98
|
-
* Decode a `PackageObject` from BEAST2 bytes, tolerating the
|
|
131
|
+
* Decode a `PackageObject` from BEAST2 bytes, tolerating the older wire
|
|
99
132
|
* formats (dual-decode migration).
|
|
100
133
|
*
|
|
101
134
|
* Every package-read path — local AND cloud — must use this instead of
|
|
102
135
|
* `decodeBeast2For(PackageObjectType)` directly, so packages exported before
|
|
103
|
-
* the `records`/`functions` fields existed keep decoding. Older
|
|
104
|
-
* with the missing maps defaulted to empty.
|
|
136
|
+
* the `sources`/`records`/`functions` fields existed keep decoding. Older
|
|
137
|
+
* bytes decode with the missing maps defaulted to empty.
|
|
105
138
|
*/
|
|
106
139
|
export function decodePackageObject(data) {
|
|
107
140
|
try {
|
|
@@ -109,16 +142,22 @@ export function decodePackageObject(data) {
|
|
|
109
142
|
}
|
|
110
143
|
catch (err) {
|
|
111
144
|
try {
|
|
112
|
-
const
|
|
113
|
-
return {
|
|
145
|
+
const recEra = decodeRecordsEra(data);
|
|
146
|
+
return { ...recEra, sources: new Map() };
|
|
114
147
|
}
|
|
115
148
|
catch {
|
|
116
149
|
try {
|
|
117
|
-
const
|
|
118
|
-
return { tasks:
|
|
150
|
+
const fnEra = decodeFunctionsEra(data);
|
|
151
|
+
return { tasks: fnEra.tasks, data: fnEra.data, functions: fnEra.functions, records: new Map(), sources: new Map() };
|
|
119
152
|
}
|
|
120
153
|
catch {
|
|
121
|
-
|
|
154
|
+
try {
|
|
155
|
+
const legacy = decodeLegacy(data);
|
|
156
|
+
return { tasks: legacy.tasks, data: legacy.data, functions: new Map(), records: new Map(), sources: new Map() };
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
throw err; // no known shape — surface the current-format error
|
|
160
|
+
}
|
|
122
161
|
}
|
|
123
162
|
}
|
|
124
163
|
}
|
package/dist/src/package.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/package.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAe,eAAe,EAAE,MAAM,eAAe,CAAC;AACnI,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;IACxC,gEAAgE;IAChE,SAAS,EAAE,aAAa;IACxB,uEAAuE;IACvE,IAAI,EAAE,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;CAC3C,CAAC,CAAC;AAKH,gCAAgC;AAChC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;AAMnD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IAC1C,8DAA8D;IAC9D,KAAK,EAAE,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IACvC,wCAAwC;IACxC,IAAI,EAAE,eAAe;IACrB,sEAAsE;IACtE,SAAS,EAAE,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAC3C;;iFAE6E;IAC7E,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/package.ts"],"names":[],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AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC;IACnD,OAAO,EAAE,QAAQ;IACjB,WAAW,EAAE,QAAQ;IACrB,SAAS,EAAE,UAAU,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;CACzD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;IACjD,UAAU,EAAE,yBAAyB;IACrC,SAAS,EAAE,uBAAuB;IAClC,MAAM,EAAE,UAAU,CAAC;QACjB,OAAO,EAAE,UAAU;KACpB,CAAC;CACH,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC;IACnD,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,UAAU,CAAC,EAAE,gBAAgB,EAAE,WAAW,EAAE,CAAC;IACxD,SAAS,EAAE,QAAQ;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,uBAAuB,GAAG,WAAW,CAAC;IACjD,UAAU,EAAE,yBAAyB;IACrC,SAAS,EAAE,uBAAuB;IAClC,MAAM,EAAE,UAAU,CAAC;QACjB,OAAO,EAAE,UAAU;KACpB,CAAC;CACH,CAAC,CAAC"}
|
package/dist/src/task.d.ts
CHANGED
|
@@ -142,13 +142,35 @@ export declare const PartitionTaskMetadataType: StructType<{
|
|
|
142
142
|
readonly combine: OptionType<BlobType>;
|
|
143
143
|
/** Target carved-slice size in wire bytes — the only sizing knob. */
|
|
144
144
|
readonly targetPartitionBytes: IntegerType;
|
|
145
|
+
/**
|
|
146
|
+
* `encodeEastIR` bundle of the per-key merge `(Key, Value, Value) -> Value`
|
|
147
|
+
* for a Dict output; `none` otherwise.
|
|
148
|
+
*
|
|
149
|
+
* Its presence (or {@link mergeSets}) selects the SEGMENT-MERGE assembly:
|
|
150
|
+
* partials are walked by their segment fences in the orchestrator, disjoint
|
|
151
|
+
* segments are byte-copied exactly as a splice does, and only overlapping
|
|
152
|
+
* ones are decoded, merged and re-encoded. Appended LAST (BEAST2 encodes
|
|
153
|
+
* struct fields positionally) with a dual decoder — see
|
|
154
|
+
* {@link decodePartitionTaskMetadata}.
|
|
155
|
+
*/
|
|
156
|
+
readonly merge: OptionType<BlobType>;
|
|
157
|
+
/** Whether a Set output assembles by segment merge (union). The Set twin of
|
|
158
|
+
* {@link merge}, which needs no function. Appended LAST. */
|
|
159
|
+
readonly mergeSets: BooleanType;
|
|
145
160
|
}>;
|
|
146
161
|
export type PartitionTaskMetadataType = typeof PartitionTaskMetadataType;
|
|
147
162
|
export type PartitionTaskMetadata = ValueTypeOf<typeof PartitionTaskMetadataType>;
|
|
148
163
|
/** Encode a {@link PartitionTaskMetadataType} value for `TaskObject.metadata`. */
|
|
149
164
|
export declare const encodePartitionTaskMetadata: (value: PartitionTaskMetadata) => Uint8Array;
|
|
150
|
-
/**
|
|
151
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Decode a `TaskObject.metadata` blob of a {@link TASK_KIND_PARTITION} task,
|
|
167
|
+
* tolerating the pre-`merge` wire format (dual-decode migration).
|
|
168
|
+
*
|
|
169
|
+
* @param data - the metadata blob
|
|
170
|
+
* @returns the decoded metadata, with `merge`/`mergeSets` defaulted off for
|
|
171
|
+
* older bytes
|
|
172
|
+
*/
|
|
173
|
+
export declare function decodePartitionTaskMetadata(data: Uint8Array): PartitionTaskMetadata;
|
|
152
174
|
/**
|
|
153
175
|
* Metadata of a {@link TASK_KIND_STREAM} task.
|
|
154
176
|
*
|
package/dist/src/task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAA0C,MAAM,eAAe,CAAC;AAIvK;;;;;;;;;;;;;;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AmB5D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAW7D;AAMD;;;;kEAIkE;AAClE,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAE/C;;;qDAGqD;AACrD,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB;IACpC,2EAA2E;;IAE3E;mFAC+E;;IAE/E;sDACkD;;IAElD,qEAAqE;;IAErE;;;;;;;;;;OAUG;;IAEH;iEAC6D;;EAE7D,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAC;AAEzE,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAclF,kFAAkF;AAClF,eAAO,MAAM,2BAA2B,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,UAChC,CAAC;AAK7C;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,UAAU,GAAG,qBAAqB,CAUnF;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;IACjC;8BAC0B;;IAE1B;;qBAEiB;;EAEjB,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC;AAEnE,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,UAC7B,CAAC;AAE1C,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,kBACpB,CAAC"}
|
package/dist/src/task.js
CHANGED
|
@@ -156,11 +156,58 @@ export const PartitionTaskMetadataType = StructType({
|
|
|
156
156
|
combine: OptionType(BlobType),
|
|
157
157
|
/** Target carved-slice size in wire bytes — the only sizing knob. */
|
|
158
158
|
targetPartitionBytes: IntegerType,
|
|
159
|
+
/**
|
|
160
|
+
* `encodeEastIR` bundle of the per-key merge `(Key, Value, Value) -> Value`
|
|
161
|
+
* for a Dict output; `none` otherwise.
|
|
162
|
+
*
|
|
163
|
+
* Its presence (or {@link mergeSets}) selects the SEGMENT-MERGE assembly:
|
|
164
|
+
* partials are walked by their segment fences in the orchestrator, disjoint
|
|
165
|
+
* segments are byte-copied exactly as a splice does, and only overlapping
|
|
166
|
+
* ones are decoded, merged and re-encoded. Appended LAST (BEAST2 encodes
|
|
167
|
+
* struct fields positionally) with a dual decoder — see
|
|
168
|
+
* {@link decodePartitionTaskMetadata}.
|
|
169
|
+
*/
|
|
170
|
+
merge: OptionType(BlobType),
|
|
171
|
+
/** Whether a Set output assembles by segment merge (union). The Set twin of
|
|
172
|
+
* {@link merge}, which needs no function. Appended LAST. */
|
|
173
|
+
mergeSets: BooleanType,
|
|
174
|
+
});
|
|
175
|
+
/**
|
|
176
|
+
* The pre-`merge` partition metadata wire shape, kept only so
|
|
177
|
+
* {@link decodePartitionTaskMetadata} can read tasks exported before the
|
|
178
|
+
* segment-merge assembly existed.
|
|
179
|
+
*/
|
|
180
|
+
const PreMergePartitionTaskMetadataType = StructType({
|
|
181
|
+
partitions: IntegerType,
|
|
182
|
+
by: OptionType(BlobType),
|
|
183
|
+
combine: OptionType(BlobType),
|
|
184
|
+
targetPartitionBytes: IntegerType,
|
|
159
185
|
});
|
|
160
186
|
/** Encode a {@link PartitionTaskMetadataType} value for `TaskObject.metadata`. */
|
|
161
187
|
export const encodePartitionTaskMetadata = encodeBeast2For(PartitionTaskMetadataType);
|
|
162
|
-
|
|
163
|
-
|
|
188
|
+
const decodeCurrentPartitionMetadata = decodeBeast2For(PartitionTaskMetadataType);
|
|
189
|
+
const decodePreMergePartitionMetadata = decodeBeast2For(PreMergePartitionTaskMetadataType);
|
|
190
|
+
/**
|
|
191
|
+
* Decode a `TaskObject.metadata` blob of a {@link TASK_KIND_PARTITION} task,
|
|
192
|
+
* tolerating the pre-`merge` wire format (dual-decode migration).
|
|
193
|
+
*
|
|
194
|
+
* @param data - the metadata blob
|
|
195
|
+
* @returns the decoded metadata, with `merge`/`mergeSets` defaulted off for
|
|
196
|
+
* older bytes
|
|
197
|
+
*/
|
|
198
|
+
export function decodePartitionTaskMetadata(data) {
|
|
199
|
+
try {
|
|
200
|
+
return decodeCurrentPartitionMetadata(data);
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
try {
|
|
204
|
+
return { ...decodePreMergePartitionMetadata(data), merge: none, mergeSets: false };
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
throw err; // no known shape — surface the current-format error
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
164
211
|
/**
|
|
165
212
|
* Metadata of a {@link TASK_KIND_STREAM} task.
|
|
166
213
|
*
|
package/dist/src/task.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAe,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACvK,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,kFAAkF;IAClF,SAAS,EAAE,UAAU;IACrB,uEAAuE;IACvE,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC;IAC/B,sEAAsE;IACtE,MAAM,EAAE,YAAY;IACpB,sFAAsF;IACtF,IAAI,EAAE,UAAU,CAAC,U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
* that exceed inline body size limits.
|
|
10
|
+
*
|
|
11
|
+
* Two protocol versions share these types. A client names the version it speaks
|
|
12
|
+
* with `?protocol=N` on the init and commit requests (a request without it is
|
|
13
|
+
* version 1), and a server answers only in the forms that version understands —
|
|
14
|
+
* every case version 2 adds sorts after the version-1 cases, so the tags a
|
|
15
|
+
* version-1 client decodes keep their numbers.
|
|
16
|
+
*/
|
|
17
|
+
import { VariantType, StructType, StringType, IntegerType, NullType, DictType, type ValueTypeOf } from '@elaraai/east';
|
|
18
|
+
/**
|
|
19
|
+
* The dataset transfer protocol version this build speaks.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Version 2 lets the server plan an upload as parts — each sent to its own URL
|
|
23
|
+
* with the request headers the server names, so an object store can bind a
|
|
24
|
+
* checksum to a single PUT or take a multipart upload larger than one PUT
|
|
25
|
+
* allows — and lets a commit answer `processing` while the server verifies the
|
|
26
|
+
* bytes, for the client to poll.
|
|
27
|
+
*/
|
|
28
|
+
export declare const TRANSFER_PROTOCOL_VERSION = 2;
|
|
29
|
+
/**
|
|
30
|
+
* How many parts an upload of `size` bytes has when planned with `partBytes`.
|
|
31
|
+
*
|
|
32
|
+
* @param size - The upload's size in bytes
|
|
33
|
+
* @param partBytes - The size of every part but the last
|
|
34
|
+
* @returns The part count — at least 1
|
|
35
|
+
*/
|
|
36
|
+
export declare function transferPartCount(size: number | bigint, partBytes: number | bigint): number;
|
|
37
|
+
/**
|
|
38
|
+
* The byte range part `part` of an upload covers.
|
|
39
|
+
*
|
|
40
|
+
* @param size - The upload's size in bytes
|
|
41
|
+
* @param partBytes - The size of every part but the last
|
|
42
|
+
* @param part - The part's number, from 1
|
|
43
|
+
* @returns The half-open range `[start, end)`, or `null` when the upload has no
|
|
44
|
+
* such part
|
|
10
45
|
*/
|
|
11
|
-
|
|
46
|
+
export declare function transferPartRange(size: number | bigint, partBytes: number | bigint, part: number): {
|
|
47
|
+
start: number;
|
|
48
|
+
end: number;
|
|
49
|
+
} | null;
|
|
12
50
|
/**
|
|
13
51
|
* Transfer upload init request.
|
|
14
52
|
*
|
|
@@ -26,7 +64,15 @@ export type TransferUploadRequest = ValueTypeOf<typeof TransferUploadRequestType
|
|
|
26
64
|
* Transfer upload init response.
|
|
27
65
|
*
|
|
28
66
|
* - `completed`: Object already exists (dedup), dataset ref updated
|
|
29
|
-
* - `upload`: Staging slot created
|
|
67
|
+
* - `upload`: Staging slot created; the client PUTs every byte to `uploadUrl`,
|
|
68
|
+
* then commits
|
|
69
|
+
* - `upload_parts` (protocol 2): the client sends the bytes as parts of
|
|
70
|
+
* `partBytes` bytes each (the last part holds the remainder, and an upload no
|
|
71
|
+
* larger than `partBytes` is one part). Part `n` (1-based) is the byte range
|
|
72
|
+
* `[(n - 1) * partBytes, min(size, n * partBytes))`; its URL and required
|
|
73
|
+
* headers come from `GET …/upload/<id>/parts/<n>`. Parts may be sent in any
|
|
74
|
+
* order and concurrently, and re-sending a part replaces it. The client
|
|
75
|
+
* commits once every part is sent.
|
|
30
76
|
*/
|
|
31
77
|
export declare const TransferUploadResponseType: VariantType<{
|
|
32
78
|
readonly completed: NullType;
|
|
@@ -34,19 +80,40 @@ export declare const TransferUploadResponseType: VariantType<{
|
|
|
34
80
|
readonly id: StringType;
|
|
35
81
|
readonly uploadUrl: StringType;
|
|
36
82
|
}>;
|
|
83
|
+
readonly upload_parts: StructType<{
|
|
84
|
+
readonly id: StringType;
|
|
85
|
+
readonly partBytes: IntegerType;
|
|
86
|
+
}>;
|
|
37
87
|
}>;
|
|
38
88
|
export type TransferUploadResponse = ValueTypeOf<typeof TransferUploadResponseType>;
|
|
39
89
|
/**
|
|
40
|
-
*
|
|
90
|
+
* Where and how to send one part of a protocol-2 upload.
|
|
91
|
+
*
|
|
92
|
+
* @property url - The URL the client PUTs the part's bytes to, without an
|
|
93
|
+
* `Authorization` header (it may be a presigned object-store URL)
|
|
94
|
+
* @property headers - Request headers the PUT must carry exactly as given — a
|
|
95
|
+
* presigned URL can sign them, e.g. the checksum an object store verifies the
|
|
96
|
+
* bytes against
|
|
97
|
+
*/
|
|
98
|
+
export declare const TransferPartResponseType: StructType<{
|
|
99
|
+
readonly url: StringType;
|
|
100
|
+
readonly headers: DictType<StringType, StringType>;
|
|
101
|
+
}>;
|
|
102
|
+
export type TransferPartResponse = ValueTypeOf<typeof TransferPartResponseType>;
|
|
103
|
+
/**
|
|
104
|
+
* Transfer done response — the commit's answer, and the poll's.
|
|
41
105
|
*
|
|
42
106
|
* - `completed`: Hash verified, object stored, dataset ref updated
|
|
43
107
|
* - `error`: Hash mismatch or other failure
|
|
108
|
+
* - `processing` (protocol 2): the server is still verifying the bytes; poll
|
|
109
|
+
* `GET …/upload/<id>` until it answers `completed` or `error`
|
|
44
110
|
*/
|
|
45
111
|
export declare const TransferDoneResponseType: VariantType<{
|
|
46
112
|
readonly completed: NullType;
|
|
47
113
|
readonly error: StructType<{
|
|
48
114
|
readonly message: StringType;
|
|
49
115
|
}>;
|
|
116
|
+
readonly processing: NullType;
|
|
50
117
|
}>;
|
|
51
118
|
export type TransferDoneResponse = ValueTypeOf<typeof TransferDoneResponseType>;
|
|
52
119
|
//# sourceMappingURL=transfer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/transfer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/transfer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAEvH;;;;;;;;;GASG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAI3F;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,IAAI,EAAE,MAAM,GACX;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAKvC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;;;EAGpC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;EAUrC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAEpF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB;;;EAGnC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB;;;;;;EAMnC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
package/dist/src/transfer.js
CHANGED
|
@@ -7,8 +7,53 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Used by both the API server and client for large dataset uploads
|
|
9
9
|
* that exceed inline body size limits.
|
|
10
|
+
*
|
|
11
|
+
* Two protocol versions share these types. A client names the version it speaks
|
|
12
|
+
* with `?protocol=N` on the init and commit requests (a request without it is
|
|
13
|
+
* version 1), and a server answers only in the forms that version understands —
|
|
14
|
+
* every case version 2 adds sorts after the version-1 cases, so the tags a
|
|
15
|
+
* version-1 client decodes keep their numbers.
|
|
16
|
+
*/
|
|
17
|
+
import { VariantType, StructType, StringType, IntegerType, NullType, DictType } from '@elaraai/east';
|
|
18
|
+
/**
|
|
19
|
+
* The dataset transfer protocol version this build speaks.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Version 2 lets the server plan an upload as parts — each sent to its own URL
|
|
23
|
+
* with the request headers the server names, so an object store can bind a
|
|
24
|
+
* checksum to a single PUT or take a multipart upload larger than one PUT
|
|
25
|
+
* allows — and lets a commit answer `processing` while the server verifies the
|
|
26
|
+
* bytes, for the client to poll.
|
|
27
|
+
*/
|
|
28
|
+
export const TRANSFER_PROTOCOL_VERSION = 2;
|
|
29
|
+
/**
|
|
30
|
+
* How many parts an upload of `size` bytes has when planned with `partBytes`.
|
|
31
|
+
*
|
|
32
|
+
* @param size - The upload's size in bytes
|
|
33
|
+
* @param partBytes - The size of every part but the last
|
|
34
|
+
* @returns The part count — at least 1
|
|
35
|
+
*/
|
|
36
|
+
export function transferPartCount(size, partBytes) {
|
|
37
|
+
const total = BigInt(size);
|
|
38
|
+
const each = BigInt(partBytes);
|
|
39
|
+
return total <= each ? 1 : Number((total + each - 1n) / each);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The byte range part `part` of an upload covers.
|
|
43
|
+
*
|
|
44
|
+
* @param size - The upload's size in bytes
|
|
45
|
+
* @param partBytes - The size of every part but the last
|
|
46
|
+
* @param part - The part's number, from 1
|
|
47
|
+
* @returns The half-open range `[start, end)`, or `null` when the upload has no
|
|
48
|
+
* such part
|
|
10
49
|
*/
|
|
11
|
-
|
|
50
|
+
export function transferPartRange(size, partBytes, part) {
|
|
51
|
+
if (!Number.isInteger(part) || part < 1 || part > transferPartCount(size, partBytes))
|
|
52
|
+
return null;
|
|
53
|
+
const start = BigInt(part - 1) * BigInt(partBytes);
|
|
54
|
+
const end = start + BigInt(partBytes) < BigInt(size) ? start + BigInt(partBytes) : BigInt(size);
|
|
55
|
+
return { start: Number(start), end: Number(end) };
|
|
56
|
+
}
|
|
12
57
|
/**
|
|
13
58
|
* Transfer upload init request.
|
|
14
59
|
*
|
|
@@ -25,7 +70,15 @@ export const TransferUploadRequestType = StructType({
|
|
|
25
70
|
* Transfer upload init response.
|
|
26
71
|
*
|
|
27
72
|
* - `completed`: Object already exists (dedup), dataset ref updated
|
|
28
|
-
* - `upload`: Staging slot created
|
|
73
|
+
* - `upload`: Staging slot created; the client PUTs every byte to `uploadUrl`,
|
|
74
|
+
* then commits
|
|
75
|
+
* - `upload_parts` (protocol 2): the client sends the bytes as parts of
|
|
76
|
+
* `partBytes` bytes each (the last part holds the remainder, and an upload no
|
|
77
|
+
* larger than `partBytes` is one part). Part `n` (1-based) is the byte range
|
|
78
|
+
* `[(n - 1) * partBytes, min(size, n * partBytes))`; its URL and required
|
|
79
|
+
* headers come from `GET …/upload/<id>/parts/<n>`. Parts may be sent in any
|
|
80
|
+
* order and concurrently, and re-sending a part replaces it. The client
|
|
81
|
+
* commits once every part is sent.
|
|
29
82
|
*/
|
|
30
83
|
export const TransferUploadResponseType = VariantType({
|
|
31
84
|
completed: NullType,
|
|
@@ -33,17 +86,37 @@ export const TransferUploadResponseType = VariantType({
|
|
|
33
86
|
id: StringType,
|
|
34
87
|
uploadUrl: StringType,
|
|
35
88
|
}),
|
|
89
|
+
upload_parts: StructType({
|
|
90
|
+
id: StringType,
|
|
91
|
+
partBytes: IntegerType,
|
|
92
|
+
}),
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* Where and how to send one part of a protocol-2 upload.
|
|
96
|
+
*
|
|
97
|
+
* @property url - The URL the client PUTs the part's bytes to, without an
|
|
98
|
+
* `Authorization` header (it may be a presigned object-store URL)
|
|
99
|
+
* @property headers - Request headers the PUT must carry exactly as given — a
|
|
100
|
+
* presigned URL can sign them, e.g. the checksum an object store verifies the
|
|
101
|
+
* bytes against
|
|
102
|
+
*/
|
|
103
|
+
export const TransferPartResponseType = StructType({
|
|
104
|
+
url: StringType,
|
|
105
|
+
headers: DictType(StringType, StringType),
|
|
36
106
|
});
|
|
37
107
|
/**
|
|
38
|
-
* Transfer done response.
|
|
108
|
+
* Transfer done response — the commit's answer, and the poll's.
|
|
39
109
|
*
|
|
40
110
|
* - `completed`: Hash verified, object stored, dataset ref updated
|
|
41
111
|
* - `error`: Hash mismatch or other failure
|
|
112
|
+
* - `processing` (protocol 2): the server is still verifying the bytes; poll
|
|
113
|
+
* `GET …/upload/<id>` until it answers `completed` or `error`
|
|
42
114
|
*/
|
|
43
115
|
export const TransferDoneResponseType = VariantType({
|
|
44
116
|
completed: NullType,
|
|
45
117
|
error: StructType({
|
|
46
118
|
message: StringType,
|
|
47
119
|
}),
|
|
120
|
+
processing: NullType,
|
|
48
121
|
});
|
|
49
122
|
//# sourceMappingURL=transfer.js.map
|
package/dist/src/transfer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../src/transfer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../src/transfer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAoB,MAAM,eAAe,CAAC;AAEvH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAqB,EAAE,SAA0B;IACjF,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;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CAAC;AAGH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,WAAW,CAAC;IAClD,SAAS,EAAE,QAAQ;IACnB,KAAK,EAAE,UAAU,CAAC;QAChB,OAAO,EAAE,UAAU;KACpB,CAAC;IACF,UAAU,EAAE,QAAQ;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.spec.d.ts","sourceRoot":"","sources":["../../src/transfer.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The dataset transfer protocol's two invariants that live in e3-types.
|
|
7
|
+
*
|
|
8
|
+
* Part arithmetic is shared by the client that cuts the bytes and the server
|
|
9
|
+
* that places them, so an off-by-one on either side would corrupt uploads
|
|
10
|
+
* silently until the commit's hash check. And protocol 2 only adds variant
|
|
11
|
+
* cases: a version-1 client decodes a version-1 answer from a new server, and a
|
|
12
|
+
* new client decodes an old server's answers, only while every added case sorts
|
|
13
|
+
* after the version-1 cases and so leaves their tags unchanged.
|
|
14
|
+
*/
|
|
15
|
+
import { describe, it } from 'node:test';
|
|
16
|
+
import * as assert from 'node:assert';
|
|
17
|
+
import { NullType, StringType, StructType, VariantType, decodeBeast2For, encodeBeast2For, variant } from '@elaraai/east';
|
|
18
|
+
import { TransferDoneResponseType, TransferUploadResponseType, transferPartCount, transferPartRange, } from './transfer.js';
|
|
19
|
+
describe('transferPartCount / transferPartRange', () => {
|
|
20
|
+
it('cuts an upload into full parts and a remainder', () => {
|
|
21
|
+
assert.strictEqual(transferPartCount(10, 4), 3);
|
|
22
|
+
assert.deepStrictEqual(transferPartRange(10, 4, 1), { start: 0, end: 4 });
|
|
23
|
+
assert.deepStrictEqual(transferPartRange(10, 4, 2), { start: 4, end: 8 });
|
|
24
|
+
assert.deepStrictEqual(transferPartRange(10, 4, 3), { start: 8, end: 10 });
|
|
25
|
+
});
|
|
26
|
+
it('gives an exact multiple no empty trailing part', () => {
|
|
27
|
+
assert.strictEqual(transferPartCount(8, 4), 2);
|
|
28
|
+
assert.deepStrictEqual(transferPartRange(8, 4, 2), { start: 4, end: 8 });
|
|
29
|
+
assert.strictEqual(transferPartRange(8, 4, 3), null);
|
|
30
|
+
});
|
|
31
|
+
it('sends an upload no larger than a part as one part', () => {
|
|
32
|
+
assert.strictEqual(transferPartCount(3, 4), 1);
|
|
33
|
+
assert.strictEqual(transferPartCount(4, 4), 1);
|
|
34
|
+
assert.deepStrictEqual(transferPartRange(3, 4, 1), { start: 0, end: 3 });
|
|
35
|
+
});
|
|
36
|
+
it('has no part 0, no fractional part and none past the end', () => {
|
|
37
|
+
assert.strictEqual(transferPartRange(10, 4, 0), null);
|
|
38
|
+
assert.strictEqual(transferPartRange(10, 4, 1.5), null);
|
|
39
|
+
assert.strictEqual(transferPartRange(10, 4, 4), null);
|
|
40
|
+
});
|
|
41
|
+
it('stays exact past 2^32 bytes, taking sizes as bigint or number', () => {
|
|
42
|
+
const size = 5n * 1024n ** 4n + 1n; // 5 TiB and a byte
|
|
43
|
+
const partBytes = 512n * 1024n ** 2n;
|
|
44
|
+
assert.strictEqual(transferPartCount(size, partBytes), 10241);
|
|
45
|
+
assert.deepStrictEqual(transferPartRange(Number(size), Number(partBytes), 10241), {
|
|
46
|
+
start: Number(size) - 1,
|
|
47
|
+
end: Number(size),
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
describe('transfer wire compatibility across protocol versions', () => {
|
|
52
|
+
// The version-1 shapes, as a client and server built before protocol 2 hold them.
|
|
53
|
+
const UploadResponseV1 = VariantType({
|
|
54
|
+
completed: NullType,
|
|
55
|
+
upload: StructType({ id: StringType, uploadUrl: StringType }),
|
|
56
|
+
});
|
|
57
|
+
const DoneResponseV1 = VariantType({
|
|
58
|
+
completed: NullType,
|
|
59
|
+
error: StructType({ message: StringType }),
|
|
60
|
+
});
|
|
61
|
+
it('keeps the init answers a version-1 client decodes', () => {
|
|
62
|
+
const upload = variant('upload', { id: 'abc', uploadUrl: 'http://h/api/uploads/abc' });
|
|
63
|
+
assert.deepStrictEqual(decodeBeast2For(UploadResponseV1)(encodeBeast2For(TransferUploadResponseType)(upload)), upload);
|
|
64
|
+
assert.deepStrictEqual(decodeBeast2For(TransferUploadResponseType)(encodeBeast2For(UploadResponseV1)(upload)), upload);
|
|
65
|
+
const completed = variant('completed', null);
|
|
66
|
+
assert.deepStrictEqual(decodeBeast2For(UploadResponseV1)(encodeBeast2For(TransferUploadResponseType)(completed)), completed);
|
|
67
|
+
});
|
|
68
|
+
it('keeps the commit answers a version-1 client decodes', () => {
|
|
69
|
+
for (const done of [variant('completed', null), variant('error', { message: 'hash mismatch' })]) {
|
|
70
|
+
assert.deepStrictEqual(decodeBeast2For(DoneResponseV1)(encodeBeast2For(TransferDoneResponseType)(done)), done);
|
|
71
|
+
assert.deepStrictEqual(decodeBeast2For(TransferDoneResponseType)(encodeBeast2For(DoneResponseV1)(done)), done);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=transfer.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.spec.js","sourceRoot":"","sources":["../../src/transfer.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzH,OAAO,EACL,wBAAwB,EACxB,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EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAU,EAAE,CAAC;YACzG,MAAM,CAAC,eAAe,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,eAAe,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YAC/G,MAAM,CAAC,eAAe,CAAC,eAAe,CAAC,wBAAwB,CAAC,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACjH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elaraai/e3-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.77",
|
|
4
4
|
"description": "Shared type definitions for e3 (East Execution Engine)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"directory": "libs/e3/packages/e3-types"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@elaraai/east": "1.0.
|
|
21
|
+
"@elaraai/east": "1.0.77"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^22.0.0",
|
package/src/api.ts
CHANGED
|
@@ -69,6 +69,15 @@ export const DataflowErrorType = StructType({ message: StringType });
|
|
|
69
69
|
export const PermissionDeniedErrorType = StructType({ path: StringType });
|
|
70
70
|
export const InternalErrorType = StructType({ message: StringType });
|
|
71
71
|
export const RepositoryNotFoundErrorType = StructType({ repo: StringType });
|
|
72
|
+
/** A write refused at the door because the bytes' wire type is not the type the
|
|
73
|
+
* dataset declares. `message` is the shared one-line rendering (declared type,
|
|
74
|
+
* given type, first differing field) so a remote `e3 dataset set` prints the
|
|
75
|
+
* line a local one does. */
|
|
76
|
+
export const DatasetTypeMismatchErrorType = StructType({
|
|
77
|
+
workspace: StringType,
|
|
78
|
+
path: StringType,
|
|
79
|
+
message: StringType,
|
|
80
|
+
});
|
|
72
81
|
|
|
73
82
|
export const ErrorType = VariantType({
|
|
74
83
|
repository_not_found: RepositoryNotFoundErrorType,
|
|
@@ -87,6 +96,9 @@ export const ErrorType = VariantType({
|
|
|
87
96
|
dataflow_aborted: NullType,
|
|
88
97
|
permission_denied: PermissionDeniedErrorType,
|
|
89
98
|
internal: InternalErrorType,
|
|
99
|
+
// Appended last: BEAST2 encodes a variant case by index, so a case added at
|
|
100
|
+
// the end leaves every existing payload decodable.
|
|
101
|
+
dataset_type_mismatch: DatasetTypeMismatchErrorType,
|
|
90
102
|
});
|
|
91
103
|
|
|
92
104
|
// =============================================================================
|
|
@@ -725,6 +737,12 @@ export const DatasetStatusDetailType = StructType({
|
|
|
725
737
|
refType: StringType,
|
|
726
738
|
hash: OptionType(StringType),
|
|
727
739
|
size: OptionType(IntegerType),
|
|
740
|
+
/** Segment and element counts of a stored collection, read from the blob's
|
|
741
|
+
* trailing index — so a re-pointed input is inspectable without decoding
|
|
742
|
+
* it. `none` for a non-collection or an unset dataset. Appended LAST, per
|
|
743
|
+
* the positional struct rule. */
|
|
744
|
+
segments: OptionType(IntegerType),
|
|
745
|
+
rows: OptionType(IntegerType),
|
|
728
746
|
});
|
|
729
747
|
|
|
730
748
|
// =============================================================================
|