@tailor-platform/sdk 1.14.0 → 1.14.2

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 (44) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +19 -0
  3. package/dist/application-BznueWxG.mjs +4 -0
  4. package/dist/{application-DnWZVbDO.mjs → application-DhwHYQ3H.mjs} +95 -44
  5. package/dist/application-DhwHYQ3H.mjs.map +1 -0
  6. package/dist/cli/index.mjs +4 -4
  7. package/dist/cli/lib.d.mts +13 -49
  8. package/dist/cli/lib.mjs +4 -4
  9. package/dist/cli/skills.d.mts +2 -0
  10. package/dist/cli/skills.mjs +51 -0
  11. package/dist/cli/skills.mjs.map +1 -0
  12. package/dist/configure/index.d.mts +4 -4
  13. package/dist/configure/index.mjs +2 -2
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/index-YzESrtj0.d.mts +396 -0
  16. package/dist/{index-DMoFYBhB.d.mts → index-q3n7wQOs.d.mts} +13 -12
  17. package/dist/{jiti-DuCiUfMj.mjs → jiti-BrELlEYT.mjs} +2 -2
  18. package/dist/{jiti-DuCiUfMj.mjs.map → jiti-BrELlEYT.mjs.map} +1 -1
  19. package/dist/{job-zGAXCidt.mjs → job-XiwGyFJt.mjs} +1 -1
  20. package/dist/{job-zGAXCidt.mjs.map → job-XiwGyFJt.mjs.map} +1 -1
  21. package/dist/plugin/index.d.mts +16 -2
  22. package/dist/plugin/index.mjs +208 -1
  23. package/dist/plugin/index.mjs.map +1 -1
  24. package/dist/{schema-BmKdDzr1.mjs → schema-DRYB-nzA.mjs} +1 -1
  25. package/dist/{schema-BmKdDzr1.mjs.map → schema-DRYB-nzA.mjs.map} +1 -1
  26. package/dist/{src-QNTCsO6J.mjs → src-DMROgdcL.mjs} +2 -2
  27. package/dist/{src-QNTCsO6J.mjs.map → src-DMROgdcL.mjs.map} +1 -1
  28. package/dist/{index-Bw_huFr7.d.mts → types-DbvONSS-.d.mts} +576 -460
  29. package/dist/{types-r-ZratAg.mjs → types-b-ig8nW_.mjs} +1 -1
  30. package/dist/types-b-ig8nW_.mjs.map +1 -0
  31. package/dist/{update-BnKKm4aR.mjs → update-Dm8ERWHJ.mjs} +312 -151
  32. package/dist/update-Dm8ERWHJ.mjs.map +1 -0
  33. package/dist/utils/test/index.d.mts +3 -3
  34. package/dist/utils/test/index.mjs +1 -1
  35. package/docs/plugin/custom.md +105 -49
  36. package/docs/plugin/index.md +2 -2
  37. package/package.json +5 -3
  38. package/skills/tailor-sdk/SKILL.md +34 -0
  39. package/dist/application-DM4zTgXU.mjs +0 -4
  40. package/dist/application-DnWZVbDO.mjs.map +0 -1
  41. package/dist/env-4RO7szrH.d.mts +0 -66
  42. package/dist/types-r-ZratAg.mjs.map +0 -1
  43. package/dist/update-BnKKm4aR.mjs.map +0 -1
  44. /package/dist/{chunk-C3Kl5s5P.mjs → chunk-GMkBE123.mjs} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.14.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#603](https://github.com/tailor-platform/sdk/pull/603) [`b093524`](https://github.com/tailor-platform/sdk/commit/b093524b2535dea2937b63ee62b300a6f0654cf0) Thanks [@k1LoW](https://github.com/k1LoW)! - feat: support allowGoogleOauth field for IdP userAuthPolicy
8
+
9
+ - [#598](https://github.com/tailor-platform/sdk/pull/598) [`b32223a`](https://github.com/tailor-platform/sdk/commit/b32223ac5735959e39c934bee3b30562c7c2b990) Thanks [@toiroakr](https://github.com/toiroakr)! - Prevent e2e-ws- workspace accumulation by separating SDK e2e tests into a dedicated CI workflow
10
+
11
+ - [#596](https://github.com/tailor-platform/sdk/pull/596) [`aecbfb7`](https://github.com/tailor-platform/sdk/commit/aecbfb73c184a9e36dfecd12580729783425a10e) Thanks [@dqn](https://github.com/dqn)! - Add `tailor-sdk` agent skill support and the `tailor-sdk-skills` shortcut installer command.
12
+
13
+ - [#592](https://github.com/tailor-platform/sdk/pull/592) [`ca758ed`](https://github.com/tailor-platform/sdk/commit/ca758ed7870dbb32364840d4b0eca465808bee13) Thanks [@toiroakr](https://github.com/toiroakr)! - Add getGeneratedType helper function for plugin-generated types
14
+
15
+ - Add async `getGeneratedType(configPath, pluginId, sourceType, kind)` function to retrieve plugin-generated types
16
+ - Auto-resolve namespace and pluginConfig from tailor.config.ts
17
+ - Support both type-attached plugins (with sourceType) and namespace plugins (sourceType is null)
18
+ - Rename `process` to `processType` and `config` to `typeConfig` in plugin context
19
+ - Simplify `PluginNamespaceProcessContext` by removing `types` and `generatedTypes` parameters
20
+ - Results are cached per config path, plugin, namespace, and pluginConfig
21
+
22
+ - [#578](https://github.com/tailor-platform/sdk/pull/578) [`a2f28c8`](https://github.com/tailor-platform/sdk/commit/a2f28c8b1ec72859271d096ddf1b0299ed83d0ca) Thanks [@riku99](https://github.com/riku99)! - Replace z.unknown() with typed Zod schemas in TailorDB schema
23
+
24
+ ## 1.14.1
25
+
26
+ ### Patch Changes
27
+
28
+ - [#587](https://github.com/tailor-platform/sdk/pull/587) [`014d8db`](https://github.com/tailor-platform/sdk/commit/014d8db10d2fb8a19ffff4a5c2d3c76c4f24f72d) Thanks [@toiroakr](https://github.com/toiroakr)! - Use tailor.idp.Client for IDP user seeding and truncation in seed generator
29
+
3
30
  ## 1.14.0
4
31
 
5
32
  ### Minor Changes
package/README.md CHANGED
@@ -46,6 +46,25 @@ See [Available Templates](https://github.com/tailor-platform/sdk/tree/main/packa
46
46
 
47
47
  For more details, see the [Quickstart Guide](./docs/quickstart.md).
48
48
 
49
+ ## Agent Skill
50
+
51
+ Install the `tailor-sdk` skill with the open `skills` CLI:
52
+
53
+ ```bash
54
+ npx skills add https://github.com/tailor-platform/sdk/tree/main/packages/sdk/skills --skill tailor-sdk
55
+ ```
56
+
57
+ Use the SDK-provided shorthand command (internally uses `skills add`):
58
+
59
+ ```bash
60
+ npx tailor-sdk-skills
61
+
62
+ # Example: install to Codex in non-interactive mode
63
+ npx tailor-sdk-skills -a codex -y
64
+ ```
65
+
66
+ `npx tailor-sdk-skills` requires an environment where the `@tailor-platform/sdk` package binary is available.
67
+
49
68
  ## Learn More
50
69
 
51
70
  ### Configuration
@@ -0,0 +1,4 @@
1
+ import "./chunk-GMkBE123.mjs";
2
+ import { t as defineApplication } from "./application-DhwHYQ3H.mjs";
3
+
4
+ export { defineApplication };
@@ -1,5 +1,5 @@
1
- import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-C3Kl5s5P.mjs";
2
- import { t as isPluginGeneratedType } from "./types-r-ZratAg.mjs";
1
+ import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-GMkBE123.mjs";
2
+ import { t as isPluginGeneratedType } from "./types-b-ig8nW_.mjs";
3
3
  import Module, { createRequire } from "node:module";
4
4
  import { z } from "zod";
5
5
  import * as fs$15 from "node:fs";
@@ -360,8 +360,6 @@ function isSingleArrayConditionFormat(cond) {
360
360
  }
361
361
  /**
362
362
  * Normalize record-level permissions into a standard structure.
363
- * @template User
364
- * @template Type
365
363
  * @param permission - Tailor type permission
366
364
  * @returns Normalized record permissions
367
365
  */
@@ -86252,7 +86250,7 @@ var require_config_loader = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86252
86250
  * @returns {Promise<{createJiti: Function|undefined, version: string;}>} A promise that fulfills with an object containing the jiti module's createJiti function and version.
86253
86251
  */
86254
86252
  static async loadJiti() {
86255
- const { createJiti } = await import("./jiti-DuCiUfMj.mjs");
86253
+ const { createJiti } = await import("./jiti-BrELlEYT.mjs");
86256
86254
  return {
86257
86255
  createJiti,
86258
86256
  version: require_package$1().version
@@ -86594,7 +86592,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86594
86592
  */
86595
86593
  async function globMatch({ basePath, pattern }) {
86596
86594
  let found = false;
86597
- const { hfs } = await import("./src-QNTCsO6J.mjs");
86595
+ const { hfs } = await import("./src-DMROgdcL.mjs");
86598
86596
  const matcher = new Minimatch(normalizeToPosix(path$9.relative(basePath, pattern)), MINIMATCH_OPTIONS);
86599
86597
  const walkSettings = {
86600
86598
  directoryFilter(entry) {
@@ -86641,7 +86639,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86641
86639
  return new Minimatch(patternToUse, MINIMATCH_OPTIONS);
86642
86640
  });
86643
86641
  const unmatchedPatterns = new Set([...relativeToPatterns.keys()]);
86644
- const { hfs } = await import("./src-QNTCsO6J.mjs");
86642
+ const { hfs } = await import("./src-DMROgdcL.mjs");
86645
86643
  const walk = hfs.walk(basePath, {
86646
86644
  async directoryFilter(entry) {
86647
86645
  if (!matchers.some((matcher) => matcher.match(entry.path, true))) return false;
@@ -97603,7 +97601,7 @@ const DBFieldMetadataSchema = z.object({
97603
97601
  create: functionSchema.optional(),
97604
97602
  update: functionSchema.optional()
97605
97603
  }).optional(),
97606
- validate: z.array(z.unknown()).optional(),
97604
+ validate: z.array(z.union([functionSchema, z.tuple([functionSchema, z.string()])])).optional(),
97607
97605
  serial: z.object({
97608
97606
  start: z.number(),
97609
97607
  maxValue: z.number().optional(),
@@ -97636,6 +97634,80 @@ const TailorDBTypeSettingsSchema = z.object({
97636
97634
  bulkUpsert: z.boolean().optional(),
97637
97635
  gqlOperations: GqlOperationsSchema.optional()
97638
97636
  });
97637
+ const GqlPermissionOperandSchema = z.union([
97638
+ z.object({ user: z.string() }),
97639
+ z.string(),
97640
+ z.boolean(),
97641
+ z.array(z.string()),
97642
+ z.array(z.boolean())
97643
+ ]);
97644
+ const RecordPermissionOperandSchema = z.union([
97645
+ GqlPermissionOperandSchema,
97646
+ z.object({ record: z.string() }),
97647
+ z.object({ oldRecord: z.string() }),
97648
+ z.object({ newRecord: z.string() })
97649
+ ]);
97650
+ const PermissionOperatorSchema = z.enum([
97651
+ "=",
97652
+ "!=",
97653
+ "in",
97654
+ "not in"
97655
+ ]);
97656
+ const RecordPermissionConditionSchema = z.tuple([
97657
+ RecordPermissionOperandSchema,
97658
+ PermissionOperatorSchema,
97659
+ RecordPermissionOperandSchema
97660
+ ]).readonly();
97661
+ const GqlPermissionConditionSchema = z.tuple([
97662
+ GqlPermissionOperandSchema,
97663
+ PermissionOperatorSchema,
97664
+ GqlPermissionOperandSchema
97665
+ ]).readonly();
97666
+ const ActionPermissionSchema = z.union([
97667
+ z.object({
97668
+ conditions: z.union([RecordPermissionConditionSchema, z.array(RecordPermissionConditionSchema).readonly()]),
97669
+ description: z.string().optional(),
97670
+ permit: z.boolean().optional()
97671
+ }),
97672
+ z.tuple([
97673
+ RecordPermissionOperandSchema,
97674
+ PermissionOperatorSchema,
97675
+ RecordPermissionOperandSchema
97676
+ ]).readonly(),
97677
+ z.tuple([
97678
+ RecordPermissionOperandSchema,
97679
+ PermissionOperatorSchema,
97680
+ RecordPermissionOperandSchema,
97681
+ z.boolean()
97682
+ ]).readonly(),
97683
+ z.array(z.union([RecordPermissionConditionSchema, z.boolean()])).refine((arr) => {
97684
+ const boolIndex = arr.findIndex((item) => typeof item === "boolean");
97685
+ return boolIndex === -1 || boolIndex === arr.length - 1;
97686
+ }, { message: "Boolean permit flag must only appear at the end" }).readonly()
97687
+ ]);
97688
+ const GqlPermissionActionSchema = z.enum([
97689
+ "read",
97690
+ "create",
97691
+ "update",
97692
+ "delete",
97693
+ "aggregate",
97694
+ "bulkUpsert"
97695
+ ]);
97696
+ const GqlPermissionPolicySchema = z.object({
97697
+ conditions: z.array(GqlPermissionConditionSchema).readonly(),
97698
+ actions: z.union([z.literal("all"), z.array(GqlPermissionActionSchema).readonly()]),
97699
+ permit: z.boolean().optional(),
97700
+ description: z.string().optional()
97701
+ });
97702
+ const RawPermissionsSchema = z.object({
97703
+ record: z.object({
97704
+ create: z.array(ActionPermissionSchema).readonly(),
97705
+ read: z.array(ActionPermissionSchema).readonly(),
97706
+ update: z.array(ActionPermissionSchema).readonly(),
97707
+ delete: z.array(ActionPermissionSchema).readonly()
97708
+ }).optional(),
97709
+ gql: z.array(GqlPermissionPolicySchema).readonly().optional()
97710
+ });
97639
97711
  const TailorDBTypeSchema = z.object({
97640
97712
  name: z.string(),
97641
97713
  fields: z.record(z.string(), TailorDBFieldSchema),
@@ -97643,7 +97715,7 @@ const TailorDBTypeSchema = z.object({
97643
97715
  name: z.string(),
97644
97716
  description: z.string().optional(),
97645
97717
  settings: TailorDBTypeSettingsSchema.optional(),
97646
- permissions: z.unknown(),
97718
+ permissions: RawPermissionsSchema,
97647
97719
  files: z.record(z.string(), z.string()),
97648
97720
  indexes: z.record(z.string(), z.object({
97649
97721
  fields: z.array(z.string()),
@@ -97697,7 +97769,7 @@ function createTailorDBService(params) {
97697
97769
  for (const attachment of attachments) {
97698
97770
  const result = await pluginManager.processAttachment({
97699
97771
  type: currentType,
97700
- config: attachment.config,
97772
+ typeConfig: attachment.config,
97701
97773
  namespace,
97702
97774
  pluginId: attachment.pluginId
97703
97775
  });
@@ -97717,6 +97789,7 @@ function createTailorDBService(params) {
97717
97789
  currentType = extendedType;
97718
97790
  logger.log(` Extended: ${styles.success(currentType.name)} with ${styles.highlight(Object.keys(extendFields).length.toString())} fields by plugin ${styles.info(attachment.pluginId)}`);
97719
97791
  }
97792
+ const plugin = pluginManager.getPlugin(attachment.pluginId);
97720
97793
  for (const [kind, generatedType] of Object.entries(output.types ?? {})) {
97721
97794
  rawTypes[sourceFilePath][generatedType.name] = generatedType;
97722
97795
  typeSourceInfo[generatedType.name] = {
@@ -97726,7 +97799,8 @@ function createTailorDBService(params) {
97726
97799
  originalFilePath: sourceFilePath,
97727
97800
  originalExportName: typeSourceInfo[rawType.name]?.exportName || rawType.name,
97728
97801
  generatedTypeKind: kind,
97729
- pluginConfig: attachment.config
97802
+ pluginConfig: plugin?.pluginConfig,
97803
+ namespace
97730
97804
  };
97731
97805
  logger.log(` Generated: ${styles.success(generatedType.name)} by plugin ${styles.info(attachment.pluginId)}`);
97732
97806
  }
@@ -97782,35 +97856,7 @@ function createTailorDBService(params) {
97782
97856
  },
97783
97857
  processNamespacePlugins: async () => {
97784
97858
  if (!pluginManager) return;
97785
- const typeByName = /* @__PURE__ */ new Map();
97786
- for (const typeMap of Object.values(rawTypes)) for (const [typeName, typeValue] of Object.entries(typeMap)) if (!typeByName.has(typeName)) typeByName.set(typeName, typeValue);
97787
- const originalTypeBySourceKey = /* @__PURE__ */ new Map();
97788
- for (const [typeName, source] of Object.entries(typeSourceInfo)) if ("filePath" in source && source.filePath && source.exportName) {
97789
- const typeValue = typeByName.get(typeName);
97790
- if (!typeValue) continue;
97791
- const key = `${source.filePath}:${source.exportName}`;
97792
- originalTypeBySourceKey.set(key, typeValue);
97793
- }
97794
- const namespaceTypes = [];
97795
- const namespaceGeneratedTypes = [];
97796
- for (const [typeName, typeValue] of typeByName.entries()) {
97797
- const source = typeSourceInfo[typeName];
97798
- if (!source) continue;
97799
- if (isPluginGeneratedType(source)) {
97800
- if (!Boolean(source.originalFilePath && source.originalExportName)) continue;
97801
- const originalType = originalTypeBySourceKey.get(`${source.originalFilePath}:${source.originalExportName}`) ?? null;
97802
- if (!originalType) continue;
97803
- namespaceGeneratedTypes.push({
97804
- type: typeValue,
97805
- pluginId: source.pluginId,
97806
- generatedTypeKind: source.generatedTypeKind,
97807
- originalType
97808
- });
97809
- continue;
97810
- }
97811
- namespaceTypes.push(typeValue);
97812
- }
97813
- const results = await pluginManager.processNamespacePlugins(namespace, namespaceTypes, namespaceGeneratedTypes);
97859
+ const results = await pluginManager.processNamespacePlugins(namespace);
97814
97860
  const pluginGeneratedKey = "__plugin_generated__";
97815
97861
  if (!rawTypes[pluginGeneratedKey]) rawTypes[pluginGeneratedKey] = {};
97816
97862
  let hasGeneratedTypes = false;
@@ -97830,7 +97876,8 @@ function createTailorDBService(params) {
97830
97876
  originalFilePath: "",
97831
97877
  originalExportName: "",
97832
97878
  generatedTypeKind: kind,
97833
- pluginConfig: config$1
97879
+ pluginConfig: config$1,
97880
+ namespace
97834
97881
  };
97835
97882
  logger.log(` Generated: ${styles.success(generatedType.name)} by namespace plugin ${styles.info(pluginId)}`);
97836
97883
  }
@@ -98324,13 +98371,17 @@ const IdPUserAuthPolicySchema = z.object({
98324
98371
  passwordRequireNumeric: z.boolean().optional(),
98325
98372
  passwordMinLength: z.number().int().refine((val) => val >= 6 && val <= 30, { message: "passwordMinLength must be between 6 and 30" }).optional(),
98326
98373
  passwordMaxLength: z.number().int().refine((val) => val >= 6 && val <= 4096, { message: "passwordMaxLength must be between 6 and 4096" }).optional(),
98327
- allowedEmailDomains: z.array(z.string()).optional()
98374
+ allowedEmailDomains: z.array(z.string()).optional(),
98375
+ allowGoogleOauth: z.boolean().optional()
98328
98376
  }).refine((data$1) => data$1.passwordMinLength === void 0 || data$1.passwordMaxLength === void 0 || data$1.passwordMinLength <= data$1.passwordMaxLength, {
98329
98377
  message: "passwordMinLength must be less than or equal to passwordMaxLength",
98330
98378
  path: ["passwordMinLength"]
98331
98379
  }).refine((data$1) => !data$1.allowedEmailDomains || data$1.allowedEmailDomains.length === 0 || !data$1.useNonEmailIdentifier, {
98332
98380
  message: "allowedEmailDomains cannot be set when useNonEmailIdentifier is true",
98333
98381
  path: ["allowedEmailDomains"]
98382
+ }).refine((data$1) => data$1.allowGoogleOauth === void 0 || data$1.allowGoogleOauth === false || !data$1.useNonEmailIdentifier, {
98383
+ message: "allowGoogleOauth cannot be set when useNonEmailIdentifier is true",
98384
+ path: ["allowGoogleOauth"]
98334
98385
  });
98335
98386
  const IdPSchema = z.object({
98336
98387
  name: z.string(),
@@ -98524,5 +98575,5 @@ function defineApplication(params) {
98524
98575
  }
98525
98576
 
98526
98577
  //#endregion
98527
- export { ExecutorSchema as a, stringifyFunction as c, logger as d, styles as f, createExecutorService as i, tailorUserMap as l, WorkflowJobSchema as n, OAuth2ClientSchema as o, symbols as p, WorkflowSchema as r, ResolverSchema as s, defineApplication as t, loadFilesWithIgnores as u };
98528
- //# sourceMappingURL=application-DnWZVbDO.mjs.map
98578
+ export { ExecutorSchema as a, TailorFieldSchema as c, tailorUserMap as d, loadFilesWithIgnores as f, symbols as h, createExecutorService as i, functionSchema as l, styles as m, WorkflowJobSchema as n, OAuth2ClientSchema as o, logger as p, WorkflowSchema as r, ResolverSchema as s, defineApplication as t, stringifyFunction as u };
98579
+ //# sourceMappingURL=application-DhwHYQ3H.mjs.map