@tailor-platform/sdk 1.74.0 → 1.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{application-DwmoI6ZQ.mjs → application-BsH6tkZC.mjs} +43 -5
  3. package/dist/application-BsH6tkZC.mjs.map +1 -0
  4. package/dist/application-CSUhZMb5.mjs +3 -0
  5. package/dist/cli/commands/tailordb/migrate/snapshot.d.mts +1 -16
  6. package/dist/cli/index.mjs +22 -33
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +2 -2
  9. package/dist/cli/lib.mjs +3 -3
  10. package/dist/cli/lib.mjs.map +1 -1
  11. package/dist/completion/zsh-worker.zsh +1 -1
  12. package/dist/configure/index.mjs +2 -2
  13. package/dist/configure/services/tailordb/schema.d.mts +5 -19
  14. package/dist/configure/types/field-runtime.d.mts +17 -0
  15. package/dist/configure/types/type.d.mts +1 -18
  16. package/dist/field-runtime-9bfXBAOK.mjs +183 -0
  17. package/dist/field-runtime-9bfXBAOK.mjs.map +1 -0
  18. package/dist/plugin/builtin/seed/index.mjs +1 -1
  19. package/dist/{runtime-Zkg3SUwi.mjs → runtime-DV1EnfMs.mjs} +229 -394
  20. package/dist/runtime-DV1EnfMs.mjs.map +1 -0
  21. package/dist/{schema-DAdZSFOd.mjs → schema-Dl_y0m9e.mjs} +8 -167
  22. package/dist/schema-Dl_y0m9e.mjs.map +1 -0
  23. package/dist/secretmanager-Bd45j7an.mjs +98 -0
  24. package/dist/secretmanager-Bd45j7an.mjs.map +1 -0
  25. package/dist/{seed-DoMTMLcm.mjs → seed-fm0LeYP2.mjs} +14 -3
  26. package/dist/seed-fm0LeYP2.mjs.map +1 -0
  27. package/dist/types-BwzB2okW.mjs +199 -0
  28. package/dist/types-BwzB2okW.mjs.map +1 -0
  29. package/dist/types-KlawuVKa.mjs +4 -0
  30. package/dist/vitest/index.d.mts +8 -1
  31. package/dist/vitest/index.mjs +776 -1
  32. package/dist/vitest/index.mjs.map +1 -1
  33. package/dist/vitest/mock.d.mts +8 -363
  34. package/dist/vitest/mocks/aigateway.d.mts +30 -0
  35. package/dist/vitest/mocks/authconnection.d.mts +28 -0
  36. package/dist/vitest/mocks/file.d.mts +41 -0
  37. package/dist/vitest/mocks/iconv.d.mts +27 -0
  38. package/dist/vitest/mocks/idp.d.mts +44 -0
  39. package/dist/vitest/mocks/secretmanager.d.mts +33 -0
  40. package/dist/vitest/mocks/tailordb.d.mts +71 -0
  41. package/dist/vitest/mocks/workflow.d.mts +115 -0
  42. package/dist/vitest/setup.mjs +1 -1
  43. package/package.json +8 -8
  44. package/dist/application-BndtMTFY.mjs +0 -3
  45. package/dist/application-DwmoI6ZQ.mjs.map +0 -1
  46. package/dist/field-DOsJCPFa.mjs +0 -22
  47. package/dist/field-DOsJCPFa.mjs.map +0 -1
  48. package/dist/mock-Ce1GCi4-.mjs +0 -871
  49. package/dist/mock-Ce1GCi4-.mjs.map +0 -1
  50. package/dist/runtime-Zkg3SUwi.mjs.map +0 -1
  51. package/dist/schema-DAdZSFOd.mjs.map +0 -1
  52. package/dist/seed-DoMTMLcm.mjs.map +0 -1
  53. package/dist/types-qhFZ8y9B.mjs +0 -4
  54. package/dist/types-ywCGpzDZ.mjs +0 -360
  55. package/dist/types-ywCGpzDZ.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.74.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1669](https://github.com/tailor-platform/sdk/pull/1669) [`6313353`](https://github.com/tailor-platform/sdk/commit/6313353a81642a8d52d4559dc37044c9365ca241) Thanks [@dqn](https://github.com/dqn)! - Preserve special characters when exporting TailorDB ERD viewer HTML and generated seed scripts.
8
+
9
+ - [#1670](https://github.com/tailor-platform/sdk/pull/1670) [`8c18c3b`](https://github.com/tailor-platform/sdk/commit/8c18c3bc1ee3a37e3258def1d15b9cc05b33aec4) Thanks [@dqn](https://github.com/dqn)! - Keep resolver and TailorDB field parsing behavior aligned.
10
+
11
+ - [#1682](https://github.com/tailor-platform/sdk/pull/1682) [`1e9ef08`](https://github.com/tailor-platform/sdk/commit/1e9ef0874f4ccea99874baf160d70d9ad8ad9688) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix a type error introduced in a previous release where an array field's `.index()`/`.unique()`/`.clone()`/`pickFields()` typing could become incompatible with itself when a field's shape flowed through an unresolved generic (e.g. a module-authoring helper's `ReturnType<typeof genericFn>` with no explicit type arguments). This could surface as a spurious `TS2322`/`TS2345` type error when wiring a `db.type()` result produced by one generic helper into another.
12
+
13
+ - [#1668](https://github.com/tailor-platform/sdk/pull/1668) [`abcdca5`](https://github.com/tailor-platform/sdk/commit/abcdca5808e487547030ac6163bf4429d976bb54) Thanks [@dqn](https://github.com/dqn)! - Remove the obsolete `MigrationInfo` type export from `@tailor-platform/sdk/cli`.
14
+
15
+ - [#1661](https://github.com/tailor-platform/sdk/pull/1661) [`3ccbae3`](https://github.com/tailor-platform/sdk/commit/3ccbae3f02cdaddbacd8849a8c097101e3c8a050) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency tsx to v4.22.5
16
+
17
+ - [#1666](https://github.com/tailor-platform/sdk/pull/1666) [`1d61fed`](https://github.com/tailor-platform/sdk/commit/1d61fed82e6433dd90f2137dbd2049bc3c74b706) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update @opentelemetry
18
+
19
+ - [#1667](https://github.com/tailor-platform/sdk/pull/1667) [`2110fd1`](https://github.com/tailor-platform/sdk/commit/2110fd1f4e27733934179f02af503efc175ee280) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency undici to v8.6.0
20
+
21
+ - [#1675](https://github.com/tailor-platform/sdk/pull/1675) [`15e721c`](https://github.com/tailor-platform/sdk/commit/15e721c610123395ccd0fa44c4bf8895d84b6584) Thanks [@dqn](https://github.com/dqn)! - Refactor Vitest mock helpers without changing their public APIs or behavior.
22
+
3
23
  ## 1.74.0
4
24
 
5
25
  ### Minor Changes
@@ -6,7 +6,7 @@ import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-
6
6
  import { t as multiline } from "./multiline-sfHpTZZK.mjs";
7
7
  import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-DcyIPFQh.mjs";
8
8
  import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-D-zflMGf.mjs";
9
- import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-DoMTMLcm.mjs";
9
+ import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-fm0LeYP2.mjs";
10
10
  import { t as readPackageJson } from "./package-json-8b0O9TlX.mjs";
11
11
  import { i as userAgent, n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-VSVGy1V0.mjs";
12
12
  import { t as createCLIError } from "./errors-Dtf2WPaW.mjs";
@@ -606,6 +606,44 @@ async function fetchAll(fn) {
606
606
  return items;
607
607
  }
608
608
  /**
609
+ * @internal
610
+ * @param error - Error value to inspect
611
+ * @returns Whether the error is a Connect NotFound error
612
+ */
613
+ function isNotFoundError(error) {
614
+ return error instanceof ConnectError && error.code === Code.NotFound;
615
+ }
616
+ /**
617
+ * Fetch all paginated resources, treating an absent resource group as empty.
618
+ * @template T
619
+ * @param fn - Page fetcher returning items and next page token
620
+ * @returns Items fetched before pagination completes or the fetcher raises NotFound
621
+ */
622
+ async function fetchAllTolerant(fn) {
623
+ return await fetchAll(async (pageToken, maxPageSize) => {
624
+ try {
625
+ return await fn(pageToken, maxPageSize);
626
+ } catch (error) {
627
+ if (isNotFoundError(error)) return [[], ""];
628
+ throw error;
629
+ }
630
+ });
631
+ }
632
+ /**
633
+ * Fetch a single resource, treating NotFound as an absent value.
634
+ * @template T
635
+ * @param fn - Resource getter
636
+ * @returns Fetched resource, or undefined when the getter raises NotFound
637
+ */
638
+ async function getOrNull(fn) {
639
+ try {
640
+ return await fn();
641
+ } catch (error) {
642
+ if (isNotFoundError(error)) return;
643
+ throw error;
644
+ }
645
+ }
646
+ /**
609
647
  * Fetch paginated resources with an optional upper bound on the number of
610
648
  * items returned. When `limit` is 0 or undefined the function behaves
611
649
  * like `fetchAll` and returns every page. When `limit` is positive the
@@ -676,7 +714,7 @@ async function resolveStaticWebsiteUrls(client, workspaceId, urls, context, opti
676
714
  logger.warn(`Static website "${siteName}" has no URL assigned yet. Excluding from ${context}.`);
677
715
  return [];
678
716
  } catch (error) {
679
- if (error instanceof ConnectError && error.code === Code.NotFound && expectedLocalNames?.has(siteName)) return [url];
717
+ if (isNotFoundError(error) && expectedLocalNames?.has(siteName)) return [url];
680
718
  logger.warn(`Static website "${siteName}" not found for ${context} configuration. Excluding from ${context}.`);
681
719
  return [];
682
720
  }
@@ -4360,7 +4398,7 @@ async function fetchExternalTailorDBTypeNameSources(args) {
4360
4398
  });
4361
4399
  return [tailordbTypes, nextPageToken ?? ""];
4362
4400
  } catch (error) {
4363
- if (error instanceof ConnectError && error.code === Code.NotFound) return [[], ""];
4401
+ if (isNotFoundError(error)) return [[], ""];
4364
4402
  throw error;
4365
4403
  }
4366
4404
  });
@@ -6532,5 +6570,5 @@ async function loadApplication(params) {
6532
6570
  }
6533
6571
 
6534
6572
  //#endregion
6535
- export { initOAuth2Client as $, hasUserTokenEntry as A, resolveUserTokenKey as B, getDistDir as C, deleteUserTokens as D, loadConfig as E, loadPlatformClientConfig as F, fetchAll as G, writePlatformConfig as H, loadStoredUserTokens as I, fetchPlatformMachineUserToken as J, fetchMachineUserToken as K, loadWorkspaceId as L, loadConfigPath as M, loadConsoleBaseUrl as N, fetchLatestToken as O, loadMachineUserName as P, getPlatformBaseUrl as Q, platformConfigFromProfile as R, createBundleCache as S, hashFile as T, closeConnectionPool as U, saveUserTokens as V, defaultPlatformBaseUrl as W, getConsoleBaseUrl as X, fetchUserInfo as Y, getOAuth2ClientId as Z, composeFunctionTreeshakeOptions as _, resolveInlineSourcemap as a, getPluginGenerationDependencies as b, HTTP_METHODS as c, buildResolverOperationHookExpr as d, initOperatorClient as et, assertUniqueLocalTailorDBTypeNames as f, platformBundleDefinePlugin as g, stringifyFunction as h, resolverBundleKey as i, loadAccessToken as j, hasAnyUserTokenEntry as k, INVOKER_EXPR as l, TailorDBTypeSchema as m, generatePluginFilesIfNeeded as n, resolveStaticWebsiteUrls as nt, WorkflowJobSchema as o, assertUniqueTailorDBTypeNamesWithExternal as p, fetchPaged as q, loadApplication as r, byName as rt, ResolverSchema as s, defineApplication as t, isDefaultPlatform as tt, buildExecutorArgsExpr as u, createLogLevelTreeshakeOptions as v, hashContent as w, hasGenerationHooks as x, resolveBundleLogLevel as y, readPlatformConfig as z };
6536
- //# sourceMappingURL=application-DwmoI6ZQ.mjs.map
6573
+ export { getOrNull as $, hasUserTokenEntry as A, resolveUserTokenKey as B, getDistDir as C, deleteUserTokens as D, loadConfig as E, loadPlatformClientConfig as F, fetchAll as G, writePlatformConfig as H, loadStoredUserTokens as I, fetchPaged as J, fetchAllTolerant as K, loadWorkspaceId as L, loadConfigPath as M, loadConsoleBaseUrl as N, fetchLatestToken as O, loadMachineUserName as P, getOAuth2ClientId as Q, platformConfigFromProfile as R, createBundleCache as S, hashFile as T, closeConnectionPool as U, saveUserTokens as V, defaultPlatformBaseUrl as W, fetchUserInfo as X, fetchPlatformMachineUserToken as Y, getConsoleBaseUrl as Z, composeFunctionTreeshakeOptions as _, resolveInlineSourcemap as a, byName as at, getPluginGenerationDependencies as b, HTTP_METHODS as c, buildResolverOperationHookExpr as d, getPlatformBaseUrl as et, assertUniqueLocalTailorDBTypeNames as f, platformBundleDefinePlugin as g, stringifyFunction as h, resolverBundleKey as i, resolveStaticWebsiteUrls as it, loadAccessToken as j, hasAnyUserTokenEntry as k, INVOKER_EXPR as l, TailorDBTypeSchema as m, generatePluginFilesIfNeeded as n, initOperatorClient as nt, WorkflowJobSchema as o, assertUniqueTailorDBTypeNamesWithExternal as p, fetchMachineUserToken as q, loadApplication as r, isDefaultPlatform as rt, ResolverSchema as s, defineApplication as t, initOAuth2Client as tt, buildExecutorArgsExpr as u, createLogLevelTreeshakeOptions as v, hashContent as w, hasGenerationHooks as x, resolveBundleLogLevel as y, readPlatformConfig as z };
6574
+ //# sourceMappingURL=application-BsH6tkZC.mjs.map