@moonbase.sh/api 0.1.109 → 0.1.111

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
@@ -100,13 +100,17 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
100
100
  // src/licenses/schemas.ts
101
101
  var licenseSchema = import_zod2.z.object({
102
102
  id: import_zod2.z.string(),
103
+ productId: import_zod2.z.string(),
104
+ ownerId: import_zod2.z.string(),
103
105
  status: import_zod2.z.nativeEnum(LicenseStatus),
104
106
  activeNumberOfActivations: import_zod2.z.number(),
105
- maxNumberOfActivations: import_zod2.z.number()
107
+ maxNumberOfActivations: import_zod2.z.number(),
108
+ offlineActivationsAllowed: import_zod2.z.boolean()
106
109
  });
107
110
  var licenseActivationSchema = import_zod2.z.object({
108
111
  id: import_zod2.z.string(),
109
112
  name: import_zod2.z.string(),
113
+ signature: import_zod2.z.string(),
110
114
  status: import_zod2.z.nativeEnum(ActivationStatus),
111
115
  activationMethod: import_zod2.z.nativeEnum(ActivationMethod),
112
116
  lastValidatedAt: import_zod2.z.coerce.date(),
@@ -149,6 +153,9 @@ var TrialStatus = /* @__PURE__ */ ((TrialStatus2) => {
149
153
  // src/trials/schemas.ts
150
154
  var trialSchema = import_zod4.z.object({
151
155
  id: import_zod4.z.string(),
156
+ productId: import_zod4.z.string(),
157
+ deviceName: import_zod4.z.string(),
158
+ deviceSignature: import_zod4.z.string(),
152
159
  status: import_zod4.z.nativeEnum(TrialStatus),
153
160
  expiresAt: import_zod4.z.coerce.date(),
154
161
  lastValidatedAt: import_zod4.z.coerce.date(),
@@ -166,6 +173,8 @@ var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
166
173
  // src/activationRequests/schemas.ts
167
174
  var activationRequestSchema = import_zod5.z.object({
168
175
  id: import_zod5.z.string(),
176
+ deviceName: import_zod5.z.string(),
177
+ deviceSignature: import_zod5.z.string(),
169
178
  status: import_zod5.z.nativeEnum(ActivationRequestStatus),
170
179
  product: productSchema,
171
180
  activation: licenseActivationSchema.optional(),
@@ -182,8 +191,8 @@ var ActivationRequestEndpoints = class {
182
191
  const response = await this.api.fetch(`/api/activations/${requestId}`);
183
192
  return activationRequestSchema.parse(response.data);
184
193
  }
185
- async request(productId) {
186
- const response = await this.api.fetch(`/api/activations/${productId}/request`);
194
+ async request(productId, target) {
195
+ const response = await this.api.fetch(`/api/activations/${productId}/request`, "POST", target);
187
196
  return activationRequestSchema.parse(response.data);
188
197
  }
189
198
  };
@@ -199,17 +208,6 @@ var CustomerEndpoints = class {
199
208
  }
200
209
  };
201
210
 
202
- // src/licenses/endpoints.ts
203
- var LicenseEndpoints = class {
204
- constructor(api) {
205
- this.api = api;
206
- }
207
- async validate(licenseId, activationId) {
208
- const response = await this.api.fetch(`/api/licenses/${licenseId}/activations/${activationId}/validate`, "POST");
209
- return licenseActivationSchema.parse(response.data);
210
- }
211
- };
212
-
213
211
  // src/globalSchemas.ts
214
212
  var import_zod6 = require("zod");
215
213
  var priceCollectionSchema = import_zod6.z.record(import_zod6.z.number());
@@ -338,6 +336,37 @@ var MoonbaseApi = class {
338
336
  }
339
337
  };
340
338
 
339
+ // src/licenses/endpoints.ts
340
+ var LicenseEndpoints = class {
341
+ constructor(api) {
342
+ this.api = api;
343
+ }
344
+ async query(opts) {
345
+ const response = await this.api.fetch(`/api/licenses?${objectToQuery(opts)}`);
346
+ return paged(licenseSchema).parse(response.data);
347
+ }
348
+ async get(licenseId) {
349
+ const response = await this.api.fetch(`/api/licenses/${licenseId}`);
350
+ return licenseSchema.parse(response.data);
351
+ }
352
+ async revoke(licenseId) {
353
+ const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
354
+ return licenseSchema.parse(response.data);
355
+ }
356
+ async queryActivations(licenseId, opts) {
357
+ const response = await this.api.fetch(`/api/licenses/${licenseId}/activations?${objectToQuery(opts)}`);
358
+ return paged(licenseActivationSchema).parse(response.data);
359
+ }
360
+ async validateActivation(licenseId, activationId) {
361
+ const response = await this.api.fetch(`/api/licenses/${licenseId}/activations/${activationId}/validate`, "POST");
362
+ return licenseActivationSchema.parse(response.data);
363
+ }
364
+ async revokeActivation(licenseId, activationId) {
365
+ const response = await this.api.fetch(`/api/licenses/${licenseId}/activations/${activationId}/revoke`, "POST");
366
+ return licenseActivationSchema.parse(response.data);
367
+ }
368
+ };
369
+
341
370
  // src/products/endpoints.ts
342
371
  var ProductEndpoints = class {
343
372
  constructor(api) {
package/dist/index.d.cts CHANGED
@@ -15,6 +15,8 @@ declare class MoonbaseApi {
15
15
 
16
16
  declare const activationRequestSchema: z.ZodObject<{
17
17
  id: z.ZodString;
18
+ deviceName: z.ZodString;
19
+ deviceSignature: z.ZodString;
18
20
  status: z.ZodNativeEnum<typeof ActivationRequestStatus>;
19
21
  product: z.ZodObject<{
20
22
  id: z.ZodString;
@@ -50,52 +52,73 @@ declare const activationRequestSchema: z.ZodObject<{
50
52
  activation: z.ZodOptional<z.ZodObject<{
51
53
  id: z.ZodString;
52
54
  name: z.ZodString;
55
+ signature: z.ZodString;
53
56
  status: z.ZodNativeEnum<typeof ActivationStatus>;
54
57
  activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
55
58
  lastValidatedAt: z.ZodDate;
56
59
  license: z.ZodObject<{
57
60
  id: z.ZodString;
61
+ productId: z.ZodString;
62
+ ownerId: z.ZodString;
58
63
  status: z.ZodNativeEnum<typeof LicenseStatus>;
59
64
  activeNumberOfActivations: z.ZodNumber;
60
65
  maxNumberOfActivations: z.ZodNumber;
66
+ offlineActivationsAllowed: z.ZodBoolean;
61
67
  }, "strip", z.ZodTypeAny, {
62
68
  status: LicenseStatus;
63
69
  id: string;
70
+ productId: string;
71
+ ownerId: string;
64
72
  activeNumberOfActivations: number;
65
73
  maxNumberOfActivations: number;
74
+ offlineActivationsAllowed: boolean;
66
75
  }, {
67
76
  status: LicenseStatus;
68
77
  id: string;
78
+ productId: string;
79
+ ownerId: string;
69
80
  activeNumberOfActivations: number;
70
81
  maxNumberOfActivations: number;
82
+ offlineActivationsAllowed: boolean;
71
83
  }>;
72
84
  }, "strip", z.ZodTypeAny, {
73
85
  status: ActivationStatus;
74
86
  id: string;
75
87
  name: string;
88
+ signature: string;
76
89
  activationMethod: ActivationMethod;
77
90
  lastValidatedAt: Date;
78
91
  license: {
79
92
  status: LicenseStatus;
80
93
  id: string;
94
+ productId: string;
95
+ ownerId: string;
81
96
  activeNumberOfActivations: number;
82
97
  maxNumberOfActivations: number;
98
+ offlineActivationsAllowed: boolean;
83
99
  };
84
100
  }, {
85
101
  status: ActivationStatus;
86
102
  id: string;
87
103
  name: string;
104
+ signature: string;
88
105
  activationMethod: ActivationMethod;
89
106
  lastValidatedAt: Date;
90
107
  license: {
91
108
  status: LicenseStatus;
92
109
  id: string;
110
+ productId: string;
111
+ ownerId: string;
93
112
  activeNumberOfActivations: number;
94
113
  maxNumberOfActivations: number;
114
+ offlineActivationsAllowed: boolean;
95
115
  };
96
116
  }>>;
97
117
  trial: z.ZodOptional<z.ZodObject<{
98
118
  id: z.ZodString;
119
+ productId: z.ZodString;
120
+ deviceName: z.ZodString;
121
+ deviceSignature: z.ZodString;
99
122
  status: z.ZodNativeEnum<typeof TrialStatus>;
100
123
  expiresAt: z.ZodDate;
101
124
  lastValidatedAt: z.ZodDate;
@@ -103,13 +126,19 @@ declare const activationRequestSchema: z.ZodObject<{
103
126
  }, "strip", z.ZodTypeAny, {
104
127
  status: TrialStatus;
105
128
  id: string;
129
+ productId: string;
106
130
  lastValidatedAt: Date;
131
+ deviceName: string;
132
+ deviceSignature: string;
107
133
  expiresAt: Date;
108
134
  ownerId?: string | undefined;
109
135
  }, {
110
136
  status: TrialStatus;
111
137
  id: string;
138
+ productId: string;
112
139
  lastValidatedAt: Date;
140
+ deviceName: string;
141
+ deviceSignature: string;
113
142
  expiresAt: Date;
114
143
  ownerId?: string | undefined;
115
144
  }>>;
@@ -204,6 +233,8 @@ declare const activationRequestSchema: z.ZodObject<{
204
233
  }, "strip", z.ZodTypeAny, {
205
234
  status: ActivationRequestStatus;
206
235
  id: string;
236
+ deviceName: string;
237
+ deviceSignature: string;
207
238
  product: {
208
239
  status: ProductStatus;
209
240
  id: string;
@@ -219,19 +250,26 @@ declare const activationRequestSchema: z.ZodObject<{
219
250
  status: ActivationStatus;
220
251
  id: string;
221
252
  name: string;
253
+ signature: string;
222
254
  activationMethod: ActivationMethod;
223
255
  lastValidatedAt: Date;
224
256
  license: {
225
257
  status: LicenseStatus;
226
258
  id: string;
259
+ productId: string;
260
+ ownerId: string;
227
261
  activeNumberOfActivations: number;
228
262
  maxNumberOfActivations: number;
263
+ offlineActivationsAllowed: boolean;
229
264
  };
230
265
  } | undefined;
231
266
  trial?: {
232
267
  status: TrialStatus;
233
268
  id: string;
269
+ productId: string;
234
270
  lastValidatedAt: Date;
271
+ deviceName: string;
272
+ deviceSignature: string;
235
273
  expiresAt: Date;
236
274
  ownerId?: string | undefined;
237
275
  } | undefined;
@@ -262,6 +300,8 @@ declare const activationRequestSchema: z.ZodObject<{
262
300
  }, {
263
301
  status: ActivationRequestStatus;
264
302
  id: string;
303
+ deviceName: string;
304
+ deviceSignature: string;
265
305
  product: {
266
306
  status: ProductStatus;
267
307
  id: string;
@@ -277,19 +317,26 @@ declare const activationRequestSchema: z.ZodObject<{
277
317
  status: ActivationStatus;
278
318
  id: string;
279
319
  name: string;
320
+ signature: string;
280
321
  activationMethod: ActivationMethod;
281
322
  lastValidatedAt: Date;
282
323
  license: {
283
324
  status: LicenseStatus;
284
325
  id: string;
326
+ productId: string;
327
+ ownerId: string;
285
328
  activeNumberOfActivations: number;
286
329
  maxNumberOfActivations: number;
330
+ offlineActivationsAllowed: boolean;
287
331
  };
288
332
  } | undefined;
289
333
  trial?: {
290
334
  status: TrialStatus;
291
335
  id: string;
336
+ productId: string;
292
337
  lastValidatedAt: Date;
338
+ deviceName: string;
339
+ deviceSignature: string;
293
340
  expiresAt: Date;
294
341
  ownerId?: string | undefined;
295
342
  } | undefined;
@@ -330,7 +377,10 @@ declare class ActivationRequestEndpoints {
330
377
  private api;
331
378
  constructor(api: MoonbaseApi);
332
379
  get(requestId: string): Promise<ActivationRequest>;
333
- request(productId: string): Promise<ActivationRequest>;
380
+ request(productId: string, target: {
381
+ deviceName: string;
382
+ deviceSignature: string;
383
+ }): Promise<ActivationRequest>;
334
384
  }
335
385
 
336
386
  declare const customerSchema: z.ZodObject<{
@@ -430,91 +480,6 @@ declare class CustomerEndpoints {
430
480
  get(idOrEmail: string): Promise<Customer>;
431
481
  }
432
482
 
433
- declare const licenseSchema: z.ZodObject<{
434
- id: z.ZodString;
435
- status: z.ZodNativeEnum<typeof LicenseStatus>;
436
- activeNumberOfActivations: z.ZodNumber;
437
- maxNumberOfActivations: z.ZodNumber;
438
- }, "strip", z.ZodTypeAny, {
439
- status: LicenseStatus;
440
- id: string;
441
- activeNumberOfActivations: number;
442
- maxNumberOfActivations: number;
443
- }, {
444
- status: LicenseStatus;
445
- id: string;
446
- activeNumberOfActivations: number;
447
- maxNumberOfActivations: number;
448
- }>;
449
- declare const licenseActivationSchema: z.ZodObject<{
450
- id: z.ZodString;
451
- name: z.ZodString;
452
- status: z.ZodNativeEnum<typeof ActivationStatus>;
453
- activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
454
- lastValidatedAt: z.ZodDate;
455
- license: z.ZodObject<{
456
- id: z.ZodString;
457
- status: z.ZodNativeEnum<typeof LicenseStatus>;
458
- activeNumberOfActivations: z.ZodNumber;
459
- maxNumberOfActivations: z.ZodNumber;
460
- }, "strip", z.ZodTypeAny, {
461
- status: LicenseStatus;
462
- id: string;
463
- activeNumberOfActivations: number;
464
- maxNumberOfActivations: number;
465
- }, {
466
- status: LicenseStatus;
467
- id: string;
468
- activeNumberOfActivations: number;
469
- maxNumberOfActivations: number;
470
- }>;
471
- }, "strip", z.ZodTypeAny, {
472
- status: ActivationStatus;
473
- id: string;
474
- name: string;
475
- activationMethod: ActivationMethod;
476
- lastValidatedAt: Date;
477
- license: {
478
- status: LicenseStatus;
479
- id: string;
480
- activeNumberOfActivations: number;
481
- maxNumberOfActivations: number;
482
- };
483
- }, {
484
- status: ActivationStatus;
485
- id: string;
486
- name: string;
487
- activationMethod: ActivationMethod;
488
- lastValidatedAt: Date;
489
- license: {
490
- status: LicenseStatus;
491
- id: string;
492
- activeNumberOfActivations: number;
493
- maxNumberOfActivations: number;
494
- };
495
- }>;
496
-
497
- declare enum LicenseStatus {
498
- Active = "Active",
499
- Revoked = "Revoked"
500
- }
501
- declare enum ActivationStatus {
502
- Active = "Active",
503
- Revoked = "Revoked"
504
- }
505
- declare enum ActivationMethod {
506
- Online = "Online",
507
- Offline = "Offline"
508
- }
509
- type License = z.infer<typeof licenseSchema>;
510
- type LicenseActivation = z.infer<typeof licenseActivationSchema>;
511
-
512
- declare class LicenseEndpoints {
513
- private api;
514
- constructor(api: MoonbaseApi);
515
- validate(licenseId: string, activationId: string): Promise<LicenseActivation>;
516
- }
517
-
518
483
  declare const pricingVariationSchema: z.ZodObject<{
519
484
  id: z.ZodString;
520
485
  name: z.ZodString;
@@ -604,6 +569,131 @@ interface Quantifiable<T> {
604
569
  quantity: number;
605
570
  }
606
571
 
572
+ declare const licenseSchema: z.ZodObject<{
573
+ id: z.ZodString;
574
+ productId: z.ZodString;
575
+ ownerId: z.ZodString;
576
+ status: z.ZodNativeEnum<typeof LicenseStatus>;
577
+ activeNumberOfActivations: z.ZodNumber;
578
+ maxNumberOfActivations: z.ZodNumber;
579
+ offlineActivationsAllowed: z.ZodBoolean;
580
+ }, "strip", z.ZodTypeAny, {
581
+ status: LicenseStatus;
582
+ id: string;
583
+ productId: string;
584
+ ownerId: string;
585
+ activeNumberOfActivations: number;
586
+ maxNumberOfActivations: number;
587
+ offlineActivationsAllowed: boolean;
588
+ }, {
589
+ status: LicenseStatus;
590
+ id: string;
591
+ productId: string;
592
+ ownerId: string;
593
+ activeNumberOfActivations: number;
594
+ maxNumberOfActivations: number;
595
+ offlineActivationsAllowed: boolean;
596
+ }>;
597
+ declare const licenseActivationSchema: z.ZodObject<{
598
+ id: z.ZodString;
599
+ name: z.ZodString;
600
+ signature: z.ZodString;
601
+ status: z.ZodNativeEnum<typeof ActivationStatus>;
602
+ activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
603
+ lastValidatedAt: z.ZodDate;
604
+ license: z.ZodObject<{
605
+ id: z.ZodString;
606
+ productId: z.ZodString;
607
+ ownerId: z.ZodString;
608
+ status: z.ZodNativeEnum<typeof LicenseStatus>;
609
+ activeNumberOfActivations: z.ZodNumber;
610
+ maxNumberOfActivations: z.ZodNumber;
611
+ offlineActivationsAllowed: z.ZodBoolean;
612
+ }, "strip", z.ZodTypeAny, {
613
+ status: LicenseStatus;
614
+ id: string;
615
+ productId: string;
616
+ ownerId: string;
617
+ activeNumberOfActivations: number;
618
+ maxNumberOfActivations: number;
619
+ offlineActivationsAllowed: boolean;
620
+ }, {
621
+ status: LicenseStatus;
622
+ id: string;
623
+ productId: string;
624
+ ownerId: string;
625
+ activeNumberOfActivations: number;
626
+ maxNumberOfActivations: number;
627
+ offlineActivationsAllowed: boolean;
628
+ }>;
629
+ }, "strip", z.ZodTypeAny, {
630
+ status: ActivationStatus;
631
+ id: string;
632
+ name: string;
633
+ signature: string;
634
+ activationMethod: ActivationMethod;
635
+ lastValidatedAt: Date;
636
+ license: {
637
+ status: LicenseStatus;
638
+ id: string;
639
+ productId: string;
640
+ ownerId: string;
641
+ activeNumberOfActivations: number;
642
+ maxNumberOfActivations: number;
643
+ offlineActivationsAllowed: boolean;
644
+ };
645
+ }, {
646
+ status: ActivationStatus;
647
+ id: string;
648
+ name: string;
649
+ signature: string;
650
+ activationMethod: ActivationMethod;
651
+ lastValidatedAt: Date;
652
+ license: {
653
+ status: LicenseStatus;
654
+ id: string;
655
+ productId: string;
656
+ ownerId: string;
657
+ activeNumberOfActivations: number;
658
+ maxNumberOfActivations: number;
659
+ offlineActivationsAllowed: boolean;
660
+ };
661
+ }>;
662
+
663
+ declare enum LicenseStatus {
664
+ Active = "Active",
665
+ Revoked = "Revoked"
666
+ }
667
+ declare enum ActivationStatus {
668
+ Active = "Active",
669
+ Revoked = "Revoked"
670
+ }
671
+ declare enum ActivationMethod {
672
+ Online = "Online",
673
+ Offline = "Offline"
674
+ }
675
+ type License = z.infer<typeof licenseSchema>;
676
+ type LicenseActivation = z.infer<typeof licenseActivationSchema>;
677
+
678
+ declare class LicenseEndpoints {
679
+ private api;
680
+ constructor(api: MoonbaseApi);
681
+ query(opts?: {
682
+ paginationToken?: string;
683
+ productFilter?: string;
684
+ pageSize?: number;
685
+ }): Promise<Page<License>>;
686
+ get(licenseId: string): Promise<License>;
687
+ revoke(licenseId: string): Promise<License>;
688
+ queryActivations(licenseId: string, opts?: {
689
+ paginationToken?: string;
690
+ productFilter?: string;
691
+ pageSize?: number;
692
+ }): Promise<Page<LicenseActivation>>;
693
+ validateActivation(licenseId: string, activationId: string): Promise<LicenseActivation>;
694
+ revokeActivation(licenseId: string, activationId: string): Promise<LicenseActivation>;
695
+ }
696
+
607
697
  declare const productSchema: z.ZodObject<{
608
698
  id: z.ZodString;
609
699
  name: z.ZodString;
@@ -655,6 +745,9 @@ declare class ProductEndpoints {
655
745
 
656
746
  declare const trialSchema: z.ZodObject<{
657
747
  id: z.ZodString;
748
+ productId: z.ZodString;
749
+ deviceName: z.ZodString;
750
+ deviceSignature: z.ZodString;
658
751
  status: z.ZodNativeEnum<typeof TrialStatus>;
659
752
  expiresAt: z.ZodDate;
660
753
  lastValidatedAt: z.ZodDate;
@@ -662,13 +755,19 @@ declare const trialSchema: z.ZodObject<{
662
755
  }, "strip", z.ZodTypeAny, {
663
756
  status: TrialStatus;
664
757
  id: string;
758
+ productId: string;
665
759
  lastValidatedAt: Date;
760
+ deviceName: string;
761
+ deviceSignature: string;
666
762
  expiresAt: Date;
667
763
  ownerId?: string | undefined;
668
764
  }, {
669
765
  status: TrialStatus;
670
766
  id: string;
767
+ productId: string;
671
768
  lastValidatedAt: Date;
769
+ deviceName: string;
770
+ deviceSignature: string;
672
771
  expiresAt: Date;
673
772
  ownerId?: string | undefined;
674
773
  }>;
package/dist/index.d.ts CHANGED
@@ -15,6 +15,8 @@ declare class MoonbaseApi {
15
15
 
16
16
  declare const activationRequestSchema: z.ZodObject<{
17
17
  id: z.ZodString;
18
+ deviceName: z.ZodString;
19
+ deviceSignature: z.ZodString;
18
20
  status: z.ZodNativeEnum<typeof ActivationRequestStatus>;
19
21
  product: z.ZodObject<{
20
22
  id: z.ZodString;
@@ -50,52 +52,73 @@ declare const activationRequestSchema: z.ZodObject<{
50
52
  activation: z.ZodOptional<z.ZodObject<{
51
53
  id: z.ZodString;
52
54
  name: z.ZodString;
55
+ signature: z.ZodString;
53
56
  status: z.ZodNativeEnum<typeof ActivationStatus>;
54
57
  activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
55
58
  lastValidatedAt: z.ZodDate;
56
59
  license: z.ZodObject<{
57
60
  id: z.ZodString;
61
+ productId: z.ZodString;
62
+ ownerId: z.ZodString;
58
63
  status: z.ZodNativeEnum<typeof LicenseStatus>;
59
64
  activeNumberOfActivations: z.ZodNumber;
60
65
  maxNumberOfActivations: z.ZodNumber;
66
+ offlineActivationsAllowed: z.ZodBoolean;
61
67
  }, "strip", z.ZodTypeAny, {
62
68
  status: LicenseStatus;
63
69
  id: string;
70
+ productId: string;
71
+ ownerId: string;
64
72
  activeNumberOfActivations: number;
65
73
  maxNumberOfActivations: number;
74
+ offlineActivationsAllowed: boolean;
66
75
  }, {
67
76
  status: LicenseStatus;
68
77
  id: string;
78
+ productId: string;
79
+ ownerId: string;
69
80
  activeNumberOfActivations: number;
70
81
  maxNumberOfActivations: number;
82
+ offlineActivationsAllowed: boolean;
71
83
  }>;
72
84
  }, "strip", z.ZodTypeAny, {
73
85
  status: ActivationStatus;
74
86
  id: string;
75
87
  name: string;
88
+ signature: string;
76
89
  activationMethod: ActivationMethod;
77
90
  lastValidatedAt: Date;
78
91
  license: {
79
92
  status: LicenseStatus;
80
93
  id: string;
94
+ productId: string;
95
+ ownerId: string;
81
96
  activeNumberOfActivations: number;
82
97
  maxNumberOfActivations: number;
98
+ offlineActivationsAllowed: boolean;
83
99
  };
84
100
  }, {
85
101
  status: ActivationStatus;
86
102
  id: string;
87
103
  name: string;
104
+ signature: string;
88
105
  activationMethod: ActivationMethod;
89
106
  lastValidatedAt: Date;
90
107
  license: {
91
108
  status: LicenseStatus;
92
109
  id: string;
110
+ productId: string;
111
+ ownerId: string;
93
112
  activeNumberOfActivations: number;
94
113
  maxNumberOfActivations: number;
114
+ offlineActivationsAllowed: boolean;
95
115
  };
96
116
  }>>;
97
117
  trial: z.ZodOptional<z.ZodObject<{
98
118
  id: z.ZodString;
119
+ productId: z.ZodString;
120
+ deviceName: z.ZodString;
121
+ deviceSignature: z.ZodString;
99
122
  status: z.ZodNativeEnum<typeof TrialStatus>;
100
123
  expiresAt: z.ZodDate;
101
124
  lastValidatedAt: z.ZodDate;
@@ -103,13 +126,19 @@ declare const activationRequestSchema: z.ZodObject<{
103
126
  }, "strip", z.ZodTypeAny, {
104
127
  status: TrialStatus;
105
128
  id: string;
129
+ productId: string;
106
130
  lastValidatedAt: Date;
131
+ deviceName: string;
132
+ deviceSignature: string;
107
133
  expiresAt: Date;
108
134
  ownerId?: string | undefined;
109
135
  }, {
110
136
  status: TrialStatus;
111
137
  id: string;
138
+ productId: string;
112
139
  lastValidatedAt: Date;
140
+ deviceName: string;
141
+ deviceSignature: string;
113
142
  expiresAt: Date;
114
143
  ownerId?: string | undefined;
115
144
  }>>;
@@ -204,6 +233,8 @@ declare const activationRequestSchema: z.ZodObject<{
204
233
  }, "strip", z.ZodTypeAny, {
205
234
  status: ActivationRequestStatus;
206
235
  id: string;
236
+ deviceName: string;
237
+ deviceSignature: string;
207
238
  product: {
208
239
  status: ProductStatus;
209
240
  id: string;
@@ -219,19 +250,26 @@ declare const activationRequestSchema: z.ZodObject<{
219
250
  status: ActivationStatus;
220
251
  id: string;
221
252
  name: string;
253
+ signature: string;
222
254
  activationMethod: ActivationMethod;
223
255
  lastValidatedAt: Date;
224
256
  license: {
225
257
  status: LicenseStatus;
226
258
  id: string;
259
+ productId: string;
260
+ ownerId: string;
227
261
  activeNumberOfActivations: number;
228
262
  maxNumberOfActivations: number;
263
+ offlineActivationsAllowed: boolean;
229
264
  };
230
265
  } | undefined;
231
266
  trial?: {
232
267
  status: TrialStatus;
233
268
  id: string;
269
+ productId: string;
234
270
  lastValidatedAt: Date;
271
+ deviceName: string;
272
+ deviceSignature: string;
235
273
  expiresAt: Date;
236
274
  ownerId?: string | undefined;
237
275
  } | undefined;
@@ -262,6 +300,8 @@ declare const activationRequestSchema: z.ZodObject<{
262
300
  }, {
263
301
  status: ActivationRequestStatus;
264
302
  id: string;
303
+ deviceName: string;
304
+ deviceSignature: string;
265
305
  product: {
266
306
  status: ProductStatus;
267
307
  id: string;
@@ -277,19 +317,26 @@ declare const activationRequestSchema: z.ZodObject<{
277
317
  status: ActivationStatus;
278
318
  id: string;
279
319
  name: string;
320
+ signature: string;
280
321
  activationMethod: ActivationMethod;
281
322
  lastValidatedAt: Date;
282
323
  license: {
283
324
  status: LicenseStatus;
284
325
  id: string;
326
+ productId: string;
327
+ ownerId: string;
285
328
  activeNumberOfActivations: number;
286
329
  maxNumberOfActivations: number;
330
+ offlineActivationsAllowed: boolean;
287
331
  };
288
332
  } | undefined;
289
333
  trial?: {
290
334
  status: TrialStatus;
291
335
  id: string;
336
+ productId: string;
292
337
  lastValidatedAt: Date;
338
+ deviceName: string;
339
+ deviceSignature: string;
293
340
  expiresAt: Date;
294
341
  ownerId?: string | undefined;
295
342
  } | undefined;
@@ -330,7 +377,10 @@ declare class ActivationRequestEndpoints {
330
377
  private api;
331
378
  constructor(api: MoonbaseApi);
332
379
  get(requestId: string): Promise<ActivationRequest>;
333
- request(productId: string): Promise<ActivationRequest>;
380
+ request(productId: string, target: {
381
+ deviceName: string;
382
+ deviceSignature: string;
383
+ }): Promise<ActivationRequest>;
334
384
  }
335
385
 
336
386
  declare const customerSchema: z.ZodObject<{
@@ -430,91 +480,6 @@ declare class CustomerEndpoints {
430
480
  get(idOrEmail: string): Promise<Customer>;
431
481
  }
432
482
 
433
- declare const licenseSchema: z.ZodObject<{
434
- id: z.ZodString;
435
- status: z.ZodNativeEnum<typeof LicenseStatus>;
436
- activeNumberOfActivations: z.ZodNumber;
437
- maxNumberOfActivations: z.ZodNumber;
438
- }, "strip", z.ZodTypeAny, {
439
- status: LicenseStatus;
440
- id: string;
441
- activeNumberOfActivations: number;
442
- maxNumberOfActivations: number;
443
- }, {
444
- status: LicenseStatus;
445
- id: string;
446
- activeNumberOfActivations: number;
447
- maxNumberOfActivations: number;
448
- }>;
449
- declare const licenseActivationSchema: z.ZodObject<{
450
- id: z.ZodString;
451
- name: z.ZodString;
452
- status: z.ZodNativeEnum<typeof ActivationStatus>;
453
- activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
454
- lastValidatedAt: z.ZodDate;
455
- license: z.ZodObject<{
456
- id: z.ZodString;
457
- status: z.ZodNativeEnum<typeof LicenseStatus>;
458
- activeNumberOfActivations: z.ZodNumber;
459
- maxNumberOfActivations: z.ZodNumber;
460
- }, "strip", z.ZodTypeAny, {
461
- status: LicenseStatus;
462
- id: string;
463
- activeNumberOfActivations: number;
464
- maxNumberOfActivations: number;
465
- }, {
466
- status: LicenseStatus;
467
- id: string;
468
- activeNumberOfActivations: number;
469
- maxNumberOfActivations: number;
470
- }>;
471
- }, "strip", z.ZodTypeAny, {
472
- status: ActivationStatus;
473
- id: string;
474
- name: string;
475
- activationMethod: ActivationMethod;
476
- lastValidatedAt: Date;
477
- license: {
478
- status: LicenseStatus;
479
- id: string;
480
- activeNumberOfActivations: number;
481
- maxNumberOfActivations: number;
482
- };
483
- }, {
484
- status: ActivationStatus;
485
- id: string;
486
- name: string;
487
- activationMethod: ActivationMethod;
488
- lastValidatedAt: Date;
489
- license: {
490
- status: LicenseStatus;
491
- id: string;
492
- activeNumberOfActivations: number;
493
- maxNumberOfActivations: number;
494
- };
495
- }>;
496
-
497
- declare enum LicenseStatus {
498
- Active = "Active",
499
- Revoked = "Revoked"
500
- }
501
- declare enum ActivationStatus {
502
- Active = "Active",
503
- Revoked = "Revoked"
504
- }
505
- declare enum ActivationMethod {
506
- Online = "Online",
507
- Offline = "Offline"
508
- }
509
- type License = z.infer<typeof licenseSchema>;
510
- type LicenseActivation = z.infer<typeof licenseActivationSchema>;
511
-
512
- declare class LicenseEndpoints {
513
- private api;
514
- constructor(api: MoonbaseApi);
515
- validate(licenseId: string, activationId: string): Promise<LicenseActivation>;
516
- }
517
-
518
483
  declare const pricingVariationSchema: z.ZodObject<{
519
484
  id: z.ZodString;
520
485
  name: z.ZodString;
@@ -604,6 +569,131 @@ interface Quantifiable<T> {
604
569
  quantity: number;
605
570
  }
606
571
 
572
+ declare const licenseSchema: z.ZodObject<{
573
+ id: z.ZodString;
574
+ productId: z.ZodString;
575
+ ownerId: z.ZodString;
576
+ status: z.ZodNativeEnum<typeof LicenseStatus>;
577
+ activeNumberOfActivations: z.ZodNumber;
578
+ maxNumberOfActivations: z.ZodNumber;
579
+ offlineActivationsAllowed: z.ZodBoolean;
580
+ }, "strip", z.ZodTypeAny, {
581
+ status: LicenseStatus;
582
+ id: string;
583
+ productId: string;
584
+ ownerId: string;
585
+ activeNumberOfActivations: number;
586
+ maxNumberOfActivations: number;
587
+ offlineActivationsAllowed: boolean;
588
+ }, {
589
+ status: LicenseStatus;
590
+ id: string;
591
+ productId: string;
592
+ ownerId: string;
593
+ activeNumberOfActivations: number;
594
+ maxNumberOfActivations: number;
595
+ offlineActivationsAllowed: boolean;
596
+ }>;
597
+ declare const licenseActivationSchema: z.ZodObject<{
598
+ id: z.ZodString;
599
+ name: z.ZodString;
600
+ signature: z.ZodString;
601
+ status: z.ZodNativeEnum<typeof ActivationStatus>;
602
+ activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
603
+ lastValidatedAt: z.ZodDate;
604
+ license: z.ZodObject<{
605
+ id: z.ZodString;
606
+ productId: z.ZodString;
607
+ ownerId: z.ZodString;
608
+ status: z.ZodNativeEnum<typeof LicenseStatus>;
609
+ activeNumberOfActivations: z.ZodNumber;
610
+ maxNumberOfActivations: z.ZodNumber;
611
+ offlineActivationsAllowed: z.ZodBoolean;
612
+ }, "strip", z.ZodTypeAny, {
613
+ status: LicenseStatus;
614
+ id: string;
615
+ productId: string;
616
+ ownerId: string;
617
+ activeNumberOfActivations: number;
618
+ maxNumberOfActivations: number;
619
+ offlineActivationsAllowed: boolean;
620
+ }, {
621
+ status: LicenseStatus;
622
+ id: string;
623
+ productId: string;
624
+ ownerId: string;
625
+ activeNumberOfActivations: number;
626
+ maxNumberOfActivations: number;
627
+ offlineActivationsAllowed: boolean;
628
+ }>;
629
+ }, "strip", z.ZodTypeAny, {
630
+ status: ActivationStatus;
631
+ id: string;
632
+ name: string;
633
+ signature: string;
634
+ activationMethod: ActivationMethod;
635
+ lastValidatedAt: Date;
636
+ license: {
637
+ status: LicenseStatus;
638
+ id: string;
639
+ productId: string;
640
+ ownerId: string;
641
+ activeNumberOfActivations: number;
642
+ maxNumberOfActivations: number;
643
+ offlineActivationsAllowed: boolean;
644
+ };
645
+ }, {
646
+ status: ActivationStatus;
647
+ id: string;
648
+ name: string;
649
+ signature: string;
650
+ activationMethod: ActivationMethod;
651
+ lastValidatedAt: Date;
652
+ license: {
653
+ status: LicenseStatus;
654
+ id: string;
655
+ productId: string;
656
+ ownerId: string;
657
+ activeNumberOfActivations: number;
658
+ maxNumberOfActivations: number;
659
+ offlineActivationsAllowed: boolean;
660
+ };
661
+ }>;
662
+
663
+ declare enum LicenseStatus {
664
+ Active = "Active",
665
+ Revoked = "Revoked"
666
+ }
667
+ declare enum ActivationStatus {
668
+ Active = "Active",
669
+ Revoked = "Revoked"
670
+ }
671
+ declare enum ActivationMethod {
672
+ Online = "Online",
673
+ Offline = "Offline"
674
+ }
675
+ type License = z.infer<typeof licenseSchema>;
676
+ type LicenseActivation = z.infer<typeof licenseActivationSchema>;
677
+
678
+ declare class LicenseEndpoints {
679
+ private api;
680
+ constructor(api: MoonbaseApi);
681
+ query(opts?: {
682
+ paginationToken?: string;
683
+ productFilter?: string;
684
+ pageSize?: number;
685
+ }): Promise<Page<License>>;
686
+ get(licenseId: string): Promise<License>;
687
+ revoke(licenseId: string): Promise<License>;
688
+ queryActivations(licenseId: string, opts?: {
689
+ paginationToken?: string;
690
+ productFilter?: string;
691
+ pageSize?: number;
692
+ }): Promise<Page<LicenseActivation>>;
693
+ validateActivation(licenseId: string, activationId: string): Promise<LicenseActivation>;
694
+ revokeActivation(licenseId: string, activationId: string): Promise<LicenseActivation>;
695
+ }
696
+
607
697
  declare const productSchema: z.ZodObject<{
608
698
  id: z.ZodString;
609
699
  name: z.ZodString;
@@ -655,6 +745,9 @@ declare class ProductEndpoints {
655
745
 
656
746
  declare const trialSchema: z.ZodObject<{
657
747
  id: z.ZodString;
748
+ productId: z.ZodString;
749
+ deviceName: z.ZodString;
750
+ deviceSignature: z.ZodString;
658
751
  status: z.ZodNativeEnum<typeof TrialStatus>;
659
752
  expiresAt: z.ZodDate;
660
753
  lastValidatedAt: z.ZodDate;
@@ -662,13 +755,19 @@ declare const trialSchema: z.ZodObject<{
662
755
  }, "strip", z.ZodTypeAny, {
663
756
  status: TrialStatus;
664
757
  id: string;
758
+ productId: string;
665
759
  lastValidatedAt: Date;
760
+ deviceName: string;
761
+ deviceSignature: string;
666
762
  expiresAt: Date;
667
763
  ownerId?: string | undefined;
668
764
  }, {
669
765
  status: TrialStatus;
670
766
  id: string;
767
+ productId: string;
671
768
  lastValidatedAt: Date;
769
+ deviceName: string;
770
+ deviceSignature: string;
672
771
  expiresAt: Date;
673
772
  ownerId?: string | undefined;
674
773
  }>;
package/dist/index.js CHANGED
@@ -54,13 +54,17 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
54
54
  // src/licenses/schemas.ts
55
55
  var licenseSchema = z2.object({
56
56
  id: z2.string(),
57
+ productId: z2.string(),
58
+ ownerId: z2.string(),
57
59
  status: z2.nativeEnum(LicenseStatus),
58
60
  activeNumberOfActivations: z2.number(),
59
- maxNumberOfActivations: z2.number()
61
+ maxNumberOfActivations: z2.number(),
62
+ offlineActivationsAllowed: z2.boolean()
60
63
  });
61
64
  var licenseActivationSchema = z2.object({
62
65
  id: z2.string(),
63
66
  name: z2.string(),
67
+ signature: z2.string(),
64
68
  status: z2.nativeEnum(ActivationStatus),
65
69
  activationMethod: z2.nativeEnum(ActivationMethod),
66
70
  lastValidatedAt: z2.coerce.date(),
@@ -103,6 +107,9 @@ var TrialStatus = /* @__PURE__ */ ((TrialStatus2) => {
103
107
  // src/trials/schemas.ts
104
108
  var trialSchema = z4.object({
105
109
  id: z4.string(),
110
+ productId: z4.string(),
111
+ deviceName: z4.string(),
112
+ deviceSignature: z4.string(),
106
113
  status: z4.nativeEnum(TrialStatus),
107
114
  expiresAt: z4.coerce.date(),
108
115
  lastValidatedAt: z4.coerce.date(),
@@ -120,6 +127,8 @@ var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
120
127
  // src/activationRequests/schemas.ts
121
128
  var activationRequestSchema = z5.object({
122
129
  id: z5.string(),
130
+ deviceName: z5.string(),
131
+ deviceSignature: z5.string(),
123
132
  status: z5.nativeEnum(ActivationRequestStatus),
124
133
  product: productSchema,
125
134
  activation: licenseActivationSchema.optional(),
@@ -136,8 +145,8 @@ var ActivationRequestEndpoints = class {
136
145
  const response = await this.api.fetch(`/api/activations/${requestId}`);
137
146
  return activationRequestSchema.parse(response.data);
138
147
  }
139
- async request(productId) {
140
- const response = await this.api.fetch(`/api/activations/${productId}/request`);
148
+ async request(productId, target) {
149
+ const response = await this.api.fetch(`/api/activations/${productId}/request`, "POST", target);
141
150
  return activationRequestSchema.parse(response.data);
142
151
  }
143
152
  };
@@ -153,17 +162,6 @@ var CustomerEndpoints = class {
153
162
  }
154
163
  };
155
164
 
156
- // src/licenses/endpoints.ts
157
- var LicenseEndpoints = class {
158
- constructor(api) {
159
- this.api = api;
160
- }
161
- async validate(licenseId, activationId) {
162
- const response = await this.api.fetch(`/api/licenses/${licenseId}/activations/${activationId}/validate`, "POST");
163
- return licenseActivationSchema.parse(response.data);
164
- }
165
- };
166
-
167
165
  // src/globalSchemas.ts
168
166
  import { z as z6 } from "zod";
169
167
  var priceCollectionSchema = z6.record(z6.number());
@@ -292,6 +290,37 @@ var MoonbaseApi = class {
292
290
  }
293
291
  };
294
292
 
293
+ // src/licenses/endpoints.ts
294
+ var LicenseEndpoints = class {
295
+ constructor(api) {
296
+ this.api = api;
297
+ }
298
+ async query(opts) {
299
+ const response = await this.api.fetch(`/api/licenses?${objectToQuery(opts)}`);
300
+ return paged(licenseSchema).parse(response.data);
301
+ }
302
+ async get(licenseId) {
303
+ const response = await this.api.fetch(`/api/licenses/${licenseId}`);
304
+ return licenseSchema.parse(response.data);
305
+ }
306
+ async revoke(licenseId) {
307
+ const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
308
+ return licenseSchema.parse(response.data);
309
+ }
310
+ async queryActivations(licenseId, opts) {
311
+ const response = await this.api.fetch(`/api/licenses/${licenseId}/activations?${objectToQuery(opts)}`);
312
+ return paged(licenseActivationSchema).parse(response.data);
313
+ }
314
+ async validateActivation(licenseId, activationId) {
315
+ const response = await this.api.fetch(`/api/licenses/${licenseId}/activations/${activationId}/validate`, "POST");
316
+ return licenseActivationSchema.parse(response.data);
317
+ }
318
+ async revokeActivation(licenseId, activationId) {
319
+ const response = await this.api.fetch(`/api/licenses/${licenseId}/activations/${activationId}/revoke`, "POST");
320
+ return licenseActivationSchema.parse(response.data);
321
+ }
322
+ };
323
+
295
324
  // src/products/endpoints.ts
296
325
  var ProductEndpoints = class {
297
326
  constructor(api) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/api",
3
3
  "type": "module",
4
- "version": "0.1.109",
4
+ "version": "0.1.111",
5
5
  "description": "Package to let you integrate backends with Moonbase.sh as payment and delivery provider",
6
6
  "author": "Tobias Lønnerød Madsen <m@dsen.tv>",
7
7
  "license": "MIT",