@tailor-platform/sdk 1.39.0 → 1.40.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +7 -10
  3. package/dist/{env-CgI46oPS.d.mts → actor-B2oEmlTc.d.mts} +9 -9
  4. package/dist/application-CEeKm4R-.mjs +4 -0
  5. package/dist/{application-DhQrXEld.mjs → application-C_LFXkKJ.mjs} +148 -148
  6. package/dist/application-C_LFXkKJ.mjs.map +1 -0
  7. package/dist/{brand-D-d15jx3.mjs → brand-Ll48SMXe.mjs} +1 -1
  8. package/dist/{brand-D-d15jx3.mjs.map → brand-Ll48SMXe.mjs.map} +1 -1
  9. package/dist/cli/index.mjs +163 -42
  10. package/dist/cli/index.mjs.map +1 -1
  11. package/dist/cli/lib.d.mts +43 -9
  12. package/dist/cli/lib.mjs +4 -4
  13. package/dist/cli/skills.mjs +13 -43
  14. package/dist/cli/skills.mjs.map +1 -1
  15. package/dist/{client-xzPXtc_e.mjs → client-DjGFRjH4.mjs} +105 -47
  16. package/dist/client-DjGFRjH4.mjs.map +1 -0
  17. package/dist/client-Dtf48x0o.mjs +4 -0
  18. package/dist/configure/index.d.mts +4 -4
  19. package/dist/configure/index.mjs +55 -4
  20. package/dist/configure/index.mjs.map +1 -1
  21. package/dist/{crash-report-BEAiCSCl.mjs → crash-report-CEIXtw4D.mjs} +1 -1
  22. package/dist/{crash-report-DXhPL8Ue.mjs → crash-report-CSWITsTz.mjs} +4 -4
  23. package/dist/{crash-report-DXhPL8Ue.mjs.map → crash-report-CSWITsTz.mjs.map} +1 -1
  24. package/dist/{errors-D9f2UJpT.mjs → errors-ChWX5ZG8.mjs} +1 -1
  25. package/dist/{errors-D9f2UJpT.mjs.map → errors-ChWX5ZG8.mjs.map} +1 -1
  26. package/dist/field-BY2vbJ8f.mjs +23 -0
  27. package/dist/field-BY2vbJ8f.mjs.map +1 -0
  28. package/dist/{index-DbzopC7M.d.mts → index-BtXZdz-F.d.mts} +2 -2
  29. package/dist/{index-y5790SX_.d.mts → index-Chvw1Eod.d.mts} +2 -2
  30. package/dist/{index-B2tsEXdh.d.mts → index-CiNNNpuH.d.mts} +2 -2
  31. package/dist/{index-31hm0Fq7.d.mts → index-D_ezppY7.d.mts} +133 -30
  32. package/dist/{index-DeBFa7oc.d.mts → index-reFAYSX7.d.mts} +2 -2
  33. package/dist/{interceptor-CzaH2Ur6.mjs → interceptor-4UC-KTno.mjs} +1 -1
  34. package/dist/{interceptor-CzaH2Ur6.mjs.map → interceptor-4UC-KTno.mjs.map} +1 -1
  35. package/dist/{job-DkAklmE4.mjs → job-p6zf8Qpg.mjs} +2 -2
  36. package/dist/job-p6zf8Qpg.mjs.map +1 -0
  37. package/dist/{logger-5_JMzHmw.mjs → logger-DTNAMYGy.mjs} +1 -1
  38. package/dist/{logger-5_JMzHmw.mjs.map → logger-DTNAMYGy.mjs.map} +1 -1
  39. package/dist/package-json-CPR7s5hf.mjs +4 -0
  40. package/dist/{package-json-BHViVisJ.mjs → package-json-CWp8s9dE.mjs} +1 -1
  41. package/dist/{package-json-BHViVisJ.mjs.map → package-json-CWp8s9dE.mjs.map} +1 -1
  42. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  43. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  44. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  45. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  46. package/dist/plugin/builtin/seed/index.mjs +1 -1
  47. package/dist/plugin/index.d.mts +2 -2
  48. package/dist/repl-editor-DjycioU-.mjs +255 -0
  49. package/dist/repl-editor-DjycioU-.mjs.map +1 -0
  50. package/dist/{runtime-DtSOnOHh.mjs → runtime-im7Sq4jO.mjs} +313 -182
  51. package/dist/runtime-im7Sq4jO.mjs.map +1 -0
  52. package/dist/{schema-CnwUqPyM.mjs → schema-CEcfEyPN.mjs} +4 -44
  53. package/dist/schema-CEcfEyPN.mjs.map +1 -0
  54. package/dist/{seed-DrbB1VXd.mjs → seed-CyYPhvNL.mjs} +12 -12
  55. package/dist/seed-CyYPhvNL.mjs.map +1 -0
  56. package/dist/{service-Bcp6JB3w.mjs → service-SrG26B9T.mjs} +3 -3
  57. package/dist/{service-Bcp6JB3w.mjs.map → service-SrG26B9T.mjs.map} +1 -1
  58. package/dist/{plugin-_K3ZfP8B.d.mts → tailor-db-field-CoFKRCYW.d.mts} +695 -1187
  59. package/dist/{telemetry-DwHuiNiR.mjs → telemetry-BuDto_2q.mjs} +2 -2
  60. package/dist/{telemetry-DwHuiNiR.mjs.map → telemetry-BuDto_2q.mjs.map} +1 -1
  61. package/dist/telemetry-C1hzFaiV.mjs +4 -0
  62. package/dist/types-BnphjkIJ.mjs +5 -0
  63. package/dist/{types-B9ZMosul.mjs → types-Duhhsx3R.mjs} +3 -32
  64. package/dist/types-Duhhsx3R.mjs.map +1 -0
  65. package/dist/utils/test/index.d.mts +2 -2
  66. package/dist/utils/test/index.mjs +1 -1
  67. package/dist/workflow.generated-Btz6srLR.d.mts +1207 -0
  68. package/docs/cli/application.md +21 -5
  69. package/docs/cli/auth.md +20 -14
  70. package/docs/cli/executor.md +17 -14
  71. package/docs/cli/function.md +6 -4
  72. package/docs/cli/query.md +45 -0
  73. package/docs/cli/secret.md +13 -9
  74. package/docs/cli/skills.md +75 -0
  75. package/docs/cli/staticwebsite.md +6 -4
  76. package/docs/cli/user.md +9 -1
  77. package/docs/cli/workflow.md +17 -13
  78. package/docs/cli-reference.md +16 -0
  79. package/docs/services/idp.md +4 -4
  80. package/docs/services/workflow.md +1 -1
  81. package/package.json +12 -9
  82. package/dist/application-C1ipG5Q6.mjs +0 -4
  83. package/dist/application-DhQrXEld.mjs.map +0 -1
  84. package/dist/client-BWAbbA1C.mjs +0 -4
  85. package/dist/client-xzPXtc_e.mjs.map +0 -1
  86. package/dist/job-DkAklmE4.mjs.map +0 -1
  87. package/dist/package-json--6dmp6-h.mjs +0 -4
  88. package/dist/runtime-DtSOnOHh.mjs.map +0 -1
  89. package/dist/schema-CnwUqPyM.mjs.map +0 -1
  90. package/dist/seed-DrbB1VXd.mjs.map +0 -1
  91. package/dist/telemetry-4IOPW6wE.mjs +0 -4
  92. package/dist/types-B9ZMosul.mjs.map +0 -1
  93. package/dist/types-C45jRrCM.mjs +0 -4
  94. package/dist/workflow.generated-BxbnuzAE.d.mts +0 -414
@@ -1,16 +1,16 @@
1
1
  /// <reference types="@tailor-platform/function-types" />
2
- import { C as TailorDBType, Dt as IncomingWebhookTrigger, It as IdProvider, Lt as OAuth2ClientInput, St as Executor, kt as ScheduleTriggerInput, n as Plugin, r as PluginAttachment, vt as Resolver, w as TypeSourceInfoEntry } from "../plugin-_K3ZfP8B.mjs";
3
- import { n as AppConfig } from "../workflow.generated-BxbnuzAE.mjs";
4
- import { n as kyselyTypePlugin } from "../index-y5790SX_.mjs";
5
- import { n as enumConstantsPlugin } from "../index-DeBFa7oc.mjs";
6
- import { n as fileUtilsPlugin } from "../index-DbzopC7M.mjs";
7
- import { n as seedPlugin } from "../index-B2tsEXdh.mjs";
2
+ import { N as TailorDBType, P as TypeSourceInfoEntry, Q as Resolver, _t as IdProvider, ct as IncomingWebhookTrigger, o as Plugin, rt as Executor, s as PluginAttachment, ut as ScheduleTriggerInput, vt as OAuth2ClientInput } from "../tailor-db-field-CoFKRCYW.mjs";
3
+ import { n as AppConfig } from "../workflow.generated-Btz6srLR.mjs";
4
+ import { n as kyselyTypePlugin } from "../index-Chvw1Eod.mjs";
5
+ import { n as enumConstantsPlugin } from "../index-reFAYSX7.mjs";
6
+ import { n as fileUtilsPlugin } from "../index-BtXZdz-F.mjs";
7
+ import { n as seedPlugin } from "../index-CiNNNpuH.mjs";
8
8
  import { z } from "zod";
9
- import { OAuth2Client } from "@badgateway/oauth2-client";
10
- import { Duration, FieldMask, Timestamp, Value } from "@bufbuild/protobuf/wkt";
11
- import { Client } from "@connectrpc/connect";
12
9
  import * as _$_bufbuild_protobuf_codegenv20 from "@bufbuild/protobuf/codegenv2";
13
10
  import { GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
11
+ import { Duration, FieldMask, Timestamp, Value } from "@bufbuild/protobuf/wkt";
12
+ import { OAuth2Client } from "@badgateway/oauth2-client";
13
+ import { Client } from "@connectrpc/connect";
14
14
  import { JsonObject, Message } from "@bufbuild/protobuf";
15
15
  import { Jsonifiable } from "type-fest";
16
16
 
@@ -17690,11 +17690,23 @@ type HealthOptions = z.input<typeof healthOptionsSchema>;
17690
17690
  */
17691
17691
  declare function getAppHealth(options: HealthOptions): Promise<AppHealthInfo>;
17692
17692
  //#endregion
17693
+ //#region src/cli/shared/args.d.ts
17694
+ /**
17695
+ * Schema for sort order (`asc` or `desc`).
17696
+ */
17697
+ declare const orderArg: z.ZodEnum<{
17698
+ asc: "asc";
17699
+ desc: "desc";
17700
+ }>;
17701
+ type Order = z.infer<typeof orderArg>;
17702
+ //#endregion
17693
17703
  //#region src/cli/commands/machineuser/list.d.ts
17694
17704
  interface ListMachineUsersOptions {
17695
17705
  workspaceId?: string;
17696
17706
  profile?: string;
17697
17707
  configPath?: string;
17708
+ order?: Order;
17709
+ limit?: number;
17698
17710
  }
17699
17711
  interface MachineUserInfo {
17700
17712
  name: string;
@@ -17768,6 +17780,8 @@ interface ListOAuth2ClientsOptions {
17768
17780
  workspaceId?: string;
17769
17781
  profile?: string;
17770
17782
  configPath?: string;
17783
+ order?: Order;
17784
+ limit?: number;
17771
17785
  }
17772
17786
  /**
17773
17787
  * List OAuth2 clients for the current application.
@@ -17812,6 +17826,8 @@ interface WorkflowExecutionInfo {
17812
17826
  interface ListWorkflowsOptions {
17813
17827
  workspaceId?: string;
17814
17828
  profile?: string;
17829
+ order?: Order;
17830
+ limit?: number;
17815
17831
  }
17816
17832
  /**
17817
17833
  * List workflows in the workspace and return CLI-friendly info.
@@ -17909,6 +17925,8 @@ type ListWorkflowExecutionsTypedOptions<W extends WorkflowLike = WorkflowLike> =
17909
17925
  status?: string;
17910
17926
  workspaceId?: string;
17911
17927
  profile?: string;
17928
+ order?: Order;
17929
+ limit?: number;
17912
17930
  };
17913
17931
  /**
17914
17932
  * @deprecated Use ListWorkflowExecutionsTypedOptions instead.
@@ -17918,6 +17936,8 @@ interface ListWorkflowExecutionsOptions {
17918
17936
  profile?: string;
17919
17937
  workflowName?: string;
17920
17938
  status?: string;
17939
+ order?: Order;
17940
+ limit?: number;
17921
17941
  }
17922
17942
  interface GetWorkflowExecutionOptions {
17923
17943
  executionId: string;
@@ -17938,6 +17958,11 @@ interface GetWorkflowExecutionResult {
17938
17958
  }
17939
17959
  /**
17940
17960
  * List workflow executions with optional filters.
17961
+ *
17962
+ * Returns at most `options.limit` items. When `limit` is omitted or 0 the
17963
+ * function pages through every execution. The CLI caps this at 50 by
17964
+ * default via `pagedLogArgs`; programmatic callers that want the same
17965
+ * cap should pass `limit: 50` explicitly.
17941
17966
  * @param options - Workflow execution listing options
17942
17967
  * @returns List of workflow executions
17943
17968
  */
@@ -18051,6 +18076,7 @@ type ExecutorLike$1 = {
18051
18076
  type ListExecutorJobsTypedOptions<E extends ExecutorLike$1 = ExecutorLike$1> = {
18052
18077
  executor: E;
18053
18078
  status?: string;
18079
+ order?: Order;
18054
18080
  limit?: number;
18055
18081
  workspaceId?: string;
18056
18082
  profile?: string;
@@ -18076,6 +18102,7 @@ type WatchExecutorJobTypedOptions<E extends ExecutorLike$1 = ExecutorLike$1> = {
18076
18102
  interface ListExecutorJobsOptions {
18077
18103
  executorName: string;
18078
18104
  status?: string;
18105
+ order?: Order;
18079
18106
  limit?: number;
18080
18107
  workspaceId?: string;
18081
18108
  profile?: string;
@@ -18121,6 +18148,11 @@ interface WatchExecutorJobResult {
18121
18148
  }
18122
18149
  /**
18123
18150
  * List executor jobs for a given executor.
18151
+ *
18152
+ * Returns at most `options.limit` items. When `limit` is omitted or 0 the
18153
+ * function pages through every job. The CLI caps this at 50 by default
18154
+ * via `pagedLogArgs`; programmatic callers that want the same cap should
18155
+ * pass `limit: 50` explicitly.
18124
18156
  * @param options - Options for listing executor jobs
18125
18157
  * @returns List of executor job information
18126
18158
  */
@@ -18145,6 +18177,8 @@ declare function watchExecutorJob(options: WatchExecutorJobOptions): Promise<Wat
18145
18177
  interface ListExecutorsOptions {
18146
18178
  workspaceId?: string;
18147
18179
  profile?: string;
18180
+ order?: Order;
18181
+ limit?: number;
18148
18182
  }
18149
18183
  /**
18150
18184
  * List executors in the workspace and return CLI-friendly info.
package/dist/cli/lib.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
 
2
- import { u as initOperatorClient } from "../client-xzPXtc_e.mjs";
3
- import { A as truncate, B as updateOrganization, Bt as DIFF_FILE_NAME, Ct as startWorkflow, D as resumeWorkflow, Dt as getWorkflowExecution, Ft as waitForExecution, Gt as compareSnapshots, Ht as MIGRATE_FILE_NAME, It as MIGRATION_LABEL_KEY, J as updateFolder, Jt as getLatestMigrationNumber, K as getOrganization, Kt as createSnapshotFromLocalTypes, L as remove, M as generate$1, Mt as getExecutor, Nt as apply, Ot as listWorkflowExecutions, P as show, Pt as executeScript, Q as getFolder, Qt as getNextMigrationNumber, Rt as bundleMigrationScript, S as listApps, Tt as getWorkflow, Ut as SCHEMA_FILE_NAME, V as organizationTree, Vt as INITIAL_SCHEMA_NUMBER, W as listOrganizations, Wt as compareLocalTypesWithSnapshot, X as listFolders, Xt as getMigrationFilePath, Yt as getMigrationDirPath, Zt as getMigrationFiles, _ as getWorkspace, _t as listExecutors, a as updateUser, an as getNamespacesWithMigrations, bt as listExecutorJobs, d as inviteUser, dt as generate, et as deleteFolder, ft as listWebhookExecutors, h as listWorkspaces, ht as triggerExecutor, in as hasChanges, it as listOAuth2Clients, k as listWorkflows, l as listUsers, ln as generateUserTypes, n as query, nn as formatDiffSummary, nt as createFolder, ot as getOAuth2Client, p as restoreWorkspace, rn as formatMigrationDiff, s as removeUser, st as getMachineUserToken, t as isNativeTypeScriptRuntime, tn as reconstructSnapshotFromMigrations, un as apiCall, ut as listMachineUsers, vt as getExecutorJob, w as getAppHealth, x as createWorkspace, xt as watchExecutorJob, y as deleteWorkspace, zt as DB_TYPES_FILE_NAME } from "../runtime-DtSOnOHh.mjs";
4
- import { a as loadConfig, b as loadAccessToken, g as getDistDir, x as loadWorkspaceId } from "../application-DhQrXEld.mjs";
5
- import { n as seedPlugin } from "../seed-DrbB1VXd.mjs";
2
+ import { d as initOperatorClient } from "../client-DjGFRjH4.mjs";
3
+ import { A as truncate, B as updateOrganization, Bt as DIFF_FILE_NAME, Ct as startWorkflow, D as resumeWorkflow, Dt as getWorkflowExecution, Ft as waitForExecution, Gt as compareSnapshots, Ht as MIGRATE_FILE_NAME, It as MIGRATION_LABEL_KEY, J as updateFolder, Jt as getLatestMigrationNumber, K as getOrganization, Kt as createSnapshotFromLocalTypes, L as remove, M as generate$1, Mt as getExecutor, Nt as apply, Ot as listWorkflowExecutions, P as show, Pt as executeScript, Q as getFolder, Qt as getNextMigrationNumber, Rt as bundleMigrationScript, S as listApps, Tt as getWorkflow, Ut as SCHEMA_FILE_NAME, V as organizationTree, Vt as INITIAL_SCHEMA_NUMBER, W as listOrganizations, Wt as compareLocalTypesWithSnapshot, X as listFolders, Xt as getMigrationFilePath, Yt as getMigrationDirPath, Zt as getMigrationFiles, _ as getWorkspace, _t as listExecutors, a as updateUser, an as getNamespacesWithMigrations, bt as listExecutorJobs, d as inviteUser, dt as generate, et as deleteFolder, ft as listWebhookExecutors, h as listWorkspaces, ht as triggerExecutor, in as hasChanges, it as listOAuth2Clients, k as listWorkflows, l as listUsers, ln as generateUserTypes, n as query, nn as formatDiffSummary, nt as createFolder, ot as getOAuth2Client, p as restoreWorkspace, rn as formatMigrationDiff, s as removeUser, st as getMachineUserToken, t as isNativeTypeScriptRuntime, tn as reconstructSnapshotFromMigrations, un as apiCall, ut as listMachineUsers, vt as getExecutorJob, w as getAppHealth, x as createWorkspace, xt as watchExecutorJob, y as deleteWorkspace, zt as DB_TYPES_FILE_NAME } from "../runtime-im7Sq4jO.mjs";
4
+ import { _ as loadConfig, b as loadAccessToken, h as getDistDir, x as loadWorkspaceId } from "../application-C_LFXkKJ.mjs";
6
5
  import { n as enumConstantsPlugin } from "../enum-constants-Dx82rSjf.mjs";
7
6
  import { n as fileUtilsPlugin } from "../file-utils-DeWpvq3T.mjs";
8
7
  import { n as kyselyTypePlugin } from "../kysely-type-CwtvQuxh.mjs";
8
+ import { n as seedPlugin } from "../seed-CyYPhvNL.mjs";
9
9
  import * as fs from "node:fs";
10
10
  import * as path from "pathe";
11
11
  import { resolveTSConfig } from "pkg-types";
@@ -1,51 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { n as logger } from "../logger-DTNAMYGy.mjs";
4
+ import { dirname, resolve } from "pathe";
5
+ import { fileURLToPath } from "node:url";
3
6
  import { spawn } from "node:child_process";
4
7
 
5
- //#region src/cli/shared/skills-installer.ts
6
- const SKILL_NAME = "tailor-sdk";
7
- const DEFAULT_SKILLS_SOURCE = "https://github.com/tailor-platform/sdk/tree/main/packages/sdk/skills";
8
- const SKILLS_SOURCE_ENV_KEY = "TAILOR_SDK_SKILLS_SOURCE";
9
- function resolveNpxCommand(platform = process.platform) {
10
- return platform === "win32" ? "npx.cmd" : "npx";
11
- }
12
- function resolveSkillsSource(source) {
13
- return source ?? process.env[SKILLS_SOURCE_ENV_KEY] ?? "https://github.com/tailor-platform/sdk/tree/main/packages/sdk/skills";
14
- }
15
- /**
16
- * Build CLI arguments for `skills add` with the fixed tailor-sdk skill target.
17
- * @param additionalArgs - Additional options to pass through to `skills add`
18
- * @param source - Optional skill source URL or path
19
- * @returns CLI arguments for `npx skills add`
20
- */
21
- function buildSkillsAddArgs(additionalArgs, source) {
22
- return [
23
- "skills",
24
- "add",
25
- resolveSkillsSource(source),
26
- "--skill",
27
- SKILL_NAME,
28
- ...additionalArgs
29
- ];
30
- }
31
- /**
32
- * Run `npx skills add` to install the tailor-sdk skill.
33
- * @param options - Runtime options for skill installation
34
- * @returns Process exit code from the spawned `npx` command
35
- */
36
- async function runSkillsInstaller(options = {}) {
37
- const args = buildSkillsAddArgs(options.additionalArgs ?? [], options.source);
38
- const childProcess = (options.spawnFn ?? ((command, spawnArgs, spawnOptions) => spawn(command, spawnArgs, spawnOptions)))(resolveNpxCommand(), args, { stdio: "inherit" });
39
- return await new Promise((resolve, reject) => {
40
- childProcess.on("error", (error) => reject(error));
41
- childProcess.on("close", (code) => resolve(code ?? 1));
42
- });
43
- }
44
-
45
- //#endregion
46
8
  //#region src/cli/skills.ts
47
- const exitCode = await runSkillsInstaller({ additionalArgs: process.argv.slice(2) });
48
- process.exit(exitCode);
9
+ logger.warn("`tailor-sdk-skills` is deprecated and will be removed in v2. Use `tailor-sdk skills install` instead.");
10
+ const mainCli = resolve(dirname(fileURLToPath(import.meta.url)), "index.mjs");
11
+ spawn(process.execPath, [
12
+ mainCli,
13
+ "skills",
14
+ "install",
15
+ ...process.argv.slice(2)
16
+ ], { stdio: "inherit" }).on("exit", (code) => {
17
+ process.exit(code ?? 1);
18
+ });
49
19
 
50
20
  //#endregion
51
21
  export { };
@@ -1 +1 @@
1
- {"version":3,"file":"skills.mjs","names":[],"sources":["../../src/cli/shared/skills-installer.ts","../../src/cli/skills.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\n\nexport const SKILL_NAME = \"tailor-sdk\";\nexport const DEFAULT_SKILLS_SOURCE =\n \"https://github.com/tailor-platform/sdk/tree/main/packages/sdk/skills\";\nconst SKILLS_SOURCE_ENV_KEY = \"TAILOR_SDK_SKILLS_SOURCE\";\n\ninterface ChildProcessLike {\n on(event: \"close\", listener: (code: number | null) => void): ChildProcessLike;\n on(event: \"error\", listener: (error: Error) => void): ChildProcessLike;\n}\n\ntype SpawnLike = (\n command: string,\n args: string[],\n options: { stdio: \"inherit\" },\n) => ChildProcessLike;\n\ninterface RunSkillsInstallerOptions {\n additionalArgs?: string[];\n source?: string;\n spawnFn?: SpawnLike;\n}\n\nfunction resolveNpxCommand(platform: NodeJS.Platform = process.platform): string {\n return platform === \"win32\" ? \"npx.cmd\" : \"npx\";\n}\n\nfunction resolveSkillsSource(source?: string): string {\n return source ?? process.env[SKILLS_SOURCE_ENV_KEY] ?? DEFAULT_SKILLS_SOURCE;\n}\n\n/**\n * Build CLI arguments for `skills add` with the fixed tailor-sdk skill target.\n * @param additionalArgs - Additional options to pass through to `skills add`\n * @param source - Optional skill source URL or path\n * @returns CLI arguments for `npx skills add`\n */\nexport function buildSkillsAddArgs(additionalArgs: readonly string[], source?: string): string[] {\n return [\"skills\", \"add\", resolveSkillsSource(source), \"--skill\", SKILL_NAME, ...additionalArgs];\n}\n\n/**\n * Run `npx skills add` to install the tailor-sdk skill.\n * @param options - Runtime options for skill installation\n * @returns Process exit code from the spawned `npx` command\n */\nexport async function runSkillsInstaller(options: RunSkillsInstallerOptions = {}): Promise<number> {\n const args = buildSkillsAddArgs(options.additionalArgs ?? [], options.source);\n const spawnFn =\n options.spawnFn ??\n ((command: string, spawnArgs: string[], spawnOptions: { stdio: \"inherit\" }) =>\n spawn(command, spawnArgs, spawnOptions));\n\n const childProcess = spawnFn(resolveNpxCommand(), args, { stdio: \"inherit\" });\n\n return await new Promise<number>((resolve, reject) => {\n childProcess.on(\"error\", (error) => reject(error));\n childProcess.on(\"close\", (code) => resolve(code ?? 1));\n });\n}\n","#!/usr/bin/env node\n\nimport { runSkillsInstaller } from \"./shared/skills-installer\";\n\nconst exitCode = await runSkillsInstaller({\n additionalArgs: process.argv.slice(2),\n});\n\nprocess.exit(exitCode);\n"],"mappings":";;;;;AAEA,MAAa,aAAa;AAC1B,MAAa,wBACX;AACF,MAAM,wBAAwB;AAmB9B,SAAS,kBAAkB,WAA4B,QAAQ,UAAkB;AAC/E,QAAO,aAAa,UAAU,YAAY;;AAG5C,SAAS,oBAAoB,QAAyB;AACpD,QAAO,UAAU,QAAQ,IAAI;;;;;;;;AAS/B,SAAgB,mBAAmB,gBAAmC,QAA2B;AAC/F,QAAO;EAAC;EAAU;EAAO,oBAAoB,OAAO;EAAE;EAAW;EAAY,GAAG;EAAe;;;;;;;AAQjG,eAAsB,mBAAmB,UAAqC,EAAE,EAAmB;CACjG,MAAM,OAAO,mBAAmB,QAAQ,kBAAkB,EAAE,EAAE,QAAQ,OAAO;CAM7E,MAAM,gBAJJ,QAAQ,aACN,SAAiB,WAAqB,iBACtC,MAAM,SAAS,WAAW,aAAa,GAEd,mBAAmB,EAAE,MAAM,EAAE,OAAO,WAAW,CAAC;AAE7E,QAAO,MAAM,IAAI,SAAiB,SAAS,WAAW;AACpD,eAAa,GAAG,UAAU,UAAU,OAAO,MAAM,CAAC;AAClD,eAAa,GAAG,UAAU,SAAS,QAAQ,QAAQ,EAAE,CAAC;GACtD;;;;;ACvDJ,MAAM,WAAW,MAAM,mBAAmB,EACxC,gBAAgB,QAAQ,KAAK,MAAM,EAAE,EACtC,CAAC;AAEF,QAAQ,KAAK,SAAS"}
1
+ {"version":3,"file":"skills.mjs","names":[],"sources":["../../src/cli/skills.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { spawn } from \"node:child_process\";\nimport { fileURLToPath } from \"node:url\";\nimport { dirname, resolve } from \"pathe\";\nimport { logger } from \"./shared/logger\";\n\nlogger.warn(\n \"`tailor-sdk-skills` is deprecated and will be removed in v2. Use `tailor-sdk skills install` instead.\",\n);\n\nconst here = dirname(fileURLToPath(import.meta.url));\nconst mainCli = resolve(here, \"index.mjs\");\n\nconst child = spawn(process.execPath, [mainCli, \"skills\", \"install\", ...process.argv.slice(2)], {\n stdio: \"inherit\",\n});\n\nchild.on(\"exit\", (code) => {\n process.exit(code ?? 1);\n});\n"],"mappings":";;;;;;;;AAOA,OAAO,KACL,wGACD;AAGD,MAAM,UAAU,QADH,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC,EACtB,YAAY;AAE5B,MAAM,QAAQ,UAAU;CAAC;CAAS;CAAU;CAAW,GAAG,QAAQ,KAAK,MAAM,EAAE;CAAC,EAAE,EAC9F,OAAO,WACR,CAAC,CAEI,GAAG,SAAS,SAAS;AACzB,SAAQ,KAAK,QAAQ,EAAE;EACvB"}
@@ -1,12 +1,12 @@
1
1
 
2
- import { n as logger } from "./logger-5_JMzHmw.mjs";
3
- import { t as readPackageJson } from "./package-json-BHViVisJ.mjs";
2
+ import { n as logger } from "./logger-DTNAMYGy.mjs";
3
+ import { t as readPackageJson } from "./package-json-CWp8s9dE.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { z } from "zod";
6
- import { OAuth2Client } from "@badgateway/oauth2-client";
6
+ import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
7
7
  import { MethodOptions_IdempotencyLevel, file_google_protobuf_descriptor, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_protobuf_struct, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
8
+ import { OAuth2Client } from "@badgateway/oauth2-client";
8
9
  import { Code, ConnectError, createClient } from "@connectrpc/connect";
9
- import { enumDesc, fileDesc, messageDesc, serviceDesc, tsEnum } from "@bufbuild/protobuf/codegenv2";
10
10
 
11
11
  //#region \0rolldown/runtime.js
12
12
  var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
@@ -2203,13 +2203,18 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
2203
2203
  const kOnDestroyed = Symbol("onDestroyed");
2204
2204
  const kOnClosed = Symbol("onClosed");
2205
2205
  const kInterceptedDispatch = Symbol("Intercepted Dispatch");
2206
+ const kWebSocketOptions = Symbol("webSocketOptions");
2206
2207
  var DispatcherBase = class extends Dispatcher {
2207
- constructor() {
2208
+ constructor(opts) {
2208
2209
  super();
2209
2210
  this[kDestroyed] = false;
2210
2211
  this[kOnDestroyed] = null;
2211
2212
  this[kClosed] = false;
2212
2213
  this[kOnClosed] = [];
2214
+ this[kWebSocketOptions] = opts?.webSocket ?? {};
2215
+ }
2216
+ get webSocketOptions() {
2217
+ return { maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024 };
2213
2218
  }
2214
2219
  get destroyed() {
2215
2220
  return this[kDestroyed];
@@ -6853,8 +6858,8 @@ var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6853
6858
  * @param {string|URL} url
6854
6859
  * @param {import('../../types/client.js').Client.Options} options
6855
6860
  */
6856
- constructor(url, { interceptors, maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, maxRedirections, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2 } = {}) {
6857
- super();
6861
+ constructor(url, { interceptors, maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, maxRedirections, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2, webSocket } = {}) {
6862
+ super({ webSocket });
6858
6863
  if (keepAlive !== void 0) throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
6859
6864
  if (socketTimeout !== void 0) throw new InvalidArgumentError("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");
6860
6865
  if (requestTimeout !== void 0) throw new InvalidArgumentError("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");
@@ -7260,8 +7265,8 @@ var require_pool_base = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7260
7265
  const kRemoveClient = Symbol("remove client");
7261
7266
  const kStats = Symbol("stats");
7262
7267
  var PoolBase = class extends DispatcherBase {
7263
- constructor() {
7264
- super();
7268
+ constructor(opts) {
7269
+ super(opts);
7265
7270
  this[kQueue] = new FixedQueue();
7266
7271
  this[kClients] = [];
7267
7272
  this[kQueued] = 0;
@@ -7392,7 +7397,6 @@ var require_pool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7392
7397
  }
7393
7398
  var Pool = class extends PoolBase {
7394
7399
  constructor(origin, { connections, factory = defaultFactory, connect, connectTimeout, tls, maxCachedSessions, socketPath, autoSelectFamily, autoSelectFamilyAttemptTimeout, allowH2, ...options } = {}) {
7395
- super();
7396
7400
  if (connections != null && (!Number.isFinite(connections) || connections < 0)) throw new InvalidArgumentError("invalid connections");
7397
7401
  if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
7398
7402
  if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
@@ -7408,6 +7412,7 @@ var require_pool = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7408
7412
  } : void 0,
7409
7413
  ...connect
7410
7414
  });
7415
+ super(options);
7411
7416
  this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool) ? options.interceptors.Pool : [];
7412
7417
  this[kConnections] = connections || null;
7413
7418
  this[kUrl] = util.parseOrigin(origin);
@@ -7571,10 +7576,10 @@ var require_agent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7571
7576
  }
7572
7577
  var Agent = class extends DispatcherBase {
7573
7578
  constructor({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
7574
- super();
7575
7579
  if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
7576
7580
  if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
7577
7581
  if (!Number.isInteger(maxRedirections) || maxRedirections < 0) throw new InvalidArgumentError("maxRedirections must be a positive number");
7582
+ super(options);
7578
7583
  if (connect && typeof connect !== "function") connect = { ...connect };
7579
7584
  this[kInterceptors] = options.interceptors?.Agent && Array.isArray(options.interceptors.Agent) ? options.interceptors.Agent : [createRedirectInterceptor({ maxRedirections })];
7580
7585
  this[kOptions] = {
@@ -14676,27 +14681,26 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14676
14681
  ]);
14677
14682
  const kBuffer = Symbol("kBuffer");
14678
14683
  const kLength = Symbol("kLength");
14679
- const kDefaultMaxDecompressedSize = 4 * 1024 * 1024;
14680
14684
  var PerMessageDeflate = class {
14681
14685
  /** @type {import('node:zlib').InflateRaw} */
14682
14686
  #inflate;
14683
14687
  #options = {};
14684
- /** @type {boolean} */
14685
- #aborted = false;
14686
- /** @type {Function|null} */
14687
- #currentCallback = null;
14688
+ #maxPayloadSize = 0;
14688
14689
  /**
14689
14690
  * @param {Map<string, string>} extensions
14690
14691
  */
14691
- constructor(extensions) {
14692
+ constructor(extensions, options) {
14692
14693
  this.#options.serverNoContextTakeover = extensions.has("server_no_context_takeover");
14693
14694
  this.#options.serverMaxWindowBits = extensions.get("server_max_window_bits");
14695
+ this.#maxPayloadSize = options.maxPayloadSize;
14694
14696
  }
14697
+ /**
14698
+ * Decompress a compressed payload.
14699
+ * @param {Buffer} chunk Compressed data
14700
+ * @param {boolean} fin Final fragment flag
14701
+ * @param {Function} callback Callback function
14702
+ */
14695
14703
  decompress(chunk, fin, callback) {
14696
- if (this.#aborted) {
14697
- callback(new MessageSizeExceededError());
14698
- return;
14699
- }
14700
14704
  if (!this.#inflate) {
14701
14705
  let windowBits = Z_DEFAULT_WINDOWBITS;
14702
14706
  if (this.#options.serverMaxWindowBits) {
@@ -14715,18 +14719,11 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14715
14719
  this.#inflate[kBuffer] = [];
14716
14720
  this.#inflate[kLength] = 0;
14717
14721
  this.#inflate.on("data", (data) => {
14718
- if (this.#aborted) return;
14719
14722
  this.#inflate[kLength] += data.length;
14720
- if (this.#inflate[kLength] > kDefaultMaxDecompressedSize) {
14721
- this.#aborted = true;
14723
+ if (this.#maxPayloadSize > 0 && this.#inflate[kLength] > this.#maxPayloadSize) {
14724
+ callback(new MessageSizeExceededError());
14722
14725
  this.#inflate.removeAllListeners();
14723
- this.#inflate.destroy();
14724
14726
  this.#inflate = null;
14725
- if (this.#currentCallback) {
14726
- const cb = this.#currentCallback;
14727
- this.#currentCallback = null;
14728
- cb(new MessageSizeExceededError());
14729
- }
14730
14727
  return;
14731
14728
  }
14732
14729
  this.#inflate[kBuffer].push(data);
@@ -14736,15 +14733,13 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
14736
14733
  callback(err);
14737
14734
  });
14738
14735
  }
14739
- this.#currentCallback = callback;
14740
14736
  this.#inflate.write(chunk);
14741
14737
  if (fin) this.#inflate.write(tail);
14742
14738
  this.#inflate.flush(() => {
14743
- if (this.#aborted || !this.#inflate) return;
14739
+ if (!this.#inflate) return;
14744
14740
  const full = Buffer.concat(this.#inflate[kBuffer], this.#inflate[kLength]);
14745
14741
  this.#inflate[kBuffer].length = 0;
14746
14742
  this.#inflate[kLength] = 0;
14747
- this.#currentCallback = null;
14748
14743
  callback(null, full);
14749
14744
  });
14750
14745
  }
@@ -14764,8 +14759,10 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14764
14759
  const { WebsocketFrameSend } = require_frame();
14765
14760
  const { closeWebSocketConnection } = require_connection();
14766
14761
  const { PerMessageDeflate } = require_permessage_deflate();
14762
+ const { MessageSizeExceededError } = require_errors();
14767
14763
  var ByteParser = class extends Writable {
14768
14764
  #buffers = [];
14765
+ #fragmentsBytes = 0;
14769
14766
  #byteOffset = 0;
14770
14767
  #loop = false;
14771
14768
  #state = parserStates.INFO;
@@ -14773,15 +14770,19 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14773
14770
  #fragments = [];
14774
14771
  /** @type {Map<string, PerMessageDeflate>} */
14775
14772
  #extensions;
14773
+ /** @type {number} */
14774
+ #maxPayloadSize;
14776
14775
  /**
14777
14776
  * @param {import('./websocket').WebSocket} ws
14778
14777
  * @param {Map<string, string>|null} extensions
14778
+ * @param {{ maxPayloadSize?: number }} [options]
14779
14779
  */
14780
- constructor(ws, extensions) {
14780
+ constructor(ws, extensions, options = {}) {
14781
14781
  super();
14782
14782
  this.ws = ws;
14783
14783
  this.#extensions = extensions == null ? /* @__PURE__ */ new Map() : extensions;
14784
- if (this.#extensions.has("permessage-deflate")) this.#extensions.set("permessage-deflate", new PerMessageDeflate(extensions));
14784
+ this.#maxPayloadSize = options.maxPayloadSize ?? 0;
14785
+ if (this.#extensions.has("permessage-deflate")) this.#extensions.set("permessage-deflate", new PerMessageDeflate(extensions, options));
14785
14786
  }
14786
14787
  /**
14787
14788
  * @param {Buffer} chunk
@@ -14793,6 +14794,13 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14793
14794
  this.#loop = true;
14794
14795
  this.run(callback);
14795
14796
  }
14797
+ #validatePayloadLength() {
14798
+ if (this.#maxPayloadSize > 0 && !isControlFrame(this.#info.opcode) && this.#info.payloadLength > this.#maxPayloadSize) {
14799
+ failWebsocketConnection(this.ws, "Payload size exceeds maximum allowed size");
14800
+ return false;
14801
+ }
14802
+ return true;
14803
+ }
14796
14804
  /**
14797
14805
  * Runs whenever a new chunk is received.
14798
14806
  * Callback is called whenever there are no more chunks buffering,
@@ -14849,6 +14857,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14849
14857
  if (payloadLength <= 125) {
14850
14858
  this.#info.payloadLength = payloadLength;
14851
14859
  this.#state = parserStates.READ_DATA;
14860
+ if (!this.#validatePayloadLength()) return;
14852
14861
  } else if (payloadLength === 126) this.#state = parserStates.PAYLOADLENGTH_16;
14853
14862
  else if (payloadLength === 127) this.#state = parserStates.PAYLOADLENGTH_64;
14854
14863
  if (isTextBinaryFrame(opcode)) {
@@ -14864,6 +14873,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14864
14873
  const buffer = this.consume(2);
14865
14874
  this.#info.payloadLength = buffer.readUInt16BE(0);
14866
14875
  this.#state = parserStates.READ_DATA;
14876
+ if (!this.#validatePayloadLength()) return;
14867
14877
  } else if (this.#state === parserStates.PAYLOADLENGTH_64) {
14868
14878
  if (this.#byteOffset < 8) return callback();
14869
14879
  const buffer = this.consume(8);
@@ -14875,6 +14885,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14875
14885
  }
14876
14886
  this.#info.payloadLength = lower;
14877
14887
  this.#state = parserStates.READ_DATA;
14888
+ if (!this.#validatePayloadLength()) return;
14878
14889
  } else if (this.#state === parserStates.READ_DATA) {
14879
14890
  if (this.#byteOffset < this.#info.payloadLength) return callback();
14880
14891
  const body = this.consume(this.#info.payloadLength);
@@ -14882,12 +14893,12 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14882
14893
  this.#loop = this.parseControlFrame(body);
14883
14894
  this.#state = parserStates.INFO;
14884
14895
  } else if (!this.#info.compressed) {
14885
- this.#fragments.push(body);
14886
- if (!this.#info.fragmented && this.#info.fin) {
14887
- const fullMessage = Buffer.concat(this.#fragments);
14888
- websocketMessageReceived(this.ws, this.#info.binaryType, fullMessage);
14889
- this.#fragments.length = 0;
14896
+ this.writeFragments(body);
14897
+ if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
14898
+ failWebsocketConnection(this.ws, new MessageSizeExceededError().message);
14899
+ return;
14890
14900
  }
14901
+ if (!this.#info.fragmented && this.#info.fin) websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments());
14891
14902
  this.#state = parserStates.INFO;
14892
14903
  } else {
14893
14904
  this.#extensions.get("permessage-deflate").decompress(body, this.#info.fin, (error, data) => {
@@ -14895,17 +14906,20 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14895
14906
  failWebsocketConnection(this.ws, error.message);
14896
14907
  return;
14897
14908
  }
14898
- this.#fragments.push(data);
14909
+ this.writeFragments(data);
14910
+ if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
14911
+ failWebsocketConnection(this.ws, new MessageSizeExceededError().message);
14912
+ return;
14913
+ }
14899
14914
  if (!this.#info.fin) {
14900
14915
  this.#state = parserStates.INFO;
14901
14916
  this.#loop = true;
14902
14917
  this.run(callback);
14903
14918
  return;
14904
14919
  }
14905
- websocketMessageReceived(this.ws, this.#info.binaryType, Buffer.concat(this.#fragments));
14920
+ websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments());
14906
14921
  this.#loop = true;
14907
14922
  this.#state = parserStates.INFO;
14908
- this.#fragments.length = 0;
14909
14923
  this.run(callback);
14910
14924
  });
14911
14925
  this.#loop = false;
@@ -14945,6 +14959,21 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14945
14959
  this.#byteOffset -= n;
14946
14960
  return buffer;
14947
14961
  }
14962
+ writeFragments(fragment) {
14963
+ this.#fragmentsBytes += fragment.length;
14964
+ this.#fragments.push(fragment);
14965
+ }
14966
+ consumeFragments() {
14967
+ const fragments = this.#fragments;
14968
+ if (fragments.length === 1) {
14969
+ this.#fragmentsBytes = 0;
14970
+ return fragments.shift();
14971
+ }
14972
+ const output = Buffer.concat(fragments, this.#fragmentsBytes);
14973
+ this.#fragments = [];
14974
+ this.#fragmentsBytes = 0;
14975
+ return output;
14976
+ }
14948
14977
  parseCloseBody(data) {
14949
14978
  assert(data.length !== 1);
14950
14979
  /** @type {number|undefined} */
@@ -15301,7 +15330,8 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
15301
15330
  */
15302
15331
  #onConnectionEstablished(response, parsedExtensions) {
15303
15332
  this[kResponse] = response;
15304
- const parser = new ByteParser(this, parsedExtensions);
15333
+ const maxPayloadSize = this[kController]?.dispatcher?.webSocketOptions?.maxPayloadSize;
15334
+ const parser = new ByteParser(this, parsedExtensions, { maxPayloadSize });
15305
15335
  parser.on("drain", onParserDrain);
15306
15336
  parser.on("error", onParserError.bind(this));
15307
15337
  response.socket.ws = this;
@@ -16119,7 +16149,7 @@ function initOAuth2Client() {
16119
16149
  * @returns Configured Operator client
16120
16150
  */
16121
16151
  async function initOperatorClient(accessToken) {
16122
- const { createTracingInterceptor } = await import("./interceptor-CzaH2Ur6.mjs");
16152
+ const { createTracingInterceptor } = await import("./interceptor-4UC-KTno.mjs");
16123
16153
  return createClient(OperatorService, await createTransport(platformBaseUrl, [
16124
16154
  await userAgentInterceptor(),
16125
16155
  await bearerTokenInterceptor(accessToken),
@@ -16298,6 +16328,34 @@ async function fetchAll(fn) {
16298
16328
  return items;
16299
16329
  }
16300
16330
  /**
16331
+ * Fetch paginated resources with an optional upper bound on the number of
16332
+ * items returned. When `limit` is 0 or undefined the function behaves
16333
+ * like `fetchAll` and returns every page. When `limit` is positive the
16334
+ * function stops once enough items are collected, requesting smaller
16335
+ * pages as it approaches the boundary.
16336
+ * @template T
16337
+ * @param fn - Page fetcher returning items and next page token
16338
+ * @param options - Pagination options
16339
+ * @returns Fetched items (length <= limit when limit > 0)
16340
+ */
16341
+ async function fetchPaged(fn, options) {
16342
+ const limit = options?.limit;
16343
+ const unbounded = limit === void 0 || limit === 0;
16344
+ const items = [];
16345
+ let pageToken = "";
16346
+ while (true) {
16347
+ const pageSize = unbounded ? MAX_PAGE_SIZE : Math.min(limit - items.length, MAX_PAGE_SIZE);
16348
+ if (!unbounded && pageSize <= 0) break;
16349
+ const [batch, nextPageToken] = await fn(pageToken, pageSize);
16350
+ items.push(...batch);
16351
+ if (!unbounded && items.length >= limit) break;
16352
+ if (!nextPageToken) break;
16353
+ pageToken = nextPageToken;
16354
+ }
16355
+ if (!unbounded && items.length > limit) return items.slice(0, limit);
16356
+ return items;
16357
+ }
16358
+ /**
16301
16359
  * Fetch user info from the Tailor Platform userinfo endpoint.
16302
16360
  * @param accessToken - Access token for the current user
16303
16361
  * @returns Parsed user info
@@ -16398,5 +16456,5 @@ async function closeConnectionPool() {
16398
16456
  }
16399
16457
 
16400
16458
  //#endregion
16401
- export { ExecutorJobStatus as A, AuthSCIMAttribute_Type as B, TailorDBType_PermitAction as C, IdPPermissionPermit as D, IdPPermissionOperator as E, AuthIDPConfig_AuthType as F, UserProfileProviderConfig_UserProfileProviderType as G, AuthSCIMConfig_AuthorizationType as H, AuthInvokerSchema as I, Condition_Operator as J, GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus as K, AuthOAuth2Client_ClientType as L, ExecutorTriggerType as M, AuthConnection_Type as N, FunctionExecution_Status as O, AuthHookPoint as P, Subgraph_ServiceType as Q, AuthOAuth2Client_GrantType as R, TailorDBType_Permission_Permit as S, IdPLang as T, PATScope as U, AuthSCIMAttribute_Uniqueness as V, TenantProviderConfig_TenantProviderType as W, PageDirection as X, FilterSchema as Y, ApplicationSchemaUpdateAttemptStatus as Z, WorkflowJobExecution_Status as _, fetchMachineUserToken as a, TailorDBGQLPermission_Permit as b, formatRequestParams as c, parseMethodName as d, platformBaseUrl as f, WorkflowExecution_Status as g, WorkspacePlatformUserRole as h, fetchAll as i, ExecutorTargetType as j, FunctionExecution_Type as k, initOAuth2Client as l, userAgent as m, closeConnectionPool as n, fetchPlatformMachineUserToken as o, resolveStaticWebsiteUrls as p, ConditionSchema as q, createTransport as r, fetchUserInfo as s, MAX_PAGE_SIZE as t, initOperatorClient as u, TailorDBGQLPermission_Action as v, PipelineResolver_OperationType as w, TailorDBType_Permission_Operator as x, TailorDBGQLPermission_Operator as y, AuthSCIMAttribute_Mutability as z };
16402
- //# sourceMappingURL=client-xzPXtc_e.mjs.map
16459
+ export { ApplicationSchemaUpdateAttemptStatus as $, FunctionExecution_Status as A, AuthOAuth2Client_GrantType as B, TailorDBType_Permission_Operator as C, IdPLang as D, PipelineResolver_OperationType as E, AuthConnection_Type as F, PATScope as G, AuthSCIMAttribute_Type as H, AuthHookPoint as I, GetApplicationSchemaHealthResponse_ApplicationSchemaHealthStatus as J, TenantProviderConfig_TenantProviderType as K, AuthIDPConfig_AuthType as L, ExecutorJobStatus as M, ExecutorTargetType as N, IdPPermissionOperator as O, ExecutorTriggerType as P, PageDirection as Q, AuthInvokerSchema as R, TailorDBGQLPermission_Permit as S, TailorDBType_PermitAction as T, AuthSCIMAttribute_Uniqueness as U, AuthSCIMAttribute_Mutability as V, AuthSCIMConfig_AuthorizationType as W, Condition_Operator as X, ConditionSchema as Y, FilterSchema as Z, WorkspacePlatformUserRole as _, fetchMachineUserToken as a, TailorDBGQLPermission_Action as b, fetchUserInfo as c, initOperatorClient as d, Subgraph_ServiceType as et, parseMethodName as f, OperatorService as g, userAgent as h, fetchAll as i, FunctionExecution_Type as j, IdPPermissionPermit as k, formatRequestParams as l, resolveStaticWebsiteUrls as m, closeConnectionPool as n, fetchPaged as o, platformBaseUrl as p, UserProfileProviderConfig_UserProfileProviderType as q, createTransport as r, fetchPlatformMachineUserToken as s, MAX_PAGE_SIZE as t, initOAuth2Client as u, WorkflowExecution_Status as v, TailorDBType_Permission_Permit as w, TailorDBGQLPermission_Operator as x, WorkflowJobExecution_Status as y, AuthOAuth2Client_ClientType as z };
16460
+ //# sourceMappingURL=client-DjGFRjH4.mjs.map