@tailor-platform/sdk 1.43.0 → 1.44.1

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/application-Cot5-3g3.mjs +4 -0
  3. package/dist/{application-DQpD_kHR.mjs → application-vJxYH5LE.mjs} +148 -11
  4. package/dist/application-vJxYH5LE.mjs.map +1 -0
  5. package/dist/cli/index.mjs +27 -19
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +349 -15
  8. package/dist/cli/lib.mjs +8 -8
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/cli/skills.mjs.map +1 -1
  11. package/dist/{client-CcV6Jjds.mjs → client-DcuQRqSd.mjs} +127 -54
  12. package/dist/client-DcuQRqSd.mjs.map +1 -0
  13. package/dist/{client-Cn9SqhZT.mjs → client-IsYnTV5A.mjs} +1 -1
  14. package/dist/configure/index.d.mts +3 -3
  15. package/dist/configure/index.mjs +1 -1
  16. package/dist/configure/index.mjs.map +1 -1
  17. package/dist/{crash-report-CSYupJ0T.mjs → crash-report-DQen2i_W.mjs} +1 -1
  18. package/dist/{crash-report-CUbm1ErM.mjs → crash-report-DVZsX1bs.mjs} +4 -4
  19. package/dist/{crash-report-CUbm1ErM.mjs.map → crash-report-DVZsX1bs.mjs.map} +1 -1
  20. package/dist/{enum-constants-Dx82rSjf.mjs → enum-constants-C3KSpsYj.mjs} +1 -1
  21. package/dist/{enum-constants-Dx82rSjf.mjs.map → enum-constants-C3KSpsYj.mjs.map} +1 -1
  22. package/dist/{errors-ChWX5ZG8.mjs → errors-_M2TVoWh.mjs} +1 -1
  23. package/dist/{errors-ChWX5ZG8.mjs.map → errors-_M2TVoWh.mjs.map} +1 -1
  24. package/dist/{file-utils-DeWpvq3T.mjs → file-utils-775qWKoo.mjs} +1 -1
  25. package/dist/{file-utils-DeWpvq3T.mjs.map → file-utils-775qWKoo.mjs.map} +1 -1
  26. package/dist/{index-Br4XCvX1.d.mts → index-BOfTiouP.d.mts} +5 -2
  27. package/dist/interceptor-4UC-KTno.mjs.map +1 -1
  28. package/dist/job-BOvKyNdT.mjs.map +1 -1
  29. package/dist/kysely/index.mjs.map +1 -1
  30. package/dist/{kysely-type-CwtvQuxh.mjs → kysely-type-BQsYEZoY.mjs} +1 -1
  31. package/dist/kysely-type-BQsYEZoY.mjs.map +1 -0
  32. package/dist/logger-DTNAMYGy.mjs.map +1 -1
  33. package/dist/{package-json-CWp8s9dE.mjs → package-json-CRzw5eUf.mjs} +1 -1
  34. package/dist/{package-json-CWp8s9dE.mjs.map → package-json-CRzw5eUf.mjs.map} +1 -1
  35. package/dist/package-json-DR_mqrCW.mjs +4 -0
  36. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  37. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  38. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  39. package/dist/plugin/builtin/seed/index.mjs +1 -1
  40. package/dist/plugin/index.mjs.map +1 -1
  41. package/dist/repl-editor-DjycioU-.mjs.map +1 -1
  42. package/dist/{runtime-Bn68JXnL.mjs → runtime-DQqulWPm.mjs} +324 -126
  43. package/dist/runtime-DQqulWPm.mjs.map +1 -0
  44. package/dist/{schema-CEcfEyPN.mjs → schema-DBq6hr6h.mjs} +13 -2
  45. package/dist/{schema-CEcfEyPN.mjs.map → schema-DBq6hr6h.mjs.map} +1 -1
  46. package/dist/{seed-CyYPhvNL.mjs → seed-BkVKgsxf.mjs} +1 -1
  47. package/dist/{seed-CyYPhvNL.mjs.map → seed-BkVKgsxf.mjs.map} +1 -1
  48. package/dist/{service-SrG26B9T.mjs → service-CCnx_IFw.mjs} +2 -2
  49. package/dist/{service-SrG26B9T.mjs.map → service-CCnx_IFw.mjs.map} +1 -1
  50. package/dist/{telemetry-BuDto_2q.mjs → telemetry-B6Le9XT-.mjs} +2 -2
  51. package/dist/{telemetry-BuDto_2q.mjs.map → telemetry-B6Le9XT-.mjs.map} +1 -1
  52. package/dist/telemetry-C_WXxIo0.mjs +4 -0
  53. package/dist/types-Duhhsx3R.mjs.map +1 -1
  54. package/dist/utils/test/index.d.mts +2 -2
  55. package/dist/utils/test/index.mjs.map +1 -1
  56. package/dist/{workflow.generated-CDCnZNkH.d.mts → workflow.generated-B7Mupf5V.d.mts} +5 -2
  57. package/docs/cli/application.md +130 -5
  58. package/docs/cli/crash-report.md +12 -1
  59. package/docs/cli/executor.md +6 -4
  60. package/docs/cli/organization.md +6 -5
  61. package/docs/cli/workspace.md +16 -13
  62. package/docs/cli-reference.md +10 -9
  63. package/docs/services/workflow.md +20 -0
  64. package/package.json +9 -9
  65. package/dist/application-DQpD_kHR.mjs.map +0 -1
  66. package/dist/application-DUcmoFdc.mjs +0 -4
  67. package/dist/client-CcV6Jjds.mjs.map +0 -1
  68. package/dist/kysely-type-CwtvQuxh.mjs.map +0 -1
  69. package/dist/package-json-CPR7s5hf.mjs +0 -4
  70. package/dist/runtime-Bn68JXnL.mjs.map +0 -1
  71. package/dist/telemetry-C1hzFaiV.mjs +0 -4
@@ -1,34 +1,34 @@
1
1
 
2
- import { $ as ApplicationSchemaUpdateAttemptStatus, 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 PageDirection, 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 Condition_Operator, Y as ConditionSchema, Z as FilterSchema, _ as WorkspacePlatformUserRole, a as fetchMachineUserToken, b as TailorDBGQLPermission_Action, d as initOperatorClient, et as Subgraph_ServiceType, 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-CcV6Jjds.mjs";
3
- import { t as db } from "./schema-CEcfEyPN.mjs";
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-DcuQRqSd.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 readPackageJson } from "./package-json-CWp8s9dE.mjs";
6
- 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-DQpD_kHR.mjs";
7
- import { r as withSpan } from "./telemetry-BuDto_2q.mjs";
8
- import { n as isCLIError, t as createCLIError } from "./errors-ChWX5ZG8.mjs";
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-vJxYH5LE.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
- function getEndpointFieldNames(methodName) {
304
- const method = OperatorService.methods.find((m) => m.name === methodName);
305
- if (!method) return [];
306
- return method.input.fields.map((f) => f.jsonName);
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();
307
311
  }
312
+ function getMethodDescriptor(methodName) {
313
+ return unaryMethods().find((m) => m.name === methodName);
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: `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\`:
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 = args.endpoint.includes("/") ? args.endpoint.split("/").pop() : args.endpoint;
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 = getEndpointFieldNames(methodName);
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 resolvedCors = await resolveStaticWebsiteUrls(client, workspaceId, application.config.cors, "CORS");
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,
@@ -2793,13 +3000,14 @@ async function planAuth(context) {
2793
3000
  }
2794
3001
  const { changeSet: serviceChangeSet, conflicts, unmanaged, resourceOwners } = await planServices$2(client, workspaceId, application.name, auths, forceApplyAll);
2795
3002
  const deletedServices = serviceChangeSet.deletes.map((del) => del.name);
3003
+ const expectedLocalWebsites = new Set(application.staticWebsiteServices.map((website) => website.name));
2796
3004
  const [idpConfigChangeSet, userProfileConfigChangeSet, tenantConfigChangeSet, machineUserChangeSet, authHookChangeSet, oauth2ClientChangeSet, scimChangeSet, scimResourceChangeSet, connectionResult] = await Promise.all([
2797
3005
  planIdPConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
2798
3006
  planUserProfileConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
2799
3007
  planTenantConfigs(client, workspaceId, auths, deletedServices, forceApplyAll),
2800
3008
  planMachineUsers(client, workspaceId, auths, deletedServices, forceApplyAll),
2801
3009
  planAuthHooks(client, workspaceId, auths, deletedServices, forceApplyAll),
2802
- planOAuth2Clients(client, workspaceId, auths, deletedServices, forceApplyAll),
3010
+ planOAuth2Clients(client, workspaceId, auths, deletedServices, expectedLocalWebsites, forceApplyAll),
2803
3011
  planSCIMConfigs(client, workspaceId, auths, deletedServices),
2804
3012
  planSCIMResources(client, workspaceId, auths, deletedServices),
2805
3013
  planAuthConnections(client, workspaceId, application.name, auths)
@@ -3408,7 +3616,7 @@ function oauth2LifetimeToSeconds(lifetime) {
3408
3616
  function areOAuth2ClientsEqual(existing, desired) {
3409
3617
  return areNormalizedEqual(normalizeComparableOAuth2Client(existing), normalizeComparableOAuth2Client(desired));
3410
3618
  }
3411
- async function planOAuth2Clients(client, workspaceId, auths, deletedServices, forceApplyAll = false) {
3619
+ async function planOAuth2Clients(client, workspaceId, auths, deletedServices, expectedLocalWebsites, forceApplyAll = false) {
3412
3620
  const changeSet = createChangeSet("Auth oauth2Clients");
3413
3621
  const fetchOAuth2Clients = (namespaceName) => {
3414
3622
  return fetchAll(async (pageToken, maxPageSize) => {
@@ -3437,7 +3645,7 @@ async function planOAuth2Clients(client, workspaceId, auths, deletedServices, fo
3437
3645
  const oauth2Client = config.oauth2Clients?.[oauth2ClientName];
3438
3646
  if (!oauth2Client) continue;
3439
3647
  const newOAuth2Client = protoOAuth2Client(oauth2ClientName, oauth2Client);
3440
- 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 });
3441
3649
  if (existingClientsMap.has(oauth2ClientName)) {
3442
3650
  const existingClient = existingClientsMap.get(oauth2ClientName);
3443
3651
  if (existingClient.clientType !== newOAuth2Client.clientType) changeSet.replaces.push({
@@ -7414,13 +7622,25 @@ function isPlainObject(value) {
7414
7622
  return typeof value === "object" && value !== null && !Array.isArray(value);
7415
7623
  }
7416
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
+ */
7417
7629
  disableGqlOperations: {
7418
7630
  create: false,
7419
7631
  update: false,
7420
7632
  delete: false,
7421
7633
  read: false
7422
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
+ */
7423
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
+ */
7424
7644
  numericStringPaths: new Set([
7425
7645
  "schema.fields.*.serial.start",
7426
7646
  "schema.fields.*.serial.maxValue",
@@ -7959,7 +8179,8 @@ async function applyWorkflow(client, result, phase = "create-update") {
7959
8179
  workflowName: create.workflow.name,
7960
8180
  mainJobFunctionName: create.workflow.mainJob.name,
7961
8181
  jobFunctions: filteredVersions,
7962
- ...create.workflow.retryPolicy && { retryPolicy: toRetryPolicy(create.workflow.retryPolicy) }
8182
+ ...create.workflow.retryPolicy && { retryPolicy: toRetryPolicy(create.workflow.retryPolicy) },
8183
+ ...create.workflow.concurrencyPolicy && { concurrencyPolicy: toConcurrencyPolicy(create.workflow.concurrencyPolicy) }
7963
8184
  });
7964
8185
  await client.setMetadata(create.metaRequest);
7965
8186
  }), ...changeSet.updates.map(async (update) => {
@@ -7969,7 +8190,8 @@ async function applyWorkflow(client, result, phase = "create-update") {
7969
8190
  workflowName: update.workflow.name,
7970
8191
  mainJobFunctionName: update.workflow.mainJob.name,
7971
8192
  jobFunctions: filteredVersions,
7972
- ...update.workflow.retryPolicy && { retryPolicy: toRetryPolicy(update.workflow.retryPolicy) }
8193
+ ...update.workflow.retryPolicy && { retryPolicy: toRetryPolicy(update.workflow.retryPolicy) },
8194
+ ...update.workflow.concurrencyPolicy && { concurrencyPolicy: toConcurrencyPolicy(update.workflow.concurrencyPolicy) }
7973
8195
  });
7974
8196
  await client.setMetadata(update.metaRequest);
7975
8197
  })]);
@@ -8063,6 +8285,9 @@ function toRetryPolicy(policy) {
8063
8285
  backoffMultiplier: policy.backoffMultiplier
8064
8286
  };
8065
8287
  }
8288
+ function toConcurrencyPolicy(policy) {
8289
+ return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
8290
+ }
8066
8291
  function workflowTrn$1(workspaceId, name) {
8067
8292
  return `trn:v1:workspace:${workspaceId}:workflow:${name}`;
8068
8293
  }
@@ -8170,7 +8395,7 @@ function canTreatWorkflowAsUnchanged(existing, workflow, usedJobNames, unchanged
8170
8395
  return areWorkflowsEqual(existing, workflow, usedJobNames);
8171
8396
  }
8172
8397
  function areWorkflowsEqual(existing, workflow, usedJobNames) {
8173
- return existing.mainJobFunctionName === workflow.mainJob.name && areNormalizedEqual(normalizeComparableExistingWorkflowRetryPolicy(existing.retryPolicy), normalizeComparableWorkflowRetryPolicy(workflow.retryPolicy)) && areNormalizedEqual(normalizeComparableWorkflowJobNames(existing.jobFunctions), normalizeComparableWorkflowJobNames(usedJobNames));
8398
+ return existing.mainJobFunctionName === workflow.mainJob.name && areNormalizedEqual(normalizeComparableExistingWorkflowRetryPolicy(existing.retryPolicy), normalizeComparableWorkflowRetryPolicy(workflow.retryPolicy)) && areNormalizedEqual(normalizeComparableConcurrencyPolicy(existing.concurrencyPolicy), normalizeComparableConcurrencyPolicy(workflow.concurrencyPolicy)) && areNormalizedEqual(normalizeComparableWorkflowJobNames(existing.jobFunctions), normalizeComparableWorkflowJobNames(usedJobNames));
8174
8399
  }
8175
8400
  function normalizeComparableExistingWorkflowRetryPolicy(policy) {
8176
8401
  if (!policy) return;
@@ -8196,6 +8421,10 @@ function normalizeComparableWorkflowRetryPolicy(policy) {
8196
8421
  maxBackoff: parseDurationToProto(policy.maxBackoff)
8197
8422
  });
8198
8423
  }
8424
+ function normalizeComparableConcurrencyPolicy(policy) {
8425
+ if (!policy || !policy.maxConcurrentExecutions) return;
8426
+ return { maxConcurrentExecutions: policy.maxConcurrentExecutions };
8427
+ }
8199
8428
  function normalizeComparableWorkflowJobNames(jobFunctions) {
8200
8429
  return Array.isArray(jobFunctions) ? [...jobFunctions].sort() : Object.keys(jobFunctions ?? {}).sort();
8201
8430
  }
@@ -10274,14 +10503,16 @@ async function listWebhookExecutors(options) {
10274
10503
  workspaceId: options?.workspaceId,
10275
10504
  profile: options?.profile
10276
10505
  });
10277
- return (await fetchAll(async (pageToken, maxPageSize) => {
10506
+ const pageDirection = toPageDirection(options?.order);
10507
+ return (await fetchPaged(async (pageToken, pageSize) => {
10278
10508
  const { webhooks, nextPageToken } = await client.listExecutorIncomingWebhooks({
10279
10509
  workspaceId,
10280
10510
  pageToken,
10281
- pageSize: maxPageSize
10511
+ pageSize,
10512
+ pageDirection
10282
10513
  });
10283
10514
  return [webhooks, nextPageToken];
10284
- })).map((w) => ({
10515
+ }, { limit: options?.limit })).map((w) => ({
10285
10516
  name: w.executorName,
10286
10517
  webhookUrl: w.url,
10287
10518
  disabled: w.disabled
@@ -10290,11 +10521,16 @@ async function listWebhookExecutors(options) {
10290
10521
  const listWebhookCommand = defineAppCommand({
10291
10522
  name: "list",
10292
10523
  description: "List executors with incoming webhook triggers",
10293
- args: z.object({ ...workspaceArgs }).strict(),
10524
+ args: z.object({
10525
+ ...workspaceArgs,
10526
+ ...paginationArgs()
10527
+ }).strict(),
10294
10528
  run: async (args) => {
10295
10529
  const executors = await listWebhookExecutors({
10296
10530
  workspaceId: args["workspace-id"],
10297
- profile: args.profile
10531
+ profile: args.profile,
10532
+ order: args.order,
10533
+ limit: args.limit
10298
10534
  });
10299
10535
  if (executors.length === 0) {
10300
10536
  logger.info("No webhook executors found.");
@@ -11778,7 +12014,8 @@ const getCommand$2 = defineAppCommand({
11778
12014
  const listFoldersOptionsSchema = z.object({
11779
12015
  organizationId: z.uuid({ message: "organization-id must be a valid UUID" }),
11780
12016
  parentFolderId: z.string().optional(),
11781
- limit: z.number().int().positive().optional()
12017
+ order: orderArg.optional(),
12018
+ limit: z.number().int().nonnegative().optional()
11782
12019
  });
11783
12020
  /**
11784
12021
  * List folders in an organization.
@@ -11788,28 +12025,19 @@ const listFoldersOptionsSchema = z.object({
11788
12025
  async function listFolders(options) {
11789
12026
  const result = listFoldersOptionsSchema.safeParse(options);
11790
12027
  if (!result.success) throw new Error(result.error.issues[0].message);
11791
- const { organizationId, parentFolderId, limit } = result.data;
11792
- const hasLimit = limit !== void 0;
12028
+ const { organizationId, parentFolderId, order, limit } = result.data;
11793
12029
  const client = await initOperatorClient(await loadAccessToken());
11794
- const results = [];
11795
- let pageToken = "";
11796
- while (true) {
11797
- if (hasLimit && results.length >= limit) break;
11798
- const remaining = hasLimit ? limit - results.length : void 0;
11799
- const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
12030
+ const pageDirection = toPageDirection(order);
12031
+ return (await fetchPaged(async (pageToken, pageSize) => {
11800
12032
  const response = await client.listOrganizationFolders({
11801
12033
  organizationId,
11802
12034
  ...parentFolderId ? { parentFolderId } : {},
11803
12035
  pageToken,
11804
- ...pageSize !== void 0 ? { pageSize } : {}
12036
+ pageSize,
12037
+ pageDirection
11805
12038
  });
11806
- const mapped = response.folders.map(folderListInfo);
11807
- if (remaining !== void 0 && mapped.length > remaining) results.push(...mapped.slice(0, remaining));
11808
- else results.push(...mapped);
11809
- if (!response.nextPageToken) break;
11810
- pageToken = response.nextPageToken;
11811
- }
11812
- return results;
12039
+ return [response.folders, response.nextPageToken];
12040
+ }, { limit })).map(folderListInfo);
11813
12041
  }
11814
12042
  const listCommand$5 = defineAppCommand({
11815
12043
  name: "list",
@@ -11817,15 +12045,13 @@ const listCommand$5 = defineAppCommand({
11817
12045
  args: z.object({
11818
12046
  ...organizationArgs,
11819
12047
  "parent-folder-id": arg(z.string().optional(), { description: "Parent folder ID to list children of" }),
11820
- limit: arg(positiveIntArg.optional(), {
11821
- alias: "l",
11822
- description: "Maximum number of folders to list"
11823
- })
12048
+ ...paginationArgs()
11824
12049
  }).strict(),
11825
12050
  run: async (args) => {
11826
12051
  const folders = await listFolders({
11827
12052
  organizationId: args["organization-id"],
11828
12053
  parentFolderId: args["parent-folder-id"],
12054
+ order: args.order,
11829
12055
  limit: args.limit
11830
12056
  });
11831
12057
  logger.out(folders, { display: { updatedAt: null } });
@@ -12859,7 +13085,7 @@ async function generate(options) {
12859
13085
  if (options.init) await handleInitOption(namespacesWithMigrations, options.yes);
12860
13086
  let pluginManager;
12861
13087
  if (plugins.length > 0) pluginManager = new PluginManager(plugins);
12862
- const { defineApplication } = await import("./application-DUcmoFdc.mjs");
13088
+ const { defineApplication } = await import("./application-Cot5-3g3.mjs");
12863
13089
  const application = defineApplication({
12864
13090
  config,
12865
13091
  pluginManager
@@ -13425,7 +13651,8 @@ const healthCommand = defineAppCommand({
13425
13651
  const listAppsOptionsSchema = z.object({
13426
13652
  workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
13427
13653
  profile: z.string().optional(),
13428
- limit: z.coerce.number().int().positive().optional()
13654
+ order: orderArg.optional(),
13655
+ limit: z.coerce.number().int().nonnegative().optional()
13429
13656
  });
13430
13657
  async function loadOptions$8(options) {
13431
13658
  const result = listAppsOptionsSchema.safeParse(options);
@@ -13439,50 +13666,40 @@ async function loadOptions$8(options) {
13439
13666
  workspaceId: result.data.workspaceId,
13440
13667
  profile: result.data.profile
13441
13668
  }),
13669
+ order: result.data.order,
13442
13670
  limit: result.data.limit
13443
13671
  };
13444
13672
  }
13445
13673
  /**
13446
- * List applications in a workspace with an optional limit.
13674
+ * List applications in a workspace with an optional order and limit.
13447
13675
  * @param options - Application listing options
13448
13676
  * @returns List of applications
13449
13677
  */
13450
13678
  async function listApps(options) {
13451
- const { client, workspaceId, limit } = await loadOptions$8(options);
13452
- const hasLimit = limit !== void 0;
13453
- const results = [];
13454
- let pageToken = "";
13455
- while (true) {
13456
- if (hasLimit && results.length >= limit) break;
13457
- const remaining = hasLimit ? limit - results.length : void 0;
13458
- const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
13679
+ const { client, workspaceId, order, limit } = await loadOptions$8(options);
13680
+ const pageDirection = toPageDirection(order);
13681
+ return (await fetchPaged(async (pageToken, pageSize) => {
13459
13682
  const { applications, nextPageToken } = await client.listApplications({
13460
13683
  workspaceId,
13461
13684
  pageToken,
13462
- ...pageSize !== void 0 ? { pageSize } : {}
13685
+ pageSize,
13686
+ pageDirection
13463
13687
  });
13464
- const mapped = applications.map(appInfo);
13465
- if (remaining !== void 0 && mapped.length > remaining) results.push(...mapped.slice(0, remaining));
13466
- else results.push(...mapped);
13467
- if (!nextPageToken) break;
13468
- pageToken = nextPageToken;
13469
- }
13470
- return results;
13688
+ return [applications, nextPageToken];
13689
+ }, { limit })).map(appInfo);
13471
13690
  }
13472
13691
  const listCommand$2 = defineAppCommand({
13473
13692
  name: "list",
13474
13693
  description: "List applications in a workspace",
13475
13694
  args: z.object({
13476
13695
  ...workspaceArgs,
13477
- limit: arg(positiveIntArg.optional(), {
13478
- alias: "l",
13479
- description: "Maximum number of applications to list"
13480
- })
13696
+ ...paginationArgs()
13481
13697
  }).strict(),
13482
13698
  run: async (args) => {
13483
13699
  const apps = await listApps({
13484
13700
  workspaceId: args["workspace-id"],
13485
13701
  profile: args.profile,
13702
+ order: args.order,
13486
13703
  limit: args.limit
13487
13704
  });
13488
13705
  const formattedApps = args.json ? apps : apps.map(({ updatedAt: _, createdAt, ...rest }) => ({
@@ -13734,41 +13951,31 @@ const getCommand = defineAppCommand({
13734
13951
  //#endregion
13735
13952
  //#region src/cli/commands/workspace/list.ts
13736
13953
  /**
13737
- * List workspaces with an optional limit.
13954
+ * List workspaces with an optional order and limit.
13738
13955
  * @param options - Workspace listing options
13739
13956
  * @returns List of workspaces
13740
13957
  */
13741
13958
  async function listWorkspaces(options) {
13742
- const limit = options?.limit;
13743
- const hasLimit = limit !== void 0;
13744
13959
  const client = await initOperatorClient(await loadAccessToken());
13745
- const results = [];
13746
- let pageToken = "";
13747
- while (true) {
13748
- if (hasLimit && results.length >= limit) break;
13749
- const remaining = hasLimit ? limit - results.length : void 0;
13750
- const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
13960
+ const pageDirection = toPageDirection(options?.order);
13961
+ return (await fetchPaged(async (pageToken, pageSize) => {
13751
13962
  const { workspaces, nextPageToken } = await client.listWorkspaces({
13752
13963
  pageToken,
13753
- ...pageSize !== void 0 ? { pageSize } : {}
13964
+ pageSize,
13965
+ pageDirection
13754
13966
  });
13755
- const mapped = workspaces.map(workspaceInfo);
13756
- if (remaining !== void 0 && mapped.length > remaining) results.push(...mapped.slice(0, remaining));
13757
- else results.push(...mapped);
13758
- if (!nextPageToken) break;
13759
- pageToken = nextPageToken;
13760
- }
13761
- return results;
13967
+ return [workspaces, nextPageToken];
13968
+ }, { limit: options?.limit })).map(workspaceInfo);
13762
13969
  }
13763
13970
  const listCommand$1 = defineAppCommand({
13764
13971
  name: "list",
13765
13972
  description: "List all Tailor Platform workspaces.",
13766
- args: z.object({ limit: arg(positiveIntArg.optional(), {
13767
- alias: "l",
13768
- description: "Maximum number of workspaces to list"
13769
- }) }).strict(),
13973
+ args: z.object({ ...paginationArgs() }).strict(),
13770
13974
  run: async (args) => {
13771
- const workspaces = await listWorkspaces({ limit: args.limit });
13975
+ const workspaces = await listWorkspaces({
13976
+ order: args.order,
13977
+ limit: args.limit
13978
+ });
13772
13979
  logger.out(workspaces, { display: { updatedAt: null } });
13773
13980
  }
13774
13981
  });
@@ -13911,7 +14118,8 @@ const inviteCommand = defineAppCommand({
13911
14118
  const listUsersOptionsSchema = z.object({
13912
14119
  workspaceId: z.uuid({ message: "workspace-id must be a valid UUID" }).optional(),
13913
14120
  profile: z.string().optional(),
13914
- limit: z.coerce.number().int().positive().optional()
14121
+ order: orderArg.optional(),
14122
+ limit: z.coerce.number().int().nonnegative().optional()
13915
14123
  });
13916
14124
  async function loadOptions$3(options) {
13917
14125
  const result = listUsersOptionsSchema.safeParse(options);
@@ -13925,50 +14133,40 @@ async function loadOptions$3(options) {
13925
14133
  workspaceId: result.data.workspaceId,
13926
14134
  profile: result.data.profile
13927
14135
  }),
14136
+ order: result.data.order,
13928
14137
  limit: result.data.limit
13929
14138
  };
13930
14139
  }
13931
14140
  /**
13932
- * List users in a workspace with an optional limit.
14141
+ * List users in a workspace with an optional order and limit.
13933
14142
  * @param options - User listing options
13934
14143
  * @returns List of workspace users
13935
14144
  */
13936
14145
  async function listUsers(options) {
13937
- const { client, workspaceId, limit } = await loadOptions$3(options);
13938
- const hasLimit = limit !== void 0;
13939
- const results = [];
13940
- let pageToken = "";
13941
- while (true) {
13942
- if (hasLimit && results.length >= limit) break;
13943
- const remaining = hasLimit ? limit - results.length : void 0;
13944
- const pageSize = remaining !== void 0 && remaining > 0 ? remaining : void 0;
14146
+ const { client, workspaceId, order, limit } = await loadOptions$3(options);
14147
+ const pageDirection = toPageDirection(order);
14148
+ return (await fetchPaged(async (pageToken, pageSize) => {
13945
14149
  const { workspacePlatformUsers, nextPageToken } = await client.listWorkspacePlatformUsers({
13946
14150
  workspaceId,
13947
14151
  pageToken,
13948
- ...pageSize !== void 0 ? { pageSize } : {}
14152
+ pageSize,
14153
+ pageDirection
13949
14154
  });
13950
- const mapped = workspacePlatformUsers.map(userInfo);
13951
- if (remaining !== void 0 && mapped.length > remaining) results.push(...mapped.slice(0, remaining));
13952
- else results.push(...mapped);
13953
- if (!nextPageToken) break;
13954
- pageToken = nextPageToken;
13955
- }
13956
- return results;
14155
+ return [workspacePlatformUsers, nextPageToken];
14156
+ }, { limit })).map(userInfo);
13957
14157
  }
13958
14158
  const listCommand = defineAppCommand({
13959
14159
  name: "list",
13960
14160
  description: "List users in a workspace",
13961
14161
  args: z.object({
13962
14162
  ...workspaceArgs,
13963
- limit: arg(positiveIntArg.optional(), {
13964
- alias: "l",
13965
- description: "Maximum number of users to list"
13966
- })
14163
+ ...paginationArgs()
13967
14164
  }).strict(),
13968
14165
  run: async (args) => {
13969
14166
  const users = await listUsers({
13970
14167
  workspaceId: args["workspace-id"],
13971
14168
  profile: args.profile,
14169
+ order: args.order,
13972
14170
  limit: args.limit
13973
14171
  });
13974
14172
  logger.out(users);
@@ -15035,5 +15233,5 @@ function isDeno() {
15035
15233
  }
15036
15234
 
15037
15235
  //#endregion
15038
- 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, apiCommand 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, apiCall 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 };
15039
- //# sourceMappingURL=runtime-Bn68JXnL.mjs.map
15236
+ 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 };
15237
+ //# sourceMappingURL=runtime-DQqulWPm.mjs.map