@moonbase.sh/licensing 1.0.17 → 1.0.19

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
@@ -62,12 +62,14 @@ var activationRequestResponseSchema = import_zod.z.object({
62
62
  var productSchema = import_zod.z.object({
63
63
  id: import_zod.z.string(),
64
64
  name: import_zod.z.string(),
65
- currentReleaseVersion: import_zod.z.string().nullish()
65
+ currentReleaseVersion: import_zod.z.string().nullish(),
66
+ properties: import_zod.z.record(import_zod.z.unknown()).nullish()
66
67
  });
67
68
  var userSchema = import_zod.z.object({
68
69
  id: import_zod.z.string(),
69
70
  name: import_zod.z.string(),
70
- email: import_zod.z.string()
71
+ email: import_zod.z.string(),
72
+ properties: import_zod.z.record(import_zod.z.unknown()).nullish()
71
73
  });
72
74
  var licenseSchema = import_zod.z.object({
73
75
  id: import_zod.z.string(),
@@ -80,6 +82,7 @@ var licenseSchema = import_zod.z.object({
80
82
  issuedTo: userSchema,
81
83
  expiresAt: import_zod.z.coerce.date().nullish(),
82
84
  validatedAt: import_zod.z.coerce.date(),
85
+ properties: import_zod.z.record(import_zod.z.unknown()).nullish(),
83
86
  token: import_zod.z.string()
84
87
  });
85
88
 
@@ -313,7 +316,11 @@ var licenseClaimsSchema = import_zod2.z.object({
313
316
  ["s:id" /* SubscriptionId */]: import_zod2.z.string().nullish(),
314
317
  ["u:id" /* UserId */]: import_zod2.z.string(),
315
318
  ["u:name" /* UserName */]: import_zod2.z.string(),
316
- ["u:email" /* UserEmail */]: import_zod2.z.string()
319
+ ["u:email" /* UserEmail */]: import_zod2.z.string(),
320
+ ["p:properties" /* ProductProperties */]: import_zod2.z.record(import_zod2.z.unknown()).nullish(),
321
+ ["u:properties" /* UserProperties */]: import_zod2.z.record(import_zod2.z.unknown()).nullish(),
322
+ ["l:properties" /* LicenseProperties */]: import_zod2.z.record(import_zod2.z.unknown()).nullish(),
323
+ ["t:properties" /* TrialProperties */]: import_zod2.z.record(import_zod2.z.unknown()).nullish()
317
324
  });
318
325
  var LicenseValidator = class {
319
326
  constructor(configuration, deviceIdResolver) {
@@ -346,7 +353,7 @@ var LicenseValidator = class {
346
353
  issuer: this.configuration.accountId,
347
354
  audience: this.configuration.productId
348
355
  }, (err, decoded) => {
349
- var _a, _b;
356
+ var _a, _b, _c, _d, _e;
350
357
  if (err) {
351
358
  reject(new MoonbaseError(
352
359
  "Could not validate license",
@@ -373,18 +380,21 @@ var LicenseValidator = class {
373
380
  product: {
374
381
  id: claims["p:id" /* ProductId */],
375
382
  name: claims["p:name" /* ProductName */],
376
- currentReleaseVersion: (_a = claims["p:rel" /* ProductReleaseVersion */]) != null ? _a : void 0
383
+ currentReleaseVersion: (_a = claims["p:rel" /* ProductReleaseVersion */]) != null ? _a : void 0,
384
+ properties: (_b = claims["p:properties" /* ProductProperties */]) != null ? _b : void 0
377
385
  },
378
386
  ownedSubProductIds: claims["sp:owned" /* OwnedSubProducts */],
379
- subscriptionId: (_b = claims["s:id" /* SubscriptionId */]) != null ? _b : void 0,
387
+ subscriptionId: (_c = claims["s:id" /* SubscriptionId */]) != null ? _c : void 0,
380
388
  issuedTo: {
381
389
  id: claims["u:id" /* UserId */],
382
390
  name: claims["u:name" /* UserName */],
383
- email: claims["u:email" /* UserEmail */]
391
+ email: claims["u:email" /* UserEmail */],
392
+ properties: (_d = claims["u:properties" /* UserProperties */]) != null ? _d : void 0
384
393
  },
385
394
  expiresAt: claims["exp" /* ExpiresAt */] || void 0,
386
395
  issuedAt: claims["iat" /* IssuedAt */],
387
396
  validatedAt: claims["validated" /* ValidatedAt */],
397
+ properties: (_e = claims["trial" /* Trial */] ? claims["t:properties" /* TrialProperties */] : claims["l:properties" /* LicenseProperties */]) != null ? _e : void 0,
388
398
  token
389
399
  }, claims]);
390
400
  } catch (err2) {
package/dist/index.d.cts CHANGED
@@ -26,27 +26,33 @@ declare const productSchema: z.ZodObject<{
26
26
  id: z.ZodString;
27
27
  name: z.ZodString;
28
28
  currentReleaseVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
29
30
  }, "strip", z.ZodTypeAny, {
30
31
  id: string;
31
32
  name: string;
32
33
  currentReleaseVersion?: string | null | undefined;
34
+ properties?: Record<string, unknown> | null | undefined;
33
35
  }, {
34
36
  id: string;
35
37
  name: string;
36
38
  currentReleaseVersion?: string | null | undefined;
39
+ properties?: Record<string, unknown> | null | undefined;
37
40
  }>;
38
41
  declare const userSchema: z.ZodObject<{
39
42
  id: z.ZodString;
40
43
  name: z.ZodString;
41
44
  email: z.ZodString;
45
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
42
46
  }, "strip", z.ZodTypeAny, {
43
47
  id: string;
44
48
  name: string;
45
49
  email: string;
50
+ properties?: Record<string, unknown> | null | undefined;
46
51
  }, {
47
52
  id: string;
48
53
  name: string;
49
54
  email: string;
55
+ properties?: Record<string, unknown> | null | undefined;
50
56
  }>;
51
57
  declare const licenseSchema: z.ZodObject<{
52
58
  id: z.ZodString;
@@ -56,14 +62,17 @@ declare const licenseSchema: z.ZodObject<{
56
62
  id: z.ZodString;
57
63
  name: z.ZodString;
58
64
  currentReleaseVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
59
66
  }, "strip", z.ZodTypeAny, {
60
67
  id: string;
61
68
  name: string;
62
69
  currentReleaseVersion?: string | null | undefined;
70
+ properties?: Record<string, unknown> | null | undefined;
63
71
  }, {
64
72
  id: string;
65
73
  name: string;
66
74
  currentReleaseVersion?: string | null | undefined;
75
+ properties?: Record<string, unknown> | null | undefined;
67
76
  }>;
68
77
  ownedSubProductIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
69
78
  subscriptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -72,17 +81,21 @@ declare const licenseSchema: z.ZodObject<{
72
81
  id: z.ZodString;
73
82
  name: z.ZodString;
74
83
  email: z.ZodString;
84
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
75
85
  }, "strip", z.ZodTypeAny, {
76
86
  id: string;
77
87
  name: string;
78
88
  email: string;
89
+ properties?: Record<string, unknown> | null | undefined;
79
90
  }, {
80
91
  id: string;
81
92
  name: string;
82
93
  email: string;
94
+ properties?: Record<string, unknown> | null | undefined;
83
95
  }>;
84
96
  expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
85
97
  validatedAt: z.ZodDate;
98
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
86
99
  token: z.ZodString;
87
100
  }, "strip", z.ZodTypeAny, {
88
101
  id: string;
@@ -92,6 +105,7 @@ declare const licenseSchema: z.ZodObject<{
92
105
  id: string;
93
106
  name: string;
94
107
  currentReleaseVersion?: string | null | undefined;
108
+ properties?: Record<string, unknown> | null | undefined;
95
109
  };
96
110
  ownedSubProductIds: string[];
97
111
  issuedAt: Date;
@@ -99,9 +113,11 @@ declare const licenseSchema: z.ZodObject<{
99
113
  id: string;
100
114
  name: string;
101
115
  email: string;
116
+ properties?: Record<string, unknown> | null | undefined;
102
117
  };
103
118
  validatedAt: Date;
104
119
  token: string;
120
+ properties?: Record<string, unknown> | null | undefined;
105
121
  subscriptionId?: string | null | undefined;
106
122
  expiresAt?: Date | null | undefined;
107
123
  }, {
@@ -112,15 +128,18 @@ declare const licenseSchema: z.ZodObject<{
112
128
  id: string;
113
129
  name: string;
114
130
  currentReleaseVersion?: string | null | undefined;
131
+ properties?: Record<string, unknown> | null | undefined;
115
132
  };
116
133
  issuedAt: Date;
117
134
  issuedTo: {
118
135
  id: string;
119
136
  name: string;
120
137
  email: string;
138
+ properties?: Record<string, unknown> | null | undefined;
121
139
  };
122
140
  validatedAt: Date;
123
141
  token: string;
142
+ properties?: Record<string, unknown> | null | undefined;
124
143
  ownedSubProductIds?: string[] | undefined;
125
144
  subscriptionId?: string | null | undefined;
126
145
  expiresAt?: Date | null | undefined;
package/dist/index.d.ts CHANGED
@@ -26,27 +26,33 @@ declare const productSchema: z.ZodObject<{
26
26
  id: z.ZodString;
27
27
  name: z.ZodString;
28
28
  currentReleaseVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
29
30
  }, "strip", z.ZodTypeAny, {
30
31
  id: string;
31
32
  name: string;
32
33
  currentReleaseVersion?: string | null | undefined;
34
+ properties?: Record<string, unknown> | null | undefined;
33
35
  }, {
34
36
  id: string;
35
37
  name: string;
36
38
  currentReleaseVersion?: string | null | undefined;
39
+ properties?: Record<string, unknown> | null | undefined;
37
40
  }>;
38
41
  declare const userSchema: z.ZodObject<{
39
42
  id: z.ZodString;
40
43
  name: z.ZodString;
41
44
  email: z.ZodString;
45
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
42
46
  }, "strip", z.ZodTypeAny, {
43
47
  id: string;
44
48
  name: string;
45
49
  email: string;
50
+ properties?: Record<string, unknown> | null | undefined;
46
51
  }, {
47
52
  id: string;
48
53
  name: string;
49
54
  email: string;
55
+ properties?: Record<string, unknown> | null | undefined;
50
56
  }>;
51
57
  declare const licenseSchema: z.ZodObject<{
52
58
  id: z.ZodString;
@@ -56,14 +62,17 @@ declare const licenseSchema: z.ZodObject<{
56
62
  id: z.ZodString;
57
63
  name: z.ZodString;
58
64
  currentReleaseVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
59
66
  }, "strip", z.ZodTypeAny, {
60
67
  id: string;
61
68
  name: string;
62
69
  currentReleaseVersion?: string | null | undefined;
70
+ properties?: Record<string, unknown> | null | undefined;
63
71
  }, {
64
72
  id: string;
65
73
  name: string;
66
74
  currentReleaseVersion?: string | null | undefined;
75
+ properties?: Record<string, unknown> | null | undefined;
67
76
  }>;
68
77
  ownedSubProductIds: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
69
78
  subscriptionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -72,17 +81,21 @@ declare const licenseSchema: z.ZodObject<{
72
81
  id: z.ZodString;
73
82
  name: z.ZodString;
74
83
  email: z.ZodString;
84
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
75
85
  }, "strip", z.ZodTypeAny, {
76
86
  id: string;
77
87
  name: string;
78
88
  email: string;
89
+ properties?: Record<string, unknown> | null | undefined;
79
90
  }, {
80
91
  id: string;
81
92
  name: string;
82
93
  email: string;
94
+ properties?: Record<string, unknown> | null | undefined;
83
95
  }>;
84
96
  expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
85
97
  validatedAt: z.ZodDate;
98
+ properties: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
86
99
  token: z.ZodString;
87
100
  }, "strip", z.ZodTypeAny, {
88
101
  id: string;
@@ -92,6 +105,7 @@ declare const licenseSchema: z.ZodObject<{
92
105
  id: string;
93
106
  name: string;
94
107
  currentReleaseVersion?: string | null | undefined;
108
+ properties?: Record<string, unknown> | null | undefined;
95
109
  };
96
110
  ownedSubProductIds: string[];
97
111
  issuedAt: Date;
@@ -99,9 +113,11 @@ declare const licenseSchema: z.ZodObject<{
99
113
  id: string;
100
114
  name: string;
101
115
  email: string;
116
+ properties?: Record<string, unknown> | null | undefined;
102
117
  };
103
118
  validatedAt: Date;
104
119
  token: string;
120
+ properties?: Record<string, unknown> | null | undefined;
105
121
  subscriptionId?: string | null | undefined;
106
122
  expiresAt?: Date | null | undefined;
107
123
  }, {
@@ -112,15 +128,18 @@ declare const licenseSchema: z.ZodObject<{
112
128
  id: string;
113
129
  name: string;
114
130
  currentReleaseVersion?: string | null | undefined;
131
+ properties?: Record<string, unknown> | null | undefined;
115
132
  };
116
133
  issuedAt: Date;
117
134
  issuedTo: {
118
135
  id: string;
119
136
  name: string;
120
137
  email: string;
138
+ properties?: Record<string, unknown> | null | undefined;
121
139
  };
122
140
  validatedAt: Date;
123
141
  token: string;
142
+ properties?: Record<string, unknown> | null | undefined;
124
143
  ownedSubProductIds?: string[] | undefined;
125
144
  subscriptionId?: string | null | undefined;
126
145
  expiresAt?: Date | null | undefined;
package/dist/index.js CHANGED
@@ -18,12 +18,14 @@ var activationRequestResponseSchema = z.object({
18
18
  var productSchema = z.object({
19
19
  id: z.string(),
20
20
  name: z.string(),
21
- currentReleaseVersion: z.string().nullish()
21
+ currentReleaseVersion: z.string().nullish(),
22
+ properties: z.record(z.unknown()).nullish()
22
23
  });
23
24
  var userSchema = z.object({
24
25
  id: z.string(),
25
26
  name: z.string(),
26
- email: z.string()
27
+ email: z.string(),
28
+ properties: z.record(z.unknown()).nullish()
27
29
  });
28
30
  var licenseSchema = z.object({
29
31
  id: z.string(),
@@ -36,6 +38,7 @@ var licenseSchema = z.object({
36
38
  issuedTo: userSchema,
37
39
  expiresAt: z.coerce.date().nullish(),
38
40
  validatedAt: z.coerce.date(),
41
+ properties: z.record(z.unknown()).nullish(),
39
42
  token: z.string()
40
43
  });
41
44
 
@@ -269,7 +272,11 @@ var licenseClaimsSchema = z2.object({
269
272
  ["s:id" /* SubscriptionId */]: z2.string().nullish(),
270
273
  ["u:id" /* UserId */]: z2.string(),
271
274
  ["u:name" /* UserName */]: z2.string(),
272
- ["u:email" /* UserEmail */]: z2.string()
275
+ ["u:email" /* UserEmail */]: z2.string(),
276
+ ["p:properties" /* ProductProperties */]: z2.record(z2.unknown()).nullish(),
277
+ ["u:properties" /* UserProperties */]: z2.record(z2.unknown()).nullish(),
278
+ ["l:properties" /* LicenseProperties */]: z2.record(z2.unknown()).nullish(),
279
+ ["t:properties" /* TrialProperties */]: z2.record(z2.unknown()).nullish()
273
280
  });
274
281
  var LicenseValidator = class {
275
282
  constructor(configuration, deviceIdResolver) {
@@ -302,7 +309,7 @@ var LicenseValidator = class {
302
309
  issuer: this.configuration.accountId,
303
310
  audience: this.configuration.productId
304
311
  }, (err, decoded) => {
305
- var _a, _b;
312
+ var _a, _b, _c, _d, _e;
306
313
  if (err) {
307
314
  reject(new MoonbaseError(
308
315
  "Could not validate license",
@@ -329,18 +336,21 @@ var LicenseValidator = class {
329
336
  product: {
330
337
  id: claims["p:id" /* ProductId */],
331
338
  name: claims["p:name" /* ProductName */],
332
- currentReleaseVersion: (_a = claims["p:rel" /* ProductReleaseVersion */]) != null ? _a : void 0
339
+ currentReleaseVersion: (_a = claims["p:rel" /* ProductReleaseVersion */]) != null ? _a : void 0,
340
+ properties: (_b = claims["p:properties" /* ProductProperties */]) != null ? _b : void 0
333
341
  },
334
342
  ownedSubProductIds: claims["sp:owned" /* OwnedSubProducts */],
335
- subscriptionId: (_b = claims["s:id" /* SubscriptionId */]) != null ? _b : void 0,
343
+ subscriptionId: (_c = claims["s:id" /* SubscriptionId */]) != null ? _c : void 0,
336
344
  issuedTo: {
337
345
  id: claims["u:id" /* UserId */],
338
346
  name: claims["u:name" /* UserName */],
339
- email: claims["u:email" /* UserEmail */]
347
+ email: claims["u:email" /* UserEmail */],
348
+ properties: (_d = claims["u:properties" /* UserProperties */]) != null ? _d : void 0
340
349
  },
341
350
  expiresAt: claims["exp" /* ExpiresAt */] || void 0,
342
351
  issuedAt: claims["iat" /* IssuedAt */],
343
352
  validatedAt: claims["validated" /* ValidatedAt */],
353
+ properties: (_e = claims["trial" /* Trial */] ? claims["t:properties" /* TrialProperties */] : claims["l:properties" /* LicenseProperties */]) != null ? _e : void 0,
344
354
  token
345
355
  }, claims]);
346
356
  } catch (err2) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/licensing",
3
3
  "type": "module",
4
- "version": "1.0.17",
4
+ "version": "1.0.19",
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",