@talgent/computer 0.2.1 → 0.2.3

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/computer.mjs +14 -7
  2. package/package.json +2 -2
package/dist/computer.mjs CHANGED
@@ -3759,10 +3759,16 @@ var wrapper_default = import_websocket.default;
3759
3759
  // src/backoff.ts
3760
3760
  var BACKOFF_BASE_MS = 1e3;
3761
3761
  var BACKOFF_MAX_MS = 3e4;
3762
- function backoffDelayMs(attempt, random = Math.random) {
3763
- const window = Math.min(BACKOFF_MAX_MS, BACKOFF_BASE_MS * 2 ** Math.max(0, attempt));
3762
+ var RECONNECT_BASE_ENV = "TALGENT_COMPUTER_RECONNECT_BASE_MS";
3763
+ function backoffDelayMs(attempt, random = Math.random, baseMs = BACKOFF_BASE_MS) {
3764
+ const window = Math.min(BACKOFF_MAX_MS, baseMs * 2 ** Math.max(0, attempt));
3764
3765
  return Math.round(window / 2 + random() * (window / 2));
3765
3766
  }
3767
+ function reconnectBackoff(env) {
3768
+ const configured = Number(env[RECONNECT_BASE_ENV]);
3769
+ const baseMs = Number.isSafeInteger(configured) && configured > 0 ? configured : BACKOFF_BASE_MS;
3770
+ return (attempt) => backoffDelayMs(attempt, Math.random, baseMs);
3771
+ }
3766
3772
 
3767
3773
  // src/connection.ts
3768
3774
  var CLOSE_CREDENTIAL_REJECTED = 4401;
@@ -4014,7 +4020,7 @@ function codeFromStatus(status2) {
4014
4020
  }
4015
4021
 
4016
4022
  // src/registration.ts
4017
- var SERVICE = "talgent.computer.public.v1.RegistrationService";
4023
+ var SERVICE = "computer.public.v1.RegistrationService";
4018
4024
  var RegistrationExpiredError = class extends Error {
4019
4025
  constructor() {
4020
4026
  super("the registration expired or was already used");
@@ -7142,8 +7148,8 @@ function refusal(messages, batch, refused, reason2) {
7142
7148
 
7143
7149
  // src/proxy/api-publication.ts
7144
7150
  var ARTIFACT_COMMANDS = /* @__PURE__ */ new Set([
7145
- "/talgent.storage.private.v1.ArtifactService/CreateArtifact",
7146
- "/talgent.storage.private.v1.ArtifactService/ReplaceArtifact"
7151
+ "/storage.private.v1.ArtifactService/CreateArtifact",
7152
+ "/storage.private.v1.ArtifactService/ReplaceArtifact"
7147
7153
  ]);
7148
7154
  async function completeArtifactCommand(request, root) {
7149
7155
  const encoding = request.headers["content-encoding"];
@@ -8427,7 +8433,7 @@ function message(error) {
8427
8433
  // package.json
8428
8434
  var package_default = {
8429
8435
  name: "@talgent/computer",
8430
- version: "0.2.1",
8436
+ version: "0.2.3",
8431
8437
  description: "Talgent Computer: registers a machine as a Managed Computer and keeps it connected.",
8432
8438
  license: "Apache-2.0",
8433
8439
  repository: {
@@ -8452,7 +8458,7 @@ var package_default = {
8452
8458
  scripts: {
8453
8459
  build: "tsc --noEmit && node build.mjs",
8454
8460
  typecheck: "tsc --noEmit",
8455
- test: 'node --test "test/**/*.test.ts"',
8461
+ test: 'node --test --test-timeout=3000 "test/**/*.test.ts"',
8456
8462
  "test:installed": "node test/installed/install-register-online.ts && node test/installed/upgrade-online.ts",
8457
8463
  lint: "eslint ."
8458
8464
  },
@@ -8569,6 +8575,7 @@ async function connect2(options) {
8569
8575
  }),
8570
8576
  signal: options.signal,
8571
8577
  log,
8578
+ backoff: reconnectBackoff(process.env),
8572
8579
  relay: (link2) => new Tunnel(service2, link2, log),
8573
8580
  heard: () => void fence.heard(),
8574
8581
  // The welcome precedes every relayed call, so the connection's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talgent/computer",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Talgent Computer: registers a machine as a Managed Computer and keeps it connected.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -39,7 +39,7 @@
39
39
  "scripts": {
40
40
  "build": "tsc --noEmit && node build.mjs",
41
41
  "typecheck": "tsc --noEmit",
42
- "test": "node --test \"test/**/*.test.ts\"",
42
+ "test": "node --test --test-timeout=3000 \"test/**/*.test.ts\"",
43
43
  "test:installed": "node test/installed/install-register-online.ts && node test/installed/upgrade-online.ts",
44
44
  "lint": "eslint ."
45
45
  }