@moonbase.sh/api 0.4.7 → 0.4.9

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
@@ -42,6 +42,7 @@ __export(src_exports, {
42
42
  NotAuthorizedError: () => NotAuthorizedError,
43
43
  NotFoundError: () => NotFoundError,
44
44
  OrderStatus: () => OrderStatus,
45
+ Platform: () => Platform,
45
46
  ProductStatus: () => ProductStatus,
46
47
  TrialStatus: () => TrialStatus,
47
48
  objectToQuery: () => objectToQuery
@@ -160,6 +161,15 @@ var provisionLicensesRequestSchema = import_zod2.z.object({
160
161
  var import_zod3 = require("zod");
161
162
 
162
163
  // src/products/models.ts
164
+ var Platform = /* @__PURE__ */ ((Platform2) => {
165
+ Platform2["Universal"] = "Universal";
166
+ Platform2["Windows"] = "Windows";
167
+ Platform2["Linux"] = "Linux";
168
+ Platform2["Mac"] = "Mac";
169
+ Platform2["iOS"] = "iOS";
170
+ Platform2["Android"] = "Android";
171
+ return Platform2;
172
+ })(Platform || {});
163
173
  var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
164
174
  ProductStatus2["Active"] = "Active";
165
175
  ProductStatus2["Inactive"] = "Inactive";
@@ -178,6 +188,22 @@ var productSchema = import_zod3.z.object({
178
188
  purchasable: import_zod3.z.boolean(),
179
189
  currentReleaseVersion: import_zod3.z.string().nullable()
180
190
  });
191
+ var productReleaseSchema = import_zod3.z.object({
192
+ version: import_zod3.z.string(),
193
+ description: import_zod3.z.string().nullable(),
194
+ publishedAt: import_zod3.z.coerce.date().nullable(),
195
+ downloadUrl: import_zod3.z.string(),
196
+ hostedDownloadUrl: import_zod3.z.string(),
197
+ downloads: import_zod3.z.object({
198
+ name: import_zod3.z.string(),
199
+ key: import_zod3.z.string(),
200
+ platform: import_zod3.z.nativeEnum(Platform),
201
+ size: import_zod3.z.number(),
202
+ downloadUrl: import_zod3.z.string(),
203
+ hostedDownloadUrl: import_zod3.z.string(),
204
+ directUrl: import_zod3.z.string()
205
+ }).array()
206
+ });
181
207
 
182
208
  // src/trials/schemas.ts
183
209
  var import_zod4 = require("zod");
@@ -658,6 +684,10 @@ var ProductEndpoints = class {
658
684
  const response = await this.api.fetch(`/api/products/${id}`);
659
685
  return productSchema.parse(response.data);
660
686
  }
687
+ async queryReleases(id, opts) {
688
+ const response = await this.api.fetch(`/api/products/${id}/releases?${objectToQuery(opts)}`);
689
+ return paged(productReleaseSchema, this.api).parse(response.data);
690
+ }
661
691
  };
662
692
 
663
693
  // src/trials/endpoints.ts
@@ -762,6 +792,7 @@ var MoonbaseClient = class {
762
792
  NotAuthorizedError,
763
793
  NotFoundError,
764
794
  OrderStatus,
795
+ Platform,
765
796
  ProductStatus,
766
797
  TrialStatus,
767
798
  objectToQuery
package/dist/index.d.cts CHANGED
@@ -3343,12 +3343,83 @@ declare const productSchema: z.ZodObject<{
3343
3343
  purchasable: boolean;
3344
3344
  currentReleaseVersion: string | null;
3345
3345
  }>;
3346
+ declare const productReleaseSchema: z.ZodObject<{
3347
+ version: z.ZodString;
3348
+ description: z.ZodNullable<z.ZodString>;
3349
+ publishedAt: z.ZodNullable<z.ZodDate>;
3350
+ downloadUrl: z.ZodString;
3351
+ hostedDownloadUrl: z.ZodString;
3352
+ downloads: z.ZodArray<z.ZodObject<{
3353
+ name: z.ZodString;
3354
+ key: z.ZodString;
3355
+ platform: z.ZodNativeEnum<typeof Platform>;
3356
+ size: z.ZodNumber;
3357
+ downloadUrl: z.ZodString;
3358
+ hostedDownloadUrl: z.ZodString;
3359
+ directUrl: z.ZodString;
3360
+ }, "strip", z.ZodTypeAny, {
3361
+ key: string;
3362
+ name: string;
3363
+ downloadUrl: string;
3364
+ hostedDownloadUrl: string;
3365
+ platform: Platform;
3366
+ size: number;
3367
+ directUrl: string;
3368
+ }, {
3369
+ key: string;
3370
+ name: string;
3371
+ downloadUrl: string;
3372
+ hostedDownloadUrl: string;
3373
+ platform: Platform;
3374
+ size: number;
3375
+ directUrl: string;
3376
+ }>, "many">;
3377
+ }, "strip", z.ZodTypeAny, {
3378
+ description: string | null;
3379
+ version: string;
3380
+ publishedAt: Date | null;
3381
+ downloadUrl: string;
3382
+ hostedDownloadUrl: string;
3383
+ downloads: {
3384
+ key: string;
3385
+ name: string;
3386
+ downloadUrl: string;
3387
+ hostedDownloadUrl: string;
3388
+ platform: Platform;
3389
+ size: number;
3390
+ directUrl: string;
3391
+ }[];
3392
+ }, {
3393
+ description: string | null;
3394
+ version: string;
3395
+ publishedAt: Date | null;
3396
+ downloadUrl: string;
3397
+ hostedDownloadUrl: string;
3398
+ downloads: {
3399
+ key: string;
3400
+ name: string;
3401
+ downloadUrl: string;
3402
+ hostedDownloadUrl: string;
3403
+ platform: Platform;
3404
+ size: number;
3405
+ directUrl: string;
3406
+ }[];
3407
+ }>;
3346
3408
 
3409
+ declare enum Platform {
3410
+ Universal = "Universal",
3411
+ Windows = "Windows",
3412
+ Linux = "Linux",
3413
+ Mac = "Mac",
3414
+ iOS = "iOS",
3415
+ Android = "Android"
3416
+ }
3347
3417
  declare enum ProductStatus {
3348
3418
  Active = "Active",
3349
3419
  Inactive = "Inactive"
3350
3420
  }
3351
3421
  type Product = z.infer<typeof productSchema>;
3422
+ type ProductRelease = z.infer<typeof productReleaseSchema>;
3352
3423
 
3353
3424
  declare class ProductEndpoints {
3354
3425
  private api;
@@ -3359,6 +3430,10 @@ declare class ProductEndpoints {
3359
3430
  pageSize?: number;
3360
3431
  }): Promise<Page<Product>>;
3361
3432
  get(id: string): Promise<Product>;
3433
+ queryReleases(id: string, opts?: {
3434
+ paginationToken?: string;
3435
+ pageSize?: number;
3436
+ }): Promise<Page<ProductRelease>>;
3362
3437
  }
3363
3438
 
3364
3439
  declare const trialSchema: z.ZodObject<{
@@ -3882,4 +3957,4 @@ declare class MoonbaseClient {
3882
3957
  orders: OrderEndpoints;
3883
3958
  }
3884
3959
 
3885
- export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Bundle, ConflictError, type CreateVoucherRequest, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseApi, 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, objectToQuery };
3960
+ export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Bundle, ConflictError, type CreateVoucherRequest, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Order, OrderStatus, type Page, Platform, type PricingVariation, type Product, type ProductRelease, ProductStatus, type ProvisionLicensesRequest, type Quantifiable, type Trial, TrialStatus, type Voucher, objectToQuery };
package/dist/index.d.ts CHANGED
@@ -3343,12 +3343,83 @@ declare const productSchema: z.ZodObject<{
3343
3343
  purchasable: boolean;
3344
3344
  currentReleaseVersion: string | null;
3345
3345
  }>;
3346
+ declare const productReleaseSchema: z.ZodObject<{
3347
+ version: z.ZodString;
3348
+ description: z.ZodNullable<z.ZodString>;
3349
+ publishedAt: z.ZodNullable<z.ZodDate>;
3350
+ downloadUrl: z.ZodString;
3351
+ hostedDownloadUrl: z.ZodString;
3352
+ downloads: z.ZodArray<z.ZodObject<{
3353
+ name: z.ZodString;
3354
+ key: z.ZodString;
3355
+ platform: z.ZodNativeEnum<typeof Platform>;
3356
+ size: z.ZodNumber;
3357
+ downloadUrl: z.ZodString;
3358
+ hostedDownloadUrl: z.ZodString;
3359
+ directUrl: z.ZodString;
3360
+ }, "strip", z.ZodTypeAny, {
3361
+ key: string;
3362
+ name: string;
3363
+ downloadUrl: string;
3364
+ hostedDownloadUrl: string;
3365
+ platform: Platform;
3366
+ size: number;
3367
+ directUrl: string;
3368
+ }, {
3369
+ key: string;
3370
+ name: string;
3371
+ downloadUrl: string;
3372
+ hostedDownloadUrl: string;
3373
+ platform: Platform;
3374
+ size: number;
3375
+ directUrl: string;
3376
+ }>, "many">;
3377
+ }, "strip", z.ZodTypeAny, {
3378
+ description: string | null;
3379
+ version: string;
3380
+ publishedAt: Date | null;
3381
+ downloadUrl: string;
3382
+ hostedDownloadUrl: string;
3383
+ downloads: {
3384
+ key: string;
3385
+ name: string;
3386
+ downloadUrl: string;
3387
+ hostedDownloadUrl: string;
3388
+ platform: Platform;
3389
+ size: number;
3390
+ directUrl: string;
3391
+ }[];
3392
+ }, {
3393
+ description: string | null;
3394
+ version: string;
3395
+ publishedAt: Date | null;
3396
+ downloadUrl: string;
3397
+ hostedDownloadUrl: string;
3398
+ downloads: {
3399
+ key: string;
3400
+ name: string;
3401
+ downloadUrl: string;
3402
+ hostedDownloadUrl: string;
3403
+ platform: Platform;
3404
+ size: number;
3405
+ directUrl: string;
3406
+ }[];
3407
+ }>;
3346
3408
 
3409
+ declare enum Platform {
3410
+ Universal = "Universal",
3411
+ Windows = "Windows",
3412
+ Linux = "Linux",
3413
+ Mac = "Mac",
3414
+ iOS = "iOS",
3415
+ Android = "Android"
3416
+ }
3347
3417
  declare enum ProductStatus {
3348
3418
  Active = "Active",
3349
3419
  Inactive = "Inactive"
3350
3420
  }
3351
3421
  type Product = z.infer<typeof productSchema>;
3422
+ type ProductRelease = z.infer<typeof productReleaseSchema>;
3352
3423
 
3353
3424
  declare class ProductEndpoints {
3354
3425
  private api;
@@ -3359,6 +3430,10 @@ declare class ProductEndpoints {
3359
3430
  pageSize?: number;
3360
3431
  }): Promise<Page<Product>>;
3361
3432
  get(id: string): Promise<Product>;
3433
+ queryReleases(id: string, opts?: {
3434
+ paginationToken?: string;
3435
+ pageSize?: number;
3436
+ }): Promise<Page<ProductRelease>>;
3362
3437
  }
3363
3438
 
3364
3439
  declare const trialSchema: z.ZodObject<{
@@ -3882,4 +3957,4 @@ declare class MoonbaseClient {
3882
3957
  orders: OrderEndpoints;
3883
3958
  }
3884
3959
 
3885
- export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Bundle, ConflictError, type CreateVoucherRequest, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseApi, 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, objectToQuery };
3960
+ export { ActivationMethod, type ActivationRequest, ActivationRequestStatus, ActivationStatus, type Bundle, ConflictError, type CreateVoucherRequest, type Customer, type ImportCustomerRequest, type ImportLicenseRequest, type ImportTrialRequest, type License, type LicenseActivation, LicenseStatus, MoonbaseApi, MoonbaseClient, type MoonbaseConfiguration, MoonbaseError, NotAuthenticatedError, NotAuthorizedError, NotFoundError, type Order, OrderStatus, type Page, Platform, type PricingVariation, type Product, type ProductRelease, ProductStatus, type ProvisionLicensesRequest, type Quantifiable, type Trial, TrialStatus, type Voucher, objectToQuery };
package/dist/index.js CHANGED
@@ -110,6 +110,15 @@ var provisionLicensesRequestSchema = z2.object({
110
110
  import { z as z3 } from "zod";
111
111
 
112
112
  // src/products/models.ts
113
+ var Platform = /* @__PURE__ */ ((Platform2) => {
114
+ Platform2["Universal"] = "Universal";
115
+ Platform2["Windows"] = "Windows";
116
+ Platform2["Linux"] = "Linux";
117
+ Platform2["Mac"] = "Mac";
118
+ Platform2["iOS"] = "iOS";
119
+ Platform2["Android"] = "Android";
120
+ return Platform2;
121
+ })(Platform || {});
113
122
  var ProductStatus = /* @__PURE__ */ ((ProductStatus2) => {
114
123
  ProductStatus2["Active"] = "Active";
115
124
  ProductStatus2["Inactive"] = "Inactive";
@@ -128,6 +137,22 @@ var productSchema = z3.object({
128
137
  purchasable: z3.boolean(),
129
138
  currentReleaseVersion: z3.string().nullable()
130
139
  });
140
+ var productReleaseSchema = z3.object({
141
+ version: z3.string(),
142
+ description: z3.string().nullable(),
143
+ publishedAt: z3.coerce.date().nullable(),
144
+ downloadUrl: z3.string(),
145
+ hostedDownloadUrl: z3.string(),
146
+ downloads: z3.object({
147
+ name: z3.string(),
148
+ key: z3.string(),
149
+ platform: z3.nativeEnum(Platform),
150
+ size: z3.number(),
151
+ downloadUrl: z3.string(),
152
+ hostedDownloadUrl: z3.string(),
153
+ directUrl: z3.string()
154
+ }).array()
155
+ });
131
156
 
132
157
  // src/trials/schemas.ts
133
158
  import { z as z4 } from "zod";
@@ -608,6 +633,10 @@ var ProductEndpoints = class {
608
633
  const response = await this.api.fetch(`/api/products/${id}`);
609
634
  return productSchema.parse(response.data);
610
635
  }
636
+ async queryReleases(id, opts) {
637
+ const response = await this.api.fetch(`/api/products/${id}/releases?${objectToQuery(opts)}`);
638
+ return paged(productReleaseSchema, this.api).parse(response.data);
639
+ }
611
640
  };
612
641
 
613
642
  // src/trials/endpoints.ts
@@ -711,6 +740,7 @@ export {
711
740
  NotAuthorizedError,
712
741
  NotFoundError,
713
742
  OrderStatus,
743
+ Platform,
714
744
  ProductStatus,
715
745
  TrialStatus,
716
746
  objectToQuery
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/api",
3
3
  "type": "module",
4
- "version": "0.4.7",
4
+ "version": "0.4.9",
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",