everything-dev 1.44.1 → 1.46.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/build.cjs +328 -0
- package/dist/build.cjs.map +1 -0
- package/dist/build.mjs +320 -0
- package/dist/build.mjs.map +1 -0
- package/dist/cli/init.cjs +1 -1
- package/dist/cli/init.mjs +1 -1
- package/dist/cli/sync.cjs +7 -1
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +7 -1
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/upgrade.cjs +2 -2
- package/dist/cli/upgrade.mjs +2 -2
- package/dist/cli.cjs +36 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +36 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/code-artifacts.cjs +25 -0
- package/dist/code-artifacts.cjs.map +1 -0
- package/dist/code-artifacts.mjs +24 -0
- package/dist/code-artifacts.mjs.map +1 -0
- package/dist/contract.cjs +16 -2
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +83 -17
- package/dist/contract.d.cts.map +1 -1
- package/dist/contract.d.mts +83 -17
- package/dist/contract.d.mts.map +1 -1
- package/dist/contract.meta.cjs +2 -0
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +6 -0
- package/dist/contract.meta.d.mts +6 -0
- package/dist/contract.meta.mjs +2 -0
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +16 -3
- package/dist/contract.mjs.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/integrity.cjs +79 -0
- package/dist/integrity.cjs.map +1 -1
- package/dist/integrity.d.cts +17 -1
- package/dist/integrity.d.cts.map +1 -1
- package/dist/integrity.d.mts +17 -1
- package/dist/integrity.d.mts.map +1 -1
- package/dist/integrity.mjs +76 -1
- package/dist/integrity.mjs.map +1 -1
- package/dist/near-cli.cjs +12 -15
- package/dist/near-cli.cjs.map +1 -1
- package/dist/near-cli.mjs +12 -15
- package/dist/near-cli.mjs.map +1 -1
- package/dist/plugin.cjs +47 -347
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +34 -15
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +34 -15
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +32 -331
- package/dist/plugin.mjs.map +1 -1
- package/dist/publish.cjs +220 -0
- package/dist/publish.cjs.map +1 -0
- package/dist/publish.mjs +217 -0
- package/dist/publish.mjs.map +1 -0
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/dist/utils/run.cjs +21 -3
- package/dist/utils/run.cjs.map +1 -1
- package/dist/utils/run.mjs +21 -3
- package/dist/utils/run.mjs.map +1 -1
- package/dist/utils/string.cjs +9 -0
- package/dist/utils/string.cjs.map +1 -0
- package/dist/utils/string.mjs +8 -0
- package/dist/utils/string.mjs.map +1 -0
- package/package.json +1 -1
package/dist/plugin.d.mts
CHANGED
|
@@ -34,13 +34,6 @@ declare const pluginEvents: EventEmitter<[never]>;
|
|
|
34
34
|
declare function consumeDevSession(): (DevSessionData & {
|
|
35
35
|
summary?: StartSummary;
|
|
36
36
|
}) | null;
|
|
37
|
-
declare function waitForPublishedConfig(opts: {
|
|
38
|
-
account: string;
|
|
39
|
-
gateway: string;
|
|
40
|
-
publishConfig: BosConfigInput;
|
|
41
|
-
timeoutMs?: number;
|
|
42
|
-
intervalMs?: number;
|
|
43
|
-
}): Promise<void>;
|
|
44
37
|
declare function resolveRemoteConfigChain(accountId: string, gatewayId: string, visited: Set<string>): Promise<BosConfig>;
|
|
45
38
|
declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
46
39
|
dev: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
@@ -67,8 +60,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
67
60
|
interactive: z.ZodOptional<z.ZodBoolean>;
|
|
68
61
|
}, z.core.$strip>, z.ZodObject<{
|
|
69
62
|
status: z.ZodEnum<{
|
|
70
|
-
error: "error";
|
|
71
63
|
started: "started";
|
|
64
|
+
error: "error";
|
|
72
65
|
}>;
|
|
73
66
|
description: z.ZodString;
|
|
74
67
|
processes: z.ZodArray<z.ZodString>;
|
|
@@ -287,6 +280,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
287
280
|
publish: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
288
281
|
deploy: z.ZodDefault<z.ZodBoolean>;
|
|
289
282
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
283
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
290
284
|
packages: z.ZodDefault<z.ZodString>;
|
|
291
285
|
network: z.ZodOptional<z.ZodEnum<{
|
|
292
286
|
testnet: "testnet";
|
|
@@ -308,6 +302,18 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
308
302
|
error: z.ZodOptional<z.ZodString>;
|
|
309
303
|
built: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
310
304
|
skipped: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
305
|
+
deployResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
306
|
+
key: z.ZodString;
|
|
307
|
+
kind: z.ZodEnum<{
|
|
308
|
+
app: "app";
|
|
309
|
+
plugin: "plugin";
|
|
310
|
+
}>;
|
|
311
|
+
success: z.ZodBoolean;
|
|
312
|
+
url: z.ZodOptional<z.ZodString>;
|
|
313
|
+
error: z.ZodOptional<z.ZodString>;
|
|
314
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
315
|
+
retried: z.ZodOptional<z.ZodBoolean>;
|
|
316
|
+
}, z.core.$strip>>>;
|
|
311
317
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
312
318
|
deploy: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
313
319
|
env: z.ZodDefault<z.ZodEnum<{
|
|
@@ -316,6 +322,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
316
322
|
}>>;
|
|
317
323
|
build: z.ZodDefault<z.ZodBoolean>;
|
|
318
324
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
325
|
+
verbose: z.ZodDefault<z.ZodBoolean>;
|
|
319
326
|
packages: z.ZodDefault<z.ZodString>;
|
|
320
327
|
network: z.ZodOptional<z.ZodEnum<{
|
|
321
328
|
testnet: "testnet";
|
|
@@ -337,6 +344,18 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
337
344
|
redeployed: z.ZodBoolean;
|
|
338
345
|
service: z.ZodOptional<z.ZodString>;
|
|
339
346
|
error: z.ZodOptional<z.ZodString>;
|
|
347
|
+
deployResults: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
348
|
+
key: z.ZodString;
|
|
349
|
+
kind: z.ZodEnum<{
|
|
350
|
+
app: "app";
|
|
351
|
+
plugin: "plugin";
|
|
352
|
+
}>;
|
|
353
|
+
success: z.ZodBoolean;
|
|
354
|
+
url: z.ZodOptional<z.ZodString>;
|
|
355
|
+
error: z.ZodOptional<z.ZodString>;
|
|
356
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
357
|
+
retried: z.ZodOptional<z.ZodBoolean>;
|
|
358
|
+
}, z.core.$strip>>>;
|
|
340
359
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
341
360
|
keyPublish: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
342
361
|
allowance: z.ZodDefault<z.ZodString>;
|
|
@@ -365,10 +384,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
365
384
|
source: z.ZodOptional<z.ZodString>;
|
|
366
385
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
367
386
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
368
|
-
plugins: "plugins";
|
|
369
|
-
ui: "ui";
|
|
370
387
|
host: "host";
|
|
388
|
+
ui: "ui";
|
|
371
389
|
api: "api";
|
|
390
|
+
plugins: "plugins";
|
|
372
391
|
}>>>;
|
|
373
392
|
noInteractive: z.ZodDefault<z.ZodBoolean>;
|
|
374
393
|
noInstall: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -384,10 +403,10 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
384
403
|
extends: z.ZodString;
|
|
385
404
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
386
405
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
387
|
-
plugins: "plugins";
|
|
388
|
-
ui: "ui";
|
|
389
406
|
host: "host";
|
|
407
|
+
ui: "ui";
|
|
390
408
|
api: "api";
|
|
409
|
+
plugins: "plugins";
|
|
391
410
|
}>>>;
|
|
392
411
|
filesCopied: z.ZodNumber;
|
|
393
412
|
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -471,8 +490,8 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
471
490
|
}, z.core.$strip>, _$_orpc_contract0.MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
472
491
|
typesGen: _$_orpc_contract0.ContractProcedure<z.ZodObject<{
|
|
473
492
|
env: z.ZodOptional<z.ZodEnum<{
|
|
474
|
-
development: "development";
|
|
475
493
|
production: "production";
|
|
494
|
+
development: "development";
|
|
476
495
|
}>>;
|
|
477
496
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
478
497
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -621,7 +640,7 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
621
640
|
}> | undefined;
|
|
622
641
|
} | null;
|
|
623
642
|
runtimeConfig: {
|
|
624
|
-
env: "
|
|
643
|
+
env: "production" | "staging" | "development";
|
|
625
644
|
account: string;
|
|
626
645
|
networkId: "testnet" | "mainnet";
|
|
627
646
|
host: {
|
|
@@ -726,5 +745,5 @@ declare const _default: _$every_plugin0.LoadedPluginWithBinding<{
|
|
|
726
745
|
configDir: string;
|
|
727
746
|
}>;
|
|
728
747
|
//#endregion
|
|
729
|
-
export { DevSessionData, ProgressEvent, StartSummary, consumeDevSession, _default as default, pluginEvents, resolveRemoteConfigChain
|
|
748
|
+
export { DevSessionData, ProgressEvent, StartSummary, consumeDevSession, _default as default, pluginEvents, resolveRemoteConfigChain };
|
|
730
749
|
//# sourceMappingURL=plugin.d.mts.map
|
package/dist/plugin.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.ts"],"mappings":";;;;;;;;UAuFiB,cAAA;EACf,YAAA,EAAc,eAAA;EACd,QAAA,EAAU,GAAA,SAAY,iBAAA;EACtB,aAAA,EAAe,aAAA;AAAA;AAAA,UAGA,YAAA;EACf,YAAA;EACA,gBAAA;EACA,OAAA;EACA,MAAA;EACA,OAAA;IAAW,IAAA;IAAe,EAAA;IAAa,GAAA;IAAc,IAAA;EAAA;EACrD,QAAA;AAAA;AAAA,KAGU,aAAA;EACV,KAAA;EACA,MAAA;EACA,UAAA;EACA,OAAA;AAAA;AAAA,cAGW,YAAA,EAAY,YAAA;AAAA,iBAKT,iBAAA,CAAA,IAAsB,cAAA;EAAmB,OAAA,GAAU,YAAA;AAAA;AAAA,iBA2I7C,wBAAA,CACpB,SAAA,UACA,SAAA,UACA,OAAA,EAAS,GAAA,WACR,OAAA,CAAQ,SAAA;AAAA,cA4BV,QAAA"}
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { buildRegistryConfigUrl,
|
|
1
|
+
import { buildRegistryConfigUrl, fetchBosConfigFromFastKv, fetchRemotePluginManifest, getRegistryNamespaceForAccount, parseBosUrl } from "./fastkv.mjs";
|
|
2
2
|
import { mergeBosConfigWithExtends, resolveExtendsRef } from "./merge.mjs";
|
|
3
3
|
import { getNetworkIdForAccount } from "./network.mjs";
|
|
4
4
|
import { BosConfigSchema } from "./types.mjs";
|
|
5
|
-
import { buildRuntimePluginsForConfig, drainConfigWarnings, findConfigPath, getHostDevelopmentPort, getProjectRoot, loadLocalConfig, loadResolvedConfig, resolveConfigComposableEntries,
|
|
5
|
+
import { buildRuntimePluginsForConfig, drainConfigWarnings, findConfigPath, getHostDevelopmentPort, getProjectRoot, loadLocalConfig, loadResolvedConfig, resolveConfigComposableEntries, resumeWarnings, suppressWarnings } from "./config.mjs";
|
|
6
6
|
import { createPlugin, z } from "./sdk.mjs";
|
|
7
7
|
import { bosContract } from "./contract.mjs";
|
|
8
|
-
import { computeSriHashForUrl } from "./integrity.mjs";
|
|
9
|
-
import { syncApiContractBridge } from "./api-contract.mjs";
|
|
8
|
+
import { computeSriHashForUrl, parseDeployLines } from "./integrity.mjs";
|
|
10
9
|
import { buildRuntimeConfig, detectLocalPackages, prepareDevelopmentRuntimeConfig } from "./app.mjs";
|
|
10
|
+
import { syncResolvedSharedDeps } from "./shared-deps.mjs";
|
|
11
|
+
import { run } from "./utils/run.mjs";
|
|
12
|
+
import { colors } from "./utils/theme.mjs";
|
|
13
|
+
import { buildEveryPluginQuietly, buildEverythingDevQuietly, buildWorkspaceTargets, fileExists, getPluginRef, readJsonFile, selectWorkspaceTargets } from "./build.mjs";
|
|
11
14
|
import { ensureEnvFile, loadProjectEnv, syncGeneratedInfra, writeGeneratedInfra } from "./cli/infra.mjs";
|
|
12
15
|
import { saveBosConfig } from "./utils/save-config.mjs";
|
|
13
16
|
import { buildInitPatterns, copyFilteredFiles, detectGitRemoteUrl, fetchParentConfig, generateDatabaseMigrations, personalizeAgentsMd, personalizeConfig, removeInitLockfile, resolveSourceDir, runBunInstall, runTypesGen, scaffoldMinimalProject, stripOrphanedWorkspacesFromLockfile, writeInitSnapshot } from "./cli/init.mjs";
|
|
14
17
|
import { getStatus } from "./cli/status.mjs";
|
|
15
|
-
import { syncResolvedSharedDeps } from "./shared-deps.mjs";
|
|
16
18
|
import { syncTemplate } from "./cli/sync.mjs";
|
|
17
19
|
import { upgradeTemplate } from "./cli/upgrade.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { addFunctionCallAccessKey, ensureNearCli
|
|
20
|
+
import { generateCodeArtifacts } from "./code-artifacts.mjs";
|
|
21
|
+
import { addFunctionCallAccessKey, ensureNearCli } from "./near-cli.mjs";
|
|
22
|
+
import { extractPublishedUrl, publishToFastKv } from "./publish.mjs";
|
|
20
23
|
import { buildDescription, buildServiceDescriptorMap } from "./service-descriptor.mjs";
|
|
21
|
-
import { run } from "./utils/run.mjs";
|
|
22
24
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
23
25
|
import { basename, dirname, join, resolve } from "node:path";
|
|
24
26
|
import { Effect } from "effect";
|
|
25
27
|
import { EventEmitter } from "node:events";
|
|
26
|
-
import { access, readFile } from "node:fs/promises";
|
|
27
28
|
import process from "node:process";
|
|
28
29
|
|
|
29
30
|
//#region src/plugin.ts
|
|
@@ -68,25 +69,7 @@ async function timePhase(timings, name, fn) {
|
|
|
68
69
|
throw error;
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
|
-
const buildCommands = {
|
|
72
|
-
host: {
|
|
73
|
-
cmd: "bun",
|
|
74
|
-
args: ["run", "build"]
|
|
75
|
-
},
|
|
76
|
-
ui: {
|
|
77
|
-
cmd: "bun",
|
|
78
|
-
args: ["run", "build"]
|
|
79
|
-
},
|
|
80
|
-
api: {
|
|
81
|
-
cmd: "bun",
|
|
82
|
-
args: ["run", "build"]
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
72
|
const PUBLISH_FUNCTION_NAMES = ["__fastdata_kv"];
|
|
86
|
-
function getPluginRef(entry) {
|
|
87
|
-
if (!entry || typeof entry === "string") return null;
|
|
88
|
-
return entry;
|
|
89
|
-
}
|
|
90
73
|
function parseSourceMode(value, defaultValue) {
|
|
91
74
|
if (value === "local" || value === "remote") return value;
|
|
92
75
|
return defaultValue;
|
|
@@ -101,40 +84,6 @@ function buildConfigResult(bosConfig, full = false) {
|
|
|
101
84
|
full
|
|
102
85
|
};
|
|
103
86
|
}
|
|
104
|
-
async function fileExists(path) {
|
|
105
|
-
try {
|
|
106
|
-
await access(path);
|
|
107
|
-
return true;
|
|
108
|
-
} catch {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
async function readJsonFile(path) {
|
|
113
|
-
return JSON.parse(await readFile(path, "utf8"));
|
|
114
|
-
}
|
|
115
|
-
function resolveWorkspaceTarget(key, bosConfig, runtimeConfig, configDir) {
|
|
116
|
-
if (bosConfig?.app && key in bosConfig.app) {
|
|
117
|
-
const appEntry = bosConfig.app[key];
|
|
118
|
-
const devPath = resolveLocalDevelopmentPath(appEntry?.development, configDir);
|
|
119
|
-
if (devPath) return {
|
|
120
|
-
key,
|
|
121
|
-
kind: "app",
|
|
122
|
-
path: devPath
|
|
123
|
-
};
|
|
124
|
-
return {
|
|
125
|
-
key,
|
|
126
|
-
kind: "app",
|
|
127
|
-
path: `${configDir}/${key}`
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const pluginPath = (runtimeConfig?.plugins?.[key])?.localPath ?? resolveLocalDevelopmentPath(getPluginRef(bosConfig?.plugins?.[key])?.development, configDir);
|
|
131
|
-
if (pluginPath) return {
|
|
132
|
-
key,
|
|
133
|
-
kind: "plugin",
|
|
134
|
-
path: pluginPath
|
|
135
|
-
};
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
87
|
function isValidProxyUrl(url) {
|
|
139
88
|
try {
|
|
140
89
|
const parsed = new URL(url);
|
|
@@ -185,88 +134,6 @@ function listPluginAttachments(config) {
|
|
|
185
134
|
};
|
|
186
135
|
}).sort((a, b) => a.key.localeCompare(b.key));
|
|
187
136
|
}
|
|
188
|
-
async function generateCodeArtifacts(configDir, config, opts) {
|
|
189
|
-
if (opts?.env) writeResolvedConfig(configDir, config, opts.env, opts.extendsChain);
|
|
190
|
-
const runtimeConfig = opts?.runtimeConfig ?? (await loadResolvedConfig({ cwd: configDir }))?.runtime;
|
|
191
|
-
if (!runtimeConfig) return null;
|
|
192
|
-
const bridge = await syncApiContractBridge({
|
|
193
|
-
configDir,
|
|
194
|
-
runtimeConfig,
|
|
195
|
-
apiBaseUrl: runtimeConfig.api.url
|
|
196
|
-
});
|
|
197
|
-
return {
|
|
198
|
-
resolvedConfigPath: opts?.env ? join(configDir, ".bos/bos.resolved-config.json") : void 0,
|
|
199
|
-
contractBridgePath: bridge.bridgePath,
|
|
200
|
-
contractStatus: bridge.status
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
function extractPublishedUrl(output) {
|
|
204
|
-
const match = output.match(/https?:\/\/[^\s"'<>]+/g);
|
|
205
|
-
if (!match || match.length === 0) return null;
|
|
206
|
-
return match[match.length - 1] ?? null;
|
|
207
|
-
}
|
|
208
|
-
function sleep(ms) {
|
|
209
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
210
|
-
}
|
|
211
|
-
async function waitForPublishedConfig(opts) {
|
|
212
|
-
const envTimeoutMs = Number(process.env.BOS_PUBLISH_CONFIRMATION_TIMEOUT_MS);
|
|
213
|
-
const envIntervalMs = Number(process.env.BOS_PUBLISH_CONFIRMATION_INTERVAL_MS);
|
|
214
|
-
const timeoutMs = opts.timeoutMs ?? (Number.isFinite(envTimeoutMs) ? envTimeoutMs : void 0) ?? 12e4;
|
|
215
|
-
const intervalMs = opts.intervalMs ?? (Number.isFinite(envIntervalMs) ? envIntervalMs : void 0) ?? 3e3;
|
|
216
|
-
const startedAt = Date.now();
|
|
217
|
-
let lastError;
|
|
218
|
-
while (Date.now() - startedAt < timeoutMs) {
|
|
219
|
-
try {
|
|
220
|
-
const verifiedConfig = await fetchBosConfigFromFastKv(`bos://${opts.account}/${opts.gateway}`);
|
|
221
|
-
if (JSON.stringify(verifiedConfig) === JSON.stringify(opts.publishConfig)) return;
|
|
222
|
-
} catch (error) {
|
|
223
|
-
lastError = error;
|
|
224
|
-
}
|
|
225
|
-
await sleep(intervalMs);
|
|
226
|
-
}
|
|
227
|
-
const reason = lastError instanceof Error ? ` Last error: ${lastError.message}` : "";
|
|
228
|
-
throw new Error(`Timed out waiting for publish confirmation at bos://${opts.account}/${opts.gateway}.${reason}`);
|
|
229
|
-
}
|
|
230
|
-
async function buildEveryPluginQuietly(cwd) {
|
|
231
|
-
if (!await fileExists(`${`${cwd}/packages/every-plugin`}/package.json`)) return;
|
|
232
|
-
if (await fileExists(`${cwd}/packages/every-plugin/dist/build/rspack/plugin.mjs`)) return;
|
|
233
|
-
const result = await run("bun", [
|
|
234
|
-
"run",
|
|
235
|
-
"--cwd",
|
|
236
|
-
"packages/every-plugin",
|
|
237
|
-
"build"
|
|
238
|
-
], {
|
|
239
|
-
cwd,
|
|
240
|
-
capture: true
|
|
241
|
-
});
|
|
242
|
-
if (result.exitCode === 0) {
|
|
243
|
-
console.log("[build:ssr] build succeeded");
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
if (result.stdout.trim()) process.stdout.write(result.stdout);
|
|
247
|
-
if (result.stderr.trim()) process.stderr.write(result.stderr);
|
|
248
|
-
throw new Error(`bun run --cwd packages/every-plugin build failed with exit code ${result.exitCode}`);
|
|
249
|
-
}
|
|
250
|
-
async function buildEverythingDevQuietly(cwd) {
|
|
251
|
-
if (!await fileExists(`${`${cwd}/packages/everything-dev`}/package.json`)) return;
|
|
252
|
-
if (await fileExists(`${cwd}/packages/everything-dev/dist/index.mjs`)) return;
|
|
253
|
-
const result = await run("bun", [
|
|
254
|
-
"run",
|
|
255
|
-
"--cwd",
|
|
256
|
-
"packages/everything-dev",
|
|
257
|
-
"build"
|
|
258
|
-
], {
|
|
259
|
-
cwd,
|
|
260
|
-
capture: true
|
|
261
|
-
});
|
|
262
|
-
if (result.exitCode === 0) {
|
|
263
|
-
console.log("[everything-dev] build succeeded");
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
if (result.stdout.trim()) process.stdout.write(result.stdout);
|
|
267
|
-
if (result.stderr.trim()) process.stderr.write(result.stderr);
|
|
268
|
-
throw new Error(`bun run --cwd packages/everything-dev build failed with exit code ${result.exitCode}`);
|
|
269
|
-
}
|
|
270
137
|
async function resolveRemoteConfigChain(accountId, gatewayId, visited) {
|
|
271
138
|
const selfRef = `bos://${accountId}/${gatewayId}`;
|
|
272
139
|
if (visited.has(selfRef)) throw new Error(`Circular extends detected: ${selfRef}`);
|
|
@@ -290,69 +157,6 @@ async function fetchPublishedConfig(accountId, gatewayId) {
|
|
|
290
157
|
throw error;
|
|
291
158
|
}
|
|
292
159
|
}
|
|
293
|
-
function selectWorkspaceTargets(packages, bosConfig) {
|
|
294
|
-
const allPackages = [...Object.keys(bosConfig?.app ?? {}), ...Object.keys(bosConfig?.plugins ?? {})];
|
|
295
|
-
if (packages === "all") return allPackages;
|
|
296
|
-
return packages.split(",").map((pkg) => pkg.trim()).filter((pkg) => allPackages.includes(pkg));
|
|
297
|
-
}
|
|
298
|
-
async function buildWorkspaceTargets(opts) {
|
|
299
|
-
const existing = [];
|
|
300
|
-
const skipped = [];
|
|
301
|
-
for (const target of opts.targets) {
|
|
302
|
-
const resolved = resolveWorkspaceTarget(target, opts.bosConfig, opts.runtimeConfig, opts.configDir);
|
|
303
|
-
if (!resolved) {
|
|
304
|
-
skipped.push(target);
|
|
305
|
-
continue;
|
|
306
|
-
}
|
|
307
|
-
if (await fileExists(`${resolved.path}/package.json`)) existing.push(resolved);
|
|
308
|
-
else skipped.push(target);
|
|
309
|
-
}
|
|
310
|
-
if (existing.length === 0) return {
|
|
311
|
-
built: [],
|
|
312
|
-
skipped
|
|
313
|
-
};
|
|
314
|
-
if ((await syncResolvedSharedDeps({
|
|
315
|
-
configDir: opts.configDir,
|
|
316
|
-
hostMode: "local",
|
|
317
|
-
bosConfig: opts.bosConfig ?? void 0,
|
|
318
|
-
extendsChain: []
|
|
319
|
-
})).catalogChanged) await run("bun", ["install"], { cwd: opts.configDir });
|
|
320
|
-
const shouldBuildPlugin = existing.some((entry) => entry.key === "api");
|
|
321
|
-
const buildTasks = [buildEverythingDevQuietly(opts.configDir)];
|
|
322
|
-
if (shouldBuildPlugin) buildTasks.push(buildEveryPluginQuietly(opts.configDir));
|
|
323
|
-
await Promise.all(buildTasks);
|
|
324
|
-
const env = {
|
|
325
|
-
...process.env,
|
|
326
|
-
NODE_ENV: opts.deploy ? "production" : "development"
|
|
327
|
-
};
|
|
328
|
-
if (opts.deploy) env.DEPLOY = "true";
|
|
329
|
-
else delete env.DEPLOY;
|
|
330
|
-
const orderedExisting = opts.deploy ? [
|
|
331
|
-
...existing.filter((entry) => entry.kind === "app" && entry.key !== "host"),
|
|
332
|
-
...existing.filter((entry) => entry.kind === "plugin"),
|
|
333
|
-
...existing.filter((entry) => entry.kind === "app" && entry.key === "host")
|
|
334
|
-
] : existing;
|
|
335
|
-
const built = [];
|
|
336
|
-
for (const resolved of orderedExisting) {
|
|
337
|
-
const pkgJson = await readJsonFile(`${resolved.path}/package.json`);
|
|
338
|
-
const buildConfig = opts.deploy && pkgJson.scripts?.deploy ? {
|
|
339
|
-
cmd: "bun",
|
|
340
|
-
args: ["run", "deploy"]
|
|
341
|
-
} : buildCommands[resolved.key] ?? {
|
|
342
|
-
cmd: "bun",
|
|
343
|
-
args: ["run", "build"]
|
|
344
|
-
};
|
|
345
|
-
await run(buildConfig.cmd, buildConfig.args, {
|
|
346
|
-
cwd: resolved.path,
|
|
347
|
-
env
|
|
348
|
-
});
|
|
349
|
-
built.push(resolved.key);
|
|
350
|
-
}
|
|
351
|
-
return {
|
|
352
|
-
built,
|
|
353
|
-
skipped
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
160
|
var plugin_default = createPlugin({
|
|
357
161
|
variables: z.object({ configPath: z.string().optional() }),
|
|
358
162
|
secrets: z.object({}),
|
|
@@ -485,14 +289,23 @@ var plugin_default = createPlugin({
|
|
|
485
289
|
}
|
|
486
290
|
if (stdout.trim()) process.stdout.write(stdout);
|
|
487
291
|
if (stderr.trim()) process.stderr.write(stderr);
|
|
488
|
-
|
|
292
|
+
const output = `${stdout}\n${stderr}`;
|
|
293
|
+
const deployEntry = parseDeployLines(output).find((e) => e.urlField === `plugins.${input.key}.production`);
|
|
294
|
+
let publishedUrl;
|
|
295
|
+
let integrity;
|
|
296
|
+
if (deployEntry) {
|
|
297
|
+
publishedUrl = deployEntry.url;
|
|
298
|
+
integrity = deployEntry.integrity;
|
|
299
|
+
} else {
|
|
300
|
+
publishedUrl = extractPublishedUrl(output) ?? void 0;
|
|
301
|
+
integrity = publishedUrl ? await computeSriHashForUrl(publishedUrl) ?? void 0 : void 0;
|
|
302
|
+
}
|
|
489
303
|
let manifest = null;
|
|
490
304
|
if (publishedUrl) manifest = await fetchRemotePluginManifest(publishedUrl);
|
|
491
305
|
else if (attachmentRef?.production) {
|
|
492
306
|
manifest = await fetchRemotePluginManifest(attachmentRef.production);
|
|
493
307
|
if (manifest) publishedUrl = attachmentRef.production;
|
|
494
308
|
}
|
|
495
|
-
const integrity = publishedUrl ? await computeSriHashForUrl(publishedUrl) : null;
|
|
496
309
|
const version = manifest?.plugin.version ?? pkgJson.version;
|
|
497
310
|
if (publishedUrl) {
|
|
498
311
|
const rootConfigPath = join(deps.configDir, "bos.config.json");
|
|
@@ -822,6 +635,7 @@ var plugin_default = createPlugin({
|
|
|
822
635
|
env: input.env,
|
|
823
636
|
build: input.deploy,
|
|
824
637
|
dryRun: input.dryRun,
|
|
638
|
+
verbose: input.verbose,
|
|
825
639
|
packages: input.packages,
|
|
826
640
|
network: input.network,
|
|
827
641
|
privateKey: input.privateKey
|
|
@@ -839,7 +653,8 @@ var plugin_default = createPlugin({
|
|
|
839
653
|
txHash: result.txHash,
|
|
840
654
|
error: result.error,
|
|
841
655
|
built: result.built,
|
|
842
|
-
skipped: result.skipped
|
|
656
|
+
skipped: result.skipped,
|
|
657
|
+
deployResults: result.deployResults
|
|
843
658
|
};
|
|
844
659
|
}),
|
|
845
660
|
deploy: builder.deploy.handler(async ({ input }) => {
|
|
@@ -856,6 +671,7 @@ var plugin_default = createPlugin({
|
|
|
856
671
|
env: input.env,
|
|
857
672
|
build: input.build,
|
|
858
673
|
dryRun: input.dryRun,
|
|
674
|
+
verbose: input.verbose,
|
|
859
675
|
packages: input.packages,
|
|
860
676
|
network: input.network,
|
|
861
677
|
privateKey: input.privateKey
|
|
@@ -867,7 +683,8 @@ var plugin_default = createPlugin({
|
|
|
867
683
|
built: result.built,
|
|
868
684
|
skipped: result.skipped,
|
|
869
685
|
redeployed: false,
|
|
870
|
-
error: result.error
|
|
686
|
+
error: result.error,
|
|
687
|
+
deployResults: result.deployResults
|
|
871
688
|
};
|
|
872
689
|
if (result.status === "dry-run") return {
|
|
873
690
|
status: "dry-run",
|
|
@@ -897,6 +714,7 @@ var plugin_default = createPlugin({
|
|
|
897
714
|
built: result.built,
|
|
898
715
|
skipped: result.skipped,
|
|
899
716
|
redeployed: false,
|
|
717
|
+
deployResults: result.deployResults,
|
|
900
718
|
error: "Config published but Railway redeploy failed: ci.railway.service is not configured in bos.config.json"
|
|
901
719
|
};
|
|
902
720
|
}
|
|
@@ -927,6 +745,7 @@ var plugin_default = createPlugin({
|
|
|
927
745
|
skipped: result.skipped,
|
|
928
746
|
redeployed: false,
|
|
929
747
|
service,
|
|
748
|
+
deployResults: result.deployResults,
|
|
930
749
|
error: `Config published but ${railError}`
|
|
931
750
|
};
|
|
932
751
|
}
|
|
@@ -941,7 +760,8 @@ var plugin_default = createPlugin({
|
|
|
941
760
|
built: result.built,
|
|
942
761
|
skipped: result.skipped,
|
|
943
762
|
redeployed,
|
|
944
|
-
service
|
|
763
|
+
service,
|
|
764
|
+
deployResults: result.deployResults
|
|
945
765
|
};
|
|
946
766
|
}),
|
|
947
767
|
keyPublish: builder.keyPublish.handler(async ({ input }) => {
|
|
@@ -1357,125 +1177,6 @@ var plugin_default = createPlugin({
|
|
|
1357
1177
|
})
|
|
1358
1178
|
})
|
|
1359
1179
|
});
|
|
1360
|
-
async function publishToFastKv(input) {
|
|
1361
|
-
const { env, dryRun, configDir } = input;
|
|
1362
|
-
let bosConfig = input.bosConfig;
|
|
1363
|
-
const runtimeConfig = input.runtimeConfig;
|
|
1364
|
-
const isStaging = env === "staging";
|
|
1365
|
-
const account = bosConfig.account;
|
|
1366
|
-
const gateway = isStaging ? bosConfig.staging?.domain ?? bosConfig.domain : bosConfig.domain;
|
|
1367
|
-
if (!gateway) return {
|
|
1368
|
-
status: "error",
|
|
1369
|
-
registryUrl: "",
|
|
1370
|
-
error: "bos.config.json must define domain to publish"
|
|
1371
|
-
};
|
|
1372
|
-
const network = input.network ?? getNetworkIdForAccount(account);
|
|
1373
|
-
const registryUrl = buildRegistryConfigUrlForNetwork(network, account, gateway);
|
|
1374
|
-
const targets = selectWorkspaceTargets(input.packages, bosConfig);
|
|
1375
|
-
let built;
|
|
1376
|
-
let skipped;
|
|
1377
|
-
if (dryRun) return {
|
|
1378
|
-
status: "dry-run",
|
|
1379
|
-
registryUrl,
|
|
1380
|
-
built,
|
|
1381
|
-
skipped
|
|
1382
|
-
};
|
|
1383
|
-
if (input.build) {
|
|
1384
|
-
await generateCodeArtifacts(configDir, bosConfig, {
|
|
1385
|
-
env: "production",
|
|
1386
|
-
runtimeConfig: runtimeConfig ?? void 0
|
|
1387
|
-
});
|
|
1388
|
-
const result = await buildWorkspaceTargets({
|
|
1389
|
-
configDir,
|
|
1390
|
-
bosConfig,
|
|
1391
|
-
runtimeConfig,
|
|
1392
|
-
targets,
|
|
1393
|
-
deploy: true
|
|
1394
|
-
});
|
|
1395
|
-
built = result.built;
|
|
1396
|
-
skipped = result.skipped;
|
|
1397
|
-
const refreshed = await loadResolvedConfig({ cwd: configDir });
|
|
1398
|
-
if (!refreshed?.config) return {
|
|
1399
|
-
status: "error",
|
|
1400
|
-
registryUrl,
|
|
1401
|
-
built,
|
|
1402
|
-
skipped,
|
|
1403
|
-
error: "Failed to reload bos.config.json after build"
|
|
1404
|
-
};
|
|
1405
|
-
bosConfig = refreshed.config;
|
|
1406
|
-
}
|
|
1407
|
-
const rawConfigPath = join(configDir, "bos.config.json");
|
|
1408
|
-
const rawConfig = JSON.parse(readFileSync(rawConfigPath, "utf-8"));
|
|
1409
|
-
const publishPayload = isStaging ? {
|
|
1410
|
-
...rawConfig,
|
|
1411
|
-
domain: gateway
|
|
1412
|
-
} : rawConfig;
|
|
1413
|
-
const registryEntries = { [`apps/${account}/${gateway}/bos.config.json`]: JSON.stringify(publishPayload) };
|
|
1414
|
-
const payload = JSON.stringify(registryEntries);
|
|
1415
|
-
const argsBase64 = Buffer.from(payload).toString("base64");
|
|
1416
|
-
const privateKey = input.privateKey || process.env.NEAR_PRIVATE_KEY || process.env.BOS_NEAR_PRIVATE_KEY;
|
|
1417
|
-
let signingMode;
|
|
1418
|
-
try {
|
|
1419
|
-
signingMode = resolveNearSigningMode(privateKey);
|
|
1420
|
-
} catch (error) {
|
|
1421
|
-
return {
|
|
1422
|
-
status: "error",
|
|
1423
|
-
registryUrl,
|
|
1424
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
1425
|
-
};
|
|
1426
|
-
}
|
|
1427
|
-
console.log();
|
|
1428
|
-
console.log(" Publishing to:");
|
|
1429
|
-
console.log(` ${colors.cyan(registryUrl)}`);
|
|
1430
|
-
try {
|
|
1431
|
-
console.log(" Ensuring NEAR CLI...");
|
|
1432
|
-
await Effect.runPromise(ensureNearCli);
|
|
1433
|
-
console.log(" NEAR CLI ready");
|
|
1434
|
-
let txHash;
|
|
1435
|
-
console.log(` Submitting transaction on ${network}...`);
|
|
1436
|
-
try {
|
|
1437
|
-
txHash = (await Effect.runPromise(executeTransaction({
|
|
1438
|
-
account,
|
|
1439
|
-
contract: getRegistryNamespaceForNetwork(network),
|
|
1440
|
-
method: "__fastdata_kv",
|
|
1441
|
-
argsBase64,
|
|
1442
|
-
network,
|
|
1443
|
-
privateKey: signingMode._tag === "privateKey" ? signingMode.privateKey : void 0,
|
|
1444
|
-
gas: "300Tgas",
|
|
1445
|
-
deposit: "0NEAR"
|
|
1446
|
-
}, signingMode))).txHash;
|
|
1447
|
-
if (txHash) console.log(` Transaction submitted: ${colors.dim(txHash)}`);
|
|
1448
|
-
} catch (error) {
|
|
1449
|
-
txHash = extractTransactionHash(error);
|
|
1450
|
-
if (!txHash) throw error;
|
|
1451
|
-
}
|
|
1452
|
-
console.log(" Waiting for publish confirmation...");
|
|
1453
|
-
await waitForPublishedConfig({
|
|
1454
|
-
account,
|
|
1455
|
-
gateway,
|
|
1456
|
-
publishConfig: publishPayload
|
|
1457
|
-
});
|
|
1458
|
-
return {
|
|
1459
|
-
status: "published",
|
|
1460
|
-
registryUrl,
|
|
1461
|
-
txHash,
|
|
1462
|
-
built,
|
|
1463
|
-
skipped,
|
|
1464
|
-
publishConfig: publishPayload
|
|
1465
|
-
};
|
|
1466
|
-
} catch (error) {
|
|
1467
|
-
return {
|
|
1468
|
-
status: "error",
|
|
1469
|
-
registryUrl,
|
|
1470
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
1471
|
-
built,
|
|
1472
|
-
skipped
|
|
1473
|
-
};
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
function extractTransactionHash(error) {
|
|
1477
|
-
return (error instanceof Error ? error.message : String(error)).match(/Transaction ID:\s*([A-Za-z0-9]+)/i)?.[1];
|
|
1478
|
-
}
|
|
1479
1180
|
function computeAllowedWorkspaces(overrides, plugins) {
|
|
1480
1181
|
const workspaces = [];
|
|
1481
1182
|
for (const section of overrides) {
|
|
@@ -1488,5 +1189,5 @@ function computeAllowedWorkspaces(overrides, plugins) {
|
|
|
1488
1189
|
}
|
|
1489
1190
|
|
|
1490
1191
|
//#endregion
|
|
1491
|
-
export { consumeDevSession, plugin_default as default, pluginEvents, resolveRemoteConfigChain
|
|
1192
|
+
export { consumeDevSession, plugin_default as default, pluginEvents, resolveRemoteConfigChain };
|
|
1492
1193
|
//# sourceMappingURL=plugin.mjs.map
|