everything-dev 1.30.0 → 1.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/cli/init.cjs +1 -0
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +1 -1
- package/dist/cli/init.d.cts.map +1 -1
- package/dist/cli/init.d.mts +1 -1
- package/dist/cli/init.d.mts.map +1 -1
- package/dist/cli/init.mjs +1 -0
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/sync.cjs +3 -1
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +3 -1
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/upgrade.cjs +1 -1
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +1 -1
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli.cjs +31 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +31 -0
- package/dist/cli.mjs.map +1 -1
- package/dist/contract.cjs +32 -1
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +80 -1
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +80 -1
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +18 -1
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +33 -0
- package/dist/contract.meta.d.mts +33 -0
- package/dist/contract.meta.mjs +18 -1
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +31 -2
- package/dist/contract.mjs.map +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/merge.cjs +1 -0
- package/dist/merge.cjs.map +1 -1
- package/dist/merge.d.cts +1 -1
- package/dist/merge.d.cts.map +1 -1
- package/dist/merge.d.mts +1 -1
- package/dist/merge.d.mts.map +1 -1
- package/dist/merge.mjs +1 -0
- package/dist/merge.mjs.map +1 -1
- package/dist/mf.cjs +1 -0
- package/dist/mf.cjs.map +1 -1
- package/dist/mf.d.cts.map +1 -1
- package/dist/mf.d.mts.map +1 -1
- package/dist/mf.mjs +1 -0
- package/dist/mf.mjs.map +1 -1
- package/dist/plugin.cjs +216 -76
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +43 -0
- package/dist/plugin.d.mts +43 -0
- package/dist/plugin.mjs +216 -76
- package/dist/plugin.mjs.map +1 -1
- package/dist/types.cjs +7 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +17 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +17 -1
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +6 -2
- package/dist/types.mjs.map +1 -1
- package/package.json +1 -1
package/dist/plugin.cjs
CHANGED
|
@@ -252,8 +252,9 @@ async function buildEverythingDevQuietly(cwd) {
|
|
|
252
252
|
async function fetchPublishedConfig(accountId, gatewayId) {
|
|
253
253
|
try {
|
|
254
254
|
return await require_fastkv.fetchBosConfigFromFastKv(`bos://${accountId}/${gatewayId}`);
|
|
255
|
-
} catch {
|
|
256
|
-
return null;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
if (error instanceof Error && error.message.startsWith("No config found")) return null;
|
|
257
|
+
throw error;
|
|
257
258
|
}
|
|
258
259
|
}
|
|
259
260
|
function selectWorkspaceTargets(packages, bosConfig) {
|
|
@@ -614,20 +615,31 @@ var plugin_default = (0, every_plugin.createPlugin)({
|
|
|
614
615
|
phase: "config",
|
|
615
616
|
status: "running"
|
|
616
617
|
});
|
|
618
|
+
const bosEnv = input.env ?? (node_process.default.env.BOS_ENV === "staging" ? "staging" : "production");
|
|
617
619
|
const account = input.account ?? node_process.default.env.BOS_ACCOUNT;
|
|
618
620
|
const domain = input.domain ?? node_process.default.env.BOS_GATEWAY;
|
|
619
621
|
let config = null;
|
|
620
622
|
let remoteConfig = null;
|
|
621
|
-
if (account && domain) {
|
|
623
|
+
if (account && domain) try {
|
|
622
624
|
remoteConfig = await fetchPublishedConfig(account, domain);
|
|
623
625
|
if (remoteConfig) config = remoteConfig;
|
|
624
|
-
else
|
|
626
|
+
else return {
|
|
627
|
+
status: "error",
|
|
628
|
+
url: "",
|
|
629
|
+
error: `No config found at bos://${account}/${domain}. Verify the account and gateway are correct and the config has been published.\nExpected URL: ${require_fastkv.buildRegistryConfigUrl(account, domain)}`
|
|
630
|
+
};
|
|
631
|
+
} catch (error) {
|
|
632
|
+
return {
|
|
633
|
+
status: "error",
|
|
634
|
+
url: "",
|
|
635
|
+
error: `Failed to fetch config for bos://${account}/${domain}: ${error instanceof Error ? error.message : "Unknown error"}\nExpected URL: ${require_fastkv.buildRegistryConfigUrl(account, domain)}`
|
|
636
|
+
};
|
|
625
637
|
}
|
|
626
|
-
|
|
638
|
+
else config = deps.bosConfig;
|
|
627
639
|
if (!config) return {
|
|
628
640
|
status: "error",
|
|
629
641
|
url: "",
|
|
630
|
-
error: "No configuration found.
|
|
642
|
+
error: "No configuration found. Provide --account and --gateway flags, or create a local bos.config.json."
|
|
631
643
|
};
|
|
632
644
|
if (account) config = {
|
|
633
645
|
...config,
|
|
@@ -638,7 +650,7 @@ var plugin_default = (0, every_plugin.createPlugin)({
|
|
|
638
650
|
domain
|
|
639
651
|
};
|
|
640
652
|
const port = input.port ?? require_config.getHostDevelopmentPort(config.app.host.development);
|
|
641
|
-
const isStaging =
|
|
653
|
+
const isStaging = bosEnv === "staging";
|
|
642
654
|
const runtimePlugins = await require_config.buildRuntimePluginsForConfig(config, deps.configDir, "production");
|
|
643
655
|
require_config.suppressWarnings();
|
|
644
656
|
const runtimeConfig = require_app.buildRuntimeConfig(config, {
|
|
@@ -651,6 +663,8 @@ var plugin_default = (0, every_plugin.createPlugin)({
|
|
|
651
663
|
});
|
|
652
664
|
require_config.drainConfigWarnings();
|
|
653
665
|
require_config.resumeWarnings();
|
|
666
|
+
if (isStaging && config.staging?.domain) runtimeConfig.domain = config.staging.domain;
|
|
667
|
+
if (isStaging) runtimeConfig.env = "staging";
|
|
654
668
|
require_infra.syncGeneratedInfra(deps.configDir, runtimeConfig);
|
|
655
669
|
if (!(0, node_fs.existsSync)((0, node_path.join)(deps.configDir, ".env"))) {
|
|
656
670
|
require_infra.ensureEnvFile(deps.configDir);
|
|
@@ -671,12 +685,13 @@ var plugin_default = (0, every_plugin.createPlugin)({
|
|
|
671
685
|
const productionEnv = {};
|
|
672
686
|
const warnings = [];
|
|
673
687
|
if (!node_process.default.env.CORS_ORIGIN && config.domain) {
|
|
674
|
-
const defaultOrigin = `https://${config.domain}`;
|
|
688
|
+
const defaultOrigin = `https://${isStaging ? config.staging?.domain ?? config.domain : config.domain}`;
|
|
675
689
|
productionEnv.CORS_ORIGIN = defaultOrigin;
|
|
676
690
|
warnings.push(`CORS_ORIGIN defaulting to ${defaultOrigin}`);
|
|
677
691
|
}
|
|
678
692
|
const requiredSecrets = /* @__PURE__ */ new Set();
|
|
679
693
|
const missingSecrets = [];
|
|
694
|
+
if (runtimeConfig.host.secrets) for (const s of runtimeConfig.host.secrets) requiredSecrets.add(s);
|
|
680
695
|
if (runtimeConfig.auth?.secrets) for (const s of runtimeConfig.auth.secrets) requiredSecrets.add(s);
|
|
681
696
|
if (runtimeConfig.api?.secrets) for (const s of runtimeConfig.api.secrets) requiredSecrets.add(s);
|
|
682
697
|
for (const plugin of Object.values(runtimeConfig.plugins ?? {})) if (plugin.secrets) for (const s of plugin.secrets) requiredSecrets.add(s);
|
|
@@ -779,89 +794,120 @@ var plugin_default = (0, every_plugin.createPlugin)({
|
|
|
779
794
|
registryUrl: "",
|
|
780
795
|
error: "No bos.config.json found"
|
|
781
796
|
};
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
|
|
797
|
+
const result = await publishToFastKv({
|
|
798
|
+
bosConfig: deps.bosConfig,
|
|
799
|
+
runtimeConfig: deps.runtimeConfig,
|
|
800
|
+
configDir: deps.configDir,
|
|
801
|
+
env: input.env,
|
|
802
|
+
build: input.deploy,
|
|
803
|
+
dryRun: input.dryRun,
|
|
804
|
+
packages: input.packages,
|
|
805
|
+
network: input.network,
|
|
806
|
+
privateKey: input.privateKey
|
|
807
|
+
});
|
|
808
|
+
if (result.publishConfig) {
|
|
809
|
+
const refreshed = await require_config.loadResolvedConfig({ cwd: deps.configDir });
|
|
810
|
+
if (refreshed?.config) {
|
|
811
|
+
deps.bosConfig = refreshed.config;
|
|
812
|
+
deps.runtimeConfig = refreshed.runtime;
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
return {
|
|
816
|
+
status: result.status,
|
|
817
|
+
registryUrl: result.registryUrl,
|
|
818
|
+
txHash: result.txHash,
|
|
819
|
+
error: result.error,
|
|
820
|
+
built: result.built,
|
|
821
|
+
skipped: result.skipped
|
|
822
|
+
};
|
|
823
|
+
}),
|
|
824
|
+
deploy: builder.deploy.handler(async ({ input }) => {
|
|
825
|
+
if (!deps.bosConfig) return {
|
|
785
826
|
status: "error",
|
|
786
827
|
registryUrl: "",
|
|
787
|
-
|
|
828
|
+
redeployed: false,
|
|
829
|
+
error: "No bos.config.json found"
|
|
788
830
|
};
|
|
789
|
-
const
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
831
|
+
const result = await publishToFastKv({
|
|
832
|
+
bosConfig: deps.bosConfig,
|
|
833
|
+
runtimeConfig: deps.runtimeConfig,
|
|
834
|
+
configDir: deps.configDir,
|
|
835
|
+
env: input.env,
|
|
836
|
+
build: input.build,
|
|
837
|
+
dryRun: input.dryRun,
|
|
838
|
+
packages: input.packages,
|
|
839
|
+
network: input.network,
|
|
840
|
+
privateKey: input.privateKey
|
|
841
|
+
});
|
|
842
|
+
if (result.status === "error") return {
|
|
843
|
+
status: "error",
|
|
844
|
+
registryUrl: result.registryUrl,
|
|
845
|
+
txHash: result.txHash,
|
|
846
|
+
built: result.built,
|
|
847
|
+
skipped: result.skipped,
|
|
848
|
+
redeployed: false,
|
|
849
|
+
error: result.error
|
|
850
|
+
};
|
|
851
|
+
if (result.status === "dry-run") return {
|
|
797
852
|
status: "dry-run",
|
|
798
|
-
registryUrl,
|
|
799
|
-
built,
|
|
800
|
-
skipped
|
|
853
|
+
registryUrl: result.registryUrl,
|
|
854
|
+
built: result.built,
|
|
855
|
+
skipped: result.skipped,
|
|
856
|
+
redeployed: false
|
|
801
857
|
};
|
|
802
|
-
if (
|
|
803
|
-
await generateCodeArtifacts(deps.configDir, deps.bosConfig, {
|
|
804
|
-
env: "production",
|
|
805
|
-
runtimeConfig: deps.runtimeConfig ?? void 0
|
|
806
|
-
});
|
|
807
|
-
const result = await buildWorkspaceTargets({
|
|
808
|
-
configDir: deps.configDir,
|
|
809
|
-
bosConfig: deps.bosConfig,
|
|
810
|
-
runtimeConfig: deps.runtimeConfig,
|
|
811
|
-
targets,
|
|
812
|
-
deploy: true
|
|
813
|
-
});
|
|
814
|
-
built = result.built;
|
|
815
|
-
skipped = result.skipped;
|
|
858
|
+
if (result.publishConfig) {
|
|
816
859
|
const refreshed = await require_config.loadResolvedConfig({ cwd: deps.configDir });
|
|
817
860
|
if (refreshed?.config) {
|
|
818
861
|
deps.bosConfig = refreshed.config;
|
|
819
862
|
deps.runtimeConfig = refreshed.runtime;
|
|
820
|
-
publishConfig = refreshed.config;
|
|
821
863
|
}
|
|
822
864
|
}
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
865
|
+
let redeployed = false;
|
|
866
|
+
let service;
|
|
867
|
+
if (node_process.default.env.RAILWAY_TOKEN) {
|
|
868
|
+
const railwayService = input.service ?? deps.bosConfig.ci?.railway?.service;
|
|
869
|
+
if (!railwayService) return {
|
|
870
|
+
status: "published",
|
|
871
|
+
registryUrl: result.registryUrl,
|
|
872
|
+
txHash: result.txHash,
|
|
873
|
+
built: result.built,
|
|
874
|
+
skipped: result.skipped,
|
|
875
|
+
redeployed: false,
|
|
876
|
+
error: "Config published but Railway redeploy failed: ci.railway.service is not configured in bos.config.json"
|
|
877
|
+
};
|
|
878
|
+
service = railwayService;
|
|
830
879
|
try {
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
gas: "300Tgas",
|
|
839
|
-
deposit: "0NEAR"
|
|
840
|
-
}))).txHash;
|
|
880
|
+
await require_run.run("railway", [
|
|
881
|
+
"redeploy",
|
|
882
|
+
"--service",
|
|
883
|
+
railwayService,
|
|
884
|
+
"--yes"
|
|
885
|
+
]);
|
|
886
|
+
redeployed = true;
|
|
841
887
|
} catch (error) {
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
888
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
889
|
+
const railError = message.includes("not found") || message.includes("ENOENT") ? "Railway CLI not found. Install it: npm i -g @railway/cli" : `Railway redeploy failed: ${message}`;
|
|
890
|
+
return {
|
|
891
|
+
status: "published",
|
|
892
|
+
registryUrl: result.registryUrl,
|
|
893
|
+
txHash: result.txHash,
|
|
894
|
+
built: result.built,
|
|
895
|
+
skipped: result.skipped,
|
|
896
|
+
redeployed: false,
|
|
897
|
+
service,
|
|
898
|
+
error: `Config published but ${railError}`
|
|
899
|
+
};
|
|
848
900
|
}
|
|
849
|
-
return {
|
|
850
|
-
status: "published",
|
|
851
|
-
registryUrl,
|
|
852
|
-
txHash,
|
|
853
|
-
built,
|
|
854
|
-
skipped
|
|
855
|
-
};
|
|
856
|
-
} catch (error) {
|
|
857
|
-
return {
|
|
858
|
-
status: "error",
|
|
859
|
-
registryUrl,
|
|
860
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
861
|
-
built,
|
|
862
|
-
skipped
|
|
863
|
-
};
|
|
864
901
|
}
|
|
902
|
+
return {
|
|
903
|
+
status: "deployed",
|
|
904
|
+
registryUrl: result.registryUrl,
|
|
905
|
+
txHash: result.txHash,
|
|
906
|
+
built: result.built,
|
|
907
|
+
skipped: result.skipped,
|
|
908
|
+
redeployed,
|
|
909
|
+
service
|
|
910
|
+
};
|
|
865
911
|
}),
|
|
866
912
|
keyPublish: builder.keyPublish.handler(async ({ input }) => {
|
|
867
913
|
if (!deps.bosConfig) return {
|
|
@@ -1214,6 +1260,100 @@ var plugin_default = (0, every_plugin.createPlugin)({
|
|
|
1214
1260
|
})
|
|
1215
1261
|
})
|
|
1216
1262
|
});
|
|
1263
|
+
async function publishToFastKv(input) {
|
|
1264
|
+
const { env, dryRun, configDir } = input;
|
|
1265
|
+
let bosConfig = input.bosConfig;
|
|
1266
|
+
const runtimeConfig = input.runtimeConfig;
|
|
1267
|
+
const isStaging = env === "staging";
|
|
1268
|
+
const account = bosConfig.account;
|
|
1269
|
+
const gateway = isStaging ? bosConfig.staging?.domain ?? bosConfig.domain : bosConfig.domain;
|
|
1270
|
+
if (!gateway) return {
|
|
1271
|
+
status: "error",
|
|
1272
|
+
registryUrl: "",
|
|
1273
|
+
error: "bos.config.json must define domain to publish"
|
|
1274
|
+
};
|
|
1275
|
+
const network = input.network ?? require_network.getNetworkIdForAccount(account);
|
|
1276
|
+
const registryUrl = require_fastkv.buildRegistryConfigUrlForNetwork(network, account, gateway);
|
|
1277
|
+
const targets = selectWorkspaceTargets(input.packages, bosConfig);
|
|
1278
|
+
let publishConfig = isStaging ? {
|
|
1279
|
+
...bosConfig,
|
|
1280
|
+
domain: gateway
|
|
1281
|
+
} : bosConfig;
|
|
1282
|
+
let built;
|
|
1283
|
+
let skipped;
|
|
1284
|
+
if (dryRun) return {
|
|
1285
|
+
status: "dry-run",
|
|
1286
|
+
registryUrl,
|
|
1287
|
+
built,
|
|
1288
|
+
skipped
|
|
1289
|
+
};
|
|
1290
|
+
if (input.build) {
|
|
1291
|
+
await generateCodeArtifacts(configDir, bosConfig, {
|
|
1292
|
+
env: "production",
|
|
1293
|
+
runtimeConfig: runtimeConfig ?? void 0
|
|
1294
|
+
});
|
|
1295
|
+
const result = await buildWorkspaceTargets({
|
|
1296
|
+
configDir,
|
|
1297
|
+
bosConfig,
|
|
1298
|
+
runtimeConfig,
|
|
1299
|
+
targets,
|
|
1300
|
+
deploy: true
|
|
1301
|
+
});
|
|
1302
|
+
built = result.built;
|
|
1303
|
+
skipped = result.skipped;
|
|
1304
|
+
const refreshed = await require_config.loadResolvedConfig({ cwd: configDir });
|
|
1305
|
+
if (refreshed?.config) {
|
|
1306
|
+
bosConfig = refreshed.config;
|
|
1307
|
+
publishConfig = isStaging ? {
|
|
1308
|
+
...refreshed.config,
|
|
1309
|
+
domain: gateway
|
|
1310
|
+
} : refreshed.config;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
const registryEntries = { [`apps/${account}/${gateway}/bos.config.json`]: JSON.stringify(publishConfig) };
|
|
1314
|
+
const payload = JSON.stringify(registryEntries);
|
|
1315
|
+
const argsBase64 = Buffer.from(payload).toString("base64");
|
|
1316
|
+
const privateKey = input.privateKey || node_process.default.env.NEAR_PRIVATE_KEY || node_process.default.env.BOS_NEAR_PRIVATE_KEY;
|
|
1317
|
+
try {
|
|
1318
|
+
await effect.Effect.runPromise(require_near_cli.ensureNearCli);
|
|
1319
|
+
let txHash;
|
|
1320
|
+
try {
|
|
1321
|
+
txHash = (await effect.Effect.runPromise(require_near_cli.executeTransaction({
|
|
1322
|
+
account,
|
|
1323
|
+
contract: require_fastkv.getRegistryNamespaceForNetwork(network),
|
|
1324
|
+
method: "__fastdata_kv",
|
|
1325
|
+
argsBase64,
|
|
1326
|
+
network,
|
|
1327
|
+
privateKey,
|
|
1328
|
+
gas: "300Tgas",
|
|
1329
|
+
deposit: "0NEAR"
|
|
1330
|
+
}))).txHash;
|
|
1331
|
+
} catch (error) {
|
|
1332
|
+
txHash = extractTransactionHash(error);
|
|
1333
|
+
if (!txHash) throw error;
|
|
1334
|
+
try {
|
|
1335
|
+
const verifiedConfig = await require_fastkv.fetchBosConfigFromFastKv(`bos://${account}/${gateway}`);
|
|
1336
|
+
if (JSON.stringify(verifiedConfig) !== JSON.stringify(publishConfig)) throw error;
|
|
1337
|
+
} catch {}
|
|
1338
|
+
}
|
|
1339
|
+
return {
|
|
1340
|
+
status: "published",
|
|
1341
|
+
registryUrl,
|
|
1342
|
+
txHash,
|
|
1343
|
+
built,
|
|
1344
|
+
skipped,
|
|
1345
|
+
publishConfig
|
|
1346
|
+
};
|
|
1347
|
+
} catch (error) {
|
|
1348
|
+
return {
|
|
1349
|
+
status: "error",
|
|
1350
|
+
registryUrl,
|
|
1351
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
1352
|
+
built,
|
|
1353
|
+
skipped
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1217
1357
|
function extractTransactionHash(error) {
|
|
1218
1358
|
return (error instanceof Error ? error.message : String(error)).match(/Transaction ID:\s*([A-Za-z0-9]+)/i)?.[1];
|
|
1219
1359
|
}
|