@moonbase.sh/storefront-api 0.2.115 → 0.2.117
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 +209 -206
- package/dist/index.d.cts +4032 -4031
- package/dist/index.d.ts +4032 -4031
- package/dist/index.js +207 -204
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -420,6 +420,130 @@ var IdentityEndpoints = class {
|
|
|
420
420
|
}
|
|
421
421
|
};
|
|
422
422
|
|
|
423
|
+
// src/inventory/activation/endpoints.ts
|
|
424
|
+
import { z as z9 } from "zod";
|
|
425
|
+
|
|
426
|
+
// src/inventory/licenses/schemas.ts
|
|
427
|
+
import { z as z8 } from "zod";
|
|
428
|
+
|
|
429
|
+
// src/inventory/licenses/models.ts
|
|
430
|
+
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
431
|
+
LicenseStatus2["Active"] = "Active";
|
|
432
|
+
LicenseStatus2["Revoked"] = "Revoked";
|
|
433
|
+
return LicenseStatus2;
|
|
434
|
+
})(LicenseStatus || {});
|
|
435
|
+
var ActivationStatus = /* @__PURE__ */ ((ActivationStatus2) => {
|
|
436
|
+
ActivationStatus2["Active"] = "Active";
|
|
437
|
+
ActivationStatus2["Revoked"] = "Revoked";
|
|
438
|
+
return ActivationStatus2;
|
|
439
|
+
})(ActivationStatus || {});
|
|
440
|
+
var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
|
|
441
|
+
ActivationMethod2["Online"] = "Online";
|
|
442
|
+
ActivationMethod2["Offline"] = "Offline";
|
|
443
|
+
return ActivationMethod2;
|
|
444
|
+
})(ActivationMethod || {});
|
|
445
|
+
|
|
446
|
+
// src/inventory/licenses/schemas.ts
|
|
447
|
+
var licenseSchema = z8.object({
|
|
448
|
+
id: z8.string(),
|
|
449
|
+
status: z8.nativeEnum(LicenseStatus),
|
|
450
|
+
product: productSummarySchema,
|
|
451
|
+
activeNumberOfActivations: z8.number(),
|
|
452
|
+
maxNumberOfActivations: z8.number(),
|
|
453
|
+
createdAt: z8.coerce.date()
|
|
454
|
+
});
|
|
455
|
+
var activationSchema = z8.object({
|
|
456
|
+
id: z8.string(),
|
|
457
|
+
licenseId: z8.string(),
|
|
458
|
+
name: z8.string(),
|
|
459
|
+
status: z8.nativeEnum(ActivationStatus),
|
|
460
|
+
activationMethod: z8.nativeEnum(ActivationMethod),
|
|
461
|
+
lastValidatedAt: z8.coerce.date().nullable()
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
// src/inventory/activation/endpoints.ts
|
|
465
|
+
var ActivationEndpoints = class {
|
|
466
|
+
constructor(api, configuration) {
|
|
467
|
+
this.api = api;
|
|
468
|
+
this.configuration = configuration;
|
|
469
|
+
}
|
|
470
|
+
async activate(deviceToken, activationMethod) {
|
|
471
|
+
const response = await this.api.authenticatedFetch(`/api/customer/inventory/activate?method=${activationMethod}${this.configuration.includeManifests ? "&includeManifests=true" : ""}`, licenseSchema, {
|
|
472
|
+
method: "POST",
|
|
473
|
+
body: deviceToken,
|
|
474
|
+
contentType: "text/plain"
|
|
475
|
+
});
|
|
476
|
+
return {
|
|
477
|
+
license: response.data,
|
|
478
|
+
url: z9.string().parse(response.headers.location)
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
// src/inventory/licenses/endpoints.ts
|
|
484
|
+
var LicenseEndpoints = class {
|
|
485
|
+
constructor(api, configuration) {
|
|
486
|
+
this.api = api;
|
|
487
|
+
this.configuration = configuration;
|
|
488
|
+
}
|
|
489
|
+
async get(nextUrl) {
|
|
490
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
|
|
491
|
+
return response.data;
|
|
492
|
+
}
|
|
493
|
+
async getActivations(licenseId, nextUrl) {
|
|
494
|
+
const response = await this.api.authenticatedFetch(
|
|
495
|
+
nextUrl || `/api/customer/inventory/licenses/${licenseId}/activations`,
|
|
496
|
+
paged(activationSchema)
|
|
497
|
+
);
|
|
498
|
+
return response.data;
|
|
499
|
+
}
|
|
500
|
+
async revokeActivation(licenseId, activationId) {
|
|
501
|
+
await this.api.authenticatedFetch(`/api/customer/inventory/licenses/${licenseId}/activations/${activationId}/revoke`, null, { method: "POST" });
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
// src/inventory/products/endpoints.ts
|
|
506
|
+
import { z as z10 } from "zod";
|
|
507
|
+
var ProductEndpoints = class {
|
|
508
|
+
constructor(api, configuration) {
|
|
509
|
+
this.api = api;
|
|
510
|
+
this.configuration = configuration;
|
|
511
|
+
}
|
|
512
|
+
async get(productId, version) {
|
|
513
|
+
const response = await this.api.fetch(`/api/customer/inventory/products/${productId}${version ? `?version=${version}${this.configuration.includeManifests ? "&includeManifests=true" : ""}` : this.configuration.includeManifests ? "?includeManifests=true" : ""}`, productSummarySchema);
|
|
514
|
+
return response.data;
|
|
515
|
+
}
|
|
516
|
+
async getOwned(nextUrl) {
|
|
517
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(productSummarySchema));
|
|
518
|
+
return response.data;
|
|
519
|
+
}
|
|
520
|
+
async getLicenses(productId, nextUrl) {
|
|
521
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
|
|
522
|
+
return response.data;
|
|
523
|
+
}
|
|
524
|
+
async getActivations(productId, nextUrl) {
|
|
525
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses/activations`, paged(activationSchema));
|
|
526
|
+
return response.data;
|
|
527
|
+
}
|
|
528
|
+
async getDownloadUrl(path) {
|
|
529
|
+
const url = new URL(path);
|
|
530
|
+
url.searchParams.append("redirect", "false");
|
|
531
|
+
const response = await this.api.fetch(url.pathname + url.search, z10.object({
|
|
532
|
+
location: z10.string()
|
|
533
|
+
}));
|
|
534
|
+
return response.data.location;
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
// src/inventory/index.ts
|
|
539
|
+
var InventoryEndpoints = class {
|
|
540
|
+
constructor(api, configuration) {
|
|
541
|
+
this.licenses = new LicenseEndpoints(api, configuration);
|
|
542
|
+
this.products = new ProductEndpoints(api, configuration);
|
|
543
|
+
this.activation = new ActivationEndpoints(api, configuration);
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
|
|
423
547
|
// src/orders/schemas.ts
|
|
424
548
|
var schemas_exports = {};
|
|
425
549
|
__export(schemas_exports, {
|
|
@@ -430,7 +554,7 @@ __export(schemas_exports, {
|
|
|
430
554
|
openProductLineItem: () => openProductLineItem,
|
|
431
555
|
orderSchema: () => orderSchema
|
|
432
556
|
});
|
|
433
|
-
import { z as
|
|
557
|
+
import { z as z11 } from "zod";
|
|
434
558
|
|
|
435
559
|
// src/orders/models.ts
|
|
436
560
|
var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
@@ -442,90 +566,90 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
|
442
566
|
})(OrderStatus || {});
|
|
443
567
|
|
|
444
568
|
// src/orders/schemas.ts
|
|
445
|
-
var couponSchema =
|
|
446
|
-
code:
|
|
447
|
-
name:
|
|
448
|
-
description:
|
|
569
|
+
var couponSchema = z11.object({
|
|
570
|
+
code: z11.string(),
|
|
571
|
+
name: z11.string(),
|
|
572
|
+
description: z11.string()
|
|
449
573
|
});
|
|
450
|
-
var lineItemProductSchema =
|
|
451
|
-
id:
|
|
452
|
-
name:
|
|
453
|
-
tagline:
|
|
454
|
-
iconUrl:
|
|
574
|
+
var lineItemProductSchema = z11.object({
|
|
575
|
+
id: z11.string(),
|
|
576
|
+
name: z11.string(),
|
|
577
|
+
tagline: z11.string(),
|
|
578
|
+
iconUrl: z11.string().nullable()
|
|
455
579
|
});
|
|
456
|
-
var openProductLineItem =
|
|
457
|
-
id:
|
|
458
|
-
type:
|
|
459
|
-
productId:
|
|
460
|
-
quantity:
|
|
461
|
-
variationId:
|
|
580
|
+
var openProductLineItem = z11.object({
|
|
581
|
+
id: z11.string(),
|
|
582
|
+
type: z11.literal("Product"),
|
|
583
|
+
productId: z11.string(),
|
|
584
|
+
quantity: z11.number(),
|
|
585
|
+
variationId: z11.string(),
|
|
462
586
|
price: priceCollectionSchema.optional(),
|
|
463
587
|
variation: pricingVariationSchema.optional(),
|
|
464
588
|
product: lineItemProductSchema.optional(),
|
|
465
589
|
appliedDiscount: discountSchema.optional()
|
|
466
590
|
});
|
|
467
|
-
var lineItemBundleSchema =
|
|
468
|
-
id:
|
|
469
|
-
name:
|
|
470
|
-
tagline:
|
|
471
|
-
iconUrl:
|
|
472
|
-
products: lineItemProductSchema.and(
|
|
473
|
-
included:
|
|
591
|
+
var lineItemBundleSchema = z11.object({
|
|
592
|
+
id: z11.string(),
|
|
593
|
+
name: z11.string(),
|
|
594
|
+
tagline: z11.string(),
|
|
595
|
+
iconUrl: z11.string().nullable(),
|
|
596
|
+
products: lineItemProductSchema.and(z11.object({
|
|
597
|
+
included: z11.boolean().optional()
|
|
474
598
|
})).array()
|
|
475
599
|
});
|
|
476
|
-
var openBundleLineItem =
|
|
477
|
-
id:
|
|
478
|
-
type:
|
|
479
|
-
bundleId:
|
|
480
|
-
quantity:
|
|
481
|
-
variationId:
|
|
482
|
-
partial:
|
|
600
|
+
var openBundleLineItem = z11.object({
|
|
601
|
+
id: z11.string(),
|
|
602
|
+
type: z11.literal("Bundle"),
|
|
603
|
+
bundleId: z11.string(),
|
|
604
|
+
quantity: z11.number(),
|
|
605
|
+
variationId: z11.string(),
|
|
606
|
+
partial: z11.boolean().optional(),
|
|
483
607
|
price: priceCollectionSchema.optional(),
|
|
484
608
|
variation: pricingVariationSchema.optional(),
|
|
485
609
|
bundle: lineItemBundleSchema.optional(),
|
|
486
610
|
appliedDiscount: discountSchema.optional()
|
|
487
611
|
});
|
|
488
|
-
var openOrderLineItem =
|
|
612
|
+
var openOrderLineItem = z11.discriminatedUnion("type", [
|
|
489
613
|
openProductLineItem,
|
|
490
614
|
openBundleLineItem
|
|
491
615
|
]);
|
|
492
|
-
var openOrderSchema =
|
|
493
|
-
id:
|
|
494
|
-
status:
|
|
495
|
-
currency:
|
|
616
|
+
var openOrderSchema = z11.object({
|
|
617
|
+
id: z11.string(),
|
|
618
|
+
status: z11.literal("Open" /* Open */),
|
|
619
|
+
currency: z11.string(),
|
|
496
620
|
items: openOrderLineItem.array(),
|
|
497
621
|
couponsApplied: couponSchema.array(),
|
|
498
|
-
checkoutUrl:
|
|
499
|
-
embeddedCheckoutUrl:
|
|
622
|
+
checkoutUrl: z11.string().optional(),
|
|
623
|
+
embeddedCheckoutUrl: z11.string().optional()
|
|
500
624
|
});
|
|
501
|
-
var moneySchema =
|
|
502
|
-
currency:
|
|
503
|
-
amount:
|
|
625
|
+
var moneySchema = z11.object({
|
|
626
|
+
currency: z11.string(),
|
|
627
|
+
amount: z11.number()
|
|
504
628
|
});
|
|
505
|
-
var orderTotalSchema =
|
|
629
|
+
var orderTotalSchema = z11.object({
|
|
506
630
|
original: moneySchema,
|
|
507
631
|
discount: moneySchema,
|
|
508
632
|
subtotal: moneySchema,
|
|
509
633
|
taxes: moneySchema,
|
|
510
634
|
due: moneySchema
|
|
511
635
|
});
|
|
512
|
-
var customerSnapshotSchema =
|
|
513
|
-
name:
|
|
514
|
-
businessName:
|
|
515
|
-
taxId:
|
|
516
|
-
email:
|
|
636
|
+
var customerSnapshotSchema = z11.object({
|
|
637
|
+
name: z11.string().nullable(),
|
|
638
|
+
businessName: z11.string().nullable(),
|
|
639
|
+
taxId: z11.string().nullable(),
|
|
640
|
+
email: z11.string().nullable(),
|
|
517
641
|
address: addressSchema.nullable()
|
|
518
642
|
});
|
|
519
|
-
var completedOrderSchema =
|
|
520
|
-
id:
|
|
521
|
-
status:
|
|
522
|
-
currency:
|
|
643
|
+
var completedOrderSchema = z11.object({
|
|
644
|
+
id: z11.string(),
|
|
645
|
+
status: z11.literal("Completed" /* Completed */),
|
|
646
|
+
currency: z11.string(),
|
|
523
647
|
customer: customerSnapshotSchema,
|
|
524
648
|
total: orderTotalSchema,
|
|
525
649
|
items: openOrderLineItem.array(),
|
|
526
650
|
couponsApplied: couponSchema.array()
|
|
527
651
|
});
|
|
528
|
-
var orderSchema =
|
|
652
|
+
var orderSchema = z11.discriminatedUnion("status", [
|
|
529
653
|
openOrderSchema,
|
|
530
654
|
completedOrderSchema
|
|
531
655
|
]);
|
|
@@ -535,8 +659,10 @@ var OrderEndpoints = class {
|
|
|
535
659
|
constructor(api) {
|
|
536
660
|
this.api = api;
|
|
537
661
|
}
|
|
538
|
-
async get(orderId) {
|
|
539
|
-
const response = await this.api.fetch(`/api/customer/orders/${orderId}`, orderSchema
|
|
662
|
+
async get(orderId, abort) {
|
|
663
|
+
const response = await this.api.fetch(`/api/customer/orders/${orderId}`, orderSchema, {
|
|
664
|
+
abort
|
|
665
|
+
});
|
|
540
666
|
return response.data;
|
|
541
667
|
}
|
|
542
668
|
async pushContent(order, checkout, utm) {
|
|
@@ -624,7 +750,8 @@ var MoonbaseApi = class {
|
|
|
624
750
|
// Force CORS on all calls
|
|
625
751
|
"x-mb-cors": "1"
|
|
626
752
|
},
|
|
627
|
-
body: (options == null ? void 0 : options.body) ? contentType !== "application/json" ? options.body : JSON.stringify(options.body) : void 0
|
|
753
|
+
body: (options == null ? void 0 : options.body) ? contentType !== "application/json" ? options.body : JSON.stringify(options.body) : void 0,
|
|
754
|
+
signal: options == null ? void 0 : options.abort
|
|
628
755
|
});
|
|
629
756
|
if (response.status >= 400)
|
|
630
757
|
await handleResponseProblem(response);
|
|
@@ -752,14 +879,33 @@ var _TokenStore = class _TokenStore {
|
|
|
752
879
|
_TokenStore.storageKey = "moonbase_auth";
|
|
753
880
|
var TokenStore = _TokenStore;
|
|
754
881
|
|
|
882
|
+
// src/vendor/schemas.ts
|
|
883
|
+
import { z as z12 } from "zod";
|
|
884
|
+
var vendorSchema = z12.object({
|
|
885
|
+
id: z12.string(),
|
|
886
|
+
name: z12.string(),
|
|
887
|
+
logoUrl: z12.string().nullable()
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
// src/vendor/endpoints.ts
|
|
891
|
+
var VendorEndpoints = class {
|
|
892
|
+
constructor(api) {
|
|
893
|
+
this.api = api;
|
|
894
|
+
}
|
|
895
|
+
async get() {
|
|
896
|
+
const response = await this.api.fetch(`/api/public/vendors/current`, vendorSchema);
|
|
897
|
+
return response.data;
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
|
|
755
901
|
// src/vouchers/schemas.ts
|
|
756
|
-
import { z as
|
|
757
|
-
var voucherSchema =
|
|
758
|
-
id:
|
|
759
|
-
name:
|
|
760
|
-
description:
|
|
761
|
-
code:
|
|
762
|
-
redeemed:
|
|
902
|
+
import { z as z13 } from "zod";
|
|
903
|
+
var voucherSchema = z13.object({
|
|
904
|
+
id: z13.string(),
|
|
905
|
+
name: z13.string(),
|
|
906
|
+
description: z13.string(),
|
|
907
|
+
code: z13.string(),
|
|
908
|
+
redeemed: z13.boolean(),
|
|
763
909
|
redeemsProducts: quantifiable(storefrontProductSchema).array(),
|
|
764
910
|
redeemsBundles: quantifiable(storefrontBundleSchema).array()
|
|
765
911
|
});
|
|
@@ -785,149 +931,6 @@ var VoucherEndpoints = class {
|
|
|
785
931
|
}
|
|
786
932
|
};
|
|
787
933
|
|
|
788
|
-
// src/inventory/activation/endpoints.ts
|
|
789
|
-
import { z as z11 } from "zod";
|
|
790
|
-
|
|
791
|
-
// src/inventory/licenses/schemas.ts
|
|
792
|
-
import { z as z10 } from "zod";
|
|
793
|
-
|
|
794
|
-
// src/inventory/licenses/models.ts
|
|
795
|
-
var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
|
|
796
|
-
LicenseStatus2["Active"] = "Active";
|
|
797
|
-
LicenseStatus2["Revoked"] = "Revoked";
|
|
798
|
-
return LicenseStatus2;
|
|
799
|
-
})(LicenseStatus || {});
|
|
800
|
-
var ActivationStatus = /* @__PURE__ */ ((ActivationStatus2) => {
|
|
801
|
-
ActivationStatus2["Active"] = "Active";
|
|
802
|
-
ActivationStatus2["Revoked"] = "Revoked";
|
|
803
|
-
return ActivationStatus2;
|
|
804
|
-
})(ActivationStatus || {});
|
|
805
|
-
var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
|
|
806
|
-
ActivationMethod2["Online"] = "Online";
|
|
807
|
-
ActivationMethod2["Offline"] = "Offline";
|
|
808
|
-
return ActivationMethod2;
|
|
809
|
-
})(ActivationMethod || {});
|
|
810
|
-
|
|
811
|
-
// src/inventory/licenses/schemas.ts
|
|
812
|
-
var licenseSchema = z10.object({
|
|
813
|
-
id: z10.string(),
|
|
814
|
-
status: z10.nativeEnum(LicenseStatus),
|
|
815
|
-
product: productSummarySchema,
|
|
816
|
-
activeNumberOfActivations: z10.number(),
|
|
817
|
-
maxNumberOfActivations: z10.number(),
|
|
818
|
-
createdAt: z10.coerce.date()
|
|
819
|
-
});
|
|
820
|
-
var activationSchema = z10.object({
|
|
821
|
-
id: z10.string(),
|
|
822
|
-
licenseId: z10.string(),
|
|
823
|
-
name: z10.string(),
|
|
824
|
-
status: z10.nativeEnum(ActivationStatus),
|
|
825
|
-
activationMethod: z10.nativeEnum(ActivationMethod),
|
|
826
|
-
lastValidatedAt: z10.coerce.date().nullable()
|
|
827
|
-
});
|
|
828
|
-
|
|
829
|
-
// src/inventory/activation/endpoints.ts
|
|
830
|
-
var ActivationEndpoints = class {
|
|
831
|
-
constructor(api, configuration) {
|
|
832
|
-
this.api = api;
|
|
833
|
-
this.configuration = configuration;
|
|
834
|
-
}
|
|
835
|
-
async activate(deviceToken, activationMethod) {
|
|
836
|
-
const response = await this.api.authenticatedFetch(`/api/customer/inventory/activate?method=${activationMethod}${this.configuration.includeManifests ? "&includeManifests=true" : ""}`, licenseSchema, {
|
|
837
|
-
method: "POST",
|
|
838
|
-
body: deviceToken,
|
|
839
|
-
contentType: "text/plain"
|
|
840
|
-
});
|
|
841
|
-
return {
|
|
842
|
-
license: response.data,
|
|
843
|
-
url: z11.string().parse(response.headers.location)
|
|
844
|
-
};
|
|
845
|
-
}
|
|
846
|
-
};
|
|
847
|
-
|
|
848
|
-
// src/inventory/licenses/endpoints.ts
|
|
849
|
-
var LicenseEndpoints = class {
|
|
850
|
-
constructor(api, configuration) {
|
|
851
|
-
this.api = api;
|
|
852
|
-
this.configuration = configuration;
|
|
853
|
-
}
|
|
854
|
-
async get(nextUrl) {
|
|
855
|
-
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
|
|
856
|
-
return response.data;
|
|
857
|
-
}
|
|
858
|
-
async getActivations(licenseId, nextUrl) {
|
|
859
|
-
const response = await this.api.authenticatedFetch(
|
|
860
|
-
nextUrl || `/api/customer/inventory/licenses/${licenseId}/activations`,
|
|
861
|
-
paged(activationSchema)
|
|
862
|
-
);
|
|
863
|
-
return response.data;
|
|
864
|
-
}
|
|
865
|
-
async revokeActivation(licenseId, activationId) {
|
|
866
|
-
await this.api.authenticatedFetch(`/api/customer/inventory/licenses/${licenseId}/activations/${activationId}/revoke`, null, { method: "POST" });
|
|
867
|
-
}
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
// src/inventory/products/endpoints.ts
|
|
871
|
-
import { z as z12 } from "zod";
|
|
872
|
-
var ProductEndpoints = class {
|
|
873
|
-
constructor(api, configuration) {
|
|
874
|
-
this.api = api;
|
|
875
|
-
this.configuration = configuration;
|
|
876
|
-
}
|
|
877
|
-
async get(productId, version) {
|
|
878
|
-
const response = await this.api.fetch(`/api/customer/inventory/products/${productId}${version ? `?version=${version}${this.configuration.includeManifests ? "&includeManifests=true" : ""}` : this.configuration.includeManifests ? "?includeManifests=true" : ""}`, productSummarySchema);
|
|
879
|
-
return response.data;
|
|
880
|
-
}
|
|
881
|
-
async getOwned(nextUrl) {
|
|
882
|
-
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(productSummarySchema));
|
|
883
|
-
return response.data;
|
|
884
|
-
}
|
|
885
|
-
async getLicenses(productId, nextUrl) {
|
|
886
|
-
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
|
|
887
|
-
return response.data;
|
|
888
|
-
}
|
|
889
|
-
async getActivations(productId, nextUrl) {
|
|
890
|
-
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses/activations`, paged(activationSchema));
|
|
891
|
-
return response.data;
|
|
892
|
-
}
|
|
893
|
-
async getDownloadUrl(path) {
|
|
894
|
-
const url = new URL(path);
|
|
895
|
-
url.searchParams.append("redirect", "false");
|
|
896
|
-
const response = await this.api.fetch(url.pathname + url.search, z12.object({
|
|
897
|
-
location: z12.string()
|
|
898
|
-
}));
|
|
899
|
-
return response.data.location;
|
|
900
|
-
}
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
// src/inventory/index.ts
|
|
904
|
-
var InventoryEndpoints = class {
|
|
905
|
-
constructor(api, configuration) {
|
|
906
|
-
this.licenses = new LicenseEndpoints(api, configuration);
|
|
907
|
-
this.products = new ProductEndpoints(api, configuration);
|
|
908
|
-
this.activation = new ActivationEndpoints(api, configuration);
|
|
909
|
-
}
|
|
910
|
-
};
|
|
911
|
-
|
|
912
|
-
// src/vendor/schemas.ts
|
|
913
|
-
import { z as z13 } from "zod";
|
|
914
|
-
var vendorSchema = z13.object({
|
|
915
|
-
id: z13.string(),
|
|
916
|
-
name: z13.string(),
|
|
917
|
-
logoUrl: z13.string().nullable()
|
|
918
|
-
});
|
|
919
|
-
|
|
920
|
-
// src/vendor/endpoints.ts
|
|
921
|
-
var VendorEndpoints = class {
|
|
922
|
-
constructor(api) {
|
|
923
|
-
this.api = api;
|
|
924
|
-
}
|
|
925
|
-
async get() {
|
|
926
|
-
const response = await this.api.fetch(`/api/public/vendors/current`, vendorSchema);
|
|
927
|
-
return response.data;
|
|
928
|
-
}
|
|
929
|
-
};
|
|
930
|
-
|
|
931
934
|
// src/schemas.ts
|
|
932
935
|
var schemas_exports2 = {};
|
|
933
936
|
__export(schemas_exports2, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/storefront-api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.117",
|
|
5
5
|
"description": "Package to let you build storefronts with Moonbase.sh as payment and delivery provider",
|
|
6
6
|
"author": "Tobias Lønnerød Madsen <m@dsen.tv>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -20,11 +20,13 @@
|
|
|
20
20
|
"@types/node": "^22.5.4",
|
|
21
21
|
"rimraf": "^6.0.1",
|
|
22
22
|
"tsup": "^8.2.4",
|
|
23
|
-
"typescript": "~5.5.4"
|
|
23
|
+
"typescript": "~5.5.4",
|
|
24
|
+
"vitest": "^2.1.4"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
27
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
27
28
|
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
28
|
-
"version": "npm version"
|
|
29
|
+
"version": "npm version",
|
|
30
|
+
"test": "vitest"
|
|
29
31
|
}
|
|
30
32
|
}
|