@independo/inderun-contracts 0.4.0 → 0.5.0-rc.2
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/generated/artifact-read-request.d.ts +24 -0
- package/dist/generated/artifact-read-request.d.ts.map +1 -0
- package/dist/generated/artifact-read-request.js +2 -0
- package/dist/generated/execution-provenance.d.ts +8 -1
- package/dist/generated/execution-provenance.d.ts.map +1 -1
- package/dist/generated/inderun-error.d.ts +8 -1
- package/dist/generated/inderun-error.d.ts.map +1 -1
- package/dist/generated/index.d.ts +6 -0
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/media-artifact.d.ts +53 -0
- package/dist/generated/media-artifact.d.ts.map +1 -0
- package/dist/generated/media-artifact.js +2 -0
- package/dist/generated/provider-capability-snapshot.d.ts +370 -0
- package/dist/generated/provider-capability-snapshot.d.ts.map +1 -0
- package/dist/generated/provider-capability-snapshot.js +2 -0
- package/dist/generated/provider-descriptor.d.ts +264 -0
- package/dist/generated/provider-descriptor.d.ts.map +1 -0
- package/dist/generated/provider-descriptor.js +2 -0
- package/dist/generated/provider-dynamic-capabilities.d.ts +99 -0
- package/dist/generated/provider-dynamic-capabilities.d.ts.map +1 -0
- package/dist/generated/provider-dynamic-capabilities.js +2 -0
- package/dist/generated/route-plan.d.ts +47 -3
- package/dist/generated/route-plan.d.ts.map +1 -1
- package/dist/generated/route-planner-input.d.ts +417 -32
- package/dist/generated/route-planner-input.d.ts.map +1 -1
- package/dist/generated/schemas.d.ts +833 -115
- package/dist/generated/schemas.d.ts.map +1 -1
- package/dist/generated/schemas.js +1038 -160
- package/dist/generated/stream-event.d.ts +136 -1
- package/dist/generated/stream-event.d.ts.map +1 -1
- package/dist/generated/stream-terminal-outcome.d.ts +182 -18
- package/dist/generated/stream-terminal-outcome.d.ts.map +1 -1
- package/dist/generated/task-output.d.ts +128 -0
- package/dist/generated/task-output.d.ts.map +1 -0
- package/dist/generated/task-output.js +2 -0
- package/dist/generated/task-request.d.ts +116 -11
- package/dist/generated/task-request.d.ts.map +1 -1
- package/dist/generated/task-result.d.ts +139 -15
- package/dist/generated/task-result.d.ts.map +1 -1
- package/dist/generated/telemetry-event.d.ts +2 -2
- package/dist/generated/telemetry-event.d.ts.map +1 -1
- package/dist/host.d.ts +24 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/types.d.ts +46 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/validators.d.ts +18 -0
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +49 -1
- package/package.json +1 -1
- package/src/generated/artifact-read-request.ts +25 -0
- package/src/generated/execution-provenance.ts +8 -1
- package/src/generated/inderun-error.ts +8 -1
- package/src/generated/index.ts +6 -0
- package/src/generated/media-artifact.ts +56 -0
- package/src/generated/provider-capability-snapshot.ts +388 -0
- package/src/generated/provider-descriptor.ts +278 -0
- package/src/generated/provider-dynamic-capabilities.ts +103 -0
- package/src/generated/route-plan.ts +49 -3
- package/src/generated/route-planner-input.ts +437 -36
- package/src/generated/schemas.ts +1044 -160
- package/src/generated/stream-event.ts +145 -1
- package/src/generated/stream-terminal-outcome.ts +191 -18
- package/src/generated/task-output.ts +137 -0
- package/src/generated/task-request.ts +124 -11
- package/src/generated/task-result.ts +147 -15
- package/src/generated/telemetry-event.ts +2 -2
- package/src/host.ts +30 -1
- package/src/index.ts +28 -1
- package/src/types.ts +38 -1
- package/src/validators.ts +76 -0
package/src/validators.ts
CHANGED
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
2
2
|
import type { ErrorObject, ValidateFunction } from "ajv";
|
|
3
3
|
|
|
4
|
+
import type { ArtifactReadRequest } from "./generated/artifact-read-request.js";
|
|
4
5
|
import type { ExecutionProvenance } from "./generated/execution-provenance.js";
|
|
5
6
|
import type { IndeRunError } from "./generated/inderun-error.js";
|
|
7
|
+
import type { MediaArtifact } from "./generated/media-artifact.js";
|
|
6
8
|
import type { HttpRequest } from "./generated/http-request.js";
|
|
7
9
|
import type { HttpResponse } from "./generated/http-response.js";
|
|
8
10
|
import type { ModelPackage } from "./generated/model-package.js";
|
|
11
|
+
import type { ProviderCapabilitySnapshot } from "./generated/provider-capability-snapshot.js";
|
|
12
|
+
import type { ProviderDescriptor } from "./generated/provider-descriptor.js";
|
|
13
|
+
import type { ProviderDynamicCapabilities } from "./generated/provider-dynamic-capabilities.js";
|
|
9
14
|
import type { RoutePlan } from "./generated/route-plan.js";
|
|
10
15
|
import type { RoutePlannerInput } from "./generated/route-planner-input.js";
|
|
11
16
|
import {
|
|
17
|
+
artifactReadRequestSchema,
|
|
12
18
|
executionProvenanceSchema,
|
|
13
19
|
httpRequestSchema,
|
|
14
20
|
httpResponseSchema,
|
|
15
21
|
inderunErrorSchema,
|
|
22
|
+
mediaArtifactSchema,
|
|
16
23
|
modelPackageSchema,
|
|
24
|
+
providerCapabilitySnapshotSchema,
|
|
25
|
+
providerDescriptorSchema,
|
|
26
|
+
providerDynamicCapabilitiesSchema,
|
|
17
27
|
routePlanSchema,
|
|
18
28
|
routePlannerInputSchema,
|
|
19
29
|
streamEventSchema,
|
|
20
30
|
streamRunSchema,
|
|
21
31
|
streamTerminalOutcomeSchema,
|
|
32
|
+
taskOutputSchema,
|
|
22
33
|
taskRequestSchema,
|
|
23
34
|
taskResultSchema,
|
|
24
35
|
telemetryEventSchema
|
|
@@ -26,6 +37,7 @@ import {
|
|
|
26
37
|
import type { StreamEvent } from "./generated/stream-event.js";
|
|
27
38
|
import type { StreamRunHandle } from "./generated/stream-run.js";
|
|
28
39
|
import type { StreamTerminalOutcome } from "./generated/stream-terminal-outcome.js";
|
|
40
|
+
import type { TaskOutput } from "./generated/task-output.js";
|
|
29
41
|
import type { TaskRequest } from "./generated/task-request.js";
|
|
30
42
|
import type { TaskResult } from "./generated/task-result.js";
|
|
31
43
|
import type { TelemetryEvent } from "./generated/telemetry-event.js";
|
|
@@ -50,6 +62,16 @@ const ajv = new Ajv2020Constructor({
|
|
|
50
62
|
// Referenced by `$ref` from every schema that carries provenance, so it has to be known
|
|
51
63
|
// to Ajv before any of them compiles. Compiling it registers it under its `$id`.
|
|
52
64
|
const validateExecutionProvenanceSchema = ajv.compile(executionProvenanceSchema);
|
|
65
|
+
// Likewise, the provider descriptor and dynamic capabilities are referenced from the
|
|
66
|
+
// capability snapshot and the route-planner input.
|
|
67
|
+
const validateProviderDescriptorSchema = ajv.compile(providerDescriptorSchema);
|
|
68
|
+
const validateProviderDynamicCapabilitiesSchema = ajv.compile(providerDynamicCapabilitiesSchema);
|
|
69
|
+
const validateProviderCapabilitySnapshotSchema = ajv.compile(providerCapabilitySnapshotSchema);
|
|
70
|
+
// The normalized output (and the media artifact it references) is shared by the result
|
|
71
|
+
// and both terminal-outcome copies.
|
|
72
|
+
const validateMediaArtifactSchema = ajv.compile(mediaArtifactSchema);
|
|
73
|
+
const validateTaskOutputSchema = ajv.compile(taskOutputSchema);
|
|
74
|
+
const validateArtifactReadRequestSchema = ajv.compile(artifactReadRequestSchema);
|
|
53
75
|
const validateTaskRequestSchema = ajv.compile(taskRequestSchema);
|
|
54
76
|
const validateTaskResultSchema = ajv.compile(taskResultSchema);
|
|
55
77
|
const validateIndeRunErrorSchema = ajv.compile(inderunErrorSchema);
|
|
@@ -71,6 +93,18 @@ export function validateTaskResult(value: unknown): value is TaskResult {
|
|
|
71
93
|
return getTaskResultValidationIssues(value).length === 0;
|
|
72
94
|
}
|
|
73
95
|
|
|
96
|
+
export function validateTaskOutput(value: unknown): value is TaskOutput {
|
|
97
|
+
return getTaskOutputValidationIssues(value).length === 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function validateMediaArtifact(value: unknown): value is MediaArtifact {
|
|
101
|
+
return getMediaArtifactValidationIssues(value).length === 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function validateArtifactReadRequest(value: unknown): value is ArtifactReadRequest {
|
|
105
|
+
return getArtifactReadRequestValidationIssues(value).length === 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
74
108
|
export function validateIndeRunError(value: unknown): value is IndeRunError {
|
|
75
109
|
return getIndeRunErrorValidationIssues(value).length === 0;
|
|
76
110
|
}
|
|
@@ -99,6 +133,22 @@ export function validateModelPackage(value: unknown): value is ModelPackage {
|
|
|
99
133
|
return getModelPackageValidationIssues(value).length === 0;
|
|
100
134
|
}
|
|
101
135
|
|
|
136
|
+
export function validateProviderDescriptor(value: unknown): value is ProviderDescriptor {
|
|
137
|
+
return getProviderDescriptorValidationIssues(value).length === 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function validateProviderDynamicCapabilities(
|
|
141
|
+
value: unknown
|
|
142
|
+
): value is ProviderDynamicCapabilities {
|
|
143
|
+
return getProviderDynamicCapabilitiesValidationIssues(value).length === 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function validateProviderCapabilitySnapshot(
|
|
147
|
+
value: unknown
|
|
148
|
+
): value is ProviderCapabilitySnapshot {
|
|
149
|
+
return getProviderCapabilitySnapshotValidationIssues(value).length === 0;
|
|
150
|
+
}
|
|
151
|
+
|
|
102
152
|
export function validateStreamRunHandle(value: unknown): value is StreamRunHandle {
|
|
103
153
|
return getStreamRunHandleValidationIssues(value).length === 0;
|
|
104
154
|
}
|
|
@@ -126,6 +176,20 @@ export function getTaskResultValidationIssues(value: unknown): ValidationIssue[]
|
|
|
126
176
|
});
|
|
127
177
|
}
|
|
128
178
|
|
|
179
|
+
export function getTaskOutputValidationIssues(value: unknown): ValidationIssue[] {
|
|
180
|
+
return getValidationIssues(validateTaskOutputSchema, value, {
|
|
181
|
+
forbidInlineSecrets: true
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function getMediaArtifactValidationIssues(value: unknown): ValidationIssue[] {
|
|
186
|
+
return getValidationIssues(validateMediaArtifactSchema, value);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function getArtifactReadRequestValidationIssues(value: unknown): ValidationIssue[] {
|
|
190
|
+
return getValidationIssues(validateArtifactReadRequestSchema, value);
|
|
191
|
+
}
|
|
192
|
+
|
|
129
193
|
export function getIndeRunErrorValidationIssues(value: unknown): ValidationIssue[] {
|
|
130
194
|
return getValidationIssues(validateIndeRunErrorSchema, value, {
|
|
131
195
|
forbidInlineSecrets: true
|
|
@@ -170,6 +234,18 @@ export function getModelPackageValidationIssues(value: unknown): ValidationIssue
|
|
|
170
234
|
});
|
|
171
235
|
}
|
|
172
236
|
|
|
237
|
+
export function getProviderDescriptorValidationIssues(value: unknown): ValidationIssue[] {
|
|
238
|
+
return getValidationIssues(validateProviderDescriptorSchema, value);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export function getProviderDynamicCapabilitiesValidationIssues(value: unknown): ValidationIssue[] {
|
|
242
|
+
return getValidationIssues(validateProviderDynamicCapabilitiesSchema, value);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function getProviderCapabilitySnapshotValidationIssues(value: unknown): ValidationIssue[] {
|
|
246
|
+
return getValidationIssues(validateProviderCapabilitySnapshotSchema, value);
|
|
247
|
+
}
|
|
248
|
+
|
|
173
249
|
export function getStreamRunHandleValidationIssues(value: unknown): ValidationIssue[] {
|
|
174
250
|
return getValidationIssues(validateStreamRunHandleSchema, value);
|
|
175
251
|
}
|