@moonbase.sh/licensing 0.4.24 → 0.4.26
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/dist/index.cjs +7 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -8
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
33
|
ActivationMethod: () => ActivationMethod,
|
|
34
34
|
DefaultDeviceIdResolver: () => DefaultDeviceIdResolver,
|
|
35
35
|
ErrorType: () => ErrorType,
|
|
@@ -40,7 +40,7 @@ __export(src_exports, {
|
|
|
40
40
|
MoonbaseError: () => MoonbaseError,
|
|
41
41
|
MoonbaseLicensing: () => MoonbaseLicensing
|
|
42
42
|
});
|
|
43
|
-
module.exports = __toCommonJS(
|
|
43
|
+
module.exports = __toCommonJS(index_exports);
|
|
44
44
|
|
|
45
45
|
// src/client.ts
|
|
46
46
|
var import_cross_fetch = __toESM(require("cross-fetch"), 1);
|
|
@@ -124,8 +124,7 @@ var LicenseClient = class {
|
|
|
124
124
|
}
|
|
125
125
|
async getRequestedActivation(request) {
|
|
126
126
|
const response = await (0, import_cross_fetch.default)(request.request, defaultFetchOptions);
|
|
127
|
-
if (response.status === 204 || response.status === 404)
|
|
128
|
-
return null;
|
|
127
|
+
if (response.status === 204 || response.status === 404) return null;
|
|
129
128
|
return await this.handleLicenseResponse(response);
|
|
130
129
|
}
|
|
131
130
|
async validateLicense(license) {
|
|
@@ -142,8 +141,7 @@ var LicenseClient = class {
|
|
|
142
141
|
}
|
|
143
142
|
async validateRawLicense(rawLicense) {
|
|
144
143
|
const license = await this.licenseValidator.validateLicense(rawLicense.toString("utf8"));
|
|
145
|
-
if (license.activationMethod === "Offline" /* Offline */)
|
|
146
|
-
return license;
|
|
144
|
+
if (license.activationMethod === "Offline" /* Offline */) return license;
|
|
147
145
|
return await this.validateLicense(license);
|
|
148
146
|
}
|
|
149
147
|
async revokeLicense(license) {
|
|
@@ -257,8 +255,7 @@ var FileLicenseStore = class {
|
|
|
257
255
|
this.options = options;
|
|
258
256
|
}
|
|
259
257
|
async loadLocalLicense() {
|
|
260
|
-
if (!import_node_fs.default.existsSync(this.path))
|
|
261
|
-
return null;
|
|
258
|
+
if (!import_node_fs.default.existsSync(this.path)) return null;
|
|
262
259
|
try {
|
|
263
260
|
const file = await import_promises.default.readFile(this.path, { encoding: "utf-8" });
|
|
264
261
|
const license = licenseSchema.parse(JSON.parse(file));
|
|
@@ -271,8 +268,7 @@ var FileLicenseStore = class {
|
|
|
271
268
|
await import_promises.default.writeFile(this.path, JSON.stringify(license), { encoding: "utf-8" });
|
|
272
269
|
}
|
|
273
270
|
async deleteLocalLicense() {
|
|
274
|
-
if (!import_node_fs.default.existsSync(this.path))
|
|
275
|
-
return;
|
|
271
|
+
if (!import_node_fs.default.existsSync(this.path)) return;
|
|
276
272
|
await import_promises.default.rm(this.path);
|
|
277
273
|
}
|
|
278
274
|
get path() {
|
package/dist/index.d.cts
CHANGED
|
@@ -214,8 +214,8 @@ declare class InMemoryLicenseStore implements ILicenseStore {
|
|
|
214
214
|
declare class FileLicenseStore implements ILicenseStore {
|
|
215
215
|
private readonly options?;
|
|
216
216
|
constructor(options?: {
|
|
217
|
-
dir?: string
|
|
218
|
-
licenseFileName?: string
|
|
217
|
+
dir?: string;
|
|
218
|
+
licenseFileName?: string;
|
|
219
219
|
} | undefined);
|
|
220
220
|
loadLocalLicense(): Promise<License | null>;
|
|
221
221
|
storeLocalLicense(license: License): Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -214,8 +214,8 @@ declare class InMemoryLicenseStore implements ILicenseStore {
|
|
|
214
214
|
declare class FileLicenseStore implements ILicenseStore {
|
|
215
215
|
private readonly options?;
|
|
216
216
|
constructor(options?: {
|
|
217
|
-
dir?: string
|
|
218
|
-
licenseFileName?: string
|
|
217
|
+
dir?: string;
|
|
218
|
+
licenseFileName?: string;
|
|
219
219
|
} | undefined);
|
|
220
220
|
loadLocalLicense(): Promise<License | null>;
|
|
221
221
|
storeLocalLicense(license: License): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -80,8 +80,7 @@ var LicenseClient = class {
|
|
|
80
80
|
}
|
|
81
81
|
async getRequestedActivation(request) {
|
|
82
82
|
const response = await fetch(request.request, defaultFetchOptions);
|
|
83
|
-
if (response.status === 204 || response.status === 404)
|
|
84
|
-
return null;
|
|
83
|
+
if (response.status === 204 || response.status === 404) return null;
|
|
85
84
|
return await this.handleLicenseResponse(response);
|
|
86
85
|
}
|
|
87
86
|
async validateLicense(license) {
|
|
@@ -98,8 +97,7 @@ var LicenseClient = class {
|
|
|
98
97
|
}
|
|
99
98
|
async validateRawLicense(rawLicense) {
|
|
100
99
|
const license = await this.licenseValidator.validateLicense(rawLicense.toString("utf8"));
|
|
101
|
-
if (license.activationMethod === "Offline" /* Offline */)
|
|
102
|
-
return license;
|
|
100
|
+
if (license.activationMethod === "Offline" /* Offline */) return license;
|
|
103
101
|
return await this.validateLicense(license);
|
|
104
102
|
}
|
|
105
103
|
async revokeLicense(license) {
|
|
@@ -213,8 +211,7 @@ var FileLicenseStore = class {
|
|
|
213
211
|
this.options = options;
|
|
214
212
|
}
|
|
215
213
|
async loadLocalLicense() {
|
|
216
|
-
if (!fsSync.existsSync(this.path))
|
|
217
|
-
return null;
|
|
214
|
+
if (!fsSync.existsSync(this.path)) return null;
|
|
218
215
|
try {
|
|
219
216
|
const file = await fs.readFile(this.path, { encoding: "utf-8" });
|
|
220
217
|
const license = licenseSchema.parse(JSON.parse(file));
|
|
@@ -227,8 +224,7 @@ var FileLicenseStore = class {
|
|
|
227
224
|
await fs.writeFile(this.path, JSON.stringify(license), { encoding: "utf-8" });
|
|
228
225
|
}
|
|
229
226
|
async deleteLocalLicense() {
|
|
230
|
-
if (!fsSync.existsSync(this.path))
|
|
231
|
-
return;
|
|
227
|
+
if (!fsSync.existsSync(this.path)) return;
|
|
232
228
|
await fs.rm(this.path);
|
|
233
229
|
}
|
|
234
230
|
get path() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/licensing",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.26",
|
|
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",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"@types/jsonwebtoken": "^9.0.9",
|
|
23
23
|
"@types/node": "^18.19.50",
|
|
24
24
|
"rimraf": "^5.0.10",
|
|
25
|
-
"tsup": "^
|
|
26
|
-
"typescript": "~5.
|
|
25
|
+
"tsup": "^8.5.0",
|
|
26
|
+
"typescript": "~5.8.3",
|
|
27
27
|
"vitest": "^2.1.4"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|