@moonbase.sh/api 0.3.37 → 0.3.38

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
@@ -80,8 +80,8 @@ var customerSchema = import_zod.z.object({
80
80
  emailConfirmed: import_zod.z.boolean(),
81
81
  hasPassword: import_zod.z.boolean(),
82
82
  isDeleted: import_zod.z.boolean(),
83
- ownedProducts: import_zod.z.string().array(),
84
- subscribedProducts: import_zod.z.string().array(),
83
+ ownedProducts: import_zod.z.string().array().transform((arr) => arr.sort()),
84
+ subscribedProducts: import_zod.z.string().array().transform((arr) => arr.sort()),
85
85
  address: addressSchema.nullable(),
86
86
  communicationPreferences: communicationPreferencesSchema
87
87
  });
@@ -98,6 +98,7 @@ var importCustomerRequestSchema = import_zod.z.object({
98
98
  var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
99
99
  LicenseStatus2["Active"] = "Active";
100
100
  LicenseStatus2["Revoked"] = "Revoked";
101
+ LicenseStatus2["Expired"] = "Expired";
101
102
  return LicenseStatus2;
102
103
  })(LicenseStatus || {});
103
104
  var ActivationStatus = /* @__PURE__ */ ((ActivationStatus2) => {
@@ -245,22 +246,6 @@ var ActivationRequestEndpoints = class {
245
246
  }
246
247
  };
247
248
 
248
- // src/customers/endpoints.ts
249
- var CustomerEndpoints = class {
250
- constructor(api) {
251
- this.api = api;
252
- }
253
- async get(idOrEmail) {
254
- const response = await this.api.fetch(`/api/customers/${idOrEmail}`);
255
- return customerSchema.parse(response.data);
256
- }
257
- async import(customer) {
258
- const request = importCustomerRequestSchema.parse(customer);
259
- const response = await this.api.fetch(`/api/customers/import`, "POST", request);
260
- return customerSchema.parse(response.data);
261
- }
262
- };
263
-
264
249
  // src/globalSchemas.ts
265
250
  var import_zod6 = require("zod");
266
251
  var userSchema = import_zod6.z.object({
@@ -438,6 +423,26 @@ var MoonbaseApi = class {
438
423
  }
439
424
  };
440
425
 
426
+ // src/customers/endpoints.ts
427
+ var CustomerEndpoints = class {
428
+ constructor(api) {
429
+ this.api = api;
430
+ }
431
+ async query(opts) {
432
+ const response = await this.api.fetch(`/api/customers?${objectToQuery(opts)}`);
433
+ return paged(customerSchema, this.api).parse(response.data);
434
+ }
435
+ async get(idOrEmail) {
436
+ const response = await this.api.fetch(`/api/customers/${idOrEmail}`);
437
+ return customerSchema.parse(response.data);
438
+ }
439
+ async import(customer) {
440
+ const request = importCustomerRequestSchema.parse(customer);
441
+ const response = await this.api.fetch(`/api/customers/import`, "POST", request);
442
+ return customerSchema.parse(response.data);
443
+ }
444
+ };
445
+
441
446
  // src/licenses/endpoints.ts
442
447
  var LicenseEndpoints = class {
443
448
  constructor(api) {
@@ -660,6 +665,14 @@ var TrialEndpoints = class {
660
665
  constructor(api) {
661
666
  this.api = api;
662
667
  }
668
+ async query(opts) {
669
+ const response = await this.api.fetch(`/api/trials?${objectToQuery(opts)}`);
670
+ return paged(trialSchema, this.api).parse(response.data);
671
+ }
672
+ async get(trialId) {
673
+ const response = await this.api.fetch(`/api/trials/${trialId}`);
674
+ return trialSchema.parse(response.data);
675
+ }
663
676
  async request(productId, target) {
664
677
  const response = await this.api.fetch(`/api/trials/${productId}/request`, "POST", target);
665
678
  return trialSchema.parse(response.data);
package/dist/index.d.cts CHANGED
@@ -97,8 +97,8 @@ declare const activationRequestSchema: z.ZodObject<{
97
97
  emailConfirmed: z.ZodBoolean;
98
98
  hasPassword: z.ZodBoolean;
99
99
  isDeleted: z.ZodBoolean;
100
- ownedProducts: z.ZodArray<z.ZodString, "many">;
101
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
100
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
101
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
102
102
  address: z.ZodNullable<z.ZodObject<{
103
103
  countryCode: z.ZodString;
104
104
  streetAddress1: z.ZodString;
@@ -287,8 +287,8 @@ declare const activationRequestSchema: z.ZodObject<{
287
287
  emailConfirmed: z.ZodBoolean;
288
288
  hasPassword: z.ZodBoolean;
289
289
  isDeleted: z.ZodBoolean;
290
- ownedProducts: z.ZodArray<z.ZodString, "many">;
291
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
290
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
291
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
292
292
  address: z.ZodNullable<z.ZodObject<{
293
293
  countryCode: z.ZodString;
294
294
  streetAddress1: z.ZodString;
@@ -651,6 +651,32 @@ declare class ActivationRequestEndpoints {
651
651
  }): Promise<ActivationRequest>;
652
652
  }
653
653
 
654
+ declare const pricingVariationSchema: z.ZodObject<{
655
+ id: z.ZodString;
656
+ name: z.ZodString;
657
+ price: z.ZodRecord<z.ZodString, z.ZodNumber>;
658
+ }, "strip", z.ZodTypeAny, {
659
+ id: string;
660
+ name: string;
661
+ price: Record<string, number>;
662
+ }, {
663
+ id: string;
664
+ name: string;
665
+ price: Record<string, number>;
666
+ }>;
667
+
668
+ type PricingVariation = z.infer<typeof pricingVariationSchema>;
669
+ interface Page<T> {
670
+ items: Array<T>;
671
+ hasMore: boolean;
672
+ next: string | null;
673
+ getNext: () => Promise<Page<T>>;
674
+ }
675
+ interface Quantifiable<T> {
676
+ value: T;
677
+ quantity: number;
678
+ }
679
+
654
680
  declare const customerSchema: z.ZodObject<{
655
681
  id: z.ZodString;
656
682
  externalId: z.ZodOptional<z.ZodString>;
@@ -663,8 +689,8 @@ declare const customerSchema: z.ZodObject<{
663
689
  emailConfirmed: z.ZodBoolean;
664
690
  hasPassword: z.ZodBoolean;
665
691
  isDeleted: z.ZodBoolean;
666
- ownedProducts: z.ZodArray<z.ZodString, "many">;
667
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
692
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
693
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
668
694
  address: z.ZodNullable<z.ZodObject<{
669
695
  countryCode: z.ZodString;
670
696
  streetAddress1: z.ZodString;
@@ -809,36 +835,14 @@ type ImportCustomerRequest = z.infer<typeof importCustomerRequestSchema>;
809
835
  declare class CustomerEndpoints {
810
836
  private api;
811
837
  constructor(api: MoonbaseApi);
838
+ query(opts?: {
839
+ paginationToken?: string;
840
+ pageSize?: number;
841
+ }): Promise<Page<Customer>>;
812
842
  get(idOrEmail: string): Promise<Customer>;
813
843
  import(customer: ImportCustomerRequest): Promise<Customer>;
814
844
  }
815
845
 
816
- declare const pricingVariationSchema: z.ZodObject<{
817
- id: z.ZodString;
818
- name: z.ZodString;
819
- price: z.ZodRecord<z.ZodString, z.ZodNumber>;
820
- }, "strip", z.ZodTypeAny, {
821
- id: string;
822
- name: string;
823
- price: Record<string, number>;
824
- }, {
825
- id: string;
826
- name: string;
827
- price: Record<string, number>;
828
- }>;
829
-
830
- type PricingVariation = z.infer<typeof pricingVariationSchema>;
831
- interface Page<T> {
832
- items: Array<T>;
833
- hasMore: boolean;
834
- next: string | null;
835
- getNext: () => Promise<Page<T>>;
836
- }
837
- interface Quantifiable<T> {
838
- value: T;
839
- quantity: number;
840
- }
841
-
842
846
  declare const licenseSchema: z.ZodObject<{
843
847
  id: z.ZodString;
844
848
  externalId: z.ZodOptional<z.ZodString>;
@@ -914,8 +918,8 @@ declare const licenseActivationSchema: z.ZodObject<{
914
918
  emailConfirmed: z.ZodBoolean;
915
919
  hasPassword: z.ZodBoolean;
916
920
  isDeleted: z.ZodBoolean;
917
- ownedProducts: z.ZodArray<z.ZodString, "many">;
918
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
921
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
922
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
919
923
  address: z.ZodNullable<z.ZodObject<{
920
924
  countryCode: z.ZodString;
921
925
  streetAddress1: z.ZodString;
@@ -1166,7 +1170,8 @@ declare const provisionLicensesRequestSchema: z.ZodObject<{
1166
1170
 
1167
1171
  declare enum LicenseStatus {
1168
1172
  Active = "Active",
1169
- Revoked = "Revoked"
1173
+ Revoked = "Revoked",
1174
+ Expired = "Expired"
1170
1175
  }
1171
1176
  declare enum ActivationStatus {
1172
1177
  Active = "Active",
@@ -3371,8 +3376,8 @@ declare const trialSchema: z.ZodObject<{
3371
3376
  emailConfirmed: z.ZodBoolean;
3372
3377
  hasPassword: z.ZodBoolean;
3373
3378
  isDeleted: z.ZodBoolean;
3374
- ownedProducts: z.ZodArray<z.ZodString, "many">;
3375
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
3379
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
3380
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
3376
3381
  address: z.ZodNullable<z.ZodObject<{
3377
3382
  countryCode: z.ZodString;
3378
3383
  streetAddress1: z.ZodString;
@@ -3563,6 +3568,12 @@ type ImportTrialRequest = z.infer<typeof importTrialRequestSchema>;
3563
3568
  declare class TrialEndpoints {
3564
3569
  private api;
3565
3570
  constructor(api: MoonbaseApi);
3571
+ query(opts?: {
3572
+ paginationToken?: string;
3573
+ productFilter?: string;
3574
+ pageSize?: number;
3575
+ }): Promise<Page<Trial>>;
3576
+ get(trialId: string): Promise<Trial>;
3566
3577
  request(productId: string, target: {
3567
3578
  deviceName: string;
3568
3579
  deviceSignature: string;
package/dist/index.d.ts CHANGED
@@ -97,8 +97,8 @@ declare const activationRequestSchema: z.ZodObject<{
97
97
  emailConfirmed: z.ZodBoolean;
98
98
  hasPassword: z.ZodBoolean;
99
99
  isDeleted: z.ZodBoolean;
100
- ownedProducts: z.ZodArray<z.ZodString, "many">;
101
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
100
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
101
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
102
102
  address: z.ZodNullable<z.ZodObject<{
103
103
  countryCode: z.ZodString;
104
104
  streetAddress1: z.ZodString;
@@ -287,8 +287,8 @@ declare const activationRequestSchema: z.ZodObject<{
287
287
  emailConfirmed: z.ZodBoolean;
288
288
  hasPassword: z.ZodBoolean;
289
289
  isDeleted: z.ZodBoolean;
290
- ownedProducts: z.ZodArray<z.ZodString, "many">;
291
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
290
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
291
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
292
292
  address: z.ZodNullable<z.ZodObject<{
293
293
  countryCode: z.ZodString;
294
294
  streetAddress1: z.ZodString;
@@ -651,6 +651,32 @@ declare class ActivationRequestEndpoints {
651
651
  }): Promise<ActivationRequest>;
652
652
  }
653
653
 
654
+ declare const pricingVariationSchema: z.ZodObject<{
655
+ id: z.ZodString;
656
+ name: z.ZodString;
657
+ price: z.ZodRecord<z.ZodString, z.ZodNumber>;
658
+ }, "strip", z.ZodTypeAny, {
659
+ id: string;
660
+ name: string;
661
+ price: Record<string, number>;
662
+ }, {
663
+ id: string;
664
+ name: string;
665
+ price: Record<string, number>;
666
+ }>;
667
+
668
+ type PricingVariation = z.infer<typeof pricingVariationSchema>;
669
+ interface Page<T> {
670
+ items: Array<T>;
671
+ hasMore: boolean;
672
+ next: string | null;
673
+ getNext: () => Promise<Page<T>>;
674
+ }
675
+ interface Quantifiable<T> {
676
+ value: T;
677
+ quantity: number;
678
+ }
679
+
654
680
  declare const customerSchema: z.ZodObject<{
655
681
  id: z.ZodString;
656
682
  externalId: z.ZodOptional<z.ZodString>;
@@ -663,8 +689,8 @@ declare const customerSchema: z.ZodObject<{
663
689
  emailConfirmed: z.ZodBoolean;
664
690
  hasPassword: z.ZodBoolean;
665
691
  isDeleted: z.ZodBoolean;
666
- ownedProducts: z.ZodArray<z.ZodString, "many">;
667
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
692
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
693
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
668
694
  address: z.ZodNullable<z.ZodObject<{
669
695
  countryCode: z.ZodString;
670
696
  streetAddress1: z.ZodString;
@@ -809,36 +835,14 @@ type ImportCustomerRequest = z.infer<typeof importCustomerRequestSchema>;
809
835
  declare class CustomerEndpoints {
810
836
  private api;
811
837
  constructor(api: MoonbaseApi);
838
+ query(opts?: {
839
+ paginationToken?: string;
840
+ pageSize?: number;
841
+ }): Promise<Page<Customer>>;
812
842
  get(idOrEmail: string): Promise<Customer>;
813
843
  import(customer: ImportCustomerRequest): Promise<Customer>;
814
844
  }
815
845
 
816
- declare const pricingVariationSchema: z.ZodObject<{
817
- id: z.ZodString;
818
- name: z.ZodString;
819
- price: z.ZodRecord<z.ZodString, z.ZodNumber>;
820
- }, "strip", z.ZodTypeAny, {
821
- id: string;
822
- name: string;
823
- price: Record<string, number>;
824
- }, {
825
- id: string;
826
- name: string;
827
- price: Record<string, number>;
828
- }>;
829
-
830
- type PricingVariation = z.infer<typeof pricingVariationSchema>;
831
- interface Page<T> {
832
- items: Array<T>;
833
- hasMore: boolean;
834
- next: string | null;
835
- getNext: () => Promise<Page<T>>;
836
- }
837
- interface Quantifiable<T> {
838
- value: T;
839
- quantity: number;
840
- }
841
-
842
846
  declare const licenseSchema: z.ZodObject<{
843
847
  id: z.ZodString;
844
848
  externalId: z.ZodOptional<z.ZodString>;
@@ -914,8 +918,8 @@ declare const licenseActivationSchema: z.ZodObject<{
914
918
  emailConfirmed: z.ZodBoolean;
915
919
  hasPassword: z.ZodBoolean;
916
920
  isDeleted: z.ZodBoolean;
917
- ownedProducts: z.ZodArray<z.ZodString, "many">;
918
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
921
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
922
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
919
923
  address: z.ZodNullable<z.ZodObject<{
920
924
  countryCode: z.ZodString;
921
925
  streetAddress1: z.ZodString;
@@ -1166,7 +1170,8 @@ declare const provisionLicensesRequestSchema: z.ZodObject<{
1166
1170
 
1167
1171
  declare enum LicenseStatus {
1168
1172
  Active = "Active",
1169
- Revoked = "Revoked"
1173
+ Revoked = "Revoked",
1174
+ Expired = "Expired"
1170
1175
  }
1171
1176
  declare enum ActivationStatus {
1172
1177
  Active = "Active",
@@ -3371,8 +3376,8 @@ declare const trialSchema: z.ZodObject<{
3371
3376
  emailConfirmed: z.ZodBoolean;
3372
3377
  hasPassword: z.ZodBoolean;
3373
3378
  isDeleted: z.ZodBoolean;
3374
- ownedProducts: z.ZodArray<z.ZodString, "many">;
3375
- subscribedProducts: z.ZodArray<z.ZodString, "many">;
3379
+ ownedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
3380
+ subscribedProducts: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
3376
3381
  address: z.ZodNullable<z.ZodObject<{
3377
3382
  countryCode: z.ZodString;
3378
3383
  streetAddress1: z.ZodString;
@@ -3563,6 +3568,12 @@ type ImportTrialRequest = z.infer<typeof importTrialRequestSchema>;
3563
3568
  declare class TrialEndpoints {
3564
3569
  private api;
3565
3570
  constructor(api: MoonbaseApi);
3571
+ query(opts?: {
3572
+ paginationToken?: string;
3573
+ productFilter?: string;
3574
+ pageSize?: number;
3575
+ }): Promise<Page<Trial>>;
3576
+ get(trialId: string): Promise<Trial>;
3566
3577
  request(productId: string, target: {
3567
3578
  deviceName: string;
3568
3579
  deviceSignature: string;
package/dist/index.js CHANGED
@@ -30,8 +30,8 @@ var customerSchema = z.object({
30
30
  emailConfirmed: z.boolean(),
31
31
  hasPassword: z.boolean(),
32
32
  isDeleted: z.boolean(),
33
- ownedProducts: z.string().array(),
34
- subscribedProducts: z.string().array(),
33
+ ownedProducts: z.string().array().transform((arr) => arr.sort()),
34
+ subscribedProducts: z.string().array().transform((arr) => arr.sort()),
35
35
  address: addressSchema.nullable(),
36
36
  communicationPreferences: communicationPreferencesSchema
37
37
  });
@@ -48,6 +48,7 @@ var importCustomerRequestSchema = z.object({
48
48
  var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
49
49
  LicenseStatus2["Active"] = "Active";
50
50
  LicenseStatus2["Revoked"] = "Revoked";
51
+ LicenseStatus2["Expired"] = "Expired";
51
52
  return LicenseStatus2;
52
53
  })(LicenseStatus || {});
53
54
  var ActivationStatus = /* @__PURE__ */ ((ActivationStatus2) => {
@@ -195,22 +196,6 @@ var ActivationRequestEndpoints = class {
195
196
  }
196
197
  };
197
198
 
198
- // src/customers/endpoints.ts
199
- var CustomerEndpoints = class {
200
- constructor(api) {
201
- this.api = api;
202
- }
203
- async get(idOrEmail) {
204
- const response = await this.api.fetch(`/api/customers/${idOrEmail}`);
205
- return customerSchema.parse(response.data);
206
- }
207
- async import(customer) {
208
- const request = importCustomerRequestSchema.parse(customer);
209
- const response = await this.api.fetch(`/api/customers/import`, "POST", request);
210
- return customerSchema.parse(response.data);
211
- }
212
- };
213
-
214
199
  // src/globalSchemas.ts
215
200
  import { z as z6 } from "zod";
216
201
  var userSchema = z6.object({
@@ -388,6 +373,26 @@ var MoonbaseApi = class {
388
373
  }
389
374
  };
390
375
 
376
+ // src/customers/endpoints.ts
377
+ var CustomerEndpoints = class {
378
+ constructor(api) {
379
+ this.api = api;
380
+ }
381
+ async query(opts) {
382
+ const response = await this.api.fetch(`/api/customers?${objectToQuery(opts)}`);
383
+ return paged(customerSchema, this.api).parse(response.data);
384
+ }
385
+ async get(idOrEmail) {
386
+ const response = await this.api.fetch(`/api/customers/${idOrEmail}`);
387
+ return customerSchema.parse(response.data);
388
+ }
389
+ async import(customer) {
390
+ const request = importCustomerRequestSchema.parse(customer);
391
+ const response = await this.api.fetch(`/api/customers/import`, "POST", request);
392
+ return customerSchema.parse(response.data);
393
+ }
394
+ };
395
+
391
396
  // src/licenses/endpoints.ts
392
397
  var LicenseEndpoints = class {
393
398
  constructor(api) {
@@ -610,6 +615,14 @@ var TrialEndpoints = class {
610
615
  constructor(api) {
611
616
  this.api = api;
612
617
  }
618
+ async query(opts) {
619
+ const response = await this.api.fetch(`/api/trials?${objectToQuery(opts)}`);
620
+ return paged(trialSchema, this.api).parse(response.data);
621
+ }
622
+ async get(trialId) {
623
+ const response = await this.api.fetch(`/api/trials/${trialId}`);
624
+ return trialSchema.parse(response.data);
625
+ }
613
626
  async request(productId, target) {
614
627
  const response = await this.api.fetch(`/api/trials/${productId}/request`, "POST", target);
615
628
  return trialSchema.parse(response.data);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/api",
3
3
  "type": "module",
4
- "version": "0.3.37",
4
+ "version": "0.3.38",
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",