@geekmidas/cli 10.0.0-alpha.85 → 10.0.0-alpha.86
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/{HostingerProvider-dxkwynSs.cjs → HostingerProvider-BCB1QJj1.cjs} +2 -2
- package/dist/{HostingerProvider-dxkwynSs.cjs.map → HostingerProvider-BCB1QJj1.cjs.map} +1 -1
- package/dist/{HostingerProvider-D85ayzTi.mjs → HostingerProvider-CVc3rLPB.mjs} +2 -2
- package/dist/{HostingerProvider-D85ayzTi.mjs.map → HostingerProvider-CVc3rLPB.mjs.map} +1 -1
- package/dist/{LegacyStateStore-CJ2o18nT.mjs → LegacyStateStore-B0R4LlX_.mjs} +2 -2
- package/dist/{LegacyStateStore-CJ2o18nT.mjs.map → LegacyStateStore-B0R4LlX_.mjs.map} +1 -1
- package/dist/{LegacyStateStore-xGxPwP-m.cjs → LegacyStateStore-CWG_HVC0.cjs} +7 -7
- package/dist/{LegacyStateStore-xGxPwP-m.cjs.map → LegacyStateStore-CWG_HVC0.cjs.map} +1 -1
- package/dist/{LocalStateStore-CkjFD-4b.cjs → LocalStateStore-CLwa2DpK.cjs} +8 -8
- package/dist/{LocalStateStore-CkjFD-4b.cjs.map → LocalStateStore-CLwa2DpK.cjs.map} +1 -1
- package/dist/{LocalStateStore-ByVjUIvS.mjs → LocalStateStore-Q4vXg2ua.mjs} +2 -2
- package/dist/{LocalStateStore-ByVjUIvS.mjs.map → LocalStateStore-Q4vXg2ua.mjs.map} +1 -1
- package/dist/{S3StateStore-iqMezbES.cjs → S3StateStore-Cea9_5gF.cjs} +5 -5
- package/dist/{S3StateStore-iqMezbES.cjs.map → S3StateStore-Cea9_5gF.cjs.map} +1 -1
- package/dist/{S3StateStore-kpFlGVLE.mjs → S3StateStore-CksKYKRa.mjs} +2 -2
- package/dist/{S3StateStore-kpFlGVLE.mjs.map → S3StateStore-CksKYKRa.mjs.map} +1 -1
- package/dist/{SSMStateStore-Bkz5ztfo.mjs → SSMStateStore-BszSCAS2.mjs} +2 -2
- package/dist/{SSMStateStore-Bkz5ztfo.mjs.map → SSMStateStore-BszSCAS2.mjs.map} +1 -1
- package/dist/{SSMStateStore-Z2OMVCtq.cjs → SSMStateStore-aBOTF018.cjs} +9 -9
- package/dist/{SSMStateStore-Z2OMVCtq.cjs.map → SSMStateStore-aBOTF018.cjs.map} +1 -1
- package/dist/{add-CM7RLj89.cjs → add-5MZAXybv.cjs} +8 -5
- package/dist/add-5MZAXybv.cjs.map +1 -0
- package/dist/{add-jpX7M8RB.mjs → add-D_jNqnfZ.mjs} +8 -5
- package/dist/add-D_jNqnfZ.mjs.map +1 -0
- package/dist/{bundler-lEBH8ENP.cjs → bundler-1REMhKps.cjs} +5 -5
- package/dist/{bundler-lEBH8ENP.cjs.map → bundler-1REMhKps.cjs.map} +1 -1
- package/dist/{bundler-CaAKsbcN.mjs → bundler-BMo-JP5s.mjs} +5 -5
- package/dist/{bundler-CaAKsbcN.mjs.map → bundler-BMo-JP5s.mjs.map} +1 -1
- package/dist/{cli-BV3jzbk0.mjs → cli-7edNFwGk.mjs} +5 -13
- package/dist/cli-7edNFwGk.mjs.map +1 -0
- package/dist/{cli-DQCBcNlN.cjs → cli-BL8ZHsLQ.cjs} +5 -13
- package/dist/cli-BL8ZHsLQ.cjs.map +1 -0
- package/dist/{compose-CQK6StuE.mjs → compose-DbJhRQlh.mjs} +24 -11
- package/dist/compose-DbJhRQlh.mjs.map +1 -0
- package/dist/{compose-CSR0yEJm.cjs → compose-xw86kVYi.cjs} +34 -21
- package/dist/compose-xw86kVYi.cjs.map +1 -0
- package/dist/{config-BzIfP8a-.d.cts → config-CpjsVxru.d.cts} +3 -3
- package/dist/{config-BzIfP8a-.d.cts.map → config-CpjsVxru.d.cts.map} +1 -1
- package/dist/{config-DhdzmndX.d.mts → config-DrCAyoH5.d.mts} +3 -3
- package/dist/{config-DhdzmndX.d.mts.map → config-DrCAyoH5.d.mts.map} +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +1 -1
- package/dist/{credentials-pAtB70k3.mjs → credentials-BgJ5mS_d.mjs} +91 -181
- package/dist/credentials-BgJ5mS_d.mjs.map +1 -0
- package/dist/{credentials-BVs7mrtw.cjs → credentials-tr26-KML.cjs} +122 -188
- package/dist/credentials-tr26-KML.cjs.map +1 -0
- package/dist/deploy/public.cjs +24 -20
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts +95 -13
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +95 -13
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +11 -10
- package/dist/deploy/public.mjs.map +1 -1
- package/dist/{deploy-BuU117CA.mjs → deploy-BTfmXd3g.mjs} +9 -9
- package/dist/deploy-BTfmXd3g.mjs.map +1 -0
- package/dist/{deploy-Bw2Mm3x3.cjs → deploy-CtbZj4zN.cjs} +13 -13
- package/dist/deploy-CtbZj4zN.cjs.map +1 -0
- package/dist/{dokploy-C81J1MVK.cjs → dokploy-TGk3oPwr.cjs} +2 -2
- package/dist/{dokploy-C81J1MVK.cjs.map → dokploy-TGk3oPwr.cjs.map} +1 -1
- package/dist/{dokploy-DWALWk7u.mjs → dokploy-r69yZaIt.mjs} +2 -2
- package/dist/{dokploy-DWALWk7u.mjs.map → dokploy-r69yZaIt.mjs.map} +1 -1
- package/dist/{encryption-DpAum8W7.mjs → encryption-C-8Tt5Hh.mjs} +3 -3
- package/dist/{encryption-DpAum8W7.mjs.map → encryption-C-8Tt5Hh.mjs.map} +1 -1
- package/dist/{encryption-B8h8Tna0.cjs → encryption-CDn7BH5O.cjs} +3 -3
- package/dist/{encryption-B8h8Tna0.cjs.map → encryption-CDn7BH5O.cjs.map} +1 -1
- package/dist/{engine-B01fjhLt.cjs → engine-Bt5k_UMq.cjs} +33 -23
- package/dist/engine-Bt5k_UMq.cjs.map +1 -0
- package/dist/{engine-BXCtEhSH.mjs → engine-jAINgiOB.mjs} +28 -18
- package/dist/engine-jAINgiOB.mjs.map +1 -0
- package/dist/{github-8B68qrLs.mjs → github-CZHAtwPT.mjs} +3 -3
- package/dist/{github-8B68qrLs.mjs.map → github-CZHAtwPT.mjs.map} +1 -1
- package/dist/{github-Cis9tYur.cjs → github-DFhuJQlp.cjs} +3 -3
- package/dist/{github-Cis9tYur.cjs.map → github-DFhuJQlp.cjs.map} +1 -1
- package/dist/{index-f77HdqN5.d.mts → index-MnUJuUlj.d.mts} +2 -2
- package/dist/{index-D1ODeM9s.d.cts.map → index-MnUJuUlj.d.mts.map} +1 -1
- package/dist/{index-D1ODeM9s.d.cts → index-elsLJTUv.d.cts} +2 -2
- package/dist/{index-f77HdqN5.d.mts.map → index-elsLJTUv.d.cts.map} +1 -1
- package/dist/index.cjs +105 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +99 -61
- package/dist/index.mjs.map +1 -1
- package/dist/local-Ciq-bTPr.mjs +224 -0
- package/dist/local-Ciq-bTPr.mjs.map +1 -0
- package/dist/local-Cq8qdgNX.cjs +241 -0
- package/dist/local-Cq8qdgNX.cjs.map +1 -0
- package/dist/{migrate-CPWn7A51.cjs → migrate-B16qgYTn.cjs} +3 -3
- package/dist/{migrate-CPWn7A51.cjs.map → migrate-B16qgYTn.cjs.map} +1 -1
- package/dist/{migrate-BBCp5blp.cjs → migrate-B1rVlwj1.cjs} +3 -3
- package/dist/{migrate-BBCp5blp.cjs.map → migrate-B1rVlwj1.cjs.map} +1 -1
- package/dist/{migrate-sDq7NApJ.mjs → migrate-Dn7nK6sh.mjs} +3 -3
- package/dist/{migrate-sDq7NApJ.mjs.map → migrate-Dn7nK6sh.mjs.map} +1 -1
- package/dist/{migrate-BeTWLSeC.mjs → migrate-ggkPVJRC.mjs} +3 -3
- package/dist/{migrate-BeTWLSeC.mjs.map → migrate-ggkPVJRC.mjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/{resolve-CXbwJ_iu.mjs → resolve-BSke45k6.mjs} +4 -4
- package/dist/{resolve-CXbwJ_iu.mjs.map → resolve-BSke45k6.mjs.map} +1 -1
- package/dist/{resolve-CztIqBOI.cjs → resolve-BXeXzpmU.cjs} +4 -4
- package/dist/{resolve-CztIqBOI.cjs.map → resolve-BXeXzpmU.cjs.map} +1 -1
- package/dist/{rollback-ByyFE5lV.mjs → rollback-CEE6dse4.mjs} +6 -6
- package/dist/{rollback-ByyFE5lV.mjs.map → rollback-CEE6dse4.mjs.map} +1 -1
- package/dist/{rollback-CyIJ4xGJ.cjs → rollback-DFMiBWf0.cjs} +8 -8
- package/dist/{rollback-CyIJ4xGJ.cjs.map → rollback-DFMiBWf0.cjs.map} +1 -1
- package/dist/{runtime-CNu2C2hB.d.mts → runtime-D48ZKk8_.d.cts} +2 -2
- package/dist/{runtime-CNu2C2hB.d.mts.map → runtime-D48ZKk8_.d.cts.map} +1 -1
- package/dist/{runtime-DMLgL26v.d.cts → runtime-HabiNBtJ.d.mts} +2 -2
- package/dist/{runtime-DMLgL26v.d.cts.map → runtime-HabiNBtJ.d.mts.map} +1 -1
- package/dist/{seeds-9C5CkDon.mjs → seeds-BYdrtZsC.mjs} +1525 -53
- package/dist/seeds-BYdrtZsC.mjs.map +1 -0
- package/dist/{seeds-B_Beuv0o.cjs → seeds-CsI0A_Ef.cjs} +1628 -65
- package/dist/seeds-CsI0A_Ef.cjs.map +1 -0
- package/dist/{sniffer-DgBkaLAu.mjs → sniffer-B0EU73bj.mjs} +5 -360
- package/dist/sniffer-B0EU73bj.mjs.map +1 -0
- package/dist/{sniffer-3fA0iExx.cjs → sniffer-DJYupBeK.cjs} +4 -413
- package/dist/sniffer-DJYupBeK.cjs.map +1 -0
- package/dist/{sst-DRi3H5TB.mjs → sst-D1Qj4sIs.mjs} +3 -3
- package/dist/{sst-DRi3H5TB.mjs.map → sst-D1Qj4sIs.mjs.map} +1 -1
- package/dist/{sst-hBrKouBy.cjs → sst-DAqUoZKG.cjs} +5 -5
- package/dist/{sst-hBrKouBy.cjs.map → sst-DAqUoZKG.cjs.map} +1 -1
- package/dist/{stages-CS1sjcRb.cjs → stages-Brn3vcdy.cjs} +2 -2
- package/dist/{stages-CS1sjcRb.cjs.map → stages-Brn3vcdy.cjs.map} +1 -1
- package/dist/{stages-CSXt7N2b.mjs → stages-DoHHz6pS.mjs} +2 -2
- package/dist/{stages-CSXt7N2b.mjs.map → stages-DoHHz6pS.mjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-BdvrmkaC.mjs → terminal-BTbZlrFV.mjs} +2 -2
- package/dist/{terminal-BdvrmkaC.mjs.map → terminal-BTbZlrFV.mjs.map} +1 -1
- package/dist/{terminal-BL5E0xbR.cjs → terminal-COv23heb.cjs} +2 -2
- package/dist/{terminal-BL5E0xbR.cjs.map → terminal-COv23heb.cjs.map} +1 -1
- package/dist/{types-BZn-8ssD.d.mts → types-0oAyFOfR.d.cts} +48 -49
- package/dist/types-0oAyFOfR.d.cts.map +1 -0
- package/dist/{types-DiZj6hqp.d.cts → types-BZ01tZs-.d.mts} +47 -50
- package/dist/types-BZ01tZs-.d.mts.map +1 -0
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-Bic_R3tz.cjs → workspace-CT0JM3Y8.cjs} +333 -1
- package/dist/workspace-CT0JM3Y8.cjs.map +1 -0
- package/dist/{workspace-Drz4jsvy.mjs → workspace-D2CYLMCW.mjs} +250 -2
- package/dist/workspace-D2CYLMCW.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/add-CM7RLj89.cjs.map +0 -1
- package/dist/add-jpX7M8RB.mjs.map +0 -1
- package/dist/cli-BV3jzbk0.mjs.map +0 -1
- package/dist/cli-DQCBcNlN.cjs.map +0 -1
- package/dist/compose-CQK6StuE.mjs.map +0 -1
- package/dist/compose-CSR0yEJm.cjs.map +0 -1
- package/dist/credentials-BVs7mrtw.cjs.map +0 -1
- package/dist/credentials-pAtB70k3.mjs.map +0 -1
- package/dist/deploy-BuU117CA.mjs.map +0 -1
- package/dist/deploy-Bw2Mm3x3.cjs.map +0 -1
- package/dist/engine-B01fjhLt.cjs.map +0 -1
- package/dist/engine-BXCtEhSH.mjs.map +0 -1
- package/dist/run-BJLIerMM.mjs +0 -133
- package/dist/run-BJLIerMM.mjs.map +0 -1
- package/dist/run-fVZ-rLnc.cjs +0 -174
- package/dist/run-fVZ-rLnc.cjs.map +0 -1
- package/dist/seeds-9C5CkDon.mjs.map +0 -1
- package/dist/seeds-B_Beuv0o.cjs.map +0 -1
- package/dist/sniffer-3fA0iExx.cjs.map +0 -1
- package/dist/sniffer-DgBkaLAu.mjs.map +0 -1
- package/dist/types-BZn-8ssD.d.mts.map +0 -1
- package/dist/types-DiZj6hqp.d.cts.map +0 -1
- package/dist/workspace-Bic_R3tz.cjs.map +0 -1
- package/dist/workspace-Drz4jsvy.mjs.map +0 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
-
const require_credentials = require("./credentials-BVs7mrtw.cjs");
|
|
3
2
|
const require_discover = require("./discover-D1It5r_h.cjs");
|
|
4
3
|
const require_sandbox = require("./sandbox-CL--ZDui.cjs");
|
|
5
|
-
const require_workspace = require("./workspace-
|
|
4
|
+
const require_workspace = require("./workspace-CT0JM3Y8.cjs");
|
|
5
|
+
const require_local = require("./local-Cq8qdgNX.cjs");
|
|
6
6
|
let node_path = require("node:path");
|
|
7
7
|
let node_fs = require("node:fs");
|
|
8
|
-
let node_os = require("node:os");
|
|
9
8
|
let node_url = require("node:url");
|
|
10
9
|
let node_crypto = require("node:crypto");
|
|
11
10
|
//#region src/secrets/encryption.ts
|
|
@@ -73,360 +72,6 @@ function eventError(error) {
|
|
|
73
72
|
};
|
|
74
73
|
}
|
|
75
74
|
//#endregion
|
|
76
|
-
//#region src/deploy/StateProvider.ts
|
|
77
|
-
/**
|
|
78
|
-
* Check if value is a StateProvider implementation.
|
|
79
|
-
*/
|
|
80
|
-
function isStateProvider(value) {
|
|
81
|
-
return typeof value === "object" && value !== null && typeof value.read === "function" && typeof value.write === "function";
|
|
82
|
-
}
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/deploy/StateStore.ts
|
|
85
|
-
/**
|
|
86
|
-
* Deploy state store.
|
|
87
|
-
*
|
|
88
|
-
* `StateProvider` reads and writes a whole stage at once, with nothing to stop
|
|
89
|
-
* two runs of the same stage from overwriting each other and nowhere to record
|
|
90
|
-
* a resource the moment it exists. A `StateStore` adds the three things a
|
|
91
|
-
* deploy needs to be safe against crashes and concurrent runs:
|
|
92
|
-
*
|
|
93
|
-
* - `lock(stage)`: one run per stage. A second gets `StateLocked`, naming the
|
|
94
|
-
* holder, instead of racing the first.
|
|
95
|
-
* - Versioned `read` and conditional `write`: a write names the version it was
|
|
96
|
-
* based on, and raises `StateVersionConflict` when the stored state moved on
|
|
97
|
-
* underneath it, so nothing is lost silently even without the lock.
|
|
98
|
-
* - Per-resource records: `putResource` journals one resource at a time, so a
|
|
99
|
-
* run that dies half way leaves behind the ids of everything it created.
|
|
100
|
-
*
|
|
101
|
-
* Built-in stores: `LocalStateStore`, `SSMStateStore`, `S3StateStore`. A
|
|
102
|
-
* custom `StateProvider` is wrapped by `LegacyStateStore`, which keeps it
|
|
103
|
-
* working but cannot lock.
|
|
104
|
-
*/
|
|
105
|
-
var StateLocked = class extends Error {
|
|
106
|
-
stage;
|
|
107
|
-
holder;
|
|
108
|
-
location;
|
|
109
|
-
constructor(stage, holder, location) {
|
|
110
|
-
const by = holder ? `${holder.owner}@${holder.host} (pid ${holder.pid}) since ${holder.acquiredAt}${holder.operation ? ` for '${holder.operation}'` : ""}` : "a run that did not record who it was";
|
|
111
|
-
super(`Deploy state for stage '${stage}' is locked by ${by} (${location}). Wait for that run to finish; if it crashed, release the lock with \`gkm state:unlock --stage ${stage}\`.`);
|
|
112
|
-
this.stage = stage;
|
|
113
|
-
this.holder = holder;
|
|
114
|
-
this.location = location;
|
|
115
|
-
this.name = "StateLocked";
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
var StateVersionConflict = class extends Error {
|
|
119
|
-
stage;
|
|
120
|
-
expectedVersion;
|
|
121
|
-
actualVersion;
|
|
122
|
-
constructor(stage, expectedVersion, actualVersion) {
|
|
123
|
-
super(`Deploy state for stage '${stage}' changed since it was read (expected ${expectedVersion ? `version ${expectedVersion}` : "no state"}, found ${actualVersion ? `version ${actualVersion}` : "no state"}). Another run wrote it: read the state again and re-apply the change, and hold the stage's lock so runs take turns.`);
|
|
124
|
-
this.stage = stage;
|
|
125
|
-
this.expectedVersion = expectedVersion;
|
|
126
|
-
this.actualVersion = actualVersion;
|
|
127
|
-
this.name = "StateVersionConflict";
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
var StageStateMissing = class extends Error {
|
|
131
|
-
stage;
|
|
132
|
-
constructor(stage) {
|
|
133
|
-
super(`There is no deploy state for stage '${stage}' to record a resource in. Write the stage's state first (write with expectedVersion: null).`);
|
|
134
|
-
this.stage = stage;
|
|
135
|
-
this.name = "StageStateMissing";
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
var StateUnreadable = class extends Error {
|
|
139
|
-
stage;
|
|
140
|
-
location;
|
|
141
|
-
constructor(stage, location, cause) {
|
|
142
|
-
super(`Deploy state for stage '${stage}' at ${location} is not valid JSON. Restore it from a backup (or the provider's history) rather than deploying without it — a deploy without state recreates every resource.`, { cause });
|
|
143
|
-
this.stage = stage;
|
|
144
|
-
this.location = location;
|
|
145
|
-
this.name = "StateUnreadable";
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
var StateSchemaTooNew = class extends Error {
|
|
149
|
-
stage;
|
|
150
|
-
schemaVersion;
|
|
151
|
-
constructor(stage, schemaVersion) {
|
|
152
|
-
super(`Deploy state for stage '${stage}' has schema version ${String(schemaVersion)}, newer than this @geekmidas/cli understands (2). Upgrade @geekmidas/cli to the version that wrote it.`);
|
|
153
|
-
this.stage = stage;
|
|
154
|
-
this.schemaVersion = schemaVersion;
|
|
155
|
-
this.name = "StateSchemaTooNew";
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Not thrown: emitted (once per store) when a custom `StateProvider` stands
|
|
160
|
-
* in for a store, so a deploy that cannot be protected from a concurrent one
|
|
161
|
-
* says so.
|
|
162
|
-
*/
|
|
163
|
-
var StateStoreWithoutLocking = class extends Error {
|
|
164
|
-
provider;
|
|
165
|
-
constructor(provider) {
|
|
166
|
-
super(`The custom state provider '${provider}' has no lock and no versions, so two deploys of the same stage can still overwrite each other. Implement StateStore (lock, versioned read, conditional write) or use the 'local', 'ssm' or 's3' state provider.`);
|
|
167
|
-
this.provider = provider;
|
|
168
|
-
this.name = "StateStoreWithoutLocking";
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
var StateStoreNeedsWorkspaceName = class extends Error {
|
|
172
|
-
provider;
|
|
173
|
-
constructor(provider) {
|
|
174
|
-
super(`The '${provider}' state provider keys state by workspace name. Set "name" in gkm.config.ts.`);
|
|
175
|
-
this.provider = provider;
|
|
176
|
-
this.name = "StateStoreNeedsWorkspaceName";
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
var UnknownStateProvider = class extends Error {
|
|
180
|
-
config;
|
|
181
|
-
constructor(config) {
|
|
182
|
-
super(`Unknown state provider ${JSON.stringify(config)}. Use 'local', 'ssm', 's3', or an object implementing StateStore or StateProvider.`);
|
|
183
|
-
this.config = config;
|
|
184
|
-
this.name = "UnknownStateProvider";
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
/** A lock or write that could not get at the state backend in time. */
|
|
188
|
-
var StateStoreBusy = class extends Error {
|
|
189
|
-
stage;
|
|
190
|
-
location;
|
|
191
|
-
constructor(stage, location) {
|
|
192
|
-
super(`Timed out waiting to write deploy state for stage '${stage}' (${location}). If no other gkm process is running, remove ${location}.`);
|
|
193
|
-
this.stage = stage;
|
|
194
|
-
this.location = location;
|
|
195
|
-
this.name = "StateStoreBusy";
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
function decodeDocument(stage, body, location) {
|
|
199
|
-
let parsed;
|
|
200
|
-
try {
|
|
201
|
-
parsed = JSON.parse(body);
|
|
202
|
-
} catch (error) {
|
|
203
|
-
throw new StateUnreadable(stage, location, error);
|
|
204
|
-
}
|
|
205
|
-
if (typeof parsed !== "object" || parsed === null) throw new StateUnreadable(stage, location, parsed);
|
|
206
|
-
const schemaVersion = parsed.schemaVersion;
|
|
207
|
-
if (schemaVersion === void 0) return {
|
|
208
|
-
schemaVersion: 1,
|
|
209
|
-
state: parsed
|
|
210
|
-
};
|
|
211
|
-
if (schemaVersion === 2) return {
|
|
212
|
-
schemaVersion: 2,
|
|
213
|
-
document: parsed
|
|
214
|
-
};
|
|
215
|
-
throw new StateSchemaTooNew(stage, schemaVersion);
|
|
216
|
-
}
|
|
217
|
-
function encodeDocument(document) {
|
|
218
|
-
return JSON.stringify(document, null, 2);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* v1 state as a v2 document. The ids v1 kept are seeded as `ready` records,
|
|
222
|
-
* so the first journaled deploy after an upgrade adopts them rather than
|
|
223
|
-
* treating them as unknown.
|
|
224
|
-
*/
|
|
225
|
-
function migrateV1(stage, state) {
|
|
226
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
227
|
-
const resources = {};
|
|
228
|
-
const seed = (type, name, id) => {
|
|
229
|
-
if (!id) return;
|
|
230
|
-
const key = name ? `${type}:${name}` : type;
|
|
231
|
-
resources[key] = {
|
|
232
|
-
key,
|
|
233
|
-
type,
|
|
234
|
-
id,
|
|
235
|
-
status: "ready",
|
|
236
|
-
updatedAt: now
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
seed("project", null, state.projectId);
|
|
240
|
-
seed("environment", null, state.environmentId);
|
|
241
|
-
for (const [app, id] of Object.entries(state.applications ?? {})) seed("application", app, id);
|
|
242
|
-
seed("postgres", null, state.services?.postgresId);
|
|
243
|
-
seed("redis", null, state.services?.redisId);
|
|
244
|
-
seed("backup-destination", null, state.backups?.destinationId);
|
|
245
|
-
return {
|
|
246
|
-
schemaVersion: 2,
|
|
247
|
-
stage,
|
|
248
|
-
serial: 1,
|
|
249
|
-
state,
|
|
250
|
-
resources,
|
|
251
|
-
updatedAt: now
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
function newLockHolder(options) {
|
|
255
|
-
let owner = "unknown";
|
|
256
|
-
try {
|
|
257
|
-
owner = (0, node_os.userInfo)().username;
|
|
258
|
-
} catch {}
|
|
259
|
-
return {
|
|
260
|
-
id: (0, node_crypto.randomUUID)(),
|
|
261
|
-
owner,
|
|
262
|
-
host: (0, node_os.hostname)(),
|
|
263
|
-
pid: process.pid,
|
|
264
|
-
acquiredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
265
|
-
operation: options?.operation
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
function contentVersion(body) {
|
|
269
|
-
return (0, node_crypto.createHash)("sha256").update(body).digest("hex").slice(0, 16);
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* A store over a backend that can read and conditionally write one blob per
|
|
273
|
-
* stage, and create a lock object only if it does not exist. Migration and
|
|
274
|
-
* resource records are the same for every such backend, so they live here.
|
|
275
|
-
*/
|
|
276
|
-
var DocumentStateStore = class {
|
|
277
|
-
async lock(stage, options) {
|
|
278
|
-
const holder = newLockHolder(options);
|
|
279
|
-
await this.createLock(stage, holder);
|
|
280
|
-
let released = false;
|
|
281
|
-
return {
|
|
282
|
-
stage,
|
|
283
|
-
holder,
|
|
284
|
-
release: async () => {
|
|
285
|
-
if (released) return;
|
|
286
|
-
released = true;
|
|
287
|
-
await this.removeLock(stage, holder);
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
async forceUnlock(stage) {
|
|
292
|
-
const holder = await this.readLock(stage);
|
|
293
|
-
await this.removeLock(stage, null);
|
|
294
|
-
return holder;
|
|
295
|
-
}
|
|
296
|
-
async read(stage) {
|
|
297
|
-
const current = await this.readDocument(stage);
|
|
298
|
-
if (!current) return null;
|
|
299
|
-
return {
|
|
300
|
-
state: current.document.state,
|
|
301
|
-
resources: current.document.resources,
|
|
302
|
-
version: current.version
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
async write(stage, state, options) {
|
|
306
|
-
if (options.expectedVersion === null) {
|
|
307
|
-
const document = {
|
|
308
|
-
schemaVersion: 2,
|
|
309
|
-
stage,
|
|
310
|
-
serial: 1,
|
|
311
|
-
state,
|
|
312
|
-
resources: {},
|
|
313
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
314
|
-
};
|
|
315
|
-
return this.writeRaw(stage, encodeDocument(document), null);
|
|
316
|
-
}
|
|
317
|
-
return this.mutate(stage, options.expectedVersion, (document) => ({
|
|
318
|
-
...document,
|
|
319
|
-
state
|
|
320
|
-
}));
|
|
321
|
-
}
|
|
322
|
-
async putResource(stage, record, options) {
|
|
323
|
-
return this.mutate(stage, options?.expectedVersion, (document) => ({
|
|
324
|
-
...document,
|
|
325
|
-
resources: {
|
|
326
|
-
...document.resources,
|
|
327
|
-
[record.key]: {
|
|
328
|
-
...record,
|
|
329
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}));
|
|
333
|
-
}
|
|
334
|
-
async deleteResource(stage, key, options) {
|
|
335
|
-
return this.mutate(stage, options?.expectedVersion, (document) => {
|
|
336
|
-
const { [key]: _removed, ...resources } = document.resources;
|
|
337
|
-
return {
|
|
338
|
-
...document,
|
|
339
|
-
resources
|
|
340
|
-
};
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
async mutate(stage, expectedVersion, change) {
|
|
344
|
-
const current = await this.readDocument(stage);
|
|
345
|
-
if (!current) {
|
|
346
|
-
if (expectedVersion !== void 0) throw new StateVersionConflict(stage, expectedVersion, null);
|
|
347
|
-
throw new StageStateMissing(stage);
|
|
348
|
-
}
|
|
349
|
-
if (expectedVersion !== void 0 && current.version !== expectedVersion) throw new StateVersionConflict(stage, expectedVersion, current.version);
|
|
350
|
-
const next = change(current.document);
|
|
351
|
-
next.serial = current.document.serial + 1;
|
|
352
|
-
next.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
353
|
-
return this.writeRaw(stage, encodeDocument(next), current.version);
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Reads the stage's document, migrating v1 in place on the way. The
|
|
357
|
-
* migration is itself a conditional write: if another run migrated (or
|
|
358
|
-
* wrote) first, its result is read instead.
|
|
359
|
-
*/
|
|
360
|
-
async readDocument(stage, attempt = 0) {
|
|
361
|
-
const raw = await this.readRaw(stage);
|
|
362
|
-
if (!raw) return null;
|
|
363
|
-
const decoded = decodeDocument(stage, raw.body, this.location(stage));
|
|
364
|
-
if (decoded.schemaVersion === 2) return {
|
|
365
|
-
document: decoded.document,
|
|
366
|
-
version: raw.version
|
|
367
|
-
};
|
|
368
|
-
await this.writeV1Backup(stage, raw.body);
|
|
369
|
-
const document = migrateV1(stage, decoded.state);
|
|
370
|
-
try {
|
|
371
|
-
return {
|
|
372
|
-
document,
|
|
373
|
-
version: await this.writeRaw(stage, encodeDocument(document), raw.version)
|
|
374
|
-
};
|
|
375
|
-
} catch (error) {
|
|
376
|
-
if (error instanceof StateVersionConflict && attempt < 2) return this.readDocument(stage, attempt + 1);
|
|
377
|
-
throw error;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
function isStateStore(value) {
|
|
382
|
-
return typeof value === "object" && value !== null && typeof value.lock === "function" && typeof value.read === "function" && typeof value.write === "function" && typeof value.putResource === "function";
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* The store for a workspace's `state` config:
|
|
386
|
-
*
|
|
387
|
-
* - none / `'local'`: `LocalStateStore` under `.gkm/`
|
|
388
|
-
* - `'ssm'`: `SSMStateStore`, with no local cache — SSM is read directly, so
|
|
389
|
-
* a stale local copy can never win over it
|
|
390
|
-
* - `'s3'`: `S3StateStore`
|
|
391
|
-
* - a `StateStore` object: used as is
|
|
392
|
-
* - a `StateProvider` object: wrapped by `LegacyStateStore`
|
|
393
|
-
*/
|
|
394
|
-
async function createStateStore(options) {
|
|
395
|
-
const { config, workspaceRoot, workspaceName } = options;
|
|
396
|
-
if (!config || config.provider === "local") {
|
|
397
|
-
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-CkjFD-4b.cjs")).then((n) => n.LocalStateStore_exports);
|
|
398
|
-
return new LocalStateStore(workspaceRoot);
|
|
399
|
-
}
|
|
400
|
-
if (isStateStore(config.provider)) return config.provider;
|
|
401
|
-
if (isStateProvider(config.provider)) {
|
|
402
|
-
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-xGxPwP-m.cjs"));
|
|
403
|
-
return new LegacyStateStore(config.provider, { warn: options.warn });
|
|
404
|
-
}
|
|
405
|
-
if (config.provider === "ssm") {
|
|
406
|
-
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("ssm");
|
|
407
|
-
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-Z2OMVCtq.cjs"));
|
|
408
|
-
const ssm = config;
|
|
409
|
-
return SSMStateStore.create({
|
|
410
|
-
workspaceName,
|
|
411
|
-
region: ssm.region,
|
|
412
|
-
profile: ssm.profile
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
if (config.provider === "s3") {
|
|
416
|
-
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("s3");
|
|
417
|
-
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-iqMezbES.cjs"));
|
|
418
|
-
const s3 = config;
|
|
419
|
-
return S3StateStore.create({
|
|
420
|
-
workspaceName,
|
|
421
|
-
bucket: s3.bucket,
|
|
422
|
-
prefix: s3.prefix,
|
|
423
|
-
region: s3.region,
|
|
424
|
-
profile: s3.profile
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
throw new UnknownStateProvider(config);
|
|
428
|
-
}
|
|
429
|
-
//#endregion
|
|
430
75
|
//#region src/target/dokploy/dokploy-api.ts
|
|
431
76
|
var dokploy_api_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
432
77
|
DEFAULT_DEPLOYMENT_TIMEOUT_MS: () => DEFAULT_DEPLOYMENT_TIMEOUT_MS,
|
|
@@ -1341,7 +986,7 @@ function resolveSnifferFile(baseName) {
|
|
|
1341
986
|
* comes back as the error the caller reports.
|
|
1342
987
|
*/
|
|
1343
988
|
async function runSniffer(run, workspacePath, cwd, nodeArgs) {
|
|
1344
|
-
const sandbox = run.sandbox ?? require_sandbox.activeSandbox() ?? new
|
|
989
|
+
const sandbox = run.sandbox ?? require_sandbox.activeSandbox() ?? new require_local.LocalSandbox({ root: (0, node_path.resolve)(workspacePath) });
|
|
1345
990
|
try {
|
|
1346
991
|
const result = await sandbox.exec("node", nodeArgs, {
|
|
1347
992
|
cwd,
|
|
@@ -1630,12 +1275,6 @@ Object.defineProperty(exports, "DeploymentTimedOut", {
|
|
|
1630
1275
|
return DeploymentTimedOut;
|
|
1631
1276
|
}
|
|
1632
1277
|
});
|
|
1633
|
-
Object.defineProperty(exports, "DocumentStateStore", {
|
|
1634
|
-
enumerable: true,
|
|
1635
|
-
get: function() {
|
|
1636
|
-
return DocumentStateStore;
|
|
1637
|
-
}
|
|
1638
|
-
});
|
|
1639
1278
|
Object.defineProperty(exports, "DokployApi", {
|
|
1640
1279
|
enumerable: true,
|
|
1641
1280
|
get: function() {
|
|
@@ -1648,48 +1287,6 @@ Object.defineProperty(exports, "DokployApiError", {
|
|
|
1648
1287
|
return DokployApiError;
|
|
1649
1288
|
}
|
|
1650
1289
|
});
|
|
1651
|
-
Object.defineProperty(exports, "StageStateMissing", {
|
|
1652
|
-
enumerable: true,
|
|
1653
|
-
get: function() {
|
|
1654
|
-
return StageStateMissing;
|
|
1655
|
-
}
|
|
1656
|
-
});
|
|
1657
|
-
Object.defineProperty(exports, "StateLocked", {
|
|
1658
|
-
enumerable: true,
|
|
1659
|
-
get: function() {
|
|
1660
|
-
return StateLocked;
|
|
1661
|
-
}
|
|
1662
|
-
});
|
|
1663
|
-
Object.defineProperty(exports, "StateStoreBusy", {
|
|
1664
|
-
enumerable: true,
|
|
1665
|
-
get: function() {
|
|
1666
|
-
return StateStoreBusy;
|
|
1667
|
-
}
|
|
1668
|
-
});
|
|
1669
|
-
Object.defineProperty(exports, "StateStoreWithoutLocking", {
|
|
1670
|
-
enumerable: true,
|
|
1671
|
-
get: function() {
|
|
1672
|
-
return StateStoreWithoutLocking;
|
|
1673
|
-
}
|
|
1674
|
-
});
|
|
1675
|
-
Object.defineProperty(exports, "StateVersionConflict", {
|
|
1676
|
-
enumerable: true,
|
|
1677
|
-
get: function() {
|
|
1678
|
-
return StateVersionConflict;
|
|
1679
|
-
}
|
|
1680
|
-
});
|
|
1681
|
-
Object.defineProperty(exports, "contentVersion", {
|
|
1682
|
-
enumerable: true,
|
|
1683
|
-
get: function() {
|
|
1684
|
-
return contentVersion;
|
|
1685
|
-
}
|
|
1686
|
-
});
|
|
1687
|
-
Object.defineProperty(exports, "createStateStore", {
|
|
1688
|
-
enumerable: true,
|
|
1689
|
-
get: function() {
|
|
1690
|
-
return createStateStore;
|
|
1691
|
-
}
|
|
1692
|
-
});
|
|
1693
1290
|
Object.defineProperty(exports, "dokploy_api_exports", {
|
|
1694
1291
|
enumerable: true,
|
|
1695
1292
|
get: function() {
|
|
@@ -1720,12 +1317,6 @@ Object.defineProperty(exports, "keyFingerprint", {
|
|
|
1720
1317
|
return keyFingerprint;
|
|
1721
1318
|
}
|
|
1722
1319
|
});
|
|
1723
|
-
Object.defineProperty(exports, "newLockHolder", {
|
|
1724
|
-
enumerable: true,
|
|
1725
|
-
get: function() {
|
|
1726
|
-
return newLockHolder;
|
|
1727
|
-
}
|
|
1728
|
-
});
|
|
1729
1320
|
Object.defineProperty(exports, "sniffAllApps", {
|
|
1730
1321
|
enumerable: true,
|
|
1731
1322
|
get: function() {
|
|
@@ -1739,4 +1330,4 @@ Object.defineProperty(exports, "sniffAppEnvironment", {
|
|
|
1739
1330
|
}
|
|
1740
1331
|
});
|
|
1741
1332
|
|
|
1742
|
-
//# sourceMappingURL=sniffer-
|
|
1333
|
+
//# sourceMappingURL=sniffer-DJYupBeK.cjs.map
|