@tailor-platform/sdk 1.40.1 → 1.44.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/CHANGELOG.md +68 -0
- package/README.md +23 -0
- package/dist/{actor-B2oEmlTc.d.mts → actor-DzCuoMlP.d.mts} +2 -2
- package/dist/application-BZRbA1pL.mjs +4 -0
- package/dist/{application-EvhIIVg0.mjs → application-DkVNbIuh.mjs} +95 -16
- package/dist/application-DkVNbIuh.mjs.map +1 -0
- package/dist/brand-Ll48SMXe.mjs.map +1 -1
- package/dist/cli/index.mjs +56 -43
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +75 -18
- package/dist/cli/lib.mjs +9 -9
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/skills.mjs.map +1 -1
- package/dist/{client-CcV6Jjds.mjs → client-DQl5NPG9.mjs} +103 -43
- package/dist/{client-CcV6Jjds.mjs.map → client-DQl5NPG9.mjs.map} +1 -1
- package/dist/{client-Cn9SqhZT.mjs → client-EI4pMzvm.mjs} +1 -1
- package/dist/configure/index.d.mts +5 -5
- package/dist/configure/index.mjs +84 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-CUbm1ErM.mjs → crash-report-CSSrblUv.mjs} +4 -4
- package/dist/{crash-report-CUbm1ErM.mjs.map → crash-report-CSSrblUv.mjs.map} +1 -1
- package/dist/{crash-report-CSYupJ0T.mjs → crash-report-DtkFq9JF.mjs} +1 -1
- package/dist/{enum-constants-Dx82rSjf.mjs → enum-constants-C3KSpsYj.mjs} +1 -1
- package/dist/{enum-constants-Dx82rSjf.mjs.map → enum-constants-C3KSpsYj.mjs.map} +1 -1
- package/dist/{errors-ChWX5ZG8.mjs → errors-_M2TVoWh.mjs} +1 -1
- package/dist/{errors-ChWX5ZG8.mjs.map → errors-_M2TVoWh.mjs.map} +1 -1
- package/dist/{file-utils-DeWpvq3T.mjs → file-utils-775qWKoo.mjs} +1 -1
- package/dist/{file-utils-DeWpvq3T.mjs.map → file-utils-775qWKoo.mjs.map} +1 -1
- package/dist/{index-Chvw1Eod.d.mts → index-0Dk-fDWi.d.mts} +2 -2
- package/dist/{index-CiNNNpuH.d.mts → index-BEEL1-6Z.d.mts} +2 -2
- package/dist/{index-D_ezppY7.d.mts → index-Br4XCvX1.d.mts} +103 -86
- package/dist/{index-BtXZdz-F.d.mts → index-DdsUV-aA.d.mts} +2 -2
- package/dist/{index-reFAYSX7.d.mts → index-ZZYEd_0R.d.mts} +2 -2
- package/dist/interceptor-4UC-KTno.mjs.map +1 -1
- package/dist/{job-p6zf8Qpg.mjs → job-BOvKyNdT.mjs} +15 -9
- package/dist/job-BOvKyNdT.mjs.map +1 -0
- package/dist/kysely/index.mjs.map +1 -1
- package/dist/{kysely-type-CwtvQuxh.mjs → kysely-type-BQsYEZoY.mjs} +1 -1
- package/dist/kysely-type-BQsYEZoY.mjs.map +1 -0
- package/dist/logger-DTNAMYGy.mjs.map +1 -1
- package/dist/{package-json-CWp8s9dE.mjs → package-json-CRzw5eUf.mjs} +1 -1
- package/dist/{package-json-CWp8s9dE.mjs.map → package-json-CRzw5eUf.mjs.map} +1 -1
- package/dist/package-json-DR_mqrCW.mjs +4 -0
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/repl-editor-DjycioU-.mjs.map +1 -1
- package/dist/{runtime-B9R1TzLD.mjs → runtime-l7GFD3Xg.mjs} +503 -196
- package/dist/runtime-l7GFD3Xg.mjs.map +1 -0
- package/dist/{schema-CEcfEyPN.mjs → schema-DBq6hr6h.mjs} +13 -2
- package/dist/{schema-CEcfEyPN.mjs.map → schema-DBq6hr6h.mjs.map} +1 -1
- package/dist/{seed-CyYPhvNL.mjs → seed-BkVKgsxf.mjs} +1 -1
- package/dist/{seed-CyYPhvNL.mjs.map → seed-BkVKgsxf.mjs.map} +1 -1
- package/dist/{service-SrG26B9T.mjs → service-CCnx_IFw.mjs} +2 -2
- package/dist/{service-SrG26B9T.mjs.map → service-CCnx_IFw.mjs.map} +1 -1
- package/dist/{tailor-db-field-CoFKRCYW.d.mts → tailor-db-field-D_z185oq.d.mts} +36 -6
- package/dist/{telemetry-BuDto_2q.mjs → telemetry-B6Le9XT-.mjs} +2 -2
- package/dist/{telemetry-BuDto_2q.mjs.map → telemetry-B6Le9XT-.mjs.map} +1 -1
- package/dist/telemetry-C_WXxIo0.mjs +4 -0
- package/dist/types-Duhhsx3R.mjs.map +1 -1
- package/dist/utils/test/index.d.mts +36 -3
- package/dist/utils/test/index.mjs +78 -9
- package/dist/utils/test/index.mjs.map +1 -1
- package/dist/{workflow.generated-Btz6srLR.d.mts → workflow.generated-CDCnZNkH.d.mts} +2 -2
- package/docs/cli/application.md +130 -5
- package/docs/cli/crash-report.md +12 -1
- package/docs/cli/executor.md +6 -4
- package/docs/cli/function.md +83 -1
- package/docs/cli/organization.md +6 -5
- package/docs/cli/workspace.md +16 -13
- package/docs/cli-reference.md +13 -10
- package/docs/services/executor.md +4 -0
- package/docs/services/idp.md +16 -0
- package/docs/services/resolver.md +4 -2
- package/docs/services/workflow.md +117 -3
- package/docs/testing.md +95 -7
- package/package.json +24 -24
- package/dist/application-CE2s_a6w.mjs +0 -4
- package/dist/application-EvhIIVg0.mjs.map +0 -1
- package/dist/job-p6zf8Qpg.mjs.map +0 -1
- package/dist/kysely-type-CwtvQuxh.mjs.map +0 -1
- package/dist/package-json-CPR7s5hf.mjs +0 -4
- package/dist/runtime-B9R1TzLD.mjs.map +0 -1
- package/dist/telemetry-C1hzFaiV.mjs +0 -4
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
|
|
2
|
-
import { $ as
|
|
3
|
-
import { t as db } from "./schema-
|
|
2
|
+
import { $ as FilterSchema, A as FunctionExecution_Status, B as AuthOAuth2Client_GrantType, C as TailorDBType_Permission_Operator, D as IdPLang, E as PipelineResolver_OperationType, F as AuthConnection_Type, H as AuthSCIMAttribute_Type, I as AuthHookPoint, J as GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus, K as TenantProviderConfig_TenantProviderType, L as AuthIDPConfig_AuthType, M as ExecutorJobStatus, N as ExecutorTargetType, O as IdPPermissionOperator, P as ExecutorTriggerType, Q as Condition_Operator, R as AuthInvokerSchema, S as TailorDBGQLPermission_Permit, T as TailorDBType_PermitAction, U as AuthSCIMAttribute_Uniqueness, V as AuthSCIMAttribute_Mutability, W as AuthSCIMConfig_AuthorizationType, X as Subgraph_ServiceType, Y as ApplicationSchemaUpdateAttemptStatus, Z as ConditionSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as PageDirection, g as OperatorService, h as userAgent, i as fetchAll, k as IdPPermissionPermit, m as resolveStaticWebsiteUrls, o as fetchPaged, p as platformBaseUrl, q as UserProfileProviderConfig_UserProfileProviderType, v as WorkflowExecution_Status, w as TailorDBType_Permission_Permit, x as TailorDBGQLPermission_Operator, y as WorkflowJobExecution_Status, z as AuthOAuth2Client_ClientType } from "./client-DQl5NPG9.mjs";
|
|
3
|
+
import { t as db } from "./schema-DBq6hr6h.mjs";
|
|
4
4
|
import { a as parseBoolean, i as symbols, n as logger, r as styles, t as CIPromptError } from "./logger-DTNAMYGy.mjs";
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { C as loadWorkspaceId, D as writePlatformConfig, S as loadAccessToken, _ as getDistDir, d as buildResolverOperationHookExpr, f as OAuth2ClientSchema, g as createBundleCache, h as loadFilesWithIgnores, m as stringifyFunction, n as generatePluginFilesIfNeeded, p as TailorDBTypeSchema, r as loadApplication, s as createExecutorService, t as defineApplication, u as buildExecutorArgsExpr, v as hashFile, w as readPlatformConfig, y as loadConfig } from "./application-DkVNbIuh.mjs";
|
|
6
|
+
import { t as readPackageJson } from "./package-json-CRzw5eUf.mjs";
|
|
7
|
+
import { n as isCLIError, t as createCLIError } from "./errors-_M2TVoWh.mjs";
|
|
8
|
+
import { r as withSpan } from "./telemetry-B6Le9XT-.mjs";
|
|
9
9
|
import { arg, createDefineCommand, defineCommand, runCommand } from "politty";
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
12
11
|
import * as fs$1 from "node:fs";
|
|
13
12
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
14
13
|
import { parseEnv } from "node:util";
|
|
14
|
+
import { ValueSchema, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
15
15
|
import * as path from "pathe";
|
|
16
16
|
import { formatDistanceToNowStrict } from "date-fns";
|
|
17
17
|
import { getBorderCharacters, table } from "table";
|
|
18
|
-
import { Code, ConnectError } from "@connectrpc/connect";
|
|
19
|
-
import * as crypto from "node:crypto";
|
|
20
|
-
import { createHash } from "node:crypto";
|
|
21
18
|
import { pathToFileURL } from "node:url";
|
|
22
|
-
import { resolveTSConfig } from "pkg-types";
|
|
23
19
|
import ml from "multiline-ts";
|
|
24
20
|
import { tmpdir } from "node:os";
|
|
25
21
|
import { findUpSync } from "find-up-simple";
|
|
26
22
|
import { xdgConfig } from "xdg-basedir";
|
|
23
|
+
import { Code, ConnectError } from "@connectrpc/connect";
|
|
24
|
+
import * as crypto from "node:crypto";
|
|
25
|
+
import { createHash } from "node:crypto";
|
|
26
|
+
import { resolveTSConfig } from "pkg-types";
|
|
27
|
+
import { ScalarType, create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
27
28
|
import * as rolldown from "rolldown";
|
|
28
29
|
import * as fs from "node:fs/promises";
|
|
29
30
|
import { glob } from "node:fs/promises";
|
|
30
31
|
import * as inflection from "inflection";
|
|
31
|
-
import { create, fromJson, toJson } from "@bufbuild/protobuf";
|
|
32
32
|
import { ExitPromptError } from "@inquirer/core";
|
|
33
33
|
import { confirm, input, password } from "@inquirer/prompts";
|
|
34
34
|
import { isCI } from "std-env";
|
|
@@ -268,7 +268,7 @@ function isVerbose() {
|
|
|
268
268
|
const defineAppCommand = createDefineCommand();
|
|
269
269
|
|
|
270
270
|
//#endregion
|
|
271
|
-
//#region src/cli/commands/api.ts
|
|
271
|
+
//#region src/cli/commands/api/api-call.ts
|
|
272
272
|
/**
|
|
273
273
|
* Call Tailor Platform API endpoints directly.
|
|
274
274
|
* If the endpoint doesn't contain "/", it defaults to `tailor.v1.OperatorService/{endpoint}`.
|
|
@@ -300,11 +300,195 @@ async function apiCall(options) {
|
|
|
300
300
|
data
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/cli/commands/api/proto-reflect.ts
|
|
306
|
+
function unaryMethods() {
|
|
307
|
+
return OperatorService.methods.filter((m) => m.methodKind === "unary");
|
|
308
|
+
}
|
|
309
|
+
function listMethodNames() {
|
|
310
|
+
return unaryMethods().map((m) => m.name).sort();
|
|
311
|
+
}
|
|
312
|
+
function getMethodDescriptor(methodName) {
|
|
313
|
+
return unaryMethods().find((m) => m.name === methodName);
|
|
307
314
|
}
|
|
315
|
+
function extractMethodName(endpoint) {
|
|
316
|
+
if (!endpoint.includes("/")) return endpoint;
|
|
317
|
+
return endpoint.split("/").pop() ?? endpoint;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/cli/commands/api/render.ts
|
|
322
|
+
const SCALAR_LABEL = {
|
|
323
|
+
[ScalarType.DOUBLE]: "double",
|
|
324
|
+
[ScalarType.FLOAT]: "float",
|
|
325
|
+
[ScalarType.INT64]: "int64",
|
|
326
|
+
[ScalarType.UINT64]: "uint64",
|
|
327
|
+
[ScalarType.INT32]: "int32",
|
|
328
|
+
[ScalarType.FIXED64]: "fixed64",
|
|
329
|
+
[ScalarType.FIXED32]: "fixed32",
|
|
330
|
+
[ScalarType.BOOL]: "bool",
|
|
331
|
+
[ScalarType.STRING]: "string",
|
|
332
|
+
[ScalarType.BYTES]: "bytes",
|
|
333
|
+
[ScalarType.UINT32]: "uint32",
|
|
334
|
+
[ScalarType.SFIXED32]: "sfixed32",
|
|
335
|
+
[ScalarType.SFIXED64]: "sfixed64",
|
|
336
|
+
[ScalarType.SINT32]: "sint32",
|
|
337
|
+
[ScalarType.SINT64]: "sint64"
|
|
338
|
+
};
|
|
339
|
+
function shortName(typeName) {
|
|
340
|
+
const dot = typeName.lastIndexOf(".");
|
|
341
|
+
return dot < 0 ? typeName : typeName.slice(dot + 1);
|
|
342
|
+
}
|
|
343
|
+
function scalarLabel(scalar) {
|
|
344
|
+
return SCALAR_LABEL[scalar] ?? `scalar(${scalar})`;
|
|
345
|
+
}
|
|
346
|
+
function enumLabel(enumDesc) {
|
|
347
|
+
return `enum ${shortName(enumDesc.typeName)}`;
|
|
348
|
+
}
|
|
349
|
+
function enumOf(field) {
|
|
350
|
+
if (field.fieldKind === "enum") return field.enum;
|
|
351
|
+
if (field.fieldKind === "list" && field.listKind === "enum") return field.enum;
|
|
352
|
+
}
|
|
353
|
+
function describeFieldType(field) {
|
|
354
|
+
switch (field.fieldKind) {
|
|
355
|
+
case "scalar": return scalarLabel(field.scalar);
|
|
356
|
+
case "enum": return enumLabel(field.enum);
|
|
357
|
+
case "message": return shortName(field.message.typeName);
|
|
358
|
+
case "list": {
|
|
359
|
+
let inner;
|
|
360
|
+
if (field.listKind === "scalar") inner = scalarLabel(field.scalar);
|
|
361
|
+
else if (field.listKind === "enum") inner = enumLabel(field.enum);
|
|
362
|
+
else inner = shortName(field.message.typeName);
|
|
363
|
+
return `repeated ${inner}`;
|
|
364
|
+
}
|
|
365
|
+
case "map": {
|
|
366
|
+
const keyType = scalarLabel(field.mapKey);
|
|
367
|
+
let valType;
|
|
368
|
+
if (field.mapKind === "scalar") valType = scalarLabel(field.scalar);
|
|
369
|
+
else if (field.mapKind === "enum") valType = enumLabel(field.enum);
|
|
370
|
+
else valType = shortName(field.message.typeName);
|
|
371
|
+
return `map<${keyType}, ${valType}>`;
|
|
372
|
+
}
|
|
373
|
+
default: return "<unknown>";
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
function nestedMessageForInspect(field) {
|
|
377
|
+
if (field.fieldKind === "message") return field.message;
|
|
378
|
+
if (field.fieldKind === "list" && field.listKind === "message") return field.message;
|
|
379
|
+
if (field.fieldKind === "map" && field.mapKind === "message") return field.message;
|
|
380
|
+
}
|
|
381
|
+
function fieldToJson(field, visited) {
|
|
382
|
+
const json = {
|
|
383
|
+
name: field.localName,
|
|
384
|
+
protoName: field.name,
|
|
385
|
+
type: describeFieldType(field),
|
|
386
|
+
fieldKind: field.fieldKind,
|
|
387
|
+
repeated: field.fieldKind === "list"
|
|
388
|
+
};
|
|
389
|
+
if (field.oneof) json.oneof = field.oneof.name;
|
|
390
|
+
const fieldEnum = enumOf(field);
|
|
391
|
+
if (fieldEnum) json.enumValues = fieldEnum.values.map((v) => v.name);
|
|
392
|
+
const nested = nestedMessageForInspect(field);
|
|
393
|
+
if (nested && !visited.has(nested)) {
|
|
394
|
+
visited.add(nested);
|
|
395
|
+
json.message = {
|
|
396
|
+
typeName: nested.typeName,
|
|
397
|
+
fields: nested.fields.map((f) => fieldToJson(f, visited))
|
|
398
|
+
};
|
|
399
|
+
visited.delete(nested);
|
|
400
|
+
} else if (nested) json.message = {
|
|
401
|
+
typeName: nested.typeName,
|
|
402
|
+
fields: [],
|
|
403
|
+
recursive: true
|
|
404
|
+
};
|
|
405
|
+
return json;
|
|
406
|
+
}
|
|
407
|
+
function renderInspectJson(method) {
|
|
408
|
+
const visited = new Set([method.input]);
|
|
409
|
+
return {
|
|
410
|
+
method: method.name,
|
|
411
|
+
input: {
|
|
412
|
+
typeName: method.input.typeName,
|
|
413
|
+
fields: method.input.fields.map((f) => fieldToJson(f, visited))
|
|
414
|
+
},
|
|
415
|
+
output: { typeName: method.output.typeName }
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function renderFieldText(field, indent, visited) {
|
|
419
|
+
const lines = [];
|
|
420
|
+
const oneofTag = field.oneof ? ` (oneof ${field.oneof.name})` : "";
|
|
421
|
+
lines.push(`${indent}${field.localName}: ${describeFieldType(field)}${oneofTag}`);
|
|
422
|
+
const fieldEnum = enumOf(field);
|
|
423
|
+
if (fieldEnum) {
|
|
424
|
+
const values = fieldEnum.values.map((v) => v.name).join(", ");
|
|
425
|
+
lines.push(`${indent} values: ${values}`);
|
|
426
|
+
}
|
|
427
|
+
const nested = nestedMessageForInspect(field);
|
|
428
|
+
if (nested && !visited.has(nested)) {
|
|
429
|
+
visited.add(nested);
|
|
430
|
+
for (const sub of nested.fields) lines.push(...renderFieldText(sub, `${indent} `, visited));
|
|
431
|
+
visited.delete(nested);
|
|
432
|
+
} else if (nested) lines.push(`${indent} …(recursive ${nested.typeName})`);
|
|
433
|
+
return lines;
|
|
434
|
+
}
|
|
435
|
+
function renderInspectText(method) {
|
|
436
|
+
const lines = [];
|
|
437
|
+
lines.push(`${method.name}`);
|
|
438
|
+
lines.push(` request: ${method.input.typeName}`);
|
|
439
|
+
const visited = new Set([method.input]);
|
|
440
|
+
for (const f of method.input.fields) lines.push(...renderFieldText(f, " ", visited));
|
|
441
|
+
lines.push(` response: ${method.output.typeName}`);
|
|
442
|
+
return lines.join("\n");
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/cli/commands/api/inspect.ts
|
|
447
|
+
const inspectCommand = defineAppCommand({
|
|
448
|
+
name: "inspect",
|
|
449
|
+
description: "Print the input message tree of an OperatorService endpoint.",
|
|
450
|
+
notes: "Combine with the global `--json` flag for a machine-readable descriptor. Recursive type references and `oneof` membership are annotated. Use `tailor-sdk api list` to discover endpoint names.",
|
|
451
|
+
examples: [{
|
|
452
|
+
cmd: "GetApplication",
|
|
453
|
+
desc: "Show fields of GetApplicationRequest."
|
|
454
|
+
}, {
|
|
455
|
+
cmd: "CreateExecutorExecutor",
|
|
456
|
+
desc: "Inspect a deeply nested input with `(oneof config)` annotations."
|
|
457
|
+
}],
|
|
458
|
+
args: z.object({ endpoint: arg(z.string(), {
|
|
459
|
+
positional: true,
|
|
460
|
+
description: "API endpoint to inspect (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication').",
|
|
461
|
+
completion: { custom: { choices: listMethodNames() } }
|
|
462
|
+
}) }).strict(),
|
|
463
|
+
run: (args) => {
|
|
464
|
+
const methodName = extractMethodName(args.endpoint);
|
|
465
|
+
const method = getMethodDescriptor(methodName);
|
|
466
|
+
if (!method) throw createCLIError({
|
|
467
|
+
message: `unknown method: ${methodName}`,
|
|
468
|
+
suggestion: "Run `tailor-sdk api list` to see available methods.",
|
|
469
|
+
command: "api inspect"
|
|
470
|
+
});
|
|
471
|
+
if (logger.jsonMode) logger.out(renderInspectJson(method));
|
|
472
|
+
else logger.out(renderInspectText(method));
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/cli/commands/api/list.ts
|
|
478
|
+
const listCommand$10 = defineAppCommand({
|
|
479
|
+
name: "list",
|
|
480
|
+
description: "List all invocable OperatorService methods.",
|
|
481
|
+
notes: "Only unary RPCs are listed; streaming methods are excluded because `tailor-sdk api run` issues a single JSON POST and reads one JSON response.",
|
|
482
|
+
args: z.object({}).strict(),
|
|
483
|
+
run: () => {
|
|
484
|
+
const names = listMethodNames();
|
|
485
|
+
if (logger.jsonMode) logger.out(names);
|
|
486
|
+
else for (const name of names) logger.out(name);
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/cli/commands/api/index.ts
|
|
308
492
|
function resolveNamespaceName(methodName, config) {
|
|
309
493
|
if (/Auth|Tenant|UserProfile/.test(methodName)) return config.auth?.name;
|
|
310
494
|
if (/IdP/.test(methodName)) {
|
|
@@ -342,7 +526,9 @@ function parseBodyAsObject(body) {
|
|
|
342
526
|
const apiCommand = defineAppCommand({
|
|
343
527
|
name: "api",
|
|
344
528
|
description: "Call Tailor Platform API endpoints directly.",
|
|
345
|
-
notes: `
|
|
529
|
+
notes: `Use \`tailor-sdk api list\` to enumerate invocable methods and \`tailor-sdk api inspect <endpoint>\` to print an endpoint's input message tree (combine with \`--json\` for machine-readable output).
|
|
530
|
+
|
|
531
|
+
The request body is inferred from the proto definition of the target endpoint, and commonly required fields are auto-injected so they can be omitted from \`--body\`:
|
|
346
532
|
|
|
347
533
|
- \`workspaceId\` — resolved from \`-w\` / \`TAILOR_PLATFORM_WORKSPACE_ID\` / the selected profile.
|
|
348
534
|
- \`namespaceName\` — resolved from \`tailor.config.ts\` based on the endpoint's service:
|
|
@@ -350,24 +536,44 @@ const apiCommand = defineAppCommand({
|
|
|
350
536
|
- IdP / TailorDB / Pipeline endpoints use the sole configured namespace when exactly one is defined.
|
|
351
537
|
|
|
352
538
|
Values already present in \`--body\` are never overridden. If a value cannot be resolved (e.g. no config found), injection is silently skipped and the server-side validation error takes precedence.`,
|
|
539
|
+
examples: [
|
|
540
|
+
{
|
|
541
|
+
cmd: "GetApplication -b '{\"applicationName\":\"app-1\"}'",
|
|
542
|
+
desc: "Call an endpoint; workspaceId is auto-injected."
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
cmd: "list",
|
|
546
|
+
desc: "List all invocable OperatorService methods."
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
cmd: "inspect GetApplication",
|
|
550
|
+
desc: "Show the input message tree for an endpoint."
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
subCommands: {
|
|
554
|
+
list: listCommand$10,
|
|
555
|
+
inspect: inspectCommand
|
|
556
|
+
},
|
|
353
557
|
args: z.object({
|
|
354
558
|
...workspaceArgs,
|
|
355
559
|
...configArg,
|
|
356
560
|
body: arg(z.string().default("{}"), {
|
|
357
561
|
alias: "b",
|
|
358
|
-
description: "Request body as JSON"
|
|
562
|
+
description: "Request body as JSON."
|
|
359
563
|
}),
|
|
360
564
|
endpoint: arg(z.string(), {
|
|
361
565
|
positional: true,
|
|
362
|
-
description: "API endpoint to call (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication')"
|
|
566
|
+
description: "API endpoint to call (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication').",
|
|
567
|
+
completion: { custom: { choices: listMethodNames() } }
|
|
363
568
|
})
|
|
364
569
|
}).strict(),
|
|
365
570
|
run: async (args) => {
|
|
366
|
-
const methodName =
|
|
571
|
+
const methodName = extractMethodName(args.endpoint);
|
|
572
|
+
const method = getMethodDescriptor(methodName);
|
|
367
573
|
const parsedBody = parseBodyAsObject(args.body);
|
|
368
574
|
let mutated = false;
|
|
369
|
-
if (parsedBody) {
|
|
370
|
-
const fieldNames =
|
|
575
|
+
if (parsedBody && method) {
|
|
576
|
+
const fieldNames = method.input.fields.map((f) => f.localName);
|
|
371
577
|
if (fieldNames.includes("workspaceId") && !("workspaceId" in parsedBody)) try {
|
|
372
578
|
parsedBody.workspaceId = await loadWorkspaceId({
|
|
373
579
|
workspaceId: args["workspace-id"],
|
|
@@ -387,7 +593,7 @@ Values already present in \`--body\` are never overridden. If a value cannot be
|
|
|
387
593
|
const result = await apiCall({
|
|
388
594
|
profile: args.profile,
|
|
389
595
|
endpoint: args.endpoint,
|
|
390
|
-
body: mutated ? JSON.stringify(parsedBody) : args.body
|
|
596
|
+
body: mutated && parsedBody ? JSON.stringify(parsedBody) : args.body
|
|
391
597
|
});
|
|
392
598
|
logger.log(JSON.stringify(result.data, null, 2));
|
|
393
599
|
}
|
|
@@ -1298,7 +1504,8 @@ async function planApplication(context) {
|
|
|
1298
1504
|
if (idpConfigs.length > 0) authIdpConfigName = idpConfigs[0].name;
|
|
1299
1505
|
}
|
|
1300
1506
|
const metaRequest = await buildMetaRequest(trn$6(workspaceId, application.name), application.name);
|
|
1301
|
-
const
|
|
1507
|
+
const expectedLocalWebsites = new Set(application.staticWebsiteServices.map((website) => website.name));
|
|
1508
|
+
const resolvedCors = await resolveStaticWebsiteUrls(client, workspaceId, application.config.cors, "CORS", { expectedLocalNames: expectedLocalWebsites });
|
|
1302
1509
|
const desired = normalizeComparableApplication(application, authNamespace, authIdpConfigName, resolvedCors);
|
|
1303
1510
|
const request = {
|
|
1304
1511
|
workspaceId,
|
|
@@ -2351,9 +2558,9 @@ async function applyIdP(client, result, phase = "create-update") {
|
|
|
2351
2558
|
* @returns Planned changes and metadata
|
|
2352
2559
|
*/
|
|
2353
2560
|
async function planIdP(context) {
|
|
2354
|
-
const { client, workspaceId, application, forRemoval, forceApplyAll = false } = context;
|
|
2561
|
+
const { client, workspaceId, application, forRemoval, forceApplyAll = false, hasIdpUserTrigger = false } = context;
|
|
2355
2562
|
const idps = forRemoval ? [] : application.idpServices;
|
|
2356
|
-
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$3(client, workspaceId, application.name, idps);
|
|
2563
|
+
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$3(client, workspaceId, application.name, idps, hasIdpUserTrigger);
|
|
2357
2564
|
return {
|
|
2358
2565
|
changeSet: {
|
|
2359
2566
|
service: serviceChangeSet,
|
|
@@ -2440,7 +2647,7 @@ function areIdPServicesEqual(existing, desired) {
|
|
|
2440
2647
|
permission: normalizeComparablePermission(existing.permission)
|
|
2441
2648
|
}), desired);
|
|
2442
2649
|
}
|
|
2443
|
-
async function planServices$3(client, workspaceId, appName, idps) {
|
|
2650
|
+
async function planServices$3(client, workspaceId, appName, idps, hasIdpUserTrigger) {
|
|
2444
2651
|
const changeSet = createChangeSet("IdP services");
|
|
2445
2652
|
const conflicts = [];
|
|
2446
2653
|
const unmanaged = [];
|
|
@@ -2489,7 +2696,9 @@ async function planServices$3(client, workspaceId, appName, idps) {
|
|
|
2489
2696
|
}
|
|
2490
2697
|
const lang = convertLang(idp.lang);
|
|
2491
2698
|
const userAuthPolicy = idp.userAuthPolicy;
|
|
2492
|
-
const publishUserEvents = idp.publishUserEvents ??
|
|
2699
|
+
const publishUserEvents = idp.publishUserEvents ?? hasIdpUserTrigger;
|
|
2700
|
+
if (hasIdpUserTrigger && idp.publishUserEvents === void 0) logger.info(`IdP service "${namespaceName}": automatically enabled "publishUserEvents" because executors with idpUser triggers are defined. Set "publishUserEvents" explicitly to silence this message.`);
|
|
2701
|
+
else if (hasIdpUserTrigger && idp.publishUserEvents === false) logger.warn(`IdP service "${namespaceName}" has "publishUserEvents: false", but executors with idpUser triggers are defined. Those executors will not fire for this IdP. Set "publishUserEvents: true" to enable them.`);
|
|
2493
2702
|
const emailConfig = idp.emailConfig;
|
|
2494
2703
|
if (!idp.permission) logger.warn(`IdP service "${namespaceName}" has no permission configured.`);
|
|
2495
2704
|
const parsedPermission = parseIdPPermission(idp.permission);
|
|
@@ -2791,13 +3000,14 @@ async function planAuth(context) {
|
|
|
2791
3000
|
}
|
|
2792
3001
|
const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$2(client, workspaceId, application.name, auths, forceApplyAll);
|
|
2793
3002
|
const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
|
|
3003
|
+
const expectedLocalWebsites = new Set(application.staticWebsiteServices.map((website) => website.name));
|
|
2794
3004
|
const [idpConfigChangeSet, userProfileConfigChangeSet, tenantConfigChangeSet, machineUserChangeSet, authHookChangeSet, oauth2ClientChangeSet, scimChangeSet, scimResourceChangeSet, connectionResult] = await Promise.all([
|
|
2795
3005
|
planIdPConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
2796
3006
|
planUserProfileConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
2797
3007
|
planTenantConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
2798
3008
|
planMachineUsers(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
2799
3009
|
planAuthHooks(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
2800
|
-
planOAuth2Clients(client, workspaceId, auths, deletedServices, forceApplyAll),
|
|
3010
|
+
planOAuth2Clients(client, workspaceId, auths, deletedServices, expectedLocalWebsites, forceApplyAll),
|
|
2801
3011
|
planSCIMConfigs(client, workspaceId, auths, deletedServices),
|
|
2802
3012
|
planSCIMResources(client, workspaceId, auths, deletedServices),
|
|
2803
3013
|
planAuthConnections(client, workspaceId, application.name, auths)
|
|
@@ -3406,7 +3616,7 @@ function oauth2LifetimeToSeconds(lifetime) {
|
|
|
3406
3616
|
function areOAuth2ClientsEqual(existing, desired) {
|
|
3407
3617
|
return areNormalizedEqual(normalizeComparableOAuth2Client(existing), normalizeComparableOAuth2Client(desired));
|
|
3408
3618
|
}
|
|
3409
|
-
async function planOAuth2Clients(client, workspaceId, auths, deletedServices, forceApplyAll = false) {
|
|
3619
|
+
async function planOAuth2Clients(client, workspaceId, auths, deletedServices, expectedLocalWebsites, forceApplyAll = false) {
|
|
3410
3620
|
const changeSet = createChangeSet("Auth oauth2Clients");
|
|
3411
3621
|
const fetchOAuth2Clients = (namespaceName) => {
|
|
3412
3622
|
return fetchAll(async (pageToken, maxPageSize) => {
|
|
@@ -3435,7 +3645,7 @@ async function planOAuth2Clients(client, workspaceId, auths, deletedServices, fo
|
|
|
3435
3645
|
const oauth2Client = config.oauth2Clients?.[oauth2ClientName];
|
|
3436
3646
|
if (!oauth2Client) continue;
|
|
3437
3647
|
const newOAuth2Client = protoOAuth2Client(oauth2ClientName, oauth2Client);
|
|
3438
|
-
const resolvedRedirectUris = await resolveStaticWebsiteUrls(client, workspaceId, newOAuth2Client.redirectUris ?? [], "OAuth2 redirect URIs");
|
|
3648
|
+
const resolvedRedirectUris = await resolveStaticWebsiteUrls(client, workspaceId, newOAuth2Client.redirectUris ?? [], "OAuth2 redirect URIs", { expectedLocalNames: expectedLocalWebsites });
|
|
3439
3649
|
if (existingClientsMap.has(oauth2ClientName)) {
|
|
3440
3650
|
const existingClient = existingClientsMap.get(oauth2ClientName);
|
|
3441
3651
|
if (existingClient.clientType !== newOAuth2Client.clientType) changeSet.replaces.push({
|
|
@@ -3959,64 +4169,6 @@ async function confirmImportantResourceDeletion(resources, yes) {
|
|
|
3959
4169
|
`);
|
|
3960
4170
|
}
|
|
3961
4171
|
|
|
3962
|
-
//#endregion
|
|
3963
|
-
//#region src/cli/shared/runtime-args.ts
|
|
3964
|
-
/**
|
|
3965
|
-
* Runtime args transformation for all services.
|
|
3966
|
-
*
|
|
3967
|
-
* Each service transforms server-side args/context into SDK-friendly format:
|
|
3968
|
-
* - Executor: server-side expression evaluated by platform before calling function
|
|
3969
|
-
* - Resolver: operationHook expression evaluated by platform before calling function
|
|
3970
|
-
*
|
|
3971
|
-
* The user field mapping (server → SDK) shared across services is defined in
|
|
3972
|
-
* `@/parser/service/tailordb` as `tailorUserMap`.
|
|
3973
|
-
*/
|
|
3974
|
-
/**
|
|
3975
|
-
* Actor field transformation expression.
|
|
3976
|
-
*
|
|
3977
|
-
* Transforms the server's actor object to match the SDK's TailorActor type:
|
|
3978
|
-
* server `attributeMap` → SDK `attributes`
|
|
3979
|
-
* server `attributes` → SDK `attributeList`
|
|
3980
|
-
* other fields → passed through
|
|
3981
|
-
* null/undefined actor → null
|
|
3982
|
-
*/
|
|
3983
|
-
const ACTOR_TRANSFORM_EXPR = "actor: args.actor ? (({ attributeMap, attributes: attrList, ...rest }) => ({ ...rest, attributes: attributeMap, attributeList: attrList }))(args.actor) : null";
|
|
3984
|
-
/**
|
|
3985
|
-
* Build the JavaScript expression that transforms server-format executor event
|
|
3986
|
-
* args into SDK-format args at runtime.
|
|
3987
|
-
*
|
|
3988
|
-
* The Tailor Platform server delivers event args with server-side field names.
|
|
3989
|
-
* The SDK exposes different field names to user code. This function produces a
|
|
3990
|
-
* JavaScript expression string that performs the mapping when evaluated
|
|
3991
|
-
* server-side.
|
|
3992
|
-
* @param triggerKind - The trigger kind discriminant from the parsed executor
|
|
3993
|
-
* @param env - Application env record to embed in the expression
|
|
3994
|
-
* @returns A JavaScript expression string, e.g. `({ ...args, ... })`
|
|
3995
|
-
*/
|
|
3996
|
-
function buildExecutorArgsExpr(triggerKind, env) {
|
|
3997
|
-
const envExpr = `env: ${JSON.stringify(env)}`;
|
|
3998
|
-
switch (triggerKind) {
|
|
3999
|
-
case "schedule": return `({ ...args, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, ${envExpr} })`;
|
|
4000
|
-
case "resolverExecuted": return `({ ...args, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, success: !!args.succeeded, result: args.succeeded?.result.resolver, error: args.failed?.error, ${envExpr} })`;
|
|
4001
|
-
case "incomingWebhook": return `({ ...args, appNamespace: args.namespaceName, rawBody: args.raw_body, ${envExpr} })`;
|
|
4002
|
-
default: return `({ ...args, event: args.eventType?.split(".").pop(), rawEvent: args.eventType, appNamespace: args.namespaceName, ${ACTOR_TRANSFORM_EXPR}, ${envExpr} })`;
|
|
4003
|
-
}
|
|
4004
|
-
}
|
|
4005
|
-
/**
|
|
4006
|
-
* Build the operationHook expression for resolver pipelines.
|
|
4007
|
-
*
|
|
4008
|
-
* Transforms server context to SDK resolver context:
|
|
4009
|
-
* context.args → input
|
|
4010
|
-
* context.pipeline → spread into result
|
|
4011
|
-
* user (global var) → TailorUser (via tailorUserMap: workspace_id→workspaceId, attribute_map→attributes, attributes→attributeList)
|
|
4012
|
-
* env → injected as JSON
|
|
4013
|
-
* @param env - Application env record to embed in the expression
|
|
4014
|
-
* @returns A JavaScript expression string for the operationHook
|
|
4015
|
-
*/
|
|
4016
|
-
function buildResolverOperationHookExpr(env) {
|
|
4017
|
-
return `({ ...context.pipeline, input: context.args, user: ${tailorUserMap}, env: ${JSON.stringify(env)} });`;
|
|
4018
|
-
}
|
|
4019
|
-
|
|
4020
4172
|
//#endregion
|
|
4021
4173
|
//#region src/cli/commands/apply/auth-invoker.ts
|
|
4022
4174
|
/**
|
|
@@ -7470,13 +7622,25 @@ function isPlainObject(value) {
|
|
|
7470
7622
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7471
7623
|
}
|
|
7472
7624
|
const tailordbCompareKnownDefaults = {
|
|
7625
|
+
/**
|
|
7626
|
+
* Platform returns this object with explicit false flags even when the SDK omitted
|
|
7627
|
+
* gqlOperations entirely. Treat the all-false object as "unset" for diff purposes.
|
|
7628
|
+
*/
|
|
7473
7629
|
disableGqlOperations: {
|
|
7474
7630
|
create: false,
|
|
7475
7631
|
update: false,
|
|
7476
7632
|
delete: false,
|
|
7477
7633
|
read: false
|
|
7478
7634
|
},
|
|
7635
|
+
/**
|
|
7636
|
+
* Some remote validate expressions are emitted as an empty string when the SDK did
|
|
7637
|
+
* not define a script. Local manifests omit the field entirely.
|
|
7638
|
+
*/
|
|
7479
7639
|
emptyExpression: "",
|
|
7640
|
+
/**
|
|
7641
|
+
* Proto bigint-backed values can round-trip as numbers locally and strings remotely.
|
|
7642
|
+
* Canonicalize them to strings at compare time.
|
|
7643
|
+
*/
|
|
7480
7644
|
numericStringPaths: new Set([
|
|
7481
7645
|
"schema.fields.*.serial.start",
|
|
7482
7646
|
"schema.fields.*.serial.maxValue",
|
|
@@ -8514,6 +8678,7 @@ async function apply(options) {
|
|
|
8514
8678
|
const yes = options?.yes ?? false;
|
|
8515
8679
|
const forceApplyAll = await withSpan("plan.detectSdkVersionChange", () => shouldForceApplyAll(client, workspaceId, application, functionEntries));
|
|
8516
8680
|
const { functionRegistry, tailorDB, staticWebsite, idp, auth, pipeline, app, executor, workflow, secretManager } = await withSpan("plan", async () => {
|
|
8681
|
+
const hasIdpUserTrigger = Object.values(application.executorService?.executors ?? {}).some((executor) => executor.trigger.kind === "idpUser");
|
|
8517
8682
|
const ctx = {
|
|
8518
8683
|
client,
|
|
8519
8684
|
workspaceId,
|
|
@@ -8521,7 +8686,8 @@ async function apply(options) {
|
|
|
8521
8686
|
forRemoval: false,
|
|
8522
8687
|
config,
|
|
8523
8688
|
noSchemaCheck: options?.noSchemaCheck,
|
|
8524
|
-
forceApplyAll
|
|
8689
|
+
forceApplyAll,
|
|
8690
|
+
hasIdpUserTrigger
|
|
8525
8691
|
};
|
|
8526
8692
|
const functionRegistry = await withSpan("plan.functionRegistry", () => planFunctionRegistry(client, workspaceId, application.name, functionEntries));
|
|
8527
8693
|
const unchangedWorkflowJobs = new Set(functionRegistry.changeSet.unchanged.filter((entry) => entry.name.startsWith(WORKFLOW_PREFIX)).map((entry) => entry.name.slice(WORKFLOW_PREFIX.length)));
|
|
@@ -8967,7 +9133,7 @@ async function getExecutor(options) {
|
|
|
8967
9133
|
throw error;
|
|
8968
9134
|
}
|
|
8969
9135
|
}
|
|
8970
|
-
const getCommand$
|
|
9136
|
+
const getCommand$6 = defineAppCommand({
|
|
8971
9137
|
name: "get",
|
|
8972
9138
|
description: "Get executor details",
|
|
8973
9139
|
args: z.object({
|
|
@@ -9447,7 +9613,7 @@ async function getWorkflow(options) {
|
|
|
9447
9613
|
throw error;
|
|
9448
9614
|
}
|
|
9449
9615
|
}
|
|
9450
|
-
const getCommand$
|
|
9616
|
+
const getCommand$5 = defineAppCommand({
|
|
9451
9617
|
name: "get",
|
|
9452
9618
|
description: "Get workflow details.",
|
|
9453
9619
|
args: z.object({
|
|
@@ -10076,7 +10242,7 @@ async function listExecutors(options) {
|
|
|
10076
10242
|
return [executors, nextPageToken];
|
|
10077
10243
|
}, { limit: options?.limit })).map((e) => toExecutorListInfo(e));
|
|
10078
10244
|
}
|
|
10079
|
-
const listCommand$
|
|
10245
|
+
const listCommand$9 = defineAppCommand({
|
|
10080
10246
|
name: "list",
|
|
10081
10247
|
description: "List all executors",
|
|
10082
10248
|
args: z.object({
|
|
@@ -10328,14 +10494,16 @@ async function listWebhookExecutors(options) {
|
|
|
10328
10494
|
workspaceId: options?.workspaceId,
|
|
10329
10495
|
profile: options?.profile
|
|
10330
10496
|
});
|
|
10331
|
-
|
|
10497
|
+
const pageDirection = toPageDirection(options?.order);
|
|
10498
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
10332
10499
|
const { webhooks, nextPageToken } = await client.listExecutorIncomingWebhooks({
|
|
10333
10500
|
workspaceId,
|
|
10334
10501
|
pageToken,
|
|
10335
|
-
pageSize
|
|
10502
|
+
pageSize,
|
|
10503
|
+
pageDirection
|
|
10336
10504
|
});
|
|
10337
10505
|
return [webhooks, nextPageToken];
|
|
10338
|
-
})).map((w) => ({
|
|
10506
|
+
}, { limit: options?.limit })).map((w) => ({
|
|
10339
10507
|
name: w.executorName,
|
|
10340
10508
|
webhookUrl: w.url,
|
|
10341
10509
|
disabled: w.disabled
|
|
@@ -10344,11 +10512,16 @@ async function listWebhookExecutors(options) {
|
|
|
10344
10512
|
const listWebhookCommand = defineAppCommand({
|
|
10345
10513
|
name: "list",
|
|
10346
10514
|
description: "List executors with incoming webhook triggers",
|
|
10347
|
-
args: z.object({
|
|
10515
|
+
args: z.object({
|
|
10516
|
+
...workspaceArgs,
|
|
10517
|
+
...paginationArgs()
|
|
10518
|
+
}).strict(),
|
|
10348
10519
|
run: async (args) => {
|
|
10349
10520
|
const executors = await listWebhookExecutors({
|
|
10350
10521
|
workspaceId: args["workspace-id"],
|
|
10351
|
-
profile: args.profile
|
|
10522
|
+
profile: args.profile,
|
|
10523
|
+
order: args.order,
|
|
10524
|
+
limit: args.limit
|
|
10352
10525
|
});
|
|
10353
10526
|
if (executors.length === 0) {
|
|
10354
10527
|
logger.info("No webhook executors found.");
|
|
@@ -10367,6 +10540,157 @@ const webhookCommand = defineCommand({
|
|
|
10367
10540
|
}
|
|
10368
10541
|
});
|
|
10369
10542
|
|
|
10543
|
+
//#endregion
|
|
10544
|
+
//#region src/cli/commands/function/transform.ts
|
|
10545
|
+
const functionRegistryInfo = (fn) => {
|
|
10546
|
+
return {
|
|
10547
|
+
name: fn.name,
|
|
10548
|
+
description: fn.description,
|
|
10549
|
+
sizeBytes: fn.sizeBytes.toString(),
|
|
10550
|
+
contentHash: fn.contentHash,
|
|
10551
|
+
createdAt: formatTimestamp(fn.createdAt),
|
|
10552
|
+
updatedAt: formatTimestamp(fn.updatedAt)
|
|
10553
|
+
};
|
|
10554
|
+
};
|
|
10555
|
+
|
|
10556
|
+
//#endregion
|
|
10557
|
+
//#region src/cli/commands/function/get.ts
|
|
10558
|
+
const getFunctionRegistryOptionsSchema = z.object({
|
|
10559
|
+
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10560
|
+
profile: z.string().optional(),
|
|
10561
|
+
name: z.string().min(1, { message: "name is required" })
|
|
10562
|
+
});
|
|
10563
|
+
async function loadOptions$12(options) {
|
|
10564
|
+
const result = getFunctionRegistryOptionsSchema.safeParse(options);
|
|
10565
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10566
|
+
return {
|
|
10567
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
10568
|
+
useProfile: true,
|
|
10569
|
+
profile: result.data.profile
|
|
10570
|
+
})),
|
|
10571
|
+
workspaceId: await loadWorkspaceId({
|
|
10572
|
+
workspaceId: result.data.workspaceId,
|
|
10573
|
+
profile: result.data.profile
|
|
10574
|
+
}),
|
|
10575
|
+
name: result.data.name
|
|
10576
|
+
};
|
|
10577
|
+
}
|
|
10578
|
+
/**
|
|
10579
|
+
* Get a function registry by name.
|
|
10580
|
+
* @param options - Function registry get options
|
|
10581
|
+
* @returns Function registry info
|
|
10582
|
+
*/
|
|
10583
|
+
async function getFunctionRegistry(options) {
|
|
10584
|
+
const { client, workspaceId, name } = await loadOptions$12(options);
|
|
10585
|
+
const notFoundErrorMessage = `Function registry "${name}" not found.`;
|
|
10586
|
+
try {
|
|
10587
|
+
const response = await client.getFunctionRegistry({
|
|
10588
|
+
workspaceId,
|
|
10589
|
+
name
|
|
10590
|
+
});
|
|
10591
|
+
if (!response.function) throw new Error(notFoundErrorMessage);
|
|
10592
|
+
return functionRegistryInfo(response.function);
|
|
10593
|
+
} catch (error) {
|
|
10594
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) throw new Error(notFoundErrorMessage, { cause: error });
|
|
10595
|
+
throw error;
|
|
10596
|
+
}
|
|
10597
|
+
}
|
|
10598
|
+
const getCommand$4 = defineAppCommand({
|
|
10599
|
+
name: "get",
|
|
10600
|
+
description: "Get a function registry by name",
|
|
10601
|
+
args: z.object({
|
|
10602
|
+
...workspaceArgs,
|
|
10603
|
+
name: arg(z.string(), {
|
|
10604
|
+
description: "Function name",
|
|
10605
|
+
alias: "n"
|
|
10606
|
+
})
|
|
10607
|
+
}).strict(),
|
|
10608
|
+
run: async (args) => {
|
|
10609
|
+
const fn = await getFunctionRegistry({
|
|
10610
|
+
workspaceId: args["workspace-id"],
|
|
10611
|
+
profile: args.profile,
|
|
10612
|
+
name: args.name
|
|
10613
|
+
});
|
|
10614
|
+
const formatted = args.json ? fn : {
|
|
10615
|
+
...fn,
|
|
10616
|
+
createdAt: humanizeRelativeTime(fn.createdAt),
|
|
10617
|
+
updatedAt: humanizeRelativeTime(fn.updatedAt)
|
|
10618
|
+
};
|
|
10619
|
+
logger.out(formatted);
|
|
10620
|
+
}
|
|
10621
|
+
});
|
|
10622
|
+
|
|
10623
|
+
//#endregion
|
|
10624
|
+
//#region src/cli/commands/function/list.ts
|
|
10625
|
+
const listFunctionRegistriesOptionsSchema = z.object({
|
|
10626
|
+
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
10627
|
+
profile: z.string().optional(),
|
|
10628
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
10629
|
+
limit: z.coerce.number().int().nonnegative().optional()
|
|
10630
|
+
});
|
|
10631
|
+
async function loadOptions$11(options) {
|
|
10632
|
+
const result = listFunctionRegistriesOptionsSchema.safeParse(options);
|
|
10633
|
+
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
10634
|
+
return {
|
|
10635
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
10636
|
+
useProfile: true,
|
|
10637
|
+
profile: result.data.profile
|
|
10638
|
+
})),
|
|
10639
|
+
workspaceId: await loadWorkspaceId({
|
|
10640
|
+
workspaceId: result.data.workspaceId,
|
|
10641
|
+
profile: result.data.profile
|
|
10642
|
+
}),
|
|
10643
|
+
order: result.data.order,
|
|
10644
|
+
limit: result.data.limit
|
|
10645
|
+
};
|
|
10646
|
+
}
|
|
10647
|
+
/**
|
|
10648
|
+
* List function registries in a workspace with optional pagination.
|
|
10649
|
+
* @param options - Function registry listing options
|
|
10650
|
+
* @returns List of function registries
|
|
10651
|
+
*/
|
|
10652
|
+
async function listFunctionRegistries(options) {
|
|
10653
|
+
const { client, workspaceId, order, limit } = await loadOptions$11(options);
|
|
10654
|
+
const pageDirection = toPageDirection(order);
|
|
10655
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
10656
|
+
try {
|
|
10657
|
+
const { functions, nextPageToken } = await client.listFunctionRegistries({
|
|
10658
|
+
workspaceId,
|
|
10659
|
+
pageToken,
|
|
10660
|
+
pageSize,
|
|
10661
|
+
sortBy: "updated_at",
|
|
10662
|
+
pageDirection
|
|
10663
|
+
});
|
|
10664
|
+
return [functions, nextPageToken];
|
|
10665
|
+
} catch (error) {
|
|
10666
|
+
if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
|
|
10667
|
+
throw error;
|
|
10668
|
+
}
|
|
10669
|
+
}, { limit })).map(functionRegistryInfo);
|
|
10670
|
+
}
|
|
10671
|
+
const listCommand$8 = defineAppCommand({
|
|
10672
|
+
name: "list",
|
|
10673
|
+
description: "List function registries in a workspace",
|
|
10674
|
+
args: z.object({
|
|
10675
|
+
...workspaceArgs,
|
|
10676
|
+
...paginationArgs()
|
|
10677
|
+
}).strict(),
|
|
10678
|
+
run: async (args) => {
|
|
10679
|
+
const registries = await listFunctionRegistries({
|
|
10680
|
+
workspaceId: args["workspace-id"],
|
|
10681
|
+
profile: args.profile,
|
|
10682
|
+
order: args.order,
|
|
10683
|
+
limit: args.limit
|
|
10684
|
+
});
|
|
10685
|
+
const formatted = args.json ? registries : registries.map(({ createdAt, updatedAt, ...rest }) => ({
|
|
10686
|
+
...rest,
|
|
10687
|
+
createdAt: humanizeRelativeTime(createdAt),
|
|
10688
|
+
updatedAt: humanizeRelativeTime(updatedAt)
|
|
10689
|
+
}));
|
|
10690
|
+
logger.out(formatted);
|
|
10691
|
+
}
|
|
10692
|
+
});
|
|
10693
|
+
|
|
10370
10694
|
//#endregion
|
|
10371
10695
|
//#region src/cli/commands/generate/types.ts
|
|
10372
10696
|
/**
|
|
@@ -11681,7 +12005,8 @@ const getCommand$2 = defineAppCommand({
|
|
|
11681
12005
|
const listFoldersOptionsSchema = z.object({
|
|
11682
12006
|
organizationId: z.uuid({ message: "organization-id must be a valid UUID" }),
|
|
11683
12007
|
parentFolderId: z.string().optional(),
|
|
11684
|
-
|
|
12008
|
+
order: orderArg.optional(),
|
|
12009
|
+
limit: z.number().int().nonnegative().optional()
|
|
11685
12010
|
});
|
|
11686
12011
|
/**
|
|
11687
12012
|
* List folders in an organization.
|
|
@@ -11691,28 +12016,19 @@ const listFoldersOptionsSchema = z.object({
|
|
|
11691
12016
|
async function listFolders(options) {
|
|
11692
12017
|
const result = listFoldersOptionsSchema.safeParse(options);
|
|
11693
12018
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
11694
|
-
const { organizationId, parentFolderId, limit } = result.data;
|
|
11695
|
-
const hasLimit = limit !== void 0;
|
|
12019
|
+
const { organizationId, parentFolderId, order, limit } = result.data;
|
|
11696
12020
|
const client = await initOperatorClient(await loadAccessToken());
|
|
11697
|
-
const
|
|
11698
|
-
|
|
11699
|
-
while (true) {
|
|
11700
|
-
if (hasLimit && results.length >= limit) break;
|
|
11701
|
-
const remaining = hasLimit ? limit - results.length : void 0;
|
|
11702
|
-
const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
|
|
12021
|
+
const pageDirection = toPageDirection(order);
|
|
12022
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
11703
12023
|
const response = await client.listOrganizationFolders({
|
|
11704
12024
|
organizationId,
|
|
11705
12025
|
...parentFolderId ? { parentFolderId } : {},
|
|
11706
12026
|
pageToken,
|
|
11707
|
-
|
|
12027
|
+
pageSize,
|
|
12028
|
+
pageDirection
|
|
11708
12029
|
});
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
else results.push(...mapped);
|
|
11712
|
-
if (!response.nextPageToken) break;
|
|
11713
|
-
pageToken = response.nextPageToken;
|
|
11714
|
-
}
|
|
11715
|
-
return results;
|
|
12030
|
+
return [response.folders, response.nextPageToken];
|
|
12031
|
+
}, { limit })).map(folderListInfo);
|
|
11716
12032
|
}
|
|
11717
12033
|
const listCommand$5 = defineAppCommand({
|
|
11718
12034
|
name: "list",
|
|
@@ -11720,15 +12036,13 @@ const listCommand$5 = defineAppCommand({
|
|
|
11720
12036
|
args: z.object({
|
|
11721
12037
|
...organizationArgs,
|
|
11722
12038
|
"parent-folder-id": arg(z.string().optional(), { description: "Parent folder ID to list children of" }),
|
|
11723
|
-
|
|
11724
|
-
alias: "l",
|
|
11725
|
-
description: "Maximum number of folders to list"
|
|
11726
|
-
})
|
|
12039
|
+
...paginationArgs()
|
|
11727
12040
|
}).strict(),
|
|
11728
12041
|
run: async (args) => {
|
|
11729
12042
|
const folders = await listFolders({
|
|
11730
12043
|
organizationId: args["organization-id"],
|
|
11731
12044
|
parentFolderId: args["parent-folder-id"],
|
|
12045
|
+
order: args.order,
|
|
11732
12046
|
limit: args.limit
|
|
11733
12047
|
});
|
|
11734
12048
|
logger.out(folders, { display: { updatedAt: null } });
|
|
@@ -12762,7 +13076,7 @@ async function generate(options) {
|
|
|
12762
13076
|
if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
|
|
12763
13077
|
let pluginManager;
|
|
12764
13078
|
if (plugins.length > 0) pluginManager = new PluginManager(plugins);
|
|
12765
|
-
const { defineApplication } = await import("./application-
|
|
13079
|
+
const { defineApplication } = await import("./application-BZRbA1pL.mjs");
|
|
12766
13080
|
const application = defineApplication({
|
|
12767
13081
|
config,
|
|
12768
13082
|
pluginManager
|
|
@@ -13275,7 +13589,10 @@ async function loadOptions$9(options) {
|
|
|
13275
13589
|
const result = healthOptionsSchema.safeParse(options);
|
|
13276
13590
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13277
13591
|
return {
|
|
13278
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13592
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13593
|
+
useProfile: true,
|
|
13594
|
+
profile: result.data.profile
|
|
13595
|
+
})),
|
|
13279
13596
|
workspaceId: await loadWorkspaceId({
|
|
13280
13597
|
workspaceId: result.data.workspaceId,
|
|
13281
13598
|
profile: result.data.profile
|
|
@@ -13325,61 +13642,55 @@ const healthCommand = defineAppCommand({
|
|
|
13325
13642
|
const listAppsOptionsSchema = z.object({
|
|
13326
13643
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
13327
13644
|
profile: z.string().optional(),
|
|
13328
|
-
|
|
13645
|
+
order: orderArg.optional(),
|
|
13646
|
+
limit: z.coerce.number().int().nonnegative().optional()
|
|
13329
13647
|
});
|
|
13330
13648
|
async function loadOptions$8(options) {
|
|
13331
13649
|
const result = listAppsOptionsSchema.safeParse(options);
|
|
13332
13650
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13333
13651
|
return {
|
|
13334
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13652
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13653
|
+
useProfile: true,
|
|
13654
|
+
profile: result.data.profile
|
|
13655
|
+
})),
|
|
13335
13656
|
workspaceId: await loadWorkspaceId({
|
|
13336
13657
|
workspaceId: result.data.workspaceId,
|
|
13337
13658
|
profile: result.data.profile
|
|
13338
13659
|
}),
|
|
13660
|
+
order: result.data.order,
|
|
13339
13661
|
limit: result.data.limit
|
|
13340
13662
|
};
|
|
13341
13663
|
}
|
|
13342
13664
|
/**
|
|
13343
|
-
* List applications in a workspace with an optional limit.
|
|
13665
|
+
* List applications in a workspace with an optional order and limit.
|
|
13344
13666
|
* @param options - Application listing options
|
|
13345
13667
|
* @returns List of applications
|
|
13346
13668
|
*/
|
|
13347
13669
|
async function listApps(options) {
|
|
13348
|
-
const { client, workspaceId, limit } = await loadOptions$8(options);
|
|
13349
|
-
const
|
|
13350
|
-
|
|
13351
|
-
let pageToken = "";
|
|
13352
|
-
while (true) {
|
|
13353
|
-
if (hasLimit && results.length >= limit) break;
|
|
13354
|
-
const remaining = hasLimit ? limit - results.length : void 0;
|
|
13355
|
-
const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
|
|
13670
|
+
const { client, workspaceId, order, limit } = await loadOptions$8(options);
|
|
13671
|
+
const pageDirection = toPageDirection(order);
|
|
13672
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
13356
13673
|
const { applications, nextPageToken } = await client.listApplications({
|
|
13357
13674
|
workspaceId,
|
|
13358
13675
|
pageToken,
|
|
13359
|
-
|
|
13676
|
+
pageSize,
|
|
13677
|
+
pageDirection
|
|
13360
13678
|
});
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
else results.push(...mapped);
|
|
13364
|
-
if (!nextPageToken) break;
|
|
13365
|
-
pageToken = nextPageToken;
|
|
13366
|
-
}
|
|
13367
|
-
return results;
|
|
13679
|
+
return [applications, nextPageToken];
|
|
13680
|
+
}, { limit })).map(appInfo);
|
|
13368
13681
|
}
|
|
13369
13682
|
const listCommand$2 = defineAppCommand({
|
|
13370
13683
|
name: "list",
|
|
13371
13684
|
description: "List applications in a workspace",
|
|
13372
13685
|
args: z.object({
|
|
13373
13686
|
...workspaceArgs,
|
|
13374
|
-
|
|
13375
|
-
alias: "l",
|
|
13376
|
-
description: "Maximum number of applications to list"
|
|
13377
|
-
})
|
|
13687
|
+
...paginationArgs()
|
|
13378
13688
|
}).strict(),
|
|
13379
13689
|
run: async (args) => {
|
|
13380
13690
|
const apps = await listApps({
|
|
13381
13691
|
workspaceId: args["workspace-id"],
|
|
13382
13692
|
profile: args.profile,
|
|
13693
|
+
order: args.order,
|
|
13383
13694
|
limit: args.limit
|
|
13384
13695
|
});
|
|
13385
13696
|
const formattedApps = args.json ? apps : apps.map(({ updatedAt: _, createdAt, ...rest }) => ({
|
|
@@ -13589,7 +13900,10 @@ async function loadOptions$6(options) {
|
|
|
13589
13900
|
const result = getWorkspaceOptionsSchema.safeParse(options);
|
|
13590
13901
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13591
13902
|
return {
|
|
13592
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
13903
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
13904
|
+
useProfile: true,
|
|
13905
|
+
profile: result.data.profile
|
|
13906
|
+
})),
|
|
13593
13907
|
workspaceId: await loadWorkspaceId({
|
|
13594
13908
|
workspaceId: result.data.workspaceId,
|
|
13595
13909
|
profile: result.data.profile
|
|
@@ -13628,41 +13942,31 @@ const getCommand = defineAppCommand({
|
|
|
13628
13942
|
//#endregion
|
|
13629
13943
|
//#region src/cli/commands/workspace/list.ts
|
|
13630
13944
|
/**
|
|
13631
|
-
* List workspaces with an optional limit.
|
|
13945
|
+
* List workspaces with an optional order and limit.
|
|
13632
13946
|
* @param options - Workspace listing options
|
|
13633
13947
|
* @returns List of workspaces
|
|
13634
13948
|
*/
|
|
13635
13949
|
async function listWorkspaces(options) {
|
|
13636
|
-
const limit = options?.limit;
|
|
13637
|
-
const hasLimit = limit !== void 0;
|
|
13638
13950
|
const client = await initOperatorClient(await loadAccessToken());
|
|
13639
|
-
const
|
|
13640
|
-
|
|
13641
|
-
while (true) {
|
|
13642
|
-
if (hasLimit && results.length >= limit) break;
|
|
13643
|
-
const remaining = hasLimit ? limit - results.length : void 0;
|
|
13644
|
-
const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
|
|
13951
|
+
const pageDirection = toPageDirection(options?.order);
|
|
13952
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
13645
13953
|
const { workspaces, nextPageToken } = await client.listWorkspaces({
|
|
13646
13954
|
pageToken,
|
|
13647
|
-
|
|
13955
|
+
pageSize,
|
|
13956
|
+
pageDirection
|
|
13648
13957
|
});
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
else results.push(...mapped);
|
|
13652
|
-
if (!nextPageToken) break;
|
|
13653
|
-
pageToken = nextPageToken;
|
|
13654
|
-
}
|
|
13655
|
-
return results;
|
|
13958
|
+
return [workspaces, nextPageToken];
|
|
13959
|
+
}, { limit: options?.limit })).map(workspaceInfo);
|
|
13656
13960
|
}
|
|
13657
13961
|
const listCommand$1 = defineAppCommand({
|
|
13658
13962
|
name: "list",
|
|
13659
13963
|
description: "List all Tailor Platform workspaces.",
|
|
13660
|
-
args: z.object({
|
|
13661
|
-
alias: "l",
|
|
13662
|
-
description: "Maximum number of workspaces to list"
|
|
13663
|
-
}) }).strict(),
|
|
13964
|
+
args: z.object({ ...paginationArgs() }).strict(),
|
|
13664
13965
|
run: async (args) => {
|
|
13665
|
-
const workspaces = await listWorkspaces({
|
|
13966
|
+
const workspaces = await listWorkspaces({
|
|
13967
|
+
order: args.order,
|
|
13968
|
+
limit: args.limit
|
|
13969
|
+
});
|
|
13666
13970
|
logger.out(workspaces, { display: { updatedAt: null } });
|
|
13667
13971
|
}
|
|
13668
13972
|
});
|
|
@@ -13753,7 +14057,10 @@ async function loadOptions$4(options) {
|
|
|
13753
14057
|
const result = inviteUserOptionsSchema.safeParse(options);
|
|
13754
14058
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13755
14059
|
return {
|
|
13756
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
14060
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
14061
|
+
useProfile: true,
|
|
14062
|
+
profile: result.data.profile
|
|
14063
|
+
})),
|
|
13757
14064
|
workspaceId: await loadWorkspaceId({
|
|
13758
14065
|
workspaceId: result.data.workspaceId,
|
|
13759
14066
|
profile: result.data.profile
|
|
@@ -13802,61 +14109,55 @@ const inviteCommand = defineAppCommand({
|
|
|
13802
14109
|
const listUsersOptionsSchema = z.object({
|
|
13803
14110
|
workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
|
|
13804
14111
|
profile: z.string().optional(),
|
|
13805
|
-
|
|
14112
|
+
order: orderArg.optional(),
|
|
14113
|
+
limit: z.coerce.number().int().nonnegative().optional()
|
|
13806
14114
|
});
|
|
13807
14115
|
async function loadOptions$3(options) {
|
|
13808
14116
|
const result = listUsersOptionsSchema.safeParse(options);
|
|
13809
14117
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13810
14118
|
return {
|
|
13811
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
14119
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
14120
|
+
useProfile: true,
|
|
14121
|
+
profile: result.data.profile
|
|
14122
|
+
})),
|
|
13812
14123
|
workspaceId: await loadWorkspaceId({
|
|
13813
14124
|
workspaceId: result.data.workspaceId,
|
|
13814
14125
|
profile: result.data.profile
|
|
13815
14126
|
}),
|
|
14127
|
+
order: result.data.order,
|
|
13816
14128
|
limit: result.data.limit
|
|
13817
14129
|
};
|
|
13818
14130
|
}
|
|
13819
14131
|
/**
|
|
13820
|
-
* List users in a workspace with an optional limit.
|
|
14132
|
+
* List users in a workspace with an optional order and limit.
|
|
13821
14133
|
* @param options - User listing options
|
|
13822
14134
|
* @returns List of workspace users
|
|
13823
14135
|
*/
|
|
13824
14136
|
async function listUsers(options) {
|
|
13825
|
-
const { client, workspaceId, limit } = await loadOptions$3(options);
|
|
13826
|
-
const
|
|
13827
|
-
|
|
13828
|
-
let pageToken = "";
|
|
13829
|
-
while (true) {
|
|
13830
|
-
if (hasLimit && results.length >= limit) break;
|
|
13831
|
-
const remaining = hasLimit ? limit - results.length : void 0;
|
|
13832
|
-
const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
|
|
14137
|
+
const { client, workspaceId, order, limit } = await loadOptions$3(options);
|
|
14138
|
+
const pageDirection = toPageDirection(order);
|
|
14139
|
+
return (await fetchPaged(async (pageToken, pageSize) => {
|
|
13833
14140
|
const { workspacePlatformUsers, nextPageToken } = await client.listWorkspacePlatformUsers({
|
|
13834
14141
|
workspaceId,
|
|
13835
14142
|
pageToken,
|
|
13836
|
-
|
|
14143
|
+
pageSize,
|
|
14144
|
+
pageDirection
|
|
13837
14145
|
});
|
|
13838
|
-
|
|
13839
|
-
|
|
13840
|
-
else results.push(...mapped);
|
|
13841
|
-
if (!nextPageToken) break;
|
|
13842
|
-
pageToken = nextPageToken;
|
|
13843
|
-
}
|
|
13844
|
-
return results;
|
|
14146
|
+
return [workspacePlatformUsers, nextPageToken];
|
|
14147
|
+
}, { limit })).map(userInfo);
|
|
13845
14148
|
}
|
|
13846
14149
|
const listCommand = defineAppCommand({
|
|
13847
14150
|
name: "list",
|
|
13848
14151
|
description: "List users in a workspace",
|
|
13849
14152
|
args: z.object({
|
|
13850
14153
|
...workspaceArgs,
|
|
13851
|
-
|
|
13852
|
-
alias: "l",
|
|
13853
|
-
description: "Maximum number of users to list"
|
|
13854
|
-
})
|
|
14154
|
+
...paginationArgs()
|
|
13855
14155
|
}).strict(),
|
|
13856
14156
|
run: async (args) => {
|
|
13857
14157
|
const users = await listUsers({
|
|
13858
14158
|
workspaceId: args["workspace-id"],
|
|
13859
14159
|
profile: args.profile,
|
|
14160
|
+
order: args.order,
|
|
13860
14161
|
limit: args.limit
|
|
13861
14162
|
});
|
|
13862
14163
|
logger.out(users);
|
|
@@ -13874,7 +14175,10 @@ async function loadOptions$2(options) {
|
|
|
13874
14175
|
const result = removeUserOptionsSchema.safeParse(options);
|
|
13875
14176
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13876
14177
|
return {
|
|
13877
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
14178
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
14179
|
+
useProfile: true,
|
|
14180
|
+
profile: result.data.profile
|
|
14181
|
+
})),
|
|
13878
14182
|
workspaceId: await loadWorkspaceId({
|
|
13879
14183
|
workspaceId: result.data.workspaceId,
|
|
13880
14184
|
profile: result.data.profile
|
|
@@ -13930,7 +14234,10 @@ async function loadOptions$1(options) {
|
|
|
13930
14234
|
const result = updateUserOptionsSchema.safeParse(options);
|
|
13931
14235
|
if (!result.success) throw new Error(result.error.issues[0].message);
|
|
13932
14236
|
return {
|
|
13933
|
-
client: await initOperatorClient(await loadAccessToken(
|
|
14237
|
+
client: await initOperatorClient(await loadAccessToken({
|
|
14238
|
+
useProfile: true,
|
|
14239
|
+
profile: result.data.profile
|
|
14240
|
+
})),
|
|
13934
14241
|
workspaceId: await loadWorkspaceId({
|
|
13935
14242
|
workspaceId: result.data.workspaceId,
|
|
13936
14243
|
profile: result.data.profile
|
|
@@ -14917,5 +15224,5 @@ function isDeno() {
|
|
|
14917
15224
|
}
|
|
14918
15225
|
|
|
14919
15226
|
//#endregion
|
|
14920
|
-
export { deleteCommand$1 as $,
|
|
14921
|
-
//# sourceMappingURL=runtime-
|
|
15227
|
+
export { deleteCommand$1 as $, getMigrationDirPath as $t, truncate as A, executionsCommand as At, updateOrganization as B, MIGRATION_LABEL_KEY as Bt, listCommand$2 as C, toPageDirection as Cn, jobsCommand as Ct, resumeWorkflow as D, startWorkflow as Dt, resumeCommand as E, startCommand as Et, showCommand as F, getCommand$6 as Ft, getCommand$1 as G, INITIAL_SCHEMA_NUMBER as Gt, treeCommand as H, bundleMigrationScript as Ht, logBetaWarning as I, getExecutor as It, updateFolder as J, compareLocalTypesWithSnapshot as Jt, getOrganization as K, MIGRATE_FILE_NAME as Kt, remove as L, apply as Lt, generate as M, listWorkflowExecutions as Mt, generateCommand as N, functionExecutionStatusToString as Nt, listCommand$3 as O, getCommand$5 as Ot, show as P, formatKeyValueTable as Pt, getFolder as Q, getLatestMigrationNumber as Qt, removeCommand$1 as R, executeScript as Rt, listApps as S, paginationArgs as Sn, getExecutorJob as St, healthCommand as T, watchExecutorJob as Tt, listCommand$4 as U, DB_TYPES_FILE_NAME as Ut, organizationTree as V, parseMigrationLabelNumber as Vt, listOrganizations as W, DIFF_FILE_NAME as Wt, listFolders as X, createSnapshotFromLocalTypes as Xt, listCommand$5 as Y, compareSnapshots as Yt, getCommand$2 as Z, formatMigrationNumber as Zt, getWorkspace as _, commonArgs as _n, webhookCommand as _t, updateUser as a, reconstructSnapshotFromMigrations as an, getCommand$3 as at, createCommand as b, isVerbose as bn, listCommand$9 as bt, listCommand as c, hasChanges as cn, tokenCommand as ct, inviteUser as d, sdkNameLabelKey as dn, generate$1 as dt, getMigrationFilePath as en, deleteFolder as et, restoreCommand as f, trnPrefix as fn, listCommand$8 as ft, getCommand as g, defineAppCommand as gn, listWebhookExecutors as gt, listWorkspaces as h, apiCall as hn, getFunctionRegistry as ht, updateCommand as i, loadDiff as in, listOAuth2Clients as it, truncateCommand as j, getWorkflowExecution as jt, listWorkflows as k, getWorkflow as kt, listUsers as l, getNamespacesWithMigrations as ln, listCommand$7 as lt, listCommand$1 as m, apiCommand as mn, getCommand$4 as mt, query as n, getNextMigrationNumber as nn, createFolder as nt, removeCommand as o, formatDiffSummary as on, getOAuth2Client as ot, restoreWorkspace as p, generateUserTypes as pn, listFunctionRegistries as pt, updateCommand$2 as q, SCHEMA_FILE_NAME as qt, queryCommand as r, isValidMigrationNumber as rn, listCommand$6 as rt, removeUser as s, formatMigrationDiff as sn, getMachineUserToken as st, isNativeTypeScriptRuntime as t, getMigrationFiles as tn, createCommand$1 as tt, inviteCommand as u, prompt as un, listMachineUsers as ut, deleteCommand as v, confirmationArgs as vn, triggerCommand as vt, getAppHealth as w, workspaceArgs as wn, listExecutorJobs as wt, createWorkspace as x, pagedLogArgs as xn, listExecutors as xt, deleteWorkspace as y, deploymentArgs as yn, triggerExecutor as yt, updateCommand$1 as z, waitForExecution$1 as zt };
|
|
15228
|
+
//# sourceMappingURL=runtime-l7GFD3Xg.mjs.map
|