@tailor-platform/sdk 0.11.3 → 0.12.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 +15 -0
- package/dist/cli/api.d.mts +16 -7
- package/dist/cli/api.mjs +8 -2
- package/dist/cli/api.mjs.map +1 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/configure/index.d.mts +2 -2
- package/dist/{index-Bx9tHHe8.d.mts → index-CvaR3wBO.d.mts} +2 -2
- package/dist/job-CSwByDTq.mjs.map +1 -1
- package/dist/{token-BJq9rpG5.mjs → token-C2dypdqc.mjs} +223 -108
- package/dist/token-C2dypdqc.mjs.map +1 -0
- package/dist/{types-C5oBGPO0.d.mts → types-CWvnDV8C.d.mts} +3 -2
- package/dist/utils/test/index.d.mts +2 -2
- package/docs/core-concepts.md +7 -7
- package/package.json +5 -4
- package/dist/token-BJq9rpG5.mjs.map +0 -1
|
@@ -901,7 +901,7 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig) {
|
|
|
901
901
|
//#endregion
|
|
902
902
|
//#region src/cli/bundler/workflow/ast-transformer.ts
|
|
903
903
|
/**
|
|
904
|
-
* Check if a module source is from
|
|
904
|
+
* Check if a module source is from \@tailor-platform/sdk (including subpaths)
|
|
905
905
|
*/
|
|
906
906
|
function isTailorSdkSource(source) {
|
|
907
907
|
return /^@tailor-platform\/sdk(\/|$)/.test(source);
|
|
@@ -932,7 +932,7 @@ function unwrapAwait(node) {
|
|
|
932
932
|
return node;
|
|
933
933
|
}
|
|
934
934
|
/**
|
|
935
|
-
* Collect all import bindings for createWorkflowJob from
|
|
935
|
+
* Collect all import bindings for createWorkflowJob from \@tailor-platform/sdk
|
|
936
936
|
* Returns a Set of local names that refer to createWorkflowJob
|
|
937
937
|
*/
|
|
938
938
|
function collectCreateWorkflowJobBindings(program) {
|
|
@@ -1033,7 +1033,7 @@ function findProperty(properties, name) {
|
|
|
1033
1033
|
return null;
|
|
1034
1034
|
}
|
|
1035
1035
|
/**
|
|
1036
|
-
* Find all workflow jobs by detecting createWorkflowJob calls from
|
|
1036
|
+
* Find all workflow jobs by detecting createWorkflowJob calls from \@tailor-platform/sdk
|
|
1037
1037
|
*/
|
|
1038
1038
|
function findAllJobs(program, _sourceText) {
|
|
1039
1039
|
const jobs = [];
|
|
@@ -1457,7 +1457,7 @@ var EnumConstantsGenerator = class {
|
|
|
1457
1457
|
aggregate(args) {
|
|
1458
1458
|
const files = [];
|
|
1459
1459
|
const allEnums = [];
|
|
1460
|
-
for (const
|
|
1460
|
+
for (const nsResult of args.input.tailordb) if (nsResult.types && nsResult.types.enums.length > 0) allEnums.push(...nsResult.types.enums);
|
|
1461
1461
|
if (allEnums.length > 0) {
|
|
1462
1462
|
const content = EnumProcessor.generateUnifiedEnumConstants(allEnums);
|
|
1463
1463
|
files.push({
|
|
@@ -1597,7 +1597,7 @@ var FileUtilsGenerator = class {
|
|
|
1597
1597
|
aggregate(args) {
|
|
1598
1598
|
const files = [];
|
|
1599
1599
|
const allNamespaceData = [];
|
|
1600
|
-
for (const
|
|
1600
|
+
for (const nsResult of args.input.tailordb) if (nsResult.types) try {
|
|
1601
1601
|
const parsed = JSON.parse(nsResult.types);
|
|
1602
1602
|
if (parsed.namespace && parsed.types) allNamespaceData.push(parsed);
|
|
1603
1603
|
} catch {}
|
|
@@ -1838,7 +1838,7 @@ var KyselyGenerator = class {
|
|
|
1838
1838
|
aggregate(args) {
|
|
1839
1839
|
const files = [];
|
|
1840
1840
|
const allNamespaceData = [];
|
|
1841
|
-
for (const
|
|
1841
|
+
for (const nsResult of args.input.tailordb) if (nsResult.types && nsResult.types.types.length > 0) allNamespaceData.push(nsResult.types);
|
|
1842
1842
|
if (allNamespaceData.length > 0) {
|
|
1843
1843
|
const content = TypeProcessor.generateUnifiedTypes(allNamespaceData);
|
|
1844
1844
|
files.push({
|
|
@@ -1879,6 +1879,74 @@ function processGqlIngest(type) {
|
|
|
1879
1879
|
};
|
|
1880
1880
|
}
|
|
1881
1881
|
|
|
1882
|
+
//#endregion
|
|
1883
|
+
//#region src/cli/generator/builtin/seed/idp-user-processor.ts
|
|
1884
|
+
/**
|
|
1885
|
+
* Processes auth configuration to generate IdP user seed metadata
|
|
1886
|
+
*/
|
|
1887
|
+
function processIdpUser(auth) {
|
|
1888
|
+
if (auth.idProvider?.kind !== "BuiltInIdP" || !auth.userProfile) return;
|
|
1889
|
+
const { typeName, usernameField } = auth.userProfile;
|
|
1890
|
+
return {
|
|
1891
|
+
name: "_User",
|
|
1892
|
+
dependencies: [typeName],
|
|
1893
|
+
mapping: {
|
|
1894
|
+
dataFile: "data/_User.jsonl",
|
|
1895
|
+
dataFormat: "jsonl",
|
|
1896
|
+
graphqlFile: "graphql/_User.graphql",
|
|
1897
|
+
mapping: { input: "$" }
|
|
1898
|
+
},
|
|
1899
|
+
graphql: `mutation CreateUser($input: _CreateUserInput!) {
|
|
1900
|
+
_createUser(input: $input) {
|
|
1901
|
+
id
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
`,
|
|
1905
|
+
schema: {
|
|
1906
|
+
usernameField,
|
|
1907
|
+
userTypeName: typeName
|
|
1908
|
+
}
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Generates the schema file content for IdP users with foreign key
|
|
1913
|
+
*/
|
|
1914
|
+
function generateIdpUserSchemaFile(usernameField, userTypeName) {
|
|
1915
|
+
return ml`
|
|
1916
|
+
import { t } from "@tailor-platform/sdk";
|
|
1917
|
+
import { createStandardSchema } from "@tailor-platform/sdk/test";
|
|
1918
|
+
import { defineSchema } from "@toiroakr/lines-db";
|
|
1919
|
+
|
|
1920
|
+
const schemaType = t.object({
|
|
1921
|
+
name: t.string(),
|
|
1922
|
+
password: t.string(),
|
|
1923
|
+
});
|
|
1924
|
+
|
|
1925
|
+
// Simple identity hook for _User (no TailorDB backing type)
|
|
1926
|
+
const hook = <T>(data: unknown) => data as T;
|
|
1927
|
+
|
|
1928
|
+
export const schema = defineSchema(
|
|
1929
|
+
createStandardSchema(schemaType, hook),
|
|
1930
|
+
{
|
|
1931
|
+
primaryKey: "name",
|
|
1932
|
+
indexes: [
|
|
1933
|
+
{ name: "_user_name_unique_idx", columns: ["name"], unique: true },
|
|
1934
|
+
],
|
|
1935
|
+
foreignKeys: [
|
|
1936
|
+
{
|
|
1937
|
+
column: "name",
|
|
1938
|
+
references: {
|
|
1939
|
+
table: "${userTypeName}",
|
|
1940
|
+
column: "${usernameField}",
|
|
1941
|
+
},
|
|
1942
|
+
},
|
|
1943
|
+
],
|
|
1944
|
+
}
|
|
1945
|
+
);
|
|
1946
|
+
|
|
1947
|
+
`;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1882
1950
|
//#endregion
|
|
1883
1951
|
//#region src/cli/generator/builtin/seed/lines-db-processor.ts
|
|
1884
1952
|
/**
|
|
@@ -1976,15 +2044,37 @@ const SeedGeneratorID = "@tailor-platform/seed";
|
|
|
1976
2044
|
* Combines GraphQL Ingest and lines-db schema generation.
|
|
1977
2045
|
*/
|
|
1978
2046
|
/**
|
|
1979
|
-
* Generates the exec.
|
|
2047
|
+
* Generates the exec.mjs script content (Node.js executable)
|
|
1980
2048
|
*/
|
|
1981
2049
|
function generateExecScript(machineUserName, configDir) {
|
|
1982
|
-
return
|
|
2050
|
+
return ml`
|
|
2051
|
+
import { execSync } from "node:child_process";
|
|
2052
|
+
import { show, machineUserToken } from "@tailor-platform/sdk/cli";
|
|
1983
2053
|
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2054
|
+
console.log("Starting seed data generation...");
|
|
2055
|
+
|
|
2056
|
+
const appInfo = await show();
|
|
2057
|
+
const endpoint = \`\${appInfo.url}/query\`;
|
|
2058
|
+
|
|
2059
|
+
const tokenInfo = await machineUserToken({ name: "${machineUserName}" });
|
|
2060
|
+
const headers = JSON.stringify({ Authorization: \`Bearer \${tokenInfo.accessToken}\` });
|
|
2061
|
+
|
|
2062
|
+
// Build command with platform-specific quoting
|
|
2063
|
+
const headersArg = process.platform === "win32"
|
|
2064
|
+
? \`"\${headers.replace(/"/g, '\\\\"')}"\` // Windows: escape " as \\"
|
|
2065
|
+
: \`'\${headers}'\`; // Unix: use single quotes
|
|
2066
|
+
|
|
2067
|
+
const cmd = \`npx gql-ingest -c ${configDir} -e "\${endpoint}" --headers \${headersArg}\`;
|
|
2068
|
+
console.log("Running:", cmd);
|
|
2069
|
+
|
|
2070
|
+
try {
|
|
2071
|
+
execSync(cmd, { stdio: "inherit" });
|
|
2072
|
+
} catch (error) {
|
|
2073
|
+
console.error("Seed failed with exit code:", error.status);
|
|
2074
|
+
process.exit(error.status ?? 1);
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
`;
|
|
1988
2078
|
}
|
|
1989
2079
|
function createSeedGenerator(options) {
|
|
1990
2080
|
return {
|
|
@@ -2001,10 +2091,10 @@ function createSeedGenerator(options) {
|
|
|
2001
2091
|
processTailorDBNamespace: ({ types }) => types,
|
|
2002
2092
|
processExecutor: (_executor) => void 0,
|
|
2003
2093
|
processResolver: (_args) => void 0,
|
|
2004
|
-
aggregate: ({
|
|
2094
|
+
aggregate: ({ input }) => {
|
|
2005
2095
|
const entityDependencies = {};
|
|
2006
2096
|
const files = [];
|
|
2007
|
-
for (const
|
|
2097
|
+
for (const nsResult of input.tailordb) {
|
|
2008
2098
|
if (!nsResult.types) continue;
|
|
2009
2099
|
const outputBaseDir = options.distPath;
|
|
2010
2100
|
if (!(outputBaseDir in entityDependencies)) entityDependencies[outputBaseDir] = {};
|
|
@@ -2031,6 +2121,31 @@ function createSeedGenerator(options) {
|
|
|
2031
2121
|
});
|
|
2032
2122
|
}
|
|
2033
2123
|
}
|
|
2124
|
+
if (input.auth) {
|
|
2125
|
+
const idpUser = processIdpUser(input.auth);
|
|
2126
|
+
if (idpUser) {
|
|
2127
|
+
const outputBaseDir = options.distPath;
|
|
2128
|
+
if (!(outputBaseDir in entityDependencies)) entityDependencies[outputBaseDir] = {};
|
|
2129
|
+
entityDependencies[outputBaseDir][idpUser.name] = idpUser.dependencies;
|
|
2130
|
+
files.push({
|
|
2131
|
+
path: path.join(outputBaseDir, idpUser.mapping.graphqlFile),
|
|
2132
|
+
content: idpUser.graphql
|
|
2133
|
+
});
|
|
2134
|
+
files.push({
|
|
2135
|
+
path: path.join(outputBaseDir, "mappings", `${idpUser.name}.json`),
|
|
2136
|
+
content: JSON.stringify(idpUser.mapping, null, 2) + "\n"
|
|
2137
|
+
});
|
|
2138
|
+
files.push({
|
|
2139
|
+
path: path.join(outputBaseDir, idpUser.mapping.dataFile),
|
|
2140
|
+
content: "",
|
|
2141
|
+
skipIfExists: true
|
|
2142
|
+
});
|
|
2143
|
+
files.push({
|
|
2144
|
+
path: path.join(outputBaseDir, "data", `${idpUser.name}.schema.ts`),
|
|
2145
|
+
content: generateIdpUserSchemaFile(idpUser.schema.usernameField, idpUser.schema.userTypeName)
|
|
2146
|
+
});
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2034
2149
|
for (const [outputDir, dependencies] of Object.entries(entityDependencies)) {
|
|
2035
2150
|
files.push({
|
|
2036
2151
|
path: path.join(outputDir, "config.yaml"),
|
|
@@ -2039,9 +2154,8 @@ function createSeedGenerator(options) {
|
|
|
2039
2154
|
`
|
|
2040
2155
|
});
|
|
2041
2156
|
if (options.machineUserName) files.push({
|
|
2042
|
-
path: path.join(outputDir, "exec.
|
|
2043
|
-
content: generateExecScript(options.machineUserName, path.basename(outputDir))
|
|
2044
|
-
executable: true
|
|
2157
|
+
path: path.join(outputDir, "exec.mjs"),
|
|
2158
|
+
content: generateExecScript(options.machineUserName, path.basename(outputDir))
|
|
2045
2159
|
});
|
|
2046
2160
|
}
|
|
2047
2161
|
return { files };
|
|
@@ -6271,8 +6385,11 @@ var DependencyWatcher = class {
|
|
|
6271
6385
|
//#region src/cli/generator/index.ts
|
|
6272
6386
|
var GenerationManager = class {
|
|
6273
6387
|
application;
|
|
6274
|
-
|
|
6275
|
-
|
|
6388
|
+
services = {
|
|
6389
|
+
tailordb: {},
|
|
6390
|
+
resolver: {},
|
|
6391
|
+
executor: {}
|
|
6392
|
+
};
|
|
6276
6393
|
baseDir;
|
|
6277
6394
|
constructor(config, generators = [], configPath) {
|
|
6278
6395
|
this.generators = generators;
|
|
@@ -6285,45 +6402,39 @@ var GenerationManager = class {
|
|
|
6285
6402
|
console.log("");
|
|
6286
6403
|
console.log("Generation for application:", styleText("cyanBright", this.application.config.name));
|
|
6287
6404
|
console.log("");
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
};
|
|
6302
|
-
} catch (error) {
|
|
6303
|
-
console.error(styleText("red", "Error loading types for TailorDB service"), styleText("redBright", namespace));
|
|
6304
|
-
console.error(error);
|
|
6305
|
-
if (!watch) throw error;
|
|
6306
|
-
}
|
|
6405
|
+
const app = this.application;
|
|
6406
|
+
for (const db of app.tailorDBServices) {
|
|
6407
|
+
const namespace = db.namespace;
|
|
6408
|
+
try {
|
|
6409
|
+
await db.loadTypes();
|
|
6410
|
+
this.services.tailordb[namespace] = {
|
|
6411
|
+
types: db.getTypes(),
|
|
6412
|
+
sourceInfo: db.getTypeSourceInfo()
|
|
6413
|
+
};
|
|
6414
|
+
} catch (error) {
|
|
6415
|
+
console.error(styleText("red", "Error loading types for TailorDB service"), styleText("redBright", namespace));
|
|
6416
|
+
console.error(error);
|
|
6417
|
+
if (!watch) throw error;
|
|
6307
6418
|
}
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
}
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6419
|
+
}
|
|
6420
|
+
for (const resolverService of app.resolverServices) {
|
|
6421
|
+
const namespace = resolverService.namespace;
|
|
6422
|
+
try {
|
|
6423
|
+
await resolverService.loadResolvers();
|
|
6424
|
+
this.services.resolver[namespace] = {};
|
|
6425
|
+
Object.entries(resolverService.getResolvers()).forEach(([_, resolver]) => {
|
|
6426
|
+
this.services.resolver[namespace][resolver.name] = resolver;
|
|
6427
|
+
});
|
|
6428
|
+
} catch (error) {
|
|
6429
|
+
console.error(styleText("red", "Error loading resolvers for Resolver service"), styleText("redBright", namespace));
|
|
6430
|
+
console.error(error);
|
|
6431
|
+
if (!watch) throw error;
|
|
6321
6432
|
}
|
|
6322
|
-
if (app.authService) await app.authService.resolveNamespaces();
|
|
6323
6433
|
}
|
|
6434
|
+
if (app.authService) await app.authService.resolveNamespaces();
|
|
6324
6435
|
const executors = await this.application.executorService?.loadExecutors();
|
|
6325
6436
|
Object.entries(executors ?? {}).forEach(([filePath, executor]) => {
|
|
6326
|
-
this.
|
|
6437
|
+
this.services.executor[filePath] = executor;
|
|
6327
6438
|
});
|
|
6328
6439
|
await this.processGenerators();
|
|
6329
6440
|
}
|
|
@@ -6334,84 +6445,75 @@ var GenerationManager = class {
|
|
|
6334
6445
|
async processGenerator(gen) {
|
|
6335
6446
|
try {
|
|
6336
6447
|
this.generatorResults[gen.id] = {
|
|
6337
|
-
|
|
6448
|
+
tailordbResults: {},
|
|
6449
|
+
resolverResults: {},
|
|
6450
|
+
tailordbNamespaceResults: {},
|
|
6451
|
+
resolverNamespaceResults: {},
|
|
6338
6452
|
executorResults: {}
|
|
6339
6453
|
};
|
|
6340
|
-
for (const [
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
resolverResults: {},
|
|
6344
|
-
tailordbNamespaceResults: {},
|
|
6345
|
-
resolverNamespaceResults: {}
|
|
6346
|
-
};
|
|
6347
|
-
for (const [namespace, types] of Object.entries(appData.tailordbNamespaces)) await this.processTailorDBNamespace(gen, appNamespace, namespace, types);
|
|
6348
|
-
for (const [namespace, resolvers] of Object.entries(appData.resolverNamespaces)) await this.processResolverNamespace(gen, appNamespace, namespace, resolvers);
|
|
6349
|
-
await this.processExecutors(gen);
|
|
6350
|
-
}
|
|
6454
|
+
for (const [namespace, types] of Object.entries(this.services.tailordb)) await this.processTailorDBNamespace(gen, namespace, types);
|
|
6455
|
+
for (const [namespace, resolvers] of Object.entries(this.services.resolver)) await this.processResolverNamespace(gen, namespace, resolvers);
|
|
6456
|
+
await this.processExecutors(gen);
|
|
6351
6457
|
await this.aggregate(gen);
|
|
6352
6458
|
} catch (error) {
|
|
6353
6459
|
console.error(styleText("red", "Error processing generator"), styleText("redBright", gen.id));
|
|
6354
6460
|
console.error(error);
|
|
6355
6461
|
}
|
|
6356
6462
|
}
|
|
6357
|
-
async processTailorDBNamespace(gen,
|
|
6358
|
-
const results = this.generatorResults[gen.id]
|
|
6463
|
+
async processTailorDBNamespace(gen, namespace, typeInfo) {
|
|
6464
|
+
const results = this.generatorResults[gen.id];
|
|
6359
6465
|
results.tailordbResults[namespace] = {};
|
|
6360
6466
|
await Promise.allSettled(Object.entries(typeInfo.types).map(async ([typeName, type]) => {
|
|
6361
6467
|
try {
|
|
6362
6468
|
results.tailordbResults[namespace][typeName] = await gen.processType({
|
|
6363
6469
|
type,
|
|
6364
|
-
applicationNamespace: appNamespace,
|
|
6365
6470
|
namespace,
|
|
6366
6471
|
source: typeInfo.sourceInfo[typeName]
|
|
6367
6472
|
});
|
|
6368
6473
|
} catch (error) {
|
|
6369
|
-
console.error(styleText("red", `Error processing type`), styleText("redBright", typeName), styleText("red", `in ${
|
|
6474
|
+
console.error(styleText("red", `Error processing type`), styleText("redBright", typeName), styleText("red", `in ${namespace} with generator ${gen.id}`));
|
|
6370
6475
|
console.error(error);
|
|
6371
6476
|
}
|
|
6372
6477
|
}));
|
|
6373
6478
|
if (gen.processTailorDBNamespace) try {
|
|
6374
6479
|
results.tailordbNamespaceResults[namespace] = await gen.processTailorDBNamespace({
|
|
6375
|
-
applicationNamespace: appNamespace,
|
|
6376
6480
|
namespace,
|
|
6377
6481
|
types: results.tailordbResults[namespace]
|
|
6378
6482
|
});
|
|
6379
6483
|
} catch (error) {
|
|
6380
|
-
console.error(styleText("red", `Error processing TailorDB namespace`), styleText("redBright", namespace), styleText("red", `
|
|
6484
|
+
console.error(styleText("red", `Error processing TailorDB namespace`), styleText("redBright", namespace), styleText("red", `with generator ${gen.id}`));
|
|
6381
6485
|
console.error(error);
|
|
6382
6486
|
}
|
|
6383
6487
|
else results.tailordbNamespaceResults[namespace] = results.tailordbResults[namespace];
|
|
6384
6488
|
}
|
|
6385
|
-
async processResolverNamespace(gen,
|
|
6386
|
-
const results = this.generatorResults[gen.id]
|
|
6489
|
+
async processResolverNamespace(gen, namespace, resolvers) {
|
|
6490
|
+
const results = this.generatorResults[gen.id];
|
|
6387
6491
|
results.resolverResults[namespace] = {};
|
|
6388
6492
|
await Promise.allSettled(Object.entries(resolvers).map(async ([resolverName, resolver]) => {
|
|
6389
6493
|
try {
|
|
6390
6494
|
results.resolverResults[namespace][resolverName] = await gen.processResolver({
|
|
6391
6495
|
resolver,
|
|
6392
|
-
applicationNamespace: appNamespace,
|
|
6393
6496
|
namespace
|
|
6394
6497
|
});
|
|
6395
6498
|
} catch (error) {
|
|
6396
|
-
console.error(styleText("red", `Error processing resolver`), styleText("redBright", resolverName), styleText("red", `in ${
|
|
6499
|
+
console.error(styleText("red", `Error processing resolver`), styleText("redBright", resolverName), styleText("red", `in ${namespace} with generator ${gen.id}`));
|
|
6397
6500
|
console.error(error);
|
|
6398
6501
|
}
|
|
6399
6502
|
}));
|
|
6400
6503
|
if (gen.processResolverNamespace) try {
|
|
6401
6504
|
results.resolverNamespaceResults[namespace] = await gen.processResolverNamespace({
|
|
6402
|
-
applicationNamespace: appNamespace,
|
|
6403
6505
|
namespace,
|
|
6404
6506
|
resolvers: results.resolverResults[namespace]
|
|
6405
6507
|
});
|
|
6406
6508
|
} catch (error) {
|
|
6407
|
-
console.error(styleText("red", `Error processing Resolver namespace`), styleText("redBright", namespace), styleText("red", `
|
|
6509
|
+
console.error(styleText("red", `Error processing Resolver namespace`), styleText("redBright", namespace), styleText("red", `with generator ${gen.id}`));
|
|
6408
6510
|
console.error(error);
|
|
6409
6511
|
}
|
|
6410
6512
|
else results.resolverNamespaceResults[namespace] = results.resolverResults[namespace];
|
|
6411
6513
|
}
|
|
6412
6514
|
async processExecutors(gen) {
|
|
6413
6515
|
const results = this.generatorResults[gen.id];
|
|
6414
|
-
await Promise.allSettled(Object.entries(this.
|
|
6516
|
+
await Promise.allSettled(Object.entries(this.services.executor).map(async ([executorId, executor]) => {
|
|
6415
6517
|
try {
|
|
6416
6518
|
results.executorResults[executorId] = await gen.processExecutor(executor);
|
|
6417
6519
|
} catch (error) {
|
|
@@ -6420,28 +6522,42 @@ var GenerationManager = class {
|
|
|
6420
6522
|
}
|
|
6421
6523
|
}));
|
|
6422
6524
|
}
|
|
6525
|
+
getAuthInput() {
|
|
6526
|
+
const authService = this.application.authService;
|
|
6527
|
+
if (!authService) return void 0;
|
|
6528
|
+
const config = authService.config;
|
|
6529
|
+
return {
|
|
6530
|
+
name: config.name,
|
|
6531
|
+
userProfile: authService.userProfile ? {
|
|
6532
|
+
typeName: authService.userProfile.type.name,
|
|
6533
|
+
namespace: authService.userProfile.namespace,
|
|
6534
|
+
usernameField: authService.userProfile.usernameField
|
|
6535
|
+
} : void 0,
|
|
6536
|
+
machineUsers: config.machineUsers,
|
|
6537
|
+
oauth2Clients: config.oauth2Clients,
|
|
6538
|
+
idProvider: config.idProvider
|
|
6539
|
+
};
|
|
6540
|
+
}
|
|
6423
6541
|
async aggregate(gen) {
|
|
6424
|
-
const
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
});
|
|
6441
|
-
}
|
|
6542
|
+
const results = this.generatorResults[gen.id];
|
|
6543
|
+
const tailordbResults = [];
|
|
6544
|
+
const resolverResults = [];
|
|
6545
|
+
for (const [namespace, types] of Object.entries(results.tailordbNamespaceResults)) tailordbResults.push({
|
|
6546
|
+
namespace,
|
|
6547
|
+
types
|
|
6548
|
+
});
|
|
6549
|
+
for (const [namespace, resolvers] of Object.entries(results.resolverNamespaceResults)) resolverResults.push({
|
|
6550
|
+
namespace,
|
|
6551
|
+
resolvers
|
|
6552
|
+
});
|
|
6553
|
+
const input = {
|
|
6554
|
+
tailordb: tailordbResults,
|
|
6555
|
+
resolver: resolverResults,
|
|
6556
|
+
auth: this.getAuthInput()
|
|
6557
|
+
};
|
|
6442
6558
|
const result = await gen.aggregate({
|
|
6443
|
-
|
|
6444
|
-
executorInputs: Object.values(
|
|
6559
|
+
input,
|
|
6560
|
+
executorInputs: Object.values(results.executorResults),
|
|
6445
6561
|
baseDir: path.join(this.baseDir, gen.id)
|
|
6446
6562
|
});
|
|
6447
6563
|
await Promise.all(result.files.map(async (file) => {
|
|
@@ -6483,15 +6599,14 @@ var GenerationManager = class {
|
|
|
6483
6599
|
this.restartWatchProcess();
|
|
6484
6600
|
});
|
|
6485
6601
|
if (this.configPath) await this.watcher.addWatchGroup("Config", [this.configPath]);
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
}
|
|
6602
|
+
const app = this.application;
|
|
6603
|
+
for (const db of app.tailorDBServices) {
|
|
6604
|
+
const dbNamespace = db.namespace;
|
|
6605
|
+
await this.watcher?.addWatchGroup(`TailorDB/${dbNamespace}`, db.config.files);
|
|
6606
|
+
}
|
|
6607
|
+
for (const resolverService of app.resolverServices) {
|
|
6608
|
+
const resolverNamespace = resolverService.namespace;
|
|
6609
|
+
await this.watcher?.addWatchGroup(`Resolver/${resolverNamespace}`, resolverService["config"].files);
|
|
6495
6610
|
}
|
|
6496
6611
|
await new Promise(() => {});
|
|
6497
6612
|
}
|
|
@@ -7054,4 +7169,4 @@ const tokenCommand = defineCommand({
|
|
|
7054
7169
|
|
|
7055
7170
|
//#endregion
|
|
7056
7171
|
export { PATScope, apply, applyCommand, commonArgs, createCommand, deleteCommand, fetchAll, fetchLatestToken, fetchUserInfo, formatArgs, generate, generateCommand, generateUserTypes, initOAuth2Client, initOperatorClient, listCommand, listCommand$1, loadAccessToken, loadConfig, loadConfigPath, loadWorkspaceId, machineUserList, machineUserToken, parseFormat, printWithFormat, readPackageJson, readPlatformConfig, remove, removeCommand, show, showCommand, tokenCommand, withCommonArgs, workspaceCreate, workspaceDelete, workspaceList, writePlatformConfig };
|
|
7057
|
-
//# sourceMappingURL=token-
|
|
7172
|
+
//# sourceMappingURL=token-C2dypdqc.mjs.map
|