@authenty/authapi-types 1.0.34 → 1.0.42

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.d.ts CHANGED
@@ -354,12 +354,23 @@ export declare namespace AuthApi {
354
354
  financial: Privilege;
355
355
  };
356
356
  type CronJob = {
357
- startAt: Date | null;
358
- latestRunErrorCount: number;
359
- latestCompletedAt: Date | null;
357
+ id: number;
358
+ name: string;
359
+ active: boolean;
360
+ schedule: string;
361
+ customTimeout_s?: number;
362
+ internalRun: boolean;
363
+ History: CronJobExecution[];
360
364
  };
361
- type CronjobsStatuses = {
362
- purchasesStatusUpdate: CronJob;
365
+ type CronStatus = 'SCHEDULED' | 'RUNNING' | 'BLOCKED' | 'ABORTED' | 'STALED' | 'ERRORED' | 'FINISHED';
366
+ type CronJobExecution = {
367
+ id: number;
368
+ cronId: number;
369
+ CronJob?: CronJob;
370
+ status: CronStatus;
371
+ metaData?: object;
372
+ startedAt: string;
373
+ finishedAt?: string;
363
374
  };
364
375
  type LogFilters = {
365
376
  page: number;
@@ -560,6 +571,14 @@ export declare namespace AuthApi {
560
571
  type DELETE = {
561
572
  msg: string;
562
573
  };
574
+ namespace subscriptions {
575
+ type GET = (objects.Purchase & {
576
+ PaymentMethod: objects.PaymentMethod;
577
+ Wallet: objects.Wallet & {
578
+ User: objects.LocalUser;
579
+ };
580
+ })[];
581
+ }
563
582
  }
564
583
  }
565
584
  namespace products {
@@ -635,13 +654,14 @@ export declare namespace AuthApi {
635
654
  }
636
655
  }
637
656
  namespace cronJobs {
638
- namespace status {
639
- type GET = auxiliarTypes.CronjobsStatuses;
640
- }
641
- namespace run {
642
- type POST = {
643
- msg: string;
644
- };
657
+ type GET = auxiliarTypes.CronJob[];
658
+ namespace $conId {
659
+ type GET = auxiliarTypes.CronJob;
660
+ namespace run {
661
+ type POST = {
662
+ msg: string;
663
+ };
664
+ }
645
665
  }
646
666
  }
647
667
  namespace aux {
@@ -895,12 +915,17 @@ export declare namespace AuthApi {
895
915
  list: () => Promise<responses.ApiResponse<responses.products.GET>>;
896
916
  get: (productId: number) => Promise<responses.ApiResponse<objects.Product>>;
897
917
  update: (productId: number, productData: any) => Promise<responses.ApiResponse<objects.Product>>;
918
+ getSubscriptions: (productId: number, includeExpired?: boolean) => Promise<responses.ApiResponse<responses.product.$productId.subscriptions.GET>>;
898
919
  };
899
920
  paymentMethods: {
900
921
  create: (id: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<responses.bundle.$bundleId.paymentMethod.POST>>;
901
922
  update: (id: number, paymentMethodId: number, paymentMethodData: objects.PaymentMethod) => Promise<responses.ApiResponse<objects.PaymentMethod>>;
902
923
  delete: (id: number, paymentMethodId: number) => Promise<responses.ApiResponse<responses.bundle.$bundleId.paymentMethod.$paymentMethodId.DELETE>>;
903
924
  };
925
+ bundles: {
926
+ list: () => Promise<responses.ApiResponse<responses.bundles.GET>>;
927
+ get: (bundleId: number, includeDeleted?: boolean, includeInactive?: boolean) => Promise<responses.ApiResponse<objects.Bundle>>;
928
+ };
904
929
  aux: {
905
930
  countries: () => Promise<responses.ApiResponse<responses.aux.countries.GET>>;
906
931
  states: (countryId: number) => Promise<responses.ApiResponse<responses.aux.states.GET>>;
@@ -916,8 +941,8 @@ export declare namespace AuthApi {
916
941
  status: () => Promise<responses.ApiResponse<responses.logs.status.GET>>;
917
942
  };
918
943
  cronJobs: {
919
- status: () => Promise<responses.ApiResponse<auxiliarTypes.CronjobsStatuses>>;
920
- run: (name: string) => Promise<responses.ApiResponse<responses.cronJobs.run.POST>>;
944
+ status: () => Promise<responses.ApiResponse<responses.cronJobs.GET>>;
945
+ run: (id: number) => Promise<responses.ApiResponse<responses.cronJobs.$conId.run.POST>>;
921
946
  };
922
947
  reports: {
923
948
  users: () => Promise<responses.ApiResponse<responses.report.users.GET>>;
package/dist/index.js CHANGED
@@ -203,7 +203,10 @@ var AuthApi;
203
203
  },
204
204
  update: async (productId, productData) => {
205
205
  return await this.request('PUT', `product/${productId}`, productData);
206
- }
206
+ },
207
+ getSubscriptions: async (productId, includeExpired = false) => {
208
+ return await this.request('GET', `product/${productId}/subscriptions`, { includeExpired });
209
+ },
207
210
  };
208
211
  this.paymentMethods = {
209
212
  create: async (id, paymentMethodData) => {
@@ -216,6 +219,14 @@ var AuthApi;
216
219
  return await this.request('DELETE', `bundle/${id}/paymentMethod/${paymentMethodId}`, {});
217
220
  }
218
221
  };
222
+ this.bundles = {
223
+ list: async () => {
224
+ return await this.request('GET', 'bundles', {});
225
+ },
226
+ get: async (bundleId, includeDeleted = false, includeInactive = false) => {
227
+ return await this.request('GET', `bundle/${bundleId}`, { includeDeleted, includeInactive });
228
+ },
229
+ };
219
230
  this.aux = {
220
231
  countries: async () => {
221
232
  return await this.request('GET', 'aux/countries', {});
@@ -248,10 +259,10 @@ var AuthApi;
248
259
  },
249
260
  cronJobs: {
250
261
  status: async () => {
251
- return await this.request('GET', 'admin/cronjobs/status', {});
262
+ return await this.request('GET', 'admin/cronjobs', {});
252
263
  },
253
- run: async (name) => {
254
- return await this.request('POST', `admin/cronjobs/run/${name}`, {});
264
+ run: async (id) => {
265
+ return await this.request('POST', `admin/cronjobs/${id}/run`, {});
255
266
  }
256
267
  },
257
268
  reports: {
@@ -29,5 +29,5 @@ export declare const Privilege: typeof AuthApi.auxiliarTypes.Privilege;
29
29
  export type Privilege = AuthApi.auxiliarTypes.Privilege;
30
30
  export type PrivilegeTable = AuthApi.auxiliarTypes.PrivilegeTable;
31
31
  export type CronJob = AuthApi.auxiliarTypes.CronJob;
32
- export type CronjobsStatuses = AuthApi.auxiliarTypes.CronjobsStatuses;
32
+ export type CronStatus = AuthApi.auxiliarTypes.CronStatus;
33
33
  export type LogFilters = AuthApi.auxiliarTypes.LogFilters;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authenty/authapi-types",
3
- "version": "1.0.34",
3
+ "version": "1.0.42",
4
4
  "description": "Shared types for Authenty API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -398,14 +398,27 @@ export namespace AuthApi {
398
398
  financial: Privilege;
399
399
  }
400
400
 
401
- export type CronJob = { //Também definido em ~/server/src/cronjobs.ts
402
- startAt: Date | null //null se não está rodando
403
- latestRunErrorCount: number //zero se não teve erro
404
- latestCompletedAt: Date | null
401
+ export type CronJob = {
402
+ id: number,
403
+ name: string,
404
+ active: boolean,
405
+ schedule: string,
406
+ customTimeout_s?: number,
407
+ internalRun: boolean,
408
+ // frequence: number
409
+ History: CronJobExecution[]
405
410
  }
406
411
 
407
- export type CronjobsStatuses = {
408
- purchasesStatusUpdate: CronJob
412
+ export type CronStatus = 'SCHEDULED'|'RUNNING'|'BLOCKED'|'ABORTED'|'STALED'|'ERRORED'|'FINISHED';
413
+
414
+ export type CronJobExecution = {
415
+ id: number,
416
+ cronId: number,
417
+ CronJob?: CronJob,
418
+ status: CronStatus,
419
+ metaData?: object,
420
+ startedAt: string,
421
+ finishedAt?: string
409
422
  }
410
423
 
411
424
  export type LogFilters = {
@@ -587,6 +600,15 @@ export namespace AuthApi {
587
600
  export type GET = objects.Product;
588
601
  export type PUT = objects.Product;
589
602
  export type DELETE = { msg: string };
603
+
604
+ export namespace subscriptions {
605
+ export type GET = (objects.Purchase & {
606
+ PaymentMethod: objects.PaymentMethod;
607
+ Wallet: objects.Wallet & {
608
+ User: objects.LocalUser;
609
+ };
610
+ })[];
611
+ }
590
612
  }
591
613
  }
592
614
  export namespace products {
@@ -669,11 +691,14 @@ export namespace AuthApi {
669
691
  }
670
692
 
671
693
  export namespace cronJobs {
672
- export namespace status {
673
- export type GET = auxiliarTypes.CronjobsStatuses;
674
- }
675
- export namespace run {
676
- export type POST = { msg: string };
694
+
695
+ export type GET = auxiliarTypes.CronJob[];
696
+ export namespace $conId {
697
+
698
+ export type GET = auxiliarTypes.CronJob;
699
+ export namespace run {
700
+ export type POST = { msg: string };
701
+ }
677
702
  }
678
703
  }
679
704
 
@@ -1163,7 +1188,10 @@ export namespace AuthApi {
1163
1188
  },
1164
1189
  update: async (productId: number, productData: any) => {
1165
1190
  return await this.request<responses.product.$productId.PUT>('PUT', `product/${productId}`, productData);
1166
- }
1191
+ },
1192
+ getSubscriptions: async (productId: number, includeExpired:boolean=false) => {
1193
+ return await this.request<responses.product.$productId.subscriptions.GET>('GET', `product/${productId}/subscriptions`, {includeExpired});
1194
+ },
1167
1195
  }
1168
1196
 
1169
1197
  public paymentMethods = {
@@ -1179,6 +1207,16 @@ export namespace AuthApi {
1179
1207
  }
1180
1208
  }
1181
1209
 
1210
+ public bundles = {
1211
+
1212
+ list: async () => {
1213
+ return await this.request<responses.bundles.GET>('GET', 'bundles', {});
1214
+ },
1215
+ get: async (bundleId: number, includeDeleted: boolean = false, includeInactive: boolean = false) => {
1216
+ return await this.request<responses.bundle.$bundleId.GET>('GET', `bundle/${bundleId}`, { includeDeleted, includeInactive });
1217
+ },
1218
+ }
1219
+
1182
1220
  public aux = {
1183
1221
  countries: async () => {
1184
1222
  return await this.request<responses.aux.countries.GET>('GET', 'aux/countries', {});
@@ -1217,10 +1255,10 @@ export namespace AuthApi {
1217
1255
 
1218
1256
  cronJobs: {
1219
1257
  status: async () => {
1220
- return await this.request<responses.cronJobs.status.GET>('GET', 'admin/cronjobs/status', {});
1258
+ return await this.request<responses.cronJobs.GET>('GET', 'admin/cronjobs', {});
1221
1259
  },
1222
- run: async (name: string) => {
1223
- return await this.request<responses.cronJobs.run.POST>('POST', `admin/cronjobs/run/${name}`, {});
1260
+ run: async (id: number) => {
1261
+ return await this.request<responses.cronJobs.$conId.run.POST>('POST', `admin/cronjobs/${id}/run`, {});
1224
1262
  }
1225
1263
  },
1226
1264
 
@@ -35,7 +35,7 @@ export const Privilege = AuthApi.auxiliarTypes.Privilege;
35
35
  export type Privilege = AuthApi.auxiliarTypes.Privilege;
36
36
  export type PrivilegeTable = AuthApi.auxiliarTypes.PrivilegeTable;
37
37
  export type CronJob = AuthApi.auxiliarTypes.CronJob;
38
- export type CronjobsStatuses = AuthApi.auxiliarTypes.CronjobsStatuses;
38
+ export type CronStatus = AuthApi.auxiliarTypes.CronStatus;
39
39
  export type LogFilters = AuthApi.auxiliarTypes.LogFilters;
40
40
 
41
41