@prisma/composer-prisma-cloud 0.31.0-dev.2 → 0.31.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/auth/pack.mjs +1 -1
- package/dist/auth/pack.mjs.map +1 -1
- package/dist/auth/testing.mjs +1 -1
- package/dist/auth/testing.mjs.map +1 -1
- package/dist/control.mjs +1 -1
- package/dist/control.mjs.map +1 -1
- package/dist/local-target.mjs +13 -27
- package/dist/local-target.mjs.map +1 -1
- package/dist/{s3-credentials-resource-D4jcpAZp-BaOuPNI5.mjs → s3-credentials-resource-D4jcpAZp-DQNbHOoF.mjs} +4 -4
- package/dist/s3-credentials-resource-D4jcpAZp-DQNbHOoF.mjs.map +1 -0
- package/package.json +19 -19
- package/dist/s3-credentials-resource-D4jcpAZp-BaOuPNI5.mjs.map +0 -1
package/dist/local-target.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as blindCast$1 } from "./casts-DpaahrlC-Ykus3kCE.mjs";
|
|
2
|
-
import { C as Providers, E as ServiceKeyProvider, O as isWithin, S as mintKeyPair, b as serviceAppName, c as PgWarmProvider, d as S3CredentialsProvider, f as collectPreflightNames, g as prismaCloudContainerOf, l as PrismaCloudContainer, m as deserialize, n as GeneratedParamProvider, r as LocalOrmMigrationProvider, y as resourceName } from "./s3-credentials-resource-D4jcpAZp-
|
|
2
|
+
import { C as Providers, E as ServiceKeyProvider, O as isWithin, S as mintKeyPair, b as serviceAppName, c as PgWarmProvider, d as S3CredentialsProvider, f as collectPreflightNames, g as prismaCloudContainerOf, l as PrismaCloudContainer, m as deserialize, n as GeneratedParamProvider, r as LocalOrmMigrationProvider, y as resourceName } from "./s3-credentials-resource-D4jcpAZp-DQNbHOoF.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { blindCast } from "@prisma/composer/casts";
|
|
5
5
|
import * as Effect from "effect/Effect";
|
|
@@ -5884,42 +5884,28 @@ function idsOf(nodes, kind) {
|
|
|
5884
5884
|
}
|
|
5885
5885
|
/**
|
|
5886
5886
|
* Stops the service processes and database servers of `nodes`, keeping
|
|
5887
|
-
* their data and ports, and returns the nodes
|
|
5888
|
-
*
|
|
5887
|
+
* their data and ports, and returns the nodes it stopped. A kind whose
|
|
5888
|
+
* emulator is not running has nothing running to stop.
|
|
5889
5889
|
*/
|
|
5890
5890
|
async function stopNodes(nodes) {
|
|
5891
5891
|
const services = idsOf(nodes, "service");
|
|
5892
5892
|
const databases = idsOf(nodes, "database");
|
|
5893
|
-
const results = await Promise.allSettled([
|
|
5893
|
+
const results = await Promise.allSettled([services.length > 0 && whenRunning("service", () => computeClient().stopInstances(services)), databases.length > 0 && whenRunning("database", () => postgresClient().stopInstances(databases))]);
|
|
5894
5894
|
const failure = results.find((result) => result.status === "rejected");
|
|
5895
5895
|
if (failure) throw failure.reason;
|
|
5896
|
-
const
|
|
5897
|
-
|
|
5896
|
+
const stoppedKinds = /* @__PURE__ */ new Set();
|
|
5897
|
+
if (results[0].status === "fulfilled" && results[0].value === true) stoppedKinds.add("service");
|
|
5898
|
+
if (results[1].status === "fulfilled" && results[1].value === true) stoppedKinds.add("database");
|
|
5899
|
+
return Object.entries(nodes).flatMap(([address, node]) => node.kind !== "bucket" && stoppedKinds.has(node.kind) ? [{
|
|
5898
5900
|
address,
|
|
5899
5901
|
kind: node.kind
|
|
5900
5902
|
}] : []);
|
|
5901
5903
|
}
|
|
5902
|
-
/**
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
*/
|
|
5908
|
-
async function stopRunning(kind, ids) {
|
|
5909
|
-
if (ids.length === 0 || !await isEmulatorRunning(kind)) return [];
|
|
5910
|
-
const wanted = new Set(ids);
|
|
5911
|
-
if (kind === "service") {
|
|
5912
|
-
const client = computeClient();
|
|
5913
|
-
const listed = (await client.listInstances()).filter((i) => wanted.has(i.id));
|
|
5914
|
-
const settledHeld = new Set(listed.filter((i) => i.status === "held" && i.pid === void 0).map((i) => i.id));
|
|
5915
|
-
const toStop = ids.filter((id) => !settledHeld.has(id));
|
|
5916
|
-
if (toStop.length > 0) await client.stopInstances(toStop);
|
|
5917
|
-
return listed.filter((i) => i.pid !== void 0 || i.status === "running" || i.status === "backoff").map((i) => i.id);
|
|
5918
|
-
}
|
|
5919
|
-
const client = postgresClient();
|
|
5920
|
-
const listed = (await client.listInstances()).filter((i) => wanted.has(i.id));
|
|
5921
|
-
await client.stopInstances(ids);
|
|
5922
|
-
return listed.filter((i) => i.status === "running").map((i) => i.id);
|
|
5904
|
+
/** Runs `action` when the emulator for `kind` is running; returns whether it ran. */
|
|
5905
|
+
async function whenRunning(kind, action) {
|
|
5906
|
+
if (!await isEmulatorRunning(kind)) return false;
|
|
5907
|
+
await action();
|
|
5908
|
+
return true;
|
|
5923
5909
|
}
|
|
5924
5910
|
/**
|
|
5925
5911
|
* Makes `scope.app` the directory's current app. When another app ran here
|