@koda-sl/baker-cli 0.311.0 → 0.312.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/dist/cli.js +79 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5503,6 +5503,71 @@ var FLOW_OAUTH_SIDE_EFFECT_TYPES = [
|
|
|
5503
5503
|
function isFlowOauthSideEffect(type) {
|
|
5504
5504
|
return FLOW_OAUTH_SIDE_EFFECT_TYPES.includes(type);
|
|
5505
5505
|
}
|
|
5506
|
+
function parseEmailRecipients(raw) {
|
|
5507
|
+
const to = [];
|
|
5508
|
+
const invalid = [];
|
|
5509
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5510
|
+
for (const token of tokenizeRecipients(raw)) {
|
|
5511
|
+
const address = addressOf(token);
|
|
5512
|
+
if (address === null) {
|
|
5513
|
+
invalid.push(token);
|
|
5514
|
+
continue;
|
|
5515
|
+
}
|
|
5516
|
+
const key = address.toLowerCase();
|
|
5517
|
+
if (seen.has(key)) {
|
|
5518
|
+
continue;
|
|
5519
|
+
}
|
|
5520
|
+
seen.add(key);
|
|
5521
|
+
to.push(token);
|
|
5522
|
+
}
|
|
5523
|
+
return { to, invalid };
|
|
5524
|
+
}
|
|
5525
|
+
function looksLikeUnresolvedVariable(raw) {
|
|
5526
|
+
return /\{\{[\s\S]*?\}\}/.test(raw);
|
|
5527
|
+
}
|
|
5528
|
+
var BARE_ADDRESS = /^[^\s@<>,;"]+@[^\s@<>,;"]+\.[^\s@<>,;"]{2,}$/;
|
|
5529
|
+
var NAMED_ADDRESS = /^[^<>]*<([^<>\s]+)>$/;
|
|
5530
|
+
function addressOf(token) {
|
|
5531
|
+
if (BARE_ADDRESS.test(token)) {
|
|
5532
|
+
return token;
|
|
5533
|
+
}
|
|
5534
|
+
const named = NAMED_ADDRESS.exec(token)?.[1];
|
|
5535
|
+
return named !== void 0 && BARE_ADDRESS.test(named) ? named : null;
|
|
5536
|
+
}
|
|
5537
|
+
function tokenizeRecipients(raw) {
|
|
5538
|
+
const tokens = [];
|
|
5539
|
+
for (const fragment of splitOnSeparators(raw)) {
|
|
5540
|
+
const trimmed = fragment.trim();
|
|
5541
|
+
if (trimmed === "") {
|
|
5542
|
+
continue;
|
|
5543
|
+
}
|
|
5544
|
+
const bracketed = trimmed.includes("<") || trimmed.includes('"');
|
|
5545
|
+
tokens.push(...bracketed ? [trimmed] : trimmed.split(/\s+/));
|
|
5546
|
+
}
|
|
5547
|
+
return tokens;
|
|
5548
|
+
}
|
|
5549
|
+
function splitOnSeparators(raw) {
|
|
5550
|
+
const fragments = [];
|
|
5551
|
+
let current = "";
|
|
5552
|
+
let inQuotes = false;
|
|
5553
|
+
let inAngles = false;
|
|
5554
|
+
for (const char of raw) {
|
|
5555
|
+
if (char === '"') {
|
|
5556
|
+
inQuotes = !inQuotes;
|
|
5557
|
+
} else if (!inQuotes && char === "<") {
|
|
5558
|
+
inAngles = true;
|
|
5559
|
+
} else if (!inQuotes && char === ">") {
|
|
5560
|
+
inAngles = false;
|
|
5561
|
+
} else if (!inQuotes && !inAngles && (char === "," || char === ";" || char === "\n" || char === "\r")) {
|
|
5562
|
+
fragments.push(current);
|
|
5563
|
+
current = "";
|
|
5564
|
+
continue;
|
|
5565
|
+
}
|
|
5566
|
+
current += char;
|
|
5567
|
+
}
|
|
5568
|
+
fragments.push(current);
|
|
5569
|
+
return fragments;
|
|
5570
|
+
}
|
|
5506
5571
|
var FLOW_RESOURCE_NODE_TYPES = [
|
|
5507
5572
|
"calendly",
|
|
5508
5573
|
"savvycal",
|
|
@@ -46816,6 +46881,19 @@ function fillNulledArrays(target, prefix, path48) {
|
|
|
46816
46881
|
return [{ path: path48, change: `\`${prefix}${key}: null\` \u2192 \`[]\`` }];
|
|
46817
46882
|
});
|
|
46818
46883
|
}
|
|
46884
|
+
function tidyEmailRecipients(sideEffect, path48) {
|
|
46885
|
+
if (sideEffect.type !== "email") return [];
|
|
46886
|
+
const config = sideEffect.encryptedConfig;
|
|
46887
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) return [];
|
|
46888
|
+
const raw = config.email;
|
|
46889
|
+
if (typeof raw !== "string" || looksLikeUnresolvedVariable(raw)) return [];
|
|
46890
|
+
const { to, invalid } = parseEmailRecipients(raw);
|
|
46891
|
+
if (invalid.length > 0 || to.length === 0) return [];
|
|
46892
|
+
const tidied = to.join(", ");
|
|
46893
|
+
if (tidied === raw) return [];
|
|
46894
|
+
config.email = tidied;
|
|
46895
|
+
return [{ path: path48, change: "tidied the recipient list's spacing and separators" }];
|
|
46896
|
+
}
|
|
46819
46897
|
function sideEffectsOf(node) {
|
|
46820
46898
|
if (!Array.isArray(node.sideEffects)) return [];
|
|
46821
46899
|
return node.sideEffects.filter(
|
|
@@ -46829,7 +46907,7 @@ function normalizeSideEffect(sideEffect, where) {
|
|
|
46829
46907
|
if (!target || typeof target !== "object") return [];
|
|
46830
46908
|
return fillNulledArrays(target, owner ? `${owner}.` : "", path48);
|
|
46831
46909
|
});
|
|
46832
|
-
return [...dropUnsetOptionals(sideEffect, path48), ...arrays];
|
|
46910
|
+
return [...dropUnsetOptionals(sideEffect, path48), ...arrays, ...tidyEmailRecipients(sideEffect, path48)];
|
|
46833
46911
|
}
|
|
46834
46912
|
function normalizeFlowTree(tree) {
|
|
46835
46913
|
const changes = [];
|