@tailor-platform/sdk 1.17.0 → 1.18.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 (76) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/application-Csj7Ow5Q.mjs +8 -0
  3. package/dist/{application-DYfVZVPT.mjs → application-gWUyKuzv.mjs} +211 -1653
  4. package/dist/{application-DYfVZVPT.mjs.map → application-gWUyKuzv.mjs.map} +1 -1
  5. package/dist/brand-BZJCv6UY.mjs +28 -0
  6. package/dist/brand-BZJCv6UY.mjs.map +1 -0
  7. package/dist/cli/index.mjs +38 -20
  8. package/dist/cli/index.mjs.map +1 -1
  9. package/dist/cli/lib.d.mts +20 -33
  10. package/dist/cli/lib.mjs +10 -5
  11. package/dist/cli/lib.mjs.map +1 -1
  12. package/dist/configure/index.d.mts +4 -4
  13. package/dist/configure/index.mjs +10 -19
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/enum-constants-Cwd4qdpa.mjs +115 -0
  16. package/dist/enum-constants-Cwd4qdpa.mjs.map +1 -0
  17. package/dist/file-utils-cqcpFk87.mjs +139 -0
  18. package/dist/file-utils-cqcpFk87.mjs.map +1 -0
  19. package/dist/index-BKXch-td.d.mts +18 -0
  20. package/dist/index-C3Ib7pFc.d.mts +18 -0
  21. package/dist/{index-qQXpN674.d.mts → index-DP8EB9FK.d.mts} +13 -5
  22. package/dist/index-SqWgrTnF.d.mts +20 -0
  23. package/dist/index-sSDpuVQY.d.mts +18 -0
  24. package/dist/{jiti-BrELlEYT.mjs → jiti-DHlauMCo.mjs} +2 -2
  25. package/dist/{jiti-BrELlEYT.mjs.map → jiti-DHlauMCo.mjs.map} +1 -1
  26. package/dist/{job-CULA2Pvf.mjs → job-2Q82qQ6N.mjs} +27 -5
  27. package/dist/job-2Q82qQ6N.mjs.map +1 -0
  28. package/dist/kysely-type-DtUUoAi3.mjs +259 -0
  29. package/dist/kysely-type-DtUUoAi3.mjs.map +1 -0
  30. package/dist/plugin/builtin/enum-constants/index.d.mts +4 -0
  31. package/dist/plugin/builtin/enum-constants/index.mjs +3 -0
  32. package/dist/plugin/builtin/file-utils/index.d.mts +4 -0
  33. package/dist/plugin/builtin/file-utils/index.mjs +3 -0
  34. package/dist/plugin/builtin/kysely-type/index.d.mts +4 -0
  35. package/dist/plugin/builtin/kysely-type/index.mjs +3 -0
  36. package/dist/plugin/builtin/seed/index.d.mts +4 -0
  37. package/dist/plugin/builtin/seed/index.mjs +3 -0
  38. package/dist/plugin/index.d.mts +3 -3
  39. package/dist/plugin/index.mjs +11 -11
  40. package/dist/plugin/index.mjs.map +1 -1
  41. package/dist/{schema-R5TxC5Pn.mjs → schema-WDvc7Zel.mjs} +4 -3
  42. package/dist/schema-WDvc7Zel.mjs.map +1 -0
  43. package/dist/seed-Dm7lrGZ3.mjs +1050 -0
  44. package/dist/seed-Dm7lrGZ3.mjs.map +1 -0
  45. package/dist/{src-DMROgdcL.mjs → src-i4uqS1G4.mjs} +2 -2
  46. package/dist/{src-DMROgdcL.mjs.map → src-i4uqS1G4.mjs.map} +1 -1
  47. package/dist/types-Bhl_wAM2.d.mts +151 -0
  48. package/dist/{types-b-ig8nW_.mjs → types-ClK_HJ0G.mjs} +1 -1
  49. package/dist/{types-b-ig8nW_.mjs.map → types-ClK_HJ0G.mjs.map} +1 -1
  50. package/dist/{types-DzvazVmg.d.mts → types-DdvTxFiD.d.mts} +1380 -1044
  51. package/dist/{update-DQKCUNmr.mjs → update-BoNKMti-.mjs} +285 -112
  52. package/dist/update-BoNKMti-.mjs.map +1 -0
  53. package/dist/utils/test/index.d.mts +4 -4
  54. package/dist/utils/test/index.mjs +3 -2
  55. package/dist/utils/test/index.mjs.map +1 -1
  56. package/docs/cli/application.md +106 -14
  57. package/docs/cli/auth.md +92 -12
  58. package/docs/cli/completion.md +18 -2
  59. package/docs/cli/executor.md +122 -14
  60. package/docs/cli/function.md +32 -4
  61. package/docs/cli/secret.md +134 -18
  62. package/docs/cli/staticwebsite.md +60 -8
  63. package/docs/cli/tailordb.md +148 -20
  64. package/docs/cli/user.md +154 -22
  65. package/docs/cli/workflow.md +100 -12
  66. package/docs/cli/workspace.md +274 -38
  67. package/docs/generator/custom.md +2 -2
  68. package/docs/plugin/custom.md +270 -163
  69. package/docs/plugin/index.md +48 -2
  70. package/package.json +22 -2
  71. package/dist/application-D5ZEr4zk.mjs +0 -4
  72. package/dist/job-CULA2Pvf.mjs.map +0 -1
  73. package/dist/schema-R5TxC5Pn.mjs.map +0 -1
  74. package/dist/types-BeNtD-fA.d.mts +0 -369
  75. package/dist/update-DQKCUNmr.mjs.map +0 -1
  76. /package/dist/{chunk-GMkBE123.mjs → chunk-CqAI0b6X.mjs} +0 -0
@@ -0,0 +1,28 @@
1
+ //#region src/utils/brand.ts
2
+ const SDK_BRAND = Symbol.for("tailor-platform/sdk");
3
+ /**
4
+ * Adds a non-enumerable SDK brand symbol to the given object (in-place).
5
+ * @param value - The object to brand
6
+ * @returns The same object with the brand applied
7
+ */
8
+ function brandValue(value) {
9
+ Object.defineProperty(value, SDK_BRAND, {
10
+ value: true,
11
+ enumerable: false,
12
+ configurable: false,
13
+ writable: false
14
+ });
15
+ return value;
16
+ }
17
+ /**
18
+ * Checks whether the given value has been branded by the SDK.
19
+ * @param value - The value to check
20
+ * @returns True if the value has the SDK brand symbol
21
+ */
22
+ function isSdkBranded(value) {
23
+ return value !== null && typeof value === "object" && SDK_BRAND in value;
24
+ }
25
+
26
+ //#endregion
27
+ export { isSdkBranded as n, brandValue as t };
28
+ //# sourceMappingURL=brand-BZJCv6UY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-BZJCv6UY.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\n/**\n * Adds a non-enumerable SDK brand symbol to the given object (in-place).\n * @param value - The object to brand\n * @returns The same object with the brand applied\n */\nexport function brandValue<T extends object>(value: T): T {\n Object.defineProperty(value, SDK_BRAND, {\n value: true,\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 * @param value - The value to check\n * @returns True if the value has the SDK brand symbol\n */\nexport function isSdkBranded(value: unknown): boolean {\n return value !== null && typeof value === \"object\" && SDK_BRAND in value;\n}\n"],"mappings":";AAEA,MAAa,YAA2B,OAAO,IAAI,sBAAsB;;;;;;AAOzE,SAAgB,WAA6B,OAAa;AACxD,QAAO,eAAe,OAAO,WAAW;EACtC,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;EACX,CAAC;AACF,QAAO;;;;;;;AAQT,SAAgB,aAAa,OAAyB;AACpD,QAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,aAAa"}
@@ -1,8 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import "../chunk-GMkBE123.mjs";
3
- import "../schema-R5TxC5Pn.mjs";
4
- import { $ as jobsCommand, A as generateCommand, Bt as getNamespacesWithMigrations, C as resumeCommand, F as removeCommand$1, Ft as loadDiff, G as generateCommand$1, Gt as commonArgs, H as listCommand$6, I as listCommand$7, J as triggerCommand, Jt as jsonArgs, Kt as confirmationArgs, Mt as getMigrationFiles, N as showCommand, O as truncateCommand, Ot as formatMigrationNumber, Pt as isValidMigrationNumber, R as getCommand$2, S as healthCommand, T as listCommand$8, V as tokenCommand, Vt as trnPrefix, Wt as apiCommand, X as listCommand$5, Xt as workspaceArgs, Yt as withCommonArgs, _ as createCommand$3, a as listCommand$10, b as listCommand$9, d as listCommand$11, dt as getCommand$1, h as deleteCommand$3, it as getCommand$3, j as logBetaWarning, jt as getMigrationFilePath, l as restoreCommand, lt as functionExecutionStatusToString, mt as applyCommand, nt as startCommand, ot as executionsCommand, p as getCommand$4, q as webhookCommand, qt as deploymentArgs, r as removeCommand, s as inviteCommand, t as updateCommand$2, ut as formatKeyValueTable, vt as parseMigrationLabelNumber } from "../update-DQKCUNmr.mjs";
5
- import { E as readPackageJson, S as initOperatorClient, Z as PATScope, _ as writePlatformConfig, b as fetchUserInfo, ct as styles, d as fetchLatestToken, f as loadAccessToken, g as readPlatformConfig, h as loadWorkspaceId, i as loadConfig, st as logger, v as fetchAll, x as initOAuth2Client, z as FunctionExecution_Type } from "../application-DYfVZVPT.mjs";
2
+ import "../chunk-CqAI0b6X.mjs";
3
+ import "../schema-WDvc7Zel.mjs";
4
+ import "../brand-BZJCv6UY.mjs";
5
+ import { $ as jobsCommand, A as generateCommand, Bt as getNamespacesWithMigrations, C as resumeCommand, F as removeCommand$1, Ft as loadDiff, G as generateCommand$1, Gt as commonArgs, H as listCommand$6, I as listCommand$7, J as triggerCommand, Jt as jsonArgs, Kt as confirmationArgs, Mt as getMigrationFiles, N as showCommand, O as truncateCommand, Ot as formatMigrationNumber, Pt as isValidMigrationNumber, R as getCommand$2, S as healthCommand, T as listCommand$8, V as tokenCommand, Vt as trnPrefix, Wt as apiCommand, X as listCommand$5, Xt as workspaceArgs, Yt as withCommonArgs, _ as createCommand$3, a as listCommand$10, b as listCommand$9, d as listCommand$11, dt as getCommand$1, h as deleteCommand$3, it as getCommand$3, j as logBetaWarning, jt as getMigrationFilePath, l as restoreCommand, lt as functionExecutionStatusToString, mt as applyCommand, nt as startCommand, ot as executionsCommand, p as getCommand$4, q as webhookCommand, qt as deploymentArgs, r as removeCommand, s as inviteCommand, t as updateCommand$2, ut as formatKeyValueTable, vt as parseMigrationLabelNumber } from "../update-BoNKMti-.mjs";
6
+ import { E as readPackageJson, S as initOperatorClient, Z as PATScope, _ as writePlatformConfig, b as fetchUserInfo, ct as styles, d as fetchLatestToken, f as loadAccessToken, g as readPlatformConfig, h as loadWorkspaceId, i as loadConfig, st as logger, v as fetchAll, x as initOAuth2Client, z as FunctionExecution_Type } from "../application-gWUyKuzv.mjs";
7
+ import "../file-utils-cqcpFk87.mjs";
8
+ import "../kysely-type-DtUUoAi3.mjs";
9
+ import "../seed-Dm7lrGZ3.mjs";
6
10
  import { createRequire, register } from "node:module";
7
11
  import { arg, defineCommand, runCommand, runMain } from "politty";
8
12
  import { withCompletionCommand } from "politty/completion";
@@ -144,10 +148,11 @@ const logsCommand = defineCommand({
144
148
  if (args.json) logger.out(detail);
145
149
  else printFunctionExecutionDetail(detail);
146
150
  } else {
147
- const logs = (await fetchAll(async (pageToken) => {
151
+ const logs = (await fetchAll(async (pageToken, maxPageSize) => {
148
152
  const { executions, nextPageToken } = await client.listFunctionExecutions({
149
153
  workspaceId,
150
- pageToken
154
+ pageToken,
155
+ pageSize: maxPageSize
151
156
  });
152
157
  return [executions, nextPageToken];
153
158
  })).map(toFunctionExecutionListInfo);
@@ -409,8 +414,11 @@ const createCommand$2 = defineCommand({
409
414
  const config = readPlatformConfig();
410
415
  if (config.profiles[args.name]) throw new Error(`Profile "${args.name}" already exists.`);
411
416
  const client = await initOperatorClient(await fetchLatestToken(config, args.user));
412
- if (!(await fetchAll(async (pageToken) => {
413
- const { workspaces, nextPageToken } = await client.listWorkspaces({ pageToken });
417
+ if (!(await fetchAll(async (pageToken, maxPageSize) => {
418
+ const { workspaces, nextPageToken } = await client.listWorkspaces({
419
+ pageToken,
420
+ pageSize: maxPageSize
421
+ });
414
422
  return [workspaces, nextPageToken];
415
423
  })).find((ws) => ws.id === args["workspace-id"])) throw new Error(`Workspace "${args["workspace-id"]}" not found.`);
416
424
  config.profiles[args.name] = {
@@ -508,8 +516,11 @@ const updateCommand$1 = defineCommand({
508
516
  const oldWorkspaceId = profile.workspace_id;
509
517
  const newWorkspaceId = args["workspace-id"] || oldWorkspaceId;
510
518
  const client = await initOperatorClient(await fetchLatestToken(config, newUser));
511
- if (!(await fetchAll(async (pageToken) => {
512
- const { workspaces, nextPageToken } = await client.listWorkspaces({ pageToken });
519
+ if (!(await fetchAll(async (pageToken, maxPageSize) => {
520
+ const { workspaces, nextPageToken } = await client.listWorkspaces({
521
+ pageToken,
522
+ pageSize: maxPageSize
523
+ });
513
524
  return [workspaces, nextPageToken];
514
525
  })).find((ws) => ws.id === newWorkspaceId)) throw new Error(`Workspace "${newWorkspaceId}" not found.`);
515
526
  profile.user = newUser;
@@ -671,11 +682,12 @@ async function secretList(options) {
671
682
  workspaceId: options.workspaceId,
672
683
  profile: options.profile
673
684
  });
674
- return (await fetchAll(async (pageToken) => {
685
+ return (await fetchAll(async (pageToken, maxPageSize) => {
675
686
  const { secrets, nextPageToken } = await client.listSecretManagerSecrets({
676
687
  workspaceId,
677
688
  secretmanagerVaultName: options.vaultName,
678
- pageToken
689
+ pageToken,
690
+ pageSize: maxPageSize
679
691
  });
680
692
  return [secrets, nextPageToken];
681
693
  })).map(secretInfo);
@@ -839,10 +851,11 @@ async function vaultList(options) {
839
851
  workspaceId: options?.workspaceId,
840
852
  profile: options?.profile
841
853
  });
842
- return (await fetchAll(async (pageToken) => {
854
+ return (await fetchAll(async (pageToken, maxPageSize) => {
843
855
  const { vaults, nextPageToken } = await client.listSecretManagerVaults({
844
856
  workspaceId,
845
- pageToken
857
+ pageToken,
858
+ pageSize: maxPageSize
846
859
  });
847
860
  return [vaults, nextPageToken];
848
861
  })).map(vaultInfo);
@@ -1157,10 +1170,11 @@ async function listStaticWebsites(options) {
1157
1170
  workspaceId: options?.workspaceId,
1158
1171
  profile: options?.profile
1159
1172
  });
1160
- return (await fetchAll(async (pageToken) => {
1173
+ return (await fetchAll(async (pageToken, maxPageSize) => {
1161
1174
  const { staticwebsites, nextPageToken } = await client.listStaticWebsites({
1162
1175
  workspaceId,
1163
- pageToken
1176
+ pageToken,
1177
+ pageSize: maxPageSize
1164
1178
  });
1165
1179
  return [staticwebsites, nextPageToken];
1166
1180
  })).map((site) => ({
@@ -1356,12 +1370,13 @@ function buildTblsSchema(types, namespace) {
1356
1370
  */
1357
1371
  async function exportTailorDBSchema(options) {
1358
1372
  const { client, workspaceId, namespace } = options;
1359
- const types = await fetchAll(async (pageToken) => {
1373
+ const types = await fetchAll(async (pageToken, maxPageSize) => {
1360
1374
  try {
1361
1375
  const { tailordbTypes, nextPageToken } = await client.listTailorDBTypes({
1362
1376
  workspaceId,
1363
1377
  namespaceName: namespace,
1364
- pageToken
1378
+ pageToken,
1379
+ pageSize: maxPageSize
1365
1380
  });
1366
1381
  return [tailordbTypes, nextPageToken];
1367
1382
  } catch (error) {
@@ -2098,8 +2113,11 @@ const listCommand = defineCommand({
2098
2113
  Please login first using 'tailor-sdk login' command.
2099
2114
  `);
2100
2115
  const client = await initOperatorClient(await fetchLatestToken(config, config.current_user));
2101
- const pats = await fetchAll(async (pageToken) => {
2102
- const { personalAccessTokens, nextPageToken } = await client.listPersonalAccessTokens({ pageToken });
2116
+ const pats = await fetchAll(async (pageToken, maxPageSize) => {
2117
+ const { personalAccessTokens, nextPageToken } = await client.listPersonalAccessTokens({
2118
+ pageToken,
2119
+ pageSize: maxPageSize
2120
+ });
2103
2121
  return [personalAccessTokens, nextPageToken];
2104
2122
  });
2105
2123
  if (pats.length === 0 && !args.json) {