@moonbase.sh/api 0.1.111 → 0.1.112

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
@@ -76,6 +76,12 @@ var customerSchema = import_zod.z.object({
76
76
  address: addressSchema.nullable(),
77
77
  communicationPreferences: communicationPreferencesSchema
78
78
  });
79
+ var importCustomerRequestSchema = import_zod.z.object({
80
+ name: import_zod.z.string(),
81
+ email: import_zod.z.string(),
82
+ password: import_zod.z.string().optional(),
83
+ address: addressSchema.optional()
84
+ });
79
85
 
80
86
  // src/licenses/schemas.ts
81
87
  var import_zod2 = require("zod");
@@ -100,6 +106,7 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
100
106
  // src/licenses/schemas.ts
101
107
  var licenseSchema = import_zod2.z.object({
102
108
  id: import_zod2.z.string(),
109
+ externalId: import_zod2.z.string().optional(),
103
110
  productId: import_zod2.z.string(),
104
111
  ownerId: import_zod2.z.string(),
105
112
  status: import_zod2.z.nativeEnum(LicenseStatus),
@@ -116,6 +123,20 @@ var licenseActivationSchema = import_zod2.z.object({
116
123
  lastValidatedAt: import_zod2.z.coerce.date(),
117
124
  license: licenseSchema
118
125
  });
126
+ var importLicenseRequestSchema = import_zod2.z.object({
127
+ customerId: import_zod2.z.string(),
128
+ productId: import_zod2.z.string(),
129
+ externalId: import_zod2.z.string().optional(),
130
+ createdAt: import_zod2.z.date().optional(),
131
+ maxNumberOfActivations: import_zod2.z.number().optional(),
132
+ offlineActivationsAllowed: import_zod2.z.boolean().optional(),
133
+ activations: import_zod2.z.object({
134
+ activationMethod: import_zod2.z.nativeEnum(ActivationMethod),
135
+ deviceName: import_zod2.z.string(),
136
+ deviceSignature: import_zod2.z.string(),
137
+ lastValidation: import_zod2.z.date().optional()
138
+ }).array().optional()
139
+ });
119
140
 
120
141
  // src/products/schemas.ts
121
142
  var import_zod3 = require("zod");
@@ -161,6 +182,15 @@ var trialSchema = import_zod4.z.object({
161
182
  lastValidatedAt: import_zod4.z.coerce.date(),
162
183
  ownerId: import_zod4.z.string().optional()
163
184
  });
185
+ var importTrialRequestSchema = import_zod4.z.object({
186
+ productId: import_zod4.z.string(),
187
+ deviceName: import_zod4.z.string(),
188
+ deviceSignature: import_zod4.z.string(),
189
+ expiresAt: import_zod4.z.date(),
190
+ customerId: import_zod4.z.string().optional(),
191
+ lastValidation: import_zod4.z.date().optional(),
192
+ createdAt: import_zod4.z.date().optional()
193
+ });
164
194
 
165
195
  // src/activationRequests/models.ts
166
196
  var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
@@ -206,6 +236,11 @@ var CustomerEndpoints = class {
206
236
  const response = await this.api.fetch(`/api/customers/${idOrEmail}`);
207
237
  return customerSchema.parse(response.data);
208
238
  }
239
+ async import(customer) {
240
+ const request = importCustomerRequestSchema.parse(customer);
241
+ const response = await this.api.fetch(`/api/customers/import`, "POST", request);
242
+ return customerSchema.parse(response.data);
243
+ }
209
244
  };
210
245
 
211
246
  // src/globalSchemas.ts
@@ -349,6 +384,11 @@ var LicenseEndpoints = class {
349
384
  const response = await this.api.fetch(`/api/licenses/${licenseId}`);
350
385
  return licenseSchema.parse(response.data);
351
386
  }
387
+ async import(license) {
388
+ const request = importLicenseRequestSchema.parse(license);
389
+ const response = await this.api.fetch(`/api/licenses/import`, "POST", request);
390
+ return licenseSchema.parse(response.data);
391
+ }
352
392
  async revoke(licenseId) {
353
393
  const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
354
394
  return licenseSchema.parse(response.data);
@@ -391,6 +431,11 @@ var TrialEndpoints = class {
391
431
  const response = await this.api.fetch(`/api/trials/${productId}/request`, "POST", target);
392
432
  return trialSchema.parse(response.data);
393
433
  }
434
+ async import(trial) {
435
+ const request = importTrialRequestSchema.parse(trial);
436
+ const response = await this.api.fetch(`/api/customers/import`, "POST", request);
437
+ return trialSchema.parse(response.data);
438
+ }
394
439
  };
395
440
 
396
441
  // src/index.ts
package/dist/index.d.cts CHANGED
@@ -58,6 +58,7 @@ declare const activationRequestSchema: z.ZodObject<{
58
58
  lastValidatedAt: z.ZodDate;
59
59
  license: z.ZodObject<{
60
60
  id: z.ZodString;
61
+ externalId: z.ZodOptional<z.ZodString>;
61
62
  productId: z.ZodString;
62
63
  ownerId: z.ZodString;
63
64
  status: z.ZodNativeEnum<typeof LicenseStatus>;
@@ -72,6 +73,7 @@ declare const activationRequestSchema: z.ZodObject<{
72
73
  activeNumberOfActivations: number;
73
74
  maxNumberOfActivations: number;
74
75
  offlineActivationsAllowed: boolean;
76
+ externalId?: string | undefined;
75
77
  }, {
76
78
  status: LicenseStatus;
77
79
  id: string;
@@ -80,6 +82,7 @@ declare const activationRequestSchema: z.ZodObject<{
80
82
  activeNumberOfActivations: number;
81
83
  maxNumberOfActivations: number;
82
84
  offlineActivationsAllowed: boolean;
85
+ externalId?: string | undefined;
83
86
  }>;
84
87
  }, "strip", z.ZodTypeAny, {
85
88
  status: ActivationStatus;
@@ -96,6 +99,7 @@ declare const activationRequestSchema: z.ZodObject<{
96
99
  activeNumberOfActivations: number;
97
100
  maxNumberOfActivations: number;
98
101
  offlineActivationsAllowed: boolean;
102
+ externalId?: string | undefined;
99
103
  };
100
104
  }, {
101
105
  status: ActivationStatus;
@@ -112,6 +116,7 @@ declare const activationRequestSchema: z.ZodObject<{
112
116
  activeNumberOfActivations: number;
113
117
  maxNumberOfActivations: number;
114
118
  offlineActivationsAllowed: boolean;
119
+ externalId?: string | undefined;
115
120
  };
116
121
  }>>;
117
122
  trial: z.ZodOptional<z.ZodObject<{
@@ -261,6 +266,7 @@ declare const activationRequestSchema: z.ZodObject<{
261
266
  activeNumberOfActivations: number;
262
267
  maxNumberOfActivations: number;
263
268
  offlineActivationsAllowed: boolean;
269
+ externalId?: string | undefined;
264
270
  };
265
271
  } | undefined;
266
272
  trial?: {
@@ -328,6 +334,7 @@ declare const activationRequestSchema: z.ZodObject<{
328
334
  activeNumberOfActivations: number;
329
335
  maxNumberOfActivations: number;
330
336
  offlineActivationsAllowed: boolean;
337
+ externalId?: string | undefined;
331
338
  };
332
339
  } | undefined;
333
340
  trial?: {
@@ -471,13 +478,66 @@ declare const customerSchema: z.ZodObject<{
471
478
  newsletterOptIn: boolean;
472
479
  };
473
480
  }>;
481
+ declare const importCustomerRequestSchema: z.ZodObject<{
482
+ name: z.ZodString;
483
+ email: z.ZodString;
484
+ password: z.ZodOptional<z.ZodString>;
485
+ address: z.ZodOptional<z.ZodObject<{
486
+ countryCode: z.ZodString;
487
+ streetAddress1: z.ZodString;
488
+ streetAddress2: z.ZodNullable<z.ZodString>;
489
+ locality: z.ZodNullable<z.ZodString>;
490
+ region: z.ZodNullable<z.ZodString>;
491
+ postCode: z.ZodString;
492
+ }, "strip", z.ZodTypeAny, {
493
+ countryCode: string;
494
+ streetAddress1: string;
495
+ streetAddress2: string | null;
496
+ locality: string | null;
497
+ region: string | null;
498
+ postCode: string;
499
+ }, {
500
+ countryCode: string;
501
+ streetAddress1: string;
502
+ streetAddress2: string | null;
503
+ locality: string | null;
504
+ region: string | null;
505
+ postCode: string;
506
+ }>>;
507
+ }, "strip", z.ZodTypeAny, {
508
+ name: string;
509
+ email: string;
510
+ password?: string | undefined;
511
+ address?: {
512
+ countryCode: string;
513
+ streetAddress1: string;
514
+ streetAddress2: string | null;
515
+ locality: string | null;
516
+ region: string | null;
517
+ postCode: string;
518
+ } | undefined;
519
+ }, {
520
+ name: string;
521
+ email: string;
522
+ password?: string | undefined;
523
+ address?: {
524
+ countryCode: string;
525
+ streetAddress1: string;
526
+ streetAddress2: string | null;
527
+ locality: string | null;
528
+ region: string | null;
529
+ postCode: string;
530
+ } | undefined;
531
+ }>;
474
532
 
475
533
  type Customer = z.infer<typeof customerSchema>;
534
+ type ImportCustomerRequest = z.infer<typeof importCustomerRequestSchema>;
476
535
 
477
536
  declare class CustomerEndpoints {
478
537
  private api;
479
538
  constructor(api: MoonbaseApi);
480
539
  get(idOrEmail: string): Promise<Customer>;
540
+ import(customer: ImportCustomerRequest): Promise<Customer>;
481
541
  }
482
542
 
483
543
  declare const pricingVariationSchema: z.ZodObject<{
@@ -571,6 +631,7 @@ interface Quantifiable<T> {
571
631
 
572
632
  declare const licenseSchema: z.ZodObject<{
573
633
  id: z.ZodString;
634
+ externalId: z.ZodOptional<z.ZodString>;
574
635
  productId: z.ZodString;
575
636
  ownerId: z.ZodString;
576
637
  status: z.ZodNativeEnum<typeof LicenseStatus>;
@@ -585,6 +646,7 @@ declare const licenseSchema: z.ZodObject<{
585
646
  activeNumberOfActivations: number;
586
647
  maxNumberOfActivations: number;
587
648
  offlineActivationsAllowed: boolean;
649
+ externalId?: string | undefined;
588
650
  }, {
589
651
  status: LicenseStatus;
590
652
  id: string;
@@ -593,6 +655,7 @@ declare const licenseSchema: z.ZodObject<{
593
655
  activeNumberOfActivations: number;
594
656
  maxNumberOfActivations: number;
595
657
  offlineActivationsAllowed: boolean;
658
+ externalId?: string | undefined;
596
659
  }>;
597
660
  declare const licenseActivationSchema: z.ZodObject<{
598
661
  id: z.ZodString;
@@ -603,6 +666,7 @@ declare const licenseActivationSchema: z.ZodObject<{
603
666
  lastValidatedAt: z.ZodDate;
604
667
  license: z.ZodObject<{
605
668
  id: z.ZodString;
669
+ externalId: z.ZodOptional<z.ZodString>;
606
670
  productId: z.ZodString;
607
671
  ownerId: z.ZodString;
608
672
  status: z.ZodNativeEnum<typeof LicenseStatus>;
@@ -617,6 +681,7 @@ declare const licenseActivationSchema: z.ZodObject<{
617
681
  activeNumberOfActivations: number;
618
682
  maxNumberOfActivations: number;
619
683
  offlineActivationsAllowed: boolean;
684
+ externalId?: string | undefined;
620
685
  }, {
621
686
  status: LicenseStatus;
622
687
  id: string;
@@ -625,6 +690,7 @@ declare const licenseActivationSchema: z.ZodObject<{
625
690
  activeNumberOfActivations: number;
626
691
  maxNumberOfActivations: number;
627
692
  offlineActivationsAllowed: boolean;
693
+ externalId?: string | undefined;
628
694
  }>;
629
695
  }, "strip", z.ZodTypeAny, {
630
696
  status: ActivationStatus;
@@ -641,6 +707,7 @@ declare const licenseActivationSchema: z.ZodObject<{
641
707
  activeNumberOfActivations: number;
642
708
  maxNumberOfActivations: number;
643
709
  offlineActivationsAllowed: boolean;
710
+ externalId?: string | undefined;
644
711
  };
645
712
  }, {
646
713
  status: ActivationStatus;
@@ -657,8 +724,59 @@ declare const licenseActivationSchema: z.ZodObject<{
657
724
  activeNumberOfActivations: number;
658
725
  maxNumberOfActivations: number;
659
726
  offlineActivationsAllowed: boolean;
727
+ externalId?: string | undefined;
660
728
  };
661
729
  }>;
730
+ declare const importLicenseRequestSchema: z.ZodObject<{
731
+ customerId: z.ZodString;
732
+ productId: z.ZodString;
733
+ externalId: z.ZodOptional<z.ZodString>;
734
+ createdAt: z.ZodOptional<z.ZodDate>;
735
+ maxNumberOfActivations: z.ZodOptional<z.ZodNumber>;
736
+ offlineActivationsAllowed: z.ZodOptional<z.ZodBoolean>;
737
+ activations: z.ZodOptional<z.ZodArray<z.ZodObject<{
738
+ activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
739
+ deviceName: z.ZodString;
740
+ deviceSignature: z.ZodString;
741
+ lastValidation: z.ZodOptional<z.ZodDate>;
742
+ }, "strip", z.ZodTypeAny, {
743
+ activationMethod: ActivationMethod;
744
+ deviceName: string;
745
+ deviceSignature: string;
746
+ lastValidation?: Date | undefined;
747
+ }, {
748
+ activationMethod: ActivationMethod;
749
+ deviceName: string;
750
+ deviceSignature: string;
751
+ lastValidation?: Date | undefined;
752
+ }>, "many">>;
753
+ }, "strip", z.ZodTypeAny, {
754
+ productId: string;
755
+ customerId: string;
756
+ externalId?: string | undefined;
757
+ createdAt?: Date | undefined;
758
+ maxNumberOfActivations?: number | undefined;
759
+ offlineActivationsAllowed?: boolean | undefined;
760
+ activations?: {
761
+ activationMethod: ActivationMethod;
762
+ deviceName: string;
763
+ deviceSignature: string;
764
+ lastValidation?: Date | undefined;
765
+ }[] | undefined;
766
+ }, {
767
+ productId: string;
768
+ customerId: string;
769
+ externalId?: string | undefined;
770
+ createdAt?: Date | undefined;
771
+ maxNumberOfActivations?: number | undefined;
772
+ offlineActivationsAllowed?: boolean | undefined;
773
+ activations?: {
774
+ activationMethod: ActivationMethod;
775
+ deviceName: string;
776
+ deviceSignature: string;
777
+ lastValidation?: Date | undefined;
778
+ }[] | undefined;
779
+ }>;
662
780
 
663
781
  declare enum LicenseStatus {
664
782
  Active = "Active",
@@ -674,6 +792,7 @@ declare enum ActivationMethod {
674
792
  }
675
793
  type License = z.infer<typeof licenseSchema>;
676
794
  type LicenseActivation = z.infer<typeof licenseActivationSchema>;
795
+ type ImportLicenseRequest = z.infer<typeof importLicenseRequestSchema>;
677
796
 
678
797
  declare class LicenseEndpoints {
679
798
  private api;
@@ -684,6 +803,7 @@ declare class LicenseEndpoints {
684
803
  pageSize?: number;
685
804
  }): Promise<Page<License>>;
686
805
  get(licenseId: string): Promise<License>;
806
+ import(license: ImportLicenseRequest): Promise<License>;
687
807
  revoke(licenseId: string): Promise<License>;
688
808
  queryActivations(licenseId: string, opts?: {
689
809
  paginationToken?: string;
@@ -771,12 +891,38 @@ declare const trialSchema: z.ZodObject<{
771
891
  expiresAt: Date;
772
892
  ownerId?: string | undefined;
773
893
  }>;
894
+ declare const importTrialRequestSchema: z.ZodObject<{
895
+ productId: z.ZodString;
896
+ deviceName: z.ZodString;
897
+ deviceSignature: z.ZodString;
898
+ expiresAt: z.ZodDate;
899
+ customerId: z.ZodOptional<z.ZodString>;
900
+ lastValidation: z.ZodOptional<z.ZodDate>;
901
+ createdAt: z.ZodOptional<z.ZodDate>;
902
+ }, "strip", z.ZodTypeAny, {
903
+ productId: string;
904
+ deviceName: string;
905
+ deviceSignature: string;
906
+ expiresAt: Date;
907
+ customerId?: string | undefined;
908
+ lastValidation?: Date | undefined;
909
+ createdAt?: Date | undefined;
910
+ }, {
911
+ productId: string;
912
+ deviceName: string;
913
+ deviceSignature: string;
914
+ expiresAt: Date;
915
+ customerId?: string | undefined;
916
+ lastValidation?: Date | undefined;
917
+ createdAt?: Date | undefined;
918
+ }>;
774
919
 
775
920
  declare enum TrialStatus {
776
921
  Active = "Active",
777
922
  Expired = "Expired"
778
923
  }
779
924
  type Trial = z.infer<typeof trialSchema>;
925
+ type ImportTrialRequest = z.infer<typeof importTrialRequestSchema>;
780
926
 
781
927
  declare class TrialEndpoints {
782
928
  private api;
@@ -785,6 +931,7 @@ declare class TrialEndpoints {
785
931
  deviceName: string;
786
932
  deviceSignature: string;
787
933
  }): Promise<Trial>;
934
+ import(trial: ImportTrialRequest): Promise<Trial>;
788
935
  }
789
936
 
790
937
  declare class NotAuthorizedError extends Error {
@@ -817,4 +964,4 @@ declare class MoonbaseClient {
817
964
  trials: TrialEndpoints;
818
965
  }
819
966
 
820
- export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Customer, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus };
967
+ export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus };
package/dist/index.d.ts CHANGED
@@ -58,6 +58,7 @@ declare const activationRequestSchema: z.ZodObject<{
58
58
  lastValidatedAt: z.ZodDate;
59
59
  license: z.ZodObject<{
60
60
  id: z.ZodString;
61
+ externalId: z.ZodOptional<z.ZodString>;
61
62
  productId: z.ZodString;
62
63
  ownerId: z.ZodString;
63
64
  status: z.ZodNativeEnum<typeof LicenseStatus>;
@@ -72,6 +73,7 @@ declare const activationRequestSchema: z.ZodObject<{
72
73
  activeNumberOfActivations: number;
73
74
  maxNumberOfActivations: number;
74
75
  offlineActivationsAllowed: boolean;
76
+ externalId?: string | undefined;
75
77
  }, {
76
78
  status: LicenseStatus;
77
79
  id: string;
@@ -80,6 +82,7 @@ declare const activationRequestSchema: z.ZodObject<{
80
82
  activeNumberOfActivations: number;
81
83
  maxNumberOfActivations: number;
82
84
  offlineActivationsAllowed: boolean;
85
+ externalId?: string | undefined;
83
86
  }>;
84
87
  }, "strip", z.ZodTypeAny, {
85
88
  status: ActivationStatus;
@@ -96,6 +99,7 @@ declare const activationRequestSchema: z.ZodObject<{
96
99
  activeNumberOfActivations: number;
97
100
  maxNumberOfActivations: number;
98
101
  offlineActivationsAllowed: boolean;
102
+ externalId?: string | undefined;
99
103
  };
100
104
  }, {
101
105
  status: ActivationStatus;
@@ -112,6 +116,7 @@ declare const activationRequestSchema: z.ZodObject<{
112
116
  activeNumberOfActivations: number;
113
117
  maxNumberOfActivations: number;
114
118
  offlineActivationsAllowed: boolean;
119
+ externalId?: string | undefined;
115
120
  };
116
121
  }>>;
117
122
  trial: z.ZodOptional<z.ZodObject<{
@@ -261,6 +266,7 @@ declare const activationRequestSchema: z.ZodObject<{
261
266
  activeNumberOfActivations: number;
262
267
  maxNumberOfActivations: number;
263
268
  offlineActivationsAllowed: boolean;
269
+ externalId?: string | undefined;
264
270
  };
265
271
  } | undefined;
266
272
  trial?: {
@@ -328,6 +334,7 @@ declare const activationRequestSchema: z.ZodObject<{
328
334
  activeNumberOfActivations: number;
329
335
  maxNumberOfActivations: number;
330
336
  offlineActivationsAllowed: boolean;
337
+ externalId?: string | undefined;
331
338
  };
332
339
  } | undefined;
333
340
  trial?: {
@@ -471,13 +478,66 @@ declare const customerSchema: z.ZodObject<{
471
478
  newsletterOptIn: boolean;
472
479
  };
473
480
  }>;
481
+ declare const importCustomerRequestSchema: z.ZodObject<{
482
+ name: z.ZodString;
483
+ email: z.ZodString;
484
+ password: z.ZodOptional<z.ZodString>;
485
+ address: z.ZodOptional<z.ZodObject<{
486
+ countryCode: z.ZodString;
487
+ streetAddress1: z.ZodString;
488
+ streetAddress2: z.ZodNullable<z.ZodString>;
489
+ locality: z.ZodNullable<z.ZodString>;
490
+ region: z.ZodNullable<z.ZodString>;
491
+ postCode: z.ZodString;
492
+ }, "strip", z.ZodTypeAny, {
493
+ countryCode: string;
494
+ streetAddress1: string;
495
+ streetAddress2: string | null;
496
+ locality: string | null;
497
+ region: string | null;
498
+ postCode: string;
499
+ }, {
500
+ countryCode: string;
501
+ streetAddress1: string;
502
+ streetAddress2: string | null;
503
+ locality: string | null;
504
+ region: string | null;
505
+ postCode: string;
506
+ }>>;
507
+ }, "strip", z.ZodTypeAny, {
508
+ name: string;
509
+ email: string;
510
+ password?: string | undefined;
511
+ address?: {
512
+ countryCode: string;
513
+ streetAddress1: string;
514
+ streetAddress2: string | null;
515
+ locality: string | null;
516
+ region: string | null;
517
+ postCode: string;
518
+ } | undefined;
519
+ }, {
520
+ name: string;
521
+ email: string;
522
+ password?: string | undefined;
523
+ address?: {
524
+ countryCode: string;
525
+ streetAddress1: string;
526
+ streetAddress2: string | null;
527
+ locality: string | null;
528
+ region: string | null;
529
+ postCode: string;
530
+ } | undefined;
531
+ }>;
474
532
 
475
533
  type Customer = z.infer<typeof customerSchema>;
534
+ type ImportCustomerRequest = z.infer<typeof importCustomerRequestSchema>;
476
535
 
477
536
  declare class CustomerEndpoints {
478
537
  private api;
479
538
  constructor(api: MoonbaseApi);
480
539
  get(idOrEmail: string): Promise<Customer>;
540
+ import(customer: ImportCustomerRequest): Promise<Customer>;
481
541
  }
482
542
 
483
543
  declare const pricingVariationSchema: z.ZodObject<{
@@ -571,6 +631,7 @@ interface Quantifiable<T> {
571
631
 
572
632
  declare const licenseSchema: z.ZodObject<{
573
633
  id: z.ZodString;
634
+ externalId: z.ZodOptional<z.ZodString>;
574
635
  productId: z.ZodString;
575
636
  ownerId: z.ZodString;
576
637
  status: z.ZodNativeEnum<typeof LicenseStatus>;
@@ -585,6 +646,7 @@ declare const licenseSchema: z.ZodObject<{
585
646
  activeNumberOfActivations: number;
586
647
  maxNumberOfActivations: number;
587
648
  offlineActivationsAllowed: boolean;
649
+ externalId?: string | undefined;
588
650
  }, {
589
651
  status: LicenseStatus;
590
652
  id: string;
@@ -593,6 +655,7 @@ declare const licenseSchema: z.ZodObject<{
593
655
  activeNumberOfActivations: number;
594
656
  maxNumberOfActivations: number;
595
657
  offlineActivationsAllowed: boolean;
658
+ externalId?: string | undefined;
596
659
  }>;
597
660
  declare const licenseActivationSchema: z.ZodObject<{
598
661
  id: z.ZodString;
@@ -603,6 +666,7 @@ declare const licenseActivationSchema: z.ZodObject<{
603
666
  lastValidatedAt: z.ZodDate;
604
667
  license: z.ZodObject<{
605
668
  id: z.ZodString;
669
+ externalId: z.ZodOptional<z.ZodString>;
606
670
  productId: z.ZodString;
607
671
  ownerId: z.ZodString;
608
672
  status: z.ZodNativeEnum<typeof LicenseStatus>;
@@ -617,6 +681,7 @@ declare const licenseActivationSchema: z.ZodObject<{
617
681
  activeNumberOfActivations: number;
618
682
  maxNumberOfActivations: number;
619
683
  offlineActivationsAllowed: boolean;
684
+ externalId?: string | undefined;
620
685
  }, {
621
686
  status: LicenseStatus;
622
687
  id: string;
@@ -625,6 +690,7 @@ declare const licenseActivationSchema: z.ZodObject<{
625
690
  activeNumberOfActivations: number;
626
691
  maxNumberOfActivations: number;
627
692
  offlineActivationsAllowed: boolean;
693
+ externalId?: string | undefined;
628
694
  }>;
629
695
  }, "strip", z.ZodTypeAny, {
630
696
  status: ActivationStatus;
@@ -641,6 +707,7 @@ declare const licenseActivationSchema: z.ZodObject<{
641
707
  activeNumberOfActivations: number;
642
708
  maxNumberOfActivations: number;
643
709
  offlineActivationsAllowed: boolean;
710
+ externalId?: string | undefined;
644
711
  };
645
712
  }, {
646
713
  status: ActivationStatus;
@@ -657,8 +724,59 @@ declare const licenseActivationSchema: z.ZodObject<{
657
724
  activeNumberOfActivations: number;
658
725
  maxNumberOfActivations: number;
659
726
  offlineActivationsAllowed: boolean;
727
+ externalId?: string | undefined;
660
728
  };
661
729
  }>;
730
+ declare const importLicenseRequestSchema: z.ZodObject<{
731
+ customerId: z.ZodString;
732
+ productId: z.ZodString;
733
+ externalId: z.ZodOptional<z.ZodString>;
734
+ createdAt: z.ZodOptional<z.ZodDate>;
735
+ maxNumberOfActivations: z.ZodOptional<z.ZodNumber>;
736
+ offlineActivationsAllowed: z.ZodOptional<z.ZodBoolean>;
737
+ activations: z.ZodOptional<z.ZodArray<z.ZodObject<{
738
+ activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
739
+ deviceName: z.ZodString;
740
+ deviceSignature: z.ZodString;
741
+ lastValidation: z.ZodOptional<z.ZodDate>;
742
+ }, "strip", z.ZodTypeAny, {
743
+ activationMethod: ActivationMethod;
744
+ deviceName: string;
745
+ deviceSignature: string;
746
+ lastValidation?: Date | undefined;
747
+ }, {
748
+ activationMethod: ActivationMethod;
749
+ deviceName: string;
750
+ deviceSignature: string;
751
+ lastValidation?: Date | undefined;
752
+ }>, "many">>;
753
+ }, "strip", z.ZodTypeAny, {
754
+ productId: string;
755
+ customerId: string;
756
+ externalId?: string | undefined;
757
+ createdAt?: Date | undefined;
758
+ maxNumberOfActivations?: number | undefined;
759
+ offlineActivationsAllowed?: boolean | undefined;
760
+ activations?: {
761
+ activationMethod: ActivationMethod;
762
+ deviceName: string;
763
+ deviceSignature: string;
764
+ lastValidation?: Date | undefined;
765
+ }[] | undefined;
766
+ }, {
767
+ productId: string;
768
+ customerId: string;
769
+ externalId?: string | undefined;
770
+ createdAt?: Date | undefined;
771
+ maxNumberOfActivations?: number | undefined;
772
+ offlineActivationsAllowed?: boolean | undefined;
773
+ activations?: {
774
+ activationMethod: ActivationMethod;
775
+ deviceName: string;
776
+ deviceSignature: string;
777
+ lastValidation?: Date | undefined;
778
+ }[] | undefined;
779
+ }>;
662
780
 
663
781
  declare enum LicenseStatus {
664
782
  Active = "Active",
@@ -674,6 +792,7 @@ declare enum ActivationMethod {
674
792
  }
675
793
  type License = z.infer<typeof licenseSchema>;
676
794
  type LicenseActivation = z.infer<typeof licenseActivationSchema>;
795
+ type ImportLicenseRequest = z.infer<typeof importLicenseRequestSchema>;
677
796
 
678
797
  declare class LicenseEndpoints {
679
798
  private api;
@@ -684,6 +803,7 @@ declare class LicenseEndpoints {
684
803
  pageSize?: number;
685
804
  }): Promise<Page<License>>;
686
805
  get(licenseId: string): Promise<License>;
806
+ import(license: ImportLicenseRequest): Promise<License>;
687
807
  revoke(licenseId: string): Promise<License>;
688
808
  queryActivations(licenseId: string, opts?: {
689
809
  paginationToken?: string;
@@ -771,12 +891,38 @@ declare const trialSchema: z.ZodObject<{
771
891
  expiresAt: Date;
772
892
  ownerId?: string | undefined;
773
893
  }>;
894
+ declare const importTrialRequestSchema: z.ZodObject<{
895
+ productId: z.ZodString;
896
+ deviceName: z.ZodString;
897
+ deviceSignature: z.ZodString;
898
+ expiresAt: z.ZodDate;
899
+ customerId: z.ZodOptional<z.ZodString>;
900
+ lastValidation: z.ZodOptional<z.ZodDate>;
901
+ createdAt: z.ZodOptional<z.ZodDate>;
902
+ }, "strip", z.ZodTypeAny, {
903
+ productId: string;
904
+ deviceName: string;
905
+ deviceSignature: string;
906
+ expiresAt: Date;
907
+ customerId?: string | undefined;
908
+ lastValidation?: Date | undefined;
909
+ createdAt?: Date | undefined;
910
+ }, {
911
+ productId: string;
912
+ deviceName: string;
913
+ deviceSignature: string;
914
+ expiresAt: Date;
915
+ customerId?: string | undefined;
916
+ lastValidation?: Date | undefined;
917
+ createdAt?: Date | undefined;
918
+ }>;
774
919
 
775
920
  declare enum TrialStatus {
776
921
  Active = "Active",
777
922
  Expired = "Expired"
778
923
  }
779
924
  type Trial = z.infer<typeof trialSchema>;
925
+ type ImportTrialRequest = z.infer<typeof importTrialRequestSchema>;
780
926
 
781
927
  declare class TrialEndpoints {
782
928
  private api;
@@ -785,6 +931,7 @@ declare class TrialEndpoints {
785
931
  deviceName: string;
786
932
  deviceSignature: string;
787
933
  }): Promise<Trial>;
934
+ import(trial: ImportTrialRequest): Promise<Trial>;
788
935
  }
789
936
 
790
937
  declare class NotAuthorizedError extends Error {
@@ -817,4 +964,4 @@ declare class MoonbaseClient {
817
964
  trials: TrialEndpoints;
818
965
  }
819
966
 
820
- export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Customer, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus };
967
+ export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus };
package/dist/index.js CHANGED
@@ -30,6 +30,12 @@ var customerSchema = z.object({
30
30
  address: addressSchema.nullable(),
31
31
  communicationPreferences: communicationPreferencesSchema
32
32
  });
33
+ var importCustomerRequestSchema = z.object({
34
+ name: z.string(),
35
+ email: z.string(),
36
+ password: z.string().optional(),
37
+ address: addressSchema.optional()
38
+ });
33
39
 
34
40
  // src/licenses/schemas.ts
35
41
  import { z as z2 } from "zod";
@@ -54,6 +60,7 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
54
60
  // src/licenses/schemas.ts
55
61
  var licenseSchema = z2.object({
56
62
  id: z2.string(),
63
+ externalId: z2.string().optional(),
57
64
  productId: z2.string(),
58
65
  ownerId: z2.string(),
59
66
  status: z2.nativeEnum(LicenseStatus),
@@ -70,6 +77,20 @@ var licenseActivationSchema = z2.object({
70
77
  lastValidatedAt: z2.coerce.date(),
71
78
  license: licenseSchema
72
79
  });
80
+ var importLicenseRequestSchema = z2.object({
81
+ customerId: z2.string(),
82
+ productId: z2.string(),
83
+ externalId: z2.string().optional(),
84
+ createdAt: z2.date().optional(),
85
+ maxNumberOfActivations: z2.number().optional(),
86
+ offlineActivationsAllowed: z2.boolean().optional(),
87
+ activations: z2.object({
88
+ activationMethod: z2.nativeEnum(ActivationMethod),
89
+ deviceName: z2.string(),
90
+ deviceSignature: z2.string(),
91
+ lastValidation: z2.date().optional()
92
+ }).array().optional()
93
+ });
73
94
 
74
95
  // src/products/schemas.ts
75
96
  import { z as z3 } from "zod";
@@ -115,6 +136,15 @@ var trialSchema = z4.object({
115
136
  lastValidatedAt: z4.coerce.date(),
116
137
  ownerId: z4.string().optional()
117
138
  });
139
+ var importTrialRequestSchema = z4.object({
140
+ productId: z4.string(),
141
+ deviceName: z4.string(),
142
+ deviceSignature: z4.string(),
143
+ expiresAt: z4.date(),
144
+ customerId: z4.string().optional(),
145
+ lastValidation: z4.date().optional(),
146
+ createdAt: z4.date().optional()
147
+ });
118
148
 
119
149
  // src/activationRequests/models.ts
120
150
  var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
@@ -160,6 +190,11 @@ var CustomerEndpoints = class {
160
190
  const response = await this.api.fetch(`/api/customers/${idOrEmail}`);
161
191
  return customerSchema.parse(response.data);
162
192
  }
193
+ async import(customer) {
194
+ const request = importCustomerRequestSchema.parse(customer);
195
+ const response = await this.api.fetch(`/api/customers/import`, "POST", request);
196
+ return customerSchema.parse(response.data);
197
+ }
163
198
  };
164
199
 
165
200
  // src/globalSchemas.ts
@@ -303,6 +338,11 @@ var LicenseEndpoints = class {
303
338
  const response = await this.api.fetch(`/api/licenses/${licenseId}`);
304
339
  return licenseSchema.parse(response.data);
305
340
  }
341
+ async import(license) {
342
+ const request = importLicenseRequestSchema.parse(license);
343
+ const response = await this.api.fetch(`/api/licenses/import`, "POST", request);
344
+ return licenseSchema.parse(response.data);
345
+ }
306
346
  async revoke(licenseId) {
307
347
  const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
308
348
  return licenseSchema.parse(response.data);
@@ -345,6 +385,11 @@ var TrialEndpoints = class {
345
385
  const response = await this.api.fetch(`/api/trials/${productId}/request`, "POST", target);
346
386
  return trialSchema.parse(response.data);
347
387
  }
388
+ async import(trial) {
389
+ const request = importTrialRequestSchema.parse(trial);
390
+ const response = await this.api.fetch(`/api/customers/import`, "POST", request);
391
+ return trialSchema.parse(response.data);
392
+ }
348
393
  };
349
394
 
350
395
  // src/index.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/api",
3
3
  "type": "module",
4
- "version": "0.1.111",
4
+ "version": "0.1.112",
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",