@elaraai/e3-types 1.0.80 → 1.0.81
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 +263 -3
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/api.js +46 -2
- package/dist/src/api.js.map +1 -1
- package/dist/src/index.d.ts +3 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/intake.d.ts +75 -0
- package/dist/src/intake.d.ts.map +1 -0
- package/dist/src/intake.js +46 -0
- package/dist/src/intake.js.map +1 -0
- package/dist/src/lock.d.ts +186 -0
- package/dist/src/lock.d.ts.map +1 -1
- package/dist/src/lock.js +23 -0
- package/dist/src/lock.js.map +1 -1
- package/dist/src/release.d.ts +1 -1
- package/dist/src/release.js +1 -1
- package/dist/src/transfer.d.ts +25 -7
- package/dist/src/transfer.d.ts.map +1 -1
- package/dist/src/transfer.js +9 -7
- package/dist/src/transfer.js.map +1 -1
- package/package.json +2 -2
- package/src/api.ts +52 -2
- package/src/index.ts +19 -0
- package/src/intake.ts +53 -0
- package/src/lock.ts +29 -0
- package/src/release.ts +1 -1
- package/src/transfer.ts +9 -7
package/src/index.ts
CHANGED
|
@@ -204,8 +204,21 @@ export {
|
|
|
204
204
|
type LockHolderVariant,
|
|
205
205
|
LockStateType,
|
|
206
206
|
type LockState,
|
|
207
|
+
LockProgressType,
|
|
208
|
+
type LockProgress,
|
|
209
|
+
LockStatusType,
|
|
210
|
+
type LockStatus,
|
|
207
211
|
} from './lock.js';
|
|
208
212
|
|
|
213
|
+
// How far a file being taken into the store has got: a deploy's file source,
|
|
214
|
+
// or an upload's delivery as its commit takes it in
|
|
215
|
+
export {
|
|
216
|
+
IntakeStepType,
|
|
217
|
+
type IntakeStep,
|
|
218
|
+
IntakeFileType,
|
|
219
|
+
type IntakeFile,
|
|
220
|
+
} from './intake.js';
|
|
221
|
+
|
|
209
222
|
// The repository's own records
|
|
210
223
|
export {
|
|
211
224
|
RepositoryRecordType,
|
|
@@ -316,6 +329,9 @@ export {
|
|
|
316
329
|
WorkspaceDeployRequestType,
|
|
317
330
|
RecordPlanType,
|
|
318
331
|
RecordIndexPlanType,
|
|
332
|
+
RecordDeployStepType,
|
|
333
|
+
RecordDeployStateType,
|
|
334
|
+
DeployProgressType,
|
|
319
335
|
WorkspaceDeployResultType,
|
|
320
336
|
WorkspaceDeployProgressType,
|
|
321
337
|
WorkspaceDeployStatusType,
|
|
@@ -386,6 +402,9 @@ export {
|
|
|
386
402
|
type SchemaPolicy,
|
|
387
403
|
type RecordPlan,
|
|
388
404
|
type RecordIndexPlan,
|
|
405
|
+
type RecordDeployStep,
|
|
406
|
+
type RecordDeployState,
|
|
407
|
+
type DeployProgress,
|
|
389
408
|
type WorkspaceDeployResult,
|
|
390
409
|
type WorkspaceDeployProgress,
|
|
391
410
|
type WorkspaceDeployStatus,
|
package/src/intake.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
/**
|
|
7
|
+
* How far a file being taken into the store has got: a deploy's file source,
|
|
8
|
+
* or an upload's delivery as its commit takes it in.
|
|
9
|
+
*
|
|
10
|
+
* A file is hashed first, since its SHA-256 is how the store knows a delivery
|
|
11
|
+
* it already holds, and then taken in: a collection by intake units on the
|
|
12
|
+
* runners, a piece of its segments each, and any other value as the object the
|
|
13
|
+
* file is.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { ArrayType, IntegerType, NullType, StringType, StructType, VariantType, type ValueTypeOf } from '@elaraai/east';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The step a file being taken in is at.
|
|
20
|
+
*/
|
|
21
|
+
export const IntakeStepType = VariantType({
|
|
22
|
+
/** Not started: a deploy takes a bounded number of files in at once */
|
|
23
|
+
waiting: NullType,
|
|
24
|
+
/** Being read for its SHA-256, by which the store knows a delivery it
|
|
25
|
+
* already holds */
|
|
26
|
+
hashing: NullType,
|
|
27
|
+
/** Being taken in by intake units: its `pieces`, and how many are `done` */
|
|
28
|
+
taking_in: StructType({ pieces: IntegerType, done: IntegerType }),
|
|
29
|
+
/** In the store: one it already held; a value that is not a collection,
|
|
30
|
+
* carried as the object the file is; or a collection, taken in by the
|
|
31
|
+
* runners named, in the order each first took a piece in — none when every
|
|
32
|
+
* piece was taken in before, by an intake that stopped part way */
|
|
33
|
+
done: VariantType({ known: NullType, carried: NullType, taken: ArrayType(StringType) }),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export type IntakeStep = ValueTypeOf<typeof IntakeStepType>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A file being taken into the store.
|
|
40
|
+
*/
|
|
41
|
+
export const IntakeFileType = StructType({
|
|
42
|
+
/** The dataset it becomes, as `inputs/<name>` */
|
|
43
|
+
path: StringType,
|
|
44
|
+
/** The step it is at */
|
|
45
|
+
step: IntakeStepType,
|
|
46
|
+
/** Bytes of the file its step has covered: read for its hash, or covered by
|
|
47
|
+
* the pieces taken in; its size once it is done */
|
|
48
|
+
bytes: IntegerType,
|
|
49
|
+
/** The file's size */
|
|
50
|
+
total: IntegerType,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export type IntakeFile = ValueTypeOf<typeof IntakeFileType>;
|
package/src/lock.ts
CHANGED
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
* - when it was acquired;
|
|
15
15
|
* - when it expires, for a cloud backend's lease.
|
|
16
16
|
*
|
|
17
|
+
* An exclusive holder may also report how far its operation has got, for
|
|
18
|
+
* another process to read while it holds the lock: a deploy taking its file
|
|
19
|
+
* sources in and deploying its records.
|
|
20
|
+
*
|
|
17
21
|
* A local repository keeps each resource's locks in `locks/<resource>/`.
|
|
18
22
|
*/
|
|
19
23
|
|
|
@@ -27,6 +31,7 @@ import {
|
|
|
27
31
|
NullType,
|
|
28
32
|
ValueTypeOf,
|
|
29
33
|
} from '@elaraai/east';
|
|
34
|
+
import { DeployProgressType } from './api.js';
|
|
30
35
|
|
|
31
36
|
/**
|
|
32
37
|
* Lock operation - what acquired the lock.
|
|
@@ -105,3 +110,27 @@ export const LockStateType = StructType({
|
|
|
105
110
|
});
|
|
106
111
|
|
|
107
112
|
export type LockState = ValueTypeOf<typeof LockStateType>;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* How far the operation holding a lock exclusively has got, as its holder
|
|
116
|
+
* reports it for another process to read while it holds the lock.
|
|
117
|
+
*/
|
|
118
|
+
export const LockProgressType = VariantType({
|
|
119
|
+
/** A deploy: its file sources and its records */
|
|
120
|
+
deployment: DeployProgressType,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export type LockProgress = ValueTypeOf<typeof LockProgressType>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A resource's exclusive lock as another process reads it while it is held:
|
|
127
|
+
* what holds it, and how far that operation says it has got.
|
|
128
|
+
*/
|
|
129
|
+
export const LockStatusType = StructType({
|
|
130
|
+
/** The lock's state: the operation, its holder, and when it was acquired */
|
|
131
|
+
state: LockStateType,
|
|
132
|
+
/** What the holder last reported of its progress; `none` until it reports */
|
|
133
|
+
progress: OptionType(LockProgressType),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export type LockStatus = ValueTypeOf<typeof LockStatusType>;
|
package/src/release.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
/** The release of e3 this build is. */
|
|
20
|
-
export const E3_RELEASE = '1.0.
|
|
20
|
+
export const E3_RELEASE = '1.0.81';
|
|
21
21
|
|
|
22
22
|
/** A semantic version: its core, a pre-release, and build metadata. */
|
|
23
23
|
const RELEASE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
package/src/transfer.ts
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* newer server that speak one version work together.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import { VariantType, StructType, StringType, IntegerType, NullType, DictType, type ValueTypeOf } from '@elaraai/east';
|
|
19
|
+
import { VariantType, StructType, StringType, IntegerType, NullType, DictType, OptionType, type ValueTypeOf } from '@elaraai/east';
|
|
20
|
+
import { IntakeFileType } from './intake.js';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* The dataset transfer protocol version this build speaks, and the only one.
|
|
@@ -25,10 +26,10 @@ import { VariantType, StructType, StringType, IntegerType, NullType, DictType, t
|
|
|
25
26
|
* The server plans an upload as parts — each sent to its own URL with the
|
|
26
27
|
* request headers the server names, so an object store can bind a checksum to
|
|
27
28
|
* a single PUT or take a multipart upload larger than one PUT allows — and a
|
|
28
|
-
* commit may answer `processing` while the server verifies the bytes
|
|
29
|
-
* client to poll.
|
|
29
|
+
* commit may answer `processing` while the server verifies the bytes and takes
|
|
30
|
+
* them in, with how far it has got, for the client to poll.
|
|
30
31
|
*/
|
|
31
|
-
export const TRANSFER_PROTOCOL_VERSION =
|
|
32
|
+
export const TRANSFER_PROTOCOL_VERSION = 3;
|
|
32
33
|
|
|
33
34
|
/**
|
|
34
35
|
* How many parts an upload of `size` bytes has when planned with `partBytes`.
|
|
@@ -118,14 +119,15 @@ export type TransferPartResponse = ValueTypeOf<typeof TransferPartResponseType>;
|
|
|
118
119
|
*
|
|
119
120
|
* - `completed`: Hash verified, object stored, dataset ref updated
|
|
120
121
|
* - `error`: Hash mismatch or other failure
|
|
121
|
-
* - `processing`: the server is still verifying the bytes
|
|
122
|
-
* `GET …/upload/<id>` until
|
|
122
|
+
* - `processing`: the server is still verifying the bytes or taking them in,
|
|
123
|
+
* with how far it has got once it has said; poll `GET …/upload/<id>` until
|
|
124
|
+
* it answers `completed` or `error`
|
|
123
125
|
*/
|
|
124
126
|
export const TransferDoneResponseType = VariantType({
|
|
125
127
|
completed: NullType,
|
|
126
128
|
error: StructType({
|
|
127
129
|
message: StringType,
|
|
128
130
|
}),
|
|
129
|
-
processing:
|
|
131
|
+
processing: OptionType(IntakeFileType),
|
|
130
132
|
});
|
|
131
133
|
export type TransferDoneResponse = ValueTypeOf<typeof TransferDoneResponseType>;
|