@tailor-platform/sdk 1.28.0 → 1.30.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 +30 -0
- package/dist/{application-CBJFUKrU.mjs → application-Bf8SUAtR.mjs} +97 -77
- package/dist/application-Bf8SUAtR.mjs.map +1 -0
- package/dist/{application-WyZetOky.mjs → application-DAQVP9CS.mjs} +3 -3
- package/dist/chunk-DEt8GZDa.mjs +8 -0
- package/dist/cli/index.mjs +118 -52
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.d.mts +208 -43
- package/dist/cli/lib.mjs +26 -28
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/skills.mjs +1 -1
- package/dist/client-CW4Oh3iz.mjs +6 -0
- package/dist/client-CZmQBXAY.mjs +16294 -0
- package/dist/client-CZmQBXAY.mjs.map +1 -0
- package/dist/configure/index.d.mts +4 -4
- package/dist/configure/index.mjs +1 -1
- package/dist/{crash-report-Cot_9Esm.mjs → crash-report-CYrETw1c.mjs} +2 -2
- package/dist/{crash-report-Ju8cQF-l.mjs → crash-report-DizNMVnm.mjs} +3 -3
- package/dist/{crash-report-Ju8cQF-l.mjs.map → crash-report-DizNMVnm.mjs.map} +1 -1
- package/dist/{env-BuMbIknz.d.mts → env-DiWYe80_.d.mts} +2 -2
- package/dist/{index-CbnLNm14.d.mts → index-2WQbf_LH.d.mts} +2 -2
- package/dist/{index-cD9sQLTh.d.mts → index-BU7Cd5I4.d.mts} +4 -4
- package/dist/{index-B0Lrzywd.d.mts → index-DCEMVfJA.d.mts} +2 -2
- package/dist/{index-D1AM_02Y.d.mts → index-HvMUWjvV.d.mts} +2 -2
- package/dist/{index-CyapgSFI.d.mts → index-rH_De6hM.d.mts} +2 -2
- package/dist/{interceptor-B0d_GrI5.mjs → interceptor-DgQNmwWJ.mjs} +2 -2
- package/dist/{interceptor-B0d_GrI5.mjs.map → interceptor-DgQNmwWJ.mjs.map} +1 -1
- package/dist/kysely/index.mjs +1 -1
- package/dist/{package-json-DHfTiUCS.mjs → package-json-DiZWrkIA.mjs} +1 -1
- package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
- package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
- package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
- package/dist/plugin/builtin/file-utils/index.mjs +1 -1
- package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/index.d.mts +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/plugin/index.d.mts +2 -2
- package/dist/plugin/index.mjs +1 -1
- package/dist/{plugin-D3a0-qe0.d.mts → plugin-C-UdAM8C.d.mts} +2 -2
- package/dist/{query-WYq8RvYp.mjs → query-C3oQTLvb.mjs} +670 -132
- package/dist/query-C3oQTLvb.mjs.map +1 -0
- package/dist/schema-BePzTFBV.mjs.map +1 -1
- package/dist/seed/index.mjs +1 -1
- package/dist/{telemetry-VvNfsyEE.mjs → telemetry-BSUlYTs-.mjs} +2 -2
- package/dist/{telemetry-VvNfsyEE.mjs.map → telemetry-BSUlYTs-.mjs.map} +1 -1
- package/dist/telemetry-BtN2l0f1.mjs +4 -0
- package/dist/utils/test/index.d.mts +2 -2
- package/dist/utils/test/index.mjs +1 -1
- package/dist/{workflow.generated-BsgIlrH-.d.mts → workflow.generated-C5wMcCjB.d.mts} +2 -2
- package/docs/cli/function.md +1 -1
- package/docs/cli/organization.md +426 -0
- package/docs/cli/user.md +21 -22
- package/docs/cli/workspace.md +0 -7
- package/docs/cli-reference.md +32 -12
- package/docs/services/executor.md +46 -0
- package/package.json +8 -8
- package/dist/application-CBJFUKrU.mjs.map +0 -1
- package/dist/chunk-Cz-A8uMR.mjs +0 -3
- package/dist/client-C2_wgujH.mjs +0 -6
- package/dist/client-bTbnbQbB.mjs +0 -957
- package/dist/client-bTbnbQbB.mjs.map +0 -1
- package/dist/query-WYq8RvYp.mjs.map +0 -1
- package/dist/telemetry-BevrwWwF.mjs +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 1.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#765](https://github.com/tailor-platform/sdk/pull/765) [`afe6f6f`](https://github.com/tailor-platform/sdk/commit/afe6f6fb968271d5bb7f2aff7317c089b9f7fd6e) Thanks [@toiroakr](https://github.com/toiroakr)! - Add organization and folder management CLI commands: `organization list/get/update/tree` and `organization folder list/get/create/update/delete` with programmatic API exports
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#800](https://github.com/tailor-platform/sdk/pull/800) [`3c60fdf`](https://github.com/tailor-platform/sdk/commit/3c60fdf63212a307be3380b63a9fd29582419919) Thanks [@dqn](https://github.com/dqn)! - Use rolldown `write: false` to keep bundle output in memory, eliminating unnecessary disk I/O in all bundlers
|
|
12
|
+
|
|
13
|
+
- [#804](https://github.com/tailor-platform/sdk/pull/804) [`ee915c1`](https://github.com/tailor-platform/sdk/commit/ee915c121b25b7c14794fccb2fd6de79d0c3f604) Thanks [@toiroakr](https://github.com/toiroakr)! - Allow `as const` readonly arrays to be passed directly to `db.enum()` and `t.enum()` without requiring a spread workaround
|
|
14
|
+
|
|
15
|
+
## 1.29.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#702](https://github.com/tailor-platform/sdk/pull/702) [`9b25f08`](https://github.com/tailor-platform/sdk/commit/9b25f084abfcb05262aece4f4624111c3d18ebdb) Thanks [@toiroakr](https://github.com/toiroakr)! - Add `login --machineuser` flag for platform machine user authentication. Token is stored in platform config for automatic use by subsequent commands. Supports `--client-id` and `--client-secret` options with environment variable fallback (`TAILOR_PLATFORM_MACHINE_USER_CLIENT_ID` / `TAILOR_PLATFORM_MACHINE_USER_CLIENT_SECRET`). Client secret is prompted securely when omitted.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#781](https://github.com/tailor-platform/sdk/pull/781) [`2de7b3e`](https://github.com/tailor-platform/sdk/commit/2de7b3ef369870a96c2d20696168f5267aa3de9b) Thanks [@renovate](https://github.com/apps/renovate)! - chore(deps): update anthropics/claude-code-action action to v1.0.75
|
|
24
|
+
|
|
25
|
+
- [#786](https://github.com/tailor-platform/sdk/pull/786) [`38ef630`](https://github.com/tailor-platform/sdk/commit/38ef6309e257fc2fa0c831b2c3b9bff7dd797c74) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency p-limit to v7.3.0
|
|
26
|
+
|
|
27
|
+
- [#788](https://github.com/tailor-platform/sdk/pull/788) [`bbeaf1e`](https://github.com/tailor-platform/sdk/commit/bbeaf1e1ff4ed6838e1edf35e366f531aebb1c2b) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update oxlint monorepo
|
|
28
|
+
|
|
29
|
+
- [#796](https://github.com/tailor-platform/sdk/pull/796) [`17808f4`](https://github.com/tailor-platform/sdk/commit/17808f4b11fc59aa714eb92cea7955bc559b4178) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update dependency kysely to v0.28.14 [security]
|
|
30
|
+
|
|
31
|
+
- [#779](https://github.com/tailor-platform/sdk/pull/779) [`b234487`](https://github.com/tailor-platform/sdk/commit/b234487f5787f540035657d11aa2759847de4177) Thanks [@dragon3](https://github.com/dragon3)! - Use typed event configs for executor triggers instead of deprecated eventType/condition fields
|
|
32
|
+
|
|
3
33
|
## 1.28.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as isSdkBranded } from "./brand-GZnI4eYb.mjs";
|
|
2
2
|
import { n as logger, r as styles } from "./logger-CqezTedh.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { c as initOAuth2Client } from "./client-CZmQBXAY.mjs";
|
|
4
4
|
import { n as seedPlugin, r as isPluginGeneratedType, t as SeedGeneratorID } from "./seed-CWkIDWMb.mjs";
|
|
5
5
|
import { n as enumConstantsPlugin, t as EnumConstantsGeneratorID } from "./enum-constants-D1nfn0qD.mjs";
|
|
6
6
|
import { n as fileUtilsPlugin, t as FileUtilsGeneratorID } from "./file-utils-Bctuzn3x.mjs";
|
|
@@ -11,17 +11,17 @@ import * as fs$1 from "node:fs";
|
|
|
11
11
|
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
12
12
|
import * as path from "pathe";
|
|
13
13
|
import { join, resolve } from "pathe";
|
|
14
|
+
import * as crypto from "node:crypto";
|
|
15
|
+
import { pathToFileURL } from "node:url";
|
|
14
16
|
import { resolveTSConfig } from "pkg-types";
|
|
15
17
|
import * as os from "node:os";
|
|
16
18
|
import { parseTOML, parseYAML, stringifyYAML } from "confbox";
|
|
17
19
|
import { findUpSync } from "find-up-simple";
|
|
18
20
|
import ml from "multiline-ts";
|
|
19
21
|
import { xdgConfig } from "xdg-basedir";
|
|
20
|
-
import * as crypto from "node:crypto";
|
|
21
22
|
import * as rolldown from "rolldown";
|
|
22
23
|
import * as fs from "node:fs/promises";
|
|
23
24
|
import { parseSync } from "oxc-parser";
|
|
24
|
-
import { pathToFileURL } from "node:url";
|
|
25
25
|
import * as inflection from "inflection";
|
|
26
26
|
import * as globals from "globals";
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ const pfConfigSchema = z.object({
|
|
|
30
30
|
version: z.literal(1),
|
|
31
31
|
users: z.partialRecord(z.string(), z.object({
|
|
32
32
|
access_token: z.string(),
|
|
33
|
-
refresh_token: z.string(),
|
|
33
|
+
refresh_token: z.string().optional(),
|
|
34
34
|
token_expires_at: z.string()
|
|
35
35
|
})),
|
|
36
36
|
profiles: z.partialRecord(z.string(), z.object({
|
|
@@ -184,6 +184,10 @@ async function fetchLatestToken(config, user) {
|
|
|
184
184
|
Please verify your user name and login using 'tailor-sdk login' command.
|
|
185
185
|
`);
|
|
186
186
|
if (new Date(tokens.token_expires_at) > /* @__PURE__ */ new Date()) return tokens.access_token;
|
|
187
|
+
if (!tokens.refresh_token) throw new Error(ml`
|
|
188
|
+
Token expired.
|
|
189
|
+
Please run 'tailor-sdk login' and try again.
|
|
190
|
+
`);
|
|
187
191
|
const client = initOAuth2Client();
|
|
188
192
|
let resp;
|
|
189
193
|
try {
|
|
@@ -320,32 +324,31 @@ function computeBundlerContextHash(params) {
|
|
|
320
324
|
* When caching is active, attempts to restore from cache first,
|
|
321
325
|
* and saves the build result (with collected dependencies) on a cache miss.
|
|
322
326
|
* @param params - Cache and build parameters
|
|
327
|
+
* @returns The bundled code string
|
|
323
328
|
*/
|
|
324
329
|
async function withCache(params) {
|
|
325
|
-
const { cache, kind, name, sourceFile,
|
|
326
|
-
if (!cache)
|
|
327
|
-
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
if (cache.tryRestore({
|
|
330
|
+
const { cache, kind, name, sourceFile, contextHash, build } = params;
|
|
331
|
+
if (!cache) return await build([]);
|
|
332
|
+
const content = cache.tryRestore({
|
|
331
333
|
kind,
|
|
332
334
|
name,
|
|
333
|
-
outputPath,
|
|
334
335
|
contextHash
|
|
335
|
-
})
|
|
336
|
+
});
|
|
337
|
+
if (content !== void 0) {
|
|
336
338
|
logger.debug(` ${styles.dim("cached")}: ${name}`);
|
|
337
|
-
return;
|
|
339
|
+
return content;
|
|
338
340
|
}
|
|
339
341
|
const { plugin, getResult } = createDepCollectorPlugin();
|
|
340
|
-
await build([plugin]);
|
|
342
|
+
const code = await build([plugin]);
|
|
341
343
|
cache.save({
|
|
342
344
|
kind,
|
|
343
345
|
name,
|
|
344
346
|
sourceFile,
|
|
345
|
-
|
|
347
|
+
content: code,
|
|
346
348
|
dependencyPaths: getResult(),
|
|
347
349
|
contextHash
|
|
348
350
|
});
|
|
351
|
+
return code;
|
|
349
352
|
}
|
|
350
353
|
/**
|
|
351
354
|
* Create a bundle cache backed by the given store.
|
|
@@ -356,37 +359,31 @@ function createBundleCache(store) {
|
|
|
356
359
|
function tryRestore(params) {
|
|
357
360
|
const cacheKey = buildCacheKey(params.kind, params.name);
|
|
358
361
|
const entry = store.getEntry(cacheKey);
|
|
359
|
-
if (!entry) return
|
|
362
|
+
if (!entry) return;
|
|
360
363
|
let currentHash;
|
|
361
364
|
try {
|
|
362
365
|
currentHash = combineHash(hashFiles(entry.dependencyPaths), params.contextHash);
|
|
363
366
|
} catch {
|
|
364
|
-
return
|
|
367
|
+
return;
|
|
365
368
|
}
|
|
366
|
-
if (currentHash !== entry.inputHash) return
|
|
367
|
-
return store.
|
|
369
|
+
if (currentHash !== entry.inputHash) return;
|
|
370
|
+
return store.restoreBundleContent(cacheKey);
|
|
368
371
|
}
|
|
369
372
|
function save(params) {
|
|
370
|
-
const { kind, name, sourceFile,
|
|
373
|
+
const { kind, name, sourceFile, content, dependencyPaths, contextHash } = params;
|
|
371
374
|
const cacheKey = buildCacheKey(kind, name);
|
|
372
375
|
const allDeps = dependencyPaths.includes(sourceFile) ? dependencyPaths : [sourceFile, ...dependencyPaths];
|
|
373
376
|
const inputHash = combineHash(hashFiles(allDeps), contextHash);
|
|
374
|
-
const contentHash =
|
|
375
|
-
store.
|
|
376
|
-
const outputFiles = [{
|
|
377
|
-
outputPath,
|
|
378
|
-
contentHash
|
|
379
|
-
}];
|
|
380
|
-
const mapPath = `${outputPath}.map`;
|
|
381
|
-
if (fs$1.existsSync(mapPath)) outputFiles.push({
|
|
382
|
-
outputPath: mapPath,
|
|
383
|
-
contentHash: hashFile(mapPath)
|
|
384
|
-
});
|
|
377
|
+
const contentHash = hashContent(content);
|
|
378
|
+
store.storeBundleContent(cacheKey, content);
|
|
385
379
|
store.setEntry(cacheKey, {
|
|
386
380
|
kind: "bundle",
|
|
387
381
|
inputHash,
|
|
388
382
|
dependencyPaths: allDeps,
|
|
389
|
-
outputFiles
|
|
383
|
+
outputFiles: [{
|
|
384
|
+
outputPath: cacheKey,
|
|
385
|
+
contentHash
|
|
386
|
+
}],
|
|
390
387
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
391
388
|
});
|
|
392
389
|
}
|
|
@@ -1618,12 +1615,13 @@ function createTriggerTransformPlugin(triggerContext) {
|
|
|
1618
1615
|
//#endregion
|
|
1619
1616
|
//#region src/cli/services/auth/bundler.ts
|
|
1620
1617
|
/**
|
|
1621
|
-
* Bundle a single auth hook handler
|
|
1618
|
+
* Bundle a single auth hook handler.
|
|
1622
1619
|
*
|
|
1623
1620
|
* Follows the same pattern as the executor bundler:
|
|
1624
1621
|
* 1. Generate an entry file that re-exports the handler as `main`
|
|
1625
1622
|
* 2. Bundle with rolldown + tree-shaking
|
|
1626
1623
|
* @param options - Bundle options
|
|
1624
|
+
* @returns Map of function name to bundled code
|
|
1627
1625
|
*/
|
|
1628
1626
|
async function bundleAuthHooks(options) {
|
|
1629
1627
|
const { configPath, authName, handlerAccessPath, triggerContext, cache, inlineSourcemap } = options;
|
|
@@ -1639,14 +1637,12 @@ async function bundleAuthHooks(options) {
|
|
|
1639
1637
|
tsconfig = void 0;
|
|
1640
1638
|
}
|
|
1641
1639
|
const functionName = `auth-hook--${authName}--before-login`;
|
|
1642
|
-
const outputPath = path.join(outputDir, `${functionName}.js`);
|
|
1643
1640
|
const absoluteConfigPath = path.resolve(configPath);
|
|
1644
|
-
await withCache({
|
|
1641
|
+
const code = await withCache({
|
|
1645
1642
|
cache,
|
|
1646
1643
|
kind: "auth-hook",
|
|
1647
1644
|
name: functionName,
|
|
1648
1645
|
sourceFile: absoluteConfigPath,
|
|
1649
|
-
outputPath,
|
|
1650
1646
|
contextHash: computeBundlerContextHash({
|
|
1651
1647
|
sourceFile: absoluteConfigPath,
|
|
1652
1648
|
serializedTriggerContext: serializeTriggerContext(triggerContext),
|
|
@@ -1664,10 +1660,10 @@ async function bundleAuthHooks(options) {
|
|
|
1664
1660
|
const triggerPlugin = createTriggerTransformPlugin(triggerContext);
|
|
1665
1661
|
const plugins = triggerPlugin ? [triggerPlugin] : [];
|
|
1666
1662
|
plugins.push(...cachePlugins);
|
|
1667
|
-
await rolldown.build(
|
|
1663
|
+
return (await rolldown.build({
|
|
1668
1664
|
input: entryPath,
|
|
1665
|
+
write: false,
|
|
1669
1666
|
output: {
|
|
1670
|
-
file: outputPath,
|
|
1671
1667
|
format: "esm",
|
|
1672
1668
|
sourcemap: inlineSourcemap ? "inline" : true,
|
|
1673
1669
|
minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
|
|
@@ -1681,10 +1677,13 @@ async function bundleAuthHooks(options) {
|
|
|
1681
1677
|
unknownGlobalSideEffects: false
|
|
1682
1678
|
},
|
|
1683
1679
|
logLevel: "silent"
|
|
1684
|
-
}));
|
|
1680
|
+
})).output[0].code;
|
|
1685
1681
|
}
|
|
1686
1682
|
});
|
|
1687
1683
|
logger.log(`${styles.success("Bundled")} auth hook for ${styles.info(`"${authName}"`)}`);
|
|
1684
|
+
const bundledCode = /* @__PURE__ */ new Map();
|
|
1685
|
+
bundledCode.set(functionName, code);
|
|
1686
|
+
return bundledCode;
|
|
1688
1687
|
}
|
|
1689
1688
|
|
|
1690
1689
|
//#endregion
|
|
@@ -2688,12 +2687,11 @@ async function bundleScriptTarget(args) {
|
|
|
2688
2687
|
${kind}: ${fnSource}`);
|
|
2689
2688
|
const entryContent = buildMinimalEntryFromResolved(imports, declarations, fnSource, sourceFilePath);
|
|
2690
2689
|
const entryPath = join(tempDir, `tailordb-script-${targetIndex}.entry.ts`);
|
|
2691
|
-
const outputPath = join(tempDir, `tailordb-script-${targetIndex}.bundle.cjs`);
|
|
2692
2690
|
writeFileSync(entryPath, entryContent);
|
|
2693
|
-
await rolldown.build(
|
|
2691
|
+
const bundledCode = (await rolldown.build({
|
|
2694
2692
|
input: entryPath,
|
|
2693
|
+
write: false,
|
|
2695
2694
|
output: {
|
|
2696
|
-
file: outputPath,
|
|
2697
2695
|
format: "cjs",
|
|
2698
2696
|
sourcemap: false,
|
|
2699
2697
|
minify: true,
|
|
@@ -2706,8 +2704,8 @@ async function bundleScriptTarget(args) {
|
|
|
2706
2704
|
unknownGlobalSideEffects: false
|
|
2707
2705
|
},
|
|
2708
2706
|
logLevel: "silent"
|
|
2709
|
-
}));
|
|
2710
|
-
return buildPrecompiledExpr(
|
|
2707
|
+
})).output[0].code;
|
|
2708
|
+
return buildPrecompiledExpr(bundledCode);
|
|
2711
2709
|
}
|
|
2712
2710
|
/**
|
|
2713
2711
|
* Precompile TailorDB hooks/validators into self-contained script expressions using rolldown.
|
|
@@ -3318,14 +3316,15 @@ async function loadExecutor(executorFilePath) {
|
|
|
3318
3316
|
* 1. Creates entry file that extracts operation.body
|
|
3319
3317
|
* 2. Bundles in a single step with tree-shaking
|
|
3320
3318
|
* @param options - Bundle executor options
|
|
3321
|
-
* @returns
|
|
3319
|
+
* @returns Map of executor name to bundled code
|
|
3322
3320
|
*/
|
|
3323
3321
|
async function bundleExecutors(options) {
|
|
3322
|
+
const bundledCode = /* @__PURE__ */ new Map();
|
|
3324
3323
|
const { config, triggerContext, additionalFiles = [], cache, inlineSourcemap } = options;
|
|
3325
3324
|
const files = [...loadFilesWithIgnores(config), ...additionalFiles];
|
|
3326
3325
|
if (files.length === 0) {
|
|
3327
3326
|
logger.warn(`No executor files found for patterns: ${config.files?.join(", ") ?? "(none)"}`);
|
|
3328
|
-
return;
|
|
3327
|
+
return bundledCode;
|
|
3329
3328
|
}
|
|
3330
3329
|
logger.newline();
|
|
3331
3330
|
logger.log(`Bundling ${styles.highlight(files.length.toString())} files for ${styles.info("\"executor\"")}`);
|
|
@@ -3347,7 +3346,7 @@ async function bundleExecutors(options) {
|
|
|
3347
3346
|
}
|
|
3348
3347
|
if (executors.length === 0) {
|
|
3349
3348
|
logger.debug(" No function executors to bundle");
|
|
3350
|
-
return;
|
|
3349
|
+
return bundledCode;
|
|
3351
3350
|
}
|
|
3352
3351
|
const outputDir = path.resolve(getDistDir(), "executors");
|
|
3353
3352
|
fs$1.mkdirSync(outputDir, { recursive: true });
|
|
@@ -3358,11 +3357,12 @@ async function bundleExecutors(options) {
|
|
|
3358
3357
|
} catch {
|
|
3359
3358
|
tsconfig = void 0;
|
|
3360
3359
|
}
|
|
3361
|
-
await Promise.all(executors.map((executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap)));
|
|
3360
|
+
const results = await Promise.all(executors.map((executor) => bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap)));
|
|
3361
|
+
for (const [name, code] of results) bundledCode.set(name, code);
|
|
3362
3362
|
logger.log(`${styles.success("Bundled")} ${styles.info("\"executor\"")}`);
|
|
3363
|
+
return bundledCode;
|
|
3363
3364
|
}
|
|
3364
3365
|
async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
|
|
3365
|
-
const outputPath = path.join(outputDir, `${executor.name}.js`);
|
|
3366
3366
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
3367
3367
|
const contextHash = computeBundlerContextHash({
|
|
3368
3368
|
sourceFile: executor.sourceFile,
|
|
@@ -3370,12 +3370,11 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
|
|
|
3370
3370
|
tsconfig,
|
|
3371
3371
|
inlineSourcemap
|
|
3372
3372
|
});
|
|
3373
|
-
await withCache({
|
|
3373
|
+
const code = await withCache({
|
|
3374
3374
|
cache,
|
|
3375
3375
|
kind: "executor",
|
|
3376
3376
|
name: executor.name,
|
|
3377
3377
|
sourceFile: executor.sourceFile,
|
|
3378
|
-
outputPath,
|
|
3379
3378
|
contextHash,
|
|
3380
3379
|
async build(cachePlugins) {
|
|
3381
3380
|
const entryPath = path.join(outputDir, `${executor.name}.entry.js`);
|
|
@@ -3390,10 +3389,10 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
|
|
|
3390
3389
|
const triggerPlugin = createTriggerTransformPlugin(triggerContext);
|
|
3391
3390
|
const plugins = triggerPlugin ? [triggerPlugin] : [];
|
|
3392
3391
|
plugins.push(...cachePlugins);
|
|
3393
|
-
await rolldown.build(
|
|
3392
|
+
return (await rolldown.build({
|
|
3394
3393
|
input: entryPath,
|
|
3394
|
+
write: false,
|
|
3395
3395
|
output: {
|
|
3396
|
-
file: outputPath,
|
|
3397
3396
|
format: "esm",
|
|
3398
3397
|
sourcemap: inlineSourcemap ? "inline" : true,
|
|
3399
3398
|
minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
|
|
@@ -3407,9 +3406,10 @@ async function bundleSingleExecutor(executor, outputDir, tsconfig, triggerContex
|
|
|
3407
3406
|
unknownGlobalSideEffects: false
|
|
3408
3407
|
},
|
|
3409
3408
|
logLevel: "silent"
|
|
3410
|
-
}));
|
|
3409
|
+
})).output[0].code;
|
|
3411
3410
|
}
|
|
3412
3411
|
});
|
|
3412
|
+
return [executor.name, code];
|
|
3413
3413
|
}
|
|
3414
3414
|
|
|
3415
3415
|
//#endregion
|
|
@@ -3505,13 +3505,14 @@ async function loadResolver(resolverFilePath) {
|
|
|
3505
3505
|
* @param triggerContext - Trigger context for workflow/job transformations
|
|
3506
3506
|
* @param cache - Optional bundle cache for skipping unchanged builds
|
|
3507
3507
|
* @param inlineSourcemap - Whether to enable inline sourcemaps
|
|
3508
|
-
* @returns
|
|
3508
|
+
* @returns Map of resolver name to bundled code
|
|
3509
3509
|
*/
|
|
3510
3510
|
async function bundleResolvers(namespace, config, triggerContext, cache, inlineSourcemap) {
|
|
3511
|
+
const bundledCode = /* @__PURE__ */ new Map();
|
|
3511
3512
|
const files = loadFilesWithIgnores(config);
|
|
3512
3513
|
if (files.length === 0) {
|
|
3513
3514
|
logger.warn(`No resolver files found for patterns: ${config.files?.join(", ") ?? "(none)"}`);
|
|
3514
|
-
return;
|
|
3515
|
+
return bundledCode;
|
|
3515
3516
|
}
|
|
3516
3517
|
logger.newline();
|
|
3517
3518
|
logger.log(`Bundling ${styles.highlight(files.length.toString())} files for ${styles.info(`"${namespace}"`)}`);
|
|
@@ -3536,11 +3537,12 @@ async function bundleResolvers(namespace, config, triggerContext, cache, inlineS
|
|
|
3536
3537
|
} catch {
|
|
3537
3538
|
tsconfig = void 0;
|
|
3538
3539
|
}
|
|
3539
|
-
await Promise.all(resolvers.map((resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap)));
|
|
3540
|
+
const results = await Promise.all(resolvers.map((resolver) => bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap)));
|
|
3541
|
+
for (const [name, code] of results) bundledCode.set(name, code);
|
|
3540
3542
|
logger.log(`${styles.success("Bundled")} ${styles.info(`"${namespace}"`)}`);
|
|
3543
|
+
return bundledCode;
|
|
3541
3544
|
}
|
|
3542
3545
|
async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContext, cache, inlineSourcemap) {
|
|
3543
|
-
const outputPath = path.join(outputDir, `${resolver.name}.js`);
|
|
3544
3546
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
3545
3547
|
const contextHash = computeBundlerContextHash({
|
|
3546
3548
|
sourceFile: resolver.sourceFile,
|
|
@@ -3548,12 +3550,11 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
|
|
|
3548
3550
|
tsconfig,
|
|
3549
3551
|
inlineSourcemap
|
|
3550
3552
|
});
|
|
3551
|
-
await withCache({
|
|
3553
|
+
const code = await withCache({
|
|
3552
3554
|
cache,
|
|
3553
3555
|
kind: "resolver",
|
|
3554
3556
|
name: resolver.name,
|
|
3555
3557
|
sourceFile: resolver.sourceFile,
|
|
3556
|
-
outputPath,
|
|
3557
3558
|
contextHash,
|
|
3558
3559
|
async build(cachePlugins) {
|
|
3559
3560
|
const entryPath = path.join(outputDir, `${resolver.name}.entry.js`);
|
|
@@ -3589,10 +3590,10 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
|
|
|
3589
3590
|
const triggerPlugin = createTriggerTransformPlugin(triggerContext);
|
|
3590
3591
|
const plugins = triggerPlugin ? [triggerPlugin] : [];
|
|
3591
3592
|
plugins.push(...cachePlugins);
|
|
3592
|
-
await rolldown.build(
|
|
3593
|
+
return (await rolldown.build({
|
|
3593
3594
|
input: entryPath,
|
|
3595
|
+
write: false,
|
|
3594
3596
|
output: {
|
|
3595
|
-
file: outputPath,
|
|
3596
3597
|
format: "esm",
|
|
3597
3598
|
sourcemap: inlineSourcemap ? "inline" : true,
|
|
3598
3599
|
minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
|
|
@@ -3606,9 +3607,10 @@ async function bundleSingleResolver(resolver, outputDir, tsconfig, triggerContex
|
|
|
3606
3607
|
unknownGlobalSideEffects: false
|
|
3607
3608
|
},
|
|
3608
3609
|
logLevel: "silent"
|
|
3609
|
-
}));
|
|
3610
|
+
})).output[0].code;
|
|
3610
3611
|
}
|
|
3611
3612
|
});
|
|
3613
|
+
return [resolver.name, code];
|
|
3612
3614
|
}
|
|
3613
3615
|
|
|
3614
3616
|
//#endregion
|
|
@@ -3829,7 +3831,10 @@ function transformWorkflowSource(source, targetJobName, targetJobExportName, oth
|
|
|
3829
3831
|
async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContext, cache, inlineSourcemap) {
|
|
3830
3832
|
if (allJobs.length === 0) {
|
|
3831
3833
|
logger.warn("No workflow jobs to bundle");
|
|
3832
|
-
return {
|
|
3834
|
+
return {
|
|
3835
|
+
mainJobDeps: {},
|
|
3836
|
+
bundledCode: /* @__PURE__ */ new Map()
|
|
3837
|
+
};
|
|
3833
3838
|
}
|
|
3834
3839
|
const { usedJobs, mainJobDeps } = await filterUsedJobs(allJobs, mainJobNames);
|
|
3835
3840
|
logger.newline();
|
|
@@ -3846,9 +3851,14 @@ async function bundleWorkflowJobs(allJobs, mainJobNames, env = {}, triggerContex
|
|
|
3846
3851
|
} catch {
|
|
3847
3852
|
tsconfig = void 0;
|
|
3848
3853
|
}
|
|
3849
|
-
await Promise.all(usedJobs.map((job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap)));
|
|
3854
|
+
const results = await Promise.all(usedJobs.map((job) => bundleSingleJob(job, usedJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap)));
|
|
3855
|
+
const bundledCode = /* @__PURE__ */ new Map();
|
|
3856
|
+
for (const [name, code] of results) bundledCode.set(name, code);
|
|
3850
3857
|
logger.log(`${styles.success("Bundled")} ${styles.info("\"workflow-job\"")}`);
|
|
3851
|
-
return {
|
|
3858
|
+
return {
|
|
3859
|
+
mainJobDeps,
|
|
3860
|
+
bundledCode
|
|
3861
|
+
};
|
|
3852
3862
|
}
|
|
3853
3863
|
/**
|
|
3854
3864
|
* Filter jobs to only include those that are actually used.
|
|
@@ -3923,7 +3933,6 @@ async function filterUsedJobs(allJobs, mainJobNames) {
|
|
|
3923
3933
|
};
|
|
3924
3934
|
}
|
|
3925
3935
|
async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerContext, cache, inlineSourcemap) {
|
|
3926
|
-
const outputPath = path.join(outputDir, `${job.name}.js`);
|
|
3927
3936
|
const serializedTriggerContext = serializeTriggerContext(triggerContext);
|
|
3928
3937
|
const sortedEnvPrefix = JSON.stringify(Object.fromEntries(Object.entries(env).sort(([a], [b]) => a.localeCompare(b))));
|
|
3929
3938
|
const contextHash = computeBundlerContextHash({
|
|
@@ -3933,12 +3942,11 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
3933
3942
|
inlineSourcemap,
|
|
3934
3943
|
prefix: sortedEnvPrefix
|
|
3935
3944
|
});
|
|
3936
|
-
await withCache({
|
|
3945
|
+
const code = await withCache({
|
|
3937
3946
|
cache,
|
|
3938
3947
|
kind: "workflow-job",
|
|
3939
3948
|
name: job.name,
|
|
3940
3949
|
sourceFile: job.sourceFile,
|
|
3941
|
-
outputPath,
|
|
3942
3950
|
contextHash,
|
|
3943
3951
|
async build(cachePlugins) {
|
|
3944
3952
|
const entryPath = path.join(outputDir, `${job.name}.entry.js`);
|
|
@@ -3967,10 +3975,10 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
3967
3975
|
}
|
|
3968
3976
|
}
|
|
3969
3977
|
}, ...cachePlugins];
|
|
3970
|
-
await rolldown.build(
|
|
3978
|
+
return (await rolldown.build({
|
|
3971
3979
|
input: entryPath,
|
|
3980
|
+
write: false,
|
|
3972
3981
|
output: {
|
|
3973
|
-
file: outputPath,
|
|
3974
3982
|
format: "esm",
|
|
3975
3983
|
sourcemap: inlineSourcemap ? "inline" : true,
|
|
3976
3984
|
minify: inlineSourcemap ? { mangle: { keepNames: true } } : true,
|
|
@@ -3984,9 +3992,10 @@ async function bundleSingleJob(job, allJobs, outputDir, tsconfig, env, triggerCo
|
|
|
3984
3992
|
unknownGlobalSideEffects: false
|
|
3985
3993
|
},
|
|
3986
3994
|
logLevel: "silent"
|
|
3987
|
-
}));
|
|
3995
|
+
})).output[0].code;
|
|
3988
3996
|
}
|
|
3989
3997
|
});
|
|
3998
|
+
return [job.name, code];
|
|
3990
3999
|
}
|
|
3991
4000
|
|
|
3992
4001
|
//#endregion
|
|
@@ -4648,8 +4657,17 @@ async function loadApplication(params) {
|
|
|
4648
4657
|
if (workflowService) await workflowService.loadWorkflows();
|
|
4649
4658
|
const triggerContext = await buildTriggerContext(config.workflow);
|
|
4650
4659
|
const inlineSourcemap = resolveInlineSourcemap(config.inlineSourcemap);
|
|
4651
|
-
|
|
4652
|
-
|
|
4660
|
+
const bundledScripts = {
|
|
4661
|
+
resolvers: /* @__PURE__ */ new Map(),
|
|
4662
|
+
executors: /* @__PURE__ */ new Map(),
|
|
4663
|
+
workflowJobs: /* @__PURE__ */ new Map(),
|
|
4664
|
+
authHooks: /* @__PURE__ */ new Map()
|
|
4665
|
+
};
|
|
4666
|
+
for (const pipeline of resolverResult.resolverServices) {
|
|
4667
|
+
const resolverBundles = await bundleResolvers(pipeline.namespace, pipeline.config, triggerContext, bundleCache, inlineSourcemap);
|
|
4668
|
+
for (const [name, code] of resolverBundles) bundledScripts.resolvers.set(name, code);
|
|
4669
|
+
}
|
|
4670
|
+
if (executorService) bundledScripts.executors = await bundleExecutors({
|
|
4653
4671
|
config: executorService.config,
|
|
4654
4672
|
triggerContext,
|
|
4655
4673
|
additionalFiles: [...pluginExecutorFiles],
|
|
@@ -4660,10 +4678,11 @@ async function loadApplication(params) {
|
|
|
4660
4678
|
if (workflowService && workflowService.jobs.length > 0) {
|
|
4661
4679
|
const mainJobNames = workflowService.workflowSources.map((ws) => ws.workflow.mainJob.name);
|
|
4662
4680
|
workflowBuildResult = await bundleWorkflowJobs(workflowService.jobs, mainJobNames, config.env ?? {}, triggerContext, bundleCache, inlineSourcemap);
|
|
4681
|
+
bundledScripts.workflowJobs = workflowBuildResult.bundledCode;
|
|
4663
4682
|
}
|
|
4664
4683
|
if (authResult.authService?.config.hooks?.beforeLogin) {
|
|
4665
4684
|
const authName = authResult.authService.config.name;
|
|
4666
|
-
await bundleAuthHooks({
|
|
4685
|
+
bundledScripts.authHooks = await bundleAuthHooks({
|
|
4667
4686
|
configPath: config.path,
|
|
4668
4687
|
authName,
|
|
4669
4688
|
handlerAccessPath: `auth.hooks.beforeLogin.handler`,
|
|
@@ -4692,10 +4711,11 @@ async function loadApplication(params) {
|
|
|
4692
4711
|
secrets,
|
|
4693
4712
|
env: config.env ?? {}
|
|
4694
4713
|
}),
|
|
4695
|
-
workflowBuildResult
|
|
4714
|
+
workflowBuildResult,
|
|
4715
|
+
bundledScripts
|
|
4696
4716
|
};
|
|
4697
4717
|
}
|
|
4698
4718
|
|
|
4699
4719
|
//#endregion
|
|
4700
4720
|
export { writePlatformConfig as S, hashFile as _, loadConfig as a, loadWorkspaceId as b, ExecutorSchema as c, TailorDBTypeSchema as d, stringifyFunction as f, getDistDir as g, createBundleCache as h, resolveInlineSourcemap as i, OAuth2ClientSchema as l, loadFilesWithIgnores as m, generatePluginFilesIfNeeded as n, WorkflowJobSchema as o, tailorUserMap as p, loadApplication as r, createExecutorService as s, defineApplication as t, ResolverSchema as u, fetchLatestToken as v, readPlatformConfig as x, loadAccessToken as y };
|
|
4701
|
-
//# sourceMappingURL=application-
|
|
4721
|
+
//# sourceMappingURL=application-Bf8SUAtR.mjs.map
|