@tailor-platform/sdk 1.47.1 → 1.49.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 (91) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/{actor-jk4-f0yp.d.mts → actor-BeIEiPYM.d.mts} +2 -2
  3. package/dist/{application-C7H7y0hS.mjs → application-CZMzt9jL.mjs} +82 -18
  4. package/dist/application-CZMzt9jL.mjs.map +1 -0
  5. package/dist/application-v_E2W-Fz.mjs +4 -0
  6. package/dist/brand-D-d15jx3.mjs.map +1 -1
  7. package/dist/cli/index.mjs +55 -31
  8. package/dist/cli/index.mjs.map +1 -1
  9. package/dist/cli/lib.d.mts +6 -6
  10. package/dist/cli/lib.mjs +6 -6
  11. package/dist/cli/lib.mjs.map +1 -1
  12. package/dist/cli/skills.mjs.map +1 -1
  13. package/dist/{client-DCqdtFte.mjs → client-CPW1N1Rs.mjs} +1 -1
  14. package/dist/{client-DbyKSN1F.mjs → client-_kHh0Pip.mjs} +2 -2
  15. package/dist/{client-DbyKSN1F.mjs.map → client-_kHh0Pip.mjs.map} +1 -1
  16. package/dist/configure/index.d.mts +4 -4
  17. package/dist/configure/index.mjs +51 -3
  18. package/dist/configure/index.mjs.map +1 -1
  19. package/dist/{crashreport-CNSw_BrJ.mjs → crashreport-CvmdFs4i.mjs} +5 -5
  20. package/dist/crashreport-CvmdFs4i.mjs.map +1 -0
  21. package/dist/{crashreport-DXGFd16F.mjs → crashreport-DHJuSmUc.mjs} +1 -1
  22. package/dist/enum-constants-C3KSpsYj.mjs.map +1 -1
  23. package/dist/{errors-wNQxQQBH.mjs → errors-pMPXghkO.mjs} +1 -1
  24. package/dist/{errors-wNQxQQBH.mjs.map → errors-pMPXghkO.mjs.map} +1 -1
  25. package/dist/field-DLSIuMTu.mjs.map +1 -1
  26. package/dist/file-utils-DjNi_3U_.mjs.map +1 -1
  27. package/dist/index-BQ4oi0AI.d.mts +48 -0
  28. package/dist/{index-BbOTbZFf.d.mts → index-BjXN1SdY.d.mts} +2 -2
  29. package/dist/{index-DB8EapT-.d.mts → index-C--7W0UO.d.mts} +5 -5
  30. package/dist/{index-BRvNi5q9.d.mts → index-VJW98BSy.d.mts} +2 -2
  31. package/dist/{index-iy-hNfGp.d.mts → index-nV4ZC_Ve.d.mts} +2 -2
  32. package/dist/{interceptor-CBsqEWDK.mjs → interceptor-DTNS0EtF.mjs} +1 -1
  33. package/dist/{interceptor-CBsqEWDK.mjs.map → interceptor-DTNS0EtF.mjs.map} +1 -1
  34. package/dist/{job-R5C2Hfcc.mjs → job-M3Avv_SV.mjs} +4 -3
  35. package/dist/{job-R5C2Hfcc.mjs.map → job-M3Avv_SV.mjs.map} +1 -1
  36. package/dist/kysely/index.mjs.map +1 -1
  37. package/dist/kysely-type-B8aRz_oC.mjs.map +1 -1
  38. package/dist/logger-DTNAMYGy.mjs.map +1 -1
  39. package/dist/{mock-BP-9O5On.mjs → mock-BfL09ULZ.mjs} +1 -1
  40. package/dist/{mock-BP-9O5On.mjs.map → mock-BfL09ULZ.mjs.map} +1 -1
  41. package/dist/multiline-e3IpANmS.mjs.map +1 -1
  42. package/dist/package-json-6Px8bDpG.mjs.map +1 -1
  43. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  44. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  45. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  46. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  47. package/dist/plugin/builtin/seed/index.mjs +1 -1
  48. package/dist/plugin/index.d.mts +2 -2
  49. package/dist/plugin/index.mjs.map +1 -1
  50. package/dist/{repl-editor-CZpLlOBj.mjs → repl-editor-jZ493eQI.mjs} +1 -1
  51. package/dist/{repl-editor-CZpLlOBj.mjs.map → repl-editor-jZ493eQI.mjs.map} +1 -1
  52. package/dist/{runtime-XjP6JMmP.mjs → runtime-oZgK353r.mjs} +484 -132
  53. package/dist/runtime-oZgK353r.mjs.map +1 -0
  54. package/dist/{tailordb-DjlNUV6u.mjs → schema-C5QjYEc-.mjs} +2 -42
  55. package/dist/schema-C5QjYEc-.mjs.map +1 -0
  56. package/dist/secret-file-BHpxGyNf.mjs +65 -0
  57. package/dist/secret-file-BHpxGyNf.mjs.map +1 -0
  58. package/dist/seed/index.mjs.map +1 -1
  59. package/dist/{seed-DrKY5yIF.mjs → seed-DjfAn0BC.mjs} +44 -19
  60. package/dist/seed-DjfAn0BC.mjs.map +1 -0
  61. package/dist/{service-obEU5gSM.mjs → service-DCgJxdg1.mjs} +2 -2
  62. package/dist/{service-obEU5gSM.mjs.map → service-DCgJxdg1.mjs.map} +1 -1
  63. package/dist/{tailor-db-field-Bn8ZC5lK.d.mts → tailor-db-field-4bMLe25-.d.mts} +5 -1
  64. package/dist/telemetry-C13VIFpT.mjs +4 -0
  65. package/dist/{telemetry-DcL8Fsm_.mjs → telemetry-C1Y56L5E.mjs} +1 -1
  66. package/dist/{telemetry-DcL8Fsm_.mjs.map → telemetry-C1Y56L5E.mjs.map} +1 -1
  67. package/dist/types-sir9UPht.mjs.map +1 -1
  68. package/dist/utils/test/index.d.mts +3 -3
  69. package/dist/utils/test/index.mjs +1 -1
  70. package/dist/utils/test/index.mjs.map +1 -1
  71. package/dist/vitest/environment.mjs +1 -1
  72. package/dist/vitest/environment.mjs.map +1 -1
  73. package/dist/vitest/index.mjs +1 -1
  74. package/dist/vitest/index.mjs.map +1 -1
  75. package/dist/vitest/setup.mjs +1 -1
  76. package/dist/vitest/setup.mjs.map +1 -1
  77. package/dist/{workflow.generated-i7PK4fg-.d.mts → workflow.generated-OYAu_6zX.d.mts} +12 -2
  78. package/docs/cli/application.md +4 -0
  79. package/docs/cli/workspace.md +20 -17
  80. package/docs/configuration.md +4 -0
  81. package/docs/generator/builtin.md +35 -4
  82. package/package.json +16 -16
  83. package/postinstall.mjs +1 -1
  84. package/dist/application-C7H7y0hS.mjs.map +0 -1
  85. package/dist/application-Csq5jxYP.mjs +0 -4
  86. package/dist/crashreport-CNSw_BrJ.mjs.map +0 -1
  87. package/dist/index-BXyS7xKC.d.mts +0 -21
  88. package/dist/runtime-XjP6JMmP.mjs.map +0 -1
  89. package/dist/seed-DrKY5yIF.mjs.map +0 -1
  90. package/dist/tailordb-DjlNUV6u.mjs.map +0 -1
  91. package/dist/telemetry-21afNV9_.mjs +0 -4
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-CZMzt9jL.mjs";
3
+
4
+ export { defineApplication };
@@ -1 +1 @@
1
- {"version":3,"file":"brand-D-d15jx3.mjs","names":[],"sources":["../src/utils/brand.ts"],"sourcesContent":["// Symbol.for ensures the same symbol is returned across different ESM module instances,\n// avoiding identity mismatches when multiple copies of the SDK are loaded.\nexport const SDK_BRAND: unique symbol = Symbol.for(\"tailor-platform/sdk\");\n\nexport type SdkBrandKind =\n | \"tailordb-type\"\n | \"resolver\"\n | \"executor\"\n | \"workflow\"\n | \"workflow-job\"\n | \"wait-point\";\n\n/**\n * Adds a non-enumerable SDK brand symbol to the given object (in-place).\n * The brand stores the kind so service loaders can distinguish between\n * different SDK object types (e.g. a type loader skips executors).\n * @param value - The object to brand\n * @param kind - The kind of SDK object\n * @returns The same object with the brand applied\n */\nexport function brandValue<T extends object>(value: T, kind: SdkBrandKind): T {\n Object.defineProperty(value, SDK_BRAND, {\n value: kind,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return value;\n}\n\n/**\n * Checks whether the given value has been branded by the SDK.\n * When kind is specified, only returns true if the brand matches that kind.\n * Accepts a single kind or an array of kinds for multi-kind matching.\n * @param value - The value to check\n * @param kind - Optional kind or kinds to match against\n * @returns True if the value has the SDK brand symbol (and matches kind if specified)\n */\nexport function isSdkBranded(\n value: unknown,\n kind?: SdkBrandKind | readonly SdkBrandKind[],\n): boolean {\n if (value === null || typeof value !== \"object\" || !(SDK_BRAND in value)) return false;\n const stored = (value as Record<symbol, unknown>)[SDK_BRAND];\n // No kind filter → any brand matches. Legacy `true` brand → matches any kind.\n return (\n kind === undefined ||\n stored === true ||\n (Array.isArray(kind) ? kind.includes(stored as SdkBrandKind) : stored === kind)\n );\n}\n"],"mappings":";;AAEA,MAAa,YAA2B,OAAO,IAAI,sBAAsB;;;;;;;;;AAkBzE,SAAgB,WAA6B,OAAU,MAAuB;CAC5E,OAAO,eAAe,OAAO,WAAW;EACtC,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;EACX,CAAC;CACF,OAAO;;;;;;;;;;AAWT,SAAgB,aACd,OACA,MACS;CACT,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ,OAAO;CACjF,MAAM,SAAU,MAAkC;CAElD,OACE,SAAS,UACT,WAAW,SACV,MAAM,QAAQ,KAAK,GAAG,KAAK,SAAS,OAAuB,GAAG,WAAW"}
1
+ {"version":3,"file":"brand-D-d15jx3.mjs","names":[],"sources":["../src/utils/brand.ts"],"sourcesContent":["// Symbol.for ensures the same symbol is returned across different ESM module instances,\n// avoiding identity mismatches when multiple copies of the SDK are loaded.\nexport const SDK_BRAND: unique symbol = Symbol.for(\"tailor-platform/sdk\");\n\nexport type SdkBrandKind =\n | \"tailordb-type\"\n | \"resolver\"\n | \"executor\"\n | \"workflow\"\n | \"workflow-job\"\n | \"wait-point\";\n\n/**\n * Adds a non-enumerable SDK brand symbol to the given object (in-place).\n * The brand stores the kind so service loaders can distinguish between\n * different SDK object types (e.g. a type loader skips executors).\n * @param value - The object to brand\n * @param kind - The kind of SDK object\n * @returns The same object with the brand applied\n */\nexport function brandValue<T extends object>(value: T, kind: SdkBrandKind): T {\n Object.defineProperty(value, SDK_BRAND, {\n value: kind,\n enumerable: false,\n configurable: false,\n writable: false,\n });\n return value;\n}\n\n/**\n * Checks whether the given value has been branded by the SDK.\n * When kind is specified, only returns true if the brand matches that kind.\n * Accepts a single kind or an array of kinds for multi-kind matching.\n * @param value - The value to check\n * @param kind - Optional kind or kinds to match against\n * @returns True if the value has the SDK brand symbol (and matches kind if specified)\n */\nexport function isSdkBranded(\n value: unknown,\n kind?: SdkBrandKind | readonly SdkBrandKind[],\n): boolean {\n if (value === null || typeof value !== \"object\" || !(SDK_BRAND in value)) return false;\n const stored = (value as Record<symbol, unknown>)[SDK_BRAND];\n // No kind filter → any brand matches. Legacy `true` brand → matches any kind.\n return (\n kind === undefined ||\n stored === true ||\n (Array.isArray(kind) ? kind.includes(stored as SdkBrandKind) : stored === kind)\n );\n}\n"],"mappings":";;AAEA,MAAa,YAA2B,OAAO,IAAI,qBAAqB;;;;;;;;;AAkBxE,SAAgB,WAA6B,OAAU,MAAuB;CAC5E,OAAO,eAAe,OAAO,WAAW;EACtC,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;CACZ,CAAC;CACD,OAAO;AACT;;;;;;;;;AAUA,SAAgB,aACd,OACA,MACS;CACT,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ,OAAO;CACjF,MAAM,SAAU,MAAkC;CAElD,OACE,SAAS,UACT,WAAW,SACV,MAAM,QAAQ,IAAI,IAAI,KAAK,SAAS,MAAsB,IAAI,WAAW;AAE9E"}
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { G as PATScope, R as AuthInvokerSchema, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, j as FunctionExecution_Type, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client } from "../client-DbyKSN1F.mjs";
3
+ import { G as PATScope, R as AuthInvokerSchema, c as fetchUserInfo, d as initOperatorClient, h as userAgent, i as fetchAll, j as FunctionExecution_Type, n as closeConnectionPool, o as fetchPaged, s as fetchPlatformMachineUserToken, u as initOAuth2Client } from "../client-_kHh0Pip.mjs";
4
4
  import { n as logger, r as styles } from "../logger-DTNAMYGy.mjs";
5
- import { $ as deleteCommand$3, At as executionsCommand, C as listCommand$13, Cn as toPageDirection, Ct as jobsCommand, E as resumeCommand, Et as startCommand, F as showCommand, Ft as getCommand$1, G as getCommand$5, H as treeCommand, I as logBetaWarning, Lt as deploy, N as generateCommand$1, Nt as functionExecutionStatusToString, O as listCommand$12, Ot as getCommand$6, Pt as formatKeyValueTable, R as removeCommand$1, Rt as executeScript, Sn as paginationArgs, T as healthCommand, U as listCommand$11, Vt as parseMigrationLabelNumber, Y as listCommand$10, Z as getCommand$4, Zt as formatMigrationNumber, _n as commonArgs, _t as webhookCommand, at as getCommand$3, b as createCommand$4, bn as isVerbose, bt as listCommand$6, c as listCommand$14, ct as tokenCommand, dn as trnPrefix, dt as generate, en as getMigrationFilePath, f as restoreCommand, ft as listCommand$7, g as getCommand$7, gn as defineAppCommand, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mn as apiCommand, mt as getCommand$2, o as removeCommand, pn as prompt, q as updateCommand$2, r as queryCommand, rn as isValidMigrationNumber, rt as listCommand$9, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, tt as createCommand$3, u as inviteCommand, un as sdkNameLabelKey, v as deleteCommand$4, vn as confirmationArgs, vt as triggerCommand, wn as workspaceArgs, xn as pagedLogArgs, yn as deploymentArgs, z as updateCommand$3 } from "../runtime-XjP6JMmP.mjs";
6
- import { C as loadWorkspaceId, D as writePlatformConfig, E as saveUserTokens, S as loadAccessToken, T as resolveTokens, _ as getDistDir, a as WorkflowJobSchema, b as deleteUserTokens, c as ExecutorSchema, i as resolveInlineSourcemap, l as INVOKER_EXPR, o as ResolverSchema, w as readPlatformConfig, x as fetchLatestToken, y as loadConfig } from "../application-C7H7y0hS.mjs";
5
+ import { $ as deleteCommand$3, At as executionsCommand, C as listCommand$13, Cn as paginationArgs, Ct as jobsCommand, E as resumeCommand, Et as startCommand, F as showCommand, Ft as getCommand$1, G as getCommand$5, H as treeCommand, I as logBetaWarning, Lt as deploy, N as generateCommand$1, Nt as functionExecutionStatusToString, O as listCommand$12, Ot as getCommand$6, Pt as formatKeyValueTable, R as removeCommand$1, Rt as executeScript, Sn as pagedLogArgs, T as healthCommand, Tn as workspaceArgs, U as listCommand$11, Vt as parseMigrationLabelNumber, Y as listCommand$10, Z as getCommand$4, Zt as formatMigrationNumber, _n as defineAppCommand, _t as webhookCommand, at as getCommand$3, b as createCommand$4, bn as deploymentArgs, bt as listCommand$6, c as listCommand$14, ct as tokenCommand, dn as trnPrefix, dt as generate, en as getMigrationFilePath, f as restoreCommand, ft as listCommand$7, g as getCommand$7, gn as assertWritable, i as updateCommand$4, in as loadDiff, j as truncateCommand, ln as getNamespacesWithMigrations, lt as listCommand$8, m as listCommand$15, mn as apiCommand, mt as getCommand$2, o as removeCommand, pn as prompt, q as updateCommand$2, r as queryCommand, rn as isValidMigrationNumber, rt as listCommand$9, t as isNativeTypeScriptRuntime, tn as getMigrationFiles, tt as createCommand$3, u as inviteCommand, un as sdkNameLabelKey, v as deleteCommand$4, vn as commonArgs, vt as triggerCommand, wn as toPageDirection, xn as isVerbose, yn as confirmationArgs, z as updateCommand$3 } from "../runtime-oZgK353r.mjs";
6
+ import { D as saveUserTokens, E as resolveTokens, O as writePlatformConfig, S as loadAccessToken, T as readPlatformConfig, _ as getDistDir, a as WorkflowJobSchema, b as deleteUserTokens, c as ExecutorSchema, i as resolveInlineSourcemap, l as INVOKER_EXPR, o as ResolverSchema, w as loadWorkspaceId, x as fetchLatestToken, y as loadConfig } from "../application-CZMzt9jL.mjs";
7
7
  import { t as multiline } from "../multiline-e3IpANmS.mjs";
8
8
  import { t as readPackageJson } from "../package-json-6Px8bDpG.mjs";
9
- import { n as isCLIError } from "../errors-wNQxQQBH.mjs";
10
- import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-CNSw_BrJ.mjs";
9
+ import { n as isCLIError } from "../errors-pMPXghkO.mjs";
10
+ import { a as JSON_FOOTER_MARKER, i as CRASH_LOG_EXTENSION, o as parseCrashReportConfig, r as sendCrashReport, t as initCrashReporting } from "../crashreport-CvmdFs4i.mjs";
11
11
  import { createRequire } from "node:module";
12
12
  import { arg, defineCommand, runCommand, runMain } from "politty";
13
13
  import { withCompletionCommand } from "politty/completion";
@@ -70,6 +70,7 @@ const authorizeAuthConnectionCommand = defineAppCommand({
70
70
  "no-browser": z.boolean().optional().default(false).describe("Don't open browser automatically")
71
71
  }).strict(),
72
72
  run: async (args) => {
73
+ await assertWritable({ profile: args.profile });
73
74
  const client = await initOperatorClient(await loadAccessToken({
74
75
  useProfile: true,
75
76
  profile: args.profile
@@ -221,6 +222,7 @@ const revokeAuthConnectionCommand = defineAppCommand({
221
222
  ...confirmationArgs
222
223
  }).strict(),
223
224
  run: async (args) => {
225
+ await assertWritable({ profile: args.profile });
224
226
  const client = await initOperatorClient(await loadAccessToken({
225
227
  useProfile: true,
226
228
  profile: args.profile
@@ -388,7 +390,8 @@ const deployCommand$1 = defineAppCommand({
388
390
  "clean-cache": arg(z.boolean().optional(), { description: "Clean the bundle cache before building" })
389
391
  }).strict(),
390
392
  run: async (args) => {
391
- const { initTelemetry } = await import("../telemetry-21afNV9_.mjs");
393
+ await assertWritable({ profile: args.profile });
394
+ const { initTelemetry } = await import("../telemetry-C13VIFpT.mjs");
392
395
  await initTelemetry();
393
396
  await deploy({
394
397
  workspaceId: args["workspace-id"],
@@ -1565,7 +1568,7 @@ const generateCommand = defineAppCommand({
1565
1568
  })
1566
1569
  }).strict(),
1567
1570
  run: async (args) => {
1568
- const { initTelemetry } = await import("../telemetry-21afNV9_.mjs");
1571
+ const { initTelemetry } = await import("../telemetry-C13VIFpT.mjs");
1569
1572
  await initTelemetry();
1570
1573
  await generate({
1571
1574
  configPath: args.config,
@@ -1864,7 +1867,8 @@ const createCommand$2 = defineAppCommand({
1864
1867
  "workspace-id": arg(z.string(), {
1865
1868
  alias: "w",
1866
1869
  description: "Workspace ID"
1867
- })
1870
+ }),
1871
+ permission: arg(z.enum(["write", "read"]).default("write"), { description: "Profile permission. 'read' blocks all write commands while the profile is active." })
1868
1872
  }).strict(),
1869
1873
  run: async (args) => {
1870
1874
  const config = await readPlatformConfig();
@@ -1879,14 +1883,16 @@ const createCommand$2 = defineAppCommand({
1879
1883
  })).find((ws) => ws.id === args["workspace-id"])) throw new Error(`Workspace "${args["workspace-id"]}" not found.`);
1880
1884
  config.profiles[args.name] = {
1881
1885
  user: args.user,
1882
- workspace_id: args["workspace-id"]
1886
+ workspace_id: args["workspace-id"],
1887
+ ...args.permission === "read" ? { readonly: true } : {}
1883
1888
  };
1884
1889
  writePlatformConfig(config);
1885
1890
  if (!args.json) logger.success(`Profile "${args.name}" created successfully.`);
1886
1891
  const profileInfo = {
1887
1892
  name: args.name,
1888
1893
  user: args.user,
1889
- workspaceId: args["workspace-id"]
1894
+ workspaceId: args["workspace-id"],
1895
+ permission: args.permission
1890
1896
  };
1891
1897
  logger.out(profileInfo);
1892
1898
  }
@@ -1929,7 +1935,8 @@ const listCommand$4 = defineAppCommand({
1929
1935
  const profileInfos = profiles.map(([name, profile]) => ({
1930
1936
  name,
1931
1937
  user: profile.user,
1932
- workspaceId: profile.workspace_id
1938
+ workspaceId: profile.workspace_id,
1939
+ permission: profile.readonly === true ? "read" : "write"
1933
1940
  }));
1934
1941
  logger.out(profileInfos);
1935
1942
  }
@@ -1952,33 +1959,39 @@ const updateCommand$1 = defineAppCommand({
1952
1959
  "workspace-id": arg(z.string().optional(), {
1953
1960
  alias: "w",
1954
1961
  description: "New workspace ID"
1955
- })
1962
+ }),
1963
+ permission: arg(z.enum(["write", "read"]).optional(), { description: "Profile permission. 'read' blocks all write commands; 'write' lifts the restriction." })
1956
1964
  }).strict(),
1957
1965
  run: async (args) => {
1958
1966
  const config = await readPlatformConfig();
1959
1967
  if (!config.profiles[args.name]) throw new Error(`Profile "${args.name}" not found.`);
1960
- if (!args.user && !args["workspace-id"]) throw new Error("Please provide at least one property to update.");
1968
+ if (!args.user && !args["workspace-id"] && args.permission === void 0) throw new Error("Please provide at least one property to update.");
1961
1969
  const profile = config.profiles[args.name];
1962
1970
  const oldUser = profile.user;
1963
1971
  const newUser = args.user || oldUser;
1964
1972
  const oldWorkspaceId = profile.workspace_id;
1965
1973
  const newWorkspaceId = args["workspace-id"] || oldWorkspaceId;
1966
- const client = await initOperatorClient(await fetchLatestToken(config, newUser));
1967
- if (!(await fetchAll(async (pageToken, maxPageSize) => {
1968
- const { workspaces, nextPageToken } = await client.listWorkspaces({
1969
- pageToken,
1970
- pageSize: maxPageSize
1971
- });
1972
- return [workspaces, nextPageToken];
1973
- })).find((ws) => ws.id === newWorkspaceId)) throw new Error(`Workspace "${newWorkspaceId}" not found.`);
1974
+ if (args.user !== void 0 || args["workspace-id"] !== void 0) {
1975
+ const client = await initOperatorClient(await fetchLatestToken(config, newUser));
1976
+ if (!(await fetchAll(async (pageToken, maxPageSize) => {
1977
+ const { workspaces, nextPageToken } = await client.listWorkspaces({
1978
+ pageToken,
1979
+ pageSize: maxPageSize
1980
+ });
1981
+ return [workspaces, nextPageToken];
1982
+ })).find((ws) => ws.id === newWorkspaceId)) throw new Error(`Workspace "${newWorkspaceId}" not found.`);
1983
+ }
1974
1984
  profile.user = newUser;
1975
1985
  profile.workspace_id = newWorkspaceId;
1986
+ if (args.permission === "read") profile.readonly = true;
1987
+ else if (args.permission === "write") delete profile.readonly;
1976
1988
  writePlatformConfig(config);
1977
1989
  if (!args.json) logger.success(`Profile "${args.name}" updated successfully`);
1978
1990
  const profileInfo = {
1979
1991
  name: args.name,
1980
1992
  user: newUser,
1981
- workspaceId: newWorkspaceId
1993
+ workspaceId: newWorkspaceId,
1994
+ permission: profile.readonly === true ? "read" : "write"
1982
1995
  };
1983
1996
  logger.out(profileInfo);
1984
1997
  }
@@ -2092,6 +2105,7 @@ const createSecretCommand = defineAppCommand({
2092
2105
  ...confirmationArgs
2093
2106
  }).strict(),
2094
2107
  run: async (args) => {
2108
+ await assertWritable({ profile: args.profile });
2095
2109
  const client = await initOperatorClient(await loadAccessToken({
2096
2110
  useProfile: true,
2097
2111
  profile: args.profile
@@ -2144,6 +2158,7 @@ const deleteSecretCommand = defineAppCommand({
2144
2158
  ...confirmationArgs
2145
2159
  }).strict(),
2146
2160
  run: async (args) => {
2161
+ await assertWritable({ profile: args.profile });
2147
2162
  const client = await initOperatorClient(await loadAccessToken({
2148
2163
  useProfile: true,
2149
2164
  profile: args.profile
@@ -2252,6 +2267,7 @@ const updateSecretCommand = defineAppCommand({
2252
2267
  ...confirmationArgs
2253
2268
  }).strict(),
2254
2269
  run: async (args) => {
2270
+ await assertWritable({ profile: args.profile });
2255
2271
  const client = await initOperatorClient(await loadAccessToken({
2256
2272
  useProfile: true,
2257
2273
  profile: args.profile
@@ -2307,6 +2323,7 @@ const createCommand$1 = defineAppCommand({
2307
2323
  ...nameArgs
2308
2324
  }).strict(),
2309
2325
  run: async (args) => {
2326
+ await assertWritable({ profile: args.profile });
2310
2327
  const client = await initOperatorClient(await loadAccessToken({
2311
2328
  useProfile: true,
2312
2329
  profile: args.profile
@@ -2339,6 +2356,7 @@ const deleteCommand$1 = defineAppCommand({
2339
2356
  ...confirmationArgs
2340
2357
  }).strict(),
2341
2358
  run: async (args) => {
2359
+ await assertWritable({ profile: args.profile });
2342
2360
  const client = await initOperatorClient(await loadAccessToken({
2343
2361
  useProfile: true,
2344
2362
  profile: args.profile
@@ -2466,15 +2484,15 @@ var setup_bun_default = "- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019
2466
2484
 
2467
2485
  //#endregion
2468
2486
  //#region src/cli/commands/setup/github/setup-npm.yml
2469
- var setup_npm_default = "- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0\n with:\n node-version-file: package.json\n cache: npm\n- run: npm ci\n";
2487
+ var setup_npm_default = "- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0\n with:\n node-version-file: package.json\n cache: npm\n- run: npm ci\n";
2470
2488
 
2471
2489
  //#endregion
2472
2490
  //#region src/cli/commands/setup/github/setup-pnpm.yml
2473
- var setup_pnpm_default = "- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0\n- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0\n with:\n node-version-file: package.json\n cache: pnpm\n- run: pnpm install --frozen-lockfile\n";
2491
+ var setup_pnpm_default = "- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8\n- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0\n with:\n node-version-file: package.json\n cache: pnpm\n- run: pnpm install --frozen-lockfile\n";
2474
2492
 
2475
2493
  //#endregion
2476
2494
  //#region src/cli/commands/setup/github/setup-yarn.yml
2477
- var setup_yarn_default = "- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0\n with:\n node-version-file: package.json\n cache: yarn\n- run: yarn install --frozen-lockfile\n";
2495
+ var setup_yarn_default = "- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0\n with:\n node-version-file: package.json\n cache: yarn\n- run: yarn install --frozen-lockfile\n";
2478
2496
 
2479
2497
  //#endregion
2480
2498
  //#region src/cli/commands/setup/github/template-deploy.ts
@@ -2908,6 +2926,7 @@ const deployCommand = defineAppCommand({
2908
2926
  })
2909
2927
  }).strict(),
2910
2928
  run: async (args) => {
2929
+ await assertWritable({ profile: args.profile });
2911
2930
  logger.info(`Deploying static website "${args.name}" from directory: ${args.dir}`);
2912
2931
  const client = await initOperatorClient(await loadAccessToken({
2913
2932
  useProfile: true,
@@ -3445,6 +3464,7 @@ const erdDeployCommand = defineAppCommand({
3445
3464
  })
3446
3465
  }).strict(),
3447
3466
  run: async (args) => {
3467
+ await assertWritable({ profile: args.profile });
3448
3468
  const { client, workspaceId, config } = await initErdContext(args);
3449
3469
  const buildResults = await prepareErdBuilds({
3450
3470
  client,
@@ -3641,6 +3661,7 @@ const setCommand = defineAppCommand({
3641
3661
  })
3642
3662
  }).strict(),
3643
3663
  run: async (args) => {
3664
+ await assertWritable({ profile: args.profile });
3644
3665
  await set({
3645
3666
  configPath: args.config,
3646
3667
  number: args.number,
@@ -3771,9 +3792,9 @@ const upgradeCommand = defineAppCommand({
3771
3792
  })
3772
3793
  }).strict(),
3773
3794
  run: async (args) => {
3774
- const { initTelemetry } = await import("../telemetry-21afNV9_.mjs");
3795
+ const { initTelemetry } = await import("../telemetry-C13VIFpT.mjs");
3775
3796
  await initTelemetry();
3776
- const { upgrade } = await import("../service-obEU5gSM.mjs");
3797
+ const { upgrade } = await import("../service-DCgJxdg1.mjs");
3777
3798
  await upgrade({
3778
3799
  from: args.from,
3779
3800
  dryRun: args["dry-run"],
@@ -3901,6 +3922,7 @@ const createCommand = defineAppCommand({
3901
3922
  })
3902
3923
  }).strict(),
3903
3924
  run: async (args) => {
3925
+ await assertWritable();
3904
3926
  const config = await readPlatformConfig();
3905
3927
  if (!config.current_user) throw new Error(multiline`
3906
3928
  No user logged in.
@@ -3927,6 +3949,7 @@ const deleteCommand = defineAppCommand({
3927
3949
  description: "Token name"
3928
3950
  }) }).strict(),
3929
3951
  run: async (args) => {
3952
+ await assertWritable();
3930
3953
  const config = await readPlatformConfig();
3931
3954
  if (!config.current_user) throw new Error(multiline`
3932
3955
  No user logged in.
@@ -3997,6 +4020,7 @@ const updateCommand = defineAppCommand({
3997
4020
  })
3998
4021
  }).strict(),
3999
4022
  run: async (args) => {
4023
+ await assertWritable();
4000
4024
  const config = await readPlatformConfig();
4001
4025
  if (!config.current_user) throw new Error(multiline`
4002
4026
  No user logged in.
@@ -4136,8 +4160,8 @@ const workspaceCommand = defineCommand({
4136
4160
  //#endregion
4137
4161
  //#region src/cli/index.ts
4138
4162
  if (!isNativeTypeScriptRuntime()) {
4139
- const { register } = await import("node:module");
4140
- register("tsx", import.meta.url, { data: {} });
4163
+ const { register } = await import("tsx/esm/api");
4164
+ register();
4141
4165
  }
4142
4166
  initCrashReporting();
4143
4167
  const packageJson = await readPackageJson();
@@ -4189,11 +4213,11 @@ runMain(mainCommand, {
4189
4213
  if (isVerbose() && error.stack) logger.debug(`\nStack trace:\n${error.stack}`);
4190
4214
  } else logger.error(`Unknown error: ${error}`);
4191
4215
  if (!isCLIError(error) && (!(error instanceof Error) || error instanceof TypeError || error instanceof RangeError)) {
4192
- const { reportCrash } = await import("../crashreport-DXGFd16F.mjs");
4216
+ const { reportCrash } = await import("../crashreport-DHJuSmUc.mjs");
4193
4217
  await reportCrash(error, "handledError");
4194
4218
  }
4195
4219
  }
4196
- const { shutdownTelemetry } = await import("../telemetry-21afNV9_.mjs");
4220
+ const { shutdownTelemetry } = await import("../telemetry-C13VIFpT.mjs");
4197
4221
  await shutdownTelemetry();
4198
4222
  }
4199
4223
  });