@tailor-platform/sdk 1.17.1 → 1.19.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 (85) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/{application-BMDE8KqK.mjs → application-A6PZjujv.mjs} +192 -1673
  3. package/dist/application-A6PZjujv.mjs.map +1 -0
  4. package/dist/application-nPS5veK6.mjs +9 -0
  5. package/dist/brand-BZJCv6UY.mjs +28 -0
  6. package/dist/brand-BZJCv6UY.mjs.map +1 -0
  7. package/dist/cli/index.mjs +40 -20
  8. package/dist/cli/index.mjs.map +1 -1
  9. package/dist/cli/lib.d.mts +16 -33
  10. package/dist/cli/lib.mjs +12 -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-CGVvu3dd.mjs +115 -0
  16. package/dist/enum-constants-CGVvu3dd.mjs.map +1 -0
  17. package/dist/file-utils-GX_tGWl4.mjs +139 -0
  18. package/dist/file-utils-GX_tGWl4.mjs.map +1 -0
  19. package/dist/index-B6pvy1MK.d.mts +20 -0
  20. package/dist/index-B91ZpOcd.d.mts +18 -0
  21. package/dist/index-CPzbMghQ.d.mts +18 -0
  22. package/dist/{index-CVcYqZSf.d.mts → index-ClLZCbcm.d.mts} +18 -5
  23. package/dist/index-DDqKNFh4.d.mts +18 -0
  24. package/dist/interceptor-D8MeZOxX.mjs +33 -0
  25. package/dist/interceptor-D8MeZOxX.mjs.map +1 -0
  26. package/dist/{jiti-BrELlEYT.mjs → jiti-DfS9jItj.mjs} +2 -2
  27. package/dist/{jiti-BrELlEYT.mjs.map → jiti-DfS9jItj.mjs.map} +1 -1
  28. package/dist/{job-CULA2Pvf.mjs → job-2Q82qQ6N.mjs} +27 -5
  29. package/dist/job-2Q82qQ6N.mjs.map +1 -0
  30. package/dist/kysely-type-Cpq5TNGY.mjs +260 -0
  31. package/dist/kysely-type-Cpq5TNGY.mjs.map +1 -0
  32. package/dist/package-json-DUY2kB6z.mjs +17 -0
  33. package/dist/package-json-DUY2kB6z.mjs.map +1 -0
  34. package/dist/package-json-Dd1AnA5F.mjs +3 -0
  35. package/dist/plugin/builtin/enum-constants/index.d.mts +4 -0
  36. package/dist/plugin/builtin/enum-constants/index.mjs +3 -0
  37. package/dist/plugin/builtin/file-utils/index.d.mts +4 -0
  38. package/dist/plugin/builtin/file-utils/index.mjs +3 -0
  39. package/dist/plugin/builtin/kysely-type/index.d.mts +4 -0
  40. package/dist/plugin/builtin/kysely-type/index.mjs +3 -0
  41. package/dist/plugin/builtin/seed/index.d.mts +4 -0
  42. package/dist/plugin/builtin/seed/index.mjs +3 -0
  43. package/dist/plugin/index.d.mts +3 -3
  44. package/dist/plugin/index.mjs +11 -11
  45. package/dist/plugin/index.mjs.map +1 -1
  46. package/dist/{schema-R5TxC5Pn.mjs → schema-D5Cpd8fQ.mjs} +48 -5
  47. package/dist/schema-D5Cpd8fQ.mjs.map +1 -0
  48. package/dist/seed-CeUEANfQ.mjs +1050 -0
  49. package/dist/seed-CeUEANfQ.mjs.map +1 -0
  50. package/dist/{src-DMROgdcL.mjs → src-Bb1UVstT.mjs} +2 -2
  51. package/dist/{src-DMROgdcL.mjs.map → src-Bb1UVstT.mjs.map} +1 -1
  52. package/dist/telemetry-9A1BZqbl.mjs +3 -0
  53. package/dist/telemetry-rFq0QdvJ.mjs +84 -0
  54. package/dist/telemetry-rFq0QdvJ.mjs.map +1 -0
  55. package/dist/types-CJF3Y1x8.d.mts +158 -0
  56. package/dist/{types-CZZBCaxB.d.mts → types-CblXasFV.d.mts} +1405 -1045
  57. package/dist/{types-b-ig8nW_.mjs → types-ClK_HJ0G.mjs} +1 -1
  58. package/dist/{types-b-ig8nW_.mjs.map → types-ClK_HJ0G.mjs.map} +1 -1
  59. package/dist/{update-CUBVjZbL.mjs → update-Cr5c7h1r.mjs} +485 -244
  60. package/dist/update-Cr5c7h1r.mjs.map +1 -0
  61. package/dist/utils/test/index.d.mts +4 -4
  62. package/dist/utils/test/index.mjs +3 -2
  63. package/dist/utils/test/index.mjs.map +1 -1
  64. package/docs/cli/application.md +106 -14
  65. package/docs/cli/auth.md +92 -12
  66. package/docs/cli/completion.md +18 -2
  67. package/docs/cli/executor.md +122 -14
  68. package/docs/cli/function.md +32 -4
  69. package/docs/cli/secret.md +134 -18
  70. package/docs/cli/staticwebsite.md +60 -8
  71. package/docs/cli/tailordb.md +148 -20
  72. package/docs/cli/user.md +154 -22
  73. package/docs/cli/workflow.md +100 -12
  74. package/docs/cli/workspace.md +274 -38
  75. package/docs/generator/custom.md +2 -2
  76. package/docs/plugin/custom.md +270 -163
  77. package/docs/plugin/index.md +48 -2
  78. package/package.json +28 -2
  79. package/dist/application-BMDE8KqK.mjs.map +0 -1
  80. package/dist/application-Dni_W16P.mjs +0 -4
  81. package/dist/job-CULA2Pvf.mjs.map +0 -1
  82. package/dist/schema-R5TxC5Pn.mjs.map +0 -1
  83. package/dist/types-DthzUFfx.d.mts +0 -372
  84. package/dist/update-CUBVjZbL.mjs.map +0 -1
  85. /package/dist/{chunk-GMkBE123.mjs → chunk-CqAI0b6X.mjs} +0 -0
@@ -0,0 +1,9 @@
1
+ import "./chunk-CqAI0b6X.mjs";
2
+ import "./brand-BZJCv6UY.mjs";
3
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-A6PZjujv.mjs";
4
+ import "./package-json-DUY2kB6z.mjs";
5
+ import "./file-utils-GX_tGWl4.mjs";
6
+ import "./kysely-type-Cpq5TNGY.mjs";
7
+ import "./seed-CeUEANfQ.mjs";
8
+
9
+ export { defineApplication };
@@ -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,14 @@
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-CUBVjZbL.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-BMDE8KqK.mjs";
2
+ import "../chunk-CqAI0b6X.mjs";
3
+ import "../schema-D5Cpd8fQ.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-Cr5c7h1r.mjs";
6
+ import { R as FunctionExecution_Type, S as initOperatorClient, X as PATScope, _ as writePlatformConfig, b as fetchUserInfo, d as fetchLatestToken, f as loadAccessToken, g as readPlatformConfig, h as loadWorkspaceId, i as loadConfig, ot as logger, st as styles, v as fetchAll, x as initOAuth2Client } from "../application-A6PZjujv.mjs";
7
+ import { t as readPackageJson } from "../package-json-DUY2kB6z.mjs";
8
+ import "../file-utils-GX_tGWl4.mjs";
9
+ import "../kysely-type-Cpq5TNGY.mjs";
10
+ import "../seed-CeUEANfQ.mjs";
11
+ import "../telemetry-rFq0QdvJ.mjs";
6
12
  import { createRequire, register } from "node:module";
7
13
  import { arg, defineCommand, runCommand, runMain } from "politty";
8
14
  import { withCompletionCommand } from "politty/completion";
@@ -144,10 +150,11 @@ const logsCommand = defineCommand({
144
150
  if (args.json) logger.out(detail);
145
151
  else printFunctionExecutionDetail(detail);
146
152
  } else {
147
- const logs = (await fetchAll(async (pageToken) => {
153
+ const logs = (await fetchAll(async (pageToken, maxPageSize) => {
148
154
  const { executions, nextPageToken } = await client.listFunctionExecutions({
149
155
  workspaceId,
150
- pageToken
156
+ pageToken,
157
+ pageSize: maxPageSize
151
158
  });
152
159
  return [executions, nextPageToken];
153
160
  })).map(toFunctionExecutionListInfo);
@@ -409,8 +416,11 @@ const createCommand$2 = defineCommand({
409
416
  const config = readPlatformConfig();
410
417
  if (config.profiles[args.name]) throw new Error(`Profile "${args.name}" already exists.`);
411
418
  const client = await initOperatorClient(await fetchLatestToken(config, args.user));
412
- if (!(await fetchAll(async (pageToken) => {
413
- const { workspaces, nextPageToken } = await client.listWorkspaces({ pageToken });
419
+ if (!(await fetchAll(async (pageToken, maxPageSize) => {
420
+ const { workspaces, nextPageToken } = await client.listWorkspaces({
421
+ pageToken,
422
+ pageSize: maxPageSize
423
+ });
414
424
  return [workspaces, nextPageToken];
415
425
  })).find((ws) => ws.id === args["workspace-id"])) throw new Error(`Workspace "${args["workspace-id"]}" not found.`);
416
426
  config.profiles[args.name] = {
@@ -508,8 +518,11 @@ const updateCommand$1 = defineCommand({
508
518
  const oldWorkspaceId = profile.workspace_id;
509
519
  const newWorkspaceId = args["workspace-id"] || oldWorkspaceId;
510
520
  const client = await initOperatorClient(await fetchLatestToken(config, newUser));
511
- if (!(await fetchAll(async (pageToken) => {
512
- const { workspaces, nextPageToken } = await client.listWorkspaces({ pageToken });
521
+ if (!(await fetchAll(async (pageToken, maxPageSize) => {
522
+ const { workspaces, nextPageToken } = await client.listWorkspaces({
523
+ pageToken,
524
+ pageSize: maxPageSize
525
+ });
513
526
  return [workspaces, nextPageToken];
514
527
  })).find((ws) => ws.id === newWorkspaceId)) throw new Error(`Workspace "${newWorkspaceId}" not found.`);
515
528
  profile.user = newUser;
@@ -671,11 +684,12 @@ async function secretList(options) {
671
684
  workspaceId: options.workspaceId,
672
685
  profile: options.profile
673
686
  });
674
- return (await fetchAll(async (pageToken) => {
687
+ return (await fetchAll(async (pageToken, maxPageSize) => {
675
688
  const { secrets, nextPageToken } = await client.listSecretManagerSecrets({
676
689
  workspaceId,
677
690
  secretmanagerVaultName: options.vaultName,
678
- pageToken
691
+ pageToken,
692
+ pageSize: maxPageSize
679
693
  });
680
694
  return [secrets, nextPageToken];
681
695
  })).map(secretInfo);
@@ -839,10 +853,11 @@ async function vaultList(options) {
839
853
  workspaceId: options?.workspaceId,
840
854
  profile: options?.profile
841
855
  });
842
- return (await fetchAll(async (pageToken) => {
856
+ return (await fetchAll(async (pageToken, maxPageSize) => {
843
857
  const { vaults, nextPageToken } = await client.listSecretManagerVaults({
844
858
  workspaceId,
845
- pageToken
859
+ pageToken,
860
+ pageSize: maxPageSize
846
861
  });
847
862
  return [vaults, nextPageToken];
848
863
  })).map(vaultInfo);
@@ -1157,10 +1172,11 @@ async function listStaticWebsites(options) {
1157
1172
  workspaceId: options?.workspaceId,
1158
1173
  profile: options?.profile
1159
1174
  });
1160
- return (await fetchAll(async (pageToken) => {
1175
+ return (await fetchAll(async (pageToken, maxPageSize) => {
1161
1176
  const { staticwebsites, nextPageToken } = await client.listStaticWebsites({
1162
1177
  workspaceId,
1163
- pageToken
1178
+ pageToken,
1179
+ pageSize: maxPageSize
1164
1180
  });
1165
1181
  return [staticwebsites, nextPageToken];
1166
1182
  })).map((site) => ({
@@ -1356,12 +1372,13 @@ function buildTblsSchema(types, namespace) {
1356
1372
  */
1357
1373
  async function exportTailorDBSchema(options) {
1358
1374
  const { client, workspaceId, namespace } = options;
1359
- const types = await fetchAll(async (pageToken) => {
1375
+ const types = await fetchAll(async (pageToken, maxPageSize) => {
1360
1376
  try {
1361
1377
  const { tailordbTypes, nextPageToken } = await client.listTailorDBTypes({
1362
1378
  workspaceId,
1363
1379
  namespaceName: namespace,
1364
- pageToken
1380
+ pageToken,
1381
+ pageSize: maxPageSize
1365
1382
  });
1366
1383
  return [tailordbTypes, nextPageToken];
1367
1384
  } catch (error) {
@@ -2098,8 +2115,11 @@ const listCommand = defineCommand({
2098
2115
  Please login first using 'tailor-sdk login' command.
2099
2116
  `);
2100
2117
  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 });
2118
+ const pats = await fetchAll(async (pageToken, maxPageSize) => {
2119
+ const { personalAccessTokens, nextPageToken } = await client.listPersonalAccessTokens({
2120
+ pageToken,
2121
+ pageSize: maxPageSize
2122
+ });
2103
2123
  return [personalAccessTokens, nextPageToken];
2104
2124
  });
2105
2125
  if (pats.length === 0 && !args.json) {