@xeonr/pipelines-sdk 0.2.0 → 0.3.0
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 +172 -16
- package/dist/client.d.ts +63 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +43 -1
- package/dist/client.js.map +1 -1
- package/dist/gen/xeonr/pipelines/private/v1/attempt_pb.d.ts +173 -12
- package/dist/gen/xeonr/pipelines/private/v1/attempt_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/private/v1/attempt_pb.js +45 -28
- package/dist/gen/xeonr/pipelines/private/v1/attempt_pb.js.map +1 -1
- package/dist/gen/xeonr/pipelines/private/v1/step_local_pb.d.ts +136 -17
- package/dist/gen/xeonr/pipelines/private/v1/step_local_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/private/v1/step_local_pb.js +42 -35
- package/dist/gen/xeonr/pipelines/private/v1/step_local_pb.js.map +1 -1
- package/dist/gen/xeonr/pipelines/private/v1/worker_pb.d.ts +187 -2
- package/dist/gen/xeonr/pipelines/private/v1/worker_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/private/v1/worker_pb.js +38 -5
- package/dist/gen/xeonr/pipelines/private/v1/worker_pb.js.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/common_pb.d.ts +4 -2
- package/dist/gen/xeonr/pipelines/v1/common_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/common_pb.js +4 -2
- package/dist/gen/xeonr/pipelines/v1/common_pb.js.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/definition_pb.d.ts +277 -4
- package/dist/gen/xeonr/pipelines/v1/definition_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/definition_pb.js +100 -7
- package/dist/gen/xeonr/pipelines/v1/definition_pb.js.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/pipelines_pb.d.ts +1100 -0
- package/dist/gen/xeonr/pipelines/v1/pipelines_pb.d.ts.map +1 -0
- package/dist/gen/xeonr/pipelines/v1/pipelines_pb.js +298 -0
- package/dist/gen/xeonr/pipelines/v1/pipelines_pb.js.map +1 -0
- package/dist/gen/xeonr/pipelines/v1/pools_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/pools_pb.js +1 -1
- package/dist/gen/xeonr/pipelines/v1/pools_pb.js.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/queues_pb.d.ts +769 -0
- package/dist/gen/xeonr/pipelines/v1/queues_pb.d.ts.map +1 -0
- package/dist/gen/xeonr/pipelines/v1/queues_pb.js +190 -0
- package/dist/gen/xeonr/pipelines/v1/queues_pb.js.map +1 -0
- package/dist/gen/xeonr/pipelines/v1/registry_pb.d.ts +60 -0
- package/dist/gen/xeonr/pipelines/v1/registry_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/registry_pb.js +21 -16
- package/dist/gen/xeonr/pipelines/v1/registry_pb.js.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/runs_pb.d.ts +846 -3
- package/dist/gen/xeonr/pipelines/v1/runs_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/runs_pb.js +243 -27
- package/dist/gen/xeonr/pipelines/v1/runs_pb.js.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/schedules_pb.d.ts +1110 -0
- package/dist/gen/xeonr/pipelines/v1/schedules_pb.d.ts.map +1 -0
- package/dist/gen/xeonr/pipelines/v1/schedules_pb.js +295 -0
- package/dist/gen/xeonr/pipelines/v1/schedules_pb.js.map +1 -0
- package/dist/gen/xeonr/pipelines/v1/secrets_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/pipelines/v1/secrets_pb.js +1 -1
- package/dist/gen/xeonr/pipelines/v1/secrets_pb.js.map +1 -1
- package/dist/gen/xeonr/platform/v1/options_pb.d.ts +123 -1
- package/dist/gen/xeonr/platform/v1/options_pb.d.ts.map +1 -1
- package/dist/gen/xeonr/platform/v1/options_pb.js +90 -1
- package/dist/gen/xeonr/platform/v1/options_pb.js.map +1 -1
- package/dist/handler.d.ts +50 -0
- package/dist/handler.d.ts.map +1 -1
- package/dist/handler.js +27 -0
- package/dist/handler.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/queues.d.ts +171 -0
- package/dist/queues.d.ts.map +1 -0
- package/dist/queues.js +135 -0
- package/dist/queues.js.map +1 -0
- package/dist/reporter.d.ts +120 -0
- package/dist/reporter.d.ts.map +1 -0
- package/dist/reporter.js +323 -0
- package/dist/reporter.js.map +1 -0
- package/dist/schedules.d.ts +201 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/schedules.js +127 -0
- package/dist/schedules.js.map +1 -0
- package/dist/testing/cron.d.ts +33 -0
- package/dist/testing/cron.d.ts.map +1 -0
- package/dist/testing/cron.js +177 -0
- package/dist/testing/cron.js.map +1 -0
- package/dist/testing/index.d.ts +129 -4
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +723 -30
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/queues.d.ts +46 -0
- package/dist/testing/queues.d.ts.map +1 -0
- package/dist/testing/queues.js +70 -0
- package/dist/testing/queues.js.map +1 -0
- package/dist/testing/schedules.d.ts +113 -0
- package/dist/testing/schedules.d.ts.map +1 -0
- package/dist/testing/schedules.js +419 -0
- package/dist/testing/schedules.js.map +1 -0
- package/dist/worker.d.ts +48 -1
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +67 -6
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ import { file_google_protobuf_descriptor } from "@bufbuild/protobuf/wkt";
|
|
|
24
24
|
/**
|
|
25
25
|
* Describes the file xeonr/platform/v1/options.proto.
|
|
26
26
|
*/
|
|
27
|
-
export const file_xeonr_platform_v1_options = /*@__PURE__*/ fileDesc("
|
|
27
|
+
export const file_xeonr_platform_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lZaVHByb3RvLnByb2Qud3RmL2dlbi9nby94ZW9uci9wbGF0Zm9ybS9wcm90b2NvbGJ1ZmZlcnMvZ28veGVvbnIvcGxhdGZvcm0vdjE7cGxhdGZvcm12MWIGcHJvdG8z", [file_google_protobuf_descriptor]);
|
|
28
28
|
/**
|
|
29
29
|
* Describes the message xeonr.platform.v1.McpTool.
|
|
30
30
|
* Use `create(McpToolSchema)` to create a new message.
|
|
@@ -40,6 +40,11 @@ export const McpToolsetSchema = /*@__PURE__*/ messageDesc(file_xeonr_platform_v1
|
|
|
40
40
|
* Use `create(McpProductSchema)` to create a new message.
|
|
41
41
|
*/
|
|
42
42
|
export const McpProductSchema = /*@__PURE__*/ messageDesc(file_xeonr_platform_v1_options, 2);
|
|
43
|
+
/**
|
|
44
|
+
* Describes the message xeonr.platform.v1.McpExclusion.
|
|
45
|
+
* Use `create(McpExclusionSchema)` to create a new message.
|
|
46
|
+
*/
|
|
47
|
+
export const McpExclusionSchema = /*@__PURE__*/ messageDesc(file_xeonr_platform_v1_options, 3);
|
|
43
48
|
/**
|
|
44
49
|
* McpTier says whether the gateway lists a tool or only finds it on request.
|
|
45
50
|
*
|
|
@@ -96,6 +101,70 @@ export var McpEffect;
|
|
|
96
101
|
* Describes the enum xeonr.platform.v1.McpEffect.
|
|
97
102
|
*/
|
|
98
103
|
export const McpEffectSchema = /*@__PURE__*/ enumDesc(file_xeonr_platform_v1_options, 1);
|
|
104
|
+
/**
|
|
105
|
+
* McpExcluded is why an RPC is deliberately not an MCP tool.
|
|
106
|
+
*
|
|
107
|
+
* @generated from enum xeonr.platform.v1.McpExcluded
|
|
108
|
+
*/
|
|
109
|
+
export var McpExcluded;
|
|
110
|
+
(function (McpExcluded) {
|
|
111
|
+
/**
|
|
112
|
+
* @generated from enum value: MCP_EXCLUDED_UNSPECIFIED = 0;
|
|
113
|
+
*/
|
|
114
|
+
McpExcluded[McpExcluded["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
115
|
+
/**
|
|
116
|
+
* Sign-in, passkey, consent, OAuth and session flows a browser drives.
|
|
117
|
+
*
|
|
118
|
+
* @generated from enum value: MCP_EXCLUDED_INTERACTIVE_AUTH = 1;
|
|
119
|
+
*/
|
|
120
|
+
McpExcluded[McpExcluded["INTERACTIVE_AUTH"] = 1] = "INTERACTIVE_AUTH";
|
|
121
|
+
/**
|
|
122
|
+
* Called by a machine, not a person: runner, agent, webhook,
|
|
123
|
+
* service-to-service, controller callbacks.
|
|
124
|
+
*
|
|
125
|
+
* @generated from enum value: MCP_EXCLUDED_MACHINE_PROTOCOL = 2;
|
|
126
|
+
*/
|
|
127
|
+
McpExcluded[McpExcluded["MACHINE_PROTOCOL"] = 2] = "MACHINE_PROTOCOL";
|
|
128
|
+
/**
|
|
129
|
+
* Moves bytes (uploads, downloads, chunked transfers) a model cannot carry
|
|
130
|
+
* as JSON arguments or results.
|
|
131
|
+
*
|
|
132
|
+
* @generated from enum value: MCP_EXCLUDED_BYTE_TRANSFER = 3;
|
|
133
|
+
*/
|
|
134
|
+
McpExcluded[McpExcluded["BYTE_TRANSFER"] = 3] = "BYTE_TRANSFER";
|
|
135
|
+
/**
|
|
136
|
+
* Needs a principal the gateway cannot carry (an API key, an automation
|
|
137
|
+
* key, a service account, a device). McpExclusion.ticket names the ticket
|
|
138
|
+
* that would lift it.
|
|
139
|
+
*
|
|
140
|
+
* @generated from enum value: MCP_EXCLUDED_NOT_PERSON_CALLABLE = 4;
|
|
141
|
+
*/
|
|
142
|
+
McpExcluded[McpExcluded["NOT_PERSON_CALLABLE"] = 4] = "NOT_PERSON_CALLABLE";
|
|
143
|
+
/**
|
|
144
|
+
* Another tool of the same product covers it. McpExclusion.superseded_by
|
|
145
|
+
* names that tool.
|
|
146
|
+
*
|
|
147
|
+
* @generated from enum value: MCP_EXCLUDED_SUPERSEDED = 5;
|
|
148
|
+
*/
|
|
149
|
+
McpExcluded[McpExcluded["SUPERSEDED"] = 5] = "SUPERSEDED";
|
|
150
|
+
/**
|
|
151
|
+
* Platform staff operations (require_admin and the like) that a person's
|
|
152
|
+
* gateway connection should not reach.
|
|
153
|
+
*
|
|
154
|
+
* @generated from enum value: MCP_EXCLUDED_PLATFORM_ADMIN = 6;
|
|
155
|
+
*/
|
|
156
|
+
McpExcluded[McpExcluded["PLATFORM_ADMIN"] = 6] = "PLATFORM_ADMIN";
|
|
157
|
+
/**
|
|
158
|
+
* None of the above. McpExclusion.detail says why.
|
|
159
|
+
*
|
|
160
|
+
* @generated from enum value: MCP_EXCLUDED_OTHER = 7;
|
|
161
|
+
*/
|
|
162
|
+
McpExcluded[McpExcluded["OTHER"] = 7] = "OTHER";
|
|
163
|
+
})(McpExcluded || (McpExcluded = {}));
|
|
164
|
+
/**
|
|
165
|
+
* Describes the enum xeonr.platform.v1.McpExcluded.
|
|
166
|
+
*/
|
|
167
|
+
export const McpExcludedSchema = /*@__PURE__*/ enumDesc(file_xeonr_platform_v1_options, 2);
|
|
99
168
|
/**
|
|
100
169
|
* no_authentication marks a method callable without a bearer token. A
|
|
101
170
|
* bearer that IS presented is still verified and, when valid, placed on the
|
|
@@ -232,4 +301,24 @@ export const mcp_hidden = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options,
|
|
|
232
301
|
* @generated from extension: string mcp_description = 9902;
|
|
233
302
|
*/
|
|
234
303
|
export const mcp_description = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 13);
|
|
304
|
+
/**
|
|
305
|
+
* mcp_exclude marks a unary RPC as deliberately not an MCP tool.
|
|
306
|
+
*
|
|
307
|
+
* @generated from extension: xeonr.platform.v1.McpExclusion mcp_exclude = 9911;
|
|
308
|
+
*/
|
|
309
|
+
export const mcp_exclude = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 14);
|
|
310
|
+
/**
|
|
311
|
+
* mcp_exclude_service excludes every method of the service that does not
|
|
312
|
+
* carry mcp_tool or its own mcp_exclude.
|
|
313
|
+
*
|
|
314
|
+
* @generated from extension: xeonr.platform.v1.McpExclusion mcp_exclude_service = 9900;
|
|
315
|
+
*/
|
|
316
|
+
export const mcp_exclude_service = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 15);
|
|
317
|
+
/**
|
|
318
|
+
* mcp_exclude_file excludes every method of every service in the file
|
|
319
|
+
* that does not carry mcp_tool or its own exclusion.
|
|
320
|
+
*
|
|
321
|
+
* @generated from extension: xeonr.platform.v1.McpExclusion mcp_exclude_file = 9900;
|
|
322
|
+
*/
|
|
323
|
+
export const mcp_exclude_file = /*@__PURE__*/ extDesc(file_xeonr_platform_v1_options, 16);
|
|
235
324
|
//# sourceMappingURL=options_pb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options_pb.js","sourceRoot":"","sources":["../../../../../src/gen/xeonr/platform/v1/options_pb.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAC5E,+EAA+E;AAC/E,4EAA4E;AAC5E,kEAAkE;AAClE,2EAA2E;AAC3E,EAAE;AACF,2EAA2E;AAC3E,0DAA0D;AAC1D,EAAE;AACF,0EAA0E;AAC1E,oEAAoE;AACpE,iEAAiE;AACjE,8EAA8E;AAC9E,8EAA8E;AAC9E,2BAA2B;AAO3B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAExF,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAGzE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAY,aAAa,CAClE,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"options_pb.js","sourceRoot":"","sources":["../../../../../src/gen/xeonr/platform/v1/options_pb.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kEAAkE;AAClE,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E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AAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAA8C,aAAa,CACjF,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA+C,aAAa,CAC1F,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA4C,aAAa,CACpF,OAAO,CAAC,8BAA8B,EAAE,EAAE,CAAC,CAAC"}
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { JsonObject, JsonValue, MessageInitShape } from "@bufbuild/protobuf";
|
|
2
2
|
import type { InputSlotSchema, OutputSlotSchema } from "./gen/xeonr/pipelines/v1/registry_pb.js";
|
|
3
|
+
import type { IssueInput, ProgressUpdate, SpanHandle, StageDef } from "./reporter.js";
|
|
4
|
+
import type { ScheduleTargetJson } from "./schedules.js";
|
|
3
5
|
/** The `<namespace>/<name>` pattern the contract holds handler names to. */
|
|
4
6
|
export declare const HANDLER_NAME: RegExp;
|
|
5
7
|
/** One attempt of a node, as the handler running it sees it. */
|
|
@@ -48,6 +50,34 @@ export interface HandlerContext<I> {
|
|
|
48
50
|
readonly attempt: AttemptInfo;
|
|
49
51
|
/** The attempt's log in pipelines. */
|
|
50
52
|
readonly log: AttemptLogger;
|
|
53
|
+
/**
|
|
54
|
+
* Enters a stage: one the handler declares in `stages`, or a new one,
|
|
55
|
+
* added with weight 0. Entering a stage finishes the one before it; the
|
|
56
|
+
* last one is finished when the handler returns (or fails). Pass `state`
|
|
57
|
+
* to finish or skip the current stage explicitly.
|
|
58
|
+
*/
|
|
59
|
+
stage(key: string, opts?: {
|
|
60
|
+
name?: string;
|
|
61
|
+
state?: "running" | "succeeded" | "failed" | "skipped";
|
|
62
|
+
message?: string;
|
|
63
|
+
}): void;
|
|
64
|
+
/**
|
|
65
|
+
* Reports progress within the current stage (or the attempt as a whole):
|
|
66
|
+
* items processed, total and failed, a fraction, a message. Sent about
|
|
67
|
+
* once a second at most, and once more before the attempt completes.
|
|
68
|
+
*/
|
|
69
|
+
progress(update: ProgressUpdate): void;
|
|
70
|
+
/**
|
|
71
|
+
* Reports a structured, non-fatal problem with one item of the work. The
|
|
72
|
+
* run can still succeed; it carries the issues. Batched, never fails the
|
|
73
|
+
* handler.
|
|
74
|
+
*/
|
|
75
|
+
issue(issue: IssueInput): void;
|
|
76
|
+
/**
|
|
77
|
+
* Runs `fn` inside a span of the attempt's trace, recorded with
|
|
78
|
+
* `ReportSpans` (status `error` when `fn` throws, which is rethrown).
|
|
79
|
+
*/
|
|
80
|
+
span<T>(name: string, fn: (span: SpanHandle) => Promise<T> | T, attributes?: JsonObject): Promise<T>;
|
|
51
81
|
}
|
|
52
82
|
/** kv outputs a handler returns, by output slot. */
|
|
53
83
|
export type HandlerOutputs = Record<string, JsonValue>;
|
|
@@ -69,6 +99,14 @@ export interface HandlerDefinition<I = JsonObject, O extends HandlerOutputs | vo
|
|
|
69
99
|
/** Resource kinds the handler accepts; empty accepts any. */
|
|
70
100
|
readonly resourceKinds?: string[];
|
|
71
101
|
readonly readmeMd?: string;
|
|
102
|
+
/** The handler's title for people ("Image convert"); empty shows the name. */
|
|
103
|
+
readonly title?: string;
|
|
104
|
+
/**
|
|
105
|
+
* The stages the handler's work goes through, in order, published in the
|
|
106
|
+
* manifest so a console can draw them before the attempt starts. Enter
|
|
107
|
+
* each with `ctx.stage(key)`.
|
|
108
|
+
*/
|
|
109
|
+
readonly stages?: readonly StageDef[];
|
|
72
110
|
/**
|
|
73
111
|
* The most attempts of this handler one worker process runs at once.
|
|
74
112
|
* Default: the worker's overall concurrency.
|
|
@@ -91,4 +129,16 @@ export interface HandlerDefinition<I = JsonObject, O extends HandlerOutputs | vo
|
|
|
91
129
|
* register it with `worker.handle`.
|
|
92
130
|
*/
|
|
93
131
|
export declare function defineHandler<I = JsonObject, O extends HandlerOutputs | void = HandlerOutputs | void>(def: HandlerDefinition<I, O>): HandlerDefinition<I, O>;
|
|
132
|
+
/**
|
|
133
|
+
* Defines a schedule's enumeration handler: at each occurrence it returns
|
|
134
|
+
* the targets the schedule fans out to, published as the kv output
|
|
135
|
+
* `targets` the platform reads.
|
|
136
|
+
*/
|
|
137
|
+
export declare function defineEnumerator<I = JsonObject>(def: Omit<HandlerDefinition<I, {
|
|
138
|
+
targets: JsonValue;
|
|
139
|
+
}>, "run" | "outputs"> & {
|
|
140
|
+
run: (ctx: HandlerContext<I>) => Promise<readonly ScheduleTargetJson[]> | readonly ScheduleTargetJson[];
|
|
141
|
+
}): HandlerDefinition<I, {
|
|
142
|
+
targets: JsonValue;
|
|
143
|
+
}>;
|
|
94
144
|
//# sourceMappingURL=handler.d.ts.map
|
package/dist/handler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,4EAA4E;AAC5E,eAAO,MAAM,YAAY,QAAuD,CAAC;AAGjF,gEAAgE;AAChE,M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AAC,SAAS,kBAAkB,EAAE,CAAC,GAAG,SAAS,kBAAkB,EAAE,CAAC;CACzG,GAAG,iBAAiB,CAAC,CAAC,EAAE;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC,CAM/C"}
|
package/dist/handler.js
CHANGED
|
@@ -10,9 +10,36 @@ export function defineHandler(def) {
|
|
|
10
10
|
throw new TypeError(`defineHandler: ${JSON.stringify(def.name)} is not <namespace>/<name>`);
|
|
11
11
|
if (!VERSION.test(def.version))
|
|
12
12
|
throw new TypeError(`defineHandler: ${JSON.stringify(def.version)} is not a semantic version`);
|
|
13
|
+
const keys = new Set();
|
|
14
|
+
for (const st of def.stages ?? []) {
|
|
15
|
+
if (!/^[a-z][a-z0-9_.-]{0,63}$/.test(st.key))
|
|
16
|
+
throw new TypeError(`defineHandler: stage key ${JSON.stringify(st.key)} is not valid`);
|
|
17
|
+
if (keys.has(st.key))
|
|
18
|
+
throw new TypeError(`defineHandler: stage ${st.key} is declared twice`);
|
|
19
|
+
if (!st.name || st.name.length > 128)
|
|
20
|
+
throw new TypeError(`defineHandler: stage ${st.key} needs a name of at most 128 characters`);
|
|
21
|
+
if (st.weight !== undefined && (!Number.isInteger(st.weight) || st.weight < 0 || st.weight > 1000)) {
|
|
22
|
+
throw new TypeError(`defineHandler: stage ${st.key}'s weight must be an integer from 0 to 1000`);
|
|
23
|
+
}
|
|
24
|
+
keys.add(st.key);
|
|
25
|
+
}
|
|
26
|
+
if ((def.stages?.length ?? 0) > 32)
|
|
27
|
+
throw new TypeError("defineHandler: at most 32 stages");
|
|
13
28
|
if (def.concurrency !== undefined && (!Number.isInteger(def.concurrency) || def.concurrency < 1)) {
|
|
14
29
|
throw new TypeError("defineHandler: concurrency must be a positive integer");
|
|
15
30
|
}
|
|
16
31
|
return def;
|
|
17
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Defines a schedule's enumeration handler: at each occurrence it returns
|
|
35
|
+
* the targets the schedule fans out to, published as the kv output
|
|
36
|
+
* `targets` the platform reads.
|
|
37
|
+
*/
|
|
38
|
+
export function defineEnumerator(def) {
|
|
39
|
+
return defineHandler({
|
|
40
|
+
...def,
|
|
41
|
+
outputs: [{ name: "targets", type: 1, required: true }],
|
|
42
|
+
run: async (ctx) => ({ targets: (await def.run(ctx)) }),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
18
45
|
//# sourceMappingURL=handler.js.map
|
package/dist/handler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAKA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,YAAY,GAAG,oDAAoD,CAAC;AACjF,MAAM,OAAO,GAAG,4CAA4C,CAAC;AAuH7D;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,GAA4B;IAE5B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAC9H,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC/H,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,EAAE,IAAI,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QAClC,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,SAAS,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,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,EAAE,IAAI,EAAE,CAAC;QACvD,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAyB,EAAE,CAAC;KAChF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -27,4 +27,15 @@ export { AttemptState, FailureClass, NodeState, RunState, Termination } from "./
|
|
|
27
27
|
export { Visibility, SlotType } from "./gen/xeonr/pipelines/v1/registry_pb.js";
|
|
28
28
|
export { HandlerFailureKind } from "./gen/xeonr/pipelines/private/v1/worker_pb.js";
|
|
29
29
|
export type { Run, NodeRun, Attempt } from "./gen/xeonr/pipelines/v1/runs_pb.js";
|
|
30
|
+
export { declareQueues, productFromToken, QueuesClient } from "./queues.js";
|
|
31
|
+
export type { QueueDecl, QueueRef, QueuesClientOptions } from "./queues.js";
|
|
32
|
+
export { declareSchedules, SchedulesClient } from "./schedules.js";
|
|
33
|
+
export type { ScheduleDecl, ScheduleJobDecl, SchedulesClientOptions, ScheduleTargetJson } from "./schedules.js";
|
|
34
|
+
export { defineEnumerator } from "./handler.js";
|
|
35
|
+
export type { IssueInput, ProgressUpdate, SpanHandle, StageDef } from "./reporter.js";
|
|
36
|
+
export { IssueSeverity, RunOrigin, RunTrigger, StageState } from "./gen/xeonr/pipelines/v1/runs_pb.js";
|
|
37
|
+
export type { RunIssue, TraceSpan, AttemptProgress } from "./gen/xeonr/pipelines/v1/runs_pb.js";
|
|
38
|
+
export type { Queue } from "./gen/xeonr/pipelines/v1/queues_pb.js";
|
|
39
|
+
export { MisfirePolicy, OccurrenceOutcome } from "./gen/xeonr/pipelines/v1/schedules_pb.js";
|
|
40
|
+
export type { Schedule } from "./gen/xeonr/pipelines/v1/schedules_pb.js";
|
|
30
41
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACvG,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAChG,YAAY,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC5F,YAAY,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,4 +21,9 @@ export { consoleLogger, Worker } from "./worker.js";
|
|
|
21
21
|
export { AttemptState, FailureClass, NodeState, RunState, Termination } from "./gen/xeonr/pipelines/v1/common_pb.js";
|
|
22
22
|
export { Visibility, SlotType } from "./gen/xeonr/pipelines/v1/registry_pb.js";
|
|
23
23
|
export { HandlerFailureKind } from "./gen/xeonr/pipelines/private/v1/worker_pb.js";
|
|
24
|
+
export { declareQueues, productFromToken, QueuesClient } from "./queues.js";
|
|
25
|
+
export { declareSchedules, SchedulesClient } from "./schedules.js";
|
|
26
|
+
export { defineEnumerator } from "./handler.js";
|
|
27
|
+
export { IssueSeverity, RunOrigin, RunTrigger, StageState } from "./gen/xeonr/pipelines/v1/runs_pb.js";
|
|
28
|
+
export { MisfirePolicy, OccurrenceOutcome } from "./gen/xeonr/pipelines/v1/schedules_pb.js";
|
|
24
29
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEvJ,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpD,0DAA0D;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEvJ,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpD,0DAA0D;AAC1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACrH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGvG,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC"}
|
package/dist/queues.d.ts
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { MessageInitShape } from "@bufbuild/protobuf";
|
|
2
|
+
import type { Client } from "@connectrpc/connect";
|
|
3
|
+
import type { RunState } from "./gen/xeonr/pipelines/v1/common_pb.js";
|
|
4
|
+
import type { RetrySchema } from "./gen/xeonr/pipelines/v1/definition_pb.js";
|
|
5
|
+
import { QueuesService } from "./gen/xeonr/pipelines/v1/queues_pb.js";
|
|
6
|
+
import type { GetQueueStatsResponse, Queue } from "./gen/xeonr/pipelines/v1/queues_pb.js";
|
|
7
|
+
import type { Run } from "./gen/xeonr/pipelines/v1/runs_pb.js";
|
|
8
|
+
import type { Connection } from "./transport.js";
|
|
9
|
+
/** Options for {@link QueuesClient}. */
|
|
10
|
+
export type QueuesClientOptions = Connection & {
|
|
11
|
+
/**
|
|
12
|
+
* The product (Auth application id) whose queues these are: the caller's
|
|
13
|
+
* own. A queue's owner always names it. See {@link productFromToken}.
|
|
14
|
+
*/
|
|
15
|
+
product: string;
|
|
16
|
+
/** Bound on each call. Default 30 s. */
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* A queue as a product declares it. Every field but `name` is optional and
|
|
21
|
+
* takes the contract's default (no cap, no rate limit, the platform's retry
|
|
22
|
+
* and timeout, priority 1).
|
|
23
|
+
*/
|
|
24
|
+
export interface QueueDecl {
|
|
25
|
+
/** `^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$`; `default` is the product's default queue. */
|
|
26
|
+
name: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
/** Makes the queue that team's own; unset serves every tenant the product acts for. */
|
|
29
|
+
tenant?: string;
|
|
30
|
+
/** Caps the queue's claimed and running attempts, all tenants together. */
|
|
31
|
+
maxConcurrency?: number;
|
|
32
|
+
/** Caps one tenant's claimed and running attempts in the queue. */
|
|
33
|
+
maxConcurrencyPerTenant?: number;
|
|
34
|
+
/** At most `limit` attempts claimed per sliding `windowMs`, retries included. */
|
|
35
|
+
rateLimit?: {
|
|
36
|
+
limit: number;
|
|
37
|
+
windowMs: number;
|
|
38
|
+
};
|
|
39
|
+
/** The retry of a job that gives none, and the most a job may ask for. */
|
|
40
|
+
defaultRetry?: MessageInitShape<typeof RetrySchema>;
|
|
41
|
+
/** The timeout of a job that gives none, and the most a job may ask for. */
|
|
42
|
+
defaultTimeoutMs?: number;
|
|
43
|
+
/** Lower first, across a product's queues a worker could claim from. Zero means 1. */
|
|
44
|
+
priority?: number;
|
|
45
|
+
}
|
|
46
|
+
/** A queue to read: by id, or by name (the product's, optionally a team's own). */
|
|
47
|
+
export type QueueRef = {
|
|
48
|
+
id: string;
|
|
49
|
+
} | {
|
|
50
|
+
name: string;
|
|
51
|
+
tenant?: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* The client for `QueuesService`: the lanes a product's jobs are admitted
|
|
55
|
+
* through, with their limits and fairness. Needs `pipelines:queue:edit` to
|
|
56
|
+
* change queues and `pipelines:queue:read` to read them.
|
|
57
|
+
*
|
|
58
|
+
* Jobs name a queue with `PipelinesClient.createJob({ queue })`; a job with
|
|
59
|
+
* none goes to the product's `default` queue.
|
|
60
|
+
*/
|
|
61
|
+
export declare class QueuesClient {
|
|
62
|
+
/** The generated client, for anything not wrapped here. */
|
|
63
|
+
readonly queues: Client<typeof QueuesService>;
|
|
64
|
+
private readonly runs;
|
|
65
|
+
readonly product: string;
|
|
66
|
+
private readonly timeoutMs;
|
|
67
|
+
constructor(opts: QueuesClientOptions);
|
|
68
|
+
/**
|
|
69
|
+
* Sets a queue (`SetQueue`): creates it, or replaces every writable field
|
|
70
|
+
* of the one with that owner and name. Pause and resume are separate.
|
|
71
|
+
*/
|
|
72
|
+
setQueue(decl: QueueDecl, signal?: AbortSignal): Promise<{
|
|
73
|
+
queue: Queue;
|
|
74
|
+
created: boolean;
|
|
75
|
+
}>;
|
|
76
|
+
/** Reads one queue (`GetQueue`). The `default` queue reads as unlimited until it is set. */
|
|
77
|
+
getQueue(ref: QueueRef, signal?: AbortSignal): Promise<Queue>;
|
|
78
|
+
/** Lists this product's queues (`ListQueues`), by priority then name. */
|
|
79
|
+
listQueues(input?: {
|
|
80
|
+
tenant?: string;
|
|
81
|
+
cursor?: string;
|
|
82
|
+
limit?: number;
|
|
83
|
+
}, signal?: AbortSignal): Promise<{
|
|
84
|
+
queues: Queue[];
|
|
85
|
+
nextCursor: string;
|
|
86
|
+
}>;
|
|
87
|
+
/** Pauses a queue (`MarkQueuePaused`): it accepts jobs and starts none. Idempotent. */
|
|
88
|
+
pauseQueue(queueId: string, reason?: string, signal?: AbortSignal): Promise<Queue>;
|
|
89
|
+
/** Resumes a paused queue (`MarkQueueResumed`). Idempotent. */
|
|
90
|
+
resumeQueue(queueId: string, signal?: AbortSignal): Promise<Queue>;
|
|
91
|
+
/** How a queue is doing now (`GetQueueStats`). */
|
|
92
|
+
getQueueStats(queueId: string, input?: {
|
|
93
|
+
windowMs?: number;
|
|
94
|
+
topTenants?: number;
|
|
95
|
+
}, signal?: AbortSignal): Promise<GetQueueStatsResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* Lists the jobs that went through a queue (`ListQueueJobs`), newest
|
|
98
|
+
* first. With `states: [RunState.FAILED]` it lists the dead letters.
|
|
99
|
+
*/
|
|
100
|
+
listQueueJobs(queueId: string, input?: {
|
|
101
|
+
tenant?: string;
|
|
102
|
+
states?: RunState[];
|
|
103
|
+
cursor?: string;
|
|
104
|
+
limit?: number;
|
|
105
|
+
}, signal?: AbortSignal): Promise<{
|
|
106
|
+
runs: Run[];
|
|
107
|
+
nextCursor: string;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Deletes a queue (`DeleteQueue`). Refused while jobs wait unless
|
|
111
|
+
* `cancelWaiting`. Returns how many jobs were cancelled.
|
|
112
|
+
*/
|
|
113
|
+
deleteQueue(queueId: string, input?: {
|
|
114
|
+
cancelWaiting?: boolean;
|
|
115
|
+
}, signal?: AbortSignal): Promise<number>;
|
|
116
|
+
/**
|
|
117
|
+
* Enqueues a dead letter again: `RetryNode` on the job's run, node `job`.
|
|
118
|
+
* The new attempt is offered on the job's queue under its settings now.
|
|
119
|
+
*/
|
|
120
|
+
requeueJob(runId: string, signal?: AbortSignal): Promise<Run>;
|
|
121
|
+
private opts;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Declares a product's queues, typically at start: `SetQueue` for each,
|
|
125
|
+
* replacing every writable field, so the code is the source of truth and
|
|
126
|
+
* repeating it changes nothing. A queue's pause survives.
|
|
127
|
+
*/
|
|
128
|
+
export declare function declareQueues(client: QueuesClient, decls: readonly QueueDecl[], signal?: AbortSignal): Promise<Queue[]>;
|
|
129
|
+
/** The SetQueue message for a declaration. */
|
|
130
|
+
export declare function queueInit(product: string, d: QueueDecl): {
|
|
131
|
+
priority: number;
|
|
132
|
+
defaultTimeout?: import("@bufbuild/protobuf/wkt").Duration;
|
|
133
|
+
defaultRetry?: import("./gen/xeonr/pipelines/v1/definition_pb.js").Retry | {
|
|
134
|
+
readonly $typeName?: never;
|
|
135
|
+
max?: number;
|
|
136
|
+
when?: import("./gen/xeonr/pipelines/v1/common_pb.js").FailureClass[];
|
|
137
|
+
backoff?: (import("./gen/xeonr/pipelines/v1/definition_pb.js").Backoff | {
|
|
138
|
+
readonly $typeName?: never;
|
|
139
|
+
initial?: (import("@bufbuild/protobuf/wkt").Duration | {
|
|
140
|
+
readonly $typeName?: never;
|
|
141
|
+
seconds?: bigint;
|
|
142
|
+
nanos?: number;
|
|
143
|
+
}) | undefined;
|
|
144
|
+
max?: (import("@bufbuild/protobuf/wkt").Duration | {
|
|
145
|
+
readonly $typeName?: never;
|
|
146
|
+
seconds?: bigint;
|
|
147
|
+
nanos?: number;
|
|
148
|
+
}) | undefined;
|
|
149
|
+
multiplier?: number;
|
|
150
|
+
}) | undefined;
|
|
151
|
+
};
|
|
152
|
+
rateLimit?: {
|
|
153
|
+
limit: number;
|
|
154
|
+
window: import("@bufbuild/protobuf/wkt").Duration;
|
|
155
|
+
};
|
|
156
|
+
owner: {
|
|
157
|
+
product: string;
|
|
158
|
+
tenant: string;
|
|
159
|
+
};
|
|
160
|
+
name: string;
|
|
161
|
+
description: string;
|
|
162
|
+
maxConcurrency: number;
|
|
163
|
+
maxConcurrencyPerTenant: number;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* The product (Auth application id) a bearer token is for, read from its
|
|
167
|
+
* `urn:xeonr:auth:application_id` claim without verifying it: the caller's
|
|
168
|
+
* own token, to name its own product. Undefined when the token carries none.
|
|
169
|
+
*/
|
|
170
|
+
export declare function productFromToken(token: string): string | undefined;
|
|
171
|
+
//# sourceMappingURL=queues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queues.d.ts","sourceRoot":"","sources":["../src/queues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AAE1F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,qCAAqC,CAAC;AAE/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,wCAAwC;AACxC,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG;IAC7C;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iFAAiF;IACjF,SAA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,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAI7H;AAED,8CAA8C;AAC9C,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYtD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUlE"}
|
package/dist/queues.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { durationFromMs } from "@bufbuild/protobuf/wkt";
|
|
2
|
+
import { createClient } from "@connectrpc/connect";
|
|
3
|
+
import { QueuesService } from "./gen/xeonr/pipelines/v1/queues_pb.js";
|
|
4
|
+
import { RunsService } from "./gen/xeonr/pipelines/v1/runs_pb.js";
|
|
5
|
+
import { transportOf } from "./transport.js";
|
|
6
|
+
/**
|
|
7
|
+
* The client for `QueuesService`: the lanes a product's jobs are admitted
|
|
8
|
+
* through, with their limits and fairness. Needs `pipelines:queue:edit` to
|
|
9
|
+
* change queues and `pipelines:queue:read` to read them.
|
|
10
|
+
*
|
|
11
|
+
* Jobs name a queue with `PipelinesClient.createJob({ queue })`; a job with
|
|
12
|
+
* none goes to the product's `default` queue.
|
|
13
|
+
*/
|
|
14
|
+
export class QueuesClient {
|
|
15
|
+
/** The generated client, for anything not wrapped here. */
|
|
16
|
+
queues;
|
|
17
|
+
runs;
|
|
18
|
+
product;
|
|
19
|
+
timeoutMs;
|
|
20
|
+
constructor(opts) {
|
|
21
|
+
const transport = transportOf(opts);
|
|
22
|
+
this.queues = createClient(QueuesService, transport);
|
|
23
|
+
this.runs = createClient(RunsService, transport);
|
|
24
|
+
if (!opts.product)
|
|
25
|
+
throw new TypeError("QueuesClient: product is required");
|
|
26
|
+
this.product = opts.product;
|
|
27
|
+
this.timeoutMs = opts.timeoutMs ?? 30_000;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Sets a queue (`SetQueue`): creates it, or replaces every writable field
|
|
31
|
+
* of the one with that owner and name. Pause and resume are separate.
|
|
32
|
+
*/
|
|
33
|
+
async setQueue(decl, signal) {
|
|
34
|
+
const res = await this.queues.setQueue({ queue: queueInit(this.product, decl) }, this.opts(signal));
|
|
35
|
+
return { queue: required(res.queue), created: res.created };
|
|
36
|
+
}
|
|
37
|
+
/** Reads one queue (`GetQueue`). The `default` queue reads as unlimited until it is set. */
|
|
38
|
+
async getQueue(ref, signal) {
|
|
39
|
+
const queue = "id" in ref
|
|
40
|
+
? { case: "queueId", value: ref.id }
|
|
41
|
+
: { case: "byName", value: { owner: { product: this.product, tenant: ref.tenant ?? "" }, name: ref.name } };
|
|
42
|
+
return required((await this.queues.getQueue({ queue }, this.opts(signal))).queue);
|
|
43
|
+
}
|
|
44
|
+
/** Lists this product's queues (`ListQueues`), by priority then name. */
|
|
45
|
+
async listQueues(input = {}, signal) {
|
|
46
|
+
const res = await this.queues.listQueues({ product: this.product, tenant: input.tenant ?? "", cursor: input.cursor ?? "", limit: input.limit ?? 0 }, this.opts(signal));
|
|
47
|
+
return { queues: res.queues, nextCursor: res.nextCursor };
|
|
48
|
+
}
|
|
49
|
+
/** Pauses a queue (`MarkQueuePaused`): it accepts jobs and starts none. Idempotent. */
|
|
50
|
+
async pauseQueue(queueId, reason = "", signal) {
|
|
51
|
+
return required((await this.queues.markQueuePaused({ queueId, reason }, this.opts(signal))).queue);
|
|
52
|
+
}
|
|
53
|
+
/** Resumes a paused queue (`MarkQueueResumed`). Idempotent. */
|
|
54
|
+
async resumeQueue(queueId, signal) {
|
|
55
|
+
return required((await this.queues.markQueueResumed({ queueId }, this.opts(signal))).queue);
|
|
56
|
+
}
|
|
57
|
+
/** How a queue is doing now (`GetQueueStats`). */
|
|
58
|
+
async getQueueStats(queueId, input = {}, signal) {
|
|
59
|
+
return this.queues.getQueueStats({ queueId, ...(input.windowMs ? { window: durationFromMs(input.windowMs) } : {}), topTenants: input.topTenants ?? 0 }, this.opts(signal));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Lists the jobs that went through a queue (`ListQueueJobs`), newest
|
|
63
|
+
* first. With `states: [RunState.FAILED]` it lists the dead letters.
|
|
64
|
+
*/
|
|
65
|
+
async listQueueJobs(queueId, input = {}, signal) {
|
|
66
|
+
const res = await this.queues.listQueueJobs({ queueId, tenant: input.tenant ?? "", states: input.states ?? [], cursor: input.cursor ?? "", limit: input.limit ?? 0 }, this.opts(signal));
|
|
67
|
+
return { runs: res.runs, nextCursor: res.nextCursor };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Deletes a queue (`DeleteQueue`). Refused while jobs wait unless
|
|
71
|
+
* `cancelWaiting`. Returns how many jobs were cancelled.
|
|
72
|
+
*/
|
|
73
|
+
async deleteQueue(queueId, input = {}, signal) {
|
|
74
|
+
return (await this.queues.deleteQueue({ queueId, cancelWaiting: input.cancelWaiting ?? false }, this.opts(signal))).cancelledJobs;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Enqueues a dead letter again: `RetryNode` on the job's run, node `job`.
|
|
78
|
+
* The new attempt is offered on the job's queue under its settings now.
|
|
79
|
+
*/
|
|
80
|
+
async requeueJob(runId, signal) {
|
|
81
|
+
return required((await this.runs.retryNode({ runId, nodeId: "job" }, this.opts(signal))).run);
|
|
82
|
+
}
|
|
83
|
+
opts(signal) {
|
|
84
|
+
return { timeoutMs: this.timeoutMs, ...(signal ? { signal } : {}) };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Declares a product's queues, typically at start: `SetQueue` for each,
|
|
89
|
+
* replacing every writable field, so the code is the source of truth and
|
|
90
|
+
* repeating it changes nothing. A queue's pause survives.
|
|
91
|
+
*/
|
|
92
|
+
export async function declareQueues(client, decls, signal) {
|
|
93
|
+
const out = [];
|
|
94
|
+
for (const d of decls)
|
|
95
|
+
out.push((await client.setQueue(d, signal)).queue);
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
/** The SetQueue message for a declaration. */
|
|
99
|
+
export function queueInit(product, d) {
|
|
100
|
+
return {
|
|
101
|
+
owner: { product, tenant: d.tenant ?? "" },
|
|
102
|
+
name: d.name,
|
|
103
|
+
description: d.description ?? "",
|
|
104
|
+
maxConcurrency: d.maxConcurrency ?? 0,
|
|
105
|
+
maxConcurrencyPerTenant: d.maxConcurrencyPerTenant ?? 0,
|
|
106
|
+
...(d.rateLimit ? { rateLimit: { limit: d.rateLimit.limit, window: durationFromMs(d.rateLimit.windowMs) } } : {}),
|
|
107
|
+
...(d.defaultRetry ? { defaultRetry: d.defaultRetry } : {}),
|
|
108
|
+
...(d.defaultTimeoutMs ? { defaultTimeout: durationFromMs(d.defaultTimeoutMs) } : {}),
|
|
109
|
+
priority: d.priority ?? 0,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The product (Auth application id) a bearer token is for, read from its
|
|
114
|
+
* `urn:xeonr:auth:application_id` claim without verifying it: the caller's
|
|
115
|
+
* own token, to name its own product. Undefined when the token carries none.
|
|
116
|
+
*/
|
|
117
|
+
export function productFromToken(token) {
|
|
118
|
+
const payload = token.split(".")[1];
|
|
119
|
+
if (!payload)
|
|
120
|
+
return undefined;
|
|
121
|
+
try {
|
|
122
|
+
const claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
|
|
123
|
+
const app = claims["urn:xeonr:auth:application_id"];
|
|
124
|
+
return typeof app === "string" && app ? app : undefined;
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function required(v) {
|
|
131
|
+
if (v === undefined)
|
|
132
|
+
throw new Error("pipelines-api answered without the queue");
|
|
133
|
+
return v;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=queues.js.map
|