@tailor-platform/sdk 1.7.0 → 1.9.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.
- package/CHANGELOG.md +27 -0
- package/dist/application-BdZ8qL7I.mjs +4 -0
- package/dist/{application-Ba2B5A-w.mjs → application-_ArEfxmV.mjs} +94 -15
- package/dist/application-_ArEfxmV.mjs.map +1 -0
- package/dist/cli/index.mjs +46 -47
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +14 -7
- package/dist/cli/lib.mjs +2 -3
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/configure/index.d.mts +3 -3
- package/dist/configure/index.mjs +778 -2
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-BSrVjiPg.d.mts → index-Bd255ayy.d.mts} +81 -37
- package/dist/{index-DraFftyF.d.mts → index-DFEsnnHR.d.mts} +211 -181
- package/dist/{jiti-SMSW3TA0.mjs → jiti-ygK9KoRA.mjs} +1 -1
- package/dist/{jiti-SMSW3TA0.mjs.map → jiti-ygK9KoRA.mjs.map} +1 -1
- package/dist/{job-8XfvLyxH.mjs → job-l-pIR9IY.mjs} +1 -1
- package/dist/{job-8XfvLyxH.mjs.map → job-l-pIR9IY.mjs.map} +1 -1
- package/dist/{list-DArHhlnw.mjs → list-CYsYjREc.mjs} +178 -108
- package/dist/list-CYsYjREc.mjs.map +1 -0
- package/dist/{src-qLXX6nub.mjs → src-CG8kJBI9.mjs} +1 -1
- package/dist/{src-qLXX6nub.mjs.map → src-CG8kJBI9.mjs.map} +1 -1
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +1 -1
- package/docs/cli/application.md +114 -35
- package/docs/cli/auth.md +101 -44
- package/docs/cli/executor.md +65 -33
- package/docs/cli/secret.md +133 -51
- package/docs/cli/staticwebsite.md +78 -41
- package/docs/cli/tailordb.md +227 -155
- package/docs/cli/user.md +164 -66
- package/docs/cli/workflow.md +132 -73
- package/docs/cli/workspace.md +126 -45
- package/docs/generator/custom.md +2 -2
- package/docs/services/auth.md +88 -1
- package/package.json +3 -1
- package/dist/application-Ba2B5A-w.mjs.map +0 -1
- package/dist/application-C_MQabII.mjs +0 -5
- package/dist/auth-Co6vu1MY.mjs +0 -779
- package/dist/auth-Co6vu1MY.mjs.map +0 -1
- package/dist/list-DArHhlnw.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#516](https://github.com/tailor-platform/sdk/pull/516) [`425ead7`](https://github.com/tailor-platform/sdk/commit/425ead7f90c408605027537ee0e157b9d35651b6) Thanks [@jackchuka](https://github.com/jackchuka)! - Add support for configuring GraphQL operations on TailorDB types
|
|
8
|
+
|
|
9
|
+
- Add `gqlOperations` option to `.features()` for granular control (true = enabled, false = disabled)
|
|
10
|
+
- Add `"query"` alias for read-only mode: `gqlOperations: "query"` disables all mutations while keeping read enabled
|
|
11
|
+
- Add `gqlOperations` option to `TailorDBServiceConfig` for namespace-level defaults
|
|
12
|
+
- Regenerate proto definitions from latest `tailor-inc/proto`
|
|
13
|
+
|
|
14
|
+
## 1.8.0
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- [#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
|
|
19
|
+
|
|
20
|
+
- [#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
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [#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).
|
|
25
|
+
|
|
26
|
+
- [#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
|
|
27
|
+
|
|
28
|
+
- [#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
|
|
29
|
+
|
|
3
30
|
## 1.7.0
|
|
4
31
|
|
|
5
32
|
### 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]) => !
|
|
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) => !
|
|
206
|
-
const t = table([headers, ...data$1.map((item) => headers.map((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: ${
|
|
451
|
-
if (!(rawRelation.type in relationTypes)) throw new Error(`${fieldRef(context)} has invalid relation type '${rawRelation.type}'. Valid values: ${
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
@@ -97522,6 +97534,34 @@ function validatePluralFormUniqueness(types$2, namespace, typeSourceInfo) {
|
|
|
97522
97534
|
//#region src/parser/service/common.ts
|
|
97523
97535
|
const functionSchema = z.custom((val) => typeof val === "function");
|
|
97524
97536
|
|
|
97537
|
+
//#endregion
|
|
97538
|
+
//#region src/parser/service/tailordb/gql-operations.ts
|
|
97539
|
+
/**
|
|
97540
|
+
* Normalize GqlOperationsConfig (alias or object) to GqlOperations object.
|
|
97541
|
+
* "query" alias expands to read-only mode: { create: false, update: false, delete: false, read: true }
|
|
97542
|
+
* @param config - The GqlOperationsConfig to normalize
|
|
97543
|
+
* @returns The normalized GqlOperations object
|
|
97544
|
+
*/
|
|
97545
|
+
function normalizeGqlOperations(config) {
|
|
97546
|
+
if (config === "query") return {
|
|
97547
|
+
create: false,
|
|
97548
|
+
update: false,
|
|
97549
|
+
delete: false,
|
|
97550
|
+
read: true
|
|
97551
|
+
};
|
|
97552
|
+
return config;
|
|
97553
|
+
}
|
|
97554
|
+
/**
|
|
97555
|
+
* Zod schema for GqlOperations configuration with normalization transform.
|
|
97556
|
+
* Accepts "query" alias or detailed object, normalizes to GqlOperations object.
|
|
97557
|
+
*/
|
|
97558
|
+
const GqlOperationsSchema = z.union([z.literal("query"), z.object({
|
|
97559
|
+
create: z.boolean().optional(),
|
|
97560
|
+
update: z.boolean().optional(),
|
|
97561
|
+
delete: z.boolean().optional(),
|
|
97562
|
+
read: z.boolean().optional()
|
|
97563
|
+
})]).transform((val) => normalizeGqlOperations(val));
|
|
97564
|
+
|
|
97525
97565
|
//#endregion
|
|
97526
97566
|
//#region src/parser/service/tailordb/schema.ts
|
|
97527
97567
|
const TailorFieldTypeSchema$1 = z.enum([
|
|
@@ -97549,6 +97589,9 @@ const DBFieldMetadataSchema = z.object({
|
|
|
97549
97589
|
index: z.boolean().optional(),
|
|
97550
97590
|
unique: z.boolean().optional(),
|
|
97551
97591
|
vector: z.boolean().optional(),
|
|
97592
|
+
foreignKey: z.boolean().optional(),
|
|
97593
|
+
foreignKeyType: z.string().optional(),
|
|
97594
|
+
foreignKeyField: z.string().optional(),
|
|
97552
97595
|
hooks: z.object({
|
|
97553
97596
|
create: functionSchema.optional(),
|
|
97554
97597
|
update: functionSchema.optional()
|
|
@@ -97560,18 +97603,39 @@ const DBFieldMetadataSchema = z.object({
|
|
|
97560
97603
|
format: z.string().optional()
|
|
97561
97604
|
}).optional()
|
|
97562
97605
|
});
|
|
97606
|
+
const RelationTypeSchema = z.enum(relationTypesKeys);
|
|
97607
|
+
const RawRelationConfigSchema = z.object({
|
|
97608
|
+
type: RelationTypeSchema,
|
|
97609
|
+
toward: z.object({
|
|
97610
|
+
type: z.string(),
|
|
97611
|
+
as: z.string().optional(),
|
|
97612
|
+
key: z.string().optional()
|
|
97613
|
+
}),
|
|
97614
|
+
backward: z.string().optional()
|
|
97615
|
+
});
|
|
97563
97616
|
const TailorDBFieldSchema = z.lazy(() => z.object({
|
|
97564
97617
|
type: TailorFieldTypeSchema$1,
|
|
97565
97618
|
fields: z.record(z.string(), TailorDBFieldSchema).optional(),
|
|
97566
|
-
|
|
97619
|
+
metadata: DBFieldMetadataSchema,
|
|
97620
|
+
rawRelation: RawRelationConfigSchema.optional()
|
|
97567
97621
|
}));
|
|
97622
|
+
/**
|
|
97623
|
+
* Schema for TailorDB type settings.
|
|
97624
|
+
* Normalizes gqlOperations from alias ("query") to object format.
|
|
97625
|
+
*/
|
|
97626
|
+
const TailorDBTypeSettingsSchema = z.object({
|
|
97627
|
+
pluralForm: z.string().optional(),
|
|
97628
|
+
aggregation: z.boolean().optional(),
|
|
97629
|
+
bulkUpsert: z.boolean().optional(),
|
|
97630
|
+
gqlOperations: GqlOperationsSchema.optional()
|
|
97631
|
+
});
|
|
97568
97632
|
const TailorDBTypeSchema = z.object({
|
|
97569
97633
|
name: z.string(),
|
|
97570
97634
|
fields: z.record(z.string(), TailorDBFieldSchema),
|
|
97571
97635
|
metadata: z.object({
|
|
97572
97636
|
name: z.string(),
|
|
97573
97637
|
description: z.string().optional(),
|
|
97574
|
-
settings:
|
|
97638
|
+
settings: TailorDBTypeSettingsSchema.optional(),
|
|
97575
97639
|
permissions: z.unknown(),
|
|
97576
97640
|
files: z.record(z.string(), z.string()),
|
|
97577
97641
|
indexes: z.record(z.string(), z.object({
|
|
@@ -97580,6 +97644,21 @@ const TailorDBTypeSchema = z.object({
|
|
|
97580
97644
|
})).optional()
|
|
97581
97645
|
})
|
|
97582
97646
|
});
|
|
97647
|
+
const TailorDBMigrationConfigSchema = z.object({
|
|
97648
|
+
directory: z.string(),
|
|
97649
|
+
machineUser: z.string().optional()
|
|
97650
|
+
});
|
|
97651
|
+
/**
|
|
97652
|
+
* Schema for TailorDB service configuration.
|
|
97653
|
+
* Normalizes gqlOperations from alias ("query") to object format.
|
|
97654
|
+
*/
|
|
97655
|
+
const TailorDBServiceConfigSchema = z.object({
|
|
97656
|
+
files: z.array(z.string()),
|
|
97657
|
+
ignores: z.array(z.string()).optional(),
|
|
97658
|
+
erdSite: z.string().optional(),
|
|
97659
|
+
migration: TailorDBMigrationConfigSchema.optional(),
|
|
97660
|
+
gqlOperations: GqlOperationsSchema.optional()
|
|
97661
|
+
});
|
|
97583
97662
|
|
|
97584
97663
|
//#endregion
|
|
97585
97664
|
//#region src/cli/application/tailordb/service.ts
|
|
@@ -97609,8 +97688,8 @@ function createTailorDBService(namespace, config) {
|
|
|
97609
97688
|
if (!result.success) continue;
|
|
97610
97689
|
const relativePath = path$20.relative(process.cwd(), typeFile);
|
|
97611
97690
|
logger.log(`Type: ${styles.successBright(`"${result.data.name}"`)} loaded from ${styles.path(relativePath)}`);
|
|
97612
|
-
rawTypes[typeFile][result.data.name] =
|
|
97613
|
-
loadedTypes[result.data.name] =
|
|
97691
|
+
rawTypes[typeFile][result.data.name] = result.data;
|
|
97692
|
+
loadedTypes[result.data.name] = result.data;
|
|
97614
97693
|
typeSourceInfo[result.data.name] = {
|
|
97615
97694
|
filePath: typeFile,
|
|
97616
97695
|
exportName
|
|
@@ -98158,7 +98237,7 @@ function defineTailorDB(config) {
|
|
|
98158
98237
|
for (const [namespace, serviceConfig] of Object.entries(config)) {
|
|
98159
98238
|
if ("external" in serviceConfig) externalTailorDBNamespaces.push(namespace);
|
|
98160
98239
|
else {
|
|
98161
|
-
const tailorDB = createTailorDBService(namespace, serviceConfig);
|
|
98240
|
+
const tailorDB = createTailorDBService(namespace, TailorDBServiceConfigSchema.parse(serviceConfig));
|
|
98162
98241
|
tailorDBServices.push(tailorDB);
|
|
98163
98242
|
}
|
|
98164
98243
|
subgraphs.push({
|
|
@@ -98296,4 +98375,4 @@ function defineApplication(config) {
|
|
|
98296
98375
|
|
|
98297
98376
|
//#endregion
|
|
98298
98377
|
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-
|
|
98378
|
+
//# sourceMappingURL=application-_ArEfxmV.mjs.map
|