deepline 0.1.93 → 0.1.95

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/index.js CHANGED
@@ -257,10 +257,10 @@ var import_node_path2 = require("path");
257
257
 
258
258
  // src/release.ts
259
259
  var SDK_RELEASE = {
260
- version: "0.1.93",
260
+ version: "0.1.95",
261
261
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
262
262
  supportPolicy: {
263
- latest: "0.1.93",
263
+ latest: "0.1.95",
264
264
  minimumSupported: "0.1.53",
265
265
  deprecatedBelow: "0.1.53"
266
266
  }
@@ -2326,6 +2326,93 @@ var DeeplineClient = class {
2326
2326
  );
2327
2327
  return response.runs ?? [];
2328
2328
  }
2329
+ // ---------------------------------------------------------------------------
2330
+ // Legacy workflows (double-shipped). Thin pass-throughs over the live cloud
2331
+ // `/api/v2/workflows/*` API so the SDK CLI keeps existing cloud workflows
2332
+ // working while users migrate them to plays via `workflows transform`. Kept
2333
+ // intentionally minimal — workflows are a deprecated surface.
2334
+ // ---------------------------------------------------------------------------
2335
+ /** List the org's workflows. `GET /api/v2/workflows`. */
2336
+ async listWorkflows(options) {
2337
+ const params = new URLSearchParams();
2338
+ if (typeof options?.limit === "number") {
2339
+ params.set("limit", String(options.limit));
2340
+ }
2341
+ const query = params.size > 0 ? `?${params.toString()}` : "";
2342
+ return this.http.get(`/api/v2/workflows${query}`);
2343
+ }
2344
+ /**
2345
+ * Fetch a single workflow (including its published-revision config — the
2346
+ * input to `compileWorkflowConfigToPlay`). `GET /api/v2/workflows/:id`.
2347
+ */
2348
+ async getWorkflow(id) {
2349
+ return this.http.get(`/api/v2/workflows/${encodeURIComponent(id)}`);
2350
+ }
2351
+ /** Delete a workflow. `DELETE /api/v2/workflows/:id`. */
2352
+ async deleteWorkflow(id) {
2353
+ return this.http.delete(`/api/v2/workflows/${encodeURIComponent(id)}`);
2354
+ }
2355
+ /** Turn a workflow off. `POST /api/v2/workflows/:id/disable`. */
2356
+ async disableWorkflow(id) {
2357
+ return this.http.post(
2358
+ `/api/v2/workflows/${encodeURIComponent(id)}/disable`,
2359
+ {}
2360
+ );
2361
+ }
2362
+ /** Turn a workflow back on. `POST /api/v2/workflows/:id/enable`. */
2363
+ async enableWorkflow(id) {
2364
+ return this.http.post(
2365
+ `/api/v2/workflows/${encodeURIComponent(id)}/enable`,
2366
+ {}
2367
+ );
2368
+ }
2369
+ /** Create/update a workflow from config. `POST /api/v2/workflows/apply`. */
2370
+ async applyWorkflow(body) {
2371
+ return this.http.post("/api/v2/workflows/apply", body);
2372
+ }
2373
+ /** Validate a workflow config without saving. `POST /api/v2/workflows/lint`. */
2374
+ async lintWorkflow(body) {
2375
+ return this.http.post("/api/v2/workflows/lint", body);
2376
+ }
2377
+ /** Fetch live workflow request schemas. `GET /api/v2/workflows/schema`. */
2378
+ async getWorkflowSchema(subject) {
2379
+ const params = new URLSearchParams();
2380
+ if (subject) params.set("subject", subject);
2381
+ const query = params.size > 0 ? `?${params.toString()}` : "";
2382
+ return this.http.get(`/api/v2/workflows/schema${query}`);
2383
+ }
2384
+ /** Queue a workflow run. `POST /api/v2/workflows/call`. */
2385
+ async callWorkflow(body) {
2386
+ return this.http.post("/api/v2/workflows/call", body);
2387
+ }
2388
+ /** List a workflow's runs. `GET /api/v2/workflows/:id/runs`. */
2389
+ async listWorkflowRuns(id, options) {
2390
+ const params = new URLSearchParams();
2391
+ if (typeof options?.limit === "number") {
2392
+ params.set("limit", String(options.limit));
2393
+ }
2394
+ const query = params.size > 0 ? `?${params.toString()}` : "";
2395
+ return this.http.get(
2396
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs${query}`
2397
+ );
2398
+ }
2399
+ /** Fetch one workflow run. `GET /api/v2/workflows/:id/runs/:runId`. */
2400
+ async getWorkflowRun(id, runId) {
2401
+ return this.http.get(
2402
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs/${encodeURIComponent(
2403
+ runId
2404
+ )}`
2405
+ );
2406
+ }
2407
+ /** Cancel a workflow run. `POST /api/v2/workflows/:id/runs/:runId/cancel`. */
2408
+ async cancelWorkflowRun(id, runId) {
2409
+ return this.http.post(
2410
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs/${encodeURIComponent(
2411
+ runId
2412
+ )}/cancel`,
2413
+ {}
2414
+ );
2415
+ }
2329
2416
  /**
2330
2417
  * Get a run by id using the public runs resource model.
2331
2418
  *
@@ -2993,41 +3080,6 @@ function formatPlayBootstrapFinderKindsForSentence() {
2993
3080
  }
2994
3081
 
2995
3082
  // ../shared_libs/play-runtime/email-status.ts
2996
- var DEFAULT_STATUS_MAP = {
2997
- verified: { status: "valid", verdict: "send", verified: true },
2998
- valid: { status: "valid", verdict: "send", verified: true },
2999
- deliverable: { status: "valid", verdict: "send", verified: true },
3000
- true: { status: "valid", verdict: "send", verified: true },
3001
- invalid: { status: "invalid", verdict: "drop", verified: false },
3002
- undeliverable: { status: "invalid", verdict: "drop", verified: false },
3003
- false: { status: "invalid", verdict: "drop", verified: false },
3004
- "catch-all": {
3005
- status: "catch_all",
3006
- verdict: "verify_next",
3007
- verified: false
3008
- },
3009
- catch_all: {
3010
- status: "catch_all",
3011
- verdict: "verify_next",
3012
- verified: false
3013
- },
3014
- valid_catch_all: {
3015
- status: "valid_catch_all",
3016
- verdict: "send_with_caution",
3017
- verified: true
3018
- },
3019
- accept_all: {
3020
- status: "catch_all",
3021
- verdict: "verify_next",
3022
- verified: false
3023
- },
3024
- unknown: { status: "unknown", verdict: "hold", verified: false },
3025
- unavailable: { status: "unknown", verdict: "hold", verified: false },
3026
- do_not_mail: { status: "do_not_mail", verdict: "drop", verified: false },
3027
- spamtrap: { status: "spamtrap", verdict: "drop", verified: false },
3028
- abuse: { status: "abuse", verdict: "drop", verified: false },
3029
- disposable: { status: "disposable", verdict: "drop", verified: false }
3030
- };
3031
3083
  function normalizeKey(value) {
3032
3084
  if (value == null) return null;
3033
3085
  if (typeof value === "boolean") return String(value);
@@ -3076,7 +3128,7 @@ function mxClass(mxProvider, mxRecord) {
3076
3128
  }
3077
3129
  function entryForStatus(key, map) {
3078
3130
  if (!key) return null;
3079
- return map?.[key] ?? DEFAULT_STATUS_MAP[key] ?? null;
3131
+ return map?.[key] ?? null;
3080
3132
  }
3081
3133
  function read(values, name) {
3082
3134
  return values[name];
@@ -4084,6 +4136,42 @@ function stringArrayRecord(value) {
4084
4136
  function stringArray(value) {
4085
4137
  return Array.isArray(value) ? value.map(String) : [];
4086
4138
  }
4139
+ function emailStatusExtractorConfig(value) {
4140
+ if (!isRecord4(value)) return void 0;
4141
+ const readPaths = (key) => {
4142
+ const paths = stringArray(value[key]).map((path) => path.trim()).filter(Boolean);
4143
+ return paths.length > 0 ? paths : void 0;
4144
+ };
4145
+ const provider = typeof value.provider === "string" && value.provider.trim() ? value.provider.trim() : null;
4146
+ if (!provider) return void 0;
4147
+ const config = { provider };
4148
+ for (const key of [
4149
+ "rawStatus",
4150
+ "rawScore",
4151
+ "valid",
4152
+ "deliverability",
4153
+ "catchAll",
4154
+ "mxProvider",
4155
+ "mxRecord",
4156
+ "fraudScore",
4157
+ "disposable",
4158
+ "roleBased",
4159
+ "freeEmail",
4160
+ "abuse",
4161
+ "spamtrap",
4162
+ "suspect"
4163
+ ]) {
4164
+ const paths = readPaths(key);
4165
+ if (paths) config[key] = paths;
4166
+ }
4167
+ if (isRecord4(value.statusMap)) {
4168
+ config.statusMap = value.statusMap;
4169
+ }
4170
+ if (Array.isArray(value.rules)) {
4171
+ config.rules = value.rules;
4172
+ }
4173
+ return config;
4174
+ }
4087
4175
  function extractorDescriptorRecord(value) {
4088
4176
  if (!isRecord4(value)) return {};
4089
4177
  return Object.fromEntries(
@@ -4093,13 +4181,15 @@ function extractorDescriptorRecord(value) {
4093
4181
  if (paths.length === 0) return [];
4094
4182
  const transforms = stringArray(descriptor.transforms).map((transform) => transform.trim()).filter(Boolean);
4095
4183
  const enumValues = stringArray(descriptor.enum).map((entry) => entry.trim()).filter(Boolean);
4184
+ const emailStatus = emailStatusExtractorConfig(descriptor.emailStatus);
4096
4185
  return [
4097
4186
  [
4098
4187
  key,
4099
4188
  {
4100
4189
  paths,
4101
4190
  ...transforms.length > 0 ? { transforms } : {},
4102
- ...enumValues.length > 0 ? { enum: enumValues } : {}
4191
+ ...enumValues.length > 0 ? { enum: enumValues } : {},
4192
+ ...emailStatus ? { emailStatus } : {}
4103
4193
  }
4104
4194
  ]
4105
4195
  ];
package/dist/index.mjs CHANGED
@@ -179,10 +179,10 @@ import { join as join2 } from "path";
179
179
 
180
180
  // src/release.ts
181
181
  var SDK_RELEASE = {
182
- version: "0.1.93",
182
+ version: "0.1.95",
183
183
  apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
184
184
  supportPolicy: {
185
- latest: "0.1.93",
185
+ latest: "0.1.95",
186
186
  minimumSupported: "0.1.53",
187
187
  deprecatedBelow: "0.1.53"
188
188
  }
@@ -2248,6 +2248,93 @@ var DeeplineClient = class {
2248
2248
  );
2249
2249
  return response.runs ?? [];
2250
2250
  }
2251
+ // ---------------------------------------------------------------------------
2252
+ // Legacy workflows (double-shipped). Thin pass-throughs over the live cloud
2253
+ // `/api/v2/workflows/*` API so the SDK CLI keeps existing cloud workflows
2254
+ // working while users migrate them to plays via `workflows transform`. Kept
2255
+ // intentionally minimal — workflows are a deprecated surface.
2256
+ // ---------------------------------------------------------------------------
2257
+ /** List the org's workflows. `GET /api/v2/workflows`. */
2258
+ async listWorkflows(options) {
2259
+ const params = new URLSearchParams();
2260
+ if (typeof options?.limit === "number") {
2261
+ params.set("limit", String(options.limit));
2262
+ }
2263
+ const query = params.size > 0 ? `?${params.toString()}` : "";
2264
+ return this.http.get(`/api/v2/workflows${query}`);
2265
+ }
2266
+ /**
2267
+ * Fetch a single workflow (including its published-revision config — the
2268
+ * input to `compileWorkflowConfigToPlay`). `GET /api/v2/workflows/:id`.
2269
+ */
2270
+ async getWorkflow(id) {
2271
+ return this.http.get(`/api/v2/workflows/${encodeURIComponent(id)}`);
2272
+ }
2273
+ /** Delete a workflow. `DELETE /api/v2/workflows/:id`. */
2274
+ async deleteWorkflow(id) {
2275
+ return this.http.delete(`/api/v2/workflows/${encodeURIComponent(id)}`);
2276
+ }
2277
+ /** Turn a workflow off. `POST /api/v2/workflows/:id/disable`. */
2278
+ async disableWorkflow(id) {
2279
+ return this.http.post(
2280
+ `/api/v2/workflows/${encodeURIComponent(id)}/disable`,
2281
+ {}
2282
+ );
2283
+ }
2284
+ /** Turn a workflow back on. `POST /api/v2/workflows/:id/enable`. */
2285
+ async enableWorkflow(id) {
2286
+ return this.http.post(
2287
+ `/api/v2/workflows/${encodeURIComponent(id)}/enable`,
2288
+ {}
2289
+ );
2290
+ }
2291
+ /** Create/update a workflow from config. `POST /api/v2/workflows/apply`. */
2292
+ async applyWorkflow(body) {
2293
+ return this.http.post("/api/v2/workflows/apply", body);
2294
+ }
2295
+ /** Validate a workflow config without saving. `POST /api/v2/workflows/lint`. */
2296
+ async lintWorkflow(body) {
2297
+ return this.http.post("/api/v2/workflows/lint", body);
2298
+ }
2299
+ /** Fetch live workflow request schemas. `GET /api/v2/workflows/schema`. */
2300
+ async getWorkflowSchema(subject) {
2301
+ const params = new URLSearchParams();
2302
+ if (subject) params.set("subject", subject);
2303
+ const query = params.size > 0 ? `?${params.toString()}` : "";
2304
+ return this.http.get(`/api/v2/workflows/schema${query}`);
2305
+ }
2306
+ /** Queue a workflow run. `POST /api/v2/workflows/call`. */
2307
+ async callWorkflow(body) {
2308
+ return this.http.post("/api/v2/workflows/call", body);
2309
+ }
2310
+ /** List a workflow's runs. `GET /api/v2/workflows/:id/runs`. */
2311
+ async listWorkflowRuns(id, options) {
2312
+ const params = new URLSearchParams();
2313
+ if (typeof options?.limit === "number") {
2314
+ params.set("limit", String(options.limit));
2315
+ }
2316
+ const query = params.size > 0 ? `?${params.toString()}` : "";
2317
+ return this.http.get(
2318
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs${query}`
2319
+ );
2320
+ }
2321
+ /** Fetch one workflow run. `GET /api/v2/workflows/:id/runs/:runId`. */
2322
+ async getWorkflowRun(id, runId) {
2323
+ return this.http.get(
2324
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs/${encodeURIComponent(
2325
+ runId
2326
+ )}`
2327
+ );
2328
+ }
2329
+ /** Cancel a workflow run. `POST /api/v2/workflows/:id/runs/:runId/cancel`. */
2330
+ async cancelWorkflowRun(id, runId) {
2331
+ return this.http.post(
2332
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs/${encodeURIComponent(
2333
+ runId
2334
+ )}/cancel`,
2335
+ {}
2336
+ );
2337
+ }
2251
2338
  /**
2252
2339
  * Get a run by id using the public runs resource model.
2253
2340
  *
@@ -2915,41 +3002,6 @@ function formatPlayBootstrapFinderKindsForSentence() {
2915
3002
  }
2916
3003
 
2917
3004
  // ../shared_libs/play-runtime/email-status.ts
2918
- var DEFAULT_STATUS_MAP = {
2919
- verified: { status: "valid", verdict: "send", verified: true },
2920
- valid: { status: "valid", verdict: "send", verified: true },
2921
- deliverable: { status: "valid", verdict: "send", verified: true },
2922
- true: { status: "valid", verdict: "send", verified: true },
2923
- invalid: { status: "invalid", verdict: "drop", verified: false },
2924
- undeliverable: { status: "invalid", verdict: "drop", verified: false },
2925
- false: { status: "invalid", verdict: "drop", verified: false },
2926
- "catch-all": {
2927
- status: "catch_all",
2928
- verdict: "verify_next",
2929
- verified: false
2930
- },
2931
- catch_all: {
2932
- status: "catch_all",
2933
- verdict: "verify_next",
2934
- verified: false
2935
- },
2936
- valid_catch_all: {
2937
- status: "valid_catch_all",
2938
- verdict: "send_with_caution",
2939
- verified: true
2940
- },
2941
- accept_all: {
2942
- status: "catch_all",
2943
- verdict: "verify_next",
2944
- verified: false
2945
- },
2946
- unknown: { status: "unknown", verdict: "hold", verified: false },
2947
- unavailable: { status: "unknown", verdict: "hold", verified: false },
2948
- do_not_mail: { status: "do_not_mail", verdict: "drop", verified: false },
2949
- spamtrap: { status: "spamtrap", verdict: "drop", verified: false },
2950
- abuse: { status: "abuse", verdict: "drop", verified: false },
2951
- disposable: { status: "disposable", verdict: "drop", verified: false }
2952
- };
2953
3005
  function normalizeKey(value) {
2954
3006
  if (value == null) return null;
2955
3007
  if (typeof value === "boolean") return String(value);
@@ -2998,7 +3050,7 @@ function mxClass(mxProvider, mxRecord) {
2998
3050
  }
2999
3051
  function entryForStatus(key, map) {
3000
3052
  if (!key) return null;
3001
- return map?.[key] ?? DEFAULT_STATUS_MAP[key] ?? null;
3053
+ return map?.[key] ?? null;
3002
3054
  }
3003
3055
  function read(values, name) {
3004
3056
  return values[name];
@@ -4006,6 +4058,42 @@ function stringArrayRecord(value) {
4006
4058
  function stringArray(value) {
4007
4059
  return Array.isArray(value) ? value.map(String) : [];
4008
4060
  }
4061
+ function emailStatusExtractorConfig(value) {
4062
+ if (!isRecord4(value)) return void 0;
4063
+ const readPaths = (key) => {
4064
+ const paths = stringArray(value[key]).map((path) => path.trim()).filter(Boolean);
4065
+ return paths.length > 0 ? paths : void 0;
4066
+ };
4067
+ const provider = typeof value.provider === "string" && value.provider.trim() ? value.provider.trim() : null;
4068
+ if (!provider) return void 0;
4069
+ const config = { provider };
4070
+ for (const key of [
4071
+ "rawStatus",
4072
+ "rawScore",
4073
+ "valid",
4074
+ "deliverability",
4075
+ "catchAll",
4076
+ "mxProvider",
4077
+ "mxRecord",
4078
+ "fraudScore",
4079
+ "disposable",
4080
+ "roleBased",
4081
+ "freeEmail",
4082
+ "abuse",
4083
+ "spamtrap",
4084
+ "suspect"
4085
+ ]) {
4086
+ const paths = readPaths(key);
4087
+ if (paths) config[key] = paths;
4088
+ }
4089
+ if (isRecord4(value.statusMap)) {
4090
+ config.statusMap = value.statusMap;
4091
+ }
4092
+ if (Array.isArray(value.rules)) {
4093
+ config.rules = value.rules;
4094
+ }
4095
+ return config;
4096
+ }
4009
4097
  function extractorDescriptorRecord(value) {
4010
4098
  if (!isRecord4(value)) return {};
4011
4099
  return Object.fromEntries(
@@ -4015,13 +4103,15 @@ function extractorDescriptorRecord(value) {
4015
4103
  if (paths.length === 0) return [];
4016
4104
  const transforms = stringArray(descriptor.transforms).map((transform) => transform.trim()).filter(Boolean);
4017
4105
  const enumValues = stringArray(descriptor.enum).map((entry) => entry.trim()).filter(Boolean);
4106
+ const emailStatus = emailStatusExtractorConfig(descriptor.emailStatus);
4018
4107
  return [
4019
4108
  [
4020
4109
  key,
4021
4110
  {
4022
4111
  paths,
4023
4112
  ...transforms.length > 0 ? { transforms } : {},
4024
- ...enumValues.length > 0 ? { enum: enumValues } : {}
4113
+ ...enumValues.length > 0 ? { enum: enumValues } : {},
4114
+ ...emailStatus ? { emailStatus } : {}
4025
4115
  }
4026
4116
  ]
4027
4117
  ];
@@ -1337,20 +1337,35 @@ async function callToolDirect(
1337
1337
 
1338
1338
  function toolMetadataFallback(toolId: string): ToolResultMetadataInput {
1339
1339
  if (toolId === 'test_rate_limit') {
1340
+ // Batched members resolve metadata through this fallback because the lean
1341
+ // worker does not bundle the catalog. It MUST mirror the same
1342
+ // `email_status: emailStatus({...})` contract registered in
1343
+ // src/lib/integrations/test/index.ts so batched results normalize to the
1344
+ // same rich email_status OBJECT (status from statusMap, catch_all as a
1345
+ // signal) that the single-execute real-metadata path produces. The legacy
1346
+ // `transforms:['emailStatus']` + mx_security_gateway→'catch_all' string
1347
+ // override coarsened email_status into a bare string and predates the
1348
+ // emailStatus object contract (#1466).
1340
1349
  return {
1341
1350
  toolId,
1342
1351
  extractors: {
1343
1352
  email_status: {
1344
1353
  paths: ['email_status'],
1345
- transforms: ['emailStatus'],
1346
- enum: ['valid', 'invalid', 'catch_all', 'unknown'],
1347
- overrides: [
1348
- {
1349
- paths: ['mx_security_gateway'],
1350
- equals: true,
1351
- value: 'catch_all',
1354
+ emailStatus: {
1355
+ provider: 'test',
1356
+ rawStatus: ['email_status'],
1357
+ catchAll: ['mx_security_gateway'],
1358
+ statusMap: {
1359
+ valid: { status: 'valid', verdict: 'send', verified: true },
1360
+ invalid: { status: 'invalid', verdict: 'drop', verified: false },
1361
+ catch_all: {
1362
+ status: 'catch_all',
1363
+ verdict: 'verify_next',
1364
+ verified: false,
1365
+ },
1366
+ unknown: { status: 'unknown', verdict: 'hold', verified: false },
1352
1367
  },
1353
- ],
1368
+ },
1354
1369
  },
1355
1370
  },
1356
1371
  targetGetters: {
@@ -1241,6 +1241,7 @@ export class DeeplineClient {
1241
1241
  async compileEnrichPlan(input: {
1242
1242
  plan_args?: string[];
1243
1243
  config?: unknown;
1244
+ native_play_materialization?: 'macro' | 'inline_prebuilt';
1244
1245
  }): Promise<{ config: EnrichCompiledConfig }> {
1245
1246
  return this.http.post('/api/v2/enrich/compile', input);
1246
1247
  }
@@ -1613,6 +1614,128 @@ export class DeeplineClient {
1613
1614
  return response.runs ?? [];
1614
1615
  }
1615
1616
 
1617
+ // ---------------------------------------------------------------------------
1618
+ // Legacy workflows (double-shipped). Thin pass-throughs over the live cloud
1619
+ // `/api/v2/workflows/*` API so the SDK CLI keeps existing cloud workflows
1620
+ // working while users migrate them to plays via `workflows transform`. Kept
1621
+ // intentionally minimal — workflows are a deprecated surface.
1622
+ // ---------------------------------------------------------------------------
1623
+
1624
+ /** List the org's workflows. `GET /api/v2/workflows`. */
1625
+ async listWorkflows(options?: { limit?: number }): Promise<{
1626
+ workflows: Array<{
1627
+ id: string;
1628
+ name: string;
1629
+ status: string;
1630
+ current_published_version: number | null;
1631
+ }>;
1632
+ }> {
1633
+ const params = new URLSearchParams();
1634
+ if (typeof options?.limit === 'number') {
1635
+ params.set('limit', String(options.limit));
1636
+ }
1637
+ const query = params.size > 0 ? `?${params.toString()}` : '';
1638
+ return this.http.get(`/api/v2/workflows${query}`);
1639
+ }
1640
+
1641
+ /**
1642
+ * Fetch a single workflow (including its published-revision config — the
1643
+ * input to `compileWorkflowConfigToPlay`). `GET /api/v2/workflows/:id`.
1644
+ */
1645
+ async getWorkflow(id: string): Promise<{
1646
+ workflow: {
1647
+ id: string;
1648
+ name: string;
1649
+ status: string;
1650
+ current_published_version: number | null;
1651
+ current_published_revision: {
1652
+ version: number;
1653
+ config: unknown;
1654
+ } | null;
1655
+ } | null;
1656
+ validation?: unknown;
1657
+ }> {
1658
+ return this.http.get(`/api/v2/workflows/${encodeURIComponent(id)}`);
1659
+ }
1660
+
1661
+ /** Delete a workflow. `DELETE /api/v2/workflows/:id`. */
1662
+ async deleteWorkflow(id: string): Promise<unknown> {
1663
+ return this.http.delete(`/api/v2/workflows/${encodeURIComponent(id)}`);
1664
+ }
1665
+
1666
+ /** Turn a workflow off. `POST /api/v2/workflows/:id/disable`. */
1667
+ async disableWorkflow(id: string): Promise<unknown> {
1668
+ return this.http.post(
1669
+ `/api/v2/workflows/${encodeURIComponent(id)}/disable`,
1670
+ {},
1671
+ );
1672
+ }
1673
+
1674
+ /** Turn a workflow back on. `POST /api/v2/workflows/:id/enable`. */
1675
+ async enableWorkflow(id: string): Promise<unknown> {
1676
+ return this.http.post(
1677
+ `/api/v2/workflows/${encodeURIComponent(id)}/enable`,
1678
+ {},
1679
+ );
1680
+ }
1681
+
1682
+ /** Create/update a workflow from config. `POST /api/v2/workflows/apply`. */
1683
+ async applyWorkflow(body: Record<string, unknown>): Promise<unknown> {
1684
+ return this.http.post('/api/v2/workflows/apply', body);
1685
+ }
1686
+
1687
+ /** Validate a workflow config without saving. `POST /api/v2/workflows/lint`. */
1688
+ async lintWorkflow(body: Record<string, unknown>): Promise<unknown> {
1689
+ return this.http.post('/api/v2/workflows/lint', body);
1690
+ }
1691
+
1692
+ /** Fetch live workflow request schemas. `GET /api/v2/workflows/schema`. */
1693
+ async getWorkflowSchema(subject?: string): Promise<unknown> {
1694
+ const params = new URLSearchParams();
1695
+ if (subject) params.set('subject', subject);
1696
+ const query = params.size > 0 ? `?${params.toString()}` : '';
1697
+ return this.http.get(`/api/v2/workflows/schema${query}`);
1698
+ }
1699
+
1700
+ /** Queue a workflow run. `POST /api/v2/workflows/call`. */
1701
+ async callWorkflow(body: Record<string, unknown>): Promise<unknown> {
1702
+ return this.http.post('/api/v2/workflows/call', body);
1703
+ }
1704
+
1705
+ /** List a workflow's runs. `GET /api/v2/workflows/:id/runs`. */
1706
+ async listWorkflowRuns(
1707
+ id: string,
1708
+ options?: { limit?: number },
1709
+ ): Promise<unknown> {
1710
+ const params = new URLSearchParams();
1711
+ if (typeof options?.limit === 'number') {
1712
+ params.set('limit', String(options.limit));
1713
+ }
1714
+ const query = params.size > 0 ? `?${params.toString()}` : '';
1715
+ return this.http.get(
1716
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs${query}`,
1717
+ );
1718
+ }
1719
+
1720
+ /** Fetch one workflow run. `GET /api/v2/workflows/:id/runs/:runId`. */
1721
+ async getWorkflowRun(id: string, runId: string): Promise<unknown> {
1722
+ return this.http.get(
1723
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs/${encodeURIComponent(
1724
+ runId,
1725
+ )}`,
1726
+ );
1727
+ }
1728
+
1729
+ /** Cancel a workflow run. `POST /api/v2/workflows/:id/runs/:runId/cancel`. */
1730
+ async cancelWorkflowRun(id: string, runId: string): Promise<unknown> {
1731
+ return this.http.post(
1732
+ `/api/v2/workflows/${encodeURIComponent(id)}/runs/${encodeURIComponent(
1733
+ runId,
1734
+ )}/cancel`,
1735
+ {},
1736
+ );
1737
+ }
1738
+
1616
1739
  /**
1617
1740
  * Get a run by id using the public runs resource model.
1618
1741
  *