@moonbase.sh/api 0.2.143 → 0.2.144

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 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);
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;
@@ -3566,4 +3598,4 @@ declare class MoonbaseClient {
3566
3598
  orders: OrderEndpoints;
3567
3599
  }
3568
3600
 
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 };
3601
+ 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;
@@ -3566,4 +3598,4 @@ declare class MoonbaseClient {
3566
3598
  orders: OrderEndpoints;
3567
3599
  }
3568
3600
 
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 };
3601
+ 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);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/api",
3
3
  "type": "module",
4
- "version": "0.2.143",
4
+ "version": "0.2.144",
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",