@diagonal-hq/cli 0.42.15 → 0.42.16
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/dist/{cli-check-data-VYRAU2E4.mjs → cli-check-data-R4UXA3WH.mjs} +2 -2
- package/dist/{cli-chunk-HMV62NPA.mjs → cli-chunk-AQ7QT67Z.mjs} +1 -1
- package/dist/{cli-chunk-KWMNEXZC.mjs → cli-chunk-MX5DAHDR.mjs} +2 -1
- package/dist/{cli-chunk-SCJXN7B6.mjs → cli-chunk-QONY26SY.mjs} +45 -0
- package/dist/{cli-workflows-XE3FFNFV.mjs → cli-workflows-6RHPPBQL.mjs} +2 -2
- package/dist/cli.mjs +147 -7
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
brand_kit_catalog_default,
|
|
12
12
|
page_meta_resolvers_default,
|
|
13
13
|
workspace_settings_catalog_default
|
|
14
|
-
} from "./cli-chunk-
|
|
14
|
+
} from "./cli-chunk-AQ7QT67Z.mjs";
|
|
15
15
|
import {
|
|
16
16
|
SCRIPT_SDK_FILES,
|
|
17
17
|
scriptSdkSurface
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
PROFILES,
|
|
25
25
|
SystemPermissions,
|
|
26
26
|
SystemRoles
|
|
27
|
-
} from "./cli-chunk-
|
|
27
|
+
} from "./cli-chunk-QONY26SY.mjs";
|
|
28
28
|
import "./cli-chunk-KRD6O5UC.mjs";
|
|
29
29
|
import {
|
|
30
30
|
GENERATED_ASSETS_PATH
|
|
@@ -2,7 +2,7 @@ import { createRequire as __diagonalCreateRequire } from 'node:module';
|
|
|
2
2
|
const require = __diagonalCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
stringFacts
|
|
5
|
-
} from "./cli-chunk-
|
|
5
|
+
} from "./cli-chunk-QONY26SY.mjs";
|
|
6
6
|
import {
|
|
7
7
|
readUid
|
|
8
8
|
} from "./cli-chunk-KRD6O5UC.mjs";
|
|
@@ -490,6 +490,7 @@ function runCompilerAsync(input, args) {
|
|
|
490
490
|
|
|
491
491
|
export {
|
|
492
492
|
WORKFLOW_STAGE,
|
|
493
|
+
TRIGGER_TYPES,
|
|
493
494
|
workflowConfigObject,
|
|
494
495
|
workflowMetadata,
|
|
495
496
|
editableInputSchema,
|
|
@@ -5,11 +5,14 @@ import {
|
|
|
5
5
|
AUTHORING_MODULE,
|
|
6
6
|
PAGES_SDK_MODULE,
|
|
7
7
|
SourceError,
|
|
8
|
+
byteOrder,
|
|
9
|
+
diagnosticAt,
|
|
8
10
|
importKind,
|
|
9
11
|
isAuthoringModule,
|
|
10
12
|
moduleSpecifiers,
|
|
11
13
|
pagesSdkObjectText,
|
|
12
14
|
parseSource,
|
|
15
|
+
pathName,
|
|
13
16
|
requestedNames,
|
|
14
17
|
resolveLocalSpecifier,
|
|
15
18
|
sliceOf,
|
|
@@ -24078,9 +24081,49 @@ var PROFILE_SPECIFIERS = new Set(
|
|
|
24078
24081
|
);
|
|
24079
24082
|
|
|
24080
24083
|
// scripts/lib/runtime-build/workflow-references.mjs
|
|
24084
|
+
import { basename } from "node:path";
|
|
24081
24085
|
var GENERATED_WORKFLOWS_PATH = "generated/workflows.ts";
|
|
24082
24086
|
var GENERATED_WORKFLOWS_MODULE = "@app/generated/workflows";
|
|
24083
24087
|
var WORKFLOWS_EXPORT = "Workflows";
|
|
24088
|
+
function workflowNames(paths, diagnostics) {
|
|
24089
|
+
const pathsByName = /* @__PURE__ */ new Map();
|
|
24090
|
+
const namesByPath = /* @__PURE__ */ new Map();
|
|
24091
|
+
for (const path of paths.toSorted(byteOrder)) {
|
|
24092
|
+
const name = pathName(
|
|
24093
|
+
path,
|
|
24094
|
+
basename(withoutDevInfix(path), ".ts"),
|
|
24095
|
+
{ exportName: WORKFLOWS_EXPORT, label: "workflow", showText: false, severity: "warning" },
|
|
24096
|
+
diagnostics
|
|
24097
|
+
);
|
|
24098
|
+
if (name === null) {
|
|
24099
|
+
continue;
|
|
24100
|
+
}
|
|
24101
|
+
const other = pathsByName.get(name);
|
|
24102
|
+
if (other !== void 0) {
|
|
24103
|
+
diagnostics.push(
|
|
24104
|
+
diagnosticAt(
|
|
24105
|
+
path,
|
|
24106
|
+
null,
|
|
24107
|
+
`The workflows ${other} and ${path} both have the name ${WORKFLOWS_EXPORT}.${name}. Rename one of the files`,
|
|
24108
|
+
{ relatedPath: other }
|
|
24109
|
+
)
|
|
24110
|
+
);
|
|
24111
|
+
continue;
|
|
24112
|
+
}
|
|
24113
|
+
pathsByName.set(name, path);
|
|
24114
|
+
namesByPath.set(path, name);
|
|
24115
|
+
}
|
|
24116
|
+
return { pathsByName, namesByPath };
|
|
24117
|
+
}
|
|
24118
|
+
function workflowEntries({ pathsByName }, metadataByPath) {
|
|
24119
|
+
const entries = /* @__PURE__ */ Object.create(null);
|
|
24120
|
+
for (const name of [...pathsByName.keys()].toSorted(byteOrder)) {
|
|
24121
|
+
const path = pathsByName.get(name);
|
|
24122
|
+
const { uid = null, slug = basename(withoutDevInfix(path), ".ts"), ...metadata } = metadataByPath.get(path) ?? {};
|
|
24123
|
+
entries[name] = { uid, slug, ...metadata };
|
|
24124
|
+
}
|
|
24125
|
+
return entries;
|
|
24126
|
+
}
|
|
24084
24127
|
|
|
24085
24128
|
// scripts/lib/runtime-build/string-facts.mjs
|
|
24086
24129
|
var URL_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//i;
|
|
@@ -24134,5 +24177,7 @@ export {
|
|
|
24134
24177
|
GENERATED_WORKFLOWS_PATH,
|
|
24135
24178
|
GENERATED_WORKFLOWS_MODULE,
|
|
24136
24179
|
WORKFLOWS_EXPORT,
|
|
24180
|
+
workflowNames,
|
|
24181
|
+
workflowEntries,
|
|
24137
24182
|
PROFILES
|
|
24138
24183
|
};
|
|
@@ -3,7 +3,7 @@ const require = __diagonalCreateRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
WORKFLOW_STAGE,
|
|
5
5
|
stripTypes
|
|
6
|
-
} from "./cli-chunk-
|
|
6
|
+
} from "./cli-chunk-MX5DAHDR.mjs";
|
|
7
7
|
import {
|
|
8
8
|
scriptSdkRuntimeFiles
|
|
9
9
|
} from "./cli-chunk-6VD2BES2.mjs";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
appModuleClosure,
|
|
16
16
|
isAppSpecifier,
|
|
17
17
|
resolveAppSpecifier
|
|
18
|
-
} from "./cli-chunk-
|
|
18
|
+
} from "./cli-chunk-QONY26SY.mjs";
|
|
19
19
|
import "./cli-chunk-KRD6O5UC.mjs";
|
|
20
20
|
import {
|
|
21
21
|
GENERATED_ASSETS_PATH
|
package/dist/cli.mjs
CHANGED
|
@@ -46,8 +46,9 @@ import {
|
|
|
46
46
|
routeBindingsSource,
|
|
47
47
|
routeParamNames,
|
|
48
48
|
workspace_settings_catalog_default
|
|
49
|
-
} from "./cli-chunk-
|
|
49
|
+
} from "./cli-chunk-AQ7QT67Z.mjs";
|
|
50
50
|
import {
|
|
51
|
+
TRIGGER_TYPES,
|
|
51
52
|
compareVersions,
|
|
52
53
|
editableInputSchema,
|
|
53
54
|
isVersion,
|
|
@@ -57,7 +58,7 @@ import {
|
|
|
57
58
|
workflowConfigObject,
|
|
58
59
|
workflowMetadata,
|
|
59
60
|
workspaceBuildNeeds
|
|
60
|
-
} from "./cli-chunk-
|
|
61
|
+
} from "./cli-chunk-MX5DAHDR.mjs";
|
|
61
62
|
import {
|
|
62
63
|
GENERATED_NOTIFICATION_TYPES_MODULE,
|
|
63
64
|
GENERATED_WORKFLOWS_MODULE,
|
|
@@ -75,8 +76,10 @@ import {
|
|
|
75
76
|
require_parser,
|
|
76
77
|
require_types,
|
|
77
78
|
styleModuleExpression,
|
|
78
|
-
templateSlugOf
|
|
79
|
-
|
|
79
|
+
templateSlugOf,
|
|
80
|
+
workflowEntries,
|
|
81
|
+
workflowNames
|
|
82
|
+
} from "./cli-chunk-QONY26SY.mjs";
|
|
80
83
|
import {
|
|
81
84
|
isUid,
|
|
82
85
|
readDefinitionUid,
|
|
@@ -9434,9 +9437,14 @@ function literalString(node) {
|
|
|
9434
9437
|
}
|
|
9435
9438
|
function readWorkflowConfigFile(path, source) {
|
|
9436
9439
|
const { ast, node } = configOf(path, source);
|
|
9437
|
-
|
|
9440
|
+
return configIdentity(ast, configProperties2(node));
|
|
9441
|
+
}
|
|
9442
|
+
function configProperties2(node) {
|
|
9443
|
+
return new Map(
|
|
9438
9444
|
node.properties.filter((property2) => property2.type === "ObjectProperty").map((property2) => [propertyKey(property2), property2])
|
|
9439
9445
|
);
|
|
9446
|
+
}
|
|
9447
|
+
function configIdentity(ast, properties) {
|
|
9440
9448
|
const { uid, slug = null } = workflowMetadata(ast);
|
|
9441
9449
|
return {
|
|
9442
9450
|
uid,
|
|
@@ -9446,6 +9454,118 @@ function readWorkflowConfigFile(path, source) {
|
|
|
9446
9454
|
input_refusal: editableInputSchema(ast).refusal
|
|
9447
9455
|
};
|
|
9448
9456
|
}
|
|
9457
|
+
function readWorkflowSettingsFile(path, source, resources, workflowUids, permissions = []) {
|
|
9458
|
+
const { ast, node } = configOf(path, source);
|
|
9459
|
+
const properties = configProperties2(node);
|
|
9460
|
+
const names = workflowNames(Object.keys(workflowUids), []);
|
|
9461
|
+
const workflowsLocal = generatedBindingLocal(ast, GENERATED_WORKFLOWS_MODULE, WORKFLOWS_EXPORT);
|
|
9462
|
+
const metadataByPath = new Map(
|
|
9463
|
+
Object.entries(workflowUids).map(([file, uid]) => [file, { uid }])
|
|
9464
|
+
);
|
|
9465
|
+
const options = {
|
|
9466
|
+
resources: resourcesBinding(ast, branchResourceNames(resources)),
|
|
9467
|
+
workflows: workflowsLocal === null ? null : {
|
|
9468
|
+
local: workflowsLocal,
|
|
9469
|
+
entries: workflowEntries(names, metadataByPath),
|
|
9470
|
+
pathsByName: names.pathsByName
|
|
9471
|
+
},
|
|
9472
|
+
domains: domainsBinding(ast, null),
|
|
9473
|
+
permissions: permissionsBinding(ast, declaredPermissionEntries(permissions))
|
|
9474
|
+
};
|
|
9475
|
+
const triggerProperty = properties.get("trigger");
|
|
9476
|
+
const trigger = triggerProperty === void 0 ? null : staticValue(triggerProperty.value, options);
|
|
9477
|
+
if (!isPlainObject(trigger) || !Object.hasOwn(TRIGGER_TYPES, trigger.type)) {
|
|
9478
|
+
throw new SourceError(
|
|
9479
|
+
`"trigger" must be an object with a type: ${Object.keys(TRIGGER_TYPES).join(", ")}.`,
|
|
9480
|
+
triggerProperty?.value ?? node
|
|
9481
|
+
);
|
|
9482
|
+
}
|
|
9483
|
+
assertTriggerFields(trigger, triggerProperty.value);
|
|
9484
|
+
const authorizerProperty = properties.get("authorizer");
|
|
9485
|
+
const authorizer = authorizerProperty === void 0 ? null : staticValue(authorizerProperty.value, options);
|
|
9486
|
+
if (!isAuthorizer(authorizer)) {
|
|
9487
|
+
throw new SourceError(
|
|
9488
|
+
`"authorizer" must be 'authenticated', { resource, permissions }, or null.`,
|
|
9489
|
+
authorizerProperty.value
|
|
9490
|
+
);
|
|
9491
|
+
}
|
|
9492
|
+
const executionModeProperty = properties.get("executionMode");
|
|
9493
|
+
const executionMode = executionModeProperty === void 0 ? null : staticValue(executionModeProperty.value, options);
|
|
9494
|
+
if (executionMode !== null && executionMode !== "sync" && executionMode !== "async") {
|
|
9495
|
+
throw new SourceError(
|
|
9496
|
+
`"executionMode" must be 'sync' or 'async'.`,
|
|
9497
|
+
executionModeProperty.value
|
|
9498
|
+
);
|
|
9499
|
+
}
|
|
9500
|
+
const pausedProperty = properties.get("paused");
|
|
9501
|
+
const paused = pausedProperty === void 0 ? null : staticValue(pausedProperty.value, options);
|
|
9502
|
+
if (paused !== null && typeof paused !== "boolean") {
|
|
9503
|
+
throw new SourceError('"paused" must be true or false.', pausedProperty.value);
|
|
9504
|
+
}
|
|
9505
|
+
const inputSchema = editableInputSchema(ast);
|
|
9506
|
+
return {
|
|
9507
|
+
...configIdentity(ast, properties),
|
|
9508
|
+
has_input: inputSchema.refusal !== null || inputSchema.property !== null,
|
|
9509
|
+
trigger,
|
|
9510
|
+
run_as: runAsSetting(properties.get("runAs"), options),
|
|
9511
|
+
authorizer,
|
|
9512
|
+
execution_mode: executionMode,
|
|
9513
|
+
paused: paused === true
|
|
9514
|
+
};
|
|
9515
|
+
}
|
|
9516
|
+
function isAuthorizer(authorizer) {
|
|
9517
|
+
if (authorizer === null || authorizer === "authenticated") {
|
|
9518
|
+
return true;
|
|
9519
|
+
}
|
|
9520
|
+
return isPlainObject(authorizer) && Object.keys(authorizer).every((key) => key === "resource" || key === "permissions") && (authorizer.resource === void 0 || typeof authorizer.resource === "string") && (authorizer.permissions === void 0 || Array.isArray(authorizer.permissions) && authorizer.permissions.every((uid) => typeof uid === "string"));
|
|
9521
|
+
}
|
|
9522
|
+
var TRIGGER_TEXT_FIELDS = {
|
|
9523
|
+
manual: [],
|
|
9524
|
+
request: ["path", "method", "domain"],
|
|
9525
|
+
scheduled: ["expression"],
|
|
9526
|
+
recordEvent: ["resource", "event"],
|
|
9527
|
+
recordLifecycle: ["resource", "hook"],
|
|
9528
|
+
recordSchedule: ["resource", "dateField", "timing"],
|
|
9529
|
+
workflowEvent: ["workflow", "event"]
|
|
9530
|
+
};
|
|
9531
|
+
function assertTriggerFields(trigger, node) {
|
|
9532
|
+
if (trigger.type === "request" && trigger.apiDocs !== void 0 && typeof trigger.apiDocs !== "boolean") {
|
|
9533
|
+
throw new SourceError('"trigger.apiDocs" must be true or false.', node);
|
|
9534
|
+
}
|
|
9535
|
+
for (const field of TRIGGER_TEXT_FIELDS[trigger.type]) {
|
|
9536
|
+
const value = trigger[field];
|
|
9537
|
+
if (value !== void 0 && value !== null && typeof value !== "string") {
|
|
9538
|
+
throw new SourceError(`"trigger.${field}" must be a string.`, node);
|
|
9539
|
+
}
|
|
9540
|
+
}
|
|
9541
|
+
const offsets = trigger.offsets;
|
|
9542
|
+
if (trigger.type === "recordSchedule" && offsets !== void 0 && offsets !== null && (!Array.isArray(offsets) || offsets.some((offset) => typeof offset !== "string"))) {
|
|
9543
|
+
throw new SourceError('"trigger.offsets" must be a list of ISO 8601 durations.', node);
|
|
9544
|
+
}
|
|
9545
|
+
}
|
|
9546
|
+
function runAsSetting(property2, options) {
|
|
9547
|
+
if (property2 === void 0) {
|
|
9548
|
+
return null;
|
|
9549
|
+
}
|
|
9550
|
+
let value = property2.value;
|
|
9551
|
+
while (value.type === "TSAsExpression" || value.type === "TSSatisfiesExpression") {
|
|
9552
|
+
value = value.expression;
|
|
9553
|
+
}
|
|
9554
|
+
if (value.type === "ObjectExpression" && [...configProperties2(value).keys()].join() === "binding") {
|
|
9555
|
+
return { binding: true };
|
|
9556
|
+
}
|
|
9557
|
+
const runAs = staticValue(value, options);
|
|
9558
|
+
if (runAs === null || runAs === "system" || runAs === "session") {
|
|
9559
|
+
return runAs;
|
|
9560
|
+
}
|
|
9561
|
+
if (isPlainObject(runAs) && typeof runAs.resource === "string" && typeof runAs.record === "string") {
|
|
9562
|
+
return { resource: runAs.resource, record: runAs.record };
|
|
9563
|
+
}
|
|
9564
|
+
throw new SourceError(
|
|
9565
|
+
`"runAs" must be 'system', 'session', { resource, record }, or { binding }.`,
|
|
9566
|
+
property2.value
|
|
9567
|
+
);
|
|
9568
|
+
}
|
|
9449
9569
|
function nonEmptyString(value, label) {
|
|
9450
9570
|
if (typeof value !== "string" || value.trim() === "") {
|
|
9451
9571
|
throw new SourceError(`"${label}" must be a non-empty string.`);
|
|
@@ -10052,6 +10172,25 @@ var workflowConfigAdapter = Object.freeze({
|
|
|
10052
10172
|
}
|
|
10053
10173
|
});
|
|
10054
10174
|
|
|
10175
|
+
// scripts/lib/runtime-build/source-adapters/workflow-settings.mjs
|
|
10176
|
+
var workflowSettingsAdapter = Object.freeze({
|
|
10177
|
+
contextFields: ["resources", "resource_slugs", "workflow_uids", "permissions"],
|
|
10178
|
+
accepts: isWorkflowConfigPath,
|
|
10179
|
+
read({ path, source, context }) {
|
|
10180
|
+
const workflowUids = object(context.workflow_uids ?? {}, "workflow_uids");
|
|
10181
|
+
if (Object.values(workflowUids).some((uid) => typeof uid !== "string")) {
|
|
10182
|
+
throw new SourceTransformRequestError("workflow_uids must map paths to strings.");
|
|
10183
|
+
}
|
|
10184
|
+
return readWorkflowSettingsFile(
|
|
10185
|
+
path,
|
|
10186
|
+
source,
|
|
10187
|
+
branchResources(context),
|
|
10188
|
+
workflowUids,
|
|
10189
|
+
branchPermissions(context)
|
|
10190
|
+
);
|
|
10191
|
+
}
|
|
10192
|
+
});
|
|
10193
|
+
|
|
10055
10194
|
// scripts/lib/runtime-build/source-adapters/workspace-brand.mjs
|
|
10056
10195
|
var workspaceBrandAdapter = Object.freeze({
|
|
10057
10196
|
identity: null,
|
|
@@ -10426,6 +10565,7 @@ var SOURCE_ADAPTERS = Object.freeze({
|
|
|
10426
10565
|
"test-case": testCaseAdapter,
|
|
10427
10566
|
"navigation-menu": navigationMenuAdapter,
|
|
10428
10567
|
"workflow-config": workflowConfigAdapter,
|
|
10568
|
+
"workflow-settings": workflowSettingsAdapter,
|
|
10429
10569
|
"module-references": moduleReferencesAdapter
|
|
10430
10570
|
});
|
|
10431
10571
|
var fieldList = (value) => Array.isArray(value) && value.every((field) => typeof field === "string") && new Set(value).size === value.length;
|
|
@@ -11490,7 +11630,7 @@ async function checkSources() {
|
|
|
11490
11630
|
if (existsSync4(DATA_FILE) && existsSync4(SDK_FILE)) {
|
|
11491
11631
|
return { dataFile: DATA_FILE, sdkFile: SDK_FILE };
|
|
11492
11632
|
}
|
|
11493
|
-
const { checkData, scriptSdk } = await import("./cli-check-data-
|
|
11633
|
+
const { checkData, scriptSdk } = await import("./cli-check-data-R4UXA3WH.mjs");
|
|
11494
11634
|
return { data: checkData(), sdk: scriptSdk() };
|
|
11495
11635
|
}
|
|
11496
11636
|
function isScriptTestPath(path) {
|
|
@@ -11510,7 +11650,7 @@ function holdsSkills(root, plan) {
|
|
|
11510
11650
|
async function checkCheckout(root, options) {
|
|
11511
11651
|
const sources = await checkSources();
|
|
11512
11652
|
const plan = composePackages(root);
|
|
11513
|
-
const testRunner = async () => (await import("./cli-workflows-
|
|
11653
|
+
const testRunner = async () => (await import("./cli-workflows-6RHPPBQL.mjs")).runBuildTests;
|
|
11514
11654
|
const skillReader = async () => (await import("./cli-skill-file-PHFXSLAU.mjs")).skillFrontMatter;
|
|
11515
11655
|
const finish = (checkoutRoot, buildPlan, answer, runTests2) => {
|
|
11516
11656
|
const run = hasScriptTests(answer) ? runTests2(checkoutRoot, answer.tests) : null;
|
package/package.json
CHANGED