@moonbase.sh/api 0.4.32 → 0.4.34
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 +230 -193
- package/dist/index.d.cts +1969 -107
- package/dist/index.d.ts +1969 -107
- package/dist/index.js +230 -193
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -50,49 +50,118 @@ __export(index_exports, {
|
|
|
50
50
|
module.exports = __toCommonJS(index_exports);
|
|
51
51
|
|
|
52
52
|
// src/activationRequests/schemas.ts
|
|
53
|
-
var
|
|
53
|
+
var import_zod6 = require("zod");
|
|
54
54
|
|
|
55
55
|
// src/licenses/schemas.ts
|
|
56
|
-
var
|
|
56
|
+
var import_zod3 = require("zod");
|
|
57
57
|
|
|
58
58
|
// src/customers/schemas.ts
|
|
59
|
+
var import_zod2 = require("zod");
|
|
60
|
+
|
|
61
|
+
// src/globalSchemas.ts
|
|
59
62
|
var import_zod = require("zod");
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
var userSchema = import_zod.z.object({
|
|
64
|
+
id: import_zod.z.string(),
|
|
65
|
+
name: import_zod.z.string(),
|
|
66
|
+
email: import_zod.z.string()
|
|
67
|
+
});
|
|
68
|
+
var entityChangeSchema = import_zod.z.object({
|
|
69
|
+
at: import_zod.z.coerce.date(),
|
|
70
|
+
by: userSchema
|
|
71
|
+
});
|
|
72
|
+
var moneySchema = import_zod.z.object({
|
|
73
|
+
currency: import_zod.z.string(),
|
|
74
|
+
amount: import_zod.z.number()
|
|
75
|
+
});
|
|
76
|
+
var priceCollectionSchema = import_zod.z.record(import_zod.z.number());
|
|
77
|
+
var percentageOffDiscountSchema = import_zod.z.object({
|
|
78
|
+
type: import_zod.z.literal("PercentageOffDiscount"),
|
|
79
|
+
percentage: import_zod.z.number()
|
|
80
|
+
});
|
|
81
|
+
var flatAmountOffDiscountSchema = import_zod.z.object({
|
|
82
|
+
type: import_zod.z.literal("FlatAmountOffDiscount"),
|
|
83
|
+
total: priceCollectionSchema
|
|
71
84
|
});
|
|
72
|
-
var
|
|
85
|
+
var discountSchema = import_zod.z.discriminatedUnion("type", [
|
|
86
|
+
percentageOffDiscountSchema,
|
|
87
|
+
flatAmountOffDiscountSchema
|
|
88
|
+
]);
|
|
89
|
+
var dateTimeSpanSchema = import_zod.z.object({
|
|
90
|
+
from: import_zod.z.coerce.date().nullable(),
|
|
91
|
+
to: import_zod.z.coerce.date().nullable()
|
|
92
|
+
});
|
|
93
|
+
var pricingDiscountSchema = import_zod.z.object({
|
|
94
|
+
name: import_zod.z.string(),
|
|
95
|
+
description: import_zod.z.string().nullable(),
|
|
96
|
+
discount: discountSchema,
|
|
97
|
+
applicableVariationIds: import_zod.z.string().array().nullable(),
|
|
98
|
+
validity: dateTimeSpanSchema.nullable()
|
|
99
|
+
});
|
|
100
|
+
var pricingVariationSchema = import_zod.z.object({
|
|
73
101
|
id: import_zod.z.string(),
|
|
74
|
-
externalId: import_zod.z.string().optional(),
|
|
75
102
|
name: import_zod.z.string(),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
103
|
+
price: priceCollectionSchema
|
|
104
|
+
});
|
|
105
|
+
function paged(itemSchema, api) {
|
|
106
|
+
return import_zod.z.object({
|
|
107
|
+
items: import_zod.z.array(itemSchema),
|
|
108
|
+
hasMore: import_zod.z.boolean(),
|
|
109
|
+
next: import_zod.z.string().nullable()
|
|
110
|
+
}).transform((page) => ({
|
|
111
|
+
...page,
|
|
112
|
+
getNext: () => {
|
|
113
|
+
if (!page.hasMore || !page.next)
|
|
114
|
+
throw new Error("Response indicates no more results");
|
|
115
|
+
return api.fetch(page.next).then((response) => paged(itemSchema, api).parse(response.data));
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
function quantifiable(itemSchema) {
|
|
120
|
+
return import_zod.z.object({
|
|
121
|
+
value: itemSchema,
|
|
122
|
+
quantity: import_zod.z.number()
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/customers/schemas.ts
|
|
127
|
+
var addressSchema = import_zod2.z.object({
|
|
128
|
+
countryCode: import_zod2.z.string(),
|
|
129
|
+
streetAddress1: import_zod2.z.string(),
|
|
130
|
+
streetAddress2: import_zod2.z.string().nullable(),
|
|
131
|
+
locality: import_zod2.z.string().nullable(),
|
|
132
|
+
region: import_zod2.z.string().nullable(),
|
|
133
|
+
postCode: import_zod2.z.string().nullable()
|
|
134
|
+
});
|
|
135
|
+
var communicationPreferencesSchema = import_zod2.z.object({
|
|
136
|
+
newsletterOptIn: import_zod2.z.boolean()
|
|
137
|
+
// productUpdatesOptIn: z.boolean(), // TODO: Enable when relevant
|
|
138
|
+
});
|
|
139
|
+
var customerSchema = import_zod2.z.object({
|
|
140
|
+
id: import_zod2.z.string(),
|
|
141
|
+
externalId: import_zod2.z.string().optional(),
|
|
142
|
+
name: import_zod2.z.string(),
|
|
143
|
+
businessName: import_zod2.z.string().nullable(),
|
|
144
|
+
taxId: import_zod2.z.string().nullable(),
|
|
145
|
+
email: import_zod2.z.string(),
|
|
146
|
+
numberOfLicenses: import_zod2.z.number(),
|
|
147
|
+
numberOfTrials: import_zod2.z.number(),
|
|
148
|
+
emailConfirmed: import_zod2.z.boolean(),
|
|
149
|
+
hasPassword: import_zod2.z.boolean(),
|
|
150
|
+
isDeleted: import_zod2.z.boolean(),
|
|
151
|
+
ownedProducts: import_zod2.z.string().array().transform((arr) => arr.sort()),
|
|
152
|
+
subscribedProducts: import_zod2.z.string().array().transform((arr) => arr.sort()),
|
|
86
153
|
address: addressSchema.nullable(),
|
|
87
|
-
communicationPreferences: communicationPreferencesSchema
|
|
154
|
+
communicationPreferences: communicationPreferencesSchema,
|
|
155
|
+
lastUpdated: entityChangeSchema,
|
|
156
|
+
created: entityChangeSchema
|
|
88
157
|
});
|
|
89
|
-
var importCustomerRequestSchema =
|
|
90
|
-
name:
|
|
91
|
-
email:
|
|
92
|
-
externalId:
|
|
93
|
-
password:
|
|
158
|
+
var importCustomerRequestSchema = import_zod2.z.object({
|
|
159
|
+
name: import_zod2.z.string(),
|
|
160
|
+
email: import_zod2.z.string(),
|
|
161
|
+
externalId: import_zod2.z.string().optional(),
|
|
162
|
+
password: import_zod2.z.string().optional(),
|
|
94
163
|
address: addressSchema.optional(),
|
|
95
|
-
createdAt:
|
|
164
|
+
createdAt: import_zod2.z.date().optional()
|
|
96
165
|
});
|
|
97
166
|
|
|
98
167
|
// src/licenses/models.ts
|
|
@@ -114,61 +183,86 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
|
|
|
114
183
|
})(ActivationMethod || {});
|
|
115
184
|
|
|
116
185
|
// src/licenses/schemas.ts
|
|
117
|
-
var
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
186
|
+
var licenseSourceSchema = import_zod3.z.discriminatedUnion("type", [
|
|
187
|
+
import_zod3.z.object({
|
|
188
|
+
type: import_zod3.z.literal("Order"),
|
|
189
|
+
orderId: import_zod3.z.string()
|
|
190
|
+
}),
|
|
191
|
+
import_zod3.z.object({
|
|
192
|
+
type: import_zod3.z.literal("Subscription"),
|
|
193
|
+
subscriptionId: import_zod3.z.string()
|
|
194
|
+
}),
|
|
195
|
+
import_zod3.z.object({
|
|
196
|
+
type: import_zod3.z.literal("Voucher"),
|
|
197
|
+
voucherId: import_zod3.z.string(),
|
|
198
|
+
code: import_zod3.z.string()
|
|
199
|
+
}),
|
|
200
|
+
import_zod3.z.object({
|
|
201
|
+
type: import_zod3.z.literal("Fastspring"),
|
|
202
|
+
reference: import_zod3.z.string(),
|
|
203
|
+
testMode: import_zod3.z.boolean()
|
|
204
|
+
})
|
|
205
|
+
]);
|
|
206
|
+
var licenseSchema = import_zod3.z.object({
|
|
207
|
+
id: import_zod3.z.string(),
|
|
208
|
+
externalId: import_zod3.z.string().optional(),
|
|
209
|
+
productId: import_zod3.z.string(),
|
|
210
|
+
ownerId: import_zod3.z.string(),
|
|
211
|
+
status: import_zod3.z.nativeEnum(LicenseStatus),
|
|
212
|
+
activeNumberOfActivations: import_zod3.z.number(),
|
|
213
|
+
maxNumberOfActivations: import_zod3.z.number(),
|
|
214
|
+
offlineActivationsAllowed: import_zod3.z.boolean(),
|
|
215
|
+
source: licenseSourceSchema.nullable(),
|
|
216
|
+
lastUpdated: entityChangeSchema,
|
|
217
|
+
created: entityChangeSchema
|
|
218
|
+
});
|
|
219
|
+
var licenseActivationSchema = import_zod3.z.object({
|
|
220
|
+
id: import_zod3.z.string(),
|
|
221
|
+
name: import_zod3.z.string(),
|
|
222
|
+
signature: import_zod3.z.string(),
|
|
223
|
+
status: import_zod3.z.nativeEnum(ActivationStatus),
|
|
224
|
+
activationMethod: import_zod3.z.nativeEnum(ActivationMethod),
|
|
225
|
+
lastValidatedAt: import_zod3.z.coerce.date(),
|
|
134
226
|
license: licenseSchema,
|
|
135
|
-
customer: customerSchema.optional()
|
|
227
|
+
customer: customerSchema.optional(),
|
|
228
|
+
lastUpdated: entityChangeSchema,
|
|
229
|
+
created: entityChangeSchema
|
|
136
230
|
});
|
|
137
|
-
var importLicenseRequestSchema =
|
|
138
|
-
ownerId:
|
|
139
|
-
productId:
|
|
140
|
-
externalId:
|
|
141
|
-
createdAt:
|
|
142
|
-
maxNumberOfActivations:
|
|
143
|
-
offlineActivationsAllowed:
|
|
144
|
-
activations:
|
|
145
|
-
activationMethod:
|
|
146
|
-
deviceName:
|
|
147
|
-
deviceSignature:
|
|
148
|
-
lastValidation:
|
|
231
|
+
var importLicenseRequestSchema = import_zod3.z.object({
|
|
232
|
+
ownerId: import_zod3.z.string(),
|
|
233
|
+
productId: import_zod3.z.string(),
|
|
234
|
+
externalId: import_zod3.z.string().optional(),
|
|
235
|
+
createdAt: import_zod3.z.date().optional(),
|
|
236
|
+
maxNumberOfActivations: import_zod3.z.number().optional(),
|
|
237
|
+
offlineActivationsAllowed: import_zod3.z.boolean().optional(),
|
|
238
|
+
activations: import_zod3.z.object({
|
|
239
|
+
activationMethod: import_zod3.z.nativeEnum(ActivationMethod),
|
|
240
|
+
deviceName: import_zod3.z.string(),
|
|
241
|
+
deviceSignature: import_zod3.z.string(),
|
|
242
|
+
lastValidation: import_zod3.z.date().optional()
|
|
149
243
|
}).array().optional()
|
|
150
244
|
});
|
|
151
|
-
var provisionLicensesRequestRequestSchema =
|
|
152
|
-
productId:
|
|
153
|
-
quantity:
|
|
154
|
-
limitPerCustomer:
|
|
245
|
+
var provisionLicensesRequestRequestSchema = import_zod3.z.object({
|
|
246
|
+
productId: import_zod3.z.string(),
|
|
247
|
+
quantity: import_zod3.z.number().optional(),
|
|
248
|
+
limitPerCustomer: import_zod3.z.number().optional()
|
|
155
249
|
}).array();
|
|
156
|
-
var provisionLicensesRequestSchema =
|
|
157
|
-
|
|
158
|
-
ownerId:
|
|
250
|
+
var provisionLicensesRequestSchema = import_zod3.z.union([
|
|
251
|
+
import_zod3.z.object({
|
|
252
|
+
ownerId: import_zod3.z.string(),
|
|
159
253
|
requests: provisionLicensesRequestRequestSchema
|
|
160
254
|
}),
|
|
161
|
-
|
|
162
|
-
customer:
|
|
163
|
-
name:
|
|
164
|
-
email:
|
|
255
|
+
import_zod3.z.object({
|
|
256
|
+
customer: import_zod3.z.object({
|
|
257
|
+
name: import_zod3.z.string(),
|
|
258
|
+
email: import_zod3.z.string()
|
|
165
259
|
}),
|
|
166
260
|
requests: provisionLicensesRequestRequestSchema
|
|
167
261
|
})
|
|
168
262
|
]);
|
|
169
263
|
|
|
170
264
|
// src/products/schemas.ts
|
|
171
|
-
var
|
|
265
|
+
var import_zod4 = require("zod");
|
|
172
266
|
|
|
173
267
|
// src/products/models.ts
|
|
174
268
|
var Platform = /* @__PURE__ */ ((Platform2) => {
|
|
@@ -187,36 +281,36 @@ var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
|
|
|
187
281
|
})(ProductStatus || {});
|
|
188
282
|
|
|
189
283
|
// src/products/schemas.ts
|
|
190
|
-
var productSchema =
|
|
191
|
-
id:
|
|
192
|
-
name:
|
|
193
|
-
tagline:
|
|
194
|
-
description:
|
|
195
|
-
website:
|
|
196
|
-
iconUrl:
|
|
197
|
-
status:
|
|
198
|
-
purchasable:
|
|
199
|
-
currentReleaseVersion:
|
|
200
|
-
});
|
|
201
|
-
var productReleaseSchema =
|
|
202
|
-
version:
|
|
203
|
-
description:
|
|
204
|
-
publishedAt:
|
|
205
|
-
downloadUrl:
|
|
206
|
-
hostedDownloadUrl:
|
|
207
|
-
downloads:
|
|
208
|
-
name:
|
|
209
|
-
key:
|
|
210
|
-
platform:
|
|
211
|
-
size:
|
|
212
|
-
downloadUrl:
|
|
213
|
-
hostedDownloadUrl:
|
|
214
|
-
directUrl:
|
|
284
|
+
var productSchema = import_zod4.z.object({
|
|
285
|
+
id: import_zod4.z.string(),
|
|
286
|
+
name: import_zod4.z.string(),
|
|
287
|
+
tagline: import_zod4.z.string(),
|
|
288
|
+
description: import_zod4.z.string(),
|
|
289
|
+
website: import_zod4.z.string().nullable(),
|
|
290
|
+
iconUrl: import_zod4.z.string().nullable(),
|
|
291
|
+
status: import_zod4.z.nativeEnum(ProductStatus),
|
|
292
|
+
purchasable: import_zod4.z.boolean(),
|
|
293
|
+
currentReleaseVersion: import_zod4.z.string().nullable()
|
|
294
|
+
});
|
|
295
|
+
var productReleaseSchema = import_zod4.z.object({
|
|
296
|
+
version: import_zod4.z.string(),
|
|
297
|
+
description: import_zod4.z.string().nullable(),
|
|
298
|
+
publishedAt: import_zod4.z.coerce.date().nullable(),
|
|
299
|
+
downloadUrl: import_zod4.z.string(),
|
|
300
|
+
hostedDownloadUrl: import_zod4.z.string(),
|
|
301
|
+
downloads: import_zod4.z.object({
|
|
302
|
+
name: import_zod4.z.string(),
|
|
303
|
+
key: import_zod4.z.string(),
|
|
304
|
+
platform: import_zod4.z.nativeEnum(Platform),
|
|
305
|
+
size: import_zod4.z.number(),
|
|
306
|
+
downloadUrl: import_zod4.z.string(),
|
|
307
|
+
hostedDownloadUrl: import_zod4.z.string(),
|
|
308
|
+
directUrl: import_zod4.z.string()
|
|
215
309
|
}).array()
|
|
216
310
|
});
|
|
217
311
|
|
|
218
312
|
// src/trials/schemas.ts
|
|
219
|
-
var
|
|
313
|
+
var import_zod5 = require("zod");
|
|
220
314
|
|
|
221
315
|
// src/trials/models.ts
|
|
222
316
|
var TrialStatus = /* @__PURE__ */ ((TrialStatus2) => {
|
|
@@ -226,26 +320,28 @@ var TrialStatus = /* @__PURE__ */ ((TrialStatus2) => {
|
|
|
226
320
|
})(TrialStatus || {});
|
|
227
321
|
|
|
228
322
|
// src/trials/schemas.ts
|
|
229
|
-
var trialSchema =
|
|
230
|
-
id:
|
|
231
|
-
externalId:
|
|
232
|
-
productId:
|
|
233
|
-
deviceName:
|
|
234
|
-
deviceSignature:
|
|
235
|
-
status:
|
|
236
|
-
expiresAt:
|
|
237
|
-
lastValidatedAt:
|
|
238
|
-
customer: customerSchema.optional()
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
323
|
+
var trialSchema = import_zod5.z.object({
|
|
324
|
+
id: import_zod5.z.string(),
|
|
325
|
+
externalId: import_zod5.z.string().optional(),
|
|
326
|
+
productId: import_zod5.z.string(),
|
|
327
|
+
deviceName: import_zod5.z.string(),
|
|
328
|
+
deviceSignature: import_zod5.z.string(),
|
|
329
|
+
status: import_zod5.z.nativeEnum(TrialStatus),
|
|
330
|
+
expiresAt: import_zod5.z.coerce.date(),
|
|
331
|
+
lastValidatedAt: import_zod5.z.coerce.date(),
|
|
332
|
+
customer: customerSchema.optional(),
|
|
333
|
+
lastUpdated: entityChangeSchema,
|
|
334
|
+
created: entityChangeSchema
|
|
335
|
+
});
|
|
336
|
+
var importTrialRequestSchema = import_zod5.z.object({
|
|
337
|
+
productId: import_zod5.z.string(),
|
|
338
|
+
externalId: import_zod5.z.string().optional(),
|
|
339
|
+
deviceName: import_zod5.z.string(),
|
|
340
|
+
deviceSignature: import_zod5.z.string(),
|
|
341
|
+
expiresAt: import_zod5.z.date(),
|
|
342
|
+
ownerId: import_zod5.z.string().optional(),
|
|
343
|
+
lastValidation: import_zod5.z.date().optional(),
|
|
344
|
+
createdAt: import_zod5.z.date().optional()
|
|
249
345
|
});
|
|
250
346
|
|
|
251
347
|
// src/activationRequests/models.ts
|
|
@@ -257,11 +353,11 @@ var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
|
|
|
257
353
|
})(ActivationRequestStatus || {});
|
|
258
354
|
|
|
259
355
|
// src/activationRequests/schemas.ts
|
|
260
|
-
var activationRequestSchema =
|
|
261
|
-
id:
|
|
262
|
-
deviceName:
|
|
263
|
-
deviceSignature:
|
|
264
|
-
status:
|
|
356
|
+
var activationRequestSchema = import_zod6.z.object({
|
|
357
|
+
id: import_zod6.z.string(),
|
|
358
|
+
deviceName: import_zod6.z.string(),
|
|
359
|
+
deviceSignature: import_zod6.z.string(),
|
|
360
|
+
status: import_zod6.z.nativeEnum(ActivationRequestStatus),
|
|
265
361
|
product: productSchema,
|
|
266
362
|
activation: licenseActivationSchema.optional(),
|
|
267
363
|
trial: trialSchema.optional()
|
|
@@ -282,71 +378,6 @@ var ActivationRequestEndpoints = class {
|
|
|
282
378
|
}
|
|
283
379
|
};
|
|
284
380
|
|
|
285
|
-
// src/globalSchemas.ts
|
|
286
|
-
var import_zod6 = require("zod");
|
|
287
|
-
var userSchema = import_zod6.z.object({
|
|
288
|
-
id: import_zod6.z.string(),
|
|
289
|
-
name: import_zod6.z.string(),
|
|
290
|
-
email: import_zod6.z.string()
|
|
291
|
-
});
|
|
292
|
-
var entityChangeSchema = import_zod6.z.object({
|
|
293
|
-
at: import_zod6.z.coerce.date(),
|
|
294
|
-
by: userSchema
|
|
295
|
-
});
|
|
296
|
-
var moneySchema = import_zod6.z.object({
|
|
297
|
-
currency: import_zod6.z.string(),
|
|
298
|
-
amount: import_zod6.z.number()
|
|
299
|
-
});
|
|
300
|
-
var priceCollectionSchema = import_zod6.z.record(import_zod6.z.number());
|
|
301
|
-
var percentageOffDiscountSchema = import_zod6.z.object({
|
|
302
|
-
type: import_zod6.z.literal("PercentageOffDiscount"),
|
|
303
|
-
percentage: import_zod6.z.number()
|
|
304
|
-
});
|
|
305
|
-
var flatAmountOffDiscountSchema = import_zod6.z.object({
|
|
306
|
-
type: import_zod6.z.literal("FlatAmountOffDiscount"),
|
|
307
|
-
total: priceCollectionSchema
|
|
308
|
-
});
|
|
309
|
-
var discountSchema = import_zod6.z.discriminatedUnion("type", [
|
|
310
|
-
percentageOffDiscountSchema,
|
|
311
|
-
flatAmountOffDiscountSchema
|
|
312
|
-
]);
|
|
313
|
-
var dateTimeSpanSchema = import_zod6.z.object({
|
|
314
|
-
from: import_zod6.z.coerce.date().nullable(),
|
|
315
|
-
to: import_zod6.z.coerce.date().nullable()
|
|
316
|
-
});
|
|
317
|
-
var pricingDiscountSchema = import_zod6.z.object({
|
|
318
|
-
name: import_zod6.z.string(),
|
|
319
|
-
description: import_zod6.z.string().nullable(),
|
|
320
|
-
discount: discountSchema,
|
|
321
|
-
applicableVariationIds: import_zod6.z.string().array().nullable(),
|
|
322
|
-
validity: dateTimeSpanSchema.nullable()
|
|
323
|
-
});
|
|
324
|
-
var pricingVariationSchema = import_zod6.z.object({
|
|
325
|
-
id: import_zod6.z.string(),
|
|
326
|
-
name: import_zod6.z.string(),
|
|
327
|
-
price: priceCollectionSchema
|
|
328
|
-
});
|
|
329
|
-
function paged(itemSchema, api) {
|
|
330
|
-
return import_zod6.z.object({
|
|
331
|
-
items: import_zod6.z.array(itemSchema),
|
|
332
|
-
hasMore: import_zod6.z.boolean(),
|
|
333
|
-
next: import_zod6.z.string().nullable()
|
|
334
|
-
}).transform((page) => ({
|
|
335
|
-
...page,
|
|
336
|
-
getNext: () => {
|
|
337
|
-
if (!page.hasMore || !page.next)
|
|
338
|
-
throw new Error("Response indicates no more results");
|
|
339
|
-
return api.fetch(page.next).then((response) => paged(itemSchema, api).parse(response.data));
|
|
340
|
-
}
|
|
341
|
-
}));
|
|
342
|
-
}
|
|
343
|
-
function quantifiable(itemSchema) {
|
|
344
|
-
return import_zod6.z.object({
|
|
345
|
-
value: itemSchema,
|
|
346
|
-
quantity: import_zod6.z.number()
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
|
|
350
381
|
// src/utils/api.ts
|
|
351
382
|
var import_cross_fetch = __toESM(require("cross-fetch"), 1);
|
|
352
383
|
|
|
@@ -506,8 +537,12 @@ var LicenseEndpoints = class {
|
|
|
506
537
|
const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
|
|
507
538
|
return licenseSchema.parse(response.data);
|
|
508
539
|
}
|
|
509
|
-
async queryActivations(
|
|
510
|
-
|
|
540
|
+
async queryActivations(licenseIdOrOpt, opts) {
|
|
541
|
+
if (licenseIdOrOpt && typeof licenseIdOrOpt === "string") {
|
|
542
|
+
const response2 = await this.api.fetch(`/api/licenses/${licenseIdOrOpt}/activations?${objectToQuery(opts)}`);
|
|
543
|
+
return paged(licenseActivationSchema, this.api).parse(response2.data);
|
|
544
|
+
}
|
|
545
|
+
const response = await this.api.fetch(`/api/license-activations?${objectToQuery(opts)}`);
|
|
511
546
|
return paged(licenseActivationSchema, this.api).parse(response.data);
|
|
512
547
|
}
|
|
513
548
|
async getActivation(licenseId, activationId) {
|
|
@@ -746,7 +781,9 @@ var voucherSchema = import_zod10.z.object({
|
|
|
746
781
|
numberOfCodes: import_zod10.z.number(),
|
|
747
782
|
numberOfRedemptions: import_zod10.z.number(),
|
|
748
783
|
redeemsProducts: quantifiable(productSchema).array(),
|
|
749
|
-
redeemsBundles: quantifiable(bundleSchema).array()
|
|
784
|
+
redeemsBundles: quantifiable(bundleSchema).array(),
|
|
785
|
+
lastUpdated: entityChangeSchema,
|
|
786
|
+
created: entityChangeSchema
|
|
750
787
|
});
|
|
751
788
|
var createVoucherRequestSchema = import_zod10.z.object({
|
|
752
789
|
name: import_zod10.z.string(),
|