@prisma/composer-cli 0.36.0 → 0.37.0-dev.1
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/{app-config-CErnR6NK-6QjHJ7q5.mjs → app-config-CErnR6NK-DnKH4Kqc.mjs} +2 -2
- package/dist/{app-config-CErnR6NK-6QjHJ7q5.mjs.map → app-config-CErnR6NK-DnKH4Kqc.mjs.map} +1 -1
- package/dist/app-configuration-file-CeJvBAti-Dk65W3Az.mjs +140 -0
- package/dist/app-configuration-file-CeJvBAti-Dk65W3Az.mjs.map +1 -0
- package/dist/{dev-current-Brb4qugP-BOI9FJdz.mjs → dev-current-D0Kn6Mf4-DaV3DWR6.mjs} +6 -6
- package/dist/{dev-current-Brb4qugP-BOI9FJdz.mjs.map → dev-current-D0Kn6Mf4-DaV3DWR6.mjs.map} +1 -1
- package/dist/{dev-environment-name-6eEr5PW8-lIZmJjfr.mjs → dev-environment-name-6eEr5PW8-DpdGjmTb.mjs} +3 -3
- package/dist/dev-environment-name-6eEr5PW8-DpdGjmTb.mjs.map +1 -0
- package/dist/{dist-B9-nLeho.mjs → dist-DizJD76s.mjs} +3 -6
- package/dist/{dist-B9-nLeho.mjs.map → dist-DizJD76s.mjs.map} +1 -1
- package/dist/{execute-deploy-destroy-CNt-xpE7-CMQCNQpY.mjs → execute-deploy-destroy-Dh1CQ9X6-XpXuMPxj.mjs} +62 -31
- package/dist/execute-deploy-destroy-Dh1CQ9X6-XpXuMPxj.mjs.map +1 -0
- package/dist/{execute-dev-BUk-XWBJ-DaB9ma8z.mjs → execute-dev-Bl-5Q-Av-DK5AoRw1.mjs} +93 -45
- package/dist/{execute-dev-BUk-XWBJ-DaB9ma8z.mjs.map → execute-dev-Bl-5Q-Av-DK5AoRw1.mjs.map} +1 -1
- package/dist/{execute-dev-current-BdEqeKAB-xCBBITAB.mjs → execute-dev-current-D3USgHJ4-frlaz_BC.mjs} +7 -7
- package/dist/{execute-dev-current-BdEqeKAB-xCBBITAB.mjs.map → execute-dev-current-D3USgHJ4-frlaz_BC.mjs.map} +1 -1
- package/dist/family.d.mts +2 -2
- package/dist/family.mjs +22 -5
- package/dist/family.mjs.map +1 -1
- package/dist/{generate-dev-stack-BkkU2HLE-Dek3CkAQ.mjs → generate-dev-stack-Cag2Bd4s-CQLqIUWA.mjs} +11 -5
- package/dist/generate-dev-stack-Cag2Bd4s-CQLqIUWA.mjs.map +1 -0
- package/dist/{list-deployed-B-N3imFH.mjs → list-deployed-B8aQ4KEm.mjs} +5 -5
- package/dist/list-deployed-B8aQ4KEm.mjs.map +1 -0
- package/dist/{family-B2JZ8O7U-P_rOUr4w.d.mts → redaction-Bf8FvTFH-M5hYsi--.d.mts} +368 -184
- package/dist/redaction-Bf8FvTFH-M5hYsi--.d.mts.map +1 -0
- package/dist/redaction-HnbkSFrK-BjFRb2aC.mjs +534 -0
- package/dist/redaction-HnbkSFrK-BjFRb2aC.mjs.map +1 -0
- package/dist/result-sR7PBi61.mjs +229 -0
- package/dist/result-sR7PBi61.mjs.map +1 -0
- package/dist/run-alchemy-OS_ix5g0-BzkuReFx.mjs +236 -0
- package/dist/run-alchemy-OS_ix5g0-BzkuReFx.mjs.map +1 -0
- package/dist/testing.d.mts +31 -2
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +8 -4
- package/dist/testing.mjs.map +1 -1
- package/dist/validate-environment-D_dECxgO-fg8lfCME.mjs +2513 -0
- package/dist/validate-environment-D_dECxgO-fg8lfCME.mjs.map +1 -0
- package/package.json +9 -9
- package/src/exports/testing.ts +3 -2
- package/dist/dev-environment-name-6eEr5PW8-lIZmJjfr.mjs.map +0 -1
- package/dist/execute-deploy-destroy-CNt-xpE7-CMQCNQpY.mjs.map +0 -1
- package/dist/family-B2JZ8O7U-P_rOUr4w.d.mts.map +0 -1
- package/dist/generate-dev-stack-BkkU2HLE-Dek3CkAQ.mjs.map +0 -1
- package/dist/list-deployed-B-N3imFH.mjs.map +0 -1
- package/dist/run-alchemy-Dl_MWw4g-DaWV9tkH.mjs +0 -667
- package/dist/run-alchemy-Dl_MWw4g-DaWV9tkH.mjs.map +0 -1
- package/dist/validate-environment-CEhUSEg2-ExABehBM.mjs +0 -1343
- package/dist/validate-environment-CEhUSEg2-ExABehBM.mjs.map +0 -1
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { c as
|
|
1
|
+
import { a as nodeAddresses, i as validateEnvironmentName, o as secretsKeys, r as runPipeline } from "./validate-environment-D_dECxgO-fg8lfCME.mjs";
|
|
2
|
+
import { a as redactDevEvent, c as redactThrown, n as SecretRedaction, o as redactError } from "./redaction-HnbkSFrK-BjFRb2aC.mjs";
|
|
3
|
+
import { i as CliStructuredError, n as ok, t as notOk } from "./result-sR7PBi61.mjs";
|
|
4
|
+
import { c as toStructured, s as requireContainerForEnvironment } from "./dev-current-D0Kn6Mf4-DaV3DWR6.mjs";
|
|
5
|
+
import { i as spawnAlchemy, n as alchemyInvocation, r as reproduceCommand } from "./run-alchemy-OS_ix5g0-BzkuReFx.mjs";
|
|
3
6
|
import { n as preflightEnvVarName, r as containerEnv, t as preflightEnv } from "./config-DiZaanS3.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as requireDevEnvironmentName, r as resolveLocalTargets, t as claimDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-
|
|
7
|
+
import { r as devEnvironmentDir } from "./app-config-CErnR6NK-DnKH4Kqc.mjs";
|
|
8
|
+
import { i as removeLeftoverAppConfigurationFiles, n as devAppConfigurationFile, r as prepareSecondProcess } from "./app-configuration-file-CeJvBAti-Dk65W3Az.mjs";
|
|
9
|
+
import { r as writeDevStackFile, t as devStackRelativePath } from "./generate-dev-stack-Cag2Bd4s-CQLqIUWA.mjs";
|
|
10
|
+
import { n as requireDevEnvironmentName, r as resolveLocalTargets, t as claimDevEnvironmentName } from "./dev-environment-name-6eEr5PW8-DpdGjmTb.mjs";
|
|
8
11
|
import * as fs from "node:fs";
|
|
9
12
|
import * as path from "node:path";
|
|
10
13
|
import { join, relative, resolve, sep } from "node:path";
|
|
14
|
+
import { stat, unwatchFile, watch, watchFile } from "fs";
|
|
15
|
+
import * as sysPath from "path";
|
|
16
|
+
import { type } from "os";
|
|
11
17
|
import { fileURLToPath } from "node:url";
|
|
18
|
+
import { isDeepStrictEqual } from "node:util";
|
|
12
19
|
import { createHash } from "node:crypto";
|
|
13
|
-
import { stat, unwatchFile, watch, watchFile } from "fs";
|
|
14
20
|
import { lstat, open, readdir, realpath, stat as stat$1 } from "fs/promises";
|
|
15
21
|
import { EventEmitter } from "events";
|
|
16
|
-
import * as sysPath from "path";
|
|
17
22
|
import { lstat as lstat$1, readdir as readdir$1, realpath as realpath$1, stat as stat$2 } from "node:fs/promises";
|
|
18
23
|
import { Readable } from "node:stream";
|
|
19
|
-
import { type } from "os";
|
|
20
24
|
//#region ../../0-framework/3-tooling/cli/dist/emulator-retry-CV8rl69G.mjs
|
|
21
25
|
/**
|
|
22
26
|
* An emulator admin call right after a converge that just PUT dozens of
|
|
@@ -1593,7 +1597,7 @@ var esm_default = {
|
|
|
1593
1597
|
FSWatcher
|
|
1594
1598
|
};
|
|
1595
1599
|
//#endregion
|
|
1596
|
-
//#region ../../0-framework/3-tooling/cli/dist/execute-dev-
|
|
1600
|
+
//#region ../../0-framework/3-tooling/cli/dist/execute-dev-Bl-5Q-Av.mjs
|
|
1597
1601
|
/**
|
|
1598
1602
|
* Local-dev spec § 6 `watch.ts`: watches each assembled bundle's declared
|
|
1599
1603
|
* `watch` paths and every authoring module (ADR-0056) — a directory watched
|
|
@@ -1791,11 +1795,24 @@ function contentHash(file) {
|
|
|
1791
1795
|
return;
|
|
1792
1796
|
}
|
|
1793
1797
|
}
|
|
1798
|
+
function sameValues(started, now) {
|
|
1799
|
+
return isDeepStrictEqual(started.configuration, now.configuration) && isDeepStrictEqual(started.secrets, now.secrets);
|
|
1800
|
+
}
|
|
1794
1801
|
async function executeDev(input, deps, cwd) {
|
|
1802
|
+
const redaction = new SecretRedaction(process.env);
|
|
1803
|
+
try {
|
|
1804
|
+
const result = await executeDevInner(input, deps, cwd, redaction);
|
|
1805
|
+
return result.ok ? result : notOk(redactError(result.failure, redaction));
|
|
1806
|
+
} catch (error) {
|
|
1807
|
+
throw redactThrown(error, redaction);
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
async function executeDevInner(input, deps, cwd, redaction) {
|
|
1795
1811
|
if (process.platform === "win32") return notOk(new CliStructuredError("DEV.PLATFORM_UNSUPPORTED", "local dev is not supported on Windows yet."));
|
|
1796
1812
|
const { onEvent } = input;
|
|
1797
1813
|
const environment = input.environment ?? "dev";
|
|
1798
1814
|
const devDir = path.join(cwd, devEnvironmentDir(environment));
|
|
1815
|
+
removeLeftoverAppConfigurationFiles(cwd);
|
|
1799
1816
|
let pipeline;
|
|
1800
1817
|
let resolved;
|
|
1801
1818
|
const containers = /* @__PURE__ */ new Map();
|
|
@@ -1803,14 +1820,16 @@ async function executeDev(input, deps, cwd) {
|
|
|
1803
1820
|
const attachmentsById = /* @__PURE__ */ new Map();
|
|
1804
1821
|
const emit = (event) => {
|
|
1805
1822
|
try {
|
|
1806
|
-
onEvent?.(event);
|
|
1823
|
+
onEvent?.(redactDevEvent(event, redaction));
|
|
1807
1824
|
} catch {}
|
|
1808
1825
|
};
|
|
1809
1826
|
try {
|
|
1810
1827
|
validateEnvironmentName(environment);
|
|
1811
1828
|
const pipelineDeps = {
|
|
1812
1829
|
runAssembler: deps.runAssembler,
|
|
1813
|
-
devServers: true
|
|
1830
|
+
devServers: true,
|
|
1831
|
+
readSecrets: true,
|
|
1832
|
+
redaction
|
|
1814
1833
|
};
|
|
1815
1834
|
pipeline = await runPipeline(input.entry, input.name, environment, cwd, input.config, pipelineDeps);
|
|
1816
1835
|
const { graph, name } = pipeline;
|
|
@@ -1848,7 +1867,13 @@ async function executeDev(input, deps, cwd) {
|
|
|
1848
1867
|
const payload = await dev.preflight({
|
|
1849
1868
|
graph,
|
|
1850
1869
|
container: containers.get(id),
|
|
1851
|
-
environment
|
|
1870
|
+
environment,
|
|
1871
|
+
configuration: pipeline.configuration,
|
|
1872
|
+
secrets: pipeline.secrets,
|
|
1873
|
+
warn: (message) => emit({
|
|
1874
|
+
kind: "target-warning",
|
|
1875
|
+
message
|
|
1876
|
+
})
|
|
1852
1877
|
});
|
|
1853
1878
|
if (payload !== void 0) preflightPayloads.set(id, payload);
|
|
1854
1879
|
} catch (error) {
|
|
@@ -1893,26 +1918,43 @@ async function executeDev(input, deps, cwd) {
|
|
|
1893
1918
|
if (CliStructuredError.is(error)) return notOk(error);
|
|
1894
1919
|
throw error;
|
|
1895
1920
|
}
|
|
1896
|
-
const
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1921
|
+
const invocationFor = (p) => {
|
|
1922
|
+
const handover = prepareSecondProcess({
|
|
1923
|
+
file: devAppConfigurationFile(devDir),
|
|
1924
|
+
appConfigurationRead: p.graph.appConfigurationRead,
|
|
1925
|
+
nodeAddresses: nodeAddresses(p.graph),
|
|
1926
|
+
secretsKeys: secretsKeys(p.graph),
|
|
1927
|
+
knownSecrets: redaction.knownSecrets,
|
|
1928
|
+
appSecrets: p.secrets
|
|
1929
|
+
});
|
|
1930
|
+
return {
|
|
1931
|
+
invocation: alchemyInvocation({
|
|
1932
|
+
command: "deploy",
|
|
1933
|
+
stackFileRelativePath: devStackRelativePath(environment),
|
|
1934
|
+
cwd,
|
|
1935
|
+
stage: environment,
|
|
1936
|
+
containerEnv: containerEnv(containers),
|
|
1937
|
+
preflightEnv: preflightTransportEnv,
|
|
1938
|
+
env: handover.env,
|
|
1939
|
+
redactedValues: redaction.allValues()
|
|
1940
|
+
}),
|
|
1941
|
+
handover
|
|
1942
|
+
};
|
|
1943
|
+
};
|
|
1944
|
+
const converge = async (p) => {
|
|
1945
|
+
const { invocation, handover } = invocationFor(p);
|
|
1905
1946
|
let stackPath;
|
|
1906
1947
|
try {
|
|
1907
1948
|
claimDevEnvironmentName(devDir, environment);
|
|
1908
1949
|
stackPath = writeDevStackFile({
|
|
1909
|
-
entryPath:
|
|
1950
|
+
entryPath: p.entryModule.path,
|
|
1910
1951
|
cwd,
|
|
1911
1952
|
environment,
|
|
1912
|
-
configFile:
|
|
1913
|
-
name:
|
|
1914
|
-
assembled:
|
|
1953
|
+
configFile: p.configSource.file,
|
|
1954
|
+
name: p.name,
|
|
1955
|
+
assembled: p.assembled
|
|
1915
1956
|
});
|
|
1957
|
+
handover.writeFile();
|
|
1916
1958
|
} catch (error) {
|
|
1917
1959
|
throw toStructured("DEV.STACK_WRITE_FAILED", error);
|
|
1918
1960
|
}
|
|
@@ -1930,10 +1972,13 @@ async function executeDev(input, deps, cwd) {
|
|
|
1930
1972
|
cwd
|
|
1931
1973
|
} }
|
|
1932
1974
|
});
|
|
1975
|
+
} finally {
|
|
1976
|
+
handover.removeFile();
|
|
1933
1977
|
}
|
|
1934
1978
|
return {
|
|
1935
1979
|
outcome,
|
|
1936
|
-
stackPath
|
|
1980
|
+
stackPath,
|
|
1981
|
+
invocation
|
|
1937
1982
|
};
|
|
1938
1983
|
};
|
|
1939
1984
|
const stopStartedServices = async () => {
|
|
@@ -1956,7 +2001,9 @@ async function executeDev(input, deps, cwd) {
|
|
|
1956
2001
|
({restarted} = await withEmulatorRetry(() => serve({
|
|
1957
2002
|
address,
|
|
1958
2003
|
node,
|
|
1959
|
-
server
|
|
2004
|
+
server,
|
|
2005
|
+
configuration: pipeline.configuration,
|
|
2006
|
+
secrets: pipeline.secrets
|
|
1960
2007
|
})));
|
|
1961
2008
|
} catch (error) {
|
|
1962
2009
|
throw toStructured("DEV.SERVICE_START_FAILED", error);
|
|
@@ -1966,7 +2013,7 @@ async function executeDev(input, deps, cwd) {
|
|
|
1966
2013
|
};
|
|
1967
2014
|
let first;
|
|
1968
2015
|
try {
|
|
1969
|
-
first = await converge();
|
|
2016
|
+
first = await converge(pipeline);
|
|
1970
2017
|
} catch (error) {
|
|
1971
2018
|
await stopStartedServices();
|
|
1972
2019
|
if (CliStructuredError.is(error)) return notOk(error);
|
|
@@ -1981,7 +2028,7 @@ async function executeDev(input, deps, cwd) {
|
|
|
1981
2028
|
exitCode: firstStatus ?? void 0,
|
|
1982
2029
|
...first.outcome.signal !== null ? { signal: first.outcome.signal } : {},
|
|
1983
2030
|
stackFilePath: first.stackPath,
|
|
1984
|
-
reproduceCommand: reproduceCommand(invocation, first.outcome),
|
|
2031
|
+
reproduceCommand: reproduceCommand(first.invocation, first.outcome),
|
|
1985
2032
|
cwd
|
|
1986
2033
|
}
|
|
1987
2034
|
} }));
|
|
@@ -2043,7 +2090,9 @@ async function executeDev(input, deps, cwd) {
|
|
|
2043
2090
|
});
|
|
2044
2091
|
const watchDeps = {
|
|
2045
2092
|
runAssembler: deps.runAssembler,
|
|
2046
|
-
devServers: true
|
|
2093
|
+
devServers: true,
|
|
2094
|
+
readSecrets: true,
|
|
2095
|
+
redaction
|
|
2047
2096
|
};
|
|
2048
2097
|
const watchFiles = deps.watch ?? startWatch;
|
|
2049
2098
|
const onWatchError = (error) => emit({
|
|
@@ -2053,7 +2102,9 @@ async function executeDev(input, deps, cwd) {
|
|
|
2053
2102
|
const configFile = pipeline.configSource.file;
|
|
2054
2103
|
const startedConfig = contentHash(configFile);
|
|
2055
2104
|
let configChanged = false;
|
|
2056
|
-
|
|
2105
|
+
let valuesChanged = false;
|
|
2106
|
+
const paused = () => {
|
|
2107
|
+
if (valuesChanged) return true;
|
|
2057
2108
|
if (!configChanged && contentHash(configFile) === startedConfig) return false;
|
|
2058
2109
|
configChanged = true;
|
|
2059
2110
|
emit({
|
|
@@ -2065,19 +2116,16 @@ async function executeDev(input, deps, cwd) {
|
|
|
2065
2116
|
configWatch = watchFiles([{
|
|
2066
2117
|
address: configFile,
|
|
2067
2118
|
paths: [configFile]
|
|
2068
|
-
}], () => void
|
|
2119
|
+
}], () => void paused(), onWatchError);
|
|
2069
2120
|
const rebuild = async () => {
|
|
2070
2121
|
try {
|
|
2071
2122
|
const rePipeline = await runPipeline(input.entry, input.name, environment, cwd, input.config, watchDeps);
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
assembled: rePipeline.assembled
|
|
2079
|
-
});
|
|
2080
|
-
const outcome = await (deps.alchemy ?? spawnAlchemy)(invocation);
|
|
2123
|
+
if (!sameValues(pipeline, rePipeline)) {
|
|
2124
|
+
if (!valuesChanged) emit({ kind: "values-changed" });
|
|
2125
|
+
valuesChanged = true;
|
|
2126
|
+
return;
|
|
2127
|
+
}
|
|
2128
|
+
const { outcome, stackPath, invocation } = await converge(rePipeline);
|
|
2081
2129
|
if (outcome.signal !== null || outcome.exitCode !== 0) {
|
|
2082
2130
|
emit({
|
|
2083
2131
|
kind: "converge-failed",
|
|
@@ -2110,11 +2158,11 @@ async function executeDev(input, deps, cwd) {
|
|
|
2110
2158
|
do {
|
|
2111
2159
|
changedDuringRebuild = false;
|
|
2112
2160
|
await rebuild();
|
|
2113
|
-
} while (changedDuringRebuild && !
|
|
2161
|
+
} while (changedDuringRebuild && !paused());
|
|
2114
2162
|
rebuilding = false;
|
|
2115
2163
|
};
|
|
2116
2164
|
watch = watchFiles(targets, () => {
|
|
2117
|
-
if (
|
|
2165
|
+
if (paused()) return;
|
|
2118
2166
|
if (rebuilding) {
|
|
2119
2167
|
changedDuringRebuild = true;
|
|
2120
2168
|
return;
|
|
@@ -2168,4 +2216,4 @@ async function executeDev(input, deps, cwd) {
|
|
|
2168
2216
|
//#endregion
|
|
2169
2217
|
export { executeDev };
|
|
2170
2218
|
|
|
2171
|
-
//# sourceMappingURL=execute-dev-
|
|
2219
|
+
//# sourceMappingURL=execute-dev-Bl-5Q-Av-DK5AoRw1.mjs.map
|