@moonbase.sh/storefront-api 0.2.83 → 0.2.86
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 +34 -17
- package/dist/index.d.cts +697 -10
- package/dist/index.d.ts +697 -10
- package/dist/index.js +34 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -112,17 +112,25 @@ var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
|
112
112
|
})(Platform || {});
|
|
113
113
|
|
|
114
114
|
// src/inventory/products/schemas.ts
|
|
115
|
+
var manifestSchema = import_zod2.z.object({
|
|
116
|
+
files: import_zod2.z.object({
|
|
117
|
+
name: import_zod2.z.string(),
|
|
118
|
+
path: import_zod2.z.string()
|
|
119
|
+
}).array()
|
|
120
|
+
});
|
|
115
121
|
var downloadSchema = import_zod2.z.object({
|
|
116
122
|
name: import_zod2.z.string(),
|
|
117
123
|
key: import_zod2.z.string(),
|
|
118
124
|
platform: import_zod2.z.nativeEnum(Platform),
|
|
119
125
|
size: import_zod2.z.number(),
|
|
120
|
-
path: import_zod2.z.string().nullable()
|
|
126
|
+
path: import_zod2.z.string().nullable(),
|
|
127
|
+
manifest: manifestSchema.optional()
|
|
121
128
|
});
|
|
122
129
|
var productSummarySchema = import_zod2.z.object({
|
|
123
130
|
id: import_zod2.z.string(),
|
|
124
131
|
name: import_zod2.z.string(),
|
|
125
132
|
tagline: import_zod2.z.string(),
|
|
133
|
+
description: import_zod2.z.string().nullish(),
|
|
126
134
|
website: import_zod2.z.string().optional(),
|
|
127
135
|
iconUrl: import_zod2.z.string().optional(),
|
|
128
136
|
numberOfLicenses: import_zod2.z.number().optional(),
|
|
@@ -143,6 +151,7 @@ var storefrontProductSchema = import_zod3.z.object({
|
|
|
143
151
|
id: import_zod3.z.string(),
|
|
144
152
|
name: import_zod3.z.string(),
|
|
145
153
|
tagline: import_zod3.z.string(),
|
|
154
|
+
description: import_zod3.z.string(),
|
|
146
155
|
iconUrl: import_zod3.z.string().nullable(),
|
|
147
156
|
website: import_zod3.z.string().nullish(),
|
|
148
157
|
owned: import_zod3.z.boolean(),
|
|
@@ -156,6 +165,7 @@ var storefrontBundleSchema = import_zod3.z.object({
|
|
|
156
165
|
id: import_zod3.z.string(),
|
|
157
166
|
name: import_zod3.z.string(),
|
|
158
167
|
tagline: import_zod3.z.string(),
|
|
168
|
+
description: import_zod3.z.string(),
|
|
159
169
|
iconUrl: import_zod3.z.string().nullable(),
|
|
160
170
|
owned: import_zod3.z.boolean(),
|
|
161
171
|
partial: import_zod3.z.boolean(),
|
|
@@ -610,11 +620,15 @@ function utmToObject(utm) {
|
|
|
610
620
|
|
|
611
621
|
// src/storefront/endpoints.ts
|
|
612
622
|
var StorefrontEndpoints = class {
|
|
613
|
-
constructor(api) {
|
|
623
|
+
constructor(api, configuration) {
|
|
614
624
|
this.api = api;
|
|
625
|
+
this.configuration = configuration;
|
|
615
626
|
}
|
|
616
627
|
async get(utm) {
|
|
617
|
-
const query = new URLSearchParams(
|
|
628
|
+
const query = new URLSearchParams(this.configuration.includeManifests ? {
|
|
629
|
+
includeManifests: "true",
|
|
630
|
+
...utmToObject(utm)
|
|
631
|
+
} : utmToObject(utm));
|
|
618
632
|
const response = await this.api.fetch(`/api/customer/storefront?${query.toString()}`, storefrontSchema);
|
|
619
633
|
return response.data;
|
|
620
634
|
}
|
|
@@ -851,11 +865,12 @@ var activationSchema = import_zod10.z.object({
|
|
|
851
865
|
|
|
852
866
|
// src/inventory/activation/endpoints.ts
|
|
853
867
|
var ActivationEndpoints = class {
|
|
854
|
-
constructor(api) {
|
|
868
|
+
constructor(api, configuration) {
|
|
855
869
|
this.api = api;
|
|
870
|
+
this.configuration = configuration;
|
|
856
871
|
}
|
|
857
872
|
async activate(deviceToken, activationMethod) {
|
|
858
|
-
const response = await this.api.authenticatedFetch(`/api/customer/inventory/activate?method=${activationMethod}`, licenseSchema, {
|
|
873
|
+
const response = await this.api.authenticatedFetch(`/api/customer/inventory/activate?method=${activationMethod}${this.configuration.includeManifests ? "&includeManifests=true" : ""}`, licenseSchema, {
|
|
859
874
|
method: "POST",
|
|
860
875
|
body: deviceToken,
|
|
861
876
|
contentType: "text/plain"
|
|
@@ -869,11 +884,12 @@ var ActivationEndpoints = class {
|
|
|
869
884
|
|
|
870
885
|
// src/inventory/licenses/endpoints.ts
|
|
871
886
|
var LicenseEndpoints = class {
|
|
872
|
-
constructor(api) {
|
|
887
|
+
constructor(api, configuration) {
|
|
873
888
|
this.api = api;
|
|
889
|
+
this.configuration = configuration;
|
|
874
890
|
}
|
|
875
891
|
async get(nextUrl) {
|
|
876
|
-
const response = await this.api.authenticatedFetch(nextUrl ||
|
|
892
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
|
|
877
893
|
return response.data;
|
|
878
894
|
}
|
|
879
895
|
async getActivations(licenseId, nextUrl) {
|
|
@@ -891,19 +907,20 @@ var LicenseEndpoints = class {
|
|
|
891
907
|
// src/inventory/products/endpoints.ts
|
|
892
908
|
var import_zod12 = require("zod");
|
|
893
909
|
var ProductEndpoints = class {
|
|
894
|
-
constructor(api) {
|
|
910
|
+
constructor(api, configuration) {
|
|
895
911
|
this.api = api;
|
|
912
|
+
this.configuration = configuration;
|
|
896
913
|
}
|
|
897
914
|
async get(productId, version) {
|
|
898
|
-
const response = await this.api.fetch(`/api/customer/inventory/products/${productId}${version ? `?version=${version}` : ""}`, productSummarySchema);
|
|
915
|
+
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);
|
|
899
916
|
return response.data;
|
|
900
917
|
}
|
|
901
918
|
async getOwned(nextUrl) {
|
|
902
|
-
const response = await this.api.authenticatedFetch(nextUrl ||
|
|
919
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(productSummarySchema));
|
|
903
920
|
return response.data;
|
|
904
921
|
}
|
|
905
922
|
async getLicenses(productId, nextUrl) {
|
|
906
|
-
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses`, paged(licenseSchema));
|
|
923
|
+
const response = await this.api.authenticatedFetch(nextUrl || `/api/customer/inventory/products/${productId}/licenses${this.configuration.includeManifests ? "?includeManifests=true" : ""}`, paged(licenseSchema));
|
|
907
924
|
return response.data;
|
|
908
925
|
}
|
|
909
926
|
async getActivations(productId, nextUrl) {
|
|
@@ -922,10 +939,10 @@ var ProductEndpoints = class {
|
|
|
922
939
|
|
|
923
940
|
// src/inventory/index.ts
|
|
924
941
|
var InventoryEndpoints = class {
|
|
925
|
-
constructor(api) {
|
|
926
|
-
this.licenses = new LicenseEndpoints(api);
|
|
927
|
-
this.products = new ProductEndpoints(api);
|
|
928
|
-
this.activation = new ActivationEndpoints(api);
|
|
942
|
+
constructor(api, configuration) {
|
|
943
|
+
this.licenses = new LicenseEndpoints(api, configuration);
|
|
944
|
+
this.products = new ProductEndpoints(api, configuration);
|
|
945
|
+
this.activation = new ActivationEndpoints(api, configuration);
|
|
929
946
|
}
|
|
930
947
|
};
|
|
931
948
|
|
|
@@ -961,11 +978,11 @@ var MoonbaseClient = class {
|
|
|
961
978
|
this.configuration.endpoint = this.configuration.endpoint.replace(/\/$/, "");
|
|
962
979
|
this.tokenStore = new TokenStore(configuration);
|
|
963
980
|
const api = new MoonbaseApi(this.configuration.endpoint, this.tokenStore);
|
|
964
|
-
this.storefront = new StorefrontEndpoints(api);
|
|
981
|
+
this.storefront = new StorefrontEndpoints(api, this.configuration);
|
|
965
982
|
this.identity = new IdentityEndpoints(api, this.tokenStore);
|
|
966
983
|
this.vouchers = new VoucherEndpoints(api);
|
|
967
984
|
this.orders = new OrderEndpoints(api);
|
|
968
|
-
this.inventory = new InventoryEndpoints(api);
|
|
985
|
+
this.inventory = new InventoryEndpoints(api, this.configuration);
|
|
969
986
|
this.activationRequests = new ActivationRequestEndpoints(api);
|
|
970
987
|
this.vendor = new VendorEndpoints(api);
|
|
971
988
|
}
|