@elaraai/e3-types 1.0.4 → 1.0.6
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 +3 -2
- package/dist/src/api.d.ts +272 -0
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/api.js +97 -0
- package/dist/src/api.js.map +1 -1
- package/dist/src/function.d.ts +129 -0
- package/dist/src/function.d.ts.map +1 -0
- package/dist/src/function.js +36 -0
- package/dist/src/function.js.map +1 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/package.d.ts +14 -0
- package/dist/src/package.d.ts.map +1 -1
- package/dist/src/package.js +39 -1
- package/dist/src/package.js.map +1 -1
- package/dist/src/runner.d.ts +48 -0
- package/dist/src/runner.d.ts.map +1 -0
- package/dist/src/runner.js +49 -0
- package/dist/src/runner.js.map +1 -0
- package/package.json +2 -2
- package/src/api.ts +116 -0
- package/src/function.ts +41 -0
- package/src/index.ts +33 -0
- package/src/package.ts +40 -1
- package/src/runner.ts +56 -0
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
* Function object types for e3.
|
|
7
|
+
*
|
|
8
|
+
* An `e3.function` is a named, typed function stored in a package and
|
|
9
|
+
* invoked by name with argument values over the CLI and HTTP API. Unlike
|
|
10
|
+
* a task it is not wired to datasets, not part of the dataflow graph, and
|
|
11
|
+
* triggers no recomputation.
|
|
12
|
+
*
|
|
13
|
+
* The function object stores its signature explicitly so `describe` and
|
|
14
|
+
* arity/type validation work from the small function object without
|
|
15
|
+
* loading the IR bundle, and so dynamic callers (CLI literal parsing,
|
|
16
|
+
* non-TS clients) have the types they need to encode arguments.
|
|
17
|
+
*/
|
|
18
|
+
import { StructType, StringType, ArrayType, EastTypeType } from '@elaraai/east';
|
|
19
|
+
import { RunnerType } from './runner.js';
|
|
20
|
+
/**
|
|
21
|
+
* Function object stored in the object store, referenced by name from
|
|
22
|
+
* `PackageObject.functions`.
|
|
23
|
+
*/
|
|
24
|
+
export const FunctionObjectType = StructType({
|
|
25
|
+
/** Hash of the encoded EastIR bundle (encodeEastIR), like a task's commandIr object. */
|
|
26
|
+
bodyIr: StringType,
|
|
27
|
+
/** Positional parameter types — the IR's signature, surfaced for arity/type
|
|
28
|
+
* validation and `describe` without decoding the whole IR. */
|
|
29
|
+
inputTypes: ArrayType(EastTypeType),
|
|
30
|
+
/** Return type — used to decode the result `value` blob client-side. */
|
|
31
|
+
outputType: EastTypeType,
|
|
32
|
+
/** Author-chosen runtime; resolved to argv by runnerToArgv. One of the known
|
|
33
|
+
* runtime tags — there is no raw-argv runner for functions. */
|
|
34
|
+
runner: RunnerType,
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/function.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAe,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAC3C,wFAAwF;IACxF,MAAM,EAAE,UAAU;IAClB;mEAC+D;IAC/D,UAAU,EAAE,SAAS,CAAC,YAAY,CAAC;IACnC,wEAAwE;IACxE,UAAU,EAAE,YAAY;IACxB;oEACgE;IAChE,MAAM,EAAE,UAAU;CACnB,CAAC,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -24,12 +24,14 @@ export { DataRefType, type DataRef, unassignedRef, nullRef, DataTreeType, } from
|
|
|
24
24
|
export { VersionVectorType, type VersionVector, DatasetRefType, type DatasetRef, } from './dataset-ref.js';
|
|
25
25
|
export { TaskObjectType, type TaskObject, } from './task.js';
|
|
26
26
|
export { StructureType, type Structure, PathSegmentType, type PathSegment, TreePathType, type TreePath, type ParsePathResult, type ParseDatasetPathResult, type ParsePackageRefResult, treePath, pathToString, parsePath, parseDatasetPath, parsePackageRef, urlPathToTreePath, DatasetSchemaType, type DatasetSchema, } from './structure.js';
|
|
27
|
-
export {
|
|
27
|
+
export { RunnerType, type RunnerValue, runnerToArgv, } from './runner.js';
|
|
28
|
+
export { FunctionObjectType, type FunctionObject, } from './function.js';
|
|
29
|
+
export { PackageDataType, type PackageData, PackageObjectType, type PackageObject, decodePackageObject, PackageDatasetsType, type PackageDatasets, PackageTransferInitRequestType, type PackageTransferInitRequest, PackageTransferInitResponseType, type PackageTransferInitResponse, PackageJobResponseType, type PackageJobResponse, PackageImportResultType, type PackageImportResult, PackageExportResultType, type PackageExportResult, PackageImportProgressType, type PackageImportProgress, PackageImportStatusType, type PackageImportStatus, PackageExportProgressType, type PackageExportProgress, PackageExportStatusType, type PackageExportStatus, } from './package.js';
|
|
28
30
|
export { WorkspaceStateType, type WorkspaceState, } from './workspace.js';
|
|
29
31
|
export { ExecutionStatusType, type ExecutionStatus, } from './execution.js';
|
|
30
32
|
export { LockOperationType, type LockOperation, ProcessHolderType, type ProcessHolder, LockStateType, type LockState, } from './lock.js';
|
|
31
33
|
export { TransferUploadRequestType, type TransferUploadRequest, TransferUploadResponseType, type TransferUploadResponse, TransferDoneResponseType, type TransferDoneResponse, } from './transfer.js';
|
|
32
34
|
export { BEAST2_CONTENT_TYPE } from './constants.js';
|
|
33
|
-
export { WorkspaceNotFoundErrorType, WorkspaceNotDeployedErrorType, WorkspaceExistsErrorType, LockHolderType, WorkspaceLockedErrorType, PackageNotFoundErrorType, PackageExistsErrorType, PackageInvalidErrorType, DatasetNotFoundErrorType, TaskNotFoundErrorType, ExecutionNotFoundErrorType, ObjectNotFoundErrorType, DataflowErrorType, PermissionDeniedErrorType, InternalErrorType, RepositoryNotFoundErrorType, ErrorType, ResponseType, RepositoryStatusType, GcRequestType, GcResultType, AsyncOperationStatusType, GcStartResultType, GcStatusResultType, PackageListItemType, PackageInfoType, PackageDetailsType, WorkspaceCreateRequestType, WorkspaceInfoType, WorkspaceDeployRequestType, WorkspaceExportRequestType, DatasetStatusType, TaskStatusUpToDateType, TaskStatusWaitingType, TaskStatusInProgressType, TaskStatusFailedType, TaskStatusErrorType, TaskStatusStaleRunningType, TaskStatusType, DatasetStatusInfoType, TaskStatusInfoType, WorkspaceStatusSummaryType, WorkspaceStatusResultType, TaskListItemType, TaskDetailsType, DataflowRequestType, LogChunkType, TaskExecutionResultType, DataflowResultType, DataflowEventType, ApiExecutionStatusType, DataflowExecutionSummaryType, ApiDataflowExecutionStateType, ExecutionHistoryStatusType, ExecutionListItemType, TreeKindType, ListEntryType, DatasetStatusDetailType, type Error, type RepositoryStatus, type GcRequest, type GcResult, type AsyncOperationStatus, type GcStartResult, type GcStatusResult, type PackageListItem, type PackageInfo, type PackageDetails, type WorkspaceInfo, type WorkspaceCreateRequest, type WorkspaceDeployRequest, type DatasetStatus, type TaskStatus as ApiTaskStatus, type DatasetStatusInfo, type TaskStatusInfo, type WorkspaceStatusSummary, type WorkspaceStatusResult, type TaskListItem, type TaskDetails, type DataflowRequest, type LogChunk, type TaskExecutionResult, type DataflowResult, type DataflowEvent, type ApiExecutionStatus, type DataflowExecutionSummary, type ApiDataflowExecutionState, type ExecutionHistoryStatus, type ExecutionListItem, type TreeKind, type ListEntry, type DatasetStatusDetail, } from './api.js';
|
|
35
|
+
export { WorkspaceNotFoundErrorType, WorkspaceNotDeployedErrorType, WorkspaceExistsErrorType, LockHolderType, WorkspaceLockedErrorType, PackageNotFoundErrorType, PackageExistsErrorType, PackageInvalidErrorType, DatasetNotFoundErrorType, TaskNotFoundErrorType, ExecutionNotFoundErrorType, ObjectNotFoundErrorType, DataflowErrorType, PermissionDeniedErrorType, InternalErrorType, RepositoryNotFoundErrorType, ErrorType, ResponseType, RepositoryStatusType, GcRequestType, GcResultType, AsyncOperationStatusType, GcStartResultType, GcStatusResultType, PackageListItemType, PackageInfoType, PackageDetailsType, WorkspaceCreateRequestType, WorkspaceInfoType, WorkspaceDeployRequestType, WorkspaceExportRequestType, DatasetStatusType, TaskStatusUpToDateType, TaskStatusWaitingType, TaskStatusInProgressType, TaskStatusFailedType, TaskStatusErrorType, TaskStatusStaleRunningType, TaskStatusType, DatasetStatusInfoType, TaskStatusInfoType, WorkspaceStatusSummaryType, WorkspaceStatusResultType, TaskListItemType, TaskDetailsType, DataflowRequestType, LogChunkType, TaskExecutionResultType, DataflowResultType, DataflowEventType, ApiExecutionStatusType, DataflowExecutionSummaryType, ApiDataflowExecutionStateType, ExecutionHistoryStatusType, ExecutionListItemType, TreeKindType, ListEntryType, DatasetStatusDetailType, ExecuteLimitsType, DiagnosticType, ExecuteResultType, FunctionCallRequestType, FunctionSignatureType, CallStartResultType, CallStatusType, CallStatusResultType, OneShotRequestType, type Error, type RepositoryStatus, type GcRequest, type GcResult, type AsyncOperationStatus, type GcStartResult, type GcStatusResult, type PackageListItem, type PackageInfo, type PackageDetails, type WorkspaceInfo, type WorkspaceCreateRequest, type WorkspaceDeployRequest, type DatasetStatus, type TaskStatus as ApiTaskStatus, type DatasetStatusInfo, type TaskStatusInfo, type WorkspaceStatusSummary, type WorkspaceStatusResult, type TaskListItem, type TaskDetails, type DataflowRequest, type LogChunk, type TaskExecutionResult, type DataflowResult, type DataflowEvent, type ApiExecutionStatus, type DataflowExecutionSummary, type ApiDataflowExecutionState, type ExecutionHistoryStatus, type ExecutionListItem, type TreeKind, type ListEntry, type DatasetStatusDetail, type ExecuteLimits, type Diagnostic, type ExecuteResult, type FunctionCallRequest, type FunctionSignature, type CallStartResult, type CallStatus, type CallStatusResult, type OneShotRequest, } from './api.js';
|
|
34
36
|
export { type DataflowExecutionStatus, type TaskStatus, TaskStateType, type TaskState, DataflowGraphTaskType, type DataflowGraphTask, DataflowGraphType, type DataflowGraph, ExecutionEventType, type ExecutionEvent, DataflowExecutionStateType, type DataflowExecutionState, DataflowRunStatusType, type DataflowRunStatus, TaskExecutionRecordType, type TaskExecutionRecord, DataflowRunSummaryType, type DataflowRunSummary, DataflowRunType, type DataflowRun, } from './dataflow.js';
|
|
35
37
|
//# 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;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,OAAO,EACZ,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,iBAAiB,EACjB,KAAK,aAAa,EAClB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,aAAa,EACb,KAAK,SAAS,EACd,eAAe,EACf,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAEjB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,iBAAiB,EACjB,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,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uBAAuB,EACvB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,eAAe,EACf,KAAK,WAAW,GACjB,MAAM,eAAe,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -30,8 +30,12 @@ export { TaskObjectType, } from './task.js';
|
|
|
30
30
|
export { StructureType, PathSegmentType, TreePathType, treePath, pathToString, parsePath, parseDatasetPath, parsePackageRef, urlPathToTreePath,
|
|
31
31
|
// Backwards compatibility
|
|
32
32
|
DatasetSchemaType, } from './structure.js';
|
|
33
|
+
// Runner wire types (functions)
|
|
34
|
+
export { RunnerType, runnerToArgv, } from './runner.js';
|
|
35
|
+
// Function objects
|
|
36
|
+
export { FunctionObjectType, } from './function.js';
|
|
33
37
|
// Package objects
|
|
34
|
-
export { PackageDataType, PackageObjectType,
|
|
38
|
+
export { PackageDataType, PackageObjectType, decodePackageObject,
|
|
35
39
|
// Backwards compatibility
|
|
36
40
|
PackageDatasetsType,
|
|
37
41
|
// Package transfer types
|
|
@@ -69,7 +73,9 @@ ExecutionHistoryStatusType, ExecutionListItemType,
|
|
|
69
73
|
// Dataset List
|
|
70
74
|
TreeKindType, ListEntryType,
|
|
71
75
|
// Dataset Status Detail
|
|
72
|
-
DatasetStatusDetailType,
|
|
76
|
+
DatasetStatusDetailType,
|
|
77
|
+
// Function / one-shot execution
|
|
78
|
+
ExecuteLimitsType, DiagnosticType, ExecuteResultType, FunctionCallRequestType, FunctionSignatureType, CallStartResultType, CallStatusType, CallStatusResultType, OneShotRequestType, } from './api.js';
|
|
73
79
|
// Dataflow execution state
|
|
74
80
|
export { TaskStateType, DataflowGraphTaskType, DataflowGraphType, ExecutionEventType, DataflowExecutionStateType,
|
|
75
81
|
// Dataflow run history
|
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;;;;;;;;;;;;;;;;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nB,0BAA0B,EAC1B,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB;AACzB,QAAQ;AACR,gBAAgB,EAChB,eAAe;AACf,YAAY;AACZ,mBAAmB,EACnB,YAAY,EACZ,uBAAuB,EACvB,kBAAkB;AAClB,uBAAuB;AACvB,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B;AAC7B,yBAAyB;AACzB,0BAA0B,EAC1B,qBAAqB;AACrB,eAAe;AACf,YAAY,EACZ,aAAa;AACb,wBAAwB;AACxB,uBAAuB;AACvB,gCAAgC;AAChC,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,GA6CnB,MAAM,UAAU,CAAC;AAElB,2BAA2B;AAC3B,OAAO,EAGL,aAAa,EAEb,qBAAqB,EAErB,iBAAiB,EAEjB,kBAAkB,EAElB,0BAA0B;AAE1B,uBAAuB;AACvB,qBAAqB,EAErB,uBAAuB,EAEvB,sBAAsB,EAEtB,eAAe,GAEhB,MAAM,eAAe,CAAC"}
|
package/dist/src/package.d.ts
CHANGED
|
@@ -246,9 +246,23 @@ export declare const PackageObjectType: StructType<{
|
|
|
246
246
|
}>;
|
|
247
247
|
}>>;
|
|
248
248
|
}>;
|
|
249
|
+
/** Functions defined in this package: name -> FunctionObject hash.
|
|
250
|
+
* BEAST2 encodes struct fields positionally in declaration order, so this
|
|
251
|
+
* field MUST stay last — never insert between `tasks` and `data`. */
|
|
252
|
+
readonly functions: DictType<StringType, StringType>;
|
|
249
253
|
}>;
|
|
250
254
|
export type PackageObjectType = typeof PackageObjectType;
|
|
251
255
|
export type PackageObject = ValueTypeOf<typeof PackageObjectType>;
|
|
256
|
+
/**
|
|
257
|
+
* Decode a `PackageObject` from BEAST2 bytes, tolerating the pre-`functions`
|
|
258
|
+
* wire format (dual-decode migration).
|
|
259
|
+
*
|
|
260
|
+
* Every package-read path — local AND cloud — must use this instead of
|
|
261
|
+
* `decodeBeast2For(PackageObjectType)` directly, so packages exported before
|
|
262
|
+
* the `functions` field existed keep decoding. Old bytes decode with
|
|
263
|
+
* `functions` defaulted to an empty map.
|
|
264
|
+
*/
|
|
265
|
+
export declare function decodePackageObject(data: Uint8Array): PackageObject;
|
|
252
266
|
export declare const PackageTransferInitRequestType: StructType<{
|
|
253
267
|
readonly size: IntegerType;
|
|
254
268
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","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,WAAW,
|
|
1
|
+
{"version":3,"file":"package.d.ts","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,WAAW,EAAmB,MAAM,eAAe,CAAC;AAInI;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;IAC1B,gEAAgE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEhE,uEAAuE;;;;;;;;;;;EAEvE,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC;AAErD,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC;AAG9D,8CAA8C;AAC9C,eAAO,MAAM,mBAAmB;IAX9B,gEAAgE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEhE,uEAAuE;;;;;;;;;;;EASvB,CAAC;AACnD,0CAA0C;AAC1C,MAAM,MA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BAAuB;;;;;;;;;;;;;;;;;EAMlC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,eAAO,MAAM,yBAAyB;;;;;;EAIpC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAMlC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
package/dist/src/package.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* - **Structure**: The shape of the data tree
|
|
14
14
|
* - **Task**: A computation with input/output paths (stored separately)
|
|
15
15
|
*/
|
|
16
|
-
import { StructType, StringType, IntegerType, VariantType, NullType, DictType } from '@elaraai/east';
|
|
16
|
+
import { StructType, StringType, IntegerType, VariantType, NullType, DictType, decodeBeast2For } from '@elaraai/east';
|
|
17
17
|
import { DatasetRefType } from './dataset-ref.js';
|
|
18
18
|
import { StructureType } from './structure.js';
|
|
19
19
|
/**
|
|
@@ -65,7 +65,45 @@ export const PackageObjectType = StructType({
|
|
|
65
65
|
tasks: DictType(StringType, StringType),
|
|
66
66
|
/** Data structure and initial values */
|
|
67
67
|
data: PackageDataType,
|
|
68
|
+
/** Functions defined in this package: name -> FunctionObject hash.
|
|
69
|
+
* BEAST2 encodes struct fields positionally in declaration order, so this
|
|
70
|
+
* field MUST stay last — never insert between `tasks` and `data`. */
|
|
71
|
+
functions: DictType(StringType, StringType),
|
|
68
72
|
});
|
|
73
|
+
/**
|
|
74
|
+
* The pre-`functions` package object wire shape, kept only so
|
|
75
|
+
* {@link decodePackageObject} can read packages exported before functions
|
|
76
|
+
* existed.
|
|
77
|
+
*/
|
|
78
|
+
const LegacyPackageObjectType = StructType({
|
|
79
|
+
tasks: DictType(StringType, StringType),
|
|
80
|
+
data: PackageDataType,
|
|
81
|
+
});
|
|
82
|
+
const decodeCurrent = decodeBeast2For(PackageObjectType);
|
|
83
|
+
const decodeLegacy = decodeBeast2For(LegacyPackageObjectType);
|
|
84
|
+
/**
|
|
85
|
+
* Decode a `PackageObject` from BEAST2 bytes, tolerating the pre-`functions`
|
|
86
|
+
* wire format (dual-decode migration).
|
|
87
|
+
*
|
|
88
|
+
* Every package-read path — local AND cloud — must use this instead of
|
|
89
|
+
* `decodeBeast2For(PackageObjectType)` directly, so packages exported before
|
|
90
|
+
* the `functions` field existed keep decoding. Old bytes decode with
|
|
91
|
+
* `functions` defaulted to an empty map.
|
|
92
|
+
*/
|
|
93
|
+
export function decodePackageObject(data) {
|
|
94
|
+
try {
|
|
95
|
+
return decodeCurrent(data);
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
try {
|
|
99
|
+
const legacy = decodeLegacy(data);
|
|
100
|
+
return { tasks: legacy.tasks, data: legacy.data, functions: new Map() };
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
throw err; // neither shape — surface the current-format error
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
69
107
|
// =============================================================================
|
|
70
108
|
// Package Transfer Types
|
|
71
109
|
// =============================================================================
|
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,MAAM,eAAe,CAAC;
|
|
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,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AAW,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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
* Runner wire types for e3 functions.
|
|
7
|
+
*
|
|
8
|
+
* `RunnerType` is the wire image of the SDK's `Runner` union (minus its
|
|
9
|
+
* `custom` raw-argv runtime — see the security note below). It pins the
|
|
10
|
+
* executable to a known runtime for every tag, so a function call can never
|
|
11
|
+
* name its own executable; only platform flags vary.
|
|
12
|
+
*
|
|
13
|
+
* A `platforms` entry is just a `-p <name>` flag on the wire; the SDK's
|
|
14
|
+
* `Platform<Known> | { custom }` distinction is authoring sugar that
|
|
15
|
+
* collapses to a string.
|
|
16
|
+
*/
|
|
17
|
+
import { VariantType, StructType, ArrayType, StringType, ValueTypeOf } from '@elaraai/east';
|
|
18
|
+
/**
|
|
19
|
+
* Wire representation of a function's runner.
|
|
20
|
+
*
|
|
21
|
+
* Each tag names a known runtime binary; `platforms` are passed as `-p`
|
|
22
|
+
* flags. There is deliberately no raw-argv case: a resolved-argv field would
|
|
23
|
+
* let any caller choose the executable and every flag — arbitrary command
|
|
24
|
+
* execution by construction.
|
|
25
|
+
*/
|
|
26
|
+
export declare const RunnerType: VariantType<{
|
|
27
|
+
readonly east_node: StructType<{
|
|
28
|
+
readonly platforms: ArrayType<StringType>;
|
|
29
|
+
}>;
|
|
30
|
+
readonly east_py: StructType<{
|
|
31
|
+
readonly platforms: ArrayType<StringType>;
|
|
32
|
+
}>;
|
|
33
|
+
readonly east_c: StructType<{
|
|
34
|
+
readonly platforms: ArrayType<StringType>;
|
|
35
|
+
}>;
|
|
36
|
+
}>;
|
|
37
|
+
export type RunnerType = typeof RunnerType;
|
|
38
|
+
export type RunnerValue = ValueTypeOf<typeof RunnerType>;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a {@link RunnerType} value to the argv prefix (the wire-value
|
|
41
|
+
* analogue of the SDK's `runnerToCommand`). Lives in e3-types so both
|
|
42
|
+
* e3-core (local) and the cloud execution kernel import the one resolver.
|
|
43
|
+
*
|
|
44
|
+
* Variant tags use underscores (`east_node`) mapped to the binary name
|
|
45
|
+
* (`east-node`) here.
|
|
46
|
+
*/
|
|
47
|
+
export declare function runnerToArgv(r: RunnerValue): string[];
|
|
48
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5F;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;EAIrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,UAAU,CAAC,CAAC;AAMzD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE,CAMrD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
* Runner wire types for e3 functions.
|
|
7
|
+
*
|
|
8
|
+
* `RunnerType` is the wire image of the SDK's `Runner` union (minus its
|
|
9
|
+
* `custom` raw-argv runtime — see the security note below). It pins the
|
|
10
|
+
* executable to a known runtime for every tag, so a function call can never
|
|
11
|
+
* name its own executable; only platform flags vary.
|
|
12
|
+
*
|
|
13
|
+
* A `platforms` entry is just a `-p <name>` flag on the wire; the SDK's
|
|
14
|
+
* `Platform<Known> | { custom }` distinction is authoring sugar that
|
|
15
|
+
* collapses to a string.
|
|
16
|
+
*/
|
|
17
|
+
import { VariantType, StructType, ArrayType, StringType } from '@elaraai/east';
|
|
18
|
+
/**
|
|
19
|
+
* Wire representation of a function's runner.
|
|
20
|
+
*
|
|
21
|
+
* Each tag names a known runtime binary; `platforms` are passed as `-p`
|
|
22
|
+
* flags. There is deliberately no raw-argv case: a resolved-argv field would
|
|
23
|
+
* let any caller choose the executable and every flag — arbitrary command
|
|
24
|
+
* execution by construction.
|
|
25
|
+
*/
|
|
26
|
+
export const RunnerType = VariantType({
|
|
27
|
+
east_node: StructType({ platforms: ArrayType(StringType) }),
|
|
28
|
+
east_py: StructType({ platforms: ArrayType(StringType) }),
|
|
29
|
+
east_c: StructType({ platforms: ArrayType(StringType) }),
|
|
30
|
+
});
|
|
31
|
+
function flags(platforms) {
|
|
32
|
+
return platforms.flatMap((p) => ['-p', p]);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a {@link RunnerType} value to the argv prefix (the wire-value
|
|
36
|
+
* analogue of the SDK's `runnerToCommand`). Lives in e3-types so both
|
|
37
|
+
* e3-core (local) and the cloud execution kernel import the one resolver.
|
|
38
|
+
*
|
|
39
|
+
* Variant tags use underscores (`east_node`) mapped to the binary name
|
|
40
|
+
* (`east-node`) here.
|
|
41
|
+
*/
|
|
42
|
+
export function runnerToArgv(r) {
|
|
43
|
+
switch (r.type) {
|
|
44
|
+
case 'east_node': return ['east-node', 'run', ...flags(r.value.platforms)];
|
|
45
|
+
case 'east_py': return ['east-py', 'run', ...flags(r.value.platforms)];
|
|
46
|
+
case 'east_c': return ['east-c', 'run', ...flags(r.value.platforms)];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/runner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAe,MAAM,eAAe,CAAC;AAE5F;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;IACpC,SAAS,EAAE,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;IAC3D,OAAO,EAAI,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;IAC3D,MAAM,EAAK,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;CAC5D,CAAC,CAAC;AAKH,SAAS,KAAK,CAAC,SAAmB;IAChC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,CAAc;IACzC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACf,KAAK,WAAW,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC3E,KAAK,SAAS,CAAC,CAAG,OAAO,CAAC,SAAS,EAAI,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC3E,KAAK,QAAQ,CAAC,CAAI,OAAO,CAAC,QAAQ,EAAK,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7E,CAAC;AACH,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.6",
|
|
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.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
package/src/api.ts
CHANGED
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
} from '@elaraai/east';
|
|
36
36
|
|
|
37
37
|
import { StructureType, TreePathType } from './structure.js';
|
|
38
|
+
import { RunnerType } from './runner.js';
|
|
38
39
|
|
|
39
40
|
// =============================================================================
|
|
40
41
|
// Error Types
|
|
@@ -723,6 +724,112 @@ export const DatasetStatusDetailType = StructType({
|
|
|
723
724
|
size: OptionType(IntegerType),
|
|
724
725
|
});
|
|
725
726
|
|
|
727
|
+
// =============================================================================
|
|
728
|
+
// Function / one-shot execution types
|
|
729
|
+
// =============================================================================
|
|
730
|
+
// Shared by the named-function path AND one-shot execution. The result of a
|
|
731
|
+
// call is an in-memory, bounded value returned inline — never promoted to a
|
|
732
|
+
// durable artifact.
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* Execution limits for a function/one-shot call.
|
|
736
|
+
*
|
|
737
|
+
* @property timeoutMs - Wall-clock limit; over it the call is killed and returns `timed_out`
|
|
738
|
+
* @property maxResultBytes - Inline result cap; over it the call returns `too_large`
|
|
739
|
+
* @property maxLogBytes - Per-stream stdout/stderr tail cap
|
|
740
|
+
*/
|
|
741
|
+
export const ExecuteLimitsType = StructType({
|
|
742
|
+
timeoutMs: OptionType(IntegerType),
|
|
743
|
+
maxResultBytes: OptionType(IntegerType),
|
|
744
|
+
maxLogBytes: OptionType(IntegerType),
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* A diagnostic attached to an `invalid` call outcome.
|
|
749
|
+
*/
|
|
750
|
+
export const DiagnosticType = StructType({
|
|
751
|
+
message: StringType,
|
|
752
|
+
filename: OptionType(StringType),
|
|
753
|
+
line: OptionType(IntegerType),
|
|
754
|
+
column: OptionType(IntegerType),
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* The terminal result of a function/one-shot call.
|
|
759
|
+
*
|
|
760
|
+
* - `success`: beast2-encoded result value; decode with the function's `outputType`
|
|
761
|
+
* - `failed`: process exited non-zero (see stderr)
|
|
762
|
+
* - `invalid`: signature/IR error; nothing ran
|
|
763
|
+
* - `too_large`: result over `maxResultBytes`; deploy a task and read it with `datasetGet`
|
|
764
|
+
* - `timed_out`: exceeded `timeoutMs` / the server's sync deadline guard
|
|
765
|
+
*/
|
|
766
|
+
export const ExecuteResultType = StructType({
|
|
767
|
+
outcome: VariantType({
|
|
768
|
+
success: StructType({ value: BlobType }),
|
|
769
|
+
failed: StructType({ exitCode: IntegerType }),
|
|
770
|
+
invalid: StructType({ diagnostics: ArrayType(DiagnosticType) }),
|
|
771
|
+
too_large: StructType({ bytes: IntegerType, limit: IntegerType }),
|
|
772
|
+
timed_out: StructType({ ms: IntegerType }),
|
|
773
|
+
}),
|
|
774
|
+
stdout: StringType,
|
|
775
|
+
stderr: StringType,
|
|
776
|
+
stdoutTruncated: BooleanType,
|
|
777
|
+
stderrTruncated: BooleanType,
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
/** Named function call. Positional args, one beast2-encoded value per param. */
|
|
781
|
+
export const FunctionCallRequestType = StructType({
|
|
782
|
+
args: ArrayType(BlobType),
|
|
783
|
+
runner: OptionType(RunnerType), // optional override; only the known runtimes
|
|
784
|
+
limits: OptionType(ExecuteLimitsType),
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
/** A function signature, returned by `describe` so dynamic callers can encode args. */
|
|
788
|
+
export const FunctionSignatureType = StructType({
|
|
789
|
+
name: StringType,
|
|
790
|
+
inputTypes: ArrayType(EastTypeType),
|
|
791
|
+
outputType: EastTypeType,
|
|
792
|
+
runner: RunnerType,
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
/** Async launch → id; poll returns status + the result once terminal. */
|
|
796
|
+
export const CallStartResultType = StructType({ callId: StringType });
|
|
797
|
+
|
|
798
|
+
/** A function-specific status — do NOT reuse AsyncOperationStatusType, which has
|
|
799
|
+
* only running|succeeded|failed and cannot represent a cancelled call (and
|
|
800
|
+
* mutating it would reorder its sorted variant tags, a breaking change for the
|
|
801
|
+
* GC/repo-delete consumers that share it). */
|
|
802
|
+
export const CallStatusType = VariantType({
|
|
803
|
+
running: NullType,
|
|
804
|
+
succeeded: NullType,
|
|
805
|
+
failed: NullType,
|
|
806
|
+
cancelled: NullType,
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
export const CallStatusResultType = StructType({
|
|
810
|
+
status: CallStatusType,
|
|
811
|
+
result: OptionType(ExecuteResultType), // present once terminal (succeeded/failed)
|
|
812
|
+
error: OptionType(StringType),
|
|
813
|
+
});
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* One-shot execution request: run an anonymous function whose IR is supplied
|
|
817
|
+
* at call time, optionally bound to existing workspace datasets, returning
|
|
818
|
+
* the result inline and persisting nothing.
|
|
819
|
+
*
|
|
820
|
+
* SECURITY: one-shot evaluates a caller-supplied IR — remote code execution
|
|
821
|
+
* with the server's authority. Gate behind an elevated role.
|
|
822
|
+
*/
|
|
823
|
+
export const OneShotRequestType = StructType({
|
|
824
|
+
bodyIr: BlobType, // anonymous EastIR, not deployed
|
|
825
|
+
args: ArrayType(VariantType({ // each arg: an inline value OR a live dataset
|
|
826
|
+
value: BlobType,
|
|
827
|
+
dataset: TreePathType, // workspace-scoped; resolved + pinned by content hash at launch
|
|
828
|
+
})),
|
|
829
|
+
runner: RunnerType,
|
|
830
|
+
limits: OptionType(ExecuteLimitsType),
|
|
831
|
+
});
|
|
832
|
+
|
|
726
833
|
// =============================================================================
|
|
727
834
|
// Value type aliases
|
|
728
835
|
// =============================================================================
|
|
@@ -761,3 +868,12 @@ export type ExecutionListItem = ValueTypeOf<typeof ExecutionListItemType>;
|
|
|
761
868
|
export type TreeKind = ValueTypeOf<typeof TreeKindType>;
|
|
762
869
|
export type ListEntry = ValueTypeOf<typeof ListEntryType>;
|
|
763
870
|
export type DatasetStatusDetail = ValueTypeOf<typeof DatasetStatusDetailType>;
|
|
871
|
+
export type ExecuteLimits = ValueTypeOf<typeof ExecuteLimitsType>;
|
|
872
|
+
export type Diagnostic = ValueTypeOf<typeof DiagnosticType>;
|
|
873
|
+
export type ExecuteResult = ValueTypeOf<typeof ExecuteResultType>;
|
|
874
|
+
export type FunctionCallRequest = ValueTypeOf<typeof FunctionCallRequestType>;
|
|
875
|
+
export type FunctionSignature = ValueTypeOf<typeof FunctionSignatureType>;
|
|
876
|
+
export type CallStartResult = ValueTypeOf<typeof CallStartResultType>;
|
|
877
|
+
export type CallStatus = ValueTypeOf<typeof CallStatusType>;
|
|
878
|
+
export type CallStatusResult = ValueTypeOf<typeof CallStatusResultType>;
|
|
879
|
+
export type OneShotRequest = ValueTypeOf<typeof OneShotRequestType>;
|
package/src/function.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
* Function object types for e3.
|
|
8
|
+
*
|
|
9
|
+
* An `e3.function` is a named, typed function stored in a package and
|
|
10
|
+
* invoked by name with argument values over the CLI and HTTP API. Unlike
|
|
11
|
+
* a task it is not wired to datasets, not part of the dataflow graph, and
|
|
12
|
+
* triggers no recomputation.
|
|
13
|
+
*
|
|
14
|
+
* The function object stores its signature explicitly so `describe` and
|
|
15
|
+
* arity/type validation work from the small function object without
|
|
16
|
+
* loading the IR bundle, and so dynamic callers (CLI literal parsing,
|
|
17
|
+
* non-TS clients) have the types they need to encode arguments.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { StructType, StringType, ArrayType, EastTypeType, ValueTypeOf } from '@elaraai/east';
|
|
21
|
+
import { RunnerType } from './runner.js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Function object stored in the object store, referenced by name from
|
|
25
|
+
* `PackageObject.functions`.
|
|
26
|
+
*/
|
|
27
|
+
export const FunctionObjectType = StructType({
|
|
28
|
+
/** Hash of the encoded EastIR bundle (encodeEastIR), like a task's commandIr object. */
|
|
29
|
+
bodyIr: StringType,
|
|
30
|
+
/** Positional parameter types — the IR's signature, surfaced for arity/type
|
|
31
|
+
* validation and `describe` without decoding the whole IR. */
|
|
32
|
+
inputTypes: ArrayType(EastTypeType),
|
|
33
|
+
/** Return type — used to decode the result `value` blob client-side. */
|
|
34
|
+
outputType: EastTypeType,
|
|
35
|
+
/** Author-chosen runtime; resolved to argv by runnerToArgv. One of the known
|
|
36
|
+
* runtime tags — there is no raw-argv runner for functions. */
|
|
37
|
+
runner: RunnerType,
|
|
38
|
+
});
|
|
39
|
+
export type FunctionObjectType = typeof FunctionObjectType;
|
|
40
|
+
|
|
41
|
+
export type FunctionObject = ValueTypeOf<typeof FunctionObjectType>;
|
package/src/index.ts
CHANGED
|
@@ -67,12 +67,26 @@ export {
|
|
|
67
67
|
type DatasetSchema,
|
|
68
68
|
} from './structure.js';
|
|
69
69
|
|
|
70
|
+
// Runner wire types (functions)
|
|
71
|
+
export {
|
|
72
|
+
RunnerType,
|
|
73
|
+
type RunnerValue,
|
|
74
|
+
runnerToArgv,
|
|
75
|
+
} from './runner.js';
|
|
76
|
+
|
|
77
|
+
// Function objects
|
|
78
|
+
export {
|
|
79
|
+
FunctionObjectType,
|
|
80
|
+
type FunctionObject,
|
|
81
|
+
} from './function.js';
|
|
82
|
+
|
|
70
83
|
// Package objects
|
|
71
84
|
export {
|
|
72
85
|
PackageDataType,
|
|
73
86
|
type PackageData,
|
|
74
87
|
PackageObjectType,
|
|
75
88
|
type PackageObject,
|
|
89
|
+
decodePackageObject,
|
|
76
90
|
// Backwards compatibility
|
|
77
91
|
PackageDatasetsType,
|
|
78
92
|
type PackageDatasets,
|
|
@@ -203,6 +217,16 @@ export {
|
|
|
203
217
|
ListEntryType,
|
|
204
218
|
// Dataset Status Detail
|
|
205
219
|
DatasetStatusDetailType,
|
|
220
|
+
// Function / one-shot execution
|
|
221
|
+
ExecuteLimitsType,
|
|
222
|
+
DiagnosticType,
|
|
223
|
+
ExecuteResultType,
|
|
224
|
+
FunctionCallRequestType,
|
|
225
|
+
FunctionSignatureType,
|
|
226
|
+
CallStartResultType,
|
|
227
|
+
CallStatusType,
|
|
228
|
+
CallStatusResultType,
|
|
229
|
+
OneShotRequestType,
|
|
206
230
|
// Type aliases
|
|
207
231
|
type Error,
|
|
208
232
|
type RepositoryStatus,
|
|
@@ -238,6 +262,15 @@ export {
|
|
|
238
262
|
type TreeKind,
|
|
239
263
|
type ListEntry,
|
|
240
264
|
type DatasetStatusDetail,
|
|
265
|
+
type ExecuteLimits,
|
|
266
|
+
type Diagnostic,
|
|
267
|
+
type ExecuteResult,
|
|
268
|
+
type FunctionCallRequest,
|
|
269
|
+
type FunctionSignature,
|
|
270
|
+
type CallStartResult,
|
|
271
|
+
type CallStatus,
|
|
272
|
+
type CallStatusResult,
|
|
273
|
+
type OneShotRequest,
|
|
241
274
|
} from './api.js';
|
|
242
275
|
|
|
243
276
|
// Dataflow execution state
|