@moonbase.sh/api 0.1.111 → 0.1.113
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 +49 -0
- package/dist/index.d.cts +170 -1
- package/dist/index.d.ts +170 -1
- package/dist/index.js +49 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63,6 +63,7 @@ var communicationPreferencesSchema = import_zod.z.object({
|
|
|
63
63
|
});
|
|
64
64
|
var customerSchema = import_zod.z.object({
|
|
65
65
|
id: import_zod.z.string(),
|
|
66
|
+
externalId: import_zod.z.string().optional(),
|
|
66
67
|
name: import_zod.z.string(),
|
|
67
68
|
businessName: import_zod.z.string().nullable(),
|
|
68
69
|
taxId: import_zod.z.string().nullable(),
|
|
@@ -76,6 +77,13 @@ var customerSchema = import_zod.z.object({
|
|
|
76
77
|
address: addressSchema.nullable(),
|
|
77
78
|
communicationPreferences: communicationPreferencesSchema
|
|
78
79
|
});
|
|
80
|
+
var importCustomerRequestSchema = import_zod.z.object({
|
|
81
|
+
name: import_zod.z.string(),
|
|
82
|
+
email: import_zod.z.string(),
|
|
83
|
+
externalId: import_zod.z.string().optional(),
|
|
84
|
+
password: import_zod.z.string().optional(),
|
|
85
|
+
address: addressSchema.optional()
|
|
86
|
+
});
|
|
79
87
|
|
|
80
88
|
// src/licenses/schemas.ts
|
|
81
89
|
var import_zod2 = require("zod");
|
|
@@ -100,6 +108,7 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
|
|
|
100
108
|
// src/licenses/schemas.ts
|
|
101
109
|
var licenseSchema = import_zod2.z.object({
|
|
102
110
|
id: import_zod2.z.string(),
|
|
111
|
+
externalId: import_zod2.z.string().optional(),
|
|
103
112
|
productId: import_zod2.z.string(),
|
|
104
113
|
ownerId: import_zod2.z.string(),
|
|
105
114
|
status: import_zod2.z.nativeEnum(LicenseStatus),
|
|
@@ -116,6 +125,20 @@ var licenseActivationSchema = import_zod2.z.object({
|
|
|
116
125
|
lastValidatedAt: import_zod2.z.coerce.date(),
|
|
117
126
|
license: licenseSchema
|
|
118
127
|
});
|
|
128
|
+
var importLicenseRequestSchema = import_zod2.z.object({
|
|
129
|
+
customerId: import_zod2.z.string(),
|
|
130
|
+
productId: import_zod2.z.string(),
|
|
131
|
+
externalId: import_zod2.z.string().optional(),
|
|
132
|
+
createdAt: import_zod2.z.date().optional(),
|
|
133
|
+
maxNumberOfActivations: import_zod2.z.number().optional(),
|
|
134
|
+
offlineActivationsAllowed: import_zod2.z.boolean().optional(),
|
|
135
|
+
activations: import_zod2.z.object({
|
|
136
|
+
activationMethod: import_zod2.z.nativeEnum(ActivationMethod),
|
|
137
|
+
deviceName: import_zod2.z.string(),
|
|
138
|
+
deviceSignature: import_zod2.z.string(),
|
|
139
|
+
lastValidation: import_zod2.z.date().optional()
|
|
140
|
+
}).array().optional()
|
|
141
|
+
});
|
|
119
142
|
|
|
120
143
|
// src/products/schemas.ts
|
|
121
144
|
var import_zod3 = require("zod");
|
|
@@ -153,6 +176,7 @@ var TrialStatus = /* @__PURE__ */ ((TrialStatus2) => {
|
|
|
153
176
|
// src/trials/schemas.ts
|
|
154
177
|
var trialSchema = import_zod4.z.object({
|
|
155
178
|
id: import_zod4.z.string(),
|
|
179
|
+
externalId: import_zod4.z.string().optional(),
|
|
156
180
|
productId: import_zod4.z.string(),
|
|
157
181
|
deviceName: import_zod4.z.string(),
|
|
158
182
|
deviceSignature: import_zod4.z.string(),
|
|
@@ -161,6 +185,16 @@ var trialSchema = import_zod4.z.object({
|
|
|
161
185
|
lastValidatedAt: import_zod4.z.coerce.date(),
|
|
162
186
|
ownerId: import_zod4.z.string().optional()
|
|
163
187
|
});
|
|
188
|
+
var importTrialRequestSchema = import_zod4.z.object({
|
|
189
|
+
productId: import_zod4.z.string(),
|
|
190
|
+
externalId: import_zod4.z.string().optional(),
|
|
191
|
+
deviceName: import_zod4.z.string(),
|
|
192
|
+
deviceSignature: import_zod4.z.string(),
|
|
193
|
+
expiresAt: import_zod4.z.date(),
|
|
194
|
+
customerId: import_zod4.z.string().optional(),
|
|
195
|
+
lastValidation: import_zod4.z.date().optional(),
|
|
196
|
+
createdAt: import_zod4.z.date().optional()
|
|
197
|
+
});
|
|
164
198
|
|
|
165
199
|
// src/activationRequests/models.ts
|
|
166
200
|
var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
|
|
@@ -206,6 +240,11 @@ var CustomerEndpoints = class {
|
|
|
206
240
|
const response = await this.api.fetch(`/api/customers/${idOrEmail}`);
|
|
207
241
|
return customerSchema.parse(response.data);
|
|
208
242
|
}
|
|
243
|
+
async import(customer) {
|
|
244
|
+
const request = importCustomerRequestSchema.parse(customer);
|
|
245
|
+
const response = await this.api.fetch(`/api/customers/import`, "POST", request);
|
|
246
|
+
return customerSchema.parse(response.data);
|
|
247
|
+
}
|
|
209
248
|
};
|
|
210
249
|
|
|
211
250
|
// src/globalSchemas.ts
|
|
@@ -349,6 +388,11 @@ var LicenseEndpoints = class {
|
|
|
349
388
|
const response = await this.api.fetch(`/api/licenses/${licenseId}`);
|
|
350
389
|
return licenseSchema.parse(response.data);
|
|
351
390
|
}
|
|
391
|
+
async import(license) {
|
|
392
|
+
const request = importLicenseRequestSchema.parse(license);
|
|
393
|
+
const response = await this.api.fetch(`/api/licenses/import`, "POST", request);
|
|
394
|
+
return licenseSchema.parse(response.data);
|
|
395
|
+
}
|
|
352
396
|
async revoke(licenseId) {
|
|
353
397
|
const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
|
|
354
398
|
return licenseSchema.parse(response.data);
|
|
@@ -391,6 +435,11 @@ var TrialEndpoints = class {
|
|
|
391
435
|
const response = await this.api.fetch(`/api/trials/${productId}/request`, "POST", target);
|
|
392
436
|
return trialSchema.parse(response.data);
|
|
393
437
|
}
|
|
438
|
+
async import(trial) {
|
|
439
|
+
const request = importTrialRequestSchema.parse(trial);
|
|
440
|
+
const response = await this.api.fetch(`/api/customers/import`, "POST", request);
|
|
441
|
+
return trialSchema.parse(response.data);
|
|
442
|
+
}
|
|
394
443
|
};
|
|
395
444
|
|
|
396
445
|
// src/index.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -58,6 +58,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
58
58
|
lastValidatedAt: z.ZodDate;
|
|
59
59
|
license: z.ZodObject<{
|
|
60
60
|
id: z.ZodString;
|
|
61
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
61
62
|
productId: z.ZodString;
|
|
62
63
|
ownerId: z.ZodString;
|
|
63
64
|
status: z.ZodNativeEnum<typeof LicenseStatus>;
|
|
@@ -72,6 +73,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
72
73
|
activeNumberOfActivations: number;
|
|
73
74
|
maxNumberOfActivations: number;
|
|
74
75
|
offlineActivationsAllowed: boolean;
|
|
76
|
+
externalId?: string | undefined;
|
|
75
77
|
}, {
|
|
76
78
|
status: LicenseStatus;
|
|
77
79
|
id: string;
|
|
@@ -80,6 +82,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
80
82
|
activeNumberOfActivations: number;
|
|
81
83
|
maxNumberOfActivations: number;
|
|
82
84
|
offlineActivationsAllowed: boolean;
|
|
85
|
+
externalId?: string | undefined;
|
|
83
86
|
}>;
|
|
84
87
|
}, "strip", z.ZodTypeAny, {
|
|
85
88
|
status: ActivationStatus;
|
|
@@ -96,6 +99,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
96
99
|
activeNumberOfActivations: number;
|
|
97
100
|
maxNumberOfActivations: number;
|
|
98
101
|
offlineActivationsAllowed: boolean;
|
|
102
|
+
externalId?: string | undefined;
|
|
99
103
|
};
|
|
100
104
|
}, {
|
|
101
105
|
status: ActivationStatus;
|
|
@@ -112,10 +116,12 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
112
116
|
activeNumberOfActivations: number;
|
|
113
117
|
maxNumberOfActivations: number;
|
|
114
118
|
offlineActivationsAllowed: boolean;
|
|
119
|
+
externalId?: string | undefined;
|
|
115
120
|
};
|
|
116
121
|
}>>;
|
|
117
122
|
trial: z.ZodOptional<z.ZodObject<{
|
|
118
123
|
id: z.ZodString;
|
|
124
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
119
125
|
productId: z.ZodString;
|
|
120
126
|
deviceName: z.ZodString;
|
|
121
127
|
deviceSignature: z.ZodString;
|
|
@@ -131,6 +137,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
131
137
|
deviceName: string;
|
|
132
138
|
deviceSignature: string;
|
|
133
139
|
expiresAt: Date;
|
|
140
|
+
externalId?: string | undefined;
|
|
134
141
|
ownerId?: string | undefined;
|
|
135
142
|
}, {
|
|
136
143
|
status: TrialStatus;
|
|
@@ -140,10 +147,12 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
140
147
|
deviceName: string;
|
|
141
148
|
deviceSignature: string;
|
|
142
149
|
expiresAt: Date;
|
|
150
|
+
externalId?: string | undefined;
|
|
143
151
|
ownerId?: string | undefined;
|
|
144
152
|
}>>;
|
|
145
153
|
customer: z.ZodOptional<z.ZodObject<{
|
|
146
154
|
id: z.ZodString;
|
|
155
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
147
156
|
name: z.ZodString;
|
|
148
157
|
businessName: z.ZodNullable<z.ZodString>;
|
|
149
158
|
taxId: z.ZodNullable<z.ZodString>;
|
|
@@ -206,6 +215,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
206
215
|
communicationPreferences: {
|
|
207
216
|
newsletterOptIn: boolean;
|
|
208
217
|
};
|
|
218
|
+
externalId?: string | undefined;
|
|
209
219
|
}, {
|
|
210
220
|
id: string;
|
|
211
221
|
name: string;
|
|
@@ -229,6 +239,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
229
239
|
communicationPreferences: {
|
|
230
240
|
newsletterOptIn: boolean;
|
|
231
241
|
};
|
|
242
|
+
externalId?: string | undefined;
|
|
232
243
|
}>>;
|
|
233
244
|
}, "strip", z.ZodTypeAny, {
|
|
234
245
|
status: ActivationRequestStatus;
|
|
@@ -261,6 +272,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
261
272
|
activeNumberOfActivations: number;
|
|
262
273
|
maxNumberOfActivations: number;
|
|
263
274
|
offlineActivationsAllowed: boolean;
|
|
275
|
+
externalId?: string | undefined;
|
|
264
276
|
};
|
|
265
277
|
} | undefined;
|
|
266
278
|
trial?: {
|
|
@@ -271,6 +283,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
271
283
|
deviceName: string;
|
|
272
284
|
deviceSignature: string;
|
|
273
285
|
expiresAt: Date;
|
|
286
|
+
externalId?: string | undefined;
|
|
274
287
|
ownerId?: string | undefined;
|
|
275
288
|
} | undefined;
|
|
276
289
|
customer?: {
|
|
@@ -296,6 +309,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
296
309
|
communicationPreferences: {
|
|
297
310
|
newsletterOptIn: boolean;
|
|
298
311
|
};
|
|
312
|
+
externalId?: string | undefined;
|
|
299
313
|
} | undefined;
|
|
300
314
|
}, {
|
|
301
315
|
status: ActivationRequestStatus;
|
|
@@ -328,6 +342,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
328
342
|
activeNumberOfActivations: number;
|
|
329
343
|
maxNumberOfActivations: number;
|
|
330
344
|
offlineActivationsAllowed: boolean;
|
|
345
|
+
externalId?: string | undefined;
|
|
331
346
|
};
|
|
332
347
|
} | undefined;
|
|
333
348
|
trial?: {
|
|
@@ -338,6 +353,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
338
353
|
deviceName: string;
|
|
339
354
|
deviceSignature: string;
|
|
340
355
|
expiresAt: Date;
|
|
356
|
+
externalId?: string | undefined;
|
|
341
357
|
ownerId?: string | undefined;
|
|
342
358
|
} | undefined;
|
|
343
359
|
customer?: {
|
|
@@ -363,6 +379,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
363
379
|
communicationPreferences: {
|
|
364
380
|
newsletterOptIn: boolean;
|
|
365
381
|
};
|
|
382
|
+
externalId?: string | undefined;
|
|
366
383
|
} | undefined;
|
|
367
384
|
}>;
|
|
368
385
|
|
|
@@ -385,6 +402,7 @@ declare class ActivationRequestEndpoints {
|
|
|
385
402
|
|
|
386
403
|
declare const customerSchema: z.ZodObject<{
|
|
387
404
|
id: z.ZodString;
|
|
405
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
388
406
|
name: z.ZodString;
|
|
389
407
|
businessName: z.ZodNullable<z.ZodString>;
|
|
390
408
|
taxId: z.ZodNullable<z.ZodString>;
|
|
@@ -447,6 +465,7 @@ declare const customerSchema: z.ZodObject<{
|
|
|
447
465
|
communicationPreferences: {
|
|
448
466
|
newsletterOptIn: boolean;
|
|
449
467
|
};
|
|
468
|
+
externalId?: string | undefined;
|
|
450
469
|
}, {
|
|
451
470
|
id: string;
|
|
452
471
|
name: string;
|
|
@@ -470,14 +489,71 @@ declare const customerSchema: z.ZodObject<{
|
|
|
470
489
|
communicationPreferences: {
|
|
471
490
|
newsletterOptIn: boolean;
|
|
472
491
|
};
|
|
492
|
+
externalId?: string | undefined;
|
|
493
|
+
}>;
|
|
494
|
+
declare const importCustomerRequestSchema: z.ZodObject<{
|
|
495
|
+
name: z.ZodString;
|
|
496
|
+
email: z.ZodString;
|
|
497
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
498
|
+
password: z.ZodOptional<z.ZodString>;
|
|
499
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
500
|
+
countryCode: z.ZodString;
|
|
501
|
+
streetAddress1: z.ZodString;
|
|
502
|
+
streetAddress2: z.ZodNullable<z.ZodString>;
|
|
503
|
+
locality: z.ZodNullable<z.ZodString>;
|
|
504
|
+
region: z.ZodNullable<z.ZodString>;
|
|
505
|
+
postCode: z.ZodString;
|
|
506
|
+
}, "strip", z.ZodTypeAny, {
|
|
507
|
+
countryCode: string;
|
|
508
|
+
streetAddress1: string;
|
|
509
|
+
streetAddress2: string | null;
|
|
510
|
+
locality: string | null;
|
|
511
|
+
region: string | null;
|
|
512
|
+
postCode: string;
|
|
513
|
+
}, {
|
|
514
|
+
countryCode: string;
|
|
515
|
+
streetAddress1: string;
|
|
516
|
+
streetAddress2: string | null;
|
|
517
|
+
locality: string | null;
|
|
518
|
+
region: string | null;
|
|
519
|
+
postCode: string;
|
|
520
|
+
}>>;
|
|
521
|
+
}, "strip", z.ZodTypeAny, {
|
|
522
|
+
name: string;
|
|
523
|
+
email: string;
|
|
524
|
+
externalId?: string | undefined;
|
|
525
|
+
password?: string | undefined;
|
|
526
|
+
address?: {
|
|
527
|
+
countryCode: string;
|
|
528
|
+
streetAddress1: string;
|
|
529
|
+
streetAddress2: string | null;
|
|
530
|
+
locality: string | null;
|
|
531
|
+
region: string | null;
|
|
532
|
+
postCode: string;
|
|
533
|
+
} | undefined;
|
|
534
|
+
}, {
|
|
535
|
+
name: string;
|
|
536
|
+
email: string;
|
|
537
|
+
externalId?: string | undefined;
|
|
538
|
+
password?: string | undefined;
|
|
539
|
+
address?: {
|
|
540
|
+
countryCode: string;
|
|
541
|
+
streetAddress1: string;
|
|
542
|
+
streetAddress2: string | null;
|
|
543
|
+
locality: string | null;
|
|
544
|
+
region: string | null;
|
|
545
|
+
postCode: string;
|
|
546
|
+
} | undefined;
|
|
473
547
|
}>;
|
|
474
548
|
|
|
475
549
|
type Customer = z.infer<typeof customerSchema>;
|
|
550
|
+
type ImportCustomerRequest = z.infer<typeof importCustomerRequestSchema>;
|
|
476
551
|
|
|
477
552
|
declare class CustomerEndpoints {
|
|
478
553
|
private api;
|
|
479
554
|
constructor(api: MoonbaseApi);
|
|
480
555
|
get(idOrEmail: string): Promise<Customer>;
|
|
556
|
+
import(customer: ImportCustomerRequest): Promise<Customer>;
|
|
481
557
|
}
|
|
482
558
|
|
|
483
559
|
declare const pricingVariationSchema: z.ZodObject<{
|
|
@@ -571,6 +647,7 @@ interface Quantifiable<T> {
|
|
|
571
647
|
|
|
572
648
|
declare const licenseSchema: z.ZodObject<{
|
|
573
649
|
id: z.ZodString;
|
|
650
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
574
651
|
productId: z.ZodString;
|
|
575
652
|
ownerId: z.ZodString;
|
|
576
653
|
status: z.ZodNativeEnum<typeof LicenseStatus>;
|
|
@@ -585,6 +662,7 @@ declare const licenseSchema: z.ZodObject<{
|
|
|
585
662
|
activeNumberOfActivations: number;
|
|
586
663
|
maxNumberOfActivations: number;
|
|
587
664
|
offlineActivationsAllowed: boolean;
|
|
665
|
+
externalId?: string | undefined;
|
|
588
666
|
}, {
|
|
589
667
|
status: LicenseStatus;
|
|
590
668
|
id: string;
|
|
@@ -593,6 +671,7 @@ declare const licenseSchema: z.ZodObject<{
|
|
|
593
671
|
activeNumberOfActivations: number;
|
|
594
672
|
maxNumberOfActivations: number;
|
|
595
673
|
offlineActivationsAllowed: boolean;
|
|
674
|
+
externalId?: string | undefined;
|
|
596
675
|
}>;
|
|
597
676
|
declare const licenseActivationSchema: z.ZodObject<{
|
|
598
677
|
id: z.ZodString;
|
|
@@ -603,6 +682,7 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
603
682
|
lastValidatedAt: z.ZodDate;
|
|
604
683
|
license: z.ZodObject<{
|
|
605
684
|
id: z.ZodString;
|
|
685
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
606
686
|
productId: z.ZodString;
|
|
607
687
|
ownerId: z.ZodString;
|
|
608
688
|
status: z.ZodNativeEnum<typeof LicenseStatus>;
|
|
@@ -617,6 +697,7 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
617
697
|
activeNumberOfActivations: number;
|
|
618
698
|
maxNumberOfActivations: number;
|
|
619
699
|
offlineActivationsAllowed: boolean;
|
|
700
|
+
externalId?: string | undefined;
|
|
620
701
|
}, {
|
|
621
702
|
status: LicenseStatus;
|
|
622
703
|
id: string;
|
|
@@ -625,6 +706,7 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
625
706
|
activeNumberOfActivations: number;
|
|
626
707
|
maxNumberOfActivations: number;
|
|
627
708
|
offlineActivationsAllowed: boolean;
|
|
709
|
+
externalId?: string | undefined;
|
|
628
710
|
}>;
|
|
629
711
|
}, "strip", z.ZodTypeAny, {
|
|
630
712
|
status: ActivationStatus;
|
|
@@ -641,6 +723,7 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
641
723
|
activeNumberOfActivations: number;
|
|
642
724
|
maxNumberOfActivations: number;
|
|
643
725
|
offlineActivationsAllowed: boolean;
|
|
726
|
+
externalId?: string | undefined;
|
|
644
727
|
};
|
|
645
728
|
}, {
|
|
646
729
|
status: ActivationStatus;
|
|
@@ -657,8 +740,59 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
657
740
|
activeNumberOfActivations: number;
|
|
658
741
|
maxNumberOfActivations: number;
|
|
659
742
|
offlineActivationsAllowed: boolean;
|
|
743
|
+
externalId?: string | undefined;
|
|
660
744
|
};
|
|
661
745
|
}>;
|
|
746
|
+
declare const importLicenseRequestSchema: z.ZodObject<{
|
|
747
|
+
customerId: z.ZodString;
|
|
748
|
+
productId: z.ZodString;
|
|
749
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
750
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
751
|
+
maxNumberOfActivations: z.ZodOptional<z.ZodNumber>;
|
|
752
|
+
offlineActivationsAllowed: z.ZodOptional<z.ZodBoolean>;
|
|
753
|
+
activations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
754
|
+
activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
|
|
755
|
+
deviceName: z.ZodString;
|
|
756
|
+
deviceSignature: z.ZodString;
|
|
757
|
+
lastValidation: z.ZodOptional<z.ZodDate>;
|
|
758
|
+
}, "strip", z.ZodTypeAny, {
|
|
759
|
+
activationMethod: ActivationMethod;
|
|
760
|
+
deviceName: string;
|
|
761
|
+
deviceSignature: string;
|
|
762
|
+
lastValidation?: Date | undefined;
|
|
763
|
+
}, {
|
|
764
|
+
activationMethod: ActivationMethod;
|
|
765
|
+
deviceName: string;
|
|
766
|
+
deviceSignature: string;
|
|
767
|
+
lastValidation?: Date | undefined;
|
|
768
|
+
}>, "many">>;
|
|
769
|
+
}, "strip", z.ZodTypeAny, {
|
|
770
|
+
productId: string;
|
|
771
|
+
customerId: string;
|
|
772
|
+
externalId?: string | undefined;
|
|
773
|
+
createdAt?: Date | undefined;
|
|
774
|
+
maxNumberOfActivations?: number | undefined;
|
|
775
|
+
offlineActivationsAllowed?: boolean | undefined;
|
|
776
|
+
activations?: {
|
|
777
|
+
activationMethod: ActivationMethod;
|
|
778
|
+
deviceName: string;
|
|
779
|
+
deviceSignature: string;
|
|
780
|
+
lastValidation?: Date | undefined;
|
|
781
|
+
}[] | undefined;
|
|
782
|
+
}, {
|
|
783
|
+
productId: string;
|
|
784
|
+
customerId: string;
|
|
785
|
+
externalId?: string | undefined;
|
|
786
|
+
createdAt?: Date | undefined;
|
|
787
|
+
maxNumberOfActivations?: number | undefined;
|
|
788
|
+
offlineActivationsAllowed?: boolean | undefined;
|
|
789
|
+
activations?: {
|
|
790
|
+
activationMethod: ActivationMethod;
|
|
791
|
+
deviceName: string;
|
|
792
|
+
deviceSignature: string;
|
|
793
|
+
lastValidation?: Date | undefined;
|
|
794
|
+
}[] | undefined;
|
|
795
|
+
}>;
|
|
662
796
|
|
|
663
797
|
declare enum LicenseStatus {
|
|
664
798
|
Active = "Active",
|
|
@@ -674,6 +808,7 @@ declare enum ActivationMethod {
|
|
|
674
808
|
}
|
|
675
809
|
type License = z.infer<typeof licenseSchema>;
|
|
676
810
|
type LicenseActivation = z.infer<typeof licenseActivationSchema>;
|
|
811
|
+
type ImportLicenseRequest = z.infer<typeof importLicenseRequestSchema>;
|
|
677
812
|
|
|
678
813
|
declare class LicenseEndpoints {
|
|
679
814
|
private api;
|
|
@@ -684,6 +819,7 @@ declare class LicenseEndpoints {
|
|
|
684
819
|
pageSize?: number;
|
|
685
820
|
}): Promise<Page<License>>;
|
|
686
821
|
get(licenseId: string): Promise<License>;
|
|
822
|
+
import(license: ImportLicenseRequest): Promise<License>;
|
|
687
823
|
revoke(licenseId: string): Promise<License>;
|
|
688
824
|
queryActivations(licenseId: string, opts?: {
|
|
689
825
|
paginationToken?: string;
|
|
@@ -745,6 +881,7 @@ declare class ProductEndpoints {
|
|
|
745
881
|
|
|
746
882
|
declare const trialSchema: z.ZodObject<{
|
|
747
883
|
id: z.ZodString;
|
|
884
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
748
885
|
productId: z.ZodString;
|
|
749
886
|
deviceName: z.ZodString;
|
|
750
887
|
deviceSignature: z.ZodString;
|
|
@@ -760,6 +897,7 @@ declare const trialSchema: z.ZodObject<{
|
|
|
760
897
|
deviceName: string;
|
|
761
898
|
deviceSignature: string;
|
|
762
899
|
expiresAt: Date;
|
|
900
|
+
externalId?: string | undefined;
|
|
763
901
|
ownerId?: string | undefined;
|
|
764
902
|
}, {
|
|
765
903
|
status: TrialStatus;
|
|
@@ -769,14 +907,44 @@ declare const trialSchema: z.ZodObject<{
|
|
|
769
907
|
deviceName: string;
|
|
770
908
|
deviceSignature: string;
|
|
771
909
|
expiresAt: Date;
|
|
910
|
+
externalId?: string | undefined;
|
|
772
911
|
ownerId?: string | undefined;
|
|
773
912
|
}>;
|
|
913
|
+
declare const importTrialRequestSchema: z.ZodObject<{
|
|
914
|
+
productId: z.ZodString;
|
|
915
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
916
|
+
deviceName: z.ZodString;
|
|
917
|
+
deviceSignature: z.ZodString;
|
|
918
|
+
expiresAt: z.ZodDate;
|
|
919
|
+
customerId: z.ZodOptional<z.ZodString>;
|
|
920
|
+
lastValidation: z.ZodOptional<z.ZodDate>;
|
|
921
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
922
|
+
}, "strip", z.ZodTypeAny, {
|
|
923
|
+
productId: string;
|
|
924
|
+
deviceName: string;
|
|
925
|
+
deviceSignature: string;
|
|
926
|
+
expiresAt: Date;
|
|
927
|
+
externalId?: string | undefined;
|
|
928
|
+
customerId?: string | undefined;
|
|
929
|
+
lastValidation?: Date | undefined;
|
|
930
|
+
createdAt?: Date | undefined;
|
|
931
|
+
}, {
|
|
932
|
+
productId: string;
|
|
933
|
+
deviceName: string;
|
|
934
|
+
deviceSignature: string;
|
|
935
|
+
expiresAt: Date;
|
|
936
|
+
externalId?: string | undefined;
|
|
937
|
+
customerId?: string | undefined;
|
|
938
|
+
lastValidation?: Date | undefined;
|
|
939
|
+
createdAt?: Date | undefined;
|
|
940
|
+
}>;
|
|
774
941
|
|
|
775
942
|
declare enum TrialStatus {
|
|
776
943
|
Active = "Active",
|
|
777
944
|
Expired = "Expired"
|
|
778
945
|
}
|
|
779
946
|
type Trial = z.infer<typeof trialSchema>;
|
|
947
|
+
type ImportTrialRequest = z.infer<typeof importTrialRequestSchema>;
|
|
780
948
|
|
|
781
949
|
declare class TrialEndpoints {
|
|
782
950
|
private api;
|
|
@@ -785,6 +953,7 @@ declare class TrialEndpoints {
|
|
|
785
953
|
deviceName: string;
|
|
786
954
|
deviceSignature: string;
|
|
787
955
|
}): Promise<Trial>;
|
|
956
|
+
import(trial: ImportTrialRequest): Promise<Trial>;
|
|
788
957
|
}
|
|
789
958
|
|
|
790
959
|
declare class NotAuthorizedError extends Error {
|
|
@@ -817,4 +986,4 @@ declare class MoonbaseClient {
|
|
|
817
986
|
trials: TrialEndpoints;
|
|
818
987
|
}
|
|
819
988
|
|
|
820
|
-
export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Customer, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus };
|
|
989
|
+
export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus };
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
58
58
|
lastValidatedAt: z.ZodDate;
|
|
59
59
|
license: z.ZodObject<{
|
|
60
60
|
id: z.ZodString;
|
|
61
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
61
62
|
productId: z.ZodString;
|
|
62
63
|
ownerId: z.ZodString;
|
|
63
64
|
status: z.ZodNativeEnum<typeof LicenseStatus>;
|
|
@@ -72,6 +73,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
72
73
|
activeNumberOfActivations: number;
|
|
73
74
|
maxNumberOfActivations: number;
|
|
74
75
|
offlineActivationsAllowed: boolean;
|
|
76
|
+
externalId?: string | undefined;
|
|
75
77
|
}, {
|
|
76
78
|
status: LicenseStatus;
|
|
77
79
|
id: string;
|
|
@@ -80,6 +82,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
80
82
|
activeNumberOfActivations: number;
|
|
81
83
|
maxNumberOfActivations: number;
|
|
82
84
|
offlineActivationsAllowed: boolean;
|
|
85
|
+
externalId?: string | undefined;
|
|
83
86
|
}>;
|
|
84
87
|
}, "strip", z.ZodTypeAny, {
|
|
85
88
|
status: ActivationStatus;
|
|
@@ -96,6 +99,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
96
99
|
activeNumberOfActivations: number;
|
|
97
100
|
maxNumberOfActivations: number;
|
|
98
101
|
offlineActivationsAllowed: boolean;
|
|
102
|
+
externalId?: string | undefined;
|
|
99
103
|
};
|
|
100
104
|
}, {
|
|
101
105
|
status: ActivationStatus;
|
|
@@ -112,10 +116,12 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
112
116
|
activeNumberOfActivations: number;
|
|
113
117
|
maxNumberOfActivations: number;
|
|
114
118
|
offlineActivationsAllowed: boolean;
|
|
119
|
+
externalId?: string | undefined;
|
|
115
120
|
};
|
|
116
121
|
}>>;
|
|
117
122
|
trial: z.ZodOptional<z.ZodObject<{
|
|
118
123
|
id: z.ZodString;
|
|
124
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
119
125
|
productId: z.ZodString;
|
|
120
126
|
deviceName: z.ZodString;
|
|
121
127
|
deviceSignature: z.ZodString;
|
|
@@ -131,6 +137,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
131
137
|
deviceName: string;
|
|
132
138
|
deviceSignature: string;
|
|
133
139
|
expiresAt: Date;
|
|
140
|
+
externalId?: string | undefined;
|
|
134
141
|
ownerId?: string | undefined;
|
|
135
142
|
}, {
|
|
136
143
|
status: TrialStatus;
|
|
@@ -140,10 +147,12 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
140
147
|
deviceName: string;
|
|
141
148
|
deviceSignature: string;
|
|
142
149
|
expiresAt: Date;
|
|
150
|
+
externalId?: string | undefined;
|
|
143
151
|
ownerId?: string | undefined;
|
|
144
152
|
}>>;
|
|
145
153
|
customer: z.ZodOptional<z.ZodObject<{
|
|
146
154
|
id: z.ZodString;
|
|
155
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
147
156
|
name: z.ZodString;
|
|
148
157
|
businessName: z.ZodNullable<z.ZodString>;
|
|
149
158
|
taxId: z.ZodNullable<z.ZodString>;
|
|
@@ -206,6 +215,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
206
215
|
communicationPreferences: {
|
|
207
216
|
newsletterOptIn: boolean;
|
|
208
217
|
};
|
|
218
|
+
externalId?: string | undefined;
|
|
209
219
|
}, {
|
|
210
220
|
id: string;
|
|
211
221
|
name: string;
|
|
@@ -229,6 +239,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
229
239
|
communicationPreferences: {
|
|
230
240
|
newsletterOptIn: boolean;
|
|
231
241
|
};
|
|
242
|
+
externalId?: string | undefined;
|
|
232
243
|
}>>;
|
|
233
244
|
}, "strip", z.ZodTypeAny, {
|
|
234
245
|
status: ActivationRequestStatus;
|
|
@@ -261,6 +272,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
261
272
|
activeNumberOfActivations: number;
|
|
262
273
|
maxNumberOfActivations: number;
|
|
263
274
|
offlineActivationsAllowed: boolean;
|
|
275
|
+
externalId?: string | undefined;
|
|
264
276
|
};
|
|
265
277
|
} | undefined;
|
|
266
278
|
trial?: {
|
|
@@ -271,6 +283,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
271
283
|
deviceName: string;
|
|
272
284
|
deviceSignature: string;
|
|
273
285
|
expiresAt: Date;
|
|
286
|
+
externalId?: string | undefined;
|
|
274
287
|
ownerId?: string | undefined;
|
|
275
288
|
} | undefined;
|
|
276
289
|
customer?: {
|
|
@@ -296,6 +309,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
296
309
|
communicationPreferences: {
|
|
297
310
|
newsletterOptIn: boolean;
|
|
298
311
|
};
|
|
312
|
+
externalId?: string | undefined;
|
|
299
313
|
} | undefined;
|
|
300
314
|
}, {
|
|
301
315
|
status: ActivationRequestStatus;
|
|
@@ -328,6 +342,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
328
342
|
activeNumberOfActivations: number;
|
|
329
343
|
maxNumberOfActivations: number;
|
|
330
344
|
offlineActivationsAllowed: boolean;
|
|
345
|
+
externalId?: string | undefined;
|
|
331
346
|
};
|
|
332
347
|
} | undefined;
|
|
333
348
|
trial?: {
|
|
@@ -338,6 +353,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
338
353
|
deviceName: string;
|
|
339
354
|
deviceSignature: string;
|
|
340
355
|
expiresAt: Date;
|
|
356
|
+
externalId?: string | undefined;
|
|
341
357
|
ownerId?: string | undefined;
|
|
342
358
|
} | undefined;
|
|
343
359
|
customer?: {
|
|
@@ -363,6 +379,7 @@ declare const activationRequestSchema: z.ZodObject<{
|
|
|
363
379
|
communicationPreferences: {
|
|
364
380
|
newsletterOptIn: boolean;
|
|
365
381
|
};
|
|
382
|
+
externalId?: string | undefined;
|
|
366
383
|
} | undefined;
|
|
367
384
|
}>;
|
|
368
385
|
|
|
@@ -385,6 +402,7 @@ declare class ActivationRequestEndpoints {
|
|
|
385
402
|
|
|
386
403
|
declare const customerSchema: z.ZodObject<{
|
|
387
404
|
id: z.ZodString;
|
|
405
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
388
406
|
name: z.ZodString;
|
|
389
407
|
businessName: z.ZodNullable<z.ZodString>;
|
|
390
408
|
taxId: z.ZodNullable<z.ZodString>;
|
|
@@ -447,6 +465,7 @@ declare const customerSchema: z.ZodObject<{
|
|
|
447
465
|
communicationPreferences: {
|
|
448
466
|
newsletterOptIn: boolean;
|
|
449
467
|
};
|
|
468
|
+
externalId?: string | undefined;
|
|
450
469
|
}, {
|
|
451
470
|
id: string;
|
|
452
471
|
name: string;
|
|
@@ -470,14 +489,71 @@ declare const customerSchema: z.ZodObject<{
|
|
|
470
489
|
communicationPreferences: {
|
|
471
490
|
newsletterOptIn: boolean;
|
|
472
491
|
};
|
|
492
|
+
externalId?: string | undefined;
|
|
493
|
+
}>;
|
|
494
|
+
declare const importCustomerRequestSchema: z.ZodObject<{
|
|
495
|
+
name: z.ZodString;
|
|
496
|
+
email: z.ZodString;
|
|
497
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
498
|
+
password: z.ZodOptional<z.ZodString>;
|
|
499
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
500
|
+
countryCode: z.ZodString;
|
|
501
|
+
streetAddress1: z.ZodString;
|
|
502
|
+
streetAddress2: z.ZodNullable<z.ZodString>;
|
|
503
|
+
locality: z.ZodNullable<z.ZodString>;
|
|
504
|
+
region: z.ZodNullable<z.ZodString>;
|
|
505
|
+
postCode: z.ZodString;
|
|
506
|
+
}, "strip", z.ZodTypeAny, {
|
|
507
|
+
countryCode: string;
|
|
508
|
+
streetAddress1: string;
|
|
509
|
+
streetAddress2: string | null;
|
|
510
|
+
locality: string | null;
|
|
511
|
+
region: string | null;
|
|
512
|
+
postCode: string;
|
|
513
|
+
}, {
|
|
514
|
+
countryCode: string;
|
|
515
|
+
streetAddress1: string;
|
|
516
|
+
streetAddress2: string | null;
|
|
517
|
+
locality: string | null;
|
|
518
|
+
region: string | null;
|
|
519
|
+
postCode: string;
|
|
520
|
+
}>>;
|
|
521
|
+
}, "strip", z.ZodTypeAny, {
|
|
522
|
+
name: string;
|
|
523
|
+
email: string;
|
|
524
|
+
externalId?: string | undefined;
|
|
525
|
+
password?: string | undefined;
|
|
526
|
+
address?: {
|
|
527
|
+
countryCode: string;
|
|
528
|
+
streetAddress1: string;
|
|
529
|
+
streetAddress2: string | null;
|
|
530
|
+
locality: string | null;
|
|
531
|
+
region: string | null;
|
|
532
|
+
postCode: string;
|
|
533
|
+
} | undefined;
|
|
534
|
+
}, {
|
|
535
|
+
name: string;
|
|
536
|
+
email: string;
|
|
537
|
+
externalId?: string | undefined;
|
|
538
|
+
password?: string | undefined;
|
|
539
|
+
address?: {
|
|
540
|
+
countryCode: string;
|
|
541
|
+
streetAddress1: string;
|
|
542
|
+
streetAddress2: string | null;
|
|
543
|
+
locality: string | null;
|
|
544
|
+
region: string | null;
|
|
545
|
+
postCode: string;
|
|
546
|
+
} | undefined;
|
|
473
547
|
}>;
|
|
474
548
|
|
|
475
549
|
type Customer = z.infer<typeof customerSchema>;
|
|
550
|
+
type ImportCustomerRequest = z.infer<typeof importCustomerRequestSchema>;
|
|
476
551
|
|
|
477
552
|
declare class CustomerEndpoints {
|
|
478
553
|
private api;
|
|
479
554
|
constructor(api: MoonbaseApi);
|
|
480
555
|
get(idOrEmail: string): Promise<Customer>;
|
|
556
|
+
import(customer: ImportCustomerRequest): Promise<Customer>;
|
|
481
557
|
}
|
|
482
558
|
|
|
483
559
|
declare const pricingVariationSchema: z.ZodObject<{
|
|
@@ -571,6 +647,7 @@ interface Quantifiable<T> {
|
|
|
571
647
|
|
|
572
648
|
declare const licenseSchema: z.ZodObject<{
|
|
573
649
|
id: z.ZodString;
|
|
650
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
574
651
|
productId: z.ZodString;
|
|
575
652
|
ownerId: z.ZodString;
|
|
576
653
|
status: z.ZodNativeEnum<typeof LicenseStatus>;
|
|
@@ -585,6 +662,7 @@ declare const licenseSchema: z.ZodObject<{
|
|
|
585
662
|
activeNumberOfActivations: number;
|
|
586
663
|
maxNumberOfActivations: number;
|
|
587
664
|
offlineActivationsAllowed: boolean;
|
|
665
|
+
externalId?: string | undefined;
|
|
588
666
|
}, {
|
|
589
667
|
status: LicenseStatus;
|
|
590
668
|
id: string;
|
|
@@ -593,6 +671,7 @@ declare const licenseSchema: z.ZodObject<{
|
|
|
593
671
|
activeNumberOfActivations: number;
|
|
594
672
|
maxNumberOfActivations: number;
|
|
595
673
|
offlineActivationsAllowed: boolean;
|
|
674
|
+
externalId?: string | undefined;
|
|
596
675
|
}>;
|
|
597
676
|
declare const licenseActivationSchema: z.ZodObject<{
|
|
598
677
|
id: z.ZodString;
|
|
@@ -603,6 +682,7 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
603
682
|
lastValidatedAt: z.ZodDate;
|
|
604
683
|
license: z.ZodObject<{
|
|
605
684
|
id: z.ZodString;
|
|
685
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
606
686
|
productId: z.ZodString;
|
|
607
687
|
ownerId: z.ZodString;
|
|
608
688
|
status: z.ZodNativeEnum<typeof LicenseStatus>;
|
|
@@ -617,6 +697,7 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
617
697
|
activeNumberOfActivations: number;
|
|
618
698
|
maxNumberOfActivations: number;
|
|
619
699
|
offlineActivationsAllowed: boolean;
|
|
700
|
+
externalId?: string | undefined;
|
|
620
701
|
}, {
|
|
621
702
|
status: LicenseStatus;
|
|
622
703
|
id: string;
|
|
@@ -625,6 +706,7 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
625
706
|
activeNumberOfActivations: number;
|
|
626
707
|
maxNumberOfActivations: number;
|
|
627
708
|
offlineActivationsAllowed: boolean;
|
|
709
|
+
externalId?: string | undefined;
|
|
628
710
|
}>;
|
|
629
711
|
}, "strip", z.ZodTypeAny, {
|
|
630
712
|
status: ActivationStatus;
|
|
@@ -641,6 +723,7 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
641
723
|
activeNumberOfActivations: number;
|
|
642
724
|
maxNumberOfActivations: number;
|
|
643
725
|
offlineActivationsAllowed: boolean;
|
|
726
|
+
externalId?: string | undefined;
|
|
644
727
|
};
|
|
645
728
|
}, {
|
|
646
729
|
status: ActivationStatus;
|
|
@@ -657,8 +740,59 @@ declare const licenseActivationSchema: z.ZodObject<{
|
|
|
657
740
|
activeNumberOfActivations: number;
|
|
658
741
|
maxNumberOfActivations: number;
|
|
659
742
|
offlineActivationsAllowed: boolean;
|
|
743
|
+
externalId?: string | undefined;
|
|
660
744
|
};
|
|
661
745
|
}>;
|
|
746
|
+
declare const importLicenseRequestSchema: z.ZodObject<{
|
|
747
|
+
customerId: z.ZodString;
|
|
748
|
+
productId: z.ZodString;
|
|
749
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
750
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
751
|
+
maxNumberOfActivations: z.ZodOptional<z.ZodNumber>;
|
|
752
|
+
offlineActivationsAllowed: z.ZodOptional<z.ZodBoolean>;
|
|
753
|
+
activations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
754
|
+
activationMethod: z.ZodNativeEnum<typeof ActivationMethod>;
|
|
755
|
+
deviceName: z.ZodString;
|
|
756
|
+
deviceSignature: z.ZodString;
|
|
757
|
+
lastValidation: z.ZodOptional<z.ZodDate>;
|
|
758
|
+
}, "strip", z.ZodTypeAny, {
|
|
759
|
+
activationMethod: ActivationMethod;
|
|
760
|
+
deviceName: string;
|
|
761
|
+
deviceSignature: string;
|
|
762
|
+
lastValidation?: Date | undefined;
|
|
763
|
+
}, {
|
|
764
|
+
activationMethod: ActivationMethod;
|
|
765
|
+
deviceName: string;
|
|
766
|
+
deviceSignature: string;
|
|
767
|
+
lastValidation?: Date | undefined;
|
|
768
|
+
}>, "many">>;
|
|
769
|
+
}, "strip", z.ZodTypeAny, {
|
|
770
|
+
productId: string;
|
|
771
|
+
customerId: string;
|
|
772
|
+
externalId?: string | undefined;
|
|
773
|
+
createdAt?: Date | undefined;
|
|
774
|
+
maxNumberOfActivations?: number | undefined;
|
|
775
|
+
offlineActivationsAllowed?: boolean | undefined;
|
|
776
|
+
activations?: {
|
|
777
|
+
activationMethod: ActivationMethod;
|
|
778
|
+
deviceName: string;
|
|
779
|
+
deviceSignature: string;
|
|
780
|
+
lastValidation?: Date | undefined;
|
|
781
|
+
}[] | undefined;
|
|
782
|
+
}, {
|
|
783
|
+
productId: string;
|
|
784
|
+
customerId: string;
|
|
785
|
+
externalId?: string | undefined;
|
|
786
|
+
createdAt?: Date | undefined;
|
|
787
|
+
maxNumberOfActivations?: number | undefined;
|
|
788
|
+
offlineActivationsAllowed?: boolean | undefined;
|
|
789
|
+
activations?: {
|
|
790
|
+
activationMethod: ActivationMethod;
|
|
791
|
+
deviceName: string;
|
|
792
|
+
deviceSignature: string;
|
|
793
|
+
lastValidation?: Date | undefined;
|
|
794
|
+
}[] | undefined;
|
|
795
|
+
}>;
|
|
662
796
|
|
|
663
797
|
declare enum LicenseStatus {
|
|
664
798
|
Active = "Active",
|
|
@@ -674,6 +808,7 @@ declare enum ActivationMethod {
|
|
|
674
808
|
}
|
|
675
809
|
type License = z.infer<typeof licenseSchema>;
|
|
676
810
|
type LicenseActivation = z.infer<typeof licenseActivationSchema>;
|
|
811
|
+
type ImportLicenseRequest = z.infer<typeof importLicenseRequestSchema>;
|
|
677
812
|
|
|
678
813
|
declare class LicenseEndpoints {
|
|
679
814
|
private api;
|
|
@@ -684,6 +819,7 @@ declare class LicenseEndpoints {
|
|
|
684
819
|
pageSize?: number;
|
|
685
820
|
}): Promise<Page<License>>;
|
|
686
821
|
get(licenseId: string): Promise<License>;
|
|
822
|
+
import(license: ImportLicenseRequest): Promise<License>;
|
|
687
823
|
revoke(licenseId: string): Promise<License>;
|
|
688
824
|
queryActivations(licenseId: string, opts?: {
|
|
689
825
|
paginationToken?: string;
|
|
@@ -745,6 +881,7 @@ declare class ProductEndpoints {
|
|
|
745
881
|
|
|
746
882
|
declare const trialSchema: z.ZodObject<{
|
|
747
883
|
id: z.ZodString;
|
|
884
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
748
885
|
productId: z.ZodString;
|
|
749
886
|
deviceName: z.ZodString;
|
|
750
887
|
deviceSignature: z.ZodString;
|
|
@@ -760,6 +897,7 @@ declare const trialSchema: z.ZodObject<{
|
|
|
760
897
|
deviceName: string;
|
|
761
898
|
deviceSignature: string;
|
|
762
899
|
expiresAt: Date;
|
|
900
|
+
externalId?: string | undefined;
|
|
763
901
|
ownerId?: string | undefined;
|
|
764
902
|
}, {
|
|
765
903
|
status: TrialStatus;
|
|
@@ -769,14 +907,44 @@ declare const trialSchema: z.ZodObject<{
|
|
|
769
907
|
deviceName: string;
|
|
770
908
|
deviceSignature: string;
|
|
771
909
|
expiresAt: Date;
|
|
910
|
+
externalId?: string | undefined;
|
|
772
911
|
ownerId?: string | undefined;
|
|
773
912
|
}>;
|
|
913
|
+
declare const importTrialRequestSchema: z.ZodObject<{
|
|
914
|
+
productId: z.ZodString;
|
|
915
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
916
|
+
deviceName: z.ZodString;
|
|
917
|
+
deviceSignature: z.ZodString;
|
|
918
|
+
expiresAt: z.ZodDate;
|
|
919
|
+
customerId: z.ZodOptional<z.ZodString>;
|
|
920
|
+
lastValidation: z.ZodOptional<z.ZodDate>;
|
|
921
|
+
createdAt: z.ZodOptional<z.ZodDate>;
|
|
922
|
+
}, "strip", z.ZodTypeAny, {
|
|
923
|
+
productId: string;
|
|
924
|
+
deviceName: string;
|
|
925
|
+
deviceSignature: string;
|
|
926
|
+
expiresAt: Date;
|
|
927
|
+
externalId?: string | undefined;
|
|
928
|
+
customerId?: string | undefined;
|
|
929
|
+
lastValidation?: Date | undefined;
|
|
930
|
+
createdAt?: Date | undefined;
|
|
931
|
+
}, {
|
|
932
|
+
productId: string;
|
|
933
|
+
deviceName: string;
|
|
934
|
+
deviceSignature: string;
|
|
935
|
+
expiresAt: Date;
|
|
936
|
+
externalId?: string | undefined;
|
|
937
|
+
customerId?: string | undefined;
|
|
938
|
+
lastValidation?: Date | undefined;
|
|
939
|
+
createdAt?: Date | undefined;
|
|
940
|
+
}>;
|
|
774
941
|
|
|
775
942
|
declare enum TrialStatus {
|
|
776
943
|
Active = "Active",
|
|
777
944
|
Expired = "Expired"
|
|
778
945
|
}
|
|
779
946
|
type Trial = z.infer<typeof trialSchema>;
|
|
947
|
+
type ImportTrialRequest = z.infer<typeof importTrialRequestSchema>;
|
|
780
948
|
|
|
781
949
|
declare class TrialEndpoints {
|
|
782
950
|
private api;
|
|
@@ -785,6 +953,7 @@ declare class TrialEndpoints {
|
|
|
785
953
|
deviceName: string;
|
|
786
954
|
deviceSignature: string;
|
|
787
955
|
}): Promise<Trial>;
|
|
956
|
+
import(trial: ImportTrialRequest): Promise<Trial>;
|
|
788
957
|
}
|
|
789
958
|
|
|
790
959
|
declare class NotAuthorizedError extends Error {
|
|
@@ -817,4 +986,4 @@ declare class MoonbaseClient {
|
|
|
817
986
|
trials: TrialEndpoints;
|
|
818
987
|
}
|
|
819
988
|
|
|
820
|
-
export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Customer, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus };
|
|
989
|
+
export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus };
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var communicationPreferencesSchema = z.object({
|
|
|
17
17
|
});
|
|
18
18
|
var customerSchema = z.object({
|
|
19
19
|
id: z.string(),
|
|
20
|
+
externalId: z.string().optional(),
|
|
20
21
|
name: z.string(),
|
|
21
22
|
businessName: z.string().nullable(),
|
|
22
23
|
taxId: z.string().nullable(),
|
|
@@ -30,6 +31,13 @@ var customerSchema = z.object({
|
|
|
30
31
|
address: addressSchema.nullable(),
|
|
31
32
|
communicationPreferences: communicationPreferencesSchema
|
|
32
33
|
});
|
|
34
|
+
var importCustomerRequestSchema = z.object({
|
|
35
|
+
name: z.string(),
|
|
36
|
+
email: z.string(),
|
|
37
|
+
externalId: z.string().optional(),
|
|
38
|
+
password: z.string().optional(),
|
|
39
|
+
address: addressSchema.optional()
|
|
40
|
+
});
|
|
33
41
|
|
|
34
42
|
// src/licenses/schemas.ts
|
|
35
43
|
import { z as z2 } from "zod";
|
|
@@ -54,6 +62,7 @@ var ActivationMethod = /* @__PURE__ */ ((ActivationMethod2) => {
|
|
|
54
62
|
// src/licenses/schemas.ts
|
|
55
63
|
var licenseSchema = z2.object({
|
|
56
64
|
id: z2.string(),
|
|
65
|
+
externalId: z2.string().optional(),
|
|
57
66
|
productId: z2.string(),
|
|
58
67
|
ownerId: z2.string(),
|
|
59
68
|
status: z2.nativeEnum(LicenseStatus),
|
|
@@ -70,6 +79,20 @@ var licenseActivationSchema = z2.object({
|
|
|
70
79
|
lastValidatedAt: z2.coerce.date(),
|
|
71
80
|
license: licenseSchema
|
|
72
81
|
});
|
|
82
|
+
var importLicenseRequestSchema = z2.object({
|
|
83
|
+
customerId: z2.string(),
|
|
84
|
+
productId: z2.string(),
|
|
85
|
+
externalId: z2.string().optional(),
|
|
86
|
+
createdAt: z2.date().optional(),
|
|
87
|
+
maxNumberOfActivations: z2.number().optional(),
|
|
88
|
+
offlineActivationsAllowed: z2.boolean().optional(),
|
|
89
|
+
activations: z2.object({
|
|
90
|
+
activationMethod: z2.nativeEnum(ActivationMethod),
|
|
91
|
+
deviceName: z2.string(),
|
|
92
|
+
deviceSignature: z2.string(),
|
|
93
|
+
lastValidation: z2.date().optional()
|
|
94
|
+
}).array().optional()
|
|
95
|
+
});
|
|
73
96
|
|
|
74
97
|
// src/products/schemas.ts
|
|
75
98
|
import { z as z3 } from "zod";
|
|
@@ -107,6 +130,7 @@ var TrialStatus = /* @__PURE__ */ ((TrialStatus2) => {
|
|
|
107
130
|
// src/trials/schemas.ts
|
|
108
131
|
var trialSchema = z4.object({
|
|
109
132
|
id: z4.string(),
|
|
133
|
+
externalId: z4.string().optional(),
|
|
110
134
|
productId: z4.string(),
|
|
111
135
|
deviceName: z4.string(),
|
|
112
136
|
deviceSignature: z4.string(),
|
|
@@ -115,6 +139,16 @@ var trialSchema = z4.object({
|
|
|
115
139
|
lastValidatedAt: z4.coerce.date(),
|
|
116
140
|
ownerId: z4.string().optional()
|
|
117
141
|
});
|
|
142
|
+
var importTrialRequestSchema = z4.object({
|
|
143
|
+
productId: z4.string(),
|
|
144
|
+
externalId: z4.string().optional(),
|
|
145
|
+
deviceName: z4.string(),
|
|
146
|
+
deviceSignature: z4.string(),
|
|
147
|
+
expiresAt: z4.date(),
|
|
148
|
+
customerId: z4.string().optional(),
|
|
149
|
+
lastValidation: z4.date().optional(),
|
|
150
|
+
createdAt: z4.date().optional()
|
|
151
|
+
});
|
|
118
152
|
|
|
119
153
|
// src/activationRequests/models.ts
|
|
120
154
|
var ActivationRequestStatus = /* @__PURE__ */ ((ActivationRequestStatus2) => {
|
|
@@ -160,6 +194,11 @@ var CustomerEndpoints = class {
|
|
|
160
194
|
const response = await this.api.fetch(`/api/customers/${idOrEmail}`);
|
|
161
195
|
return customerSchema.parse(response.data);
|
|
162
196
|
}
|
|
197
|
+
async import(customer) {
|
|
198
|
+
const request = importCustomerRequestSchema.parse(customer);
|
|
199
|
+
const response = await this.api.fetch(`/api/customers/import`, "POST", request);
|
|
200
|
+
return customerSchema.parse(response.data);
|
|
201
|
+
}
|
|
163
202
|
};
|
|
164
203
|
|
|
165
204
|
// src/globalSchemas.ts
|
|
@@ -303,6 +342,11 @@ var LicenseEndpoints = class {
|
|
|
303
342
|
const response = await this.api.fetch(`/api/licenses/${licenseId}`);
|
|
304
343
|
return licenseSchema.parse(response.data);
|
|
305
344
|
}
|
|
345
|
+
async import(license) {
|
|
346
|
+
const request = importLicenseRequestSchema.parse(license);
|
|
347
|
+
const response = await this.api.fetch(`/api/licenses/import`, "POST", request);
|
|
348
|
+
return licenseSchema.parse(response.data);
|
|
349
|
+
}
|
|
306
350
|
async revoke(licenseId) {
|
|
307
351
|
const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
|
|
308
352
|
return licenseSchema.parse(response.data);
|
|
@@ -345,6 +389,11 @@ var TrialEndpoints = class {
|
|
|
345
389
|
const response = await this.api.fetch(`/api/trials/${productId}/request`, "POST", target);
|
|
346
390
|
return trialSchema.parse(response.data);
|
|
347
391
|
}
|
|
392
|
+
async import(trial) {
|
|
393
|
+
const request = importTrialRequestSchema.parse(trial);
|
|
394
|
+
const response = await this.api.fetch(`/api/customers/import`, "POST", request);
|
|
395
|
+
return trialSchema.parse(response.data);
|
|
396
|
+
}
|
|
348
397
|
};
|
|
349
398
|
|
|
350
399
|
// src/index.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.113",
|
|
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",
|