@tailor-platform/sdk 1.7.0 → 1.8.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 (41) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/{application-Ba2B5A-w.mjs → application-HIu5peO4.mjs} +44 -14
  3. package/dist/application-HIu5peO4.mjs.map +1 -0
  4. package/dist/application-ViV4dYwI.mjs +4 -0
  5. package/dist/cli/index.mjs +46 -47
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +8 -7
  8. package/dist/cli/lib.mjs +2 -3
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/configure/index.d.mts +3 -3
  11. package/dist/configure/index.mjs +778 -2
  12. package/dist/configure/index.mjs.map +1 -1
  13. package/dist/{index-BSrVjiPg.d.mts → index-BwJ7-efr.d.mts} +73 -29
  14. package/dist/{index-DraFftyF.d.mts → index-Dkm2qwmF.d.mts} +142 -180
  15. package/dist/{jiti-SMSW3TA0.mjs → jiti-ygK9KoRA.mjs} +1 -1
  16. package/dist/{jiti-SMSW3TA0.mjs.map → jiti-ygK9KoRA.mjs.map} +1 -1
  17. package/dist/{job-8XfvLyxH.mjs → job-l-pIR9IY.mjs} +1 -1
  18. package/dist/{job-8XfvLyxH.mjs.map → job-l-pIR9IY.mjs.map} +1 -1
  19. package/dist/{list-DArHhlnw.mjs → list-D1K7WwpV.mjs} +96 -48
  20. package/dist/list-D1K7WwpV.mjs.map +1 -0
  21. package/dist/{src-qLXX6nub.mjs → src-CG8kJBI9.mjs} +1 -1
  22. package/dist/{src-qLXX6nub.mjs.map → src-CG8kJBI9.mjs.map} +1 -1
  23. package/dist/utils/test/index.d.mts +2 -2
  24. package/dist/utils/test/index.mjs +1 -1
  25. package/docs/cli/application.md +114 -35
  26. package/docs/cli/auth.md +101 -44
  27. package/docs/cli/executor.md +65 -33
  28. package/docs/cli/secret.md +133 -51
  29. package/docs/cli/staticwebsite.md +78 -41
  30. package/docs/cli/tailordb.md +227 -155
  31. package/docs/cli/user.md +164 -66
  32. package/docs/cli/workflow.md +132 -73
  33. package/docs/cli/workspace.md +126 -45
  34. package/docs/generator/custom.md +2 -2
  35. package/docs/services/auth.md +88 -1
  36. package/package.json +3 -1
  37. package/dist/application-Ba2B5A-w.mjs.map +0 -1
  38. package/dist/application-C_MQabII.mjs +0 -5
  39. package/dist/auth-Co6vu1MY.mjs +0 -779
  40. package/dist/auth-Co6vu1MY.mjs.map +0 -1
  41. package/dist/list-DArHhlnw.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 1.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#515](https://github.com/tailor-platform/sdk/pull/515) [`fce8058`](https://github.com/tailor-platform/sdk/commit/fce80580d49d784feb232918341c5643da2d96dc) Thanks [@toiroakr](https://github.com/toiroakr)! - Add Kysely utility types (Transaction, Insertable, Selectable, Updateable) to generated code
8
+
9
+ - [#521](https://github.com/tailor-platform/sdk/pull/521) [`fa17d60`](https://github.com/tailor-platform/sdk/commit/fa17d601d8e3a13e593eb5f1da6cbf5c6802a034) Thanks [@toiroakr](https://github.com/toiroakr)! - Add `display` option to `logger.out` for field transformation and exclusion in non-JSON mode
10
+
11
+ ### Patch Changes
12
+
13
+ - [#519](https://github.com/tailor-platform/sdk/pull/519) [`3124bb2`](https://github.com/tailor-platform/sdk/commit/3124bb2bd755fe9fe9f781b6dadc28472d11969b) Thanks [@riku99](https://github.com/riku99)! - Normalized packages/sdk/src/cli/application/index.ts imports to use parser and enabled the ESLint/Oxlint rule blocking cli → configure imports (tests excluded).
14
+
15
+ - [#508](https://github.com/tailor-platform/sdk/pull/508) [`49d3fd5`](https://github.com/tailor-platform/sdk/commit/49d3fd5a255607145ce28c895dbdd2d94bea80b7) Thanks [@haru0017](https://github.com/haru0017)! - Transform webhook args `raw_body` to `rawBody` in executor bundler
16
+
17
+ - [#484](https://github.com/tailor-platform/sdk/pull/484) [`56ee4ff`](https://github.com/tailor-platform/sdk/commit/56ee4ff2dc23bd275ef9556c47363315e9d4e981) Thanks [@riku99](https://github.com/riku99)! - Updated imports of confgure tailordb and resolver in cli
18
+
3
19
  ## 1.7.0
4
20
 
5
21
  ### Minor Changes
@@ -187,14 +187,25 @@ const logger = {
187
187
  console.log(JSON.stringify(data$1));
188
188
  return;
189
189
  }
190
+ const display = options?.display;
190
191
  const formatValue = (value, pretty = false) => {
191
192
  if (value === null || value === void 0) return "N/A";
192
193
  if (value instanceof Date) return formatDistanceToNowStrict(value, { addSuffix: true });
193
194
  if (typeof value === "object") return pretty ? JSON.stringify(value, null, 2) : JSON.stringify(value);
194
195
  return String(value);
195
196
  };
197
+ const isExcluded = (key) => {
198
+ return display !== void 0 && key in display && display[key] === null;
199
+ };
200
+ const transformValue = (key, value, item, pretty = false) => {
201
+ if (display && key in display) {
202
+ const transformer = display[key];
203
+ if (transformer) return transformer(value, item);
204
+ }
205
+ return formatValue(value, pretty);
206
+ };
196
207
  if (!Array.isArray(data$1)) {
197
- const t$1 = table(Object.entries(data$1).filter(([key]) => !options?.excludeFields?.includes(key)).map(([key, value]) => [key, formatValue(value, true)]), {
208
+ const t$1 = table(Object.entries(data$1).filter(([key]) => !isExcluded(key)).map(([key, value]) => [key, transformValue(key, value, data$1, true)]), {
198
209
  singleLine: false,
199
210
  border: getBorderCharacters("norc")
200
211
  });
@@ -202,8 +213,8 @@ const logger = {
202
213
  return;
203
214
  }
204
215
  if (data$1.length === 0) return;
205
- const headers = Array.from(new Set(data$1.flatMap((item) => Object.keys(item)))).filter((h) => !options?.excludeFields?.includes(h));
206
- const t = table([headers, ...data$1.map((item) => headers.map((header) => formatValue(item[header])))], {
216
+ const headers = Array.from(new Set(data$1.flatMap((item) => Object.keys(item)))).filter((h) => !isExcluded(h));
217
+ const t = table([headers, ...data$1.map((item) => headers.map((header) => transformValue(header, item[header], item)))], {
207
218
  border: getBorderCharacters("norc"),
208
219
  drawHorizontalLine: (lineIndex, rowCount) => {
209
220
  return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
@@ -438,6 +449,7 @@ const relationTypes = {
438
449
  "N-1": "n-1",
439
450
  keyOnly: "keyOnly"
440
451
  };
452
+ const relationTypesKeys = Object.keys(relationTypes);
441
453
  function fieldRef(context) {
442
454
  return `Field "${context.fieldName}" on type "${context.typeName}"`;
443
455
  }
@@ -447,8 +459,8 @@ function fieldRef(context) {
447
459
  * @param context - Context information for the relation (type name, field name, all type names)
448
460
  */
449
461
  function validateRelationConfig(rawRelation, context) {
450
- if (!rawRelation.type) throw new Error(`${fieldRef(context)} has a relation but is missing the required 'type' property. Valid values: ${Object.keys(relationTypes).join(", ")}.`);
451
- if (!(rawRelation.type in relationTypes)) throw new Error(`${fieldRef(context)} has invalid relation type '${rawRelation.type}'. Valid values: ${Object.keys(relationTypes).join(", ")}.`);
462
+ if (!rawRelation.type) throw new Error(`${fieldRef(context)} has a relation but is missing the required 'type' property. Valid values: ${relationTypesKeys.join(", ")}.`);
463
+ if (!(rawRelation.type in relationTypes)) throw new Error(`${fieldRef(context)} has invalid relation type '${rawRelation.type}'. Valid values: ${relationTypesKeys.join(", ")}.`);
452
464
  if (rawRelation.toward.type !== "self" && !context.allTypeNames.has(rawRelation.toward.type)) throw new Error(`${fieldRef(context)} references unknown type "${rawRelation.toward.type}".`);
453
465
  }
454
466
  /**
@@ -86238,7 +86250,7 @@ var require_config_loader = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86238
86250
  * @returns {Promise<{createJiti: Function|undefined, version: string;}>} A promise that fulfills with an object containing the jiti module's createJiti function and version.
86239
86251
  */
86240
86252
  static async loadJiti() {
86241
- const { createJiti } = await import("./jiti-SMSW3TA0.mjs");
86253
+ const { createJiti } = await import("./jiti-ygK9KoRA.mjs");
86242
86254
  return {
86243
86255
  createJiti,
86244
86256
  version: require_package$1().version
@@ -86580,7 +86592,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86580
86592
  */
86581
86593
  async function globMatch({ basePath, pattern }) {
86582
86594
  let found = false;
86583
- const { hfs } = await import("./src-qLXX6nub.mjs");
86595
+ const { hfs } = await import("./src-CG8kJBI9.mjs");
86584
86596
  const matcher = new Minimatch(normalizeToPosix(path$9.relative(basePath, pattern)), MINIMATCH_OPTIONS);
86585
86597
  const walkSettings = {
86586
86598
  directoryFilter(entry) {
@@ -86627,7 +86639,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
86627
86639
  return new Minimatch(patternToUse, MINIMATCH_OPTIONS);
86628
86640
  });
86629
86641
  const unmatchedPatterns = new Set([...relativeToPatterns.keys()]);
86630
- const { hfs } = await import("./src-qLXX6nub.mjs");
86642
+ const { hfs } = await import("./src-CG8kJBI9.mjs");
86631
86643
  const walk = hfs.walk(basePath, {
86632
86644
  async directoryFilter(entry) {
86633
86645
  if (!matchers.some((matcher) => matcher.match(entry.path, true))) return false;
@@ -97351,7 +97363,7 @@ function parseTypes(rawTypes, namespace, typeSourceInfo) {
97351
97363
  return types$2;
97352
97364
  }
97353
97365
  /**
97354
- * Parse a TailorDBType into a ParsedTailorDBType.
97366
+ * Parse a TailorDBTypeSchemaOutput into a TailorDBType.
97355
97367
  * @param type - TailorDB type to parse
97356
97368
  * @param allTypeNames - Set of all TailorDB type names
97357
97369
  * @param rawTypes - All raw TailorDB types keyed by name
@@ -97549,6 +97561,9 @@ const DBFieldMetadataSchema = z.object({
97549
97561
  index: z.boolean().optional(),
97550
97562
  unique: z.boolean().optional(),
97551
97563
  vector: z.boolean().optional(),
97564
+ foreignKey: z.boolean().optional(),
97565
+ foreignKeyType: z.string().optional(),
97566
+ foreignKeyField: z.string().optional(),
97552
97567
  hooks: z.object({
97553
97568
  create: functionSchema.optional(),
97554
97569
  update: functionSchema.optional()
@@ -97560,10 +97575,21 @@ const DBFieldMetadataSchema = z.object({
97560
97575
  format: z.string().optional()
97561
97576
  }).optional()
97562
97577
  });
97578
+ const RelationTypeSchema = z.enum(relationTypesKeys);
97579
+ const RawRelationConfigSchema = z.object({
97580
+ type: RelationTypeSchema,
97581
+ toward: z.object({
97582
+ type: z.string(),
97583
+ as: z.string().optional(),
97584
+ key: z.string().optional()
97585
+ }),
97586
+ backward: z.string().optional()
97587
+ });
97563
97588
  const TailorDBFieldSchema = z.lazy(() => z.object({
97564
97589
  type: TailorFieldTypeSchema$1,
97565
97590
  fields: z.record(z.string(), TailorDBFieldSchema).optional(),
97566
- _metadata: DBFieldMetadataSchema
97591
+ metadata: DBFieldMetadataSchema,
97592
+ rawRelation: RawRelationConfigSchema.optional()
97567
97593
  }));
97568
97594
  const TailorDBTypeSchema = z.object({
97569
97595
  name: z.string(),
@@ -97571,7 +97597,11 @@ const TailorDBTypeSchema = z.object({
97571
97597
  metadata: z.object({
97572
97598
  name: z.string(),
97573
97599
  description: z.string().optional(),
97574
- settings: z.unknown().optional(),
97600
+ settings: z.object({
97601
+ pluralForm: z.string().optional(),
97602
+ aggregation: z.boolean().optional(),
97603
+ bulkUpsert: z.boolean().optional()
97604
+ }).optional(),
97575
97605
  permissions: z.unknown(),
97576
97606
  files: z.record(z.string(), z.string()),
97577
97607
  indexes: z.record(z.string(), z.object({
@@ -97609,8 +97639,8 @@ function createTailorDBService(namespace, config) {
97609
97639
  if (!result.success) continue;
97610
97640
  const relativePath = path$20.relative(process.cwd(), typeFile);
97611
97641
  logger.log(`Type: ${styles.successBright(`"${result.data.name}"`)} loaded from ${styles.path(relativePath)}`);
97612
- rawTypes[typeFile][result.data.name] = exportedValue;
97613
- loadedTypes[result.data.name] = exportedValue;
97642
+ rawTypes[typeFile][result.data.name] = result.data;
97643
+ loadedTypes[result.data.name] = result.data;
97614
97644
  typeSourceInfo[result.data.name] = {
97615
97645
  filePath: typeFile,
97616
97646
  exportName
@@ -98296,4 +98326,4 @@ function defineApplication(config) {
98296
98326
 
98297
98327
  //#endregion
98298
98328
  export { OAuth2ClientSchema as a, tailorUserMap as c, styles as d, symbols as f, ExecutorSchema as i, loadFilesWithIgnores as l, WorkflowJobSchema as n, ResolverSchema as o, WorkflowSchema as r, stringifyFunction as s, defineApplication as t, logger as u };
98299
- //# sourceMappingURL=application-Ba2B5A-w.mjs.map
98329
+ //# sourceMappingURL=application-HIu5peO4.mjs.map