@metarisc/metarisc-js 0.0.1-alpha.32 → 0.0.1-alpha.33

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.
@@ -2,8 +2,19 @@ import { Core, MetariscConfig } from "../core";
2
2
  import { Client } from "../client";
3
3
  import { Collection } from "../collection";
4
4
  import { Commission } from '../model/Commission';
5
+ import { PassageCommission } from '../model/PassageCommission';
5
6
  export declare class CommissionsAPI extends Core {
6
7
  constructor(config: MetariscConfig, client?: Client);
8
+ /**
9
+ * Récupération des détails de la commission.
10
+ * @param commissionId Identifiant unique de la commission
11
+ */
12
+ getCommission(commissionId: string): Collection<Commission>;
13
+ /**
14
+ * Récupération de la liste des dates de passage de la commission.
15
+ * @param commissionId Identifiant unique de la commission
16
+ */
17
+ paginateCommissionDates(commissionId: string): Collection<PassageCommission>;
7
18
  /**
8
19
  * Liste des commissions.
9
20
  */
@@ -7,6 +7,34 @@ class CommissionsAPI extends core_1.Core {
7
7
  constructor(config, client) {
8
8
  super(config, client);
9
9
  }
10
+ /**
11
+ * Récupération des détails de la commission.
12
+ * @param commissionId Identifiant unique de la commission
13
+ */
14
+ getCommission(commissionId) {
15
+ const pathVariable = { 'commission_id': commissionId };
16
+ return this.collect({
17
+ method: 'GET',
18
+ endpoint: utils_1.Utils.constructPath(pathVariable, '/commissions/{commission_id}'),
19
+ headers: {},
20
+ params: {},
21
+ body: {}
22
+ });
23
+ }
24
+ /**
25
+ * Récupération de la liste des dates de passage de la commission.
26
+ * @param commissionId Identifiant unique de la commission
27
+ */
28
+ paginateCommissionDates(commissionId) {
29
+ const pathVariable = { 'commission_id': commissionId };
30
+ return this.collect({
31
+ method: 'GET',
32
+ endpoint: utils_1.Utils.constructPath(pathVariable, '/commissions/{commission_id}/dates'),
33
+ headers: {},
34
+ params: {},
35
+ body: {}
36
+ });
37
+ }
10
38
  /**
11
39
  * Liste des commissions.
12
40
  */
@@ -1,9 +1,27 @@
1
1
  import { Core, MetariscConfig } from "../core";
2
+ import type { AxiosResponse } from "axios";
2
3
  import { Client } from "../client";
3
4
  import { Collection } from "../collection";
4
5
  import { TourneeDeci } from '../model/TourneeDeci';
6
+ import { TourneeDeciPei } from '../model/TourneeDeciPei';
5
7
  export declare class TournesDECIAPI extends Core {
6
8
  constructor(config: MetariscConfig, client?: Client);
9
+ /**
10
+ * Récupération des détails de la tournée DECI.
11
+ * @param tourneeDeciId Identifiant de la tournée DECI
12
+ */
13
+ getTourneeDeci(tourneeDeciId: string): Promise<AxiosResponse<TourneeDeci>>;
14
+ /**
15
+ * Récupération des détails liés au contrôle d'un PEI d'une tournée.
16
+ * @param tourneeDeciId Identifiant de la tournée DECI
17
+ * @param peiId Identifiant du PEI lié au contrôle
18
+ */
19
+ getTourneeDeciPei(tourneeDeciId: string, peiId: string): Promise<AxiosResponse<TourneeDeciPei>>;
20
+ /**
21
+ * Récupération de la liste des contrôles PEI liés à la tournée DECI.
22
+ * @param tourneeDeciId Identifiant de la tournée DECI
23
+ */
24
+ paginateTourneeDeciPei(tourneeDeciId: string): Collection<TourneeDeciPei>;
7
25
  /**
8
26
  * Liste des tournées DECI.
9
27
  */
@@ -7,6 +7,49 @@ class TournesDECIAPI extends core_1.Core {
7
7
  constructor(config, client) {
8
8
  super(config, client);
9
9
  }
10
+ /**
11
+ * Récupération des détails de la tournée DECI.
12
+ * @param tourneeDeciId Identifiant de la tournée DECI
13
+ */
14
+ async getTourneeDeci(tourneeDeciId) {
15
+ const pathVariable = { 'tournee_deci_id': tourneeDeciId };
16
+ return this.request({
17
+ method: 'GET',
18
+ endpoint: utils_1.Utils.constructPath(pathVariable, '/tournees_deci/{tournee_deci_id}'),
19
+ headers: {},
20
+ params: {},
21
+ body: {}
22
+ });
23
+ }
24
+ /**
25
+ * Récupération des détails liés au contrôle d'un PEI d'une tournée.
26
+ * @param tourneeDeciId Identifiant de la tournée DECI
27
+ * @param peiId Identifiant du PEI lié au contrôle
28
+ */
29
+ async getTourneeDeciPei(tourneeDeciId, peiId) {
30
+ const pathVariable = { 'tournee_deci_id': tourneeDeciId, 'pei_id': peiId };
31
+ return this.request({
32
+ method: 'GET',
33
+ endpoint: utils_1.Utils.constructPath(pathVariable, '/tournees_deci/{tournee_deci_id}/pei/{pei_id}'),
34
+ headers: {},
35
+ params: {},
36
+ body: {}
37
+ });
38
+ }
39
+ /**
40
+ * Récupération de la liste des contrôles PEI liés à la tournée DECI.
41
+ * @param tourneeDeciId Identifiant de la tournée DECI
42
+ */
43
+ paginateTourneeDeciPei(tourneeDeciId) {
44
+ const pathVariable = { 'tournee_deci_id': tourneeDeciId };
45
+ return this.collect({
46
+ method: 'GET',
47
+ endpoint: utils_1.Utils.constructPath(pathVariable, '/tournees_deci/{tournee_deci_id}/pei'),
48
+ headers: {},
49
+ params: {},
50
+ body: {}
51
+ });
52
+ }
10
53
  /**
11
54
  * Liste des tournées DECI.
12
55
  */
package/lib/client.js CHANGED
@@ -56,7 +56,7 @@ class Client {
56
56
  await this.refreshToken();
57
57
  }
58
58
  catch (e) {
59
- throw new SessionExpiredError_1.SessionExpiredError('La session utilisateur a expirée');
59
+ throw new SessionExpiredError_1.SessionExpiredError('La session utilisateur a expirée. ' + e.message);
60
60
  }
61
61
  }
62
62
  return config;
@@ -0,0 +1,11 @@
1
+ export type PassageCommission = {
2
+ 'id'?: string;
3
+ 'date_debut'?: Date;
4
+ 'date_fin'?: Date;
5
+ 'type'?: TypeEnum;
6
+ };
7
+ export declare enum TypeEnum {
8
+ Salle = "salle",
9
+ VisiteDeSecurite = "visite_de_securite",
10
+ GroupeDeVisite = "groupe_de_visite"
11
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeEnum = void 0;
4
+ var TypeEnum;
5
+ (function (TypeEnum) {
6
+ TypeEnum["Salle"] = "salle";
7
+ TypeEnum["VisiteDeSecurite"] = "visite_de_securite";
8
+ TypeEnum["GroupeDeVisite"] = "groupe_de_visite";
9
+ })(TypeEnum = exports.TypeEnum || (exports.TypeEnum = {}));
@@ -0,0 +1,16 @@
1
+ import { AnomaliePEI } from '../../src/model/AnomaliePEI';
2
+ import { PEI } from '../../src/model/PEI';
3
+ export type TourneeDeciPei = {
4
+ 'id'?: string;
5
+ 'date_du_controle'?: Date;
6
+ 'liste_anomalies'?: Array<AnomaliePEI>;
7
+ 'essais_engin_utilise'?: EssaisEnginUtiliseEnum;
8
+ 'pei'?: PEI;
9
+ 'est_controle'?: boolean;
10
+ };
11
+ export declare enum EssaisEnginUtiliseEnum {
12
+ Aucun = "aucun",
13
+ Fpt = "fpt",
14
+ Mpr = "mpr",
15
+ Ccf = "ccf"
16
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EssaisEnginUtiliseEnum = void 0;
4
+ var EssaisEnginUtiliseEnum;
5
+ (function (EssaisEnginUtiliseEnum) {
6
+ EssaisEnginUtiliseEnum["Aucun"] = "aucun";
7
+ EssaisEnginUtiliseEnum["Fpt"] = "fpt";
8
+ EssaisEnginUtiliseEnum["Mpr"] = "mpr";
9
+ EssaisEnginUtiliseEnum["Ccf"] = "ccf";
10
+ })(EssaisEnginUtiliseEnum = exports.EssaisEnginUtiliseEnum || (exports.EssaisEnginUtiliseEnum = {}));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@metarisc/metarisc-js",
3
3
  "main": "lib/index.js",
4
4
  "types": "lib/index.d.ts",
5
- "version": "0.0.1-alpha.32",
5
+ "version": "0.0.1-alpha.33",
6
6
  "scripts": {
7
7
  "lint": "eslint . --ext .ts --fix",
8
8
  "compile": "tsc",
@@ -3,12 +3,45 @@ import { Utils } from "../utils";
3
3
  import { Client } from "../client";
4
4
  import { Collection } from "../collection";
5
5
  import { Commission } from '../model/Commission';
6
+ import { PassageCommission } from '../model/PassageCommission';
6
7
 
7
8
  export class CommissionsAPI extends Core {
8
9
  constructor(config: MetariscConfig, client?: Client) {
9
10
  super(config, client);
10
11
  }
11
12
 
13
+ /**
14
+ * Récupération des détails de la commission.
15
+ * @param commissionId Identifiant unique de la commission
16
+ */
17
+ getCommission(commissionId: string): Collection<Commission>
18
+ {
19
+ const pathVariable = { 'commission_id': commissionId };
20
+ return this.collect<Commission>({
21
+ method: 'GET',
22
+ endpoint: Utils.constructPath(pathVariable, '/commissions/{commission_id}'),
23
+ headers: { },
24
+ params: { },
25
+ body: {}
26
+ });
27
+ }
28
+
29
+ /**
30
+ * Récupération de la liste des dates de passage de la commission.
31
+ * @param commissionId Identifiant unique de la commission
32
+ */
33
+ paginateCommissionDates(commissionId: string): Collection<PassageCommission>
34
+ {
35
+ const pathVariable = { 'commission_id': commissionId };
36
+ return this.collect<PassageCommission>({
37
+ method: 'GET',
38
+ endpoint: Utils.constructPath(pathVariable, '/commissions/{commission_id}/dates'),
39
+ headers: { },
40
+ params: { },
41
+ body: {}
42
+ });
43
+ }
44
+
12
45
  /**
13
46
  * Liste des commissions.
14
47
  */
@@ -1,14 +1,65 @@
1
1
  import { Core, MetariscConfig } from "../core";
2
2
  import { Utils } from "../utils";
3
+ import type { AxiosResponse } from "axios";
3
4
  import { Client } from "../client";
4
5
  import { Collection } from "../collection";
5
6
  import { TourneeDeci } from '../model/TourneeDeci';
7
+ import { TourneeDeciPei } from '../model/TourneeDeciPei';
6
8
 
7
9
  export class TournesDECIAPI extends Core {
8
10
  constructor(config: MetariscConfig, client?: Client) {
9
11
  super(config, client);
10
12
  }
11
13
 
14
+ /**
15
+ * Récupération des détails de la tournée DECI.
16
+ * @param tourneeDeciId Identifiant de la tournée DECI
17
+ */
18
+ async getTourneeDeci(tourneeDeciId: string): Promise<AxiosResponse<TourneeDeci>>
19
+ {
20
+ const pathVariable = { 'tournee_deci_id': tourneeDeciId };
21
+ return this.request({
22
+ method: 'GET',
23
+ endpoint: Utils.constructPath(pathVariable, '/tournees_deci/{tournee_deci_id}'),
24
+ headers: { },
25
+ params: { },
26
+ body: {}
27
+ });
28
+ }
29
+
30
+ /**
31
+ * Récupération des détails liés au contrôle d'un PEI d'une tournée.
32
+ * @param tourneeDeciId Identifiant de la tournée DECI
33
+ * @param peiId Identifiant du PEI lié au contrôle
34
+ */
35
+ async getTourneeDeciPei(tourneeDeciId: string, peiId: string): Promise<AxiosResponse<TourneeDeciPei>>
36
+ {
37
+ const pathVariable = { 'tournee_deci_id': tourneeDeciId, 'pei_id': peiId };
38
+ return this.request({
39
+ method: 'GET',
40
+ endpoint: Utils.constructPath(pathVariable, '/tournees_deci/{tournee_deci_id}/pei/{pei_id}'),
41
+ headers: { },
42
+ params: { },
43
+ body: {}
44
+ });
45
+ }
46
+
47
+ /**
48
+ * Récupération de la liste des contrôles PEI liés à la tournée DECI.
49
+ * @param tourneeDeciId Identifiant de la tournée DECI
50
+ */
51
+ paginateTourneeDeciPei(tourneeDeciId: string): Collection<TourneeDeciPei>
52
+ {
53
+ const pathVariable = { 'tournee_deci_id': tourneeDeciId };
54
+ return this.collect<TourneeDeciPei>({
55
+ method: 'GET',
56
+ endpoint: Utils.constructPath(pathVariable, '/tournees_deci/{tournee_deci_id}/pei'),
57
+ headers: { },
58
+ params: { },
59
+ body: {}
60
+ });
61
+ }
62
+
12
63
  /**
13
64
  * Liste des tournées DECI.
14
65
  */
package/src/client.ts CHANGED
@@ -76,7 +76,7 @@ export class Client {
76
76
  await this.refreshToken();
77
77
  }
78
78
  catch(e) {
79
- throw new SessionExpiredError('La session utilisateur a expirée')
79
+ throw new SessionExpiredError('La session utilisateur a expirée. ' + e.message);
80
80
  }
81
81
  }
82
82
  return config;
@@ -0,0 +1,12 @@
1
+ export type PassageCommission = {
2
+ 'id'?: string;
3
+ 'date_debut'?: Date;
4
+ 'date_fin'?: Date;
5
+ 'type'?: TypeEnum;
6
+ };
7
+
8
+ export enum TypeEnum {
9
+ Salle = 'salle',
10
+ VisiteDeSecurite = 'visite_de_securite',
11
+ GroupeDeVisite = 'groupe_de_visite'
12
+ }
@@ -0,0 +1,18 @@
1
+ import { AnomaliePEI } from '../../src/model/AnomaliePEI';
2
+ import { PEI } from '../../src/model/PEI';
3
+
4
+ export type TourneeDeciPei = {
5
+ 'id'?: string;
6
+ 'date_du_controle'?: Date;
7
+ 'liste_anomalies'?: Array<AnomaliePEI>;
8
+ 'essais_engin_utilise'?: EssaisEnginUtiliseEnum;
9
+ 'pei'?: PEI;
10
+ 'est_controle'?: boolean;
11
+ };
12
+
13
+ export enum EssaisEnginUtiliseEnum {
14
+ Aucun = 'aucun',
15
+ Fpt = 'fpt',
16
+ Mpr = 'mpr',
17
+ Ccf = 'ccf'
18
+ }