@moonbase.sh/api 0.1.110 → 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
@@ -208,17 +208,6 @@ var CustomerEndpoints = class {
208
208
  }
209
209
  };
210
210
 
211
- // src/licenses/endpoints.ts
212
- var LicenseEndpoints = class {
213
- constructor(api) {
214
- this.api = api;
215
- }
216
- async validate(licenseId, activationId) {
217
- const response = await this.api.fetch(`/api/licenses/${licenseId}/activations/${activationId}/validate`, "POST");
218
- return licenseActivationSchema.parse(response.data);
219
- }
220
- };
221
-
222
211
  // src/globalSchemas.ts
223
212
  var import_zod6 = require("zod");
224
213
  var priceCollectionSchema = import_zod6.z.record(import_zod6.z.number());
@@ -347,6 +336,37 @@ var MoonbaseApi = class {
347
336
  }
348
337
  };
349
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
+
350
370
  // src/products/endpoints.ts
351
371
  var ProductEndpoints = class {
352
372
  constructor(api) {
package/dist/index.d.cts CHANGED
@@ -480,6 +480,95 @@ declare class CustomerEndpoints {
480
480
  get(idOrEmail: string): Promise<Customer>;
481
481
  }
482
482
 
483
+ declare const pricingVariationSchema: z.ZodObject<{
484
+ id: z.ZodString;
485
+ name: z.ZodString;
486
+ originalPrice: z.ZodRecord<z.ZodString, z.ZodNumber>;
487
+ price: z.ZodRecord<z.ZodString, z.ZodNumber>;
488
+ hasDiscount: z.ZodBoolean;
489
+ discount: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
490
+ type: z.ZodLiteral<"PercentageOffDiscount">;
491
+ name: z.ZodString;
492
+ description: z.ZodOptional<z.ZodString>;
493
+ percentage: z.ZodNumber;
494
+ total: z.ZodRecord<z.ZodString, z.ZodNumber>;
495
+ }, "strip", z.ZodTypeAny, {
496
+ type: "PercentageOffDiscount";
497
+ name: string;
498
+ percentage: number;
499
+ total: Record<string, number>;
500
+ description?: string | undefined;
501
+ }, {
502
+ type: "PercentageOffDiscount";
503
+ name: string;
504
+ percentage: number;
505
+ total: Record<string, number>;
506
+ description?: string | undefined;
507
+ }>, z.ZodObject<{
508
+ type: z.ZodLiteral<"FlatAmountOffDiscount">;
509
+ name: z.ZodString;
510
+ description: z.ZodOptional<z.ZodString>;
511
+ total: z.ZodRecord<z.ZodString, z.ZodNumber>;
512
+ }, "strip", z.ZodTypeAny, {
513
+ type: "FlatAmountOffDiscount";
514
+ name: string;
515
+ total: Record<string, number>;
516
+ description?: string | undefined;
517
+ }, {
518
+ type: "FlatAmountOffDiscount";
519
+ name: string;
520
+ total: Record<string, number>;
521
+ description?: string | undefined;
522
+ }>]>>;
523
+ }, "strip", z.ZodTypeAny, {
524
+ id: string;
525
+ name: string;
526
+ originalPrice: Record<string, number>;
527
+ price: Record<string, number>;
528
+ hasDiscount: boolean;
529
+ discount?: {
530
+ type: "PercentageOffDiscount";
531
+ name: string;
532
+ percentage: number;
533
+ total: Record<string, number>;
534
+ description?: string | undefined;
535
+ } | {
536
+ type: "FlatAmountOffDiscount";
537
+ name: string;
538
+ total: Record<string, number>;
539
+ description?: string | undefined;
540
+ } | undefined;
541
+ }, {
542
+ id: string;
543
+ name: string;
544
+ originalPrice: Record<string, number>;
545
+ price: Record<string, number>;
546
+ hasDiscount: boolean;
547
+ discount?: {
548
+ type: "PercentageOffDiscount";
549
+ name: string;
550
+ percentage: number;
551
+ total: Record<string, number>;
552
+ description?: string | undefined;
553
+ } | {
554
+ type: "FlatAmountOffDiscount";
555
+ name: string;
556
+ total: Record<string, number>;
557
+ description?: string | undefined;
558
+ } | undefined;
559
+ }>;
560
+
561
+ type PricingVariation = z.infer<typeof pricingVariationSchema>;
562
+ interface Page<T> {
563
+ items: Array<T>;
564
+ hasMore: boolean;
565
+ next: string | null;
566
+ }
567
+ interface Quantifiable<T> {
568
+ value: T;
569
+ quantity: number;
570
+ }
571
+
483
572
  declare const licenseSchema: z.ZodObject<{
484
573
  id: z.ZodString;
485
574
  productId: z.ZodString;
@@ -589,96 +678,20 @@ type LicenseActivation = z.infer<typeof licenseActivationSchema>;
589
678
  declare class LicenseEndpoints {
590
679
  private api;
591
680
  constructor(api: MoonbaseApi);
592
- validate(licenseId: string, activationId: string): Promise<LicenseActivation>;
593
- }
594
-
595
- declare const pricingVariationSchema: z.ZodObject<{
596
- id: z.ZodString;
597
- name: z.ZodString;
598
- originalPrice: z.ZodRecord<z.ZodString, z.ZodNumber>;
599
- price: z.ZodRecord<z.ZodString, z.ZodNumber>;
600
- hasDiscount: z.ZodBoolean;
601
- discount: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
602
- type: z.ZodLiteral<"PercentageOffDiscount">;
603
- name: z.ZodString;
604
- description: z.ZodOptional<z.ZodString>;
605
- percentage: z.ZodNumber;
606
- total: z.ZodRecord<z.ZodString, z.ZodNumber>;
607
- }, "strip", z.ZodTypeAny, {
608
- type: "PercentageOffDiscount";
609
- name: string;
610
- percentage: number;
611
- total: Record<string, number>;
612
- description?: string | undefined;
613
- }, {
614
- type: "PercentageOffDiscount";
615
- name: string;
616
- percentage: number;
617
- total: Record<string, number>;
618
- description?: string | undefined;
619
- }>, z.ZodObject<{
620
- type: z.ZodLiteral<"FlatAmountOffDiscount">;
621
- name: z.ZodString;
622
- description: z.ZodOptional<z.ZodString>;
623
- total: z.ZodRecord<z.ZodString, z.ZodNumber>;
624
- }, "strip", z.ZodTypeAny, {
625
- type: "FlatAmountOffDiscount";
626
- name: string;
627
- total: Record<string, number>;
628
- description?: string | undefined;
629
- }, {
630
- type: "FlatAmountOffDiscount";
631
- name: string;
632
- total: Record<string, number>;
633
- description?: string | undefined;
634
- }>]>>;
635
- }, "strip", z.ZodTypeAny, {
636
- id: string;
637
- name: string;
638
- originalPrice: Record<string, number>;
639
- price: Record<string, number>;
640
- hasDiscount: boolean;
641
- discount?: {
642
- type: "PercentageOffDiscount";
643
- name: string;
644
- percentage: number;
645
- total: Record<string, number>;
646
- description?: string | undefined;
647
- } | {
648
- type: "FlatAmountOffDiscount";
649
- name: string;
650
- total: Record<string, number>;
651
- description?: string | undefined;
652
- } | undefined;
653
- }, {
654
- id: string;
655
- name: string;
656
- originalPrice: Record<string, number>;
657
- price: Record<string, number>;
658
- hasDiscount: boolean;
659
- discount?: {
660
- type: "PercentageOffDiscount";
661
- name: string;
662
- percentage: number;
663
- total: Record<string, number>;
664
- description?: string | undefined;
665
- } | {
666
- type: "FlatAmountOffDiscount";
667
- name: string;
668
- total: Record<string, number>;
669
- description?: string | undefined;
670
- } | undefined;
671
- }>;
672
-
673
- type PricingVariation = z.infer<typeof pricingVariationSchema>;
674
- interface Page<T> {
675
- items: Array<T>;
676
- hasMore: boolean;
677
- next: string | null;
678
- }
679
- interface Quantifiable<T> {
680
- value: T;
681
- quantity: number;
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>;
682
695
  }
683
696
 
684
697
  declare const productSchema: z.ZodObject<{
package/dist/index.d.ts CHANGED
@@ -480,6 +480,95 @@ declare class CustomerEndpoints {
480
480
  get(idOrEmail: string): Promise<Customer>;
481
481
  }
482
482
 
483
+ declare const pricingVariationSchema: z.ZodObject<{
484
+ id: z.ZodString;
485
+ name: z.ZodString;
486
+ originalPrice: z.ZodRecord<z.ZodString, z.ZodNumber>;
487
+ price: z.ZodRecord<z.ZodString, z.ZodNumber>;
488
+ hasDiscount: z.ZodBoolean;
489
+ discount: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
490
+ type: z.ZodLiteral<"PercentageOffDiscount">;
491
+ name: z.ZodString;
492
+ description: z.ZodOptional<z.ZodString>;
493
+ percentage: z.ZodNumber;
494
+ total: z.ZodRecord<z.ZodString, z.ZodNumber>;
495
+ }, "strip", z.ZodTypeAny, {
496
+ type: "PercentageOffDiscount";
497
+ name: string;
498
+ percentage: number;
499
+ total: Record<string, number>;
500
+ description?: string | undefined;
501
+ }, {
502
+ type: "PercentageOffDiscount";
503
+ name: string;
504
+ percentage: number;
505
+ total: Record<string, number>;
506
+ description?: string | undefined;
507
+ }>, z.ZodObject<{
508
+ type: z.ZodLiteral<"FlatAmountOffDiscount">;
509
+ name: z.ZodString;
510
+ description: z.ZodOptional<z.ZodString>;
511
+ total: z.ZodRecord<z.ZodString, z.ZodNumber>;
512
+ }, "strip", z.ZodTypeAny, {
513
+ type: "FlatAmountOffDiscount";
514
+ name: string;
515
+ total: Record<string, number>;
516
+ description?: string | undefined;
517
+ }, {
518
+ type: "FlatAmountOffDiscount";
519
+ name: string;
520
+ total: Record<string, number>;
521
+ description?: string | undefined;
522
+ }>]>>;
523
+ }, "strip", z.ZodTypeAny, {
524
+ id: string;
525
+ name: string;
526
+ originalPrice: Record<string, number>;
527
+ price: Record<string, number>;
528
+ hasDiscount: boolean;
529
+ discount?: {
530
+ type: "PercentageOffDiscount";
531
+ name: string;
532
+ percentage: number;
533
+ total: Record<string, number>;
534
+ description?: string | undefined;
535
+ } | {
536
+ type: "FlatAmountOffDiscount";
537
+ name: string;
538
+ total: Record<string, number>;
539
+ description?: string | undefined;
540
+ } | undefined;
541
+ }, {
542
+ id: string;
543
+ name: string;
544
+ originalPrice: Record<string, number>;
545
+ price: Record<string, number>;
546
+ hasDiscount: boolean;
547
+ discount?: {
548
+ type: "PercentageOffDiscount";
549
+ name: string;
550
+ percentage: number;
551
+ total: Record<string, number>;
552
+ description?: string | undefined;
553
+ } | {
554
+ type: "FlatAmountOffDiscount";
555
+ name: string;
556
+ total: Record<string, number>;
557
+ description?: string | undefined;
558
+ } | undefined;
559
+ }>;
560
+
561
+ type PricingVariation = z.infer<typeof pricingVariationSchema>;
562
+ interface Page<T> {
563
+ items: Array<T>;
564
+ hasMore: boolean;
565
+ next: string | null;
566
+ }
567
+ interface Quantifiable<T> {
568
+ value: T;
569
+ quantity: number;
570
+ }
571
+
483
572
  declare const licenseSchema: z.ZodObject<{
484
573
  id: z.ZodString;
485
574
  productId: z.ZodString;
@@ -589,96 +678,20 @@ type LicenseActivation = z.infer<typeof licenseActivationSchema>;
589
678
  declare class LicenseEndpoints {
590
679
  private api;
591
680
  constructor(api: MoonbaseApi);
592
- validate(licenseId: string, activationId: string): Promise<LicenseActivation>;
593
- }
594
-
595
- declare const pricingVariationSchema: z.ZodObject<{
596
- id: z.ZodString;
597
- name: z.ZodString;
598
- originalPrice: z.ZodRecord<z.ZodString, z.ZodNumber>;
599
- price: z.ZodRecord<z.ZodString, z.ZodNumber>;
600
- hasDiscount: z.ZodBoolean;
601
- discount: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
602
- type: z.ZodLiteral<"PercentageOffDiscount">;
603
- name: z.ZodString;
604
- description: z.ZodOptional<z.ZodString>;
605
- percentage: z.ZodNumber;
606
- total: z.ZodRecord<z.ZodString, z.ZodNumber>;
607
- }, "strip", z.ZodTypeAny, {
608
- type: "PercentageOffDiscount";
609
- name: string;
610
- percentage: number;
611
- total: Record<string, number>;
612
- description?: string | undefined;
613
- }, {
614
- type: "PercentageOffDiscount";
615
- name: string;
616
- percentage: number;
617
- total: Record<string, number>;
618
- description?: string | undefined;
619
- }>, z.ZodObject<{
620
- type: z.ZodLiteral<"FlatAmountOffDiscount">;
621
- name: z.ZodString;
622
- description: z.ZodOptional<z.ZodString>;
623
- total: z.ZodRecord<z.ZodString, z.ZodNumber>;
624
- }, "strip", z.ZodTypeAny, {
625
- type: "FlatAmountOffDiscount";
626
- name: string;
627
- total: Record<string, number>;
628
- description?: string | undefined;
629
- }, {
630
- type: "FlatAmountOffDiscount";
631
- name: string;
632
- total: Record<string, number>;
633
- description?: string | undefined;
634
- }>]>>;
635
- }, "strip", z.ZodTypeAny, {
636
- id: string;
637
- name: string;
638
- originalPrice: Record<string, number>;
639
- price: Record<string, number>;
640
- hasDiscount: boolean;
641
- discount?: {
642
- type: "PercentageOffDiscount";
643
- name: string;
644
- percentage: number;
645
- total: Record<string, number>;
646
- description?: string | undefined;
647
- } | {
648
- type: "FlatAmountOffDiscount";
649
- name: string;
650
- total: Record<string, number>;
651
- description?: string | undefined;
652
- } | undefined;
653
- }, {
654
- id: string;
655
- name: string;
656
- originalPrice: Record<string, number>;
657
- price: Record<string, number>;
658
- hasDiscount: boolean;
659
- discount?: {
660
- type: "PercentageOffDiscount";
661
- name: string;
662
- percentage: number;
663
- total: Record<string, number>;
664
- description?: string | undefined;
665
- } | {
666
- type: "FlatAmountOffDiscount";
667
- name: string;
668
- total: Record<string, number>;
669
- description?: string | undefined;
670
- } | undefined;
671
- }>;
672
-
673
- type PricingVariation = z.infer<typeof pricingVariationSchema>;
674
- interface Page<T> {
675
- items: Array<T>;
676
- hasMore: boolean;
677
- next: string | null;
678
- }
679
- interface Quantifiable<T> {
680
- value: T;
681
- quantity: number;
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>;
682
695
  }
683
696
 
684
697
  declare const productSchema: z.ZodObject<{
package/dist/index.js CHANGED
@@ -162,17 +162,6 @@ var CustomerEndpoints = class {
162
162
  }
163
163
  };
164
164
 
165
- // src/licenses/endpoints.ts
166
- var LicenseEndpoints = class {
167
- constructor(api) {
168
- this.api = api;
169
- }
170
- async validate(licenseId, activationId) {
171
- const response = await this.api.fetch(`/api/licenses/${licenseId}/activations/${activationId}/validate`, "POST");
172
- return licenseActivationSchema.parse(response.data);
173
- }
174
- };
175
-
176
165
  // src/globalSchemas.ts
177
166
  import { z as z6 } from "zod";
178
167
  var priceCollectionSchema = z6.record(z6.number());
@@ -301,6 +290,37 @@ var MoonbaseApi = class {
301
290
  }
302
291
  };
303
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
+
304
324
  // src/products/endpoints.ts
305
325
  var ProductEndpoints = class {
306
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.110",
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",