@envsync-cloud/deploy-cli 0.6.7 → 0.6.8

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1249,7 +1249,7 @@ function runBootstrapInit(config) {
1249
1249
  ],
1250
1250
  { quiet: true }
1251
1251
  ).trim();
1252
- const result = JSON.parse(output);
1252
+ const result = parseBootstrapInitJson(output);
1253
1253
  if (!result.openfgaStoreId || !result.openfgaModelId) {
1254
1254
  throw new Error("Bootstrap init did not return OpenFGA IDs");
1255
1255
  }
@@ -1259,6 +1259,31 @@ function runBootstrapInit(config) {
1259
1259
  openfgaModelId: result.openfgaModelId
1260
1260
  };
1261
1261
  }
1262
+ function parseBootstrapInitJson(output) {
1263
+ const trimmed = output.trim();
1264
+ if (!trimmed) {
1265
+ throw new Error("Bootstrap init returned no JSON output");
1266
+ }
1267
+ try {
1268
+ return JSON.parse(trimmed);
1269
+ } catch {
1270
+ const lines = trimmed.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
1271
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
1272
+ const candidate = lines[index];
1273
+ if (!candidate.startsWith("{") || !candidate.endsWith("}")) continue;
1274
+ try {
1275
+ return JSON.parse(candidate);
1276
+ } catch {
1277
+ continue;
1278
+ }
1279
+ }
1280
+ throw new Error(
1281
+ `Bootstrap init returned non-JSON output.
1282
+ Captured stdout:
1283
+ ${trimmed}`
1284
+ );
1285
+ }
1286
+ }
1262
1287
  function hasCompleteBootstrapState(generated) {
1263
1288
  return REQUIRED_BOOTSTRAP_ENV_KEYS.every((key) => {
1264
1289
  switch (key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@envsync-cloud/deploy-cli",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
4
4
  "description": "CLI for self-hosted EnvSync deployment on Docker Swarm",
5
5
  "type": "module",
6
6
  "bin": {