@nexum-hub/agent 0.0.3-next.11 → 0.0.3-next.13
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/README.md +6 -6
- package/contracts/v2/fixtures/wire.json +37 -288
- package/contracts/v2/wire/envelope.schema.json +0 -64
- package/contracts/v2/wire/events.schema.json +0 -20
- package/contracts/v2/wire/operations.schema.json +0 -66
- package/contracts/v2/wire/types.schema.json +1 -7
- package/dist/application/authority.d.ts +3 -13
- package/dist/application/authority.js +10 -62
- package/dist/application/authority.js.map +1 -1
- package/dist/application/connection.js +0 -2
- package/dist/application/connection.js.map +1 -1
- package/dist/application/maintenance.js +3 -4
- package/dist/application/maintenance.js.map +1 -1
- package/dist/application/runtime.d.ts +1 -7
- package/dist/application/runtime.js +15 -167
- package/dist/application/runtime.js.map +1 -1
- package/dist/contracts/wire-validation.d.ts +1 -3
- package/dist/contracts/wire-validation.js +1 -14
- package/dist/contracts/wire-validation.js.map +1 -1
- package/dist/contracts/wire.d.ts +2 -37
- package/dist/contracts/wire.js +0 -2
- package/dist/contracts/wire.js.map +1 -1
- package/package.json +1 -1
- package/scripts/npm-install.mjs +40 -14
- package/scripts/service.mjs +3 -0
package/scripts/npm-install.mjs
CHANGED
|
@@ -33,6 +33,22 @@ const npmBin = (root) =>
|
|
|
33
33
|
? "node_modules/npm/bin/npm-cli.js"
|
|
34
34
|
: "lib/node_modules/npm/bin/npm-cli.js",
|
|
35
35
|
);
|
|
36
|
+
// Mainland timezone IDs, not an ambiguous UTC+8 offset, select the China mirror.
|
|
37
|
+
export function npmRegistries(
|
|
38
|
+
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
39
|
+
) {
|
|
40
|
+
const mainland = [
|
|
41
|
+
"Asia/Shanghai",
|
|
42
|
+
"Asia/Chongqing",
|
|
43
|
+
"Asia/Harbin",
|
|
44
|
+
"Asia/Urumqi",
|
|
45
|
+
"PRC",
|
|
46
|
+
].includes(timeZone);
|
|
47
|
+
return [
|
|
48
|
+
...(mainland ? ["https://registry.npmmirror.com/"] : []),
|
|
49
|
+
"https://registry.npmjs.org/",
|
|
50
|
+
];
|
|
51
|
+
}
|
|
36
52
|
const fail = (condition, reason) => {
|
|
37
53
|
if (!condition) throw new Error(reason);
|
|
38
54
|
};
|
|
@@ -159,20 +175,30 @@ async function packageStage(stage, version, managedNode, source) {
|
|
|
159
175
|
const scratch = path.join(stage, ".resolve");
|
|
160
176
|
let from = source;
|
|
161
177
|
if (!from) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
const registries = npmRegistries();
|
|
179
|
+
for (const [index, registry] of registries.entries()) {
|
|
180
|
+
// Retry package resolution only; the Agent is activated after this stage.
|
|
181
|
+
await rm(scratch, { recursive: true, force: true });
|
|
182
|
+
await directory(scratch);
|
|
183
|
+
try {
|
|
184
|
+
exec(nodeBin(managedNode), [
|
|
185
|
+
npmBin(managedNode),
|
|
186
|
+
"install",
|
|
187
|
+
"--prefix",
|
|
188
|
+
scratch,
|
|
189
|
+
"--no-save",
|
|
190
|
+
"--no-package-lock",
|
|
191
|
+
"--omit=dev",
|
|
192
|
+
"--no-audit",
|
|
193
|
+
"--no-fund",
|
|
194
|
+
`--registry=${registry}`,
|
|
195
|
+
`@nexum-hub/agent@${version}`,
|
|
196
|
+
]);
|
|
197
|
+
break;
|
|
198
|
+
} catch (error) {
|
|
199
|
+
if (index === registries.length - 1) throw error;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
176
202
|
from = path.join(scratch, "node_modules", "@nexum-hub", "agent");
|
|
177
203
|
}
|
|
178
204
|
const manifest = JSON.parse(
|
package/scripts/service.mjs
CHANGED