@moonbase.sh/licensing 3.1.1 → 3.2.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.
package/README.md CHANGED
@@ -76,6 +76,7 @@ const licenseGone = new Set<ErrorType | undefined>([
76
76
  ErrorType.LicenseExpired,
77
77
  ErrorType.LicenseInvalid,
78
78
  ErrorType.LicenseDeviceMismatch,
79
+ ErrorType.StoreClosed,
79
80
  ])
80
81
 
81
82
  async function licenseOnStartup(): Promise<License | null> {
package/dist/index.cjs CHANGED
@@ -68,6 +68,9 @@ var import_node_process3 = __toESM(require("process"), 1);
68
68
  // src/client.ts
69
69
  var import_cross_fetch = __toESM(require("cross-fetch"), 1);
70
70
 
71
+ // package.json
72
+ var version = "3.2.1";
73
+
71
74
  // src/errors.ts
72
75
  var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
73
76
  ErrorType2["None"] = "None";
@@ -79,6 +82,7 @@ var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
79
82
  ErrorType2["LicenseExpired"] = "LicenseExpired";
80
83
  ErrorType2["LicenseDeviceMismatch"] = "LicenseDeviceMismatch";
81
84
  ErrorType2["DeviceIdentityUnavailable"] = "DeviceIdentityUnavailable";
85
+ ErrorType2["StoreClosed"] = "StoreClosed";
82
86
  return ErrorType2;
83
87
  })(ErrorType || {});
84
88
  var MoonbaseError = class extends Error {
@@ -159,7 +163,7 @@ var defaultFetchOptions = {
159
163
  headers: {
160
164
  "Accept": "application/json",
161
165
  "Content-Type": "application/json",
162
- "x-mb-client": `moonbase.js`
166
+ "x-mb-client": `@moonbase.sh/licensing/${version}`
163
167
  }
164
168
  };
165
169
  var LicenseClient = class {
@@ -275,7 +279,8 @@ var licenseErrorTypes = /* @__PURE__ */ new Set([
275
279
  "LicenseInvalid" /* LicenseInvalid */,
276
280
  "LicenseRevoked" /* LicenseRevoked */,
277
281
  "LicenseActivationRevoked" /* LicenseActivationRevoked */,
278
- "LicenseExpired" /* LicenseExpired */
282
+ "LicenseExpired" /* LicenseExpired */,
283
+ "StoreClosed" /* StoreClosed */
279
284
  ]);
280
285
  async function errorFromResponse(response) {
281
286
  const fallback = new MoonbaseError(
package/dist/index.d.cts CHANGED
@@ -623,7 +623,13 @@ declare enum ErrorType {
623
623
  /** The license is valid but bound to a different device, or to an older fingerprint version. */
624
624
  LicenseDeviceMismatch = "LicenseDeviceMismatch",
625
625
  /** No stable hardware identifier could be read, so no device id can be computed. */
626
- DeviceIdentityUnavailable = "DeviceIdentityUnavailable"
626
+ DeviceIdentityUnavailable = "DeviceIdentityUnavailable",
627
+ /**
628
+ * The store this product is sold through has closed its Moonbase account. Not transient:
629
+ * nothing about the license can be validated, activated or renewed online again. An offline
630
+ * license keeps validating, since that never asks the server.
631
+ */
632
+ StoreClosed = "StoreClosed"
627
633
  }
628
634
  declare class MoonbaseError extends Error {
629
635
  readonly title: string;
package/dist/index.d.ts CHANGED
@@ -623,7 +623,13 @@ declare enum ErrorType {
623
623
  /** The license is valid but bound to a different device, or to an older fingerprint version. */
624
624
  LicenseDeviceMismatch = "LicenseDeviceMismatch",
625
625
  /** No stable hardware identifier could be read, so no device id can be computed. */
626
- DeviceIdentityUnavailable = "DeviceIdentityUnavailable"
626
+ DeviceIdentityUnavailable = "DeviceIdentityUnavailable",
627
+ /**
628
+ * The store this product is sold through has closed its Moonbase account. Not transient:
629
+ * nothing about the license can be validated, activated or renewed online again. An offline
630
+ * license keeps validating, since that never asks the server.
631
+ */
632
+ StoreClosed = "StoreClosed"
627
633
  }
628
634
  declare class MoonbaseError extends Error {
629
635
  readonly title: string;
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ import process3 from "process";
5
5
  // src/client.ts
6
6
  import fetch from "cross-fetch";
7
7
 
8
+ // package.json
9
+ var version = "3.2.1";
10
+
8
11
  // src/errors.ts
9
12
  var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
10
13
  ErrorType2["None"] = "None";
@@ -16,6 +19,7 @@ var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
16
19
  ErrorType2["LicenseExpired"] = "LicenseExpired";
17
20
  ErrorType2["LicenseDeviceMismatch"] = "LicenseDeviceMismatch";
18
21
  ErrorType2["DeviceIdentityUnavailable"] = "DeviceIdentityUnavailable";
22
+ ErrorType2["StoreClosed"] = "StoreClosed";
19
23
  return ErrorType2;
20
24
  })(ErrorType || {});
21
25
  var MoonbaseError = class extends Error {
@@ -96,7 +100,7 @@ var defaultFetchOptions = {
96
100
  headers: {
97
101
  "Accept": "application/json",
98
102
  "Content-Type": "application/json",
99
- "x-mb-client": `moonbase.js`
103
+ "x-mb-client": `@moonbase.sh/licensing/${version}`
100
104
  }
101
105
  };
102
106
  var LicenseClient = class {
@@ -212,7 +216,8 @@ var licenseErrorTypes = /* @__PURE__ */ new Set([
212
216
  "LicenseInvalid" /* LicenseInvalid */,
213
217
  "LicenseRevoked" /* LicenseRevoked */,
214
218
  "LicenseActivationRevoked" /* LicenseActivationRevoked */,
215
- "LicenseExpired" /* LicenseExpired */
219
+ "LicenseExpired" /* LicenseExpired */,
220
+ "StoreClosed" /* StoreClosed */
216
221
  ]);
217
222
  async function errorFromResponse(response) {
218
223
  const fallback = new MoonbaseError(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/licensing",
3
3
  "type": "module",
4
- "version": "3.1.1",
4
+ "version": "3.2.1",
5
5
  "description": "Package to add sotftware licensing using Moonbase.sh to your node.js apps",
6
6
  "author": "Tobias Lønnerød Madsen <m@dsen.tv>",
7
7
  "license": "MIT",