oasis_test 0.1.15 → 0.1.16

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 +6 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -51161,19 +51161,20 @@ void (async () => {
51161
51161
  let nodeId = serverChanged ? void 0 : prev?.nodeId;
51162
51162
  let token = serverChanged ? flags.get("token") ?? process.env["OASIS_NODE_TOKEN"] : flags.get("token") ?? process.env["OASIS_NODE_TOKEN"] ?? prev?.token;
51163
51163
  const enrollToken = flags.get("enroll-token") ?? process.env["OASIS_ENROLL_TOKEN"];
51164
- if (prev?.nodeId && prev?.token && !serverChanged) {
51165
- nodeId = prev.nodeId;
51166
- token = prev.token;
51167
- } else if (enrollToken) {
51164
+ const derivedNodeId = resolveNodeId();
51165
+ if (enrollToken) {
51168
51166
  const res = await fetch(`${httpBase(serverUrl)}/api/nodes/exchange`, {
51169
51167
  method: "POST",
51170
51168
  headers: { "content-type": "application/json" },
51171
- body: JSON.stringify({ enrollToken, hostname: os8.hostname() })
51169
+ body: JSON.stringify({ enrollToken, nodeId: derivedNodeId, hostname: os8.hostname() })
51172
51170
  });
51173
51171
  if (!res.ok) throw new Error(`enroll token exchange failed: HTTP ${res.status}`);
51174
51172
  const body = await res.json();
51175
51173
  token = body.token;
51176
51174
  nodeId = body.nodeId;
51175
+ } else if (prev?.nodeId && prev?.token && !serverChanged) {
51176
+ nodeId = prev.nodeId;
51177
+ token = prev.token;
51177
51178
  }
51178
51179
  if (!token || !nodeId) {
51179
51180
  console.error("Usage: oasis start --server-ws <wss://...> (--enroll-token <ent_...> | --token <ont_...>) [--name <name>]");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis_test",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
5
5
  "bin": {
6
6
  "oasis": "./dist/index.js"