@moonbase.sh/api 0.2.143 → 0.3.0
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 +23 -1
- package/dist/index.d.cts +241 -1
- package/dist/index.d.ts +241 -1
- package/dist/index.js +23 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -143,6 +143,14 @@ var importLicenseRequestSchema = import_zod2.z.object({
|
|
|
143
143
|
lastValidation: import_zod2.z.date().optional()
|
|
144
144
|
}).array().optional()
|
|
145
145
|
});
|
|
146
|
+
var provisionLicensesRequestSchema = import_zod2.z.object({
|
|
147
|
+
ownerId: import_zod2.z.string(),
|
|
148
|
+
requests: import_zod2.z.object({
|
|
149
|
+
productId: import_zod2.z.string(),
|
|
150
|
+
quantity: import_zod2.z.number().optional(),
|
|
151
|
+
limitPerCustomer: import_zod2.z.number().optional()
|
|
152
|
+
}).array()
|
|
153
|
+
});
|
|
146
154
|
|
|
147
155
|
// src/products/schemas.ts
|
|
148
156
|
var import_zod3 = require("zod");
|
|
@@ -445,6 +453,11 @@ var LicenseEndpoints = class {
|
|
|
445
453
|
const response = await this.api.fetch(`/api/licenses/import`, "POST", request);
|
|
446
454
|
return licenseSchema.parse(response.data);
|
|
447
455
|
}
|
|
456
|
+
async provision(input) {
|
|
457
|
+
const request = provisionLicensesRequestSchema.parse(input);
|
|
458
|
+
const response = await this.api.fetch(`/api/licenses/provision`, "POST", request);
|
|
459
|
+
return licenseSchema.array().parse(response.data);
|
|
460
|
+
}
|
|
448
461
|
async revoke(licenseId) {
|
|
449
462
|
const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
|
|
450
463
|
return licenseSchema.parse(response.data);
|
|
@@ -495,9 +508,18 @@ var bundleLineItemFulfillmentSchema = import_zod8.z.object({
|
|
|
495
508
|
licenseIds: import_zod8.z.string().array()
|
|
496
509
|
}))
|
|
497
510
|
});
|
|
511
|
+
var subscriptionLineItemFulfillmentSchema = import_zod8.z.object({
|
|
512
|
+
type: import_zod8.z.literal("Subscription"),
|
|
513
|
+
subscriptionId: import_zod8.z.string(),
|
|
514
|
+
inner: import_zod8.z.discriminatedUnion("type", [
|
|
515
|
+
licenseLineItemFulfillmentSchema,
|
|
516
|
+
bundleLineItemFulfillmentSchema
|
|
517
|
+
])
|
|
518
|
+
});
|
|
498
519
|
var lineItemFulfillmentSchema = import_zod8.z.discriminatedUnion("type", [
|
|
499
520
|
licenseLineItemFulfillmentSchema,
|
|
500
|
-
bundleLineItemFulfillmentSchema
|
|
521
|
+
bundleLineItemFulfillmentSchema,
|
|
522
|
+
subscriptionLineItemFulfillmentSchema
|
|
501
523
|
]);
|
|
502
524
|
var lineItemTotalSchema = import_zod8.z.object({
|
|
503
525
|
original: moneySchema,
|
package/dist/index.d.cts
CHANGED
|
@@ -1110,6 +1110,36 @@ declare const importLicenseRequestSchema: z.ZodObject<{
|
|
|
1110
1110
|
lastValidation?: Date | undefined;
|
|
1111
1111
|
}[] | undefined;
|
|
1112
1112
|
}>;
|
|
1113
|
+
declare const provisionLicensesRequestSchema: z.ZodObject<{
|
|
1114
|
+
ownerId: z.ZodString;
|
|
1115
|
+
requests: z.ZodArray<z.ZodObject<{
|
|
1116
|
+
productId: z.ZodString;
|
|
1117
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
1118
|
+
limitPerCustomer: z.ZodOptional<z.ZodNumber>;
|
|
1119
|
+
}, "strip", z.ZodTypeAny, {
|
|
1120
|
+
productId: string;
|
|
1121
|
+
quantity?: number | undefined;
|
|
1122
|
+
limitPerCustomer?: number | undefined;
|
|
1123
|
+
}, {
|
|
1124
|
+
productId: string;
|
|
1125
|
+
quantity?: number | undefined;
|
|
1126
|
+
limitPerCustomer?: number | undefined;
|
|
1127
|
+
}>, "many">;
|
|
1128
|
+
}, "strip", z.ZodTypeAny, {
|
|
1129
|
+
ownerId: string;
|
|
1130
|
+
requests: {
|
|
1131
|
+
productId: string;
|
|
1132
|
+
quantity?: number | undefined;
|
|
1133
|
+
limitPerCustomer?: number | undefined;
|
|
1134
|
+
}[];
|
|
1135
|
+
}, {
|
|
1136
|
+
ownerId: string;
|
|
1137
|
+
requests: {
|
|
1138
|
+
productId: string;
|
|
1139
|
+
quantity?: number | undefined;
|
|
1140
|
+
limitPerCustomer?: number | undefined;
|
|
1141
|
+
}[];
|
|
1142
|
+
}>;
|
|
1113
1143
|
|
|
1114
1144
|
declare enum LicenseStatus {
|
|
1115
1145
|
Active = "Active",
|
|
@@ -1126,6 +1156,7 @@ declare enum ActivationMethod {
|
|
|
1126
1156
|
type License = z.infer<typeof licenseSchema>;
|
|
1127
1157
|
type LicenseActivation = z.infer<typeof licenseActivationSchema>;
|
|
1128
1158
|
type ImportLicenseRequest = z.infer<typeof importLicenseRequestSchema>;
|
|
1159
|
+
type ProvisionLicensesRequest = z.infer<typeof provisionLicensesRequestSchema>;
|
|
1129
1160
|
|
|
1130
1161
|
declare class LicenseEndpoints {
|
|
1131
1162
|
private api;
|
|
@@ -1137,6 +1168,7 @@ declare class LicenseEndpoints {
|
|
|
1137
1168
|
}): Promise<Page<License>>;
|
|
1138
1169
|
get(licenseId: string): Promise<License>;
|
|
1139
1170
|
import(license: ImportLicenseRequest): Promise<License>;
|
|
1171
|
+
provision(input: ProvisionLicensesRequest): Promise<License[]>;
|
|
1140
1172
|
revoke(licenseId: string): Promise<License>;
|
|
1141
1173
|
queryActivations(licenseId: string, opts?: {
|
|
1142
1174
|
paginationToken?: string;
|
|
@@ -1769,6 +1801,62 @@ declare const orderSchema: z.ZodObject<{
|
|
|
1769
1801
|
productLicenses: Record<string, {
|
|
1770
1802
|
licenseIds: string[];
|
|
1771
1803
|
}>;
|
|
1804
|
+
}>, z.ZodObject<{
|
|
1805
|
+
type: z.ZodLiteral<"Subscription">;
|
|
1806
|
+
subscriptionId: z.ZodString;
|
|
1807
|
+
inner: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1808
|
+
type: z.ZodLiteral<"License">;
|
|
1809
|
+
licenseIds: z.ZodArray<z.ZodString, "many">;
|
|
1810
|
+
}, "strip", z.ZodTypeAny, {
|
|
1811
|
+
type: "License";
|
|
1812
|
+
licenseIds: string[];
|
|
1813
|
+
}, {
|
|
1814
|
+
type: "License";
|
|
1815
|
+
licenseIds: string[];
|
|
1816
|
+
}>, z.ZodObject<{
|
|
1817
|
+
type: z.ZodLiteral<"Bundle">;
|
|
1818
|
+
productLicenses: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1819
|
+
licenseIds: z.ZodArray<z.ZodString, "many">;
|
|
1820
|
+
}, "strip", z.ZodTypeAny, {
|
|
1821
|
+
licenseIds: string[];
|
|
1822
|
+
}, {
|
|
1823
|
+
licenseIds: string[];
|
|
1824
|
+
}>>;
|
|
1825
|
+
}, "strip", z.ZodTypeAny, {
|
|
1826
|
+
type: "Bundle";
|
|
1827
|
+
productLicenses: Record<string, {
|
|
1828
|
+
licenseIds: string[];
|
|
1829
|
+
}>;
|
|
1830
|
+
}, {
|
|
1831
|
+
type: "Bundle";
|
|
1832
|
+
productLicenses: Record<string, {
|
|
1833
|
+
licenseIds: string[];
|
|
1834
|
+
}>;
|
|
1835
|
+
}>]>;
|
|
1836
|
+
}, "strip", z.ZodTypeAny, {
|
|
1837
|
+
type: "Subscription";
|
|
1838
|
+
subscriptionId: string;
|
|
1839
|
+
inner: {
|
|
1840
|
+
type: "License";
|
|
1841
|
+
licenseIds: string[];
|
|
1842
|
+
} | {
|
|
1843
|
+
type: "Bundle";
|
|
1844
|
+
productLicenses: Record<string, {
|
|
1845
|
+
licenseIds: string[];
|
|
1846
|
+
}>;
|
|
1847
|
+
};
|
|
1848
|
+
}, {
|
|
1849
|
+
type: "Subscription";
|
|
1850
|
+
subscriptionId: string;
|
|
1851
|
+
inner: {
|
|
1852
|
+
type: "License";
|
|
1853
|
+
licenseIds: string[];
|
|
1854
|
+
} | {
|
|
1855
|
+
type: "Bundle";
|
|
1856
|
+
productLicenses: Record<string, {
|
|
1857
|
+
licenseIds: string[];
|
|
1858
|
+
}>;
|
|
1859
|
+
};
|
|
1772
1860
|
}>]>>;
|
|
1773
1861
|
}, "strip", z.ZodTypeAny, {
|
|
1774
1862
|
type: "Product";
|
|
@@ -1849,6 +1937,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
1849
1937
|
productLicenses: Record<string, {
|
|
1850
1938
|
licenseIds: string[];
|
|
1851
1939
|
}>;
|
|
1940
|
+
} | {
|
|
1941
|
+
type: "Subscription";
|
|
1942
|
+
subscriptionId: string;
|
|
1943
|
+
inner: {
|
|
1944
|
+
type: "License";
|
|
1945
|
+
licenseIds: string[];
|
|
1946
|
+
} | {
|
|
1947
|
+
type: "Bundle";
|
|
1948
|
+
productLicenses: Record<string, {
|
|
1949
|
+
licenseIds: string[];
|
|
1950
|
+
}>;
|
|
1951
|
+
};
|
|
1852
1952
|
} | undefined;
|
|
1853
1953
|
}, {
|
|
1854
1954
|
type: "Product";
|
|
@@ -1929,6 +2029,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
1929
2029
|
productLicenses: Record<string, {
|
|
1930
2030
|
licenseIds: string[];
|
|
1931
2031
|
}>;
|
|
2032
|
+
} | {
|
|
2033
|
+
type: "Subscription";
|
|
2034
|
+
subscriptionId: string;
|
|
2035
|
+
inner: {
|
|
2036
|
+
type: "License";
|
|
2037
|
+
licenseIds: string[];
|
|
2038
|
+
} | {
|
|
2039
|
+
type: "Bundle";
|
|
2040
|
+
productLicenses: Record<string, {
|
|
2041
|
+
licenseIds: string[];
|
|
2042
|
+
}>;
|
|
2043
|
+
};
|
|
1932
2044
|
} | undefined;
|
|
1933
2045
|
}>, z.ZodObject<{
|
|
1934
2046
|
type: z.ZodLiteral<"Bundle">;
|
|
@@ -2221,6 +2333,62 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2221
2333
|
productLicenses: Record<string, {
|
|
2222
2334
|
licenseIds: string[];
|
|
2223
2335
|
}>;
|
|
2336
|
+
}>, z.ZodObject<{
|
|
2337
|
+
type: z.ZodLiteral<"Subscription">;
|
|
2338
|
+
subscriptionId: z.ZodString;
|
|
2339
|
+
inner: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2340
|
+
type: z.ZodLiteral<"License">;
|
|
2341
|
+
licenseIds: z.ZodArray<z.ZodString, "many">;
|
|
2342
|
+
}, "strip", z.ZodTypeAny, {
|
|
2343
|
+
type: "License";
|
|
2344
|
+
licenseIds: string[];
|
|
2345
|
+
}, {
|
|
2346
|
+
type: "License";
|
|
2347
|
+
licenseIds: string[];
|
|
2348
|
+
}>, z.ZodObject<{
|
|
2349
|
+
type: z.ZodLiteral<"Bundle">;
|
|
2350
|
+
productLicenses: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2351
|
+
licenseIds: z.ZodArray<z.ZodString, "many">;
|
|
2352
|
+
}, "strip", z.ZodTypeAny, {
|
|
2353
|
+
licenseIds: string[];
|
|
2354
|
+
}, {
|
|
2355
|
+
licenseIds: string[];
|
|
2356
|
+
}>>;
|
|
2357
|
+
}, "strip", z.ZodTypeAny, {
|
|
2358
|
+
type: "Bundle";
|
|
2359
|
+
productLicenses: Record<string, {
|
|
2360
|
+
licenseIds: string[];
|
|
2361
|
+
}>;
|
|
2362
|
+
}, {
|
|
2363
|
+
type: "Bundle";
|
|
2364
|
+
productLicenses: Record<string, {
|
|
2365
|
+
licenseIds: string[];
|
|
2366
|
+
}>;
|
|
2367
|
+
}>]>;
|
|
2368
|
+
}, "strip", z.ZodTypeAny, {
|
|
2369
|
+
type: "Subscription";
|
|
2370
|
+
subscriptionId: string;
|
|
2371
|
+
inner: {
|
|
2372
|
+
type: "License";
|
|
2373
|
+
licenseIds: string[];
|
|
2374
|
+
} | {
|
|
2375
|
+
type: "Bundle";
|
|
2376
|
+
productLicenses: Record<string, {
|
|
2377
|
+
licenseIds: string[];
|
|
2378
|
+
}>;
|
|
2379
|
+
};
|
|
2380
|
+
}, {
|
|
2381
|
+
type: "Subscription";
|
|
2382
|
+
subscriptionId: string;
|
|
2383
|
+
inner: {
|
|
2384
|
+
type: "License";
|
|
2385
|
+
licenseIds: string[];
|
|
2386
|
+
} | {
|
|
2387
|
+
type: "Bundle";
|
|
2388
|
+
productLicenses: Record<string, {
|
|
2389
|
+
licenseIds: string[];
|
|
2390
|
+
}>;
|
|
2391
|
+
};
|
|
2224
2392
|
}>]>>;
|
|
2225
2393
|
}, "strip", z.ZodTypeAny, {
|
|
2226
2394
|
type: "Bundle";
|
|
@@ -2301,6 +2469,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2301
2469
|
productLicenses: Record<string, {
|
|
2302
2470
|
licenseIds: string[];
|
|
2303
2471
|
}>;
|
|
2472
|
+
} | {
|
|
2473
|
+
type: "Subscription";
|
|
2474
|
+
subscriptionId: string;
|
|
2475
|
+
inner: {
|
|
2476
|
+
type: "License";
|
|
2477
|
+
licenseIds: string[];
|
|
2478
|
+
} | {
|
|
2479
|
+
type: "Bundle";
|
|
2480
|
+
productLicenses: Record<string, {
|
|
2481
|
+
licenseIds: string[];
|
|
2482
|
+
}>;
|
|
2483
|
+
};
|
|
2304
2484
|
} | undefined;
|
|
2305
2485
|
}, {
|
|
2306
2486
|
type: "Bundle";
|
|
@@ -2381,6 +2561,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2381
2561
|
productLicenses: Record<string, {
|
|
2382
2562
|
licenseIds: string[];
|
|
2383
2563
|
}>;
|
|
2564
|
+
} | {
|
|
2565
|
+
type: "Subscription";
|
|
2566
|
+
subscriptionId: string;
|
|
2567
|
+
inner: {
|
|
2568
|
+
type: "License";
|
|
2569
|
+
licenseIds: string[];
|
|
2570
|
+
} | {
|
|
2571
|
+
type: "Bundle";
|
|
2572
|
+
productLicenses: Record<string, {
|
|
2573
|
+
licenseIds: string[];
|
|
2574
|
+
}>;
|
|
2575
|
+
};
|
|
2384
2576
|
} | undefined;
|
|
2385
2577
|
}>]>, "many">;
|
|
2386
2578
|
lastUpdated: z.ZodObject<{
|
|
@@ -2526,6 +2718,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2526
2718
|
productLicenses: Record<string, {
|
|
2527
2719
|
licenseIds: string[];
|
|
2528
2720
|
}>;
|
|
2721
|
+
} | {
|
|
2722
|
+
type: "Subscription";
|
|
2723
|
+
subscriptionId: string;
|
|
2724
|
+
inner: {
|
|
2725
|
+
type: "License";
|
|
2726
|
+
licenseIds: string[];
|
|
2727
|
+
} | {
|
|
2728
|
+
type: "Bundle";
|
|
2729
|
+
productLicenses: Record<string, {
|
|
2730
|
+
licenseIds: string[];
|
|
2731
|
+
}>;
|
|
2732
|
+
};
|
|
2529
2733
|
} | undefined;
|
|
2530
2734
|
} | {
|
|
2531
2735
|
type: "Bundle";
|
|
@@ -2606,6 +2810,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2606
2810
|
productLicenses: Record<string, {
|
|
2607
2811
|
licenseIds: string[];
|
|
2608
2812
|
}>;
|
|
2813
|
+
} | {
|
|
2814
|
+
type: "Subscription";
|
|
2815
|
+
subscriptionId: string;
|
|
2816
|
+
inner: {
|
|
2817
|
+
type: "License";
|
|
2818
|
+
licenseIds: string[];
|
|
2819
|
+
} | {
|
|
2820
|
+
type: "Bundle";
|
|
2821
|
+
productLicenses: Record<string, {
|
|
2822
|
+
licenseIds: string[];
|
|
2823
|
+
}>;
|
|
2824
|
+
};
|
|
2609
2825
|
} | undefined;
|
|
2610
2826
|
})[];
|
|
2611
2827
|
isRefunded: boolean;
|
|
@@ -2799,6 +3015,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2799
3015
|
productLicenses: Record<string, {
|
|
2800
3016
|
licenseIds: string[];
|
|
2801
3017
|
}>;
|
|
3018
|
+
} | {
|
|
3019
|
+
type: "Subscription";
|
|
3020
|
+
subscriptionId: string;
|
|
3021
|
+
inner: {
|
|
3022
|
+
type: "License";
|
|
3023
|
+
licenseIds: string[];
|
|
3024
|
+
} | {
|
|
3025
|
+
type: "Bundle";
|
|
3026
|
+
productLicenses: Record<string, {
|
|
3027
|
+
licenseIds: string[];
|
|
3028
|
+
}>;
|
|
3029
|
+
};
|
|
2802
3030
|
} | undefined;
|
|
2803
3031
|
} | {
|
|
2804
3032
|
type: "Bundle";
|
|
@@ -2879,6 +3107,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2879
3107
|
productLicenses: Record<string, {
|
|
2880
3108
|
licenseIds: string[];
|
|
2881
3109
|
}>;
|
|
3110
|
+
} | {
|
|
3111
|
+
type: "Subscription";
|
|
3112
|
+
subscriptionId: string;
|
|
3113
|
+
inner: {
|
|
3114
|
+
type: "License";
|
|
3115
|
+
licenseIds: string[];
|
|
3116
|
+
} | {
|
|
3117
|
+
type: "Bundle";
|
|
3118
|
+
productLicenses: Record<string, {
|
|
3119
|
+
licenseIds: string[];
|
|
3120
|
+
}>;
|
|
3121
|
+
};
|
|
2882
3122
|
} | undefined;
|
|
2883
3123
|
})[];
|
|
2884
3124
|
isRefunded: boolean;
|
|
@@ -3566,4 +3806,4 @@ declare class MoonbaseClient {
|
|
|
3566
3806
|
orders: OrderEndpoints;
|
|
3567
3807
|
}
|
|
3568
3808
|
|
|
3569
|
-
export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Bundle, ConflictError, type CreateVoucherRequest, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Order, OrderStatus, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus, type Voucher };
|
|
3809
|
+
export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Bundle, ConflictError, type CreateVoucherRequest, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Order, OrderStatus, type Page, type PricingVariation, type Product, ProductStatus, type ProvisionLicensesRequest, type Quantifiable, type Trial, TrialStatus, type Voucher };
|
package/dist/index.d.ts
CHANGED
|
@@ -1110,6 +1110,36 @@ declare const importLicenseRequestSchema: z.ZodObject<{
|
|
|
1110
1110
|
lastValidation?: Date | undefined;
|
|
1111
1111
|
}[] | undefined;
|
|
1112
1112
|
}>;
|
|
1113
|
+
declare const provisionLicensesRequestSchema: z.ZodObject<{
|
|
1114
|
+
ownerId: z.ZodString;
|
|
1115
|
+
requests: z.ZodArray<z.ZodObject<{
|
|
1116
|
+
productId: z.ZodString;
|
|
1117
|
+
quantity: z.ZodOptional<z.ZodNumber>;
|
|
1118
|
+
limitPerCustomer: z.ZodOptional<z.ZodNumber>;
|
|
1119
|
+
}, "strip", z.ZodTypeAny, {
|
|
1120
|
+
productId: string;
|
|
1121
|
+
quantity?: number | undefined;
|
|
1122
|
+
limitPerCustomer?: number | undefined;
|
|
1123
|
+
}, {
|
|
1124
|
+
productId: string;
|
|
1125
|
+
quantity?: number | undefined;
|
|
1126
|
+
limitPerCustomer?: number | undefined;
|
|
1127
|
+
}>, "many">;
|
|
1128
|
+
}, "strip", z.ZodTypeAny, {
|
|
1129
|
+
ownerId: string;
|
|
1130
|
+
requests: {
|
|
1131
|
+
productId: string;
|
|
1132
|
+
quantity?: number | undefined;
|
|
1133
|
+
limitPerCustomer?: number | undefined;
|
|
1134
|
+
}[];
|
|
1135
|
+
}, {
|
|
1136
|
+
ownerId: string;
|
|
1137
|
+
requests: {
|
|
1138
|
+
productId: string;
|
|
1139
|
+
quantity?: number | undefined;
|
|
1140
|
+
limitPerCustomer?: number | undefined;
|
|
1141
|
+
}[];
|
|
1142
|
+
}>;
|
|
1113
1143
|
|
|
1114
1144
|
declare enum LicenseStatus {
|
|
1115
1145
|
Active = "Active",
|
|
@@ -1126,6 +1156,7 @@ declare enum ActivationMethod {
|
|
|
1126
1156
|
type License = z.infer<typeof licenseSchema>;
|
|
1127
1157
|
type LicenseActivation = z.infer<typeof licenseActivationSchema>;
|
|
1128
1158
|
type ImportLicenseRequest = z.infer<typeof importLicenseRequestSchema>;
|
|
1159
|
+
type ProvisionLicensesRequest = z.infer<typeof provisionLicensesRequestSchema>;
|
|
1129
1160
|
|
|
1130
1161
|
declare class LicenseEndpoints {
|
|
1131
1162
|
private api;
|
|
@@ -1137,6 +1168,7 @@ declare class LicenseEndpoints {
|
|
|
1137
1168
|
}): Promise<Page<License>>;
|
|
1138
1169
|
get(licenseId: string): Promise<License>;
|
|
1139
1170
|
import(license: ImportLicenseRequest): Promise<License>;
|
|
1171
|
+
provision(input: ProvisionLicensesRequest): Promise<License[]>;
|
|
1140
1172
|
revoke(licenseId: string): Promise<License>;
|
|
1141
1173
|
queryActivations(licenseId: string, opts?: {
|
|
1142
1174
|
paginationToken?: string;
|
|
@@ -1769,6 +1801,62 @@ declare const orderSchema: z.ZodObject<{
|
|
|
1769
1801
|
productLicenses: Record<string, {
|
|
1770
1802
|
licenseIds: string[];
|
|
1771
1803
|
}>;
|
|
1804
|
+
}>, z.ZodObject<{
|
|
1805
|
+
type: z.ZodLiteral<"Subscription">;
|
|
1806
|
+
subscriptionId: z.ZodString;
|
|
1807
|
+
inner: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1808
|
+
type: z.ZodLiteral<"License">;
|
|
1809
|
+
licenseIds: z.ZodArray<z.ZodString, "many">;
|
|
1810
|
+
}, "strip", z.ZodTypeAny, {
|
|
1811
|
+
type: "License";
|
|
1812
|
+
licenseIds: string[];
|
|
1813
|
+
}, {
|
|
1814
|
+
type: "License";
|
|
1815
|
+
licenseIds: string[];
|
|
1816
|
+
}>, z.ZodObject<{
|
|
1817
|
+
type: z.ZodLiteral<"Bundle">;
|
|
1818
|
+
productLicenses: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1819
|
+
licenseIds: z.ZodArray<z.ZodString, "many">;
|
|
1820
|
+
}, "strip", z.ZodTypeAny, {
|
|
1821
|
+
licenseIds: string[];
|
|
1822
|
+
}, {
|
|
1823
|
+
licenseIds: string[];
|
|
1824
|
+
}>>;
|
|
1825
|
+
}, "strip", z.ZodTypeAny, {
|
|
1826
|
+
type: "Bundle";
|
|
1827
|
+
productLicenses: Record<string, {
|
|
1828
|
+
licenseIds: string[];
|
|
1829
|
+
}>;
|
|
1830
|
+
}, {
|
|
1831
|
+
type: "Bundle";
|
|
1832
|
+
productLicenses: Record<string, {
|
|
1833
|
+
licenseIds: string[];
|
|
1834
|
+
}>;
|
|
1835
|
+
}>]>;
|
|
1836
|
+
}, "strip", z.ZodTypeAny, {
|
|
1837
|
+
type: "Subscription";
|
|
1838
|
+
subscriptionId: string;
|
|
1839
|
+
inner: {
|
|
1840
|
+
type: "License";
|
|
1841
|
+
licenseIds: string[];
|
|
1842
|
+
} | {
|
|
1843
|
+
type: "Bundle";
|
|
1844
|
+
productLicenses: Record<string, {
|
|
1845
|
+
licenseIds: string[];
|
|
1846
|
+
}>;
|
|
1847
|
+
};
|
|
1848
|
+
}, {
|
|
1849
|
+
type: "Subscription";
|
|
1850
|
+
subscriptionId: string;
|
|
1851
|
+
inner: {
|
|
1852
|
+
type: "License";
|
|
1853
|
+
licenseIds: string[];
|
|
1854
|
+
} | {
|
|
1855
|
+
type: "Bundle";
|
|
1856
|
+
productLicenses: Record<string, {
|
|
1857
|
+
licenseIds: string[];
|
|
1858
|
+
}>;
|
|
1859
|
+
};
|
|
1772
1860
|
}>]>>;
|
|
1773
1861
|
}, "strip", z.ZodTypeAny, {
|
|
1774
1862
|
type: "Product";
|
|
@@ -1849,6 +1937,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
1849
1937
|
productLicenses: Record<string, {
|
|
1850
1938
|
licenseIds: string[];
|
|
1851
1939
|
}>;
|
|
1940
|
+
} | {
|
|
1941
|
+
type: "Subscription";
|
|
1942
|
+
subscriptionId: string;
|
|
1943
|
+
inner: {
|
|
1944
|
+
type: "License";
|
|
1945
|
+
licenseIds: string[];
|
|
1946
|
+
} | {
|
|
1947
|
+
type: "Bundle";
|
|
1948
|
+
productLicenses: Record<string, {
|
|
1949
|
+
licenseIds: string[];
|
|
1950
|
+
}>;
|
|
1951
|
+
};
|
|
1852
1952
|
} | undefined;
|
|
1853
1953
|
}, {
|
|
1854
1954
|
type: "Product";
|
|
@@ -1929,6 +2029,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
1929
2029
|
productLicenses: Record<string, {
|
|
1930
2030
|
licenseIds: string[];
|
|
1931
2031
|
}>;
|
|
2032
|
+
} | {
|
|
2033
|
+
type: "Subscription";
|
|
2034
|
+
subscriptionId: string;
|
|
2035
|
+
inner: {
|
|
2036
|
+
type: "License";
|
|
2037
|
+
licenseIds: string[];
|
|
2038
|
+
} | {
|
|
2039
|
+
type: "Bundle";
|
|
2040
|
+
productLicenses: Record<string, {
|
|
2041
|
+
licenseIds: string[];
|
|
2042
|
+
}>;
|
|
2043
|
+
};
|
|
1932
2044
|
} | undefined;
|
|
1933
2045
|
}>, z.ZodObject<{
|
|
1934
2046
|
type: z.ZodLiteral<"Bundle">;
|
|
@@ -2221,6 +2333,62 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2221
2333
|
productLicenses: Record<string, {
|
|
2222
2334
|
licenseIds: string[];
|
|
2223
2335
|
}>;
|
|
2336
|
+
}>, z.ZodObject<{
|
|
2337
|
+
type: z.ZodLiteral<"Subscription">;
|
|
2338
|
+
subscriptionId: z.ZodString;
|
|
2339
|
+
inner: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
2340
|
+
type: z.ZodLiteral<"License">;
|
|
2341
|
+
licenseIds: z.ZodArray<z.ZodString, "many">;
|
|
2342
|
+
}, "strip", z.ZodTypeAny, {
|
|
2343
|
+
type: "License";
|
|
2344
|
+
licenseIds: string[];
|
|
2345
|
+
}, {
|
|
2346
|
+
type: "License";
|
|
2347
|
+
licenseIds: string[];
|
|
2348
|
+
}>, z.ZodObject<{
|
|
2349
|
+
type: z.ZodLiteral<"Bundle">;
|
|
2350
|
+
productLicenses: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2351
|
+
licenseIds: z.ZodArray<z.ZodString, "many">;
|
|
2352
|
+
}, "strip", z.ZodTypeAny, {
|
|
2353
|
+
licenseIds: string[];
|
|
2354
|
+
}, {
|
|
2355
|
+
licenseIds: string[];
|
|
2356
|
+
}>>;
|
|
2357
|
+
}, "strip", z.ZodTypeAny, {
|
|
2358
|
+
type: "Bundle";
|
|
2359
|
+
productLicenses: Record<string, {
|
|
2360
|
+
licenseIds: string[];
|
|
2361
|
+
}>;
|
|
2362
|
+
}, {
|
|
2363
|
+
type: "Bundle";
|
|
2364
|
+
productLicenses: Record<string, {
|
|
2365
|
+
licenseIds: string[];
|
|
2366
|
+
}>;
|
|
2367
|
+
}>]>;
|
|
2368
|
+
}, "strip", z.ZodTypeAny, {
|
|
2369
|
+
type: "Subscription";
|
|
2370
|
+
subscriptionId: string;
|
|
2371
|
+
inner: {
|
|
2372
|
+
type: "License";
|
|
2373
|
+
licenseIds: string[];
|
|
2374
|
+
} | {
|
|
2375
|
+
type: "Bundle";
|
|
2376
|
+
productLicenses: Record<string, {
|
|
2377
|
+
licenseIds: string[];
|
|
2378
|
+
}>;
|
|
2379
|
+
};
|
|
2380
|
+
}, {
|
|
2381
|
+
type: "Subscription";
|
|
2382
|
+
subscriptionId: string;
|
|
2383
|
+
inner: {
|
|
2384
|
+
type: "License";
|
|
2385
|
+
licenseIds: string[];
|
|
2386
|
+
} | {
|
|
2387
|
+
type: "Bundle";
|
|
2388
|
+
productLicenses: Record<string, {
|
|
2389
|
+
licenseIds: string[];
|
|
2390
|
+
}>;
|
|
2391
|
+
};
|
|
2224
2392
|
}>]>>;
|
|
2225
2393
|
}, "strip", z.ZodTypeAny, {
|
|
2226
2394
|
type: "Bundle";
|
|
@@ -2301,6 +2469,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2301
2469
|
productLicenses: Record<string, {
|
|
2302
2470
|
licenseIds: string[];
|
|
2303
2471
|
}>;
|
|
2472
|
+
} | {
|
|
2473
|
+
type: "Subscription";
|
|
2474
|
+
subscriptionId: string;
|
|
2475
|
+
inner: {
|
|
2476
|
+
type: "License";
|
|
2477
|
+
licenseIds: string[];
|
|
2478
|
+
} | {
|
|
2479
|
+
type: "Bundle";
|
|
2480
|
+
productLicenses: Record<string, {
|
|
2481
|
+
licenseIds: string[];
|
|
2482
|
+
}>;
|
|
2483
|
+
};
|
|
2304
2484
|
} | undefined;
|
|
2305
2485
|
}, {
|
|
2306
2486
|
type: "Bundle";
|
|
@@ -2381,6 +2561,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2381
2561
|
productLicenses: Record<string, {
|
|
2382
2562
|
licenseIds: string[];
|
|
2383
2563
|
}>;
|
|
2564
|
+
} | {
|
|
2565
|
+
type: "Subscription";
|
|
2566
|
+
subscriptionId: string;
|
|
2567
|
+
inner: {
|
|
2568
|
+
type: "License";
|
|
2569
|
+
licenseIds: string[];
|
|
2570
|
+
} | {
|
|
2571
|
+
type: "Bundle";
|
|
2572
|
+
productLicenses: Record<string, {
|
|
2573
|
+
licenseIds: string[];
|
|
2574
|
+
}>;
|
|
2575
|
+
};
|
|
2384
2576
|
} | undefined;
|
|
2385
2577
|
}>]>, "many">;
|
|
2386
2578
|
lastUpdated: z.ZodObject<{
|
|
@@ -2526,6 +2718,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2526
2718
|
productLicenses: Record<string, {
|
|
2527
2719
|
licenseIds: string[];
|
|
2528
2720
|
}>;
|
|
2721
|
+
} | {
|
|
2722
|
+
type: "Subscription";
|
|
2723
|
+
subscriptionId: string;
|
|
2724
|
+
inner: {
|
|
2725
|
+
type: "License";
|
|
2726
|
+
licenseIds: string[];
|
|
2727
|
+
} | {
|
|
2728
|
+
type: "Bundle";
|
|
2729
|
+
productLicenses: Record<string, {
|
|
2730
|
+
licenseIds: string[];
|
|
2731
|
+
}>;
|
|
2732
|
+
};
|
|
2529
2733
|
} | undefined;
|
|
2530
2734
|
} | {
|
|
2531
2735
|
type: "Bundle";
|
|
@@ -2606,6 +2810,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2606
2810
|
productLicenses: Record<string, {
|
|
2607
2811
|
licenseIds: string[];
|
|
2608
2812
|
}>;
|
|
2813
|
+
} | {
|
|
2814
|
+
type: "Subscription";
|
|
2815
|
+
subscriptionId: string;
|
|
2816
|
+
inner: {
|
|
2817
|
+
type: "License";
|
|
2818
|
+
licenseIds: string[];
|
|
2819
|
+
} | {
|
|
2820
|
+
type: "Bundle";
|
|
2821
|
+
productLicenses: Record<string, {
|
|
2822
|
+
licenseIds: string[];
|
|
2823
|
+
}>;
|
|
2824
|
+
};
|
|
2609
2825
|
} | undefined;
|
|
2610
2826
|
})[];
|
|
2611
2827
|
isRefunded: boolean;
|
|
@@ -2799,6 +3015,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2799
3015
|
productLicenses: Record<string, {
|
|
2800
3016
|
licenseIds: string[];
|
|
2801
3017
|
}>;
|
|
3018
|
+
} | {
|
|
3019
|
+
type: "Subscription";
|
|
3020
|
+
subscriptionId: string;
|
|
3021
|
+
inner: {
|
|
3022
|
+
type: "License";
|
|
3023
|
+
licenseIds: string[];
|
|
3024
|
+
} | {
|
|
3025
|
+
type: "Bundle";
|
|
3026
|
+
productLicenses: Record<string, {
|
|
3027
|
+
licenseIds: string[];
|
|
3028
|
+
}>;
|
|
3029
|
+
};
|
|
2802
3030
|
} | undefined;
|
|
2803
3031
|
} | {
|
|
2804
3032
|
type: "Bundle";
|
|
@@ -2879,6 +3107,18 @@ declare const orderSchema: z.ZodObject<{
|
|
|
2879
3107
|
productLicenses: Record<string, {
|
|
2880
3108
|
licenseIds: string[];
|
|
2881
3109
|
}>;
|
|
3110
|
+
} | {
|
|
3111
|
+
type: "Subscription";
|
|
3112
|
+
subscriptionId: string;
|
|
3113
|
+
inner: {
|
|
3114
|
+
type: "License";
|
|
3115
|
+
licenseIds: string[];
|
|
3116
|
+
} | {
|
|
3117
|
+
type: "Bundle";
|
|
3118
|
+
productLicenses: Record<string, {
|
|
3119
|
+
licenseIds: string[];
|
|
3120
|
+
}>;
|
|
3121
|
+
};
|
|
2882
3122
|
} | undefined;
|
|
2883
3123
|
})[];
|
|
2884
3124
|
isRefunded: boolean;
|
|
@@ -3566,4 +3806,4 @@ declare class MoonbaseClient {
|
|
|
3566
3806
|
orders: OrderEndpoints;
|
|
3567
3807
|
}
|
|
3568
3808
|
|
|
3569
|
-
export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Bundle, ConflictError, type CreateVoucherRequest, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Order, OrderStatus, type Page, type PricingVariation, type Product, ProductStatus, type Quantifiable, type Trial, TrialStatus, type Voucher };
|
|
3809
|
+
export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Bundle, ConflictError, type CreateVoucherRequest, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Order, OrderStatus, type Page, type PricingVariation, type Product, ProductStatus, type ProvisionLicensesRequest, type Quantifiable, type Trial, TrialStatus, type Voucher };
|
package/dist/index.js
CHANGED
|
@@ -95,6 +95,14 @@ var importLicenseRequestSchema = z2.object({
|
|
|
95
95
|
lastValidation: z2.date().optional()
|
|
96
96
|
}).array().optional()
|
|
97
97
|
});
|
|
98
|
+
var provisionLicensesRequestSchema = z2.object({
|
|
99
|
+
ownerId: z2.string(),
|
|
100
|
+
requests: z2.object({
|
|
101
|
+
productId: z2.string(),
|
|
102
|
+
quantity: z2.number().optional(),
|
|
103
|
+
limitPerCustomer: z2.number().optional()
|
|
104
|
+
}).array()
|
|
105
|
+
});
|
|
98
106
|
|
|
99
107
|
// src/products/schemas.ts
|
|
100
108
|
import { z as z3 } from "zod";
|
|
@@ -397,6 +405,11 @@ var LicenseEndpoints = class {
|
|
|
397
405
|
const response = await this.api.fetch(`/api/licenses/import`, "POST", request);
|
|
398
406
|
return licenseSchema.parse(response.data);
|
|
399
407
|
}
|
|
408
|
+
async provision(input) {
|
|
409
|
+
const request = provisionLicensesRequestSchema.parse(input);
|
|
410
|
+
const response = await this.api.fetch(`/api/licenses/provision`, "POST", request);
|
|
411
|
+
return licenseSchema.array().parse(response.data);
|
|
412
|
+
}
|
|
400
413
|
async revoke(licenseId) {
|
|
401
414
|
const response = await this.api.fetch(`/api/licenses/${licenseId}/revoke`, "POST");
|
|
402
415
|
return licenseSchema.parse(response.data);
|
|
@@ -447,9 +460,18 @@ var bundleLineItemFulfillmentSchema = z8.object({
|
|
|
447
460
|
licenseIds: z8.string().array()
|
|
448
461
|
}))
|
|
449
462
|
});
|
|
463
|
+
var subscriptionLineItemFulfillmentSchema = z8.object({
|
|
464
|
+
type: z8.literal("Subscription"),
|
|
465
|
+
subscriptionId: z8.string(),
|
|
466
|
+
inner: z8.discriminatedUnion("type", [
|
|
467
|
+
licenseLineItemFulfillmentSchema,
|
|
468
|
+
bundleLineItemFulfillmentSchema
|
|
469
|
+
])
|
|
470
|
+
});
|
|
450
471
|
var lineItemFulfillmentSchema = z8.discriminatedUnion("type", [
|
|
451
472
|
licenseLineItemFulfillmentSchema,
|
|
452
|
-
bundleLineItemFulfillmentSchema
|
|
473
|
+
bundleLineItemFulfillmentSchema,
|
|
474
|
+
subscriptionLineItemFulfillmentSchema
|
|
453
475
|
]);
|
|
454
476
|
var lineItemTotalSchema = z8.object({
|
|
455
477
|
original: moneySchema,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/api",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
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",
|