@norskvideo/ctl-sdk 0.1.57 → 0.1.58
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/fleet.d.ts +12 -0
- package/fleet.js +7 -0
- package/manifest-schema.d.ts +21 -1
- package/manifest-schema.js +14 -1
- package/package.json +1 -1
package/fleet.d.ts
CHANGED
|
@@ -109,6 +109,16 @@ export interface FleetOptions {
|
|
|
109
109
|
WebSocket?: new (url: string) => WebSocketLike;
|
|
110
110
|
/** The page's origin, for a live operation's ws(s) URL; the page's own by default. */
|
|
111
111
|
origin?: string;
|
|
112
|
+
/** The page's path, which says which instance it is (RFC 0008); its own by default. */
|
|
113
|
+
path?: string;
|
|
114
|
+
}
|
|
115
|
+
/** The dashboard instance a page is, and how it is configured (RFC 0008). */
|
|
116
|
+
export interface FleetInstance {
|
|
117
|
+
name: string;
|
|
118
|
+
displayName: string;
|
|
119
|
+
/** `<product>/<name>`, for an instance of a product's definition. */
|
|
120
|
+
definition?: string;
|
|
121
|
+
parameters: Record<string, string>;
|
|
112
122
|
}
|
|
113
123
|
export interface Fleet {
|
|
114
124
|
query(selection: FleetSelection): Promise<FleetDirectory>;
|
|
@@ -117,6 +127,8 @@ export interface Fleet {
|
|
|
117
127
|
call<T = unknown>(runtimeId: string, operationId: string, input?: FleetCallInput): Promise<T>;
|
|
118
128
|
/** Open a runtime's declared live operation. */
|
|
119
129
|
live(runtimeId: string, operationId: string, handlers: FleetLiveHandlers, input?: FleetCallInput): Promise<FleetLive>;
|
|
130
|
+
/** Which instance this page is, and its parameters. */
|
|
131
|
+
instance(): Promise<FleetInstance>;
|
|
120
132
|
state: {
|
|
121
133
|
get<T = unknown>(key: string): Promise<FleetStateDocument<T> | undefined>;
|
|
122
134
|
/** Write at `revision` (omit for a new key); a FleetStateConflict when
|
package/fleet.js
CHANGED
|
@@ -94,6 +94,13 @@ export function fleetClient(options = {}) {
|
|
|
94
94
|
socket.addEventListener("close", () => handlers.onClose?.());
|
|
95
95
|
return { send: (data) => socket.send(data), close: () => socket.close() };
|
|
96
96
|
},
|
|
97
|
+
async instance() {
|
|
98
|
+
const path = options.path ?? globalThis.location?.pathname ?? "/";
|
|
99
|
+
const res = await doFetch(`${base}/instance?path=${encodeURIComponent(path)}`, { credentials: "same-origin" });
|
|
100
|
+
if (!res.ok)
|
|
101
|
+
throw new Error(`the dashboard instance answered ${res.status}`);
|
|
102
|
+
return (await res.json());
|
|
103
|
+
},
|
|
97
104
|
state: {
|
|
98
105
|
async get(key) {
|
|
99
106
|
const res = await doFetch(`${base}/state/${encodeURIComponent(key)}`, { credentials: "same-origin" });
|
package/manifest-schema.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare const DefaultProductTemplateSchema: z.ZodObject<{
|
|
|
9
9
|
url: z.ZodString;
|
|
10
10
|
}, z.core.$strip>;
|
|
11
11
|
export type DefaultProductTemplate = z.infer<typeof DefaultProductTemplateSchema>;
|
|
12
|
-
declare const DefaultDashboardSchema: z.ZodObject<{
|
|
12
|
+
export declare const DefaultDashboardSchema: z.ZodObject<{
|
|
13
13
|
name: z.ZodString;
|
|
14
14
|
displayName: z.ZodOptional<z.ZodString>;
|
|
15
15
|
url: z.ZodString;
|
|
@@ -30,6 +30,16 @@ declare const DefaultDashboardSchema: z.ZodObject<{
|
|
|
30
30
|
label: z.ZodString;
|
|
31
31
|
}, z.core.$strip>], "kind">;
|
|
32
32
|
}, z.core.$strip>], "mode">>;
|
|
33
|
+
instances: z.ZodOptional<z.ZodEnum<{
|
|
34
|
+
single: "single";
|
|
35
|
+
many: "many";
|
|
36
|
+
}>>;
|
|
37
|
+
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
purpose: z.ZodString;
|
|
40
|
+
default: z.ZodOptional<z.ZodString>;
|
|
41
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
}, z.core.$strip>>>;
|
|
33
43
|
}, z.core.$strip>;
|
|
34
44
|
export type DefaultDashboard = z.infer<typeof DefaultDashboardSchema>;
|
|
35
45
|
/** One product role (RFC 0003 D5a). The name rule is foundation's, so the
|
|
@@ -246,6 +256,16 @@ export declare const ManifestSchema: z.ZodObject<{
|
|
|
246
256
|
label: z.ZodString;
|
|
247
257
|
}, z.core.$strip>], "kind">;
|
|
248
258
|
}, z.core.$strip>], "mode">>;
|
|
259
|
+
instances: z.ZodOptional<z.ZodEnum<{
|
|
260
|
+
single: "single";
|
|
261
|
+
many: "many";
|
|
262
|
+
}>>;
|
|
263
|
+
parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
264
|
+
name: z.ZodString;
|
|
265
|
+
purpose: z.ZodString;
|
|
266
|
+
default: z.ZodOptional<z.ZodString>;
|
|
267
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
268
|
+
}, z.core.$strip>>>;
|
|
249
269
|
}, z.core.$strip>>>;
|
|
250
270
|
export: z.ZodOptional<z.ZodObject<{
|
|
251
271
|
include: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
package/manifest-schema.js
CHANGED
|
@@ -90,7 +90,7 @@ const DefaultProductTemplateSchema = z.object({
|
|
|
90
90
|
const DashboardLabel = z
|
|
91
91
|
.string()
|
|
92
92
|
.regex(/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/, "one DNS label: lowercase letters, digits and hyphens, 1-63 chars");
|
|
93
|
-
const DefaultDashboardSchema = z.object({
|
|
93
|
+
export const DefaultDashboardSchema = z.object({
|
|
94
94
|
name: DashboardLabel.meta({ description: "The dashboard's name, and its host's label when it has one of its own." }),
|
|
95
95
|
displayName: z.string().min(1).optional(),
|
|
96
96
|
url: z
|
|
@@ -113,6 +113,19 @@ const DefaultDashboardSchema = z.object({
|
|
|
113
113
|
])
|
|
114
114
|
.optional()
|
|
115
115
|
.meta({ description: "The hosting proposed; absent is a host of its own." }),
|
|
116
|
+
// RFC 0008: the entry is a definition, of one instance or many.
|
|
117
|
+
instances: z.enum(["single", "many"]).optional().meta({
|
|
118
|
+
description: "single (the default): one instance, made when the product is added. many: none until an operator makes them, each with its own parameters and host.",
|
|
119
|
+
}),
|
|
120
|
+
parameters: z
|
|
121
|
+
.array(z.object({
|
|
122
|
+
name: z.string().regex(/^[A-Z][A-Z0-9_]*$/, "upper-case letters, digits and underscores"),
|
|
123
|
+
purpose: z.string().min(1),
|
|
124
|
+
default: z.string().optional(),
|
|
125
|
+
required: z.boolean().optional(),
|
|
126
|
+
}))
|
|
127
|
+
.optional()
|
|
128
|
+
.meta({ description: "What each instance is asked for when it is made; the page reads its answers." }),
|
|
116
129
|
});
|
|
117
130
|
/** Save-as-product-template file selection. When the runner exports a running
|
|
118
131
|
* instance's working directory into a new product template, it packs only files
|