@tailor-platform/sdk 1.55.1 → 1.56.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 +20 -0
- package/dist/application-C9-t0qQb.mjs +4 -0
- package/dist/{application-DzUlASfA.mjs → application-YHZIkjdy.mjs} +160 -71
- package/dist/application-YHZIkjdy.mjs.map +1 -0
- package/dist/cli/index.mjs +5 -7
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +10 -10
- package/dist/cli/lib.mjs +3 -3
- package/dist/configure/index.d.mts +3 -3
- package/dist/configure/index.mjs +2 -8
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-BLsnrEtc.d.mts → index-BW3v5XYC.d.mts} +3 -3
- package/dist/{index-BE-fpxIo.d.mts → index-CPRnOjjt.d.mts} +2 -2
- package/dist/{index-S6-FtUpA.d.mts → index-CQZVJ5SX.d.mts} +2 -2
- package/dist/{index-D9xG-a6Y.d.mts → index-CfRFkXIO.d.mts} +2 -2
- package/dist/{index-cHqh66cF.d.mts → index-DUupuPhZ.d.mts} +2 -2
- 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-BuE5ZOnW.d.mts → plugin-C_FyVSdl.d.mts} +3 -3
- package/dist/{runtime-CgGeIoxi.mjs → runtime-B8F1nklz.mjs} +70 -30
- package/dist/runtime-B8F1nklz.mjs.map +1 -0
- package/dist/{seed-DfLyRh63.mjs → seed-C0fE2sJB.mjs} +5 -5
- package/dist/seed-C0fE2sJB.mjs.map +1 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-CQg1_Ami.d.mts → workflow.generated-BHdBzgx6.d.mts} +12 -2
- package/docs/configuration.md +12 -0
- package/docs/services/auth.md +11 -0
- package/package.json +1 -1
- package/dist/application-DM8q9GDI.mjs +0 -4
- package/dist/application-DzUlASfA.mjs.map +0 -1
- package/dist/runtime-CgGeIoxi.mjs.map +0 -1
- package/dist/seed-DfLyRh63.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.56.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1341](https://github.com/tailor-platform/sdk/pull/1341) [`64b07b4`](https://github.com/tailor-platform/sdk/commit/64b07b4c6f1db868abf2e1ebb9097e0e2f2f3cc6) Thanks [@dqn](https://github.com/dqn)! - Add a `logLevel` config option to remove lower-level `console.*` calls from bundled deployment functions.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#1345](https://github.com/tailor-platform/sdk/pull/1345) [`ec863f1`](https://github.com/tailor-platform/sdk/commit/ec863f13e7a3ca43e40ad413c1bbe47cd5567c95) Thanks [@dqn](https://github.com/dqn)! - Fix `seed --truncate` deleting only the first page of Built-In IdP `_User` records. The generated truncation script used incorrect pagination keys, so projects with more than one page of users were left with the remaining pages while the command still reported success. All pages are now deleted.
|
|
12
|
+
|
|
13
|
+
- [#1344](https://github.com/tailor-platform/sdk/pull/1344) [`d3f22da`](https://github.com/tailor-platform/sdk/commit/d3f22da5a9bcd44ca9659ac35a68a20a2cbc1c2a) Thanks [@dqn](https://github.com/dqn)! - Fix CLI auth config losing keyring-stored logins. Running any command without `TAILOR_USE_KEYRING` no longer downgrades `config.yaml` in a way that drops `storage: keyring` users (and dangles their `current_user` reference), which previously logged keyring users out. Configs containing keyring users now stay in V2 format; file-only configs still downgrade to V1 for backward compatibility.
|
|
14
|
+
|
|
15
|
+
## 1.55.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#1190](https://github.com/tailor-platform/sdk/pull/1190) [`6f891e8`](https://github.com/tailor-platform/sdk/commit/6f891e8a0f948ca2b58bb7e1d4ad19efc31cc38c) Thanks [@toiroakr](https://github.com/toiroakr)! - Validate auth service configuration during `deploy` / `generate`, consistent with how IdP, TailorDB, and static websites are already handled. Configs that set both `userProfile` and `machineUserAttributes` now fail with a clearer message: "Specify either `userProfile` or `machineUserAttributes`, not both."
|
|
20
|
+
|
|
21
|
+
- [#1332](https://github.com/tailor-platform/sdk/pull/1332) [`aa898b7`](https://github.com/tailor-platform/sdk/commit/aa898b7f369c441077973848a92a09152f6bed4f) Thanks [@dqn](https://github.com/dqn)! - Fix `executor get --json` to include typed event trigger metadata such as event types, namespaces, target names, and conditions.
|
|
22
|
+
|
|
3
23
|
## 1.55.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -6,7 +6,7 @@ import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-
|
|
|
6
6
|
import { t as multiline } from "./multiline-Cf9ODpr1.mjs";
|
|
7
7
|
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-BHPxPXmn.mjs";
|
|
8
8
|
import { n as kyselyTypePlugin, t as KyselyGeneratorID } from "./kysely-type-D1e0Vwkd.mjs";
|
|
9
|
-
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-
|
|
9
|
+
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-C0fE2sJB.mjs";
|
|
10
10
|
import { t as readPackageJson } from "./package-json-DcQApfPQ.mjs";
|
|
11
11
|
import { n as tightenSecretFilePermissions, r as writeSecretFile } from "./secret-file-CWzF8rry.mjs";
|
|
12
12
|
import { builtinModules, createRequire } from "node:module";
|
|
@@ -30,12 +30,27 @@ import * as inflection from "inflection";
|
|
|
30
30
|
import * as globals from "globals";
|
|
31
31
|
import pLimit from "p-limit";
|
|
32
32
|
|
|
33
|
+
//#region src/parser/app-config/log-level.ts
|
|
34
|
+
const LOG_LEVELS = [
|
|
35
|
+
"DEBUG",
|
|
36
|
+
"INFO",
|
|
37
|
+
"WARN",
|
|
38
|
+
"ERROR",
|
|
39
|
+
"SILENT"
|
|
40
|
+
];
|
|
41
|
+
function isLogLevel(value) {
|
|
42
|
+
return LOG_LEVELS.includes(value);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
33
46
|
//#region src/parser/app-config/schema.ts
|
|
34
47
|
const envValueSchema = z.union([
|
|
35
48
|
z.string(),
|
|
36
49
|
z.number(),
|
|
37
50
|
z.boolean()
|
|
38
51
|
]);
|
|
52
|
+
const LogLevelSchema = z.enum(LOG_LEVELS);
|
|
53
|
+
const logLevelSchema = z.string().refine((value) => LogLevelSchema.safeParse(value.trim().toUpperCase()).success, { message: `'logLevel' must be one of: ${LOG_LEVELS.join(", ")}.` });
|
|
39
54
|
/**
|
|
40
55
|
* Structural validation schema for `defineConfig({...})`. Validates only
|
|
41
56
|
* top-level fields with platform-side constraints (notably `id`); fields
|
|
@@ -55,6 +70,7 @@ const AppConfigSchema = z.object({
|
|
|
55
70
|
allowedIpAddresses: z.array(z.string()).optional(),
|
|
56
71
|
disableIntrospection: z.boolean().optional(),
|
|
57
72
|
inlineSourcemap: z.boolean().optional(),
|
|
73
|
+
logLevel: logLevelSchema.optional(),
|
|
58
74
|
db: z.unknown().optional(),
|
|
59
75
|
resolver: z.unknown().optional(),
|
|
60
76
|
idp: z.unknown().optional(),
|
|
@@ -329,17 +345,23 @@ function toV1ForDisk(config) {
|
|
|
329
345
|
token_expires_at: entry.token_expires_at
|
|
330
346
|
};
|
|
331
347
|
}
|
|
348
|
+
const currentUser = config.current_user && users[config.current_user] ? config.current_user : null;
|
|
332
349
|
return {
|
|
333
350
|
version: 1,
|
|
334
351
|
users,
|
|
335
352
|
profiles: config.profiles,
|
|
336
|
-
current_user:
|
|
353
|
+
current_user: currentUser
|
|
337
354
|
};
|
|
338
355
|
}
|
|
339
356
|
/**
|
|
340
357
|
* Write Tailor Platform CLI configuration to disk.
|
|
341
|
-
* By default, V2 configs are converted to V1 for backward compatibility
|
|
342
|
-
*
|
|
358
|
+
* By default, V2 configs are converted to V1 for backward compatibility, so an
|
|
359
|
+
* older SDK can still read the file. Configs containing a keyring user are kept
|
|
360
|
+
* as V2 regardless, because the keyring storage variant is not representable in
|
|
361
|
+
* V1 and downgrading it would silently drop the user's login. Such configs are
|
|
362
|
+
* already V2 on disk (a keyring entry is only ever persisted with
|
|
363
|
+
* TAILOR_USE_KEYRING set), so keeping V2 does not regress backward compatibility.
|
|
364
|
+
* Set TAILOR_USE_KEYRING to write V2 format unconditionally.
|
|
343
365
|
*
|
|
344
366
|
* The config file may contain access/refresh tokens when the OS keyring is
|
|
345
367
|
* unavailable, so it is written via {@link writeSecretFile} so other users
|
|
@@ -347,7 +369,9 @@ function toV1ForDisk(config) {
|
|
|
347
369
|
* @param config - Platform configuration to write
|
|
348
370
|
*/
|
|
349
371
|
function writePlatformConfig(config) {
|
|
350
|
-
|
|
372
|
+
const configPath = platformConfigPath();
|
|
373
|
+
const hasKeyringUser = config.version === 2 && Object.values(config.users).some((u) => u?.storage === "keyring");
|
|
374
|
+
writeSecretFile(configPath, stringifyYAML(config.version === 2 && !process.env.TAILOR_USE_KEYRING && !hasKeyringUser ? toV1ForDisk(config) : config));
|
|
351
375
|
}
|
|
352
376
|
const tcContextConfigSchema = z.object({
|
|
353
377
|
username: z.string().optional(),
|
|
@@ -733,14 +757,14 @@ function combineHash(fileHash, contextHash) {
|
|
|
733
757
|
* Compute a context hash for cache invalidation across bundlers.
|
|
734
758
|
*
|
|
735
759
|
* Combines the source file path, serialized trigger context, tsconfig hash,
|
|
736
|
-
* sourcemap mode, and an optional prefix (e.g., serialized
|
|
737
|
-
* into a single SHA-256 hash.
|
|
760
|
+
* sourcemap mode, bundle log level, and an optional prefix (e.g., serialized
|
|
761
|
+
* env variables) into a single SHA-256 hash.
|
|
738
762
|
* @param params - Context hash computation parameters
|
|
739
763
|
* @returns SHA-256 hex digest of the combined context
|
|
740
764
|
*/
|
|
741
765
|
function computeBundlerContextHash(params) {
|
|
742
|
-
const { sourceFile, serializedTriggerContext, tsconfig, inlineSourcemap, prefix } = params;
|
|
743
|
-
return hashContent((prefix ?? "") + path.resolve(sourceFile) + serializedTriggerContext + (tsconfig ? hashFile(tsconfig) : "") + String(inlineSourcemap ?? false));
|
|
766
|
+
const { sourceFile, serializedTriggerContext, tsconfig, inlineSourcemap, bundleLogLevel, prefix } = params;
|
|
767
|
+
return hashContent((prefix ?? "") + path.resolve(sourceFile) + serializedTriggerContext + (tsconfig ? hashFile(tsconfig) : "") + String(inlineSourcemap ?? false) + (bundleLogLevel ?? ""));
|
|
744
768
|
}
|
|
745
769
|
/**
|
|
746
770
|
* Run a build with optional cache restore/save around it.
|
|
@@ -1359,6 +1383,83 @@ async function removeStaleEntryFiles(outputDir) {
|
|
|
1359
1383
|
await Promise.all(files.filter((file) => file.endsWith(".entry.js")).map((file) => fs.rm(path.join(outputDir, file), { force: true })));
|
|
1360
1384
|
}
|
|
1361
1385
|
|
|
1386
|
+
//#endregion
|
|
1387
|
+
//#region src/cli/shared/bundle-log-level.ts
|
|
1388
|
+
const INFO_LEVEL_CONSOLE_METHODS = [
|
|
1389
|
+
"console.log",
|
|
1390
|
+
"console.info",
|
|
1391
|
+
"console.table",
|
|
1392
|
+
"console.dir",
|
|
1393
|
+
"console.dirxml",
|
|
1394
|
+
"console.count",
|
|
1395
|
+
"console.countReset",
|
|
1396
|
+
"console.time",
|
|
1397
|
+
"console.timeLog",
|
|
1398
|
+
"console.timeEnd",
|
|
1399
|
+
"console.group",
|
|
1400
|
+
"console.groupCollapsed",
|
|
1401
|
+
"console.groupEnd",
|
|
1402
|
+
"console.clear"
|
|
1403
|
+
];
|
|
1404
|
+
const DEBUG_LEVEL_CONSOLE_METHODS = ["console.debug", "console.trace"];
|
|
1405
|
+
const WARN_LEVEL_CONSOLE_METHODS = ["console.warn"];
|
|
1406
|
+
const ERROR_LEVEL_CONSOLE_METHODS = ["console.error"];
|
|
1407
|
+
const MANUAL_PURE_FUNCTIONS_BY_LOG_LEVEL = {
|
|
1408
|
+
DEBUG: [],
|
|
1409
|
+
INFO: DEBUG_LEVEL_CONSOLE_METHODS,
|
|
1410
|
+
WARN: [...DEBUG_LEVEL_CONSOLE_METHODS, ...INFO_LEVEL_CONSOLE_METHODS],
|
|
1411
|
+
ERROR: [
|
|
1412
|
+
...DEBUG_LEVEL_CONSOLE_METHODS,
|
|
1413
|
+
...INFO_LEVEL_CONSOLE_METHODS,
|
|
1414
|
+
...WARN_LEVEL_CONSOLE_METHODS
|
|
1415
|
+
],
|
|
1416
|
+
SILENT: [
|
|
1417
|
+
...DEBUG_LEVEL_CONSOLE_METHODS,
|
|
1418
|
+
...INFO_LEVEL_CONSOLE_METHODS,
|
|
1419
|
+
...WARN_LEVEL_CONSOLE_METHODS,
|
|
1420
|
+
...ERROR_LEVEL_CONSOLE_METHODS
|
|
1421
|
+
]
|
|
1422
|
+
};
|
|
1423
|
+
function normalizeBundleLogLevel(value) {
|
|
1424
|
+
const normalized = value.trim().toUpperCase();
|
|
1425
|
+
return isLogLevel(normalized) ? normalized : void 0;
|
|
1426
|
+
}
|
|
1427
|
+
function resolveBundleLogLevel(configValue) {
|
|
1428
|
+
if (configValue === void 0) return "DEBUG";
|
|
1429
|
+
const resolved = normalizeBundleLogLevel(configValue);
|
|
1430
|
+
if (resolved) return resolved;
|
|
1431
|
+
throw new Error(`Invalid logLevel "${configValue}". Expected one of: ${LOG_LEVELS.join(", ")}`);
|
|
1432
|
+
}
|
|
1433
|
+
function manualPureFunctionsForLogLevel(logLevel) {
|
|
1434
|
+
return MANUAL_PURE_FUNCTIONS_BY_LOG_LEVEL[logLevel];
|
|
1435
|
+
}
|
|
1436
|
+
function createLogLevelTreeshakeOptions(logLevel) {
|
|
1437
|
+
const manualPureFunctions = manualPureFunctionsForLogLevel(logLevel);
|
|
1438
|
+
return manualPureFunctions.length > 0 ? { manualPureFunctions } : {};
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
//#endregion
|
|
1442
|
+
//#region src/cli/shared/function-treeshake.ts
|
|
1443
|
+
const BASE_FUNCTION_TREESHAKE_OPTIONS = {
|
|
1444
|
+
moduleSideEffects: false,
|
|
1445
|
+
annotations: true,
|
|
1446
|
+
unknownGlobalSideEffects: false
|
|
1447
|
+
};
|
|
1448
|
+
function mergeFunctionTreeshakeOptions(fragments) {
|
|
1449
|
+
const merged = {};
|
|
1450
|
+
const manualPureFunctions = /* @__PURE__ */ new Set();
|
|
1451
|
+
for (const fragment of fragments) {
|
|
1452
|
+
Object.assign(merged, fragment);
|
|
1453
|
+
for (const name of fragment.manualPureFunctions ?? []) manualPureFunctions.add(name);
|
|
1454
|
+
}
|
|
1455
|
+
if (manualPureFunctions.size > 0) merged.manualPureFunctions = [...manualPureFunctions];
|
|
1456
|
+
else delete merged.manualPureFunctions;
|
|
1457
|
+
return merged;
|
|
1458
|
+
}
|
|
1459
|
+
function composeFunctionTreeshakeOptions(fragments = []) {
|
|
1460
|
+
return mergeFunctionTreeshakeOptions([BASE_FUNCTION_TREESHAKE_OPTIONS, ...fragments]);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1362
1463
|
//#endregion
|
|
1363
1464
|
//#region src/cli/services/file-loader.ts
|
|
1364
1465
|
const DEFAULT_IGNORE_PATTERNS = ["**/*.test.ts", "**/*.spec.ts"];
|
|
@@ -2193,7 +2294,7 @@ function createTriggerTransformPlugin(triggerContext) {
|
|
|
2193
2294
|
* @returns Map of function name to bundled code
|
|
2194
2295
|
*/
|
|
2195
2296
|
async function bundleAuthHooks(options) {
|
|
2196
|
-
const { configPath, authName, handlerAccessPath, env = {}, triggerContext, cache, inlineSourcemap } = options;
|
|
2297
|
+
const { configPath, authName, handlerAccessPath, env = {}, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG" } = options;
|
|
2197
2298
|
logger.newline();
|
|
2198
2299
|
logger.log(`Bundling auth hook for ${styles.info(`"${authName}"`)}`);
|
|
2199
2300
|
const outputDir = path.resolve(getDistDir(), "auth-hooks");
|
|
@@ -2219,6 +2320,7 @@ async function bundleAuthHooks(options) {
|
|
|
2219
2320
|
serializedTriggerContext,
|
|
2220
2321
|
tsconfig,
|
|
2221
2322
|
inlineSourcemap,
|
|
2323
|
+
bundleLogLevel,
|
|
2222
2324
|
prefix: sortedEnvPrefix
|
|
2223
2325
|
}),
|
|
2224
2326
|
async build(cachePlugins) {
|
|
@@ -2246,11 +2348,8 @@ async function bundleAuthHooks(options) {
|
|
|
2246
2348
|
},
|
|
2247
2349
|
tsconfig,
|
|
2248
2350
|
plugins,
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
annotations: true,
|
|
2252
|
-
unknownGlobalSideEffects: false
|
|
2253
|
-
},
|
|
2351
|
+
transform: { define: { "process.env.LOG_LEVEL": JSON.stringify(bundleLogLevel) } },
|
|
2352
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
2254
2353
|
logLevel: "silent"
|
|
2255
2354
|
})).output[0].code;
|
|
2256
2355
|
}
|
|
@@ -3651,6 +3750,7 @@ const TenantProviderSchema = z.object({
|
|
|
3651
3750
|
signatureField: z.string().describe("Field used as the tenant signature")
|
|
3652
3751
|
});
|
|
3653
3752
|
const UserProfileSchema = z.object({
|
|
3753
|
+
namespace: z.string().optional().describe("TailorDB namespace where the user type is defined"),
|
|
3654
3754
|
type: z.object({
|
|
3655
3755
|
name: z.string(),
|
|
3656
3756
|
fields: z.any(),
|
|
@@ -3693,16 +3793,17 @@ const AuthConfigBaseSchema = z.object({
|
|
|
3693
3793
|
connections: z.record(z.string(), AuthConnectionConfigSchema).optional().describe("Auth connection definitions for external OAuth2 providers"),
|
|
3694
3794
|
publishSessionEvents: z.boolean().optional().describe("Enable publishing session events")
|
|
3695
3795
|
});
|
|
3696
|
-
const AuthConfigSchema = z.
|
|
3697
|
-
userProfile:
|
|
3698
|
-
machineUserAttributes: z.undefined().optional()
|
|
3699
|
-
}), z.xor([AuthConfigBaseSchema.extend({
|
|
3700
|
-
userProfile: UserProfileSchema,
|
|
3796
|
+
const AuthConfigSchema = z.xor([AuthConfigBaseSchema.extend({
|
|
3797
|
+
userProfile: UserProfileSchema.optional().describe("User profile configuration"),
|
|
3701
3798
|
machineUserAttributes: z.undefined().optional()
|
|
3702
3799
|
}), AuthConfigBaseSchema.extend({
|
|
3703
3800
|
userProfile: z.undefined().optional(),
|
|
3704
|
-
machineUserAttributes: z.record(z.string(), TailorFieldSchema)
|
|
3705
|
-
})]
|
|
3801
|
+
machineUserAttributes: z.record(z.string(), TailorFieldSchema).describe("Machine user attribute fields")
|
|
3802
|
+
})], { error: (iss) => {
|
|
3803
|
+
if (iss.code !== "invalid_union") return void 0;
|
|
3804
|
+
if (iss.errors.length < 2) return void 0;
|
|
3805
|
+
if (iss.errors.every((variantErrors) => variantErrors.every((e) => e.path.length === 1 && (e.path[0] === "userProfile" || e.path[0] === "machineUserAttributes")))) return "Specify either `userProfile` or `machineUserAttributes`, not both.";
|
|
3806
|
+
} }).brand("AuthConfig");
|
|
3706
3807
|
|
|
3707
3808
|
//#endregion
|
|
3708
3809
|
//#region src/cli/services/auth/service.ts
|
|
@@ -3714,18 +3815,12 @@ const AuthConfigSchema = z.union([AuthConfigBaseSchema.extend({
|
|
|
3714
3815
|
* @returns A new AuthService instance
|
|
3715
3816
|
*/
|
|
3716
3817
|
function createAuthService(config, tailorDBServices, externalTailorDBNamespaces) {
|
|
3717
|
-
const
|
|
3718
|
-
...config,
|
|
3719
|
-
idProvider: IdProviderSchema.optional().parse(config.idProvider)
|
|
3720
|
-
};
|
|
3721
|
-
const connections = {};
|
|
3722
|
-
if (config.connections) for (const [name, connConfig] of Object.entries(config.connections)) connections[name] = AuthConnectionConfigSchema.parse(connConfig);
|
|
3818
|
+
const connections = config.connections ? { ...config.connections } : {};
|
|
3723
3819
|
let userProfile;
|
|
3724
3820
|
return {
|
|
3725
3821
|
config,
|
|
3726
3822
|
tailorDBServices,
|
|
3727
3823
|
externalTailorDBNamespaces,
|
|
3728
|
-
parsedConfig,
|
|
3729
3824
|
connections,
|
|
3730
3825
|
get userProfile() {
|
|
3731
3826
|
return userProfile;
|
|
@@ -4000,7 +4095,7 @@ async function loadExecutor(executorFilePath) {
|
|
|
4000
4095
|
*/
|
|
4001
4096
|
async function bundleExecutors(options) {
|
|
4002
4097
|
const bundledCode = /* @__PURE__ */ new Map();
|
|
4003
|
-
const { config, triggerContext, additionalFiles = [], cache, inlineSourcemap } = options;
|
|
4098
|
+
const { config, triggerContext, additionalFiles = [], cache, inlineSourcemap, bundleLogLevel = "DEBUG" } = options;
|
|
4004
4099
|
const files = [...loadFilesWithIgnores(config), ...additionalFiles];
|
|
4005
4100
|
if (files.length === 0) {
|
|
4006
4101
|
logger.warn(`No executor files found for patterns: ${config.files?.join(", ") ?? "(none)"}`);
|
|
@@ -4037,18 +4132,19 @@ async function bundleExecutors(options) {
|
|
|
4037
4132
|
} catch {
|
|
4038
4133
|
tsconfig = void 0;
|
|
4039
4134
|
}
|
|
4040
|
-
const results = await withBundleConcurrency(executors, (executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap));
|
|
4135
|
+
const results = await withBundleConcurrency(executors, (executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel));
|
|
4041
4136
|
for (const [name, code] of results) bundledCode.set(name, code);
|
|
4042
4137
|
logger.log(`${styles.success("Bundled")} ${styles.info("\"executor\"")}`);
|
|
4043
4138
|
return bundledCode;
|
|
4044
4139
|
}
|
|
4045
|
-
async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
|
|
4140
|
+
async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4046
4141
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
4047
4142
|
const contextHash = computeBundlerContextHash({
|
|
4048
4143
|
sourceFile: executor.sourceFile,
|
|
4049
4144
|
serializedTriggerContext,
|
|
4050
4145
|
tsconfig,
|
|
4051
|
-
inlineSourcemap
|
|
4146
|
+
inlineSourcemap,
|
|
4147
|
+
bundleLogLevel
|
|
4052
4148
|
});
|
|
4053
4149
|
const code = await withCache({
|
|
4054
4150
|
cache,
|
|
@@ -4083,11 +4179,7 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
|
|
|
4083
4179
|
},
|
|
4084
4180
|
tsconfig,
|
|
4085
4181
|
plugins,
|
|
4086
|
-
treeshake:
|
|
4087
|
-
moduleSideEffects: false,
|
|
4088
|
-
annotations: true,
|
|
4089
|
-
unknownGlobalSideEffects: false
|
|
4090
|
-
},
|
|
4182
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
4091
4183
|
logLevel: "silent"
|
|
4092
4184
|
})).output[0].code;
|
|
4093
4185
|
}
|
|
@@ -4214,9 +4306,10 @@ const ADAPTER_BUNDLE_ERROR_BYTES = 256 * 1024;
|
|
|
4214
4306
|
* generated dispatcher that routes by `req.method`; `output` is used as is.
|
|
4215
4307
|
* @param adapters - Detected adapters to bundle
|
|
4216
4308
|
* @param cache - Optional bundle cache for skipping unchanged builds
|
|
4309
|
+
* @param bundleLogLevel - Controls which console calls are kept in bundled code
|
|
4217
4310
|
* @returns Bundled scripts keyed by adapter name
|
|
4218
4311
|
*/
|
|
4219
|
-
async function bundleHttpAdapters(adapters, cache) {
|
|
4312
|
+
async function bundleHttpAdapters(adapters, cache, bundleLogLevel = "DEBUG") {
|
|
4220
4313
|
if (adapters.length === 0) return {
|
|
4221
4314
|
bundledInputs: /* @__PURE__ */ new Map(),
|
|
4222
4315
|
bundledOutputs: /* @__PURE__ */ new Map()
|
|
@@ -4236,7 +4329,7 @@ async function bundleHttpAdapters(adapters, cache) {
|
|
|
4236
4329
|
adapter,
|
|
4237
4330
|
kind
|
|
4238
4331
|
}));
|
|
4239
|
-
}), ({ adapter, kind }) => bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache));
|
|
4332
|
+
}), ({ adapter, kind }) => bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache, bundleLogLevel));
|
|
4240
4333
|
const bundledInputs = /* @__PURE__ */ new Map();
|
|
4241
4334
|
const bundledOutputs = /* @__PURE__ */ new Map();
|
|
4242
4335
|
for (const [name, kind, code] of results) if (kind === "input") bundledInputs.set(name, code);
|
|
@@ -4247,12 +4340,13 @@ async function bundleHttpAdapters(adapters, cache) {
|
|
|
4247
4340
|
bundledOutputs
|
|
4248
4341
|
};
|
|
4249
4342
|
}
|
|
4250
|
-
async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache) {
|
|
4343
|
+
async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache, bundleLogLevel = "DEBUG") {
|
|
4251
4344
|
const contextHash = computeBundlerContextHash({
|
|
4252
4345
|
sourceFile: adapter.sourceFile,
|
|
4253
4346
|
serializedTriggerContext: kind === "input" ? adapter.methods.join(",") : "",
|
|
4254
4347
|
tsconfig,
|
|
4255
4348
|
inlineSourcemap: false,
|
|
4349
|
+
bundleLogLevel,
|
|
4256
4350
|
prefix: kind
|
|
4257
4351
|
});
|
|
4258
4352
|
const code = await withCache({
|
|
@@ -4304,11 +4398,7 @@ async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache) {
|
|
|
4304
4398
|
tsconfig,
|
|
4305
4399
|
plugins,
|
|
4306
4400
|
transform: { target: "es2017" },
|
|
4307
|
-
treeshake:
|
|
4308
|
-
moduleSideEffects: false,
|
|
4309
|
-
annotations: true,
|
|
4310
|
-
unknownGlobalSideEffects: false
|
|
4311
|
-
},
|
|
4401
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
4312
4402
|
logLevel: "silent"
|
|
4313
4403
|
})).output[0].code;
|
|
4314
4404
|
} finally {
|
|
@@ -4511,9 +4601,10 @@ async function loadResolver(resolverFilePath) {
|
|
|
4511
4601
|
* @param triggerContext - Trigger context for workflow/job transformations
|
|
4512
4602
|
* @param cache - Optional bundle cache for skipping unchanged builds
|
|
4513
4603
|
* @param inlineSourcemap - Whether to enable inline sourcemaps
|
|
4604
|
+
* @param bundleLogLevel - Controls which console calls are kept in bundled code
|
|
4514
4605
|
* @returns Map of resolver name to bundled code
|
|
4515
4606
|
*/
|
|
4516
|
-
async function bundleResolvers(namespace, config, triggerContext, cache, inlineSourcemap) {
|
|
4607
|
+
async function bundleResolvers(namespace, config, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4517
4608
|
const bundledCode = /* @__PURE__ */ new Map();
|
|
4518
4609
|
const files = loadFilesWithIgnores(config);
|
|
4519
4610
|
if (files.length === 0) {
|
|
@@ -4543,18 +4634,19 @@ async function bundleResolvers(namespace, config, triggerContext, cache, inlineS
|
|
|
4543
4634
|
} catch {
|
|
4544
4635
|
tsconfig = void 0;
|
|
4545
4636
|
}
|
|
4546
|
-
const results = await withBundleConcurrency(resolvers, (resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap));
|
|
4637
|
+
const results = await withBundleConcurrency(resolvers, (resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel));
|
|
4547
4638
|
for (const [name, code] of results) bundledCode.set(name, code);
|
|
4548
4639
|
logger.log(`${styles.success("Bundled")} ${styles.info(`"${namespace}"`)}`);
|
|
4549
4640
|
return bundledCode;
|
|
4550
4641
|
}
|
|
4551
|
-
async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
|
|
4642
|
+
async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4552
4643
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
4553
4644
|
const contextHash = computeBundlerContextHash({
|
|
4554
4645
|
sourceFile: resolver.sourceFile,
|
|
4555
4646
|
serializedTriggerContext,
|
|
4556
4647
|
tsconfig,
|
|
4557
|
-
inlineSourcemap
|
|
4648
|
+
inlineSourcemap,
|
|
4649
|
+
bundleLogLevel
|
|
4558
4650
|
});
|
|
4559
4651
|
const code = await withCache({
|
|
4560
4652
|
cache,
|
|
@@ -4605,11 +4697,7 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
|
|
|
4605
4697
|
},
|
|
4606
4698
|
tsconfig,
|
|
4607
4699
|
plugins,
|
|
4608
|
-
treeshake:
|
|
4609
|
-
moduleSideEffects: false,
|
|
4610
|
-
annotations: true,
|
|
4611
|
-
unknownGlobalSideEffects: false
|
|
4612
|
-
},
|
|
4700
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
4613
4701
|
logLevel: "silent"
|
|
4614
4702
|
})).output[0].code;
|
|
4615
4703
|
}
|
|
@@ -4840,9 +4928,10 @@ function safeRealpath(p) {
|
|
|
4840
4928
|
* @param triggerContext - Trigger context for transformations
|
|
4841
4929
|
* @param cache - Optional bundle cache for skipping unchanged builds
|
|
4842
4930
|
* @param inlineSourcemap - Whether to enable inline sourcemaps
|
|
4931
|
+
* @param bundleLogLevel - Controls which console calls are kept in bundled code
|
|
4843
4932
|
* @returns Workflow job bundling result
|
|
4844
4933
|
*/
|
|
4845
|
-
async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContext, cache, inlineSourcemap) {
|
|
4934
|
+
async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4846
4935
|
if (allJobs.length === 0) {
|
|
4847
4936
|
logger.warn("No workflow jobs to bundle");
|
|
4848
4937
|
return {
|
|
@@ -4866,7 +4955,7 @@ async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContex
|
|
|
4866
4955
|
} catch {
|
|
4867
4956
|
tsconfig = void 0;
|
|
4868
4957
|
}
|
|
4869
|
-
const results = await withBundleConcurrency(usedJobs, (job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap));
|
|
4958
|
+
const results = await withBundleConcurrency(usedJobs, (job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap, bundleLogLevel));
|
|
4870
4959
|
const bundledCode = /* @__PURE__ */ new Map();
|
|
4871
4960
|
for (const [name, code] of results) bundledCode.set(name, code);
|
|
4872
4961
|
logger.log(`${styles.success("Bundled")} ${styles.info("\"workflow-job\"")}`);
|
|
@@ -4948,7 +5037,7 @@ async function filterUsedJobs(allJobs, mainJobNames) {
|
|
|
4948
5037
|
mainJobDeps
|
|
4949
5038
|
};
|
|
4950
5039
|
}
|
|
4951
|
-
async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap) {
|
|
5040
|
+
async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4952
5041
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
4953
5042
|
const sortedEnvPrefix = JSON.stringify(Object.fromEntries(Object.entries(env).sort(([a], [b]) => a.localeCompare(b))));
|
|
4954
5043
|
const contextHash = computeBundlerContextHash({
|
|
@@ -4956,6 +5045,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
4956
5045
|
serializedTriggerContext,
|
|
4957
5046
|
tsconfig,
|
|
4958
5047
|
inlineSourcemap,
|
|
5048
|
+
bundleLogLevel,
|
|
4959
5049
|
prefix: sortedEnvPrefix
|
|
4960
5050
|
});
|
|
4961
5051
|
const code = await withCache({
|
|
@@ -5006,11 +5096,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
5006
5096
|
},
|
|
5007
5097
|
tsconfig,
|
|
5008
5098
|
plugins,
|
|
5009
|
-
treeshake:
|
|
5010
|
-
moduleSideEffects: false,
|
|
5011
|
-
annotations: true,
|
|
5012
|
-
unknownGlobalSideEffects: false
|
|
5013
|
-
},
|
|
5099
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
5014
5100
|
logLevel: "silent"
|
|
5015
5101
|
})).output[0].code;
|
|
5016
5102
|
}
|
|
@@ -5473,7 +5559,7 @@ function defineAuth(config, tailorDBServices, externalTailorDBNamespaces) {
|
|
|
5473
5559
|
subgraphs
|
|
5474
5560
|
};
|
|
5475
5561
|
let authService;
|
|
5476
|
-
if (!("external" in config)) authService = createAuthService(config, tailorDBServices, externalTailorDBNamespaces);
|
|
5562
|
+
if (!("external" in config)) authService = createAuthService(AuthConfigSchema.parse(config), tailorDBServices, externalTailorDBNamespaces);
|
|
5477
5563
|
subgraphs.push({
|
|
5478
5564
|
Type: "auth",
|
|
5479
5565
|
Name: config.name
|
|
@@ -5644,6 +5730,7 @@ async function loadApplication(params) {
|
|
|
5644
5730
|
if (httpAdapterService) await httpAdapterService.loadAdapters();
|
|
5645
5731
|
const triggerContext = await buildTriggerContext(config.workflow, authResult.authService?.config.name);
|
|
5646
5732
|
const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
|
|
5733
|
+
const bundleLogLevel = resolveBundleLogLevel(config.logLevel);
|
|
5647
5734
|
const bundledScripts = {
|
|
5648
5735
|
resolvers: /* @__PURE__ */ new Map(),
|
|
5649
5736
|
executors: /* @__PURE__ */ new Map(),
|
|
@@ -5651,7 +5738,7 @@ async function loadApplication(params) {
|
|
|
5651
5738
|
authHooks: /* @__PURE__ */ new Map()
|
|
5652
5739
|
};
|
|
5653
5740
|
for (const pipeline of resolverResult.resolverServices) {
|
|
5654
|
-
const resolverBundles = await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap);
|
|
5741
|
+
const resolverBundles = await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap, bundleLogLevel);
|
|
5655
5742
|
for (const [name, code] of resolverBundles) bundledScripts.resolvers.set(name, code);
|
|
5656
5743
|
}
|
|
5657
5744
|
if (executorService) bundledScripts.executors = await bundleExecutors({
|
|
@@ -5659,12 +5746,13 @@ async function loadApplication(params) {
|
|
|
5659
5746
|
triggerContext,
|
|
5660
5747
|
additionalFiles: [...pluginExecutorFiles],
|
|
5661
5748
|
cache: bundleCache,
|
|
5662
|
-
inlineSourcemap
|
|
5749
|
+
inlineSourcemap,
|
|
5750
|
+
bundleLogLevel
|
|
5663
5751
|
});
|
|
5664
5752
|
let workflowBuildResult;
|
|
5665
5753
|
if (workflowService && workflowService.jobs.length > 0) {
|
|
5666
5754
|
const mainJobNames = workflowService.workflowSources.map((ws) => ws.workflow.mainJob.name);
|
|
5667
|
-
workflowBuildResult = await bundleWorkflowJobs(workflowService.jobs, mainJobNames, config.env ?? {}, triggerContext, bundleCache, inlineSourcemap);
|
|
5755
|
+
workflowBuildResult = await bundleWorkflowJobs(workflowService.jobs, mainJobNames, config.env ?? {}, triggerContext, bundleCache, inlineSourcemap, bundleLogLevel);
|
|
5668
5756
|
bundledScripts.workflowJobs = workflowBuildResult.bundledCode;
|
|
5669
5757
|
}
|
|
5670
5758
|
let httpAdapterBuildResult;
|
|
@@ -5673,7 +5761,7 @@ async function loadApplication(params) {
|
|
|
5673
5761
|
sourceFile: a.sourceFile,
|
|
5674
5762
|
methods: a.methods,
|
|
5675
5763
|
hasOutput: a.hasOutput
|
|
5676
|
-
})), bundleCache);
|
|
5764
|
+
})), bundleCache, bundleLogLevel);
|
|
5677
5765
|
if (authResult.authService?.config.hooks?.beforeLogin) {
|
|
5678
5766
|
const authName = authResult.authService.config.name;
|
|
5679
5767
|
bundledScripts.authHooks = await bundleAuthHooks({
|
|
@@ -5683,7 +5771,8 @@ async function loadApplication(params) {
|
|
|
5683
5771
|
env: config.env ?? {},
|
|
5684
5772
|
triggerContext,
|
|
5685
5773
|
cache: bundleCache,
|
|
5686
|
-
inlineSourcemap
|
|
5774
|
+
inlineSourcemap,
|
|
5775
|
+
bundleLogLevel
|
|
5687
5776
|
});
|
|
5688
5777
|
}
|
|
5689
5778
|
for (const pipeline of resolverResult.resolverServices) await pipeline.loadResolvers();
|
|
@@ -5716,5 +5805,5 @@ async function loadApplication(params) {
|
|
|
5716
5805
|
}
|
|
5717
5806
|
|
|
5718
5807
|
//#endregion
|
|
5719
|
-
export {
|
|
5720
|
-
//# sourceMappingURL=application-
|
|
5808
|
+
export { saveUserTokens as A, deleteUserTokens as C, loadWorkspaceId as D, loadConfigPath as E, readPlatformConfig as O, loadConfig as S, loadAccessToken as T, createLogLevelTreeshakeOptions as _, WorkflowJobSchema as a, getDistDir as b, createExecutorService as c, buildExecutorArgsExpr as d, buildResolverOperationHookExpr as f, composeFunctionTreeshakeOptions as g, loadFilesWithIgnores as h, resolveInlineSourcemap as i, writePlatformConfig as j, resolveTokens as k, ExecutorSchema as l, stringifyFunction as m, generatePluginFilesIfNeeded as n, ResolverSchema as o, TailorDBTypeSchema as p, loadApplication as r, HTTP_METHODS as s, defineApplication as t, INVOKER_EXPR as u, resolveBundleLogLevel as v, fetchLatestToken as w, hashFile as x, createBundleCache as y };
|
|
5809
|
+
//# sourceMappingURL=application-YHZIkjdy.mjs.map
|