@tailor-platform/sdk 1.1.2 → 1.2.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 +68 -0
- package/dist/{chunk-DhYkiPYI.mjs → chunk-CIV_ash9.mjs} +2 -2
- package/dist/cli/index.mjs +36 -28
- package/dist/cli/index.mjs.map +1 -1
- package/dist/cli/lib.mjs +2 -2
- package/dist/config-Bc_PBkyF.mjs.map +1 -1
- package/dist/configure/index.d.mts +2 -2
- package/dist/configure/index.mjs.map +1 -1
- package/dist/{index-BZTdfjoO.d.mts → index-Dz4RseTN.d.mts} +29 -20
- package/dist/{jiti-CuWZt63q.mjs → jiti-1z3eKztL.mjs} +2 -2
- package/dist/{jiti-CuWZt63q.mjs.map → jiti-1z3eKztL.mjs.map} +1 -1
- package/dist/{list-BrjIcqAX.mjs → list-9sLkfPfn.mjs} +269 -163
- package/dist/list-9sLkfPfn.mjs.map +1 -0
- package/dist/{src-BU1BDRRs.mjs → src-BhwQdist.mjs} +2 -2
- package/dist/{src-BU1BDRRs.mjs.map → src-BhwQdist.mjs.map} +1 -1
- package/dist/utils/test/index.d.mts +1 -1
- package/package.json +5 -5
- package/dist/list-BrjIcqAX.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as
|
|
1
|
+
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "./chunk-CIV_ash9.mjs";
|
|
2
2
|
import { i as WORKFLOW_JOB_BRAND, r as getDistDir } from "./config-Bc_PBkyF.mjs";
|
|
3
3
|
import Module, { createRequire } from "node:module";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
@@ -7,7 +7,10 @@ import path from "node:path";
|
|
|
7
7
|
import { loadEnvFile } from "node:process";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import chalk from "chalk";
|
|
10
|
+
import util, { formatWithOptions } from "node:util";
|
|
10
11
|
import { createConsola } from "consola";
|
|
12
|
+
import { formatDistanceToNowStrict } from "date-fns";
|
|
13
|
+
import { getBorderCharacters, table } from "table";
|
|
11
14
|
import { OAuth2Client } from "@badgateway/oauth2-client";
|
|
12
15
|
import { MethodOptions_IdempotencyLevel, ValueSchema, file_google_protobuf_descriptor, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_protobuf_struct, file_google_protobuf_timestamp, timestampDate } from "@bufbuild/protobuf/wkt";
|
|
13
16
|
import { Code, ConnectError, createClient } from "@connectrpc/connect";
|
|
@@ -24,7 +27,6 @@ import ml from "multiline-ts";
|
|
|
24
27
|
import { xdgConfig } from "xdg-basedir";
|
|
25
28
|
import { pathToFileURL } from "node:url";
|
|
26
29
|
import { glob } from "node:fs/promises";
|
|
27
|
-
import util from "node:util";
|
|
28
30
|
import assert from "node:assert";
|
|
29
31
|
import * as inflection from "inflection";
|
|
30
32
|
import * as rolldown from "rolldown";
|
|
@@ -33,8 +35,6 @@ import { create, fromJson } from "@bufbuild/protobuf";
|
|
|
33
35
|
import { spawn } from "node:child_process";
|
|
34
36
|
import chokidar from "chokidar";
|
|
35
37
|
import * as madgeModule from "madge";
|
|
36
|
-
import { formatDistanceToNowStrict } from "date-fns";
|
|
37
|
-
import { getBorderCharacters, table } from "table";
|
|
38
38
|
import ora from "ora";
|
|
39
39
|
|
|
40
40
|
//#region src/cli/utils/errors.ts
|
|
@@ -250,19 +250,64 @@ const symbols = {
|
|
|
250
250
|
bullet: chalk.gray("•"),
|
|
251
251
|
arrow: chalk.gray("→")
|
|
252
252
|
};
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
253
|
+
let _jsonMode = false;
|
|
254
|
+
const TYPE_ICONS = {
|
|
255
|
+
info: "ℹ",
|
|
256
|
+
success: "✔",
|
|
257
|
+
warn: "⚠",
|
|
258
|
+
error: "✖",
|
|
259
|
+
debug: "⚙",
|
|
260
|
+
trace: "→",
|
|
261
|
+
log: ""
|
|
262
|
+
};
|
|
263
|
+
var IconReporter = class {
|
|
264
|
+
log(logObj, ctx) {
|
|
265
|
+
const stdout = ctx.options.stdout || process.stdout;
|
|
266
|
+
const stderr = ctx.options.stderr || process.stderr;
|
|
267
|
+
const formatOptions = ctx.options.formatOptions;
|
|
268
|
+
const message = formatWithOptions({
|
|
269
|
+
breakLength: stdout.columns || 80,
|
|
270
|
+
compact: formatOptions.compact
|
|
271
|
+
}, ...logObj.args);
|
|
272
|
+
const icon = TYPE_ICONS[logObj.type] || "";
|
|
273
|
+
const prefix = icon ? `${icon} ` : "";
|
|
274
|
+
const timestamp = formatOptions.date && logObj.date ? `${logObj.date.toLocaleTimeString()} ` : "";
|
|
275
|
+
stderr.write(`${timestamp}${prefix}${message}\n`);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
var PlainReporter = class {
|
|
279
|
+
log(logObj, ctx) {
|
|
280
|
+
const stderr = ctx.options.stderr || process.stderr;
|
|
281
|
+
const message = formatWithOptions({
|
|
282
|
+
breakLength: 100,
|
|
283
|
+
compact: ctx.options.formatOptions.compact
|
|
284
|
+
}, ...logObj.args);
|
|
285
|
+
stderr.write(`${message}\n`);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
const defaultLogger = createConsola({
|
|
289
|
+
reporters: [new IconReporter()],
|
|
290
|
+
formatOptions: { date: false }
|
|
291
|
+
});
|
|
292
|
+
const streamLogger = createConsola({
|
|
293
|
+
reporters: [new IconReporter()],
|
|
294
|
+
formatOptions: { date: true }
|
|
295
|
+
});
|
|
296
|
+
const plainLogger = createConsola({
|
|
297
|
+
reporters: [new PlainReporter()],
|
|
298
|
+
formatOptions: {
|
|
299
|
+
date: false,
|
|
300
|
+
compact: true
|
|
301
|
+
}
|
|
302
|
+
});
|
|
262
303
|
const logger = {
|
|
263
|
-
jsonMode
|
|
304
|
+
get jsonMode() {
|
|
305
|
+
return _jsonMode;
|
|
306
|
+
},
|
|
307
|
+
set jsonMode(value) {
|
|
308
|
+
_jsonMode = value;
|
|
309
|
+
},
|
|
264
310
|
info(message, opts) {
|
|
265
|
-
if (this.jsonMode) return;
|
|
266
311
|
switch (opts?.mode ?? "default") {
|
|
267
312
|
case "stream":
|
|
268
313
|
streamLogger.info(message);
|
|
@@ -274,7 +319,6 @@ const logger = {
|
|
|
274
319
|
}
|
|
275
320
|
},
|
|
276
321
|
success(message, opts) {
|
|
277
|
-
if (this.jsonMode) return;
|
|
278
322
|
switch (opts?.mode ?? "default") {
|
|
279
323
|
case "stream":
|
|
280
324
|
streamLogger.success(message);
|
|
@@ -286,7 +330,6 @@ const logger = {
|
|
|
286
330
|
}
|
|
287
331
|
},
|
|
288
332
|
warn(message, opts) {
|
|
289
|
-
if (this.jsonMode) return;
|
|
290
333
|
switch (opts?.mode ?? "default") {
|
|
291
334
|
case "stream":
|
|
292
335
|
streamLogger.warn(message);
|
|
@@ -309,21 +352,45 @@ const logger = {
|
|
|
309
352
|
}
|
|
310
353
|
},
|
|
311
354
|
log(message) {
|
|
312
|
-
if (this.jsonMode) return;
|
|
313
355
|
plainLogger.log(message);
|
|
314
356
|
},
|
|
315
357
|
newline() {
|
|
316
|
-
if (this.jsonMode) return;
|
|
317
358
|
plainLogger.log("");
|
|
318
359
|
},
|
|
319
360
|
debug(message) {
|
|
320
|
-
if (this.jsonMode) return;
|
|
321
361
|
plainLogger.log(styles.dim(message));
|
|
322
362
|
},
|
|
323
|
-
data
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
|
|
363
|
+
out(data$1) {
|
|
364
|
+
if (typeof data$1 === "string") {
|
|
365
|
+
process.stdout.write(data$1.endsWith("\n") ? data$1 : data$1 + "\n");
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (this.jsonMode) {
|
|
369
|
+
console.log(JSON.stringify(data$1));
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (!Array.isArray(data$1)) {
|
|
373
|
+
const t$2 = table(Object.entries(data$1), {
|
|
374
|
+
singleLine: true,
|
|
375
|
+
border: getBorderCharacters("norc")
|
|
376
|
+
});
|
|
377
|
+
process.stdout.write(t$2);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (data$1.length === 0) return;
|
|
381
|
+
const headers = Array.from(new Set(data$1.flatMap((item) => Object.keys(item))));
|
|
382
|
+
const t$1 = table([headers, ...data$1.map((item) => headers.map((header) => {
|
|
383
|
+
const value = item[header];
|
|
384
|
+
if (value === null || value === void 0) return "";
|
|
385
|
+
if ((header === "createdAt" || header === "updatedAt") && typeof value === "string") return formatDistanceToNowStrict(new Date(value), { addSuffix: true });
|
|
386
|
+
return String(value);
|
|
387
|
+
}))], {
|
|
388
|
+
border: getBorderCharacters("norc"),
|
|
389
|
+
drawHorizontalLine: (lineIndex, rowCount) => {
|
|
390
|
+
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
process.stdout.write(t$1);
|
|
327
394
|
},
|
|
328
395
|
prompt(message, options) {
|
|
329
396
|
if (T) throw new CIPromptError();
|
|
@@ -3245,7 +3312,7 @@ var init_visitor_keys$1 = __esmMin((() => {
|
|
|
3245
3312
|
|
|
3246
3313
|
//#endregion
|
|
3247
3314
|
//#region ../../node_modules/eslint-visitor-keys/lib/index.js
|
|
3248
|
-
var lib_exports$2 = /* @__PURE__ */
|
|
3315
|
+
var lib_exports$2 = /* @__PURE__ */ __exportAll({
|
|
3249
3316
|
KEYS: () => visitor_keys_default$1,
|
|
3250
3317
|
getKeys: () => getKeys$1,
|
|
3251
3318
|
unionWith: () => unionWith
|
|
@@ -3582,7 +3649,7 @@ var require_utils$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3582
3649
|
|
|
3583
3650
|
//#endregion
|
|
3584
3651
|
//#region ../../node_modules/acorn/dist/acorn.mjs
|
|
3585
|
-
var acorn_exports = /* @__PURE__ */
|
|
3652
|
+
var acorn_exports = /* @__PURE__ */ __exportAll({
|
|
3586
3653
|
Node: () => Node,
|
|
3587
3654
|
Parser: () => Parser,
|
|
3588
3655
|
Position: () => Position,
|
|
@@ -9692,7 +9759,7 @@ var init_version$1 = __esmMin((() => {
|
|
|
9692
9759
|
|
|
9693
9760
|
//#endregion
|
|
9694
9761
|
//#region ../../node_modules/espree/espree.js
|
|
9695
|
-
var espree_exports = /* @__PURE__ */
|
|
9762
|
+
var espree_exports = /* @__PURE__ */ __exportAll({
|
|
9696
9763
|
Syntax: () => Syntax$3,
|
|
9697
9764
|
VisitorKeys: () => VisitorKeys,
|
|
9698
9765
|
latestEcmaVersion: () => latestEcmaVersion$1,
|
|
@@ -16293,7 +16360,7 @@ var init_lib$2 = __esmMin((() => {
|
|
|
16293
16360
|
|
|
16294
16361
|
//#endregion
|
|
16295
16362
|
//#region ../../node_modules/@eslint-community/eslint-utils/index.mjs
|
|
16296
|
-
var eslint_utils_exports = /* @__PURE__ */
|
|
16363
|
+
var eslint_utils_exports = /* @__PURE__ */ __exportAll({
|
|
16297
16364
|
CALL: () => CALL,
|
|
16298
16365
|
CONSTRUCT: () => CONSTRUCT,
|
|
16299
16366
|
ESM: () => ESM,
|
|
@@ -28138,7 +28205,7 @@ var require_no_continue = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
28138
28205
|
|
|
28139
28206
|
//#endregion
|
|
28140
28207
|
//#region ../../node_modules/@eslint-community/regexpp/index.mjs
|
|
28141
|
-
var regexpp_exports = /* @__PURE__ */
|
|
28208
|
+
var regexpp_exports = /* @__PURE__ */ __exportAll({
|
|
28142
28209
|
AST: () => ast,
|
|
28143
28210
|
RegExpParser: () => RegExpParser,
|
|
28144
28211
|
RegExpSyntaxError: () => RegExpSyntaxError,
|
|
@@ -62328,7 +62395,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62328
62395
|
|
|
62329
62396
|
//#endregion
|
|
62330
62397
|
//#region ../../node_modules/@eslint/plugin-kit/dist/esm/index.js
|
|
62331
|
-
var esm_exports$2 = /* @__PURE__ */
|
|
62398
|
+
var esm_exports$2 = /* @__PURE__ */ __exportAll({
|
|
62332
62399
|
CallMethodStep: () => CallMethodStep,
|
|
62333
62400
|
ConfigCommentParser: () => ConfigCommentParser$1,
|
|
62334
62401
|
Directive: () => Directive,
|
|
@@ -64775,7 +64842,7 @@ var init_version = __esmMin((() => {
|
|
|
64775
64842
|
|
|
64776
64843
|
//#endregion
|
|
64777
64844
|
//#region ../../node_modules/eslint-scope/lib/index.js
|
|
64778
|
-
var lib_exports$1 = /* @__PURE__ */
|
|
64845
|
+
var lib_exports$1 = /* @__PURE__ */ __exportAll({
|
|
64779
64846
|
Definition: () => Definition,
|
|
64780
64847
|
PatternVisitor: () => pattern_visitor_default,
|
|
64781
64848
|
Reference: () => reference_default,
|
|
@@ -68720,7 +68787,7 @@ var require_lodash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68720
68787
|
|
|
68721
68788
|
//#endregion
|
|
68722
68789
|
//#region ../../node_modules/@eslint/eslintrc/lib/shared/config-ops.js
|
|
68723
|
-
var config_ops_exports = /* @__PURE__ */
|
|
68790
|
+
var config_ops_exports = /* @__PURE__ */ __exportAll({
|
|
68724
68791
|
getRuleSeverity: () => getRuleSeverity,
|
|
68725
68792
|
isErrorSeverity: () => isErrorSeverity,
|
|
68726
68793
|
isEverySeverityValid: () => isEverySeverityValid,
|
|
@@ -76819,7 +76886,7 @@ var init_config_validator = __esmMin((() => {
|
|
|
76819
76886
|
|
|
76820
76887
|
//#endregion
|
|
76821
76888
|
//#region ../../node_modules/@eslint/eslintrc/lib/shared/naming.js
|
|
76822
|
-
var naming_exports = /* @__PURE__ */
|
|
76889
|
+
var naming_exports = /* @__PURE__ */ __exportAll({
|
|
76823
76890
|
getNamespaceFromTerm: () => getNamespaceFromTerm,
|
|
76824
76891
|
getShorthandName: () => getShorthandName,
|
|
76825
76892
|
normalizePackageName: () => normalizePackageName
|
|
@@ -76886,7 +76953,7 @@ var init_naming = __esmMin((() => {
|
|
|
76886
76953
|
|
|
76887
76954
|
//#endregion
|
|
76888
76955
|
//#region ../../node_modules/@eslint/eslintrc/lib/index-universal.js
|
|
76889
|
-
var index_universal_exports = /* @__PURE__ */
|
|
76956
|
+
var index_universal_exports = /* @__PURE__ */ __exportAll({ Legacy: () => Legacy$1 });
|
|
76890
76957
|
var Legacy$1;
|
|
76891
76958
|
var init_index_universal = __esmMin((() => {
|
|
76892
76959
|
init_config_ops();
|
|
@@ -77379,7 +77446,7 @@ var require_flat_config_schema = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
77379
77446
|
|
|
77380
77447
|
//#endregion
|
|
77381
77448
|
//#region ../../node_modules/@eslint/config-array/dist/esm/std__path/posix.js
|
|
77382
|
-
var posix_exports = /* @__PURE__ */
|
|
77449
|
+
var posix_exports = /* @__PURE__ */ __exportAll({
|
|
77383
77450
|
DELIMITER: () => DELIMITER$1,
|
|
77384
77451
|
SEPARATOR: () => SEPARATOR$1,
|
|
77385
77452
|
SEPARATOR_PATTERN: () => SEPARATOR_PATTERN$1,
|
|
@@ -78423,7 +78490,7 @@ var init_posix = __esmMin((() => {
|
|
|
78423
78490
|
|
|
78424
78491
|
//#endregion
|
|
78425
78492
|
//#region ../../node_modules/@eslint/config-array/dist/esm/std__path/windows.js
|
|
78426
|
-
var windows_exports = /* @__PURE__ */
|
|
78493
|
+
var windows_exports = /* @__PURE__ */ __exportAll({
|
|
78427
78494
|
DELIMITER: () => DELIMITER,
|
|
78428
78495
|
SEPARATOR: () => SEPARATOR,
|
|
78429
78496
|
SEPARATOR_PATTERN: () => SEPARATOR_PATTERN,
|
|
@@ -79900,7 +79967,7 @@ var init_esm$2 = __esmMin((() => {
|
|
|
79900
79967
|
|
|
79901
79968
|
//#endregion
|
|
79902
79969
|
//#region ../../node_modules/@eslint/config-array/dist/esm/index.js
|
|
79903
|
-
var esm_exports$1 = /* @__PURE__ */
|
|
79970
|
+
var esm_exports$1 = /* @__PURE__ */ __exportAll({
|
|
79904
79971
|
ConfigArray: () => ConfigArray$1,
|
|
79905
79972
|
ConfigArraySymbol: () => ConfigArraySymbol,
|
|
79906
79973
|
ObjectSchema: () => ObjectSchema
|
|
@@ -86396,7 +86463,7 @@ var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
86396
86463
|
|
|
86397
86464
|
//#endregion
|
|
86398
86465
|
//#region ../../node_modules/flatted/esm/index.js
|
|
86399
|
-
var esm_exports = /* @__PURE__ */
|
|
86466
|
+
var esm_exports = /* @__PURE__ */ __exportAll({
|
|
86400
86467
|
fromJSON: () => fromJSON,
|
|
86401
86468
|
parse: () => parse,
|
|
86402
86469
|
stringify: () => stringify$1,
|
|
@@ -87635,7 +87702,7 @@ var require_config_loader = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
87635
87702
|
* @returns {Promise<{createJiti: Function|undefined, version: string;}>} A promise that fulfills with an object containing the jiti module's createJiti function and version.
|
|
87636
87703
|
*/
|
|
87637
87704
|
static async loadJiti() {
|
|
87638
|
-
const { createJiti } = await import("./jiti-
|
|
87705
|
+
const { createJiti } = await import("./jiti-1z3eKztL.mjs");
|
|
87639
87706
|
return {
|
|
87640
87707
|
createJiti,
|
|
87641
87708
|
version: require_package$1().version
|
|
@@ -87977,7 +88044,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
87977
88044
|
*/
|
|
87978
88045
|
async function globMatch({ basePath, pattern }) {
|
|
87979
88046
|
let found = false;
|
|
87980
|
-
const { hfs } = await import("./src-
|
|
88047
|
+
const { hfs } = await import("./src-BhwQdist.mjs");
|
|
87981
88048
|
const matcher = new Minimatch(normalizeToPosix(path$9.relative(basePath, pattern)), MINIMATCH_OPTIONS);
|
|
87982
88049
|
const walkSettings = {
|
|
87983
88050
|
directoryFilter(entry) {
|
|
@@ -88024,7 +88091,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
88024
88091
|
return new Minimatch(patternToUse, MINIMATCH_OPTIONS);
|
|
88025
88092
|
});
|
|
88026
88093
|
const unmatchedPatterns = new Set([...relativeToPatterns.keys()]);
|
|
88027
|
-
const { hfs } = await import("./src-
|
|
88094
|
+
const { hfs } = await import("./src-BhwQdist.mjs");
|
|
88028
88095
|
const walk = hfs.walk(basePath, {
|
|
88029
88096
|
async directoryFilter(entry) {
|
|
88030
88097
|
if (!matchers.some((matcher) => matcher.match(entry.path, true))) return false;
|
|
@@ -88628,7 +88695,7 @@ var require_eslint_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
88628
88695
|
|
|
88629
88696
|
//#endregion
|
|
88630
88697
|
//#region ../../node_modules/eslint/node_modules/@humanwhocodes/retry/dist/retrier.js
|
|
88631
|
-
var retrier_exports = /* @__PURE__ */
|
|
88698
|
+
var retrier_exports = /* @__PURE__ */ __exportAll({ Retrier: () => Retrier });
|
|
88632
88699
|
/**
|
|
88633
88700
|
* Logs a message to the console if the DEBUG environment variable is set.
|
|
88634
88701
|
* @param {string} message The message to log.
|
|
@@ -90790,7 +90857,7 @@ var init_config_array = __esmMin((() => {
|
|
|
90790
90857
|
* Utility for resolving a module relative to another module
|
|
90791
90858
|
* @author Teddy Katz
|
|
90792
90859
|
*/
|
|
90793
|
-
var relative_module_resolver_exports = /* @__PURE__ */
|
|
90860
|
+
var relative_module_resolver_exports = /* @__PURE__ */ __exportAll({ resolve: () => resolve });
|
|
90794
90861
|
/**
|
|
90795
90862
|
* Resolves a Node module relative to another module
|
|
90796
90863
|
* @param {string} moduleName The name of a Node module, or a path to a Node module.
|
|
@@ -91959,7 +92026,7 @@ var init_flat_compat = __esmMin((() => {
|
|
|
91959
92026
|
|
|
91960
92027
|
//#endregion
|
|
91961
92028
|
//#region ../../node_modules/@eslint/eslintrc/lib/index.js
|
|
91962
|
-
var lib_exports = /* @__PURE__ */
|
|
92029
|
+
var lib_exports = /* @__PURE__ */ __exportAll({
|
|
91963
92030
|
FlatCompat: () => FlatCompat,
|
|
91964
92031
|
Legacy: () => Legacy
|
|
91965
92032
|
});
|
|
@@ -100500,6 +100567,13 @@ function generateLinesDbSchemaFile(metadata, importPath) {
|
|
|
100500
100567
|
//#region src/cli/generator/builtin/seed/index.ts
|
|
100501
100568
|
const SeedGeneratorID = "@tailor-platform/seed";
|
|
100502
100569
|
/**
|
|
100570
|
+
* Converts a path to POSIX format (forward slashes).
|
|
100571
|
+
* This ensures consistent import paths across platforms.
|
|
100572
|
+
*/
|
|
100573
|
+
function toPosixPath(p$1) {
|
|
100574
|
+
return p$1.split(path$20.sep).join(path$20.posix.sep);
|
|
100575
|
+
}
|
|
100576
|
+
/**
|
|
100503
100577
|
* Generates the exec.mjs script content (Node.js executable)
|
|
100504
100578
|
*/
|
|
100505
100579
|
function generateExecScript(machineUserName, relativeConfigPath) {
|
|
@@ -100573,7 +100647,7 @@ function createSeedGenerator(options) {
|
|
|
100573
100647
|
content: gqlIngest.graphql
|
|
100574
100648
|
});
|
|
100575
100649
|
const schemaOutputPath = path$20.join(outputBaseDir, "data", `${linesDb.typeName}.schema.ts`);
|
|
100576
|
-
const importPath = path$20.relative(path$20.dirname(schemaOutputPath), linesDb.importPath);
|
|
100650
|
+
const importPath = toPosixPath(path$20.relative(path$20.dirname(schemaOutputPath), linesDb.importPath));
|
|
100577
100651
|
const normalizedImportPath = importPath.replace(/\.ts$/, "").startsWith(".") ? importPath.replace(/\.ts$/, "") : `./${importPath.replace(/\.ts$/, "")}`;
|
|
100578
100652
|
files.push({
|
|
100579
100653
|
path: schemaOutputPath,
|
|
@@ -100614,7 +100688,7 @@ function createSeedGenerator(options) {
|
|
|
100614
100688
|
`
|
|
100615
100689
|
});
|
|
100616
100690
|
if (options.machineUserName) {
|
|
100617
|
-
const relativeConfigPath = path$20.relative(outputDir, configPath)
|
|
100691
|
+
const relativeConfigPath = toPosixPath(path$20.relative(outputDir, configPath));
|
|
100618
100692
|
files.push({
|
|
100619
100693
|
path: path$20.join(outputDir, "exec.mjs"),
|
|
100620
100694
|
content: generateExecScript(options.machineUserName, relativeConfigPath)
|
|
@@ -100788,11 +100862,11 @@ function trnPrefix(workspaceId) {
|
|
|
100788
100862
|
return `trn:v1:workspace:${workspaceId}`;
|
|
100789
100863
|
}
|
|
100790
100864
|
const sdkNameLabelKey = "sdk-name";
|
|
100791
|
-
async function buildMetaRequest(trn$
|
|
100865
|
+
async function buildMetaRequest(trn$7, appName) {
|
|
100792
100866
|
const packageJson$1 = await readPackageJson();
|
|
100793
100867
|
const sdkVersion = packageJson$1.version ? `v${packageJson$1.version.replace(/\./g, "-")}` : "unknown";
|
|
100794
100868
|
return {
|
|
100795
|
-
trn: trn$
|
|
100869
|
+
trn: trn$7,
|
|
100796
100870
|
labels: {
|
|
100797
100871
|
[sdkNameLabelKey]: appName,
|
|
100798
100872
|
"sdk-version": sdkVersion
|
|
@@ -100843,7 +100917,7 @@ async function applyApplication(client, changeSet, phase = "create-update") {
|
|
|
100843
100917
|
await client.deleteApplication(del.request);
|
|
100844
100918
|
}));
|
|
100845
100919
|
}
|
|
100846
|
-
function trn$
|
|
100920
|
+
function trn$6(workspaceId, name$1) {
|
|
100847
100921
|
return `trn:v1:workspace:${workspaceId}:application:${name$1}`;
|
|
100848
100922
|
}
|
|
100849
100923
|
async function planApplication({ client, workspaceId, application, forRemoval }) {
|
|
@@ -100894,7 +100968,7 @@ async function planApplication({ client, workspaceId, application, forRemoval })
|
|
|
100894
100968
|
});
|
|
100895
100969
|
if (idpConfigs.length > 0) authIdpConfigName = idpConfigs[0].name;
|
|
100896
100970
|
}
|
|
100897
|
-
const metaRequest = await buildMetaRequest(trn$
|
|
100971
|
+
const metaRequest = await buildMetaRequest(trn$6(workspaceId, application.name), application.name);
|
|
100898
100972
|
if (existingApplications.some((app) => app.name === application.name)) changeSet.updates.push({
|
|
100899
100973
|
name: application.name,
|
|
100900
100974
|
request: {
|
|
@@ -101030,7 +101104,7 @@ async function planIdP({ client, workspaceId, application, forRemoval }) {
|
|
|
101030
101104
|
resourceOwners
|
|
101031
101105
|
};
|
|
101032
101106
|
}
|
|
101033
|
-
function trn$
|
|
101107
|
+
function trn$5(workspaceId, name$1) {
|
|
101034
101108
|
return `trn:v1:workspace:${workspaceId}:idp:${name$1}`;
|
|
101035
101109
|
}
|
|
101036
101110
|
async function planServices$3(client, workspaceId, appName, idps) {
|
|
@@ -101053,7 +101127,7 @@ async function planServices$3(client, workspaceId, appName, idps) {
|
|
|
101053
101127
|
const existingServices = {};
|
|
101054
101128
|
await Promise.all(withoutLabel.map(async (resource) => {
|
|
101055
101129
|
if (!resource.namespace?.name) return;
|
|
101056
|
-
const { metadata } = await client.getMetadata({ trn: trn$
|
|
101130
|
+
const { metadata } = await client.getMetadata({ trn: trn$5(workspaceId, resource.namespace.name) });
|
|
101057
101131
|
existingServices[resource.namespace.name] = {
|
|
101058
101132
|
resource,
|
|
101059
101133
|
label: metadata?.labels[sdkNameLabelKey]
|
|
@@ -101062,7 +101136,7 @@ async function planServices$3(client, workspaceId, appName, idps) {
|
|
|
101062
101136
|
for (const idp of idps) {
|
|
101063
101137
|
const namespaceName = idp.name;
|
|
101064
101138
|
const existing = existingServices[namespaceName];
|
|
101065
|
-
const metaRequest = await buildMetaRequest(trn$
|
|
101139
|
+
const metaRequest = await buildMetaRequest(trn$5(workspaceId, namespaceName), appName);
|
|
101066
101140
|
let authorization;
|
|
101067
101141
|
switch (idp.authorization) {
|
|
101068
101142
|
case "insecure":
|
|
@@ -101277,7 +101351,7 @@ async function planAuth({ client, workspaceId, application, forRemoval }) {
|
|
|
101277
101351
|
resourceOwners
|
|
101278
101352
|
};
|
|
101279
101353
|
}
|
|
101280
|
-
function trn$
|
|
101354
|
+
function trn$4(workspaceId, name$1) {
|
|
101281
101355
|
return `trn:v1:workspace:${workspaceId}:auth:${name$1}`;
|
|
101282
101356
|
}
|
|
101283
101357
|
async function planServices$2(client, workspaceId, appName, auths) {
|
|
@@ -101300,7 +101374,7 @@ async function planServices$2(client, workspaceId, appName, auths) {
|
|
|
101300
101374
|
const existingServices = {};
|
|
101301
101375
|
await Promise.all(withoutLabel.map(async (resource) => {
|
|
101302
101376
|
if (!resource.namespace?.name) return;
|
|
101303
|
-
const { metadata } = await client.getMetadata({ trn: trn$
|
|
101377
|
+
const { metadata } = await client.getMetadata({ trn: trn$4(workspaceId, resource.namespace.name) });
|
|
101304
101378
|
existingServices[resource.namespace.name] = {
|
|
101305
101379
|
resource,
|
|
101306
101380
|
label: metadata?.labels[sdkNameLabelKey]
|
|
@@ -101309,7 +101383,7 @@ async function planServices$2(client, workspaceId, appName, auths) {
|
|
|
101309
101383
|
for (const auth of auths) {
|
|
101310
101384
|
const { parsedConfig: config } = auth;
|
|
101311
101385
|
const existing = existingServices[config.name];
|
|
101312
|
-
const metaRequest = await buildMetaRequest(trn$
|
|
101386
|
+
const metaRequest = await buildMetaRequest(trn$4(workspaceId, config.name), appName);
|
|
101313
101387
|
if (existing) {
|
|
101314
101388
|
if (!existing.label) unmanaged.push({
|
|
101315
101389
|
resourceType: "Auth service",
|
|
@@ -102119,7 +102193,7 @@ async function applyExecutor(client, result, phase = "create-update") {
|
|
|
102119
102193
|
})]);
|
|
102120
102194
|
else if (phase === "delete") await Promise.all(changeSet.deletes.map((del) => client.deleteExecutorExecutor(del.request)));
|
|
102121
102195
|
}
|
|
102122
|
-
function trn$
|
|
102196
|
+
function trn$3(workspaceId, name$1) {
|
|
102123
102197
|
return `trn:v1:workspace:${workspaceId}:executor:${name$1}`;
|
|
102124
102198
|
}
|
|
102125
102199
|
async function planExecutor({ client, workspaceId, application, forRemoval }) {
|
|
@@ -102141,7 +102215,7 @@ async function planExecutor({ client, workspaceId, application, forRemoval }) {
|
|
|
102141
102215
|
});
|
|
102142
102216
|
const existingExecutors = {};
|
|
102143
102217
|
await Promise.all(withoutLabel.map(async (resource) => {
|
|
102144
|
-
const { metadata } = await client.getMetadata({ trn: trn$
|
|
102218
|
+
const { metadata } = await client.getMetadata({ trn: trn$3(workspaceId, resource.name) });
|
|
102145
102219
|
existingExecutors[resource.name] = {
|
|
102146
102220
|
resource,
|
|
102147
102221
|
label: metadata?.labels[sdkNameLabelKey]
|
|
@@ -102150,7 +102224,7 @@ async function planExecutor({ client, workspaceId, application, forRemoval }) {
|
|
|
102150
102224
|
const executors = forRemoval ? {} : await application.executorService?.loadExecutors() ?? {};
|
|
102151
102225
|
for (const executor of Object.values(executors)) {
|
|
102152
102226
|
const existing = existingExecutors[executor.name];
|
|
102153
|
-
const metaRequest = await buildMetaRequest(trn$
|
|
102227
|
+
const metaRequest = await buildMetaRequest(trn$3(workspaceId, executor.name), application.name);
|
|
102154
102228
|
if (existing) {
|
|
102155
102229
|
if (!existing.label) unmanaged.push({
|
|
102156
102230
|
resourceType: "Executor",
|
|
@@ -102198,10 +102272,20 @@ async function planExecutor({ client, workspaceId, application, forRemoval }) {
|
|
|
102198
102272
|
resourceOwners
|
|
102199
102273
|
};
|
|
102200
102274
|
}
|
|
102275
|
+
/**
|
|
102276
|
+
* Build args expression for resolverExecuted trigger.
|
|
102277
|
+
* Transforms server's succeeded/failed fields to success/result/error fields.
|
|
102278
|
+
*/
|
|
102279
|
+
function buildResolverExecutedArgsExpr(additionalFields) {
|
|
102280
|
+
const baseFields = `...args, appNamespace: args.namespaceName, success: !!args.succeeded, result: args.succeeded?.result.resolver, error: args.failed?.error`;
|
|
102281
|
+
return additionalFields ? `({ ${baseFields}, ${additionalFields} })` : `({ ${baseFields} })`;
|
|
102282
|
+
}
|
|
102201
102283
|
function protoExecutor(appName, executor, env) {
|
|
102202
102284
|
const trigger = executor.trigger;
|
|
102203
102285
|
let triggerType;
|
|
102204
102286
|
let triggerConfig;
|
|
102287
|
+
const envField = `env: ${JSON.stringify(env)}`;
|
|
102288
|
+
const baseArgsExpr = `({ ...args, appNamespace: args.namespaceName, ${envField} })`;
|
|
102205
102289
|
const eventType = {
|
|
102206
102290
|
recordCreated: "tailordb.type_record.created",
|
|
102207
102291
|
recordUpdated: "tailordb.type_record.updated",
|
|
@@ -102227,7 +102311,7 @@ function protoExecutor(appName, executor, env) {
|
|
|
102227
102311
|
case: "event",
|
|
102228
102312
|
value: {
|
|
102229
102313
|
eventType: eventType[trigger.kind],
|
|
102230
|
-
condition: { expr: [`args.typeName === "${trigger.typeName}"`, ...trigger.condition ? [`(${stringifyFunction(trigger.condition)})({
|
|
102314
|
+
condition: { expr: [`args.typeName === "${trigger.typeName}"`, ...trigger.condition ? [`(${stringifyFunction(trigger.condition)})(${baseArgsExpr})`] : []].join(" && ") }
|
|
102231
102315
|
}
|
|
102232
102316
|
} };
|
|
102233
102317
|
break;
|
|
@@ -102237,7 +102321,7 @@ function protoExecutor(appName, executor, env) {
|
|
|
102237
102321
|
case: "event",
|
|
102238
102322
|
value: {
|
|
102239
102323
|
eventType: eventType[trigger.kind],
|
|
102240
|
-
condition: { expr: [`args.resolverName === "${trigger.resolverName}"`, ...trigger.condition ? [`(${stringifyFunction(trigger.condition)})({
|
|
102324
|
+
condition: { expr: [`args.resolverName === "${trigger.resolverName}"`, ...trigger.condition ? [`(${stringifyFunction(trigger.condition)})(${buildResolverExecutedArgsExpr(envField)})`] : []].join(" && ") }
|
|
102241
102325
|
}
|
|
102242
102326
|
} };
|
|
102243
102327
|
break;
|
|
@@ -102253,13 +102337,14 @@ function protoExecutor(appName, executor, env) {
|
|
|
102253
102337
|
const target = executor.operation;
|
|
102254
102338
|
let targetType;
|
|
102255
102339
|
let targetConfig;
|
|
102340
|
+
const argsExpr = trigger.kind === "resolverExecuted" ? buildResolverExecutedArgsExpr(envField) : baseArgsExpr;
|
|
102256
102341
|
switch (target.kind) {
|
|
102257
102342
|
case "webhook":
|
|
102258
102343
|
targetType = ExecutorTargetType.WEBHOOK;
|
|
102259
102344
|
targetConfig = { config: {
|
|
102260
102345
|
case: "webhook",
|
|
102261
102346
|
value: {
|
|
102262
|
-
url: { expr: `(${stringifyFunction(target.url)})(
|
|
102347
|
+
url: { expr: `(${stringifyFunction(target.url)})(${argsExpr})` },
|
|
102263
102348
|
headers: target.headers ? Object.entries(target.headers).map(([key, v$1]) => {
|
|
102264
102349
|
let value;
|
|
102265
102350
|
if (typeof v$1 === "string") value = {
|
|
@@ -102278,7 +102363,7 @@ function protoExecutor(appName, executor, env) {
|
|
|
102278
102363
|
value
|
|
102279
102364
|
};
|
|
102280
102365
|
}) : void 0,
|
|
102281
|
-
body: target.requestBody ? { expr: `(${stringifyFunction(target.requestBody)})(
|
|
102366
|
+
body: target.requestBody ? { expr: `(${stringifyFunction(target.requestBody)})(${argsExpr})` } : void 0
|
|
102282
102367
|
}
|
|
102283
102368
|
} };
|
|
102284
102369
|
break;
|
|
@@ -102289,7 +102374,7 @@ function protoExecutor(appName, executor, env) {
|
|
|
102289
102374
|
value: {
|
|
102290
102375
|
appName: target.appName ?? appName,
|
|
102291
102376
|
query: target.query,
|
|
102292
|
-
variables: target.variables ? { expr: `(${stringifyFunction(target.variables)})(
|
|
102377
|
+
variables: target.variables ? { expr: `(${stringifyFunction(target.variables)})(${argsExpr})` } : void 0,
|
|
102293
102378
|
invoker: target.authInvoker ?? void 0
|
|
102294
102379
|
}
|
|
102295
102380
|
} };
|
|
@@ -102305,7 +102390,7 @@ function protoExecutor(appName, executor, env) {
|
|
|
102305
102390
|
value: {
|
|
102306
102391
|
name: `${executor.name}__target`,
|
|
102307
102392
|
script,
|
|
102308
|
-
variables: { expr:
|
|
102393
|
+
variables: { expr: argsExpr },
|
|
102309
102394
|
invoker: target.authInvoker ?? void 0
|
|
102310
102395
|
}
|
|
102311
102396
|
} };
|
|
@@ -102317,7 +102402,7 @@ function protoExecutor(appName, executor, env) {
|
|
|
102317
102402
|
case: "workflow",
|
|
102318
102403
|
value: {
|
|
102319
102404
|
workflowName: target.workflowName,
|
|
102320
|
-
variables: target.args ? typeof target.args === "function" ? { expr: `(${stringifyFunction(target.args)})(
|
|
102405
|
+
variables: target.args ? typeof target.args === "function" ? { expr: `(${stringifyFunction(target.args)})(${argsExpr})` } : { expr: JSON.stringify(target.args) } : void 0,
|
|
102321
102406
|
invoker: target.authInvoker ?? void 0
|
|
102322
102407
|
}
|
|
102323
102408
|
} };
|
|
@@ -102406,7 +102491,7 @@ async function planPipeline({ client, workspaceId, application, forRemoval }) {
|
|
|
102406
102491
|
resourceOwners
|
|
102407
102492
|
};
|
|
102408
102493
|
}
|
|
102409
|
-
function trn$
|
|
102494
|
+
function trn$2(workspaceId, name$1) {
|
|
102410
102495
|
return `trn:v1:workspace:${workspaceId}:pipeline:${name$1}`;
|
|
102411
102496
|
}
|
|
102412
102497
|
async function planServices$1(client, workspaceId, appName, pipelines) {
|
|
@@ -102429,7 +102514,7 @@ async function planServices$1(client, workspaceId, appName, pipelines) {
|
|
|
102429
102514
|
const existingServices = {};
|
|
102430
102515
|
await Promise.all(withoutLabel.map(async (resource) => {
|
|
102431
102516
|
if (!resource.namespace?.name) return;
|
|
102432
|
-
const { metadata } = await client.getMetadata({ trn: trn$
|
|
102517
|
+
const { metadata } = await client.getMetadata({ trn: trn$2(workspaceId, resource.namespace.name) });
|
|
102433
102518
|
existingServices[resource.namespace.name] = {
|
|
102434
102519
|
resource,
|
|
102435
102520
|
label: metadata?.labels[sdkNameLabelKey]
|
|
@@ -102437,7 +102522,7 @@ async function planServices$1(client, workspaceId, appName, pipelines) {
|
|
|
102437
102522
|
}));
|
|
102438
102523
|
for (const pipeline of pipelines) {
|
|
102439
102524
|
const existing = existingServices[pipeline.namespace];
|
|
102440
|
-
const metaRequest = await buildMetaRequest(trn$
|
|
102525
|
+
const metaRequest = await buildMetaRequest(trn$2(workspaceId, pipeline.namespace), appName);
|
|
102441
102526
|
if (existing) {
|
|
102442
102527
|
if (!existing.label) unmanaged.push({
|
|
102443
102528
|
resourceType: "Pipeline service",
|
|
@@ -102630,7 +102715,7 @@ async function applyStaticWebsite(client, result, phase = "create-update") {
|
|
|
102630
102715
|
})]);
|
|
102631
102716
|
else if (phase === "delete") await Promise.all(changeSet.deletes.map((del) => client.deleteStaticWebsite(del.request)));
|
|
102632
102717
|
}
|
|
102633
|
-
function trn$
|
|
102718
|
+
function trn$1(workspaceId, name$1) {
|
|
102634
102719
|
return `trn:v1:workspace:${workspaceId}:staticwebsite:${name$1}`;
|
|
102635
102720
|
}
|
|
102636
102721
|
async function planStaticWebsite({ client, workspaceId, application, forRemoval }) {
|
|
@@ -102652,7 +102737,7 @@ async function planStaticWebsite({ client, workspaceId, application, forRemoval
|
|
|
102652
102737
|
});
|
|
102653
102738
|
const existingWebsites = {};
|
|
102654
102739
|
await Promise.all(withoutLabel.map(async (resource) => {
|
|
102655
|
-
const { metadata } = await client.getMetadata({ trn: trn$
|
|
102740
|
+
const { metadata } = await client.getMetadata({ trn: trn$1(workspaceId, resource.name) });
|
|
102656
102741
|
existingWebsites[resource.name] = {
|
|
102657
102742
|
resource,
|
|
102658
102743
|
label: metadata?.labels[sdkNameLabelKey]
|
|
@@ -102663,7 +102748,7 @@ async function planStaticWebsite({ client, workspaceId, application, forRemoval
|
|
|
102663
102748
|
const config = websiteService;
|
|
102664
102749
|
const name$1 = websiteService.name;
|
|
102665
102750
|
const existing = existingWebsites[name$1];
|
|
102666
|
-
const metaRequest = await buildMetaRequest(trn$
|
|
102751
|
+
const metaRequest = await buildMetaRequest(trn$1(workspaceId, name$1), application.name);
|
|
102667
102752
|
if (existing) {
|
|
102668
102753
|
if (!existing.label) unmanaged.push({
|
|
102669
102754
|
resourceType: "StaticWebsite",
|
|
@@ -102761,7 +102846,7 @@ async function planTailorDB({ client, workspaceId, application, forRemoval }) {
|
|
|
102761
102846
|
resourceOwners
|
|
102762
102847
|
};
|
|
102763
102848
|
}
|
|
102764
|
-
function trn
|
|
102849
|
+
function trn(workspaceId, name$1) {
|
|
102765
102850
|
return `${trnPrefix(workspaceId)}:tailordb:${name$1}`;
|
|
102766
102851
|
}
|
|
102767
102852
|
async function planServices(client, workspaceId, appName, tailordbs) {
|
|
@@ -102784,7 +102869,7 @@ async function planServices(client, workspaceId, appName, tailordbs) {
|
|
|
102784
102869
|
const existingServices = {};
|
|
102785
102870
|
await Promise.all(withoutLabel.map(async (resource) => {
|
|
102786
102871
|
if (!resource.namespace?.name) return;
|
|
102787
|
-
const { metadata } = await client.getMetadata({ trn: trn
|
|
102872
|
+
const { metadata } = await client.getMetadata({ trn: trn(workspaceId, resource.namespace.name) });
|
|
102788
102873
|
existingServices[resource.namespace.name] = {
|
|
102789
102874
|
resource,
|
|
102790
102875
|
label: metadata?.labels[sdkNameLabelKey]
|
|
@@ -102792,7 +102877,7 @@ async function planServices(client, workspaceId, appName, tailordbs) {
|
|
|
102792
102877
|
}));
|
|
102793
102878
|
for (const tailordb of tailordbs) {
|
|
102794
102879
|
const existing = existingServices[tailordb.namespace];
|
|
102795
|
-
const metaRequest = await buildMetaRequest(trn
|
|
102880
|
+
const metaRequest = await buildMetaRequest(trn(workspaceId, tailordb.namespace), appName);
|
|
102796
102881
|
if (existing) {
|
|
102797
102882
|
if (!existing.label) unmanaged.push({
|
|
102798
102883
|
resourceType: "TailorDB service",
|
|
@@ -103265,9 +103350,9 @@ function protoGqlOperand(operand) {
|
|
|
103265
103350
|
//#endregion
|
|
103266
103351
|
//#region src/cli/apply/services/workflow.ts
|
|
103267
103352
|
async function applyWorkflow(client, result, phase = "create-update") {
|
|
103268
|
-
const { changeSet } = result;
|
|
103353
|
+
const { changeSet, appName } = result;
|
|
103269
103354
|
if (phase === "create-update") {
|
|
103270
|
-
const jobFunctionVersions = await registerJobFunctions(client, changeSet);
|
|
103355
|
+
const jobFunctionVersions = await registerJobFunctions(client, changeSet, appName);
|
|
103271
103356
|
await Promise.all([...changeSet.creates.map(async (create$1) => {
|
|
103272
103357
|
const filteredVersions = filterJobFunctionVersions(jobFunctionVersions, create$1.usedJobNames);
|
|
103273
103358
|
await client.createWorkflow({
|
|
@@ -103304,44 +103389,58 @@ function filterJobFunctionVersions(allVersions, usedJobNames) {
|
|
|
103304
103389
|
* Register job functions used by any workflow.
|
|
103305
103390
|
* Only registers jobs that are actually used (based on usedJobNames in changeSet).
|
|
103306
103391
|
* Uses create for new jobs and update for existing jobs.
|
|
103392
|
+
* Sets metadata on used JobFunctions and removes metadata from unused ones.
|
|
103307
103393
|
*/
|
|
103308
|
-
async function registerJobFunctions(client, changeSet) {
|
|
103394
|
+
async function registerJobFunctions(client, changeSet, appName) {
|
|
103309
103395
|
const jobFunctionVersions = {};
|
|
103310
103396
|
const firstWorkflow = changeSet.creates[0] || changeSet.updates[0];
|
|
103311
103397
|
if (!firstWorkflow) return jobFunctionVersions;
|
|
103312
103398
|
const { workspaceId, scripts } = firstWorkflow;
|
|
103313
103399
|
const allUsedJobNames = /* @__PURE__ */ new Set();
|
|
103314
103400
|
for (const item of [...changeSet.creates, ...changeSet.updates]) for (const jobName of item.usedJobNames) allUsedJobNames.add(jobName);
|
|
103315
|
-
const
|
|
103401
|
+
const existingJobFunctions = await fetchAll(async (pageToken) => {
|
|
103316
103402
|
const response = await client.listWorkflowJobFunctions({
|
|
103317
103403
|
workspaceId,
|
|
103318
103404
|
pageToken
|
|
103319
103405
|
});
|
|
103320
103406
|
return [response.jobFunctions.map((j) => j.name), response.nextPageToken];
|
|
103321
103407
|
});
|
|
103322
|
-
const existingJobNamesSet = new Set(
|
|
103408
|
+
const existingJobNamesSet = new Set(existingJobFunctions);
|
|
103323
103409
|
const results = await Promise.all(Array.from(allUsedJobNames).map(async (jobName) => {
|
|
103324
103410
|
const script = scripts.get(jobName);
|
|
103325
103411
|
if (!script) throw new Error(`No bundled script found for job "${jobName}". Please run "generate" command before "apply".`);
|
|
103412
|
+
const response = existingJobNamesSet.has(jobName) ? await client.updateWorkflowJobFunction({
|
|
103413
|
+
workspaceId,
|
|
103414
|
+
jobFunctionName: jobName,
|
|
103415
|
+
script
|
|
103416
|
+
}) : await client.createWorkflowJobFunction({
|
|
103417
|
+
workspaceId,
|
|
103418
|
+
jobFunctionName: jobName,
|
|
103419
|
+
script
|
|
103420
|
+
});
|
|
103421
|
+
await client.setMetadata(await buildMetaRequest(jobFunctionTrn(workspaceId, jobName), appName));
|
|
103326
103422
|
return {
|
|
103327
103423
|
jobName,
|
|
103328
|
-
version:
|
|
103329
|
-
workspaceId,
|
|
103330
|
-
jobFunctionName: jobName,
|
|
103331
|
-
script
|
|
103332
|
-
}) : await client.createWorkflowJobFunction({
|
|
103333
|
-
workspaceId,
|
|
103334
|
-
jobFunctionName: jobName,
|
|
103335
|
-
script
|
|
103336
|
-
})).jobFunction?.version
|
|
103424
|
+
version: response.jobFunction?.version
|
|
103337
103425
|
};
|
|
103338
103426
|
}));
|
|
103339
103427
|
for (const { jobName, version: version$4 } of results) if (version$4) jobFunctionVersions[jobName] = version$4;
|
|
103428
|
+
const unusedJobFunctions = existingJobFunctions.filter((jobName) => !allUsedJobNames.has(jobName));
|
|
103429
|
+
await Promise.all(unusedJobFunctions.map(async (jobName) => {
|
|
103430
|
+
const { metadata } = await client.getMetadata({ trn: jobFunctionTrn(workspaceId, jobName) });
|
|
103431
|
+
if (metadata?.labels?.[sdkNameLabelKey] === appName) await client.setMetadata({
|
|
103432
|
+
trn: jobFunctionTrn(workspaceId, jobName),
|
|
103433
|
+
labels: { [sdkNameLabelKey]: "" }
|
|
103434
|
+
});
|
|
103435
|
+
}));
|
|
103340
103436
|
return jobFunctionVersions;
|
|
103341
103437
|
}
|
|
103342
|
-
function
|
|
103438
|
+
function workflowTrn(workspaceId, name$1) {
|
|
103343
103439
|
return `trn:v1:workspace:${workspaceId}:workflow:${name$1}`;
|
|
103344
103440
|
}
|
|
103441
|
+
function jobFunctionTrn(workspaceId, name$1) {
|
|
103442
|
+
return `trn:v1:workspace:${workspaceId}:workflow_job_function:${name$1}`;
|
|
103443
|
+
}
|
|
103345
103444
|
async function planWorkflow(client, workspaceId, appName, workflows, mainJobDeps) {
|
|
103346
103445
|
const changeSet = new ChangeSet("Workflows");
|
|
103347
103446
|
const conflicts = [];
|
|
@@ -103359,7 +103458,7 @@ async function planWorkflow(client, workspaceId, appName, workflows, mainJobDeps
|
|
|
103359
103458
|
});
|
|
103360
103459
|
const existingWorkflows = {};
|
|
103361
103460
|
await Promise.all(withoutLabel.map(async (resource) => {
|
|
103362
|
-
const { metadata } = await client.getMetadata({ trn:
|
|
103461
|
+
const { metadata } = await client.getMetadata({ trn: workflowTrn(workspaceId, resource.name) });
|
|
103363
103462
|
existingWorkflows[resource.name] = {
|
|
103364
103463
|
resource,
|
|
103365
103464
|
label: metadata?.labels[sdkNameLabelKey]
|
|
@@ -103368,7 +103467,7 @@ async function planWorkflow(client, workspaceId, appName, workflows, mainJobDeps
|
|
|
103368
103467
|
const allScripts = await loadWorkflowScripts();
|
|
103369
103468
|
for (const workflow of Object.values(workflows)) {
|
|
103370
103469
|
const existing = existingWorkflows[workflow.name];
|
|
103371
|
-
const metaRequest = await buildMetaRequest(
|
|
103470
|
+
const metaRequest = await buildMetaRequest(workflowTrn(workspaceId, workflow.name), appName);
|
|
103372
103471
|
const usedJobNames = mainJobDeps[workflow.mainJob.name];
|
|
103373
103472
|
if (!usedJobNames) throw new Error(`No dependency info found for mainJob "${workflow.mainJob.name}". Please run "generate" command before "apply".`);
|
|
103374
103473
|
if (existing) {
|
|
@@ -103413,7 +103512,8 @@ async function planWorkflow(client, workspaceId, appName, workflows, mainJobDeps
|
|
|
103413
103512
|
changeSet,
|
|
103414
103513
|
conflicts,
|
|
103415
103514
|
unmanaged,
|
|
103416
|
-
resourceOwners
|
|
103515
|
+
resourceOwners,
|
|
103516
|
+
appName
|
|
103417
103517
|
};
|
|
103418
103518
|
}
|
|
103419
103519
|
async function loadWorkflowScripts() {
|
|
@@ -104066,7 +104166,6 @@ var GenerationManager = class {
|
|
|
104066
104166
|
async generate(watch) {
|
|
104067
104167
|
logger.newline();
|
|
104068
104168
|
logger.log(`Generation for application: ${styles.highlight(this.application.config.name)}`);
|
|
104069
|
-
logger.newline();
|
|
104070
104169
|
const app = this.application;
|
|
104071
104170
|
for (const db of app.tailorDBServices) {
|
|
104072
104171
|
const namespace = db.namespace;
|
|
@@ -104358,42 +104457,6 @@ const generateCommand = defineCommand({
|
|
|
104358
104457
|
})
|
|
104359
104458
|
});
|
|
104360
104459
|
|
|
104361
|
-
//#endregion
|
|
104362
|
-
//#region src/cli/utils/format.ts
|
|
104363
|
-
function humanizeRelativeTime(isoString) {
|
|
104364
|
-
const date = new Date(isoString);
|
|
104365
|
-
if (Number.isNaN(date.getTime())) return isoString;
|
|
104366
|
-
return formatDistanceToNowStrict(date, { addSuffix: true });
|
|
104367
|
-
}
|
|
104368
|
-
function printData(data$1, json = false) {
|
|
104369
|
-
if (json) {
|
|
104370
|
-
console.log(JSON.stringify(data$1));
|
|
104371
|
-
return;
|
|
104372
|
-
}
|
|
104373
|
-
if (!Array.isArray(data$1)) {
|
|
104374
|
-
const t$2 = table(Object.entries(data$1), {
|
|
104375
|
-
singleLine: true,
|
|
104376
|
-
border: getBorderCharacters("norc")
|
|
104377
|
-
});
|
|
104378
|
-
process.stdout.write(t$2);
|
|
104379
|
-
return;
|
|
104380
|
-
}
|
|
104381
|
-
if (data$1.length === 0) return;
|
|
104382
|
-
const headers = Array.from(new Set(data$1.flatMap((item) => Object.keys(item))));
|
|
104383
|
-
const t$1 = table([headers, ...data$1.map((item) => headers.map((header) => {
|
|
104384
|
-
const value = item[header];
|
|
104385
|
-
if (value === null || value === void 0) return "";
|
|
104386
|
-
if ((header === "createdAt" || header === "updatedAt") && typeof value === "string") return humanizeRelativeTime(value);
|
|
104387
|
-
return String(value);
|
|
104388
|
-
}))], {
|
|
104389
|
-
border: getBorderCharacters("norc"),
|
|
104390
|
-
drawHorizontalLine: (lineIndex, rowCount) => {
|
|
104391
|
-
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
|
|
104392
|
-
}
|
|
104393
|
-
});
|
|
104394
|
-
process.stdout.write(t$1);
|
|
104395
|
-
}
|
|
104396
|
-
|
|
104397
104460
|
//#endregion
|
|
104398
104461
|
//#region src/cli/machineuser/list.ts
|
|
104399
104462
|
function machineUserInfo(user) {
|
|
@@ -104440,11 +104503,12 @@ const listCommand$3 = defineCommand({
|
|
|
104440
104503
|
...deploymentArgs
|
|
104441
104504
|
},
|
|
104442
104505
|
run: withCommonArgs(async (args) => {
|
|
104443
|
-
|
|
104506
|
+
const machineUsers = await listMachineUsers({
|
|
104444
104507
|
workspaceId: args["workspace-id"],
|
|
104445
104508
|
profile: args.profile,
|
|
104446
104509
|
configPath: args.config
|
|
104447
|
-
})
|
|
104510
|
+
});
|
|
104511
|
+
logger.out(machineUsers);
|
|
104448
104512
|
})
|
|
104449
104513
|
});
|
|
104450
104514
|
|
|
@@ -104502,11 +104566,12 @@ const tokenCommand = defineCommand({
|
|
|
104502
104566
|
profile: args.profile,
|
|
104503
104567
|
configPath: args.config
|
|
104504
104568
|
});
|
|
104505
|
-
|
|
104569
|
+
const tokenInfo = {
|
|
104506
104570
|
access_token: token.accessToken,
|
|
104507
104571
|
token_type: token.tokenType,
|
|
104508
104572
|
expires_at: token.expiresAt
|
|
104509
|
-
}
|
|
104573
|
+
};
|
|
104574
|
+
logger.out(tokenInfo);
|
|
104510
104575
|
})
|
|
104511
104576
|
});
|
|
104512
104577
|
|
|
@@ -104586,12 +104651,13 @@ const getCommand$1 = defineCommand({
|
|
|
104586
104651
|
}
|
|
104587
104652
|
},
|
|
104588
104653
|
run: withCommonArgs(async (args) => {
|
|
104589
|
-
|
|
104654
|
+
const credentials = await getOAuth2Client({
|
|
104590
104655
|
name: args.name,
|
|
104591
104656
|
workspaceId: args["workspace-id"],
|
|
104592
104657
|
profile: args.profile,
|
|
104593
104658
|
configPath: args.config
|
|
104594
|
-
})
|
|
104659
|
+
});
|
|
104660
|
+
logger.out(credentials);
|
|
104595
104661
|
})
|
|
104596
104662
|
});
|
|
104597
104663
|
|
|
@@ -104632,11 +104698,12 @@ const listCommand$2 = defineCommand({
|
|
|
104632
104698
|
...deploymentArgs
|
|
104633
104699
|
},
|
|
104634
104700
|
run: withCommonArgs(async (args) => {
|
|
104635
|
-
|
|
104701
|
+
const oauth2Clients = await listOAuth2Clients({
|
|
104636
104702
|
workspaceId: args["workspace-id"],
|
|
104637
104703
|
profile: args.profile,
|
|
104638
104704
|
configPath: args.config
|
|
104639
|
-
})
|
|
104705
|
+
});
|
|
104706
|
+
logger.out(oauth2Clients);
|
|
104640
104707
|
})
|
|
104641
104708
|
});
|
|
104642
104709
|
|
|
@@ -104801,14 +104868,48 @@ const showCommand = defineCommand({
|
|
|
104801
104868
|
}
|
|
104802
104869
|
},
|
|
104803
104870
|
run: withCommonArgs(async (args) => {
|
|
104804
|
-
|
|
104871
|
+
const appInfo = await show({
|
|
104805
104872
|
workspaceId: args["workspace-id"],
|
|
104806
104873
|
profile: args.profile,
|
|
104807
104874
|
configPath: args.config
|
|
104808
|
-
})
|
|
104875
|
+
});
|
|
104876
|
+
logger.out(appInfo);
|
|
104809
104877
|
})
|
|
104810
104878
|
});
|
|
104811
104879
|
|
|
104880
|
+
//#endregion
|
|
104881
|
+
//#region src/cli/utils/format.ts
|
|
104882
|
+
/**
|
|
104883
|
+
* Formats a table with consistent single-line border style.
|
|
104884
|
+
* Use this instead of importing `table` directly.
|
|
104885
|
+
*/
|
|
104886
|
+
function formatTable(data$1, config) {
|
|
104887
|
+
return table(data$1, {
|
|
104888
|
+
...config,
|
|
104889
|
+
border: getBorderCharacters("norc")
|
|
104890
|
+
});
|
|
104891
|
+
}
|
|
104892
|
+
/**
|
|
104893
|
+
* Formats a key-value table with single-line border style.
|
|
104894
|
+
*/
|
|
104895
|
+
function formatKeyValueTable(data$1) {
|
|
104896
|
+
return formatTable(data$1, { singleLine: true });
|
|
104897
|
+
}
|
|
104898
|
+
/**
|
|
104899
|
+
* Formats a table with headers, using single-line border style.
|
|
104900
|
+
* Draws horizontal lines only at top, after header, and bottom.
|
|
104901
|
+
*/
|
|
104902
|
+
function formatTableWithHeaders(headers, rows) {
|
|
104903
|
+
return formatTable([headers, ...rows], { drawHorizontalLine: (lineIndex, rowCount) => {
|
|
104904
|
+
return lineIndex === 0 || lineIndex === 1 || lineIndex === rowCount;
|
|
104905
|
+
} });
|
|
104906
|
+
}
|
|
104907
|
+
function humanizeRelativeTime(isoString) {
|
|
104908
|
+
const date = new Date(isoString);
|
|
104909
|
+
if (Number.isNaN(date.getTime())) return isoString;
|
|
104910
|
+
return formatDistanceToNowStrict(date, { addSuffix: true });
|
|
104911
|
+
}
|
|
104912
|
+
|
|
104812
104913
|
//#endregion
|
|
104813
104914
|
//#region src/cli/workflow/args.ts
|
|
104814
104915
|
const nameArgs = { name: {
|
|
@@ -105059,7 +105160,7 @@ function printExecutionWithLogs(execution) {
|
|
|
105059
105160
|
["startedAt", execution.startedAt],
|
|
105060
105161
|
["finishedAt", execution.finishedAt]
|
|
105061
105162
|
];
|
|
105062
|
-
|
|
105163
|
+
logger.out(formatKeyValueTable(summaryData));
|
|
105063
105164
|
if (execution.jobDetails && execution.jobDetails.length > 0) {
|
|
105064
105165
|
logger.log(styles.bold("\nJob Executions:"));
|
|
105065
105166
|
for (const job of execution.jobDetails) {
|
|
@@ -105128,13 +105229,16 @@ const executionsCommand = defineCommand({
|
|
|
105128
105229
|
if (!args.json) logger.info(`Execution ID: ${execution.id}`, { mode: "stream" });
|
|
105129
105230
|
const result = args.wait ? await waitWithSpinner(wait, interval, args.json) : execution;
|
|
105130
105231
|
if (args.logs && !args.json) printExecutionWithLogs(result);
|
|
105131
|
-
else
|
|
105132
|
-
} else
|
|
105133
|
-
|
|
105134
|
-
|
|
105135
|
-
|
|
105136
|
-
|
|
105137
|
-
|
|
105232
|
+
else logger.out(result);
|
|
105233
|
+
} else {
|
|
105234
|
+
const executions = await listWorkflowExecutions({
|
|
105235
|
+
workspaceId: args["workspace-id"],
|
|
105236
|
+
profile: args.profile,
|
|
105237
|
+
workflowName: args["workflow-name"],
|
|
105238
|
+
status: args.status
|
|
105239
|
+
});
|
|
105240
|
+
logger.out(executions);
|
|
105241
|
+
}
|
|
105138
105242
|
})
|
|
105139
105243
|
});
|
|
105140
105244
|
|
|
@@ -105176,11 +105280,12 @@ const getCommand = defineCommand({
|
|
|
105176
105280
|
...nameArgs
|
|
105177
105281
|
},
|
|
105178
105282
|
run: withCommonArgs(async (args) => {
|
|
105179
|
-
|
|
105283
|
+
const workflow = await getWorkflow({
|
|
105180
105284
|
name: args.name,
|
|
105181
105285
|
workspaceId: args["workspace-id"],
|
|
105182
105286
|
profile: args.profile
|
|
105183
|
-
})
|
|
105287
|
+
});
|
|
105288
|
+
logger.out(workflow);
|
|
105184
105289
|
})
|
|
105185
105290
|
});
|
|
105186
105291
|
|
|
@@ -105218,7 +105323,7 @@ const listCommand$1 = defineCommand({
|
|
|
105218
105323
|
workspaceId: args["workspace-id"],
|
|
105219
105324
|
profile: args.profile
|
|
105220
105325
|
});
|
|
105221
|
-
if (args.json)
|
|
105326
|
+
if (args.json) logger.out(workflows);
|
|
105222
105327
|
else {
|
|
105223
105328
|
if (workflows.length === 0) {
|
|
105224
105329
|
logger.info("No workflows found.");
|
|
@@ -105236,7 +105341,7 @@ const listCommand$1 = defineCommand({
|
|
|
105236
105341
|
w.jobFunctions.toString(),
|
|
105237
105342
|
humanizeRelativeTime(w.updatedAt)
|
|
105238
105343
|
]);
|
|
105239
|
-
|
|
105344
|
+
logger.out(formatTableWithHeaders(headers, rows));
|
|
105240
105345
|
}
|
|
105241
105346
|
})
|
|
105242
105347
|
});
|
|
@@ -105394,9 +105499,9 @@ const startCommand = defineCommand({
|
|
|
105394
105499
|
configPath: args.config,
|
|
105395
105500
|
interval
|
|
105396
105501
|
});
|
|
105397
|
-
|
|
105502
|
+
logger.info(`Execution ID: ${executionId}`, { mode: "stream" });
|
|
105398
105503
|
if (args.wait) {
|
|
105399
|
-
const result = await wait({ showProgress:
|
|
105504
|
+
const result = await wait({ showProgress: true });
|
|
105400
105505
|
if (args.logs && !args.json) {
|
|
105401
105506
|
const { execution } = await getWorkflowExecution({
|
|
105402
105507
|
executionId,
|
|
@@ -105405,8 +105510,8 @@ const startCommand = defineCommand({
|
|
|
105405
105510
|
logs: true
|
|
105406
105511
|
});
|
|
105407
105512
|
printExecutionWithLogs(execution);
|
|
105408
|
-
} else
|
|
105409
|
-
} else
|
|
105513
|
+
} else logger.out(result);
|
|
105514
|
+
} else logger.out({ executionId });
|
|
105410
105515
|
})
|
|
105411
105516
|
});
|
|
105412
105517
|
|
|
@@ -105479,8 +105584,8 @@ const resumeCommand = defineCommand({
|
|
|
105479
105584
|
logs: true
|
|
105480
105585
|
});
|
|
105481
105586
|
printExecutionWithLogs(execution);
|
|
105482
|
-
} else
|
|
105483
|
-
} else
|
|
105587
|
+
} else logger.out(result);
|
|
105588
|
+
} else logger.out({ executionId });
|
|
105484
105589
|
})
|
|
105485
105590
|
});
|
|
105486
105591
|
|
|
@@ -105576,7 +105681,7 @@ const createCommand = defineCommand({
|
|
|
105576
105681
|
folderId: args["folder-id"]
|
|
105577
105682
|
});
|
|
105578
105683
|
if (!args.json) logger.success(`Workspace "${args.name}" created successfully.`);
|
|
105579
|
-
|
|
105684
|
+
logger.out(workspace);
|
|
105580
105685
|
})
|
|
105581
105686
|
});
|
|
105582
105687
|
|
|
@@ -105681,13 +105786,14 @@ const listCommand = defineCommand({
|
|
|
105681
105786
|
throw new Error(`--limit must be a positive integer, got '${args.limit}'`);
|
|
105682
105787
|
}
|
|
105683
105788
|
const workspaces = await listWorkspaces({ limit });
|
|
105684
|
-
|
|
105789
|
+
const formattedWorkspaces = args.json ? workspaces : workspaces.map(({ updatedAt: _$1, createdAt, ...rest }) => ({
|
|
105685
105790
|
...rest,
|
|
105686
105791
|
createdAt: humanizeRelativeTime(createdAt)
|
|
105687
|
-
}))
|
|
105792
|
+
}));
|
|
105793
|
+
logger.out(formattedWorkspaces);
|
|
105688
105794
|
})
|
|
105689
105795
|
});
|
|
105690
105796
|
|
|
105691
105797
|
//#endregion
|
|
105692
|
-
export {
|
|
105693
|
-
//# sourceMappingURL=list-
|
|
105798
|
+
export { withCommonArgs as $, generate as A, loadWorkspaceId as B, listOAuth2Clients as C, tokenCommand as D, getMachineUserToken as E, loadConfig as F, initOAuth2Client as G, writePlatformConfig as H, apiCall as I, PATScope as J, initOperatorClient as K, apiCommand as L, apply as M, applyCommand as N, listCommand$3 as O, generateUserTypes as P, jsonArgs as Q, fetchLatestToken as R, listCommand$2 as S, getOAuth2Client as T, fetchAll as U, readPlatformConfig as V, fetchUserInfo as W, confirmationArgs as X, commonArgs as Y, deploymentArgs as Z, listWorkflowExecutions as _, createCommand as a, remove as b, resumeWorkflow as c, listCommand$1 as d, workspaceArgs as et, listWorkflows as f, getWorkflowExecution as g, executionsCommand as h, deleteWorkspace as i, generateCommand as j, listMachineUsers as k, startCommand as l, getWorkflow as m, listWorkspaces as n, createWorkspace as o, getCommand as p, readPackageJson as q, deleteCommand as r, resumeCommand as s, listCommand as t, logger as tt, startWorkflow as u, show as v, getCommand$1 as w, removeCommand as x, showCommand as y, loadAccessToken as z };
|
|
105799
|
+
//# sourceMappingURL=list-9sLkfPfn.mjs.map
|