@tailor-platform/sdk 1.39.0 → 1.39.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.
- package/CHANGELOG.md +12 -0
- package/dist/{env-CgI46oPS.d.mts → actor-Bb4OVq1j.d.mts} +9 -9
- package/dist/{application-DhQrXEld.mjs → application-BHu8YE-g.mjs} +148 -148
- package/dist/application-BHu8YE-g.mjs.map +1 -0
- package/dist/application-C8Lr37AM.mjs +4 -0
- package/dist/{brand-D-d15jx3.mjs → brand-Ll48SMXe.mjs} +1 -1
- package/dist/{brand-D-d15jx3.mjs.map → brand-Ll48SMXe.mjs.map} +1 -1
- package/dist/cli/index.mjs +15 -15
- package/dist/cli/lib.d.mts +9 -9
- package/dist/cli/lib.mjs +4 -4
- package/dist/{client-xzPXtc_e.mjs → client-B2K45RvK.mjs} +77 -47
- package/dist/client-B2K45RvK.mjs.map +1 -0
- package/dist/{client-BWAbbA1C.mjs → client-CEVmv94H.mjs} +1 -1
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +55 -4
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{crash-report-DXhPL8Ue.mjs → crash-report-CACiemAr.mjs} +4 -4
- package/dist/{crash-report-DXhPL8Ue.mjs.map → crash-report-CACiemAr.mjs.map} +1 -1
- package/dist/{crash-report-BEAiCSCl.mjs → crash-report-CPUF3T5d.mjs} +1 -1
- package/dist/{errors-D9f2UJpT.mjs → errors-ChWX5ZG8.mjs} +1 -1
- package/dist/{errors-D9f2UJpT.mjs.map → errors-ChWX5ZG8.mjs.map} +1 -1
- package/dist/field-BY2vbJ8f.mjs +23 -0
- package/dist/field-BY2vbJ8f.mjs.map +1 -0
- package/dist/{index-31hm0Fq7.d.mts → index-BYmdVno1.d.mts} +133 -30
- package/dist/{index-y5790SX_.d.mts → index-CeFwhUkX.d.mts} +2 -2
- package/dist/{index-B2tsEXdh.d.mts → index-Ch8Em3nz.d.mts} +2 -2
- package/dist/{index-DbzopC7M.d.mts → index-Cx1RYDbu.d.mts} +2 -2
- package/dist/{index-DeBFa7oc.d.mts → index-DLO_XvLi.d.mts} +2 -2
- package/dist/{interceptor-CzaH2Ur6.mjs → interceptor-B5bKVwgq.mjs} +1 -1
- package/dist/{interceptor-CzaH2Ur6.mjs.map → interceptor-B5bKVwgq.mjs.map} +1 -1
- package/dist/{job-DkAklmE4.mjs → job-p6zf8Qpg.mjs} +2 -2
- package/dist/job-p6zf8Qpg.mjs.map +1 -0
- package/dist/{logger-5_JMzHmw.mjs → logger-DTNAMYGy.mjs} +1 -1
- package/dist/{logger-5_JMzHmw.mjs.map → logger-DTNAMYGy.mjs.map} +1 -1
- package/dist/package-json-CPR7s5hf.mjs +4 -0
- package/dist/{package-json-BHViVisJ.mjs → package-json-CWp8s9dE.mjs} +1 -1
- package/dist/{package-json-BHViVisJ.mjs.map → package-json-CWp8s9dE.mjs.map} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/{runtime-DtSOnOHh.mjs → runtime-2xqzvkQv.mjs} +86 -15
- package/dist/runtime-2xqzvkQv.mjs.map +1 -0
- package/dist/{schema-CnwUqPyM.mjs → schema-CEcfEyPN.mjs} +4 -44
- package/dist/schema-CEcfEyPN.mjs.map +1 -0
- package/dist/{seed-DrbB1VXd.mjs → seed-CyYPhvNL.mjs} +12 -12
- package/dist/seed-CyYPhvNL.mjs.map +1 -0
- package/dist/{service-Bcp6JB3w.mjs → service-SrG26B9T.mjs} +3 -3
- package/dist/{service-Bcp6JB3w.mjs.map → service-SrG26B9T.mjs.map} +1 -1
- package/dist/{plugin-_K3ZfP8B.d.mts → tailor-db-field-B99RnR2N.d.mts} +695 -1187
- package/dist/{telemetry-DwHuiNiR.mjs → telemetry-BuDto_2q.mjs} +2 -2
- package/dist/{telemetry-DwHuiNiR.mjs.map → telemetry-BuDto_2q.mjs.map} +1 -1
- package/dist/telemetry-C1hzFaiV.mjs +4 -0
- package/dist/types-BnphjkIJ.mjs +5 -0
- package/dist/{types-B9ZMosul.mjs → types-Duhhsx3R.mjs} +3 -32
- package/dist/types-Duhhsx3R.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +1 -1
- package/dist/workflow.generated-DSwr-k57.d.mts +1207 -0
- package/docs/cli/application.md +21 -5
- package/docs/services/idp.md +4 -4
- package/package.json +2 -2
- package/dist/application-C1ipG5Q6.mjs +0 -4
- package/dist/application-DhQrXEld.mjs.map +0 -1
- package/dist/client-xzPXtc_e.mjs.map +0 -1
- package/dist/job-DkAklmE4.mjs.map +0 -1
- package/dist/package-json--6dmp6-h.mjs +0 -4
- package/dist/runtime-DtSOnOHh.mjs.map +0 -1
- package/dist/schema-CnwUqPyM.mjs.map +0 -1
- package/dist/seed-DrbB1VXd.mjs.map +0 -1
- package/dist/telemetry-4IOPW6wE.mjs +0 -4
- package/dist/types-B9ZMosul.mjs.map +0 -1
- package/dist/types-C45jRrCM.mjs +0 -4
- package/dist/workflow.generated-BxbnuzAE.d.mts +0 -414
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.39.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#885](https://github.com/tailor-platform/sdk/pull/885) [`c67000f`](https://github.com/tailor-platform/sdk/commit/c67000fae7fcfe394e27bae8e12431fac2dc47d0) Thanks [@toiroakr](https://github.com/toiroakr)! - Auto-inject workspaceId and namespaceName into `api` command request body based on proto schema introspection and SDK config
|
|
8
|
+
|
|
9
|
+
- [#1017](https://github.com/tailor-platform/sdk/pull/1017) [`ab445c4`](https://github.com/tailor-platform/sdk/commit/ab445c494acc3ec1b1f7f135d97f06126902043a) Thanks [@k1LoW](https://github.com/k1LoW)! - Make `authorization` field optional in `defineIdp()` for migration to permission-based access control
|
|
10
|
+
|
|
11
|
+
- [#930](https://github.com/tailor-platform/sdk/pull/930) [`3bfeec3`](https://github.com/tailor-platform/sdk/commit/3bfeec37db1f28071ac0eeb201f9eea14f0f0d8e) Thanks [@toiroakr](https://github.com/toiroakr)! - Internal refactoring of type layer boundaries. No changes to public API.
|
|
12
|
+
|
|
13
|
+
- [#1014](https://github.com/tailor-platform/sdk/pull/1014) [`faa3301`](https://github.com/tailor-platform/sdk/commit/faa3301b7ff341ff3ddb52d387ae466381d267e2) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): lock file maintenance
|
|
14
|
+
|
|
3
15
|
## 1.39.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/// <reference types="@tailor-platform/function-types" />
|
|
2
|
-
import {
|
|
2
|
+
import { Bt as InferredAttributeMap, zt as InferredAttributeList } from "./tailor-db-field-B99RnR2N.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/types/env.d.ts
|
|
5
|
+
interface Env {}
|
|
6
|
+
/** Represents environment variables in the Tailor platform. */
|
|
7
|
+
type TailorEnv = keyof Env extends never ? Record<string, string> : Env;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/types/actor.d.ts
|
|
5
10
|
/** User type enum values from the Tailor Platform server. */
|
|
6
11
|
type TailorActorType = "USER_TYPE_USER" | "USER_TYPE_MACHINE_USER" | "USER_TYPE_UNSPECIFIED";
|
|
7
12
|
/** Represents an actor in event triggers. */
|
|
@@ -21,10 +26,5 @@ type TailorActor = {
|
|
|
21
26
|
userType: TailorActorType;
|
|
22
27
|
};
|
|
23
28
|
//#endregion
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/** Represents environment variables in the Tailor platform. */
|
|
27
|
-
type TailorEnv = keyof Env extends never ? Record<string, string> : Env;
|
|
28
|
-
//#endregion
|
|
29
|
-
export { TailorEnv as n, TailorActor as r, Env as t };
|
|
30
|
-
//# sourceMappingURL=env-CgI46oPS.d.mts.map
|
|
29
|
+
export { Env as n, TailorEnv as r, TailorActor as t };
|
|
30
|
+
//# sourceMappingURL=actor-Bb4OVq1j.d.mts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
import { l as initOAuth2Client } from "./client-
|
|
3
|
-
import { n as isSdkBranded } from "./brand-
|
|
4
|
-
import { a as parseBoolean, n as logger, r as styles } from "./logger-
|
|
5
|
-
import { t as readPackageJson } from "./package-json-
|
|
6
|
-
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-DrbB1VXd.mjs";
|
|
2
|
+
import { l as initOAuth2Client } from "./client-B2K45RvK.mjs";
|
|
3
|
+
import { n as isSdkBranded } from "./brand-Ll48SMXe.mjs";
|
|
4
|
+
import { a as parseBoolean, n as logger, r as styles } from "./logger-DTNAMYGy.mjs";
|
|
5
|
+
import { t as readPackageJson } from "./package-json-CWp8s9dE.mjs";
|
|
7
6
|
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-Dx82rSjf.mjs";
|
|
8
7
|
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-DeWpvq3T.mjs";
|
|
9
8
|
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-CwtvQuxh.mjs";
|
|
9
|
+
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-CyYPhvNL.mjs";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import * as fs$1 from "node:fs";
|
|
@@ -16,10 +16,10 @@ import { join, resolve } from "pathe";
|
|
|
16
16
|
import * as crypto from "node:crypto";
|
|
17
17
|
import { pathToFileURL } from "node:url";
|
|
18
18
|
import { resolveTSConfig } from "pkg-types";
|
|
19
|
+
import ml from "multiline-ts";
|
|
19
20
|
import * as os from "node:os";
|
|
20
21
|
import { parseTOML, parseYAML, stringifyYAML } from "confbox";
|
|
21
22
|
import { findUpSync } from "find-up-simple";
|
|
22
|
-
import ml from "multiline-ts";
|
|
23
23
|
import { lt } from "semver";
|
|
24
24
|
import { xdgConfig } from "xdg-basedir";
|
|
25
25
|
import * as rolldown from "rolldown";
|
|
@@ -28,6 +28,69 @@ import { parseSync } from "oxc-parser";
|
|
|
28
28
|
import * as inflection from "inflection";
|
|
29
29
|
import * as globals from "globals";
|
|
30
30
|
|
|
31
|
+
//#region src/parser/generator-config/schema.ts
|
|
32
|
+
const DependencyKindSchema = z.enum([
|
|
33
|
+
"tailordb",
|
|
34
|
+
"resolver",
|
|
35
|
+
"executor"
|
|
36
|
+
]);
|
|
37
|
+
const KyselyTypeConfigSchema = z.tuple([z.literal("@tailor-platform/kysely-type"), z.object({ distPath: z.string() })]);
|
|
38
|
+
const SeedConfigSchema = z.tuple([z.literal("@tailor-platform/seed"), z.object({
|
|
39
|
+
distPath: z.string(),
|
|
40
|
+
machineUserName: z.string().optional()
|
|
41
|
+
})]);
|
|
42
|
+
const EnumConstantsConfigSchema = z.tuple([z.literal("@tailor-platform/enum-constants"), z.object({ distPath: z.string() })]);
|
|
43
|
+
const FileUtilsConfigSchema = z.tuple([z.literal("@tailor-platform/file-utils"), z.object({ distPath: z.string() })]);
|
|
44
|
+
const CodeGeneratorSchema = z.object({
|
|
45
|
+
id: z.string(),
|
|
46
|
+
description: z.string(),
|
|
47
|
+
dependencies: z.array(DependencyKindSchema),
|
|
48
|
+
processType: z.function().optional(),
|
|
49
|
+
processResolver: z.function().optional(),
|
|
50
|
+
processExecutor: z.function().optional(),
|
|
51
|
+
processTailorDBNamespace: z.function().optional(),
|
|
52
|
+
processResolverNamespace: z.function().optional(),
|
|
53
|
+
aggregate: z.function({ output: z.any() })
|
|
54
|
+
});
|
|
55
|
+
const BaseGeneratorConfigSchema = z.union([
|
|
56
|
+
KyselyTypeConfigSchema,
|
|
57
|
+
SeedConfigSchema,
|
|
58
|
+
EnumConstantsConfigSchema,
|
|
59
|
+
FileUtilsConfigSchema,
|
|
60
|
+
CodeGeneratorSchema
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/parser/service/common.ts
|
|
65
|
+
const functionSchema = z.custom((val) => typeof val === "function");
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/parser/plugin-config/schema.ts
|
|
69
|
+
const PluginConfigSchema = z.object({
|
|
70
|
+
id: z.string(),
|
|
71
|
+
description: z.string(),
|
|
72
|
+
importPath: z.string().optional(),
|
|
73
|
+
pluginConfig: z.unknown().optional(),
|
|
74
|
+
typeConfigRequired: z.union([z.boolean(), functionSchema]).optional(),
|
|
75
|
+
onTypeLoaded: functionSchema.optional(),
|
|
76
|
+
onNamespaceLoaded: functionSchema.optional(),
|
|
77
|
+
onTailorDBReady: functionSchema.optional(),
|
|
78
|
+
onResolverReady: functionSchema.optional(),
|
|
79
|
+
onExecutorReady: functionSchema.optional()
|
|
80
|
+
}).passthrough().refine((p) => {
|
|
81
|
+
return !(p.onTypeLoaded || p.onNamespaceLoaded) || !!p.importPath;
|
|
82
|
+
}, { message: "importPath is required when plugin has definition-time hooks (onTypeLoaded/onNamespaceLoaded)" }).transform((plugin) => plugin);
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/plugin/builtin/registry.ts
|
|
86
|
+
const builtinPlugins = new Map([
|
|
87
|
+
[KyselyGeneratorID, (options) => kyselyTypePlugin(options)],
|
|
88
|
+
[SeedGeneratorID, (options) => seedPlugin(options)],
|
|
89
|
+
[EnumConstantsGeneratorID, (options) => enumConstantsPlugin(options)],
|
|
90
|
+
[FileUtilsGeneratorID, (options) => fileUtilsPlugin(options)]
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
//#endregion
|
|
31
94
|
//#region src/cli/shared/token-store.ts
|
|
32
95
|
const SERVICE_NAME = "tailor-platform-cli";
|
|
33
96
|
let entryClass;
|
|
@@ -443,6 +506,82 @@ function loadConfigPath(configPath) {
|
|
|
443
506
|
return findUpSync(DEFAULT_CONFIG_FILENAME);
|
|
444
507
|
}
|
|
445
508
|
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/cli/shared/mock.ts
|
|
511
|
+
globalThis.tailordb = { Client: class {
|
|
512
|
+
constructor(_config) {}
|
|
513
|
+
async connect() {}
|
|
514
|
+
async end() {}
|
|
515
|
+
async queryObject() {
|
|
516
|
+
return {};
|
|
517
|
+
}
|
|
518
|
+
} };
|
|
519
|
+
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/cli/shared/config-loader.ts
|
|
522
|
+
const GeneratorConfigSchema = CodeGeneratorSchema.brand("CodeGenerator");
|
|
523
|
+
/**
|
|
524
|
+
* Load Tailor configuration file and associated generators and plugins.
|
|
525
|
+
* @param configPath - Optional explicit config path
|
|
526
|
+
* @returns Loaded config, generators, plugins, and config path
|
|
527
|
+
*/
|
|
528
|
+
async function loadConfig(configPath) {
|
|
529
|
+
const foundPath = loadConfigPath(configPath);
|
|
530
|
+
if (!foundPath) throw new Error("Configuration file not found: tailor.config.ts not found in current or parent directories");
|
|
531
|
+
const resolvedPath = path.resolve(process.cwd(), foundPath);
|
|
532
|
+
if (!fs$1.existsSync(resolvedPath)) throw new Error(`Configuration file not found: ${configPath}`);
|
|
533
|
+
const configModule = await import(pathToFileURL(resolvedPath).href);
|
|
534
|
+
if (!configModule || !configModule.default) throw new Error("Invalid Tailor config module: default export not found");
|
|
535
|
+
const allGenerators = [];
|
|
536
|
+
const allPlugins = [];
|
|
537
|
+
for (const value of Object.values(configModule)) if (Array.isArray(value)) {
|
|
538
|
+
const generatorParsed = value.reduce((acc, item) => {
|
|
539
|
+
if (!acc.success) return acc;
|
|
540
|
+
const baseResult = BaseGeneratorConfigSchema.safeParse(item);
|
|
541
|
+
if (baseResult.success && Array.isArray(baseResult.data)) {
|
|
542
|
+
const [id, options] = baseResult.data;
|
|
543
|
+
const pluginFactory = builtinPlugins.get(id);
|
|
544
|
+
if (pluginFactory) {
|
|
545
|
+
acc.convertedPlugins.push(pluginFactory(options));
|
|
546
|
+
return acc;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const result = GeneratorConfigSchema.safeParse(item);
|
|
550
|
+
if (result.success) acc.items.push(result.data);
|
|
551
|
+
else acc.success = false;
|
|
552
|
+
return acc;
|
|
553
|
+
}, {
|
|
554
|
+
success: true,
|
|
555
|
+
items: [],
|
|
556
|
+
convertedPlugins: []
|
|
557
|
+
});
|
|
558
|
+
if (generatorParsed.success && (generatorParsed.items.length > 0 || generatorParsed.convertedPlugins.length > 0)) {
|
|
559
|
+
allGenerators.push(...generatorParsed.items);
|
|
560
|
+
allPlugins.push(...generatorParsed.convertedPlugins);
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
const pluginParsed = value.reduce((acc, item) => {
|
|
564
|
+
if (!acc.success) return acc;
|
|
565
|
+
const result = PluginConfigSchema.safeParse(item);
|
|
566
|
+
if (result.success) acc.items.push(result.data);
|
|
567
|
+
else acc.success = false;
|
|
568
|
+
return acc;
|
|
569
|
+
}, {
|
|
570
|
+
success: true,
|
|
571
|
+
items: []
|
|
572
|
+
});
|
|
573
|
+
if (pluginParsed.success && pluginParsed.items.length > 0) allPlugins.push(...pluginParsed.items);
|
|
574
|
+
}
|
|
575
|
+
return {
|
|
576
|
+
config: {
|
|
577
|
+
...configModule.default,
|
|
578
|
+
path: resolvedPath
|
|
579
|
+
},
|
|
580
|
+
generators: allGenerators,
|
|
581
|
+
plugins: allPlugins
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
|
|
446
585
|
//#endregion
|
|
447
586
|
//#region src/cli/cache/hasher.ts
|
|
448
587
|
/**
|
|
@@ -2410,10 +2549,6 @@ function validatePluralFormUniqueness(types, namespace, typeSourceInfo) {
|
|
|
2410
2549
|
if (errors.length > 0) throw new Error(`GraphQL field name conflicts detected in TailorDB service "${namespace}".\n${errors.map((e) => ` - ${e}`).join("\n")}`);
|
|
2411
2550
|
}
|
|
2412
2551
|
|
|
2413
|
-
//#endregion
|
|
2414
|
-
//#region src/parser/service/common.ts
|
|
2415
|
-
const functionSchema = z.custom((val) => typeof val === "function");
|
|
2416
|
-
|
|
2417
2552
|
//#endregion
|
|
2418
2553
|
//#region src/parser/service/tailordb/schema.ts
|
|
2419
2554
|
/**
|
|
@@ -4453,141 +4588,6 @@ async function loadFileContent(filePath) {
|
|
|
4453
4588
|
};
|
|
4454
4589
|
}
|
|
4455
4590
|
|
|
4456
|
-
//#endregion
|
|
4457
|
-
//#region src/parser/generator-config/index.ts
|
|
4458
|
-
const DependencyKindSchema = z.enum([
|
|
4459
|
-
"tailordb",
|
|
4460
|
-
"resolver",
|
|
4461
|
-
"executor"
|
|
4462
|
-
]);
|
|
4463
|
-
const KyselyTypeConfigSchema = z.tuple([z.literal("@tailor-platform/kysely-type"), z.object({ distPath: z.string() })]);
|
|
4464
|
-
const SeedConfigSchema = z.tuple([z.literal("@tailor-platform/seed"), z.object({
|
|
4465
|
-
distPath: z.string(),
|
|
4466
|
-
machineUserName: z.string().optional()
|
|
4467
|
-
})]);
|
|
4468
|
-
const EnumConstantsConfigSchema = z.tuple([z.literal("@tailor-platform/enum-constants"), z.object({ distPath: z.string() })]);
|
|
4469
|
-
const FileUtilsConfigSchema = z.tuple([z.literal("@tailor-platform/file-utils"), z.object({ distPath: z.string() })]);
|
|
4470
|
-
const CodeGeneratorSchema = z.object({
|
|
4471
|
-
id: z.string(),
|
|
4472
|
-
description: z.string(),
|
|
4473
|
-
dependencies: z.array(DependencyKindSchema),
|
|
4474
|
-
processType: z.function().optional(),
|
|
4475
|
-
processResolver: z.function().optional(),
|
|
4476
|
-
processExecutor: z.function().optional(),
|
|
4477
|
-
processTailorDBNamespace: z.function().optional(),
|
|
4478
|
-
processResolverNamespace: z.function().optional(),
|
|
4479
|
-
aggregate: z.function({ output: z.any() })
|
|
4480
|
-
});
|
|
4481
|
-
const BaseGeneratorConfigSchema = z.union([
|
|
4482
|
-
KyselyTypeConfigSchema,
|
|
4483
|
-
SeedConfigSchema,
|
|
4484
|
-
EnumConstantsConfigSchema,
|
|
4485
|
-
FileUtilsConfigSchema,
|
|
4486
|
-
CodeGeneratorSchema
|
|
4487
|
-
]);
|
|
4488
|
-
|
|
4489
|
-
//#endregion
|
|
4490
|
-
//#region src/parser/plugin-config/schema.ts
|
|
4491
|
-
const PluginConfigSchema = z.object({
|
|
4492
|
-
id: z.string(),
|
|
4493
|
-
description: z.string(),
|
|
4494
|
-
importPath: z.string().optional(),
|
|
4495
|
-
pluginConfig: z.unknown().optional(),
|
|
4496
|
-
typeConfigRequired: z.union([z.boolean(), functionSchema]).optional(),
|
|
4497
|
-
onTypeLoaded: functionSchema.optional(),
|
|
4498
|
-
onNamespaceLoaded: functionSchema.optional(),
|
|
4499
|
-
onTailorDBReady: functionSchema.optional(),
|
|
4500
|
-
onResolverReady: functionSchema.optional(),
|
|
4501
|
-
onExecutorReady: functionSchema.optional()
|
|
4502
|
-
}).passthrough().refine((p) => {
|
|
4503
|
-
return !(p.onTypeLoaded || p.onNamespaceLoaded) || !!p.importPath;
|
|
4504
|
-
}, { message: "importPath is required when plugin has definition-time hooks (onTypeLoaded/onNamespaceLoaded)" }).transform((plugin) => plugin);
|
|
4505
|
-
|
|
4506
|
-
//#endregion
|
|
4507
|
-
//#region src/plugin/builtin/registry.ts
|
|
4508
|
-
const builtinPlugins = new Map([
|
|
4509
|
-
[KyselyGeneratorID, (options) => kyselyTypePlugin(options)],
|
|
4510
|
-
[SeedGeneratorID, (options) => seedPlugin(options)],
|
|
4511
|
-
[EnumConstantsGeneratorID, (options) => enumConstantsPlugin(options)],
|
|
4512
|
-
[FileUtilsGeneratorID, (options) => fileUtilsPlugin(options)]
|
|
4513
|
-
]);
|
|
4514
|
-
|
|
4515
|
-
//#endregion
|
|
4516
|
-
//#region src/cli/shared/mock.ts
|
|
4517
|
-
globalThis.tailordb = { Client: class {
|
|
4518
|
-
constructor(_config) {}
|
|
4519
|
-
async connect() {}
|
|
4520
|
-
async end() {}
|
|
4521
|
-
async queryObject() {
|
|
4522
|
-
return {};
|
|
4523
|
-
}
|
|
4524
|
-
} };
|
|
4525
|
-
|
|
4526
|
-
//#endregion
|
|
4527
|
-
//#region src/cli/shared/config-loader.ts
|
|
4528
|
-
const GeneratorConfigSchema = CodeGeneratorSchema.brand("CodeGenerator");
|
|
4529
|
-
/**
|
|
4530
|
-
* Load Tailor configuration file and associated generators and plugins.
|
|
4531
|
-
* @param configPath - Optional explicit config path
|
|
4532
|
-
* @returns Loaded config, generators, plugins, and config path
|
|
4533
|
-
*/
|
|
4534
|
-
async function loadConfig(configPath) {
|
|
4535
|
-
const foundPath = loadConfigPath(configPath);
|
|
4536
|
-
if (!foundPath) throw new Error("Configuration file not found: tailor.config.ts not found in current or parent directories");
|
|
4537
|
-
const resolvedPath = path.resolve(process.cwd(), foundPath);
|
|
4538
|
-
if (!fs$1.existsSync(resolvedPath)) throw new Error(`Configuration file not found: ${configPath}`);
|
|
4539
|
-
const configModule = await import(pathToFileURL(resolvedPath).href);
|
|
4540
|
-
if (!configModule || !configModule.default) throw new Error("Invalid Tailor config module: default export not found");
|
|
4541
|
-
const allGenerators = [];
|
|
4542
|
-
const allPlugins = [];
|
|
4543
|
-
for (const value of Object.values(configModule)) if (Array.isArray(value)) {
|
|
4544
|
-
const generatorParsed = value.reduce((acc, item) => {
|
|
4545
|
-
if (!acc.success) return acc;
|
|
4546
|
-
const baseResult = BaseGeneratorConfigSchema.safeParse(item);
|
|
4547
|
-
if (baseResult.success && Array.isArray(baseResult.data)) {
|
|
4548
|
-
const [id, options] = baseResult.data;
|
|
4549
|
-
const pluginFactory = builtinPlugins.get(id);
|
|
4550
|
-
if (pluginFactory) {
|
|
4551
|
-
acc.convertedPlugins.push(pluginFactory(options));
|
|
4552
|
-
return acc;
|
|
4553
|
-
}
|
|
4554
|
-
}
|
|
4555
|
-
const result = GeneratorConfigSchema.safeParse(item);
|
|
4556
|
-
if (result.success) acc.items.push(result.data);
|
|
4557
|
-
else acc.success = false;
|
|
4558
|
-
return acc;
|
|
4559
|
-
}, {
|
|
4560
|
-
success: true,
|
|
4561
|
-
items: [],
|
|
4562
|
-
convertedPlugins: []
|
|
4563
|
-
});
|
|
4564
|
-
if (generatorParsed.success && (generatorParsed.items.length > 0 || generatorParsed.convertedPlugins.length > 0)) {
|
|
4565
|
-
allGenerators.push(...generatorParsed.items);
|
|
4566
|
-
allPlugins.push(...generatorParsed.convertedPlugins);
|
|
4567
|
-
continue;
|
|
4568
|
-
}
|
|
4569
|
-
const pluginParsed = value.reduce((acc, item) => {
|
|
4570
|
-
if (!acc.success) return acc;
|
|
4571
|
-
const result = PluginConfigSchema.safeParse(item);
|
|
4572
|
-
if (result.success) acc.items.push(result.data);
|
|
4573
|
-
else acc.success = false;
|
|
4574
|
-
return acc;
|
|
4575
|
-
}, {
|
|
4576
|
-
success: true,
|
|
4577
|
-
items: []
|
|
4578
|
-
});
|
|
4579
|
-
if (pluginParsed.success && pluginParsed.items.length > 0) allPlugins.push(...pluginParsed.items);
|
|
4580
|
-
}
|
|
4581
|
-
return {
|
|
4582
|
-
config: {
|
|
4583
|
-
...configModule.default,
|
|
4584
|
-
path: resolvedPath
|
|
4585
|
-
},
|
|
4586
|
-
generators: allGenerators,
|
|
4587
|
-
plugins: allPlugins
|
|
4588
|
-
};
|
|
4589
|
-
}
|
|
4590
|
-
|
|
4591
4591
|
//#endregion
|
|
4592
4592
|
//#region src/cli/shared/inline-sourcemap.ts
|
|
4593
4593
|
/**
|
|
@@ -4751,7 +4751,7 @@ const IdPSchema = z.object({
|
|
|
4751
4751
|
z.literal("insecure"),
|
|
4752
4752
|
z.literal("loggedIn"),
|
|
4753
4753
|
z.object({ cel: z.string() })
|
|
4754
|
-
]).describe("Authorization mode for IdP API access"),
|
|
4754
|
+
]).optional().describe("Authorization mode for IdP API access"),
|
|
4755
4755
|
clients: z.array(z.string()).describe("OAuth2 client names that can use this IdP"),
|
|
4756
4756
|
lang: IdPLangSchema.optional().describe("UI language for IdP pages"),
|
|
4757
4757
|
userAuthPolicy: IdPUserAuthPolicySchema.transform((input) => IdPUserAuthPolicySchema.parse(input ?? {})).optional().describe("User authentication policy configuration"),
|
|
@@ -5087,5 +5087,5 @@ async function loadApplication(params) {
|
|
|
5087
5087
|
}
|
|
5088
5088
|
|
|
5089
5089
|
//#endregion
|
|
5090
|
-
export { resolveTokens as C, readPlatformConfig as S, writePlatformConfig as T,
|
|
5091
|
-
//# sourceMappingURL=application-
|
|
5090
|
+
export { resolveTokens as C, readPlatformConfig as S, writePlatformConfig as T, loadConfig as _, WorkflowJobSchema as a, loadAccessToken as b, ExecutorSchema as c, stringifyFunction as d, tailorUserMap as f, hashFile as g, getDistDir as h, resolveInlineSourcemap as i, OAuth2ClientSchema as l, createBundleCache as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, loadFilesWithIgnores as p, loadApplication as r, createExecutorService as s, defineApplication as t, TailorDBTypeSchema as u, deleteUserTokens as v, saveUserTokens as w, loadWorkspaceId as x, fetchLatestToken as y };
|
|
5091
|
+
//# sourceMappingURL=application-BHu8YE-g.mjs.map
|