@tailor-platform/sdk 1.46.0 → 1.47.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 (64) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/{actor-BmxQeMFP.d.mts → actor-DhXSqWTW.d.mts} +2 -2
  3. package/dist/application-CN9Htzup.mjs +4 -0
  4. package/dist/{application-B4zVVNRS.mjs → application-TasSqBTD.mjs} +22 -41
  5. package/dist/application-TasSqBTD.mjs.map +1 -0
  6. package/dist/cli/index.mjs +33 -15
  7. package/dist/cli/index.mjs.map +1 -1
  8. package/dist/cli/lib.d.mts +6 -6
  9. package/dist/cli/lib.mjs +3 -3
  10. package/dist/{client-BwXkoiMq.mjs → client-COfsXV69.mjs} +31 -120
  11. package/dist/client-COfsXV69.mjs.map +1 -0
  12. package/dist/{client-DTaArWQr.mjs → client-DYSkSLRr.mjs} +1 -1
  13. package/dist/configure/index.d.mts +4 -4
  14. package/dist/configure/index.mjs +4 -43
  15. package/dist/configure/index.mjs.map +1 -1
  16. package/dist/{crashreport-6mcMyWu4.mjs → crashreport-B8lVOx0U.mjs} +1 -1
  17. package/dist/{crashreport-DGeGj9BF.mjs → crashreport-CKJwnWsX.mjs} +2 -2
  18. package/dist/{crashreport-DGeGj9BF.mjs.map → crashreport-CKJwnWsX.mjs.map} +1 -1
  19. package/dist/{index-DV-5OIEv.d.mts → index-BRvNi5q9.d.mts} +2 -2
  20. package/dist/{index-BBvPd9Uv.d.mts → index-BXyS7xKC.d.mts} +2 -2
  21. package/dist/{index-Dxe6alSZ.d.mts → index-BbOTbZFf.d.mts} +2 -2
  22. package/dist/{index-PB0otrDj.d.mts → index-BoU_52Du.d.mts} +4 -4
  23. package/dist/{index-B5_4Tzm2.d.mts → index-iy-hNfGp.d.mts} +2 -2
  24. package/dist/{interceptor-CrcDfLPq.mjs → interceptor-CBsqEWDK.mjs} +1 -1
  25. package/dist/{interceptor-CrcDfLPq.mjs.map → interceptor-CBsqEWDK.mjs.map} +1 -1
  26. package/dist/mock-BP-9O5On.mjs +796 -0
  27. package/dist/mock-BP-9O5On.mjs.map +1 -0
  28. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  29. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  30. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  31. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  32. package/dist/plugin/index.d.mts +2 -2
  33. package/dist/{repl-editor-BlT2dFtm.mjs → repl-editor-CZpLlOBj.mjs} +1 -1
  34. package/dist/{repl-editor-BlT2dFtm.mjs.map → repl-editor-CZpLlOBj.mjs.map} +1 -1
  35. package/dist/{runtime-B67skpW-.mjs → runtime-DDYL2Zf1.mjs} +86 -8
  36. package/dist/runtime-DDYL2Zf1.mjs.map +1 -0
  37. package/dist/{service-CCgw66c6.mjs → service-obEU5gSM.mjs} +1 -1
  38. package/dist/{service-CCgw66c6.mjs.map → service-obEU5gSM.mjs.map} +1 -1
  39. package/dist/{tailor-db-field-Hx9OqPWY.d.mts → tailor-db-field-Bn8ZC5lK.d.mts} +1 -1
  40. package/dist/{schema-DBq6hr6h.mjs → tailordb-Bg9-TZj1.mjs} +42 -2
  41. package/dist/tailordb-Bg9-TZj1.mjs.map +1 -0
  42. package/dist/utils/test/index.d.mts +13 -4
  43. package/dist/utils/test/index.mjs +12 -3
  44. package/dist/utils/test/index.mjs.map +1 -1
  45. package/dist/vitest/environment.d.mts +12 -0
  46. package/dist/vitest/environment.mjs +44 -0
  47. package/dist/vitest/environment.mjs.map +1 -0
  48. package/dist/vitest/index.d.mts +345 -0
  49. package/dist/vitest/index.mjs +350 -0
  50. package/dist/vitest/index.mjs.map +1 -0
  51. package/dist/vitest/setup.d.mts +64 -0
  52. package/dist/vitest/setup.mjs +141 -0
  53. package/dist/vitest/setup.mjs.map +1 -0
  54. package/dist/{workflow.generated-DFljpJh7.d.mts → workflow.generated-i7PK4fg-.d.mts} +2 -2
  55. package/docs/cli/setup.md +1 -0
  56. package/docs/services/tailordb.md +43 -12
  57. package/docs/services/workflow.md +1 -1
  58. package/docs/testing.md +530 -243
  59. package/package.json +32 -6
  60. package/dist/application-B4zVVNRS.mjs.map +0 -1
  61. package/dist/application-Boa_11Nv.mjs +0 -4
  62. package/dist/client-BwXkoiMq.mjs.map +0 -1
  63. package/dist/runtime-B67skpW-.mjs.map +0 -1
  64. package/dist/schema-DBq6hr6h.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.47.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1115](https://github.com/tailor-platform/sdk/pull/1115) [`8dd619e`](https://github.com/tailor-platform/sdk/commit/8dd619e9c58f4662b117bbd968ecf9528d688fe4) Thanks [@toiroakr](https://github.com/toiroakr)! - Add `@tailor-platform/sdk/vitest` (beta) — a Vitest plugin and environment that emulates the Tailor Platform function runtime locally. Catches `node:*` imports and Node.js globals usage that would fail at deploy time, and provides mock control objects (`tailordbMock`, `workflowMock`, `secretmanagerMock`, `authconnectionMock`, `idpMock`, `fileMock`, `iconvMock`) for all platform APIs with response configuration and call recording.
8
+
9
+ Revamp `packages/sdk/docs/testing.md` into a 2-layer model (Unit Tests / E2E Tests). The previous structure split Unit, Bundled, and Workflow tests across overlapping sections and contained broken vitest imports and references to a non-existent `--template testing`. The new docs cover testing resolvers (simple, with TailorDB mocks, with DI, and with wait points) and workflow jobs (simple, with `triggerJobFunction` mocks, with wait-point mocks, and full-workflow integration), all anchored on the actual `resolver` and `workflow` templates.
10
+
11
+ Mark `createImportMain` and `setupInvokerMock` from `@tailor-platform/sdk/test` as `@deprecated`. `createImportMain` is an SDK-internal helper for verifying bundled output; applications should test their TypeScript source directly (unit) and verify deployed behavior via E2E. `setupInvokerMock` is superseded by the `tailor-runtime` Vitest environment, where bundled tests can drive the invoker via `vi.spyOn(globalThis.tailor.context, "getInvoker").mockReturnValue(...)` and unit tests can pass `invoker` directly to `.body()`. Both exports remain in place for now to avoid a breaking change and will be removed in a future release.
12
+
13
+ Remove the broken `tests/bundled.test.ts` from the `resolver` and `workflow` templates along with the related `bundled` vitest project and `test:bundled` / `test:bundled:prepare` scripts. These tests were not exercised by CI and had drifted out of sync with the SDK, producing failures on a fresh scaffold.
14
+
15
+ Fix a broken anchor in `docs/services/workflow.md` that pointed at the removed `#testing-wait-points` heading; it now links to `../testing.md#jobs-that-wait-on-approval` to match the new testing docs structure.
16
+
17
+ ### Patch Changes
18
+
19
+ - [#1155](https://github.com/tailor-platform/sdk/pull/1155) [`fd70f8c`](https://github.com/tailor-platform/sdk/commit/fd70f8c75aa9a315eaf23ee25f36f43324b2eb54) Thanks [@toiroakr](https://github.com/toiroakr)! - Fix false-positive remote schema drift on `decimal` fields without an explicit
20
+ `scale`. The platform stores decimal fields with a default scale of 6, but the
21
+ snapshot generated by `tailor-sdk tailordb migration generate --init` did not
22
+ record this default, so `tailor-sdk deploy` (formerly `apply`) reported drift as
23
+ `scale: remote=6, expected=undefined` and blocked the deploy.
24
+
25
+ Migration drift detection now treats an unset `scale` on a `decimal` field as
26
+ equivalent to the platform default (6). No regeneration of existing snapshots
27
+ is required; users no longer need `--no-schema-check` to work around this case.
28
+
29
+ - [#1164](https://github.com/tailor-platform/sdk/pull/1164) [`b1e8f5a`](https://github.com/tailor-platform/sdk/commit/b1e8f5a7e971527ff04cdb5867cacda2415e01bf) Thanks [@toiroakr](https://github.com/toiroakr)! - Eliminate the parser-layer exception that allowed `parser/service/tailordb/runtime.ts` to re-export runtime helpers from the configure module. Plugin attachment processing for a TailorDB type now lives in `PluginManager.processAttachmentsForType` and returns plain data (extended type, generated types, render events), so the cli layer applies state and renders progress without depending on `TailorAnyDBType`. Internal refactor with no public API change.
30
+
31
+ - [#1134](https://github.com/tailor-platform/sdk/pull/1134) [`02e12f6`](https://github.com/tailor-platform/sdk/commit/02e12f6b4a0a5986bc925defcac44717ae293c88) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update @opentelemetry
32
+
33
+ - [#1135](https://github.com/tailor-platform/sdk/pull/1135) [`8f53196`](https://github.com/tailor-platform/sdk/commit/8f53196bd66e4ecba702074399979d577e289a07) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @clack/prompts to v1.3.0
34
+
35
+ - [#1137](https://github.com/tailor-platform/sdk/pull/1137) [`aef3653`](https://github.com/tailor-platform/sdk/commit/aef365380900c65420237cb47f75ff56f31c939a) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency @napi-rs/keyring to v1.3.0
36
+
37
+ - [#1047](https://github.com/tailor-platform/sdk/pull/1047) [`aa6ec4a`](https://github.com/tailor-platform/sdk/commit/aa6ec4a562b771526ffb553aa03f7061ed483504) Thanks [@toiroakr](https://github.com/toiroakr)! - chore(setup github): bump bundled `tailor-platform/actions` ref to v1.1.0 and let Renovate keep it up to date going forward.
38
+
3
39
  ## 1.46.0
4
40
 
5
41
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  /// <reference types="@tailor-platform/function-types" />
2
- import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-Hx9OqPWY.mjs";
2
+ import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-Bn8ZC5lK.mjs";
3
3
 
4
4
  //#region src/types/env.d.ts
5
5
  interface Env {}
@@ -27,4 +27,4 @@ type TailorActor = {
27
27
  };
28
28
  //#endregion
29
29
  export { Env as n, TailorEnv as r, TailorActor as t };
30
- //# sourceMappingURL=actor-BmxQeMFP.d.mts.map
30
+ //# sourceMappingURL=actor-DhXSqWTW.d.mts.map
@@ -0,0 +1,4 @@
1
+
2
+ import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-TasSqBTD.mjs";
3
+
4
+ export { defineApplication };
@@ -1,5 +1,5 @@
1
1
 
2
- import { u as initOAuth2Client } from "./client-BwXkoiMq.mjs";
2
+ import { u as initOAuth2Client } from "./client-COfsXV69.mjs";
3
3
  import { n as isSdkBranded } from "./brand-Ll48SMXe.mjs";
4
4
  import { a as parseBoolean, n as logger, r as styles } from "./logger-DTNAMYGy.mjs";
5
5
  import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-C3KSpsYj.mjs";
@@ -3287,46 +3287,27 @@ function createTailorDBService(params) {
3287
3287
  */
3288
3288
  const processPluginsForType = async (rawType, attachments, sourceFilePath) => {
3289
3289
  if (!pluginManager) return;
3290
- let currentType = rawType;
3291
- for (const attachment of attachments) {
3292
- const result = await pluginManager.processAttachment({
3293
- type: currentType,
3294
- typeConfig: attachment.config,
3295
- namespace,
3296
- pluginId: attachment.pluginId
3297
- });
3298
- if (!result.success) {
3299
- logger.error(result.error);
3300
- throw new Error(result.error);
3301
- }
3302
- const output = result.output;
3303
- const extendFields = output.extends?.fields;
3304
- if (extendFields && Object.keys(extendFields).length > 0) {
3305
- const extendedType = pluginManager.extendType({
3306
- originalType: currentType,
3307
- extendFields,
3308
- pluginId: attachment.pluginId
3309
- });
3310
- rawTypes[sourceFilePath][currentType.name] = extendedType;
3311
- currentType = extendedType;
3312
- logger.log(` Extended: ${styles.success(currentType.name)} with ${styles.highlight(Object.keys(extendFields).length.toString())} fields by plugin ${styles.info(attachment.pluginId)}`);
3313
- }
3314
- const plugin = pluginManager.getPlugin(attachment.pluginId);
3315
- for (const [kind, generatedType] of Object.entries(output.types ?? {})) {
3316
- rawTypes[sourceFilePath][generatedType.name] = generatedType;
3317
- typeSourceInfo[generatedType.name] = {
3318
- exportName: generatedType.name,
3319
- pluginId: attachment.pluginId,
3320
- pluginImportPath: pluginManager.getPluginImportPath(attachment.pluginId) ?? "",
3321
- originalFilePath: sourceFilePath,
3322
- originalExportName: typeSourceInfo[rawType.name]?.exportName || rawType.name,
3323
- generatedTypeKind: kind,
3324
- pluginConfig: plugin?.pluginConfig,
3325
- namespace
3326
- };
3327
- logger.log(` Generated: ${styles.success(generatedType.name)} by plugin ${styles.info(attachment.pluginId)}`);
3328
- }
3290
+ const { extendedType, generatedTypes, events } = await pluginManager.processAttachmentsForType({
3291
+ rawType,
3292
+ attachments,
3293
+ namespace
3294
+ });
3295
+ if (extendedType) rawTypes[sourceFilePath][rawType.name] = extendedType;
3296
+ for (const gen of generatedTypes) {
3297
+ rawTypes[sourceFilePath][gen.typeName] = gen.type;
3298
+ typeSourceInfo[gen.typeName] = {
3299
+ exportName: gen.typeName,
3300
+ pluginId: gen.pluginId,
3301
+ pluginImportPath: gen.pluginImportPath,
3302
+ originalFilePath: sourceFilePath,
3303
+ originalExportName: typeSourceInfo[rawType.name]?.exportName || rawType.name,
3304
+ generatedTypeKind: gen.kind,
3305
+ pluginConfig: gen.pluginConfig,
3306
+ namespace
3307
+ };
3329
3308
  }
3309
+ for (const ev of events) if (ev.kind === "extended") logger.log(` Extended: ${styles.success(ev.typeName)} with ${styles.highlight(ev.fieldCount.toString())} fields by plugin ${styles.info(ev.pluginId)}`);
3310
+ else logger.log(` Generated: ${styles.success(ev.typeName)} by plugin ${styles.info(ev.pluginId)}`);
3330
3311
  };
3331
3312
  const loadTypeFile = async (typeFile, tsconfig) => {
3332
3313
  rawTypes[typeFile] = {};
@@ -5318,4 +5299,4 @@ async function loadApplication(params) {
5318
5299
 
5319
5300
  //#endregion
5320
5301
  export { loadWorkspaceId as C, writePlatformConfig as D, saveUserTokens as E, loadAccessToken as S, resolveTokens as T, getDistDir as _, WorkflowJobSchema as a, deleteUserTokens as b, ExecutorSchema as c, buildResolverOperationHookExpr as d, OAuth2ClientSchema as f, createBundleCache as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, INVOKER_EXPR as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, createExecutorService as s, defineApplication as t, buildExecutorArgsExpr as u, hashFile as v, readPlatformConfig as w, fetchLatestToken as x, loadConfig as y };
5321
- //# sourceMappingURL=application-B4zVVNRS.mjs.map
5302
+ //# sourceMappingURL=application-TasSqBTD.mjs.map