@tailor-platform/sdk 1.55.2 → 1.56.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 +20 -0
- package/dist/application-CC3oaSay.mjs +4 -0
- package/dist/{application-MY7YJJ-C.mjs → application-DuT_ae02.mjs} +179 -56
- package/dist/application-DuT_ae02.mjs.map +1 -0
- package/dist/cli/index.mjs +6 -8
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +1 -1
- package/dist/cli/lib.mjs +3 -3
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs +1 -1
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-1APcOP9X.d.mts → index-B61gFI9a.d.mts} +7 -2
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/{runtime-DH5F_z8A.mjs → runtime-745lvg7i.mjs} +24 -3
- package/dist/runtime-745lvg7i.mjs.map +1 -0
- package/dist/{seed-DfLyRh63.mjs → seed-C0fE2sJB.mjs} +5 -5
- package/dist/seed-C0fE2sJB.mjs.map +1 -0
- package/dist/{types-BinLwXM9.mjs → types-BwGth3a1.mjs} +57 -28
- package/dist/types-BwGth3a1.mjs.map +1 -0
- package/dist/{types-UeXbHFXW.mjs → types-Ccwchyj5.mjs} +1 -1
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/{workflow.generated-BGLDYJOq.d.mts → workflow.generated-Kz-nQrTf.d.mts} +20 -1
- package/docs/configuration.md +12 -0
- package/package.json +1 -1
- package/dist/application-D6znmyMd.mjs +0 -4
- package/dist/application-MY7YJJ-C.mjs.map +0 -1
- package/dist/runtime-DH5F_z8A.mjs.map +0 -1
- package/dist/seed-DfLyRh63.mjs.map +0 -1
- package/dist/types-BinLwXM9.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.56.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1347](https://github.com/tailor-platform/sdk/pull/1347) [`6888110`](https://github.com/tailor-platform/sdk/commit/6888110fa61f9f3fd991e0fb44e86fd37f9536f3) Thanks [@dqn](https://github.com/dqn)! - Fix resolver field builders (`t.*`) leaking metadata between fields. `description()`, `typeName()`, and `validate()` now return a new field instead of mutating the original, so a field instance reused across places (for example shared between a resolver's `input` and `output`, or a record passed to `t.object`) no longer leaks its metadata into the other usages. This matches the existing `db.*` behavior.
|
|
8
|
+
|
|
9
|
+
- [#1346](https://github.com/tailor-platform/sdk/pull/1346) [`0254e3c`](https://github.com/tailor-platform/sdk/commit/0254e3caff0d1eeb7407d8932385bf5bdbaf4356) Thanks [@dqn](https://github.com/dqn)! - Warn when a permission rule is written in object form without an explicit `permit`. Object-format rules (e.g. `read: [{ conditions: [...] }]`) default to `deny`, unlike the array shorthand which defaults to `allow`, so omitting `permit` can silently lock out access you meant to grant. The CLI now flags these rules during generate/deploy so you can set `permit: true` (allow) or `permit: false` (deny) explicitly. Runtime behavior is unchanged. This covers TailorDB record permissions, TailorDB GraphQL permissions, and IdP permissions.
|
|
10
|
+
|
|
11
|
+
## 1.56.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#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.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#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.
|
|
20
|
+
|
|
21
|
+
- [#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.
|
|
22
|
+
|
|
3
23
|
## 1.55.2
|
|
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
|
}
|
|
@@ -2461,6 +2560,29 @@ function normalizeActionPermission(permission) {
|
|
|
2461
2560
|
permit: conditionArrayPermit ? "allow" : "deny"
|
|
2462
2561
|
};
|
|
2463
2562
|
}
|
|
2563
|
+
/**
|
|
2564
|
+
* Find object-format permission rules that omit `permit`.
|
|
2565
|
+
*
|
|
2566
|
+
* Object-format rules default to `deny` when `permit` is omitted, whereas the
|
|
2567
|
+
* array shorthand defaults to `allow`. Omitting `permit` on an object rule is
|
|
2568
|
+
* therefore an easy way to accidentally deny access you meant to grant, so the
|
|
2569
|
+
* CLI warns about these locations to nudge authors toward setting `permit`
|
|
2570
|
+
* explicitly.
|
|
2571
|
+
* @param rawPermissions - Raw permissions definition
|
|
2572
|
+
* @returns Dotted locations of offending rules, e.g. `record.read[0]`, `gql[1]`
|
|
2573
|
+
*/
|
|
2574
|
+
function findOmittedPermitRules(rawPermissions) {
|
|
2575
|
+
const locations = [];
|
|
2576
|
+
const record = rawPermissions.record;
|
|
2577
|
+
if (record) for (const action of Object.keys(record)) record[action]?.forEach((rule, index) => {
|
|
2578
|
+
if (isObjectFormat(rule) && rule.permit === void 0) locations.push(`record.${String(action)}[${index}]`);
|
|
2579
|
+
});
|
|
2580
|
+
const gql = rawPermissions.gql;
|
|
2581
|
+
if (gql) gql.forEach((policy, index) => {
|
|
2582
|
+
if (policy.permit === void 0) locations.push(`gql[${index}]`);
|
|
2583
|
+
});
|
|
2584
|
+
return locations;
|
|
2585
|
+
}
|
|
2464
2586
|
|
|
2465
2587
|
//#endregion
|
|
2466
2588
|
//#region src/parser/service/tailordb/relation.ts
|
|
@@ -3332,6 +3454,12 @@ function createTailorDBService(params) {
|
|
|
3332
3454
|
for (const fileTypes of Object.values(rawTypes)) for (const [typeName, type] of Object.entries(fileTypes)) allTypes[typeName] = type;
|
|
3333
3455
|
types = parseTypes(allTypes, namespace, typeSourceInfo);
|
|
3334
3456
|
};
|
|
3457
|
+
const warnOmittedPermit = () => {
|
|
3458
|
+
for (const fileTypes of Object.values(rawTypes)) for (const [typeName, type] of Object.entries(fileTypes)) {
|
|
3459
|
+
const locations = findOmittedPermitRules(type.metadata.permissions ?? {});
|
|
3460
|
+
if (locations.length > 0) logger.warn(`TailorDB type "${typeName}" has permission rule(s) ${locations.join(", ")} in object form without an explicit "permit"; they default to "deny". Set permit: true (allow) or permit: false (deny) to silence this warning.`);
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3335
3463
|
/**
|
|
3336
3464
|
* Process plugins for a type and add generated types to rawTypes
|
|
3337
3465
|
* @param rawType - The raw TailorDB type being processed
|
|
@@ -3424,6 +3552,7 @@ function createTailorDBService(params) {
|
|
|
3424
3552
|
if (pluginManager) for (const typeFile of typeFiles) await loadTypeFile(typeFile, tsconfig);
|
|
3425
3553
|
else await Promise.all(typeFiles.map((typeFile) => loadTypeFile(typeFile, tsconfig)));
|
|
3426
3554
|
doParseTypes();
|
|
3555
|
+
warnOmittedPermit();
|
|
3427
3556
|
return types;
|
|
3428
3557
|
})();
|
|
3429
3558
|
return loadPromise;
|
|
@@ -3996,7 +4125,7 @@ async function loadExecutor(executorFilePath) {
|
|
|
3996
4125
|
*/
|
|
3997
4126
|
async function bundleExecutors(options) {
|
|
3998
4127
|
const bundledCode = /* @__PURE__ */ new Map();
|
|
3999
|
-
const { config, triggerContext, additionalFiles = [], cache, inlineSourcemap } = options;
|
|
4128
|
+
const { config, triggerContext, additionalFiles = [], cache, inlineSourcemap, bundleLogLevel = "DEBUG" } = options;
|
|
4000
4129
|
const files = [...loadFilesWithIgnores(config), ...additionalFiles];
|
|
4001
4130
|
if (files.length === 0) {
|
|
4002
4131
|
logger.warn(`No executor files found for patterns: ${config.files?.join(", ") ?? "(none)"}`);
|
|
@@ -4033,18 +4162,19 @@ async function bundleExecutors(options) {
|
|
|
4033
4162
|
} catch {
|
|
4034
4163
|
tsconfig = void 0;
|
|
4035
4164
|
}
|
|
4036
|
-
const results = await withBundleConcurrency(executors, (executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap));
|
|
4165
|
+
const results = await withBundleConcurrency(executors, (executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel));
|
|
4037
4166
|
for (const [name, code] of results) bundledCode.set(name, code);
|
|
4038
4167
|
logger.log(`${styles.success("Bundled")} ${styles.info("\"executor\"")}`);
|
|
4039
4168
|
return bundledCode;
|
|
4040
4169
|
}
|
|
4041
|
-
async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
|
|
4170
|
+
async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4042
4171
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
4043
4172
|
const contextHash = computeBundlerContextHash({
|
|
4044
4173
|
sourceFile: executor.sourceFile,
|
|
4045
4174
|
serializedTriggerContext,
|
|
4046
4175
|
tsconfig,
|
|
4047
|
-
inlineSourcemap
|
|
4176
|
+
inlineSourcemap,
|
|
4177
|
+
bundleLogLevel
|
|
4048
4178
|
});
|
|
4049
4179
|
const code = await withCache({
|
|
4050
4180
|
cache,
|
|
@@ -4079,11 +4209,7 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
|
|
|
4079
4209
|
},
|
|
4080
4210
|
tsconfig,
|
|
4081
4211
|
plugins,
|
|
4082
|
-
treeshake:
|
|
4083
|
-
moduleSideEffects: false,
|
|
4084
|
-
annotations: true,
|
|
4085
|
-
unknownGlobalSideEffects: false
|
|
4086
|
-
},
|
|
4212
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
4087
4213
|
logLevel: "silent"
|
|
4088
4214
|
})).output[0].code;
|
|
4089
4215
|
}
|
|
@@ -4210,9 +4336,10 @@ const ADAPTER_BUNDLE_ERROR_BYTES = 256 * 1024;
|
|
|
4210
4336
|
* generated dispatcher that routes by `req.method`; `output` is used as is.
|
|
4211
4337
|
* @param adapters - Detected adapters to bundle
|
|
4212
4338
|
* @param cache - Optional bundle cache for skipping unchanged builds
|
|
4339
|
+
* @param bundleLogLevel - Controls which console calls are kept in bundled code
|
|
4213
4340
|
* @returns Bundled scripts keyed by adapter name
|
|
4214
4341
|
*/
|
|
4215
|
-
async function bundleHttpAdapters(adapters, cache) {
|
|
4342
|
+
async function bundleHttpAdapters(adapters, cache, bundleLogLevel = "DEBUG") {
|
|
4216
4343
|
if (adapters.length === 0) return {
|
|
4217
4344
|
bundledInputs: /* @__PURE__ */ new Map(),
|
|
4218
4345
|
bundledOutputs: /* @__PURE__ */ new Map()
|
|
@@ -4232,7 +4359,7 @@ async function bundleHttpAdapters(adapters, cache) {
|
|
|
4232
4359
|
adapter,
|
|
4233
4360
|
kind
|
|
4234
4361
|
}));
|
|
4235
|
-
}), ({ adapter, kind }) => bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache));
|
|
4362
|
+
}), ({ adapter, kind }) => bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache, bundleLogLevel));
|
|
4236
4363
|
const bundledInputs = /* @__PURE__ */ new Map();
|
|
4237
4364
|
const bundledOutputs = /* @__PURE__ */ new Map();
|
|
4238
4365
|
for (const [name, kind, code] of results) if (kind === "input") bundledInputs.set(name, code);
|
|
@@ -4243,12 +4370,13 @@ async function bundleHttpAdapters(adapters, cache) {
|
|
|
4243
4370
|
bundledOutputs
|
|
4244
4371
|
};
|
|
4245
4372
|
}
|
|
4246
|
-
async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache) {
|
|
4373
|
+
async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache, bundleLogLevel = "DEBUG") {
|
|
4247
4374
|
const contextHash = computeBundlerContextHash({
|
|
4248
4375
|
sourceFile: adapter.sourceFile,
|
|
4249
4376
|
serializedTriggerContext: kind === "input" ? adapter.methods.join(",") : "",
|
|
4250
4377
|
tsconfig,
|
|
4251
4378
|
inlineSourcemap: false,
|
|
4379
|
+
bundleLogLevel,
|
|
4252
4380
|
prefix: kind
|
|
4253
4381
|
});
|
|
4254
4382
|
const code = await withCache({
|
|
@@ -4300,11 +4428,7 @@ async function bundleAdapterScript(adapter, kind, outputDir, tsconfig, cache) {
|
|
|
4300
4428
|
tsconfig,
|
|
4301
4429
|
plugins,
|
|
4302
4430
|
transform: { target: "es2017" },
|
|
4303
|
-
treeshake:
|
|
4304
|
-
moduleSideEffects: false,
|
|
4305
|
-
annotations: true,
|
|
4306
|
-
unknownGlobalSideEffects: false
|
|
4307
|
-
},
|
|
4431
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
4308
4432
|
logLevel: "silent"
|
|
4309
4433
|
})).output[0].code;
|
|
4310
4434
|
} finally {
|
|
@@ -4507,9 +4631,10 @@ async function loadResolver(resolverFilePath) {
|
|
|
4507
4631
|
* @param triggerContext - Trigger context for workflow/job transformations
|
|
4508
4632
|
* @param cache - Optional bundle cache for skipping unchanged builds
|
|
4509
4633
|
* @param inlineSourcemap - Whether to enable inline sourcemaps
|
|
4634
|
+
* @param bundleLogLevel - Controls which console calls are kept in bundled code
|
|
4510
4635
|
* @returns Map of resolver name to bundled code
|
|
4511
4636
|
*/
|
|
4512
|
-
async function bundleResolvers(namespace, config, triggerContext, cache, inlineSourcemap) {
|
|
4637
|
+
async function bundleResolvers(namespace, config, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4513
4638
|
const bundledCode = /* @__PURE__ */ new Map();
|
|
4514
4639
|
const files = loadFilesWithIgnores(config);
|
|
4515
4640
|
if (files.length === 0) {
|
|
@@ -4539,18 +4664,19 @@ async function bundleResolvers(namespace, config, triggerContext, cache, inlineS
|
|
|
4539
4664
|
} catch {
|
|
4540
4665
|
tsconfig = void 0;
|
|
4541
4666
|
}
|
|
4542
|
-
const results = await withBundleConcurrency(resolvers, (resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap));
|
|
4667
|
+
const results = await withBundleConcurrency(resolvers, (resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel));
|
|
4543
4668
|
for (const [name, code] of results) bundledCode.set(name, code);
|
|
4544
4669
|
logger.log(`${styles.success("Bundled")} ${styles.info(`"${namespace}"`)}`);
|
|
4545
4670
|
return bundledCode;
|
|
4546
4671
|
}
|
|
4547
|
-
async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
|
|
4672
|
+
async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4548
4673
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
4549
4674
|
const contextHash = computeBundlerContextHash({
|
|
4550
4675
|
sourceFile: resolver.sourceFile,
|
|
4551
4676
|
serializedTriggerContext,
|
|
4552
4677
|
tsconfig,
|
|
4553
|
-
inlineSourcemap
|
|
4678
|
+
inlineSourcemap,
|
|
4679
|
+
bundleLogLevel
|
|
4554
4680
|
});
|
|
4555
4681
|
const code = await withCache({
|
|
4556
4682
|
cache,
|
|
@@ -4601,11 +4727,7 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
|
|
|
4601
4727
|
},
|
|
4602
4728
|
tsconfig,
|
|
4603
4729
|
plugins,
|
|
4604
|
-
treeshake:
|
|
4605
|
-
moduleSideEffects: false,
|
|
4606
|
-
annotations: true,
|
|
4607
|
-
unknownGlobalSideEffects: false
|
|
4608
|
-
},
|
|
4730
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
4609
4731
|
logLevel: "silent"
|
|
4610
4732
|
})).output[0].code;
|
|
4611
4733
|
}
|
|
@@ -4836,9 +4958,10 @@ function safeRealpath(p) {
|
|
|
4836
4958
|
* @param triggerContext - Trigger context for transformations
|
|
4837
4959
|
* @param cache - Optional bundle cache for skipping unchanged builds
|
|
4838
4960
|
* @param inlineSourcemap - Whether to enable inline sourcemaps
|
|
4961
|
+
* @param bundleLogLevel - Controls which console calls are kept in bundled code
|
|
4839
4962
|
* @returns Workflow job bundling result
|
|
4840
4963
|
*/
|
|
4841
|
-
async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContext, cache, inlineSourcemap) {
|
|
4964
|
+
async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4842
4965
|
if (allJobs.length === 0) {
|
|
4843
4966
|
logger.warn("No workflow jobs to bundle");
|
|
4844
4967
|
return {
|
|
@@ -4862,7 +4985,7 @@ async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContex
|
|
|
4862
4985
|
} catch {
|
|
4863
4986
|
tsconfig = void 0;
|
|
4864
4987
|
}
|
|
4865
|
-
const results = await withBundleConcurrency(usedJobs, (job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap));
|
|
4988
|
+
const results = await withBundleConcurrency(usedJobs, (job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap, bundleLogLevel));
|
|
4866
4989
|
const bundledCode = /* @__PURE__ */ new Map();
|
|
4867
4990
|
for (const [name, code] of results) bundledCode.set(name, code);
|
|
4868
4991
|
logger.log(`${styles.success("Bundled")} ${styles.info("\"workflow-job\"")}`);
|
|
@@ -4944,7 +5067,7 @@ async function filterUsedJobs(allJobs, mainJobNames) {
|
|
|
4944
5067
|
mainJobDeps
|
|
4945
5068
|
};
|
|
4946
5069
|
}
|
|
4947
|
-
async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap) {
|
|
5070
|
+
async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap, bundleLogLevel = "DEBUG") {
|
|
4948
5071
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
4949
5072
|
const sortedEnvPrefix = JSON.stringify(Object.fromEntries(Object.entries(env).sort(([a], [b]) => a.localeCompare(b))));
|
|
4950
5073
|
const contextHash = computeBundlerContextHash({
|
|
@@ -4952,6 +5075,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
4952
5075
|
serializedTriggerContext,
|
|
4953
5076
|
tsconfig,
|
|
4954
5077
|
inlineSourcemap,
|
|
5078
|
+
bundleLogLevel,
|
|
4955
5079
|
prefix: sortedEnvPrefix
|
|
4956
5080
|
});
|
|
4957
5081
|
const code = await withCache({
|
|
@@ -5002,11 +5126,7 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
5002
5126
|
},
|
|
5003
5127
|
tsconfig,
|
|
5004
5128
|
plugins,
|
|
5005
|
-
treeshake:
|
|
5006
|
-
moduleSideEffects: false,
|
|
5007
|
-
annotations: true,
|
|
5008
|
-
unknownGlobalSideEffects: false
|
|
5009
|
-
},
|
|
5129
|
+
treeshake: composeFunctionTreeshakeOptions([createLogLevelTreeshakeOptions(bundleLogLevel)]),
|
|
5010
5130
|
logLevel: "silent"
|
|
5011
5131
|
})).output[0].code;
|
|
5012
5132
|
}
|
|
@@ -5640,6 +5760,7 @@ async function loadApplication(params) {
|
|
|
5640
5760
|
if (httpAdapterService) await httpAdapterService.loadAdapters();
|
|
5641
5761
|
const triggerContext = await buildTriggerContext(config.workflow, authResult.authService?.config.name);
|
|
5642
5762
|
const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
|
|
5763
|
+
const bundleLogLevel = resolveBundleLogLevel(config.logLevel);
|
|
5643
5764
|
const bundledScripts = {
|
|
5644
5765
|
resolvers: /* @__PURE__ */ new Map(),
|
|
5645
5766
|
executors: /* @__PURE__ */ new Map(),
|
|
@@ -5647,7 +5768,7 @@ async function loadApplication(params) {
|
|
|
5647
5768
|
authHooks: /* @__PURE__ */ new Map()
|
|
5648
5769
|
};
|
|
5649
5770
|
for (const pipeline of resolverResult.resolverServices) {
|
|
5650
|
-
const resolverBundles = await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap);
|
|
5771
|
+
const resolverBundles = await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap, bundleLogLevel);
|
|
5651
5772
|
for (const [name, code] of resolverBundles) bundledScripts.resolvers.set(name, code);
|
|
5652
5773
|
}
|
|
5653
5774
|
if (executorService) bundledScripts.executors = await bundleExecutors({
|
|
@@ -5655,12 +5776,13 @@ async function loadApplication(params) {
|
|
|
5655
5776
|
triggerContext,
|
|
5656
5777
|
additionalFiles: [...pluginExecutorFiles],
|
|
5657
5778
|
cache: bundleCache,
|
|
5658
|
-
inlineSourcemap
|
|
5779
|
+
inlineSourcemap,
|
|
5780
|
+
bundleLogLevel
|
|
5659
5781
|
});
|
|
5660
5782
|
let workflowBuildResult;
|
|
5661
5783
|
if (workflowService && workflowService.jobs.length > 0) {
|
|
5662
5784
|
const mainJobNames = workflowService.workflowSources.map((ws) => ws.workflow.mainJob.name);
|
|
5663
|
-
workflowBuildResult = await bundleWorkflowJobs(workflowService.jobs, mainJobNames, config.env ?? {}, triggerContext, bundleCache, inlineSourcemap);
|
|
5785
|
+
workflowBuildResult = await bundleWorkflowJobs(workflowService.jobs, mainJobNames, config.env ?? {}, triggerContext, bundleCache, inlineSourcemap, bundleLogLevel);
|
|
5664
5786
|
bundledScripts.workflowJobs = workflowBuildResult.bundledCode;
|
|
5665
5787
|
}
|
|
5666
5788
|
let httpAdapterBuildResult;
|
|
@@ -5669,7 +5791,7 @@ async function loadApplication(params) {
|
|
|
5669
5791
|
sourceFile: a.sourceFile,
|
|
5670
5792
|
methods: a.methods,
|
|
5671
5793
|
hasOutput: a.hasOutput
|
|
5672
|
-
})), bundleCache);
|
|
5794
|
+
})), bundleCache, bundleLogLevel);
|
|
5673
5795
|
if (authResult.authService?.config.hooks?.beforeLogin) {
|
|
5674
5796
|
const authName = authResult.authService.config.name;
|
|
5675
5797
|
bundledScripts.authHooks = await bundleAuthHooks({
|
|
@@ -5679,7 +5801,8 @@ async function loadApplication(params) {
|
|
|
5679
5801
|
env: config.env ?? {},
|
|
5680
5802
|
triggerContext,
|
|
5681
5803
|
cache: bundleCache,
|
|
5682
|
-
inlineSourcemap
|
|
5804
|
+
inlineSourcemap,
|
|
5805
|
+
bundleLogLevel
|
|
5683
5806
|
});
|
|
5684
5807
|
}
|
|
5685
5808
|
for (const pipeline of resolverResult.resolverServices) await pipeline.loadResolvers();
|
|
@@ -5712,5 +5835,5 @@ async function loadApplication(params) {
|
|
|
5712
5835
|
}
|
|
5713
5836
|
|
|
5714
5837
|
//#endregion
|
|
5715
|
-
export {
|
|
5716
|
-
//# sourceMappingURL=application-
|
|
5838
|
+
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 };
|
|
5839
|
+
//# sourceMappingURL=application-DuT_ae02.mjs.map
|