@moonbase.sh/licensing 1.0.7 → 1.0.12

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 CHANGED
@@ -74,6 +74,8 @@ var licenseSchema = import_zod.z.object({
74
74
  trial: import_zod.z.boolean(),
75
75
  activationMethod: import_zod.z.nativeEnum(ActivationMethod),
76
76
  product: productSchema,
77
+ ownedSubProductIds: import_zod.z.array(import_zod.z.string()).default([]),
78
+ subscriptionId: import_zod.z.string().nullish(),
77
79
  issuedAt: import_zod.z.coerce.date(),
78
80
  issuedTo: userSchema,
79
81
  expiresAt: import_zod.z.coerce.date().nullish(),
@@ -307,6 +309,8 @@ var licenseClaimsSchema = import_zod2.z.object({
307
309
  ["p:id" /* ProductId */]: import_zod2.z.string(),
308
310
  ["p:name" /* ProductName */]: import_zod2.z.string(),
309
311
  ["p:rel" /* ProductReleaseVersion */]: import_zod2.z.string().nullish(),
312
+ ["sp:owned" /* OwnedSubProducts */]: import_zod2.z.string().nullish().transform((v) => v ? v.split(",") : []),
313
+ ["s:id" /* SubscriptionId */]: import_zod2.z.string().nullish(),
310
314
  ["u:id" /* UserId */]: import_zod2.z.string(),
311
315
  ["u:name" /* UserName */]: import_zod2.z.string(),
312
316
  ["u:email" /* UserEmail */]: import_zod2.z.string()
@@ -342,7 +346,7 @@ var LicenseValidator = class {
342
346
  issuer: this.configuration.accountId,
343
347
  audience: this.configuration.productId
344
348
  }, (err, decoded) => {
345
- var _a;
349
+ var _a, _b;
346
350
  if (err) {
347
351
  reject(new MoonbaseError(
348
352
  "Could not validate license",
@@ -371,6 +375,8 @@ var LicenseValidator = class {
371
375
  name: claims["p:name" /* ProductName */],
372
376
  currentReleaseVersion: (_a = claims["p:rel" /* ProductReleaseVersion */]) != null ? _a : void 0
373
377
  },
378
+ ownedSubProductIds: claims["sp:owned" /* OwnedSubProducts */],
379
+ subscriptionId: (_b = claims["s:id" /* SubscriptionId */]) != null ? _b : void 0,
374
380
  issuedTo: {
375
381
  id: claims["u:id" /* UserId */],
376
382
  name: claims["u:name" /* UserName */],
package/dist/index.d.cts CHANGED
@@ -65,6 +65,8 @@ declare const licenseSchema: z.ZodObject<{
65
65
  name: string;
66
66
  currentReleaseVersion?: string | null | undefined;
67
67
  }>;
68
+ ownedSubProductIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
69
+ subscriptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
70
  issuedAt: z.ZodDate;
69
71
  issuedTo: z.ZodObject<{
70
72
  id: z.ZodString;
@@ -91,6 +93,7 @@ declare const licenseSchema: z.ZodObject<{
91
93
  name: string;
92
94
  currentReleaseVersion?: string | null | undefined;
93
95
  };
96
+ ownedSubProductIds: string[];
94
97
  issuedAt: Date;
95
98
  issuedTo: {
96
99
  id: string;
@@ -99,6 +102,7 @@ declare const licenseSchema: z.ZodObject<{
99
102
  };
100
103
  validatedAt: Date;
101
104
  token: string;
105
+ subscriptionId?: string | null | undefined;
102
106
  expiresAt?: Date | null | undefined;
103
107
  }, {
104
108
  id: string;
@@ -117,6 +121,8 @@ declare const licenseSchema: z.ZodObject<{
117
121
  };
118
122
  validatedAt: Date;
119
123
  token: string;
124
+ ownedSubProductIds?: string[] | undefined;
125
+ subscriptionId?: string | null | undefined;
120
126
  expiresAt?: Date | null | undefined;
121
127
  }>;
122
128
 
package/dist/index.d.ts CHANGED
@@ -65,6 +65,8 @@ declare const licenseSchema: z.ZodObject<{
65
65
  name: string;
66
66
  currentReleaseVersion?: string | null | undefined;
67
67
  }>;
68
+ ownedSubProductIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
69
+ subscriptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
70
  issuedAt: z.ZodDate;
69
71
  issuedTo: z.ZodObject<{
70
72
  id: z.ZodString;
@@ -91,6 +93,7 @@ declare const licenseSchema: z.ZodObject<{
91
93
  name: string;
92
94
  currentReleaseVersion?: string | null | undefined;
93
95
  };
96
+ ownedSubProductIds: string[];
94
97
  issuedAt: Date;
95
98
  issuedTo: {
96
99
  id: string;
@@ -99,6 +102,7 @@ declare const licenseSchema: z.ZodObject<{
99
102
  };
100
103
  validatedAt: Date;
101
104
  token: string;
105
+ subscriptionId?: string | null | undefined;
102
106
  expiresAt?: Date | null | undefined;
103
107
  }, {
104
108
  id: string;
@@ -117,6 +121,8 @@ declare const licenseSchema: z.ZodObject<{
117
121
  };
118
122
  validatedAt: Date;
119
123
  token: string;
124
+ ownedSubProductIds?: string[] | undefined;
125
+ subscriptionId?: string | null | undefined;
120
126
  expiresAt?: Date | null | undefined;
121
127
  }>;
122
128
 
package/dist/index.js CHANGED
@@ -30,6 +30,8 @@ var licenseSchema = z.object({
30
30
  trial: z.boolean(),
31
31
  activationMethod: z.nativeEnum(ActivationMethod),
32
32
  product: productSchema,
33
+ ownedSubProductIds: z.array(z.string()).default([]),
34
+ subscriptionId: z.string().nullish(),
33
35
  issuedAt: z.coerce.date(),
34
36
  issuedTo: userSchema,
35
37
  expiresAt: z.coerce.date().nullish(),
@@ -263,6 +265,8 @@ var licenseClaimsSchema = z2.object({
263
265
  ["p:id" /* ProductId */]: z2.string(),
264
266
  ["p:name" /* ProductName */]: z2.string(),
265
267
  ["p:rel" /* ProductReleaseVersion */]: z2.string().nullish(),
268
+ ["sp:owned" /* OwnedSubProducts */]: z2.string().nullish().transform((v) => v ? v.split(",") : []),
269
+ ["s:id" /* SubscriptionId */]: z2.string().nullish(),
266
270
  ["u:id" /* UserId */]: z2.string(),
267
271
  ["u:name" /* UserName */]: z2.string(),
268
272
  ["u:email" /* UserEmail */]: z2.string()
@@ -298,7 +302,7 @@ var LicenseValidator = class {
298
302
  issuer: this.configuration.accountId,
299
303
  audience: this.configuration.productId
300
304
  }, (err, decoded) => {
301
- var _a;
305
+ var _a, _b;
302
306
  if (err) {
303
307
  reject(new MoonbaseError(
304
308
  "Could not validate license",
@@ -327,6 +331,8 @@ var LicenseValidator = class {
327
331
  name: claims["p:name" /* ProductName */],
328
332
  currentReleaseVersion: (_a = claims["p:rel" /* ProductReleaseVersion */]) != null ? _a : void 0
329
333
  },
334
+ ownedSubProductIds: claims["sp:owned" /* OwnedSubProducts */],
335
+ subscriptionId: (_b = claims["s:id" /* SubscriptionId */]) != null ? _b : void 0,
330
336
  issuedTo: {
331
337
  id: claims["u:id" /* UserId */],
332
338
  name: claims["u:name" /* UserName */],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/licensing",
3
3
  "type": "module",
4
- "version": "1.0.7",
4
+ "version": "1.0.12",
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",