@deepraxis/cli 0.3.0-dev.131725 → 0.3.0-dev.18dcf1b
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/praxis.js +250 -140
- package/package.json +1 -1
package/dist/praxis.js
CHANGED
|
@@ -13989,6 +13989,7 @@ var init_flag_registry_generated = __esm(() => {
|
|
|
13989
13989
|
crm: { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_rv860m7z9h8szkgma56cd14n", ticket: 2179, expires: "2026-12-31", system: "devops" },
|
|
13990
13990
|
"delivery-rules-v2": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2048, expires: "2026-11-28", system: "devops" },
|
|
13991
13991
|
"end-users": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2312, expires: "2026-12-15", system: "devops" },
|
|
13992
|
+
"letters-email-delivery": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "agent_9261c17c-1f22-46c5-8b17-e4bfb749424a", ticket: 2150, expires: "2026-11-29", system: "devops" },
|
|
13992
13993
|
"model-access-gate": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 1933, expires: "2026-12-15", system: "devops" },
|
|
13993
13994
|
"open-project": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "praxis-51", ticket: 1488, expires: "2026-11-25", system: "devops" },
|
|
13994
13995
|
"requests-never-hold": { kind: "RELEASE", type: "BOOLEAN", default: false, owner: "usr_t60d4g5z82rhbtbfrfxfbdxe", ticket: 2119, expires: "2026-11-29", system: "devops" },
|
|
@@ -63573,12 +63574,216 @@ function wranglerEdges(nodes) {
|
|
|
63573
63574
|
}
|
|
63574
63575
|
return edges;
|
|
63575
63576
|
}
|
|
63577
|
+
// ../../packages/praxis/deploy-core/src/job-events.ts
|
|
63578
|
+
var DEFAULT_EXPIRE_MINUTES = 60;
|
|
63579
|
+
var DEFAULT_PHASE_ID = "stable";
|
|
63580
|
+
function jobStatesOf(outcome) {
|
|
63581
|
+
switch (outcome.kind) {
|
|
63582
|
+
case "succeeded":
|
|
63583
|
+
return { jobState: "succeeded", jobRunState: "succeeded" };
|
|
63584
|
+
case "failed":
|
|
63585
|
+
return { jobState: "failed", jobRunState: "failed" };
|
|
63586
|
+
case "disabled":
|
|
63587
|
+
return { jobState: "disabled", jobRunState: "unspecified" };
|
|
63588
|
+
case "skipped":
|
|
63589
|
+
return { jobState: "skipped", jobRunState: "unspecified" };
|
|
63590
|
+
}
|
|
63591
|
+
}
|
|
63592
|
+
function formatDeployEvent(event) {
|
|
63593
|
+
return `${JSON.stringify(event)}
|
|
63594
|
+
`;
|
|
63595
|
+
}
|
|
63596
|
+
function expireTimeOf(startedAt, expireMinutes = DEFAULT_EXPIRE_MINUTES) {
|
|
63597
|
+
const start = Date.parse(startedAt);
|
|
63598
|
+
if (Number.isNaN(start))
|
|
63599
|
+
throw new Error(`--events-file needs a parseable start time, got ${JSON.stringify(startedAt)}`);
|
|
63600
|
+
const minutes = Number(expireMinutes);
|
|
63601
|
+
if (!Number.isFinite(minutes) || minutes <= 0)
|
|
63602
|
+
throw new Error(`--expire-minutes must be a positive number, got ${JSON.stringify(expireMinutes)}`);
|
|
63603
|
+
return new Date(start + minutes * 60000).toISOString();
|
|
63604
|
+
}
|
|
63605
|
+
function decidePhaseState(states) {
|
|
63606
|
+
if (states.length === 0)
|
|
63607
|
+
return "unspecified";
|
|
63608
|
+
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
63609
|
+
return "failed";
|
|
63610
|
+
if (states.some((state) => state === "in_progress" || state === "pending"))
|
|
63611
|
+
return "in_progress";
|
|
63612
|
+
const neverRan = states.every((state) => state === "skipped" || state === "disabled");
|
|
63613
|
+
return neverRan ? "skipped" : "succeeded";
|
|
63614
|
+
}
|
|
63615
|
+
function decideRolloutState(jobs, options = {}) {
|
|
63616
|
+
const states = [...jobs.values()];
|
|
63617
|
+
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
63618
|
+
return "failed";
|
|
63619
|
+
const deploy = jobs.get("deploy");
|
|
63620
|
+
if (deploy === undefined || deploy === "pending" || deploy === "in_progress" || deploy === "disabled")
|
|
63621
|
+
return "pending";
|
|
63622
|
+
if (deploy === "skipped" && options.artifactIdentical !== true)
|
|
63623
|
+
return "pending";
|
|
63624
|
+
if (states.every((state) => state === "succeeded" || state === "skipped" || state === "disabled" || state === "ignored")) {
|
|
63625
|
+
return options.artifactIdentical === true ? "skipped" : "succeeded";
|
|
63626
|
+
}
|
|
63627
|
+
return "pending";
|
|
63628
|
+
}
|
|
63629
|
+
function decideFinishedState(rollouts) {
|
|
63630
|
+
if (rollouts.length === 0)
|
|
63631
|
+
return "failed";
|
|
63632
|
+
const count3 = (wanted) => rollouts.filter((state) => wanted.includes(state)).length;
|
|
63633
|
+
const succeeded = count3(["succeeded", "skipped"]);
|
|
63634
|
+
const failed = count3(["failed"]);
|
|
63635
|
+
const waiting = count3(["pending"]);
|
|
63636
|
+
if (failed === 0)
|
|
63637
|
+
return succeeded === rollouts.length ? "succeeded" : "failed";
|
|
63638
|
+
return succeeded > 0 && waiting > 0 ? "halted" : "failed";
|
|
63639
|
+
}
|
|
63640
|
+
// ../../packages/praxis/deploy-core/node_modules/yaml/dist/index.js
|
|
63641
|
+
var composer = require_composer2();
|
|
63642
|
+
var Document = require_Document2();
|
|
63643
|
+
var Schema = require_Schema2();
|
|
63644
|
+
var errors = require_errors2();
|
|
63645
|
+
var Alias = require_Alias2();
|
|
63646
|
+
var identity = require_identity2();
|
|
63647
|
+
var Pair = require_Pair2();
|
|
63648
|
+
var Scalar = require_Scalar2();
|
|
63649
|
+
var YAMLMap = require_YAMLMap2();
|
|
63650
|
+
var YAMLSeq = require_YAMLSeq2();
|
|
63651
|
+
var cst = require_cst2();
|
|
63652
|
+
var lexer = require_lexer2();
|
|
63653
|
+
var lineCounter = require_line_counter2();
|
|
63654
|
+
var parser = require_parser2();
|
|
63655
|
+
var publicApi = require_public_api2();
|
|
63656
|
+
var visit = require_visit2();
|
|
63657
|
+
var $Composer = composer.Composer;
|
|
63658
|
+
var $Document = Document.Document;
|
|
63659
|
+
var $Schema = Schema.Schema;
|
|
63660
|
+
var $YAMLError = errors.YAMLError;
|
|
63661
|
+
var $YAMLParseError = errors.YAMLParseError;
|
|
63662
|
+
var $YAMLWarning = errors.YAMLWarning;
|
|
63663
|
+
var $Alias = Alias.Alias;
|
|
63664
|
+
var $isAlias = identity.isAlias;
|
|
63665
|
+
var $isCollection = identity.isCollection;
|
|
63666
|
+
var $isDocument = identity.isDocument;
|
|
63667
|
+
var $isMap = identity.isMap;
|
|
63668
|
+
var $isNode = identity.isNode;
|
|
63669
|
+
var $isPair = identity.isPair;
|
|
63670
|
+
var $isScalar = identity.isScalar;
|
|
63671
|
+
var $isSeq = identity.isSeq;
|
|
63672
|
+
var $Pair = Pair.Pair;
|
|
63673
|
+
var $Scalar = Scalar.Scalar;
|
|
63674
|
+
var $YAMLMap = YAMLMap.YAMLMap;
|
|
63675
|
+
var $YAMLSeq = YAMLSeq.YAMLSeq;
|
|
63676
|
+
var $Lexer = lexer.Lexer;
|
|
63677
|
+
var $LineCounter = lineCounter.LineCounter;
|
|
63678
|
+
var $Parser = parser.Parser;
|
|
63679
|
+
var $parse = publicApi.parse;
|
|
63680
|
+
var $parseAllDocuments = publicApi.parseAllDocuments;
|
|
63681
|
+
var $parseDocument = publicApi.parseDocument;
|
|
63682
|
+
var $stringify = publicApi.stringify;
|
|
63683
|
+
var $visit = visit.visit;
|
|
63684
|
+
var $visitAsync = visit.visitAsync;
|
|
63685
|
+
|
|
63576
63686
|
// ../../packages/praxis/deploy-core/src/lambda-function.ts
|
|
63577
63687
|
var LAMBDA_FUNCTIONS_ROOT = "services/lambda/functions";
|
|
63578
63688
|
var UPSTREAM = "aliyun-fc";
|
|
63579
|
-
var
|
|
63689
|
+
var PROJECT_FILE = "praxis.yaml";
|
|
63690
|
+
function lambdaFunctionRootOwner(root) {
|
|
63691
|
+
return root.split("/").filter((segment) => segment !== "").slice(0, -1).join("/");
|
|
63692
|
+
}
|
|
63693
|
+
function normalizeRoot(root) {
|
|
63694
|
+
return root.replace(/^\.\//, "").split("/").filter((segment) => segment !== "" && segment !== ".").join("/");
|
|
63695
|
+
}
|
|
63696
|
+
var DEFAULT_ROOTS = [
|
|
63697
|
+
{ root: LAMBDA_FUNCTIONS_ROOT, owner: lambdaFunctionRootOwner(LAMBDA_FUNCTIONS_ROOT) }
|
|
63698
|
+
];
|
|
63580
63699
|
var isText = (value) => typeof value === "string" && value !== "";
|
|
63700
|
+
function lambdaFunctionRootsOf(text) {
|
|
63701
|
+
if (text === null)
|
|
63702
|
+
return { roots: DEFAULT_ROOTS, warnings: [] };
|
|
63703
|
+
let parsed;
|
|
63704
|
+
try {
|
|
63705
|
+
parsed = $parse(text);
|
|
63706
|
+
} catch (cause) {
|
|
63707
|
+
return {
|
|
63708
|
+
roots: DEFAULT_ROOTS,
|
|
63709
|
+
warnings: [`${PROJECT_FILE}: does not parse, so its recipe roots are not read`]
|
|
63710
|
+
};
|
|
63711
|
+
}
|
|
63712
|
+
const declared = readPath(parsed, ["devops", "deploy", "recipes"]);
|
|
63713
|
+
if (declared === undefined)
|
|
63714
|
+
return { roots: DEFAULT_ROOTS, warnings: [] };
|
|
63715
|
+
if (!Array.isArray(declared)) {
|
|
63716
|
+
return {
|
|
63717
|
+
roots: DEFAULT_ROOTS,
|
|
63718
|
+
warnings: [
|
|
63719
|
+
`${PROJECT_FILE}: devops.deploy.recipes is not a list, so its recipe roots are not read`
|
|
63720
|
+
]
|
|
63721
|
+
};
|
|
63722
|
+
}
|
|
63723
|
+
const roots = [];
|
|
63724
|
+
const warnings = [];
|
|
63725
|
+
declared.forEach((entry, index) => {
|
|
63726
|
+
const root = typeof entry === "string" ? entry : typeof entry === "object" && entry !== null ? entry.root : undefined;
|
|
63727
|
+
if (!isText(root)) {
|
|
63728
|
+
warnings.push(`${PROJECT_FILE}: devops.deploy.recipes[${index}] names no root`);
|
|
63729
|
+
return;
|
|
63730
|
+
}
|
|
63731
|
+
const declaredOwner = typeof entry === "object" && entry !== null ? entry.owner : undefined;
|
|
63732
|
+
if (declaredOwner !== undefined && !isText(declaredOwner)) {
|
|
63733
|
+
warnings.push(`${PROJECT_FILE}: devops.deploy.recipes[${index}] names no owner`);
|
|
63734
|
+
return;
|
|
63735
|
+
}
|
|
63736
|
+
const normalized = normalizeRoot(root);
|
|
63737
|
+
if (normalized === "") {
|
|
63738
|
+
warnings.push(`${PROJECT_FILE}: devops.deploy.recipes[${index}] names no root`);
|
|
63739
|
+
return;
|
|
63740
|
+
}
|
|
63741
|
+
if (roots.some((known) => known.root === normalized))
|
|
63742
|
+
return;
|
|
63743
|
+
roots.push({
|
|
63744
|
+
root: normalized,
|
|
63745
|
+
owner: declaredOwner === undefined ? lambdaFunctionRootOwner(normalized) : normalizeRoot(declaredOwner)
|
|
63746
|
+
});
|
|
63747
|
+
});
|
|
63748
|
+
if (roots.length === 0 && warnings.length === 0) {
|
|
63749
|
+
warnings.push(`${PROJECT_FILE}: devops.deploy.recipes declares no root, so no function recipe is a target`);
|
|
63750
|
+
}
|
|
63751
|
+
return { roots, warnings };
|
|
63752
|
+
}
|
|
63753
|
+
function readPath(value, segments) {
|
|
63754
|
+
let current = value;
|
|
63755
|
+
for (const segment of segments) {
|
|
63756
|
+
if (current === null || typeof current !== "object" || Array.isArray(current))
|
|
63757
|
+
return;
|
|
63758
|
+
current = current[segment];
|
|
63759
|
+
}
|
|
63760
|
+
return current;
|
|
63761
|
+
}
|
|
63581
63762
|
var isCount = (value, min, max) => typeof value === "number" && Number.isInteger(value) && value >= min && value <= max;
|
|
63763
|
+
function lambdaFunctionCodeOf(value) {
|
|
63764
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
63765
|
+
return null;
|
|
63766
|
+
const declared = value;
|
|
63767
|
+
if (!isText(declared.entry) || !isText(declared.artifact))
|
|
63768
|
+
return null;
|
|
63769
|
+
if (!isText(declared.runtime) || !isText(declared.handler))
|
|
63770
|
+
return null;
|
|
63771
|
+
if (!Array.isArray(declared.layers) || !declared.layers.every(isText))
|
|
63772
|
+
return null;
|
|
63773
|
+
if (!Array.isArray(declared.command) || declared.command.length === 0 || !declared.command.every(isText))
|
|
63774
|
+
return null;
|
|
63775
|
+
if (!isCount(declared.port, 1, 65535))
|
|
63776
|
+
return null;
|
|
63777
|
+
return {
|
|
63778
|
+
entry: declared.entry,
|
|
63779
|
+
artifact: declared.artifact,
|
|
63780
|
+
runtime: declared.runtime,
|
|
63781
|
+
handler: declared.handler,
|
|
63782
|
+
layers: [...declared.layers],
|
|
63783
|
+
command: [...declared.command],
|
|
63784
|
+
port: declared.port
|
|
63785
|
+
};
|
|
63786
|
+
}
|
|
63582
63787
|
function lambdaFunctionOf(text) {
|
|
63583
63788
|
const parsed = text === null ? null : parseJsonc2(text);
|
|
63584
63789
|
if (parsed === null)
|
|
@@ -63597,6 +63802,15 @@ function lambdaFunctionOf(text) {
|
|
|
63597
63802
|
return null;
|
|
63598
63803
|
if (!isCount(parsed.concurrency, 1, 1024))
|
|
63599
63804
|
return null;
|
|
63805
|
+
if (parsed.diskSizeMb !== undefined && !isCount(parsed.diskSizeMb, 512, 10240))
|
|
63806
|
+
return null;
|
|
63807
|
+
let code;
|
|
63808
|
+
if (parsed.code !== undefined) {
|
|
63809
|
+
const declared = lambdaFunctionCodeOf(parsed.code);
|
|
63810
|
+
if (declared === null)
|
|
63811
|
+
return null;
|
|
63812
|
+
code = declared;
|
|
63813
|
+
}
|
|
63600
63814
|
return {
|
|
63601
63815
|
name: parsed.name,
|
|
63602
63816
|
upstream: parsed.upstream,
|
|
@@ -63605,35 +63819,39 @@ function lambdaFunctionOf(text) {
|
|
|
63605
63819
|
cpu: parsed.cpu,
|
|
63606
63820
|
memoryMb: parsed.memoryMb,
|
|
63607
63821
|
timeoutSeconds: parsed.timeoutSeconds,
|
|
63608
|
-
concurrency: parsed.concurrency
|
|
63822
|
+
concurrency: parsed.concurrency,
|
|
63823
|
+
...parsed.diskSizeMb === undefined ? {} : { diskSizeMb: parsed.diskSizeMb },
|
|
63824
|
+
...code === undefined ? {} : { code }
|
|
63609
63825
|
};
|
|
63610
63826
|
}
|
|
63611
|
-
|
|
63612
|
-
return { path: `${LAMBDA_FUNCTIONS_ROOT}/${recipe.name}`, name: `lambda-${recipe.name}` };
|
|
63613
|
-
}
|
|
63614
|
-
function lambdaFunctionOwner(path) {
|
|
63615
|
-
return path.split("/").slice(0, -2).join("/");
|
|
63616
|
-
}
|
|
63827
|
+
var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
63617
63828
|
async function scanRecipes(facts) {
|
|
63829
|
+
const declared = lambdaFunctionRootsOf(await facts.read(PROJECT_FILE));
|
|
63618
63830
|
const found = [];
|
|
63619
|
-
const warnings = [];
|
|
63831
|
+
const warnings = [...declared.warnings];
|
|
63832
|
+
const matchers = declared.roots.map((root) => ({
|
|
63833
|
+
root,
|
|
63834
|
+
pattern: new RegExp(`^${escapeRegExp(root.root)}/([^/]+)/function\\.json$`)
|
|
63835
|
+
}));
|
|
63620
63836
|
for (const path of [...facts.tree].sort()) {
|
|
63621
|
-
const
|
|
63622
|
-
|
|
63623
|
-
|
|
63624
|
-
|
|
63625
|
-
|
|
63626
|
-
|
|
63627
|
-
|
|
63628
|
-
|
|
63629
|
-
|
|
63630
|
-
|
|
63631
|
-
|
|
63632
|
-
|
|
63633
|
-
|
|
63634
|
-
|
|
63837
|
+
for (const { root, pattern } of matchers) {
|
|
63838
|
+
const match = pattern.exec(path);
|
|
63839
|
+
if (match === null)
|
|
63840
|
+
continue;
|
|
63841
|
+
const dir = path.slice(0, -"/function.json".length);
|
|
63842
|
+
const recipe = lambdaFunctionOf(await facts.read(path));
|
|
63843
|
+
if (recipe === null) {
|
|
63844
|
+
warnings.push(`${dir}: function.json is not a recipe`);
|
|
63845
|
+
continue;
|
|
63846
|
+
}
|
|
63847
|
+
if (recipe.upstream !== UPSTREAM)
|
|
63848
|
+
continue;
|
|
63849
|
+
if (recipe.name !== match[1]) {
|
|
63850
|
+
warnings.push(`${dir}: function.json names ${JSON.stringify(recipe.name)}, not the directory name`);
|
|
63851
|
+
continue;
|
|
63852
|
+
}
|
|
63853
|
+
found.push({ recipe, path: dir, root });
|
|
63635
63854
|
}
|
|
63636
|
-
found.push(recipe);
|
|
63637
63855
|
}
|
|
63638
63856
|
return { found, warnings };
|
|
63639
63857
|
}
|
|
@@ -63648,13 +63866,14 @@ function lambdaFunctionProvider(_options = {}) {
|
|
|
63648
63866
|
const scan = await scanRecipes(facts);
|
|
63649
63867
|
const targets = [];
|
|
63650
63868
|
const byOwner = new Map;
|
|
63651
|
-
for (const recipe of scan.found) {
|
|
63652
|
-
const
|
|
63869
|
+
for (const { recipe, path, root } of scan.found) {
|
|
63870
|
+
const name = `lambda-${recipe.name}`;
|
|
63653
63871
|
if (claimed.has(path))
|
|
63654
63872
|
continue;
|
|
63655
63873
|
targets.push({ path, name, destination: "aliyun-fc", production: true, onTrain: true });
|
|
63656
|
-
|
|
63657
|
-
|
|
63874
|
+
if (root.owner === "")
|
|
63875
|
+
continue;
|
|
63876
|
+
byOwner.set(root.owner, [...byOwner.get(root.owner) ?? [], path]);
|
|
63658
63877
|
}
|
|
63659
63878
|
const refined = partial.targets.map((target) => {
|
|
63660
63879
|
const paths = byOwner.get(target.path);
|
|
@@ -63717,52 +63936,6 @@ function environmentsOf(lifecycle) {
|
|
|
63717
63936
|
const named = environments.filter((entry) => typeof entry === "string");
|
|
63718
63937
|
return named.length === 0 ? undefined : named;
|
|
63719
63938
|
}
|
|
63720
|
-
// ../../packages/praxis/deploy-core/node_modules/yaml/dist/index.js
|
|
63721
|
-
var composer = require_composer2();
|
|
63722
|
-
var Document = require_Document2();
|
|
63723
|
-
var Schema = require_Schema2();
|
|
63724
|
-
var errors = require_errors2();
|
|
63725
|
-
var Alias = require_Alias2();
|
|
63726
|
-
var identity = require_identity2();
|
|
63727
|
-
var Pair = require_Pair2();
|
|
63728
|
-
var Scalar = require_Scalar2();
|
|
63729
|
-
var YAMLMap = require_YAMLMap2();
|
|
63730
|
-
var YAMLSeq = require_YAMLSeq2();
|
|
63731
|
-
var cst = require_cst2();
|
|
63732
|
-
var lexer = require_lexer2();
|
|
63733
|
-
var lineCounter = require_line_counter2();
|
|
63734
|
-
var parser = require_parser2();
|
|
63735
|
-
var publicApi = require_public_api2();
|
|
63736
|
-
var visit = require_visit2();
|
|
63737
|
-
var $Composer = composer.Composer;
|
|
63738
|
-
var $Document = Document.Document;
|
|
63739
|
-
var $Schema = Schema.Schema;
|
|
63740
|
-
var $YAMLError = errors.YAMLError;
|
|
63741
|
-
var $YAMLParseError = errors.YAMLParseError;
|
|
63742
|
-
var $YAMLWarning = errors.YAMLWarning;
|
|
63743
|
-
var $Alias = Alias.Alias;
|
|
63744
|
-
var $isAlias = identity.isAlias;
|
|
63745
|
-
var $isCollection = identity.isCollection;
|
|
63746
|
-
var $isDocument = identity.isDocument;
|
|
63747
|
-
var $isMap = identity.isMap;
|
|
63748
|
-
var $isNode = identity.isNode;
|
|
63749
|
-
var $isPair = identity.isPair;
|
|
63750
|
-
var $isScalar = identity.isScalar;
|
|
63751
|
-
var $isSeq = identity.isSeq;
|
|
63752
|
-
var $Pair = Pair.Pair;
|
|
63753
|
-
var $Scalar = Scalar.Scalar;
|
|
63754
|
-
var $YAMLMap = YAMLMap.YAMLMap;
|
|
63755
|
-
var $YAMLSeq = YAMLSeq.YAMLSeq;
|
|
63756
|
-
var $Lexer = lexer.Lexer;
|
|
63757
|
-
var $LineCounter = lineCounter.LineCounter;
|
|
63758
|
-
var $Parser = parser.Parser;
|
|
63759
|
-
var $parse = publicApi.parse;
|
|
63760
|
-
var $parseAllDocuments = publicApi.parseAllDocuments;
|
|
63761
|
-
var $parseDocument = publicApi.parseDocument;
|
|
63762
|
-
var $stringify = publicApi.stringify;
|
|
63763
|
-
var $visit = visit.visit;
|
|
63764
|
-
var $visitAsync = visit.visitAsync;
|
|
63765
|
-
|
|
63766
63939
|
// ../../packages/praxis/deploy-core/src/workspace.ts
|
|
63767
63940
|
function packageJsonIn(dir) {
|
|
63768
63941
|
return dir === "." ? "package.json" : `${dir}/package.json`;
|
|
@@ -64191,69 +64364,6 @@ function stronglyConnected(count3, edges) {
|
|
|
64191
64364
|
visit2(node2);
|
|
64192
64365
|
return components;
|
|
64193
64366
|
}
|
|
64194
|
-
// ../../packages/praxis/deploy-core/src/job-events.ts
|
|
64195
|
-
var DEFAULT_EXPIRE_MINUTES = 60;
|
|
64196
|
-
var DEFAULT_PHASE_ID = "stable";
|
|
64197
|
-
function jobStatesOf(outcome) {
|
|
64198
|
-
switch (outcome.kind) {
|
|
64199
|
-
case "succeeded":
|
|
64200
|
-
return { jobState: "succeeded", jobRunState: "succeeded" };
|
|
64201
|
-
case "failed":
|
|
64202
|
-
return { jobState: "failed", jobRunState: "failed" };
|
|
64203
|
-
case "disabled":
|
|
64204
|
-
return { jobState: "disabled", jobRunState: "unspecified" };
|
|
64205
|
-
case "skipped":
|
|
64206
|
-
return { jobState: "skipped", jobRunState: "unspecified" };
|
|
64207
|
-
}
|
|
64208
|
-
}
|
|
64209
|
-
function formatDeployEvent(event) {
|
|
64210
|
-
return `${JSON.stringify(event)}
|
|
64211
|
-
`;
|
|
64212
|
-
}
|
|
64213
|
-
function expireTimeOf(startedAt, expireMinutes = DEFAULT_EXPIRE_MINUTES) {
|
|
64214
|
-
const start = Date.parse(startedAt);
|
|
64215
|
-
if (Number.isNaN(start))
|
|
64216
|
-
throw new Error(`--events-file needs a parseable start time, got ${JSON.stringify(startedAt)}`);
|
|
64217
|
-
const minutes = Number(expireMinutes);
|
|
64218
|
-
if (!Number.isFinite(minutes) || minutes <= 0)
|
|
64219
|
-
throw new Error(`--expire-minutes must be a positive number, got ${JSON.stringify(expireMinutes)}`);
|
|
64220
|
-
return new Date(start + minutes * 60000).toISOString();
|
|
64221
|
-
}
|
|
64222
|
-
function decidePhaseState(states) {
|
|
64223
|
-
if (states.length === 0)
|
|
64224
|
-
return "unspecified";
|
|
64225
|
-
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
64226
|
-
return "failed";
|
|
64227
|
-
if (states.some((state) => state === "in_progress" || state === "pending"))
|
|
64228
|
-
return "in_progress";
|
|
64229
|
-
const neverRan = states.every((state) => state === "skipped" || state === "disabled");
|
|
64230
|
-
return neverRan ? "skipped" : "succeeded";
|
|
64231
|
-
}
|
|
64232
|
-
function decideRolloutState(jobs, options = {}) {
|
|
64233
|
-
const states = [...jobs.values()];
|
|
64234
|
-
if (states.some((state) => state === "failed" || state === "aborted"))
|
|
64235
|
-
return "failed";
|
|
64236
|
-
const deploy = jobs.get("deploy");
|
|
64237
|
-
if (deploy === undefined || deploy === "pending" || deploy === "in_progress" || deploy === "disabled")
|
|
64238
|
-
return "pending";
|
|
64239
|
-
if (deploy === "skipped" && options.artifactIdentical !== true)
|
|
64240
|
-
return "pending";
|
|
64241
|
-
if (states.every((state) => state === "succeeded" || state === "skipped" || state === "disabled" || state === "ignored")) {
|
|
64242
|
-
return options.artifactIdentical === true ? "skipped" : "succeeded";
|
|
64243
|
-
}
|
|
64244
|
-
return "pending";
|
|
64245
|
-
}
|
|
64246
|
-
function decideFinishedState(rollouts) {
|
|
64247
|
-
if (rollouts.length === 0)
|
|
64248
|
-
return "failed";
|
|
64249
|
-
const count3 = (wanted) => rollouts.filter((state) => wanted.includes(state)).length;
|
|
64250
|
-
const succeeded = count3(["succeeded", "skipped"]);
|
|
64251
|
-
const failed = count3(["failed"]);
|
|
64252
|
-
const waiting = count3(["pending"]);
|
|
64253
|
-
if (failed === 0)
|
|
64254
|
-
return succeeded === rollouts.length ? "succeeded" : "failed";
|
|
64255
|
-
return succeeded > 0 && waiting > 0 ? "halted" : "failed";
|
|
64256
|
-
}
|
|
64257
64367
|
// ../../packages/praxis/deploy-core/src/root-ownership.ts
|
|
64258
64368
|
var ROOT_OWNERSHIP_FILE = "root-ownership.yaml";
|
|
64259
64369
|
var ROOT_OWNERSHIP_DEFAULT = "widen";
|
|
@@ -64582,7 +64692,7 @@ function reportBlockedTarget(events, target, message) {
|
|
|
64582
64692
|
}
|
|
64583
64693
|
|
|
64584
64694
|
// src/commands/devops.ts
|
|
64585
|
-
var
|
|
64695
|
+
var import_yaml4 = __toESM(require_dist(), 1);
|
|
64586
64696
|
|
|
64587
64697
|
// src/commands/devops-deploy-plan.ts
|
|
64588
64698
|
import { resolve as resolve3 } from "node:path";
|
|
@@ -65967,7 +66077,7 @@ async function devopsDeployTofu(flags, ports) {
|
|
|
65967
66077
|
const projectYaml = await ports.readFile(join5(ports.cwd, "praxis.yaml"));
|
|
65968
66078
|
let parsedYaml;
|
|
65969
66079
|
try {
|
|
65970
|
-
parsedYaml = projectYaml === null ? undefined :
|
|
66080
|
+
parsedYaml = projectYaml === null ? undefined : import_yaml4.parse(projectYaml);
|
|
65971
66081
|
} catch (error) {
|
|
65972
66082
|
throw new UsageError(`praxis.yaml is not valid YAML: ${error.message}`);
|
|
65973
66083
|
}
|
|
@@ -71091,7 +71201,7 @@ function startProgress(ctx, write = (text3) => writeOutput({ stderr: text3 })) {
|
|
|
71091
71201
|
}
|
|
71092
71202
|
|
|
71093
71203
|
// src/main.ts
|
|
71094
|
-
var version = "0.3.0-dev.
|
|
71204
|
+
var version = "0.3.0-dev.18dcf1b";
|
|
71095
71205
|
var commands = commandTree(operations);
|
|
71096
71206
|
var manual = [...workflows.map((w) => w.words), [API_WORD]];
|
|
71097
71207
|
function route(argv) {
|