@moonbase.sh/storefront-api 0.2.83 → 0.2.84
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 +25 -14
- package/dist/index.d.cts +635 -8
- package/dist/index.d.ts +635 -8
- package/dist/index.js +25 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -70,17 +70,25 @@ var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
|
70
70
|
})(Platform || {});
|
|
71
71
|
|
|
72
72
|
// src/inventory/products/schemas.ts
|
|
73
|
+
var manifestSchema = z2.object({
|
|
74
|
+
files: z2.object({
|
|
75
|
+
name: z2.string(),
|
|
76
|
+
path: z2.string()
|
|
77
|
+
}).array()
|
|
78
|
+
});
|
|
73
79
|
var downloadSchema = z2.object({
|
|
74
80
|
name: z2.string(),
|
|
75
81
|
key: z2.string(),
|
|
76
82
|
platform: z2.nativeEnum(Platform),
|
|
77
83
|
size: z2.number(),
|
|
78
|
-
path: z2.string().nullable()
|
|
84
|
+
path: z2.string().nullable(),
|
|
85
|
+
manifest: manifestSchema.optional()
|
|
79
86
|
});
|
|
80
87
|
var productSummarySchema = z2.object({
|
|
81
88
|
id: z2.string(),
|
|
82
89
|
name: z2.string(),
|
|
83
90
|
tagline: z2.string(),
|
|
91
|
+
description: z2.string().nullish(),
|
|
84
92
|
website: z2.string().optional(),
|
|
85
93
|
iconUrl: z2.string().optional(),
|
|
86
94
|
numberOfLicenses: z2.number().optional(),
|
|
@@ -809,11 +817,12 @@ var activationSchema = z10.object({
|
|
|
809
817
|
|
|
810
818
|
// src/inventory/activation/endpoints.ts
|
|
811
819
|
var ActivationEndpoints = class {
|
|
812
|
-
constructor(api) {
|
|
820
|
+
constructor(api, configuration) {
|
|
813
821
|
this.api = api;
|
|
822
|
+
this.configuration = configuration;
|
|
814
823
|
}
|
|
815
824
|
async activate(deviceToken, activationMethod) {
|
|
816
|
-
const response = await this.api.authenticatedFetch(`/api/customer/inventory/activate?method=${activationMethod}`, licenseSchema, {
|
|
825
|
+
const response = await this.api.authenticatedFetch(`/api/customer/inventory/activate?method=${activationMethod}${this.configuration.includeManifests ? "&includeManifests=true" : ""}`, licenseSchema, {
|
|
817
826
|
method: "POST",
|
|
818
827
|
body: deviceToken,
|
|
819
828
|
contentType: "text/plain"
|
|
@@ -827,11 +836,12 @@ var ActivationEndpoints = class {
|
|
|
827
836
|
|
|
828
837
|
// src/inventory/licenses/endpoints.ts
|
|
829
838
|
var LicenseEndpoints = class {
|
|
830
|
-
constructor(api) {
|
|
839
|
+
constructor(api, configuration) {
|
|
831
840
|
this.api = api;
|
|
841
|
+
this.configuration = configuration;
|
|
832
842
|
}
|
|
833
843
|
async get(nextUrl) {
|
|
834
|
-
const response = await this.api.authenticatedFetch(nextUrl ||
|
|
844
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
|
|
835
845
|
return response.data;
|
|
836
846
|
}
|
|
837
847
|
async getActivations(licenseId, nextUrl) {
|
|
@@ -849,19 +859,20 @@ var LicenseEndpoints = class {
|
|
|
849
859
|
// src/inventory/products/endpoints.ts
|
|
850
860
|
import { z as z12 } from "zod";
|
|
851
861
|
var ProductEndpoints = class {
|
|
852
|
-
constructor(api) {
|
|
862
|
+
constructor(api, configuration) {
|
|
853
863
|
this.api = api;
|
|
864
|
+
this.configuration = configuration;
|
|
854
865
|
}
|
|
855
866
|
async get(productId, version) {
|
|
856
|
-
const response = await this.api.fetch(`/api/customer/inventory/products/${productId}${version ? `?version=${version}` : ""}`, productSummarySchema);
|
|
867
|
+
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);
|
|
857
868
|
return response.data;
|
|
858
869
|
}
|
|
859
870
|
async getOwned(nextUrl) {
|
|
860
|
-
const response = await this.api.authenticatedFetch(nextUrl ||
|
|
871
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(productSummarySchema));
|
|
861
872
|
return response.data;
|
|
862
873
|
}
|
|
863
874
|
async getLicenses(productId, nextUrl) {
|
|
864
|
-
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses`, paged(licenseSchema));
|
|
875
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
|
|
865
876
|
return response.data;
|
|
866
877
|
}
|
|
867
878
|
async getActivations(productId, nextUrl) {
|
|
@@ -880,10 +891,10 @@ var ProductEndpoints = class {
|
|
|
880
891
|
|
|
881
892
|
// src/inventory/index.ts
|
|
882
893
|
var InventoryEndpoints = class {
|
|
883
|
-
constructor(api) {
|
|
884
|
-
this.licenses = new LicenseEndpoints(api);
|
|
885
|
-
this.products = new ProductEndpoints(api);
|
|
886
|
-
this.activation = new ActivationEndpoints(api);
|
|
894
|
+
constructor(api, configuration) {
|
|
895
|
+
this.licenses = new LicenseEndpoints(api, configuration);
|
|
896
|
+
this.products = new ProductEndpoints(api, configuration);
|
|
897
|
+
this.activation = new ActivationEndpoints(api, configuration);
|
|
887
898
|
}
|
|
888
899
|
};
|
|
889
900
|
|
|
@@ -923,7 +934,7 @@ var MoonbaseClient = class {
|
|
|
923
934
|
this.identity = new IdentityEndpoints(api, this.tokenStore);
|
|
924
935
|
this.vouchers = new VoucherEndpoints(api);
|
|
925
936
|
this.orders = new OrderEndpoints(api);
|
|
926
|
-
this.inventory = new InventoryEndpoints(api);
|
|
937
|
+
this.inventory = new InventoryEndpoints(api, this.configuration);
|
|
927
938
|
this.activationRequests = new ActivationRequestEndpoints(api);
|
|
928
939
|
this.vendor = new VendorEndpoints(api);
|
|
929
940
|
}
|
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.84",
|
|
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",
|