punchout-simulator 0.3.0 → 0.3.1

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.
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/server/cli.ts
4
+ import { readFileSync as readFileSync3 } from "fs";
4
5
  import { fileURLToPath } from "url";
5
6
  import { serve } from "@hono/node-server";
6
7
  import { nanoid as nanoid7 } from "nanoid";
@@ -24,6 +25,9 @@ function setRuntime(r) {
24
25
  function getToken() {
25
26
  return runtime.token;
26
27
  }
28
+ function getVersion() {
29
+ return runtime.version;
30
+ }
27
31
  function getPublicUrl() {
28
32
  return runtime.publicUrl.replace(/\/$/, "");
29
33
  }
@@ -2030,7 +2034,7 @@ ${body}` : body;
2030
2034
  dataRoute.get("/health", (c) => c.json({ ok: true }));
2031
2035
  dataRoute.get(
2032
2036
  "/runtime",
2033
- (c) => c.json({ publicUrl: getPublicUrl(), callbackUrl: `${getPublicUrl()}/punchout/return` })
2037
+ (c) => c.json({ publicUrl: getPublicUrl(), callbackUrl: `${getPublicUrl()}/punchout/return`, version: getVersion() })
2034
2038
  );
2035
2039
  dataRoute.get("/sessions", (c) => c.json(listSessions()));
2036
2040
  dataRoute.get("/sessions/:id", (c) => c.json(readSession(c.req.param("id"))));
@@ -2477,6 +2481,13 @@ function hostnameOf(url) {
2477
2481
  return "";
2478
2482
  }
2479
2483
  }
2484
+ function readVersion() {
2485
+ try {
2486
+ return JSON.parse(readFileSync3(new URL("../../package.json", import.meta.url), "utf8")).version;
2487
+ } catch {
2488
+ return void 0;
2489
+ }
2490
+ }
2480
2491
  function printHelp() {
2481
2492
  console.log(`punchout-simulator \u2014 test cXML PunchOut integrations as a virtual counterparty
2482
2493
 
@@ -2503,7 +2514,7 @@ async function main() {
2503
2514
  const exposed = !LOOPBACK.has(hostnameOf(publicUrl)) || !LOOPBACK.has(bindHost);
2504
2515
  const token = flags.token || (exposed ? nanoid7(24) : void 0);
2505
2516
  setDataDir(flags.dataDir);
2506
- setRuntime({ port: flags.port, publicUrl, token });
2517
+ setRuntime({ port: flags.port, publicUrl, token, version: readVersion() });
2507
2518
  await initConfig();
2508
2519
  if (flags.seed) await seedDemoIfEmpty();
2509
2520
  const webRoot = flags.dev ? void 0 : fileURLToPath(new URL("../web", import.meta.url));
@@ -1,4 +1,4 @@
1
- import{m as et}from"./index-fwAo3vG0.js";/*!-----------------------------------------------------------------------------
1
+ import{m as et}from"./index-BzgSetIt.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as f}from"./index-fwAo3vG0.js";/*!-----------------------------------------------------------------------------
1
+ import{m as f}from"./index-BzgSetIt.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as l}from"./index-fwAo3vG0.js";/*!-----------------------------------------------------------------------------
1
+ import{m as l}from"./index-BzgSetIt.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as s}from"./index-fwAo3vG0.js";/*!-----------------------------------------------------------------------------
1
+ import{m as s}from"./index-BzgSetIt.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -1,4 +1,4 @@
1
- import{m as lt}from"./index-fwAo3vG0.js";/*!-----------------------------------------------------------------------------
1
+ import{m as lt}from"./index-BzgSetIt.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license