@metarisc/metarisc-js 0.0.1-alpha.2 → 0.0.1-alpha.21
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/.eslintrc +10 -2
- package/.github/workflows/main.yml +29 -0
- package/README.md +29 -0
- package/lib/api/DossiersAPI.d.ts +62 -0
- package/lib/api/DossiersAPI.js +136 -0
- package/lib/api/EvenementsAPI.d.ts +41 -0
- package/lib/api/EvenementsAPI.js +90 -0
- package/lib/api/NotificationsAPI.d.ts +30 -0
- package/lib/api/NotificationsAPI.js +71 -0
- package/lib/api/OrganisationAPI.d.ts +19 -0
- package/lib/api/OrganisationAPI.js +43 -0
- package/lib/api/OrganisationsAPI.d.ts +19 -0
- package/lib/api/OrganisationsAPI.js +43 -0
- package/lib/api/PEIAPI.d.ts +43 -0
- package/lib/api/PEIAPI.js +91 -0
- package/lib/api/POIAPI.d.ts +50 -0
- package/lib/api/POIAPI.js +106 -0
- package/lib/api/PingAPI.d.ts +11 -0
- package/lib/api/PingAPI.js +27 -0
- package/lib/api/SupportAPI.d.ts +25 -0
- package/lib/api/SupportAPI.js +57 -0
- package/lib/api/UtilisateursAPI.d.ts +19 -0
- package/lib/api/UtilisateursAPI.js +42 -0
- package/lib/auth/oauth2.d.ts +19 -0
- package/lib/auth/oauth2.js +25 -0
- package/lib/client.d.ts +33 -0
- package/lib/client.js +97 -0
- package/lib/collection.d.ts +42 -0
- package/lib/collection.js +52 -0
- package/lib/core.d.ts +48 -0
- package/lib/core.js +28 -0
- package/lib/index.d.ts +15 -1
- package/lib/index.js +27 -1
- package/lib/metarisc.d.ts +20 -18
- package/lib/metarisc.js +36 -27
- package/lib/model/AdressePostale.d.ts +10 -0
- package/lib/model/AdressePostale.js +2 -0
- package/lib/model/AnomalieDECI.d.ts +10 -0
- package/lib/model/AnomalieDECI.js +9 -0
- package/lib/model/Contact.d.ts +13 -0
- package/lib/model/Contact.js +2 -0
- package/lib/model/DescriptifTechnique.d.ts +40 -0
- package/lib/model/DescriptifTechnique.js +45 -0
- package/lib/model/DescriptifTechniqueBase.d.ts +5 -0
- package/lib/model/DescriptifTechniqueBase.js +2 -0
- package/lib/model/DescriptifTechniqueDECIBase.d.ts +16 -0
- package/lib/model/DescriptifTechniqueDECIBase.js +9 -0
- package/lib/model/DescriptifTechniquePENA.d.ts +43 -0
- package/lib/model/DescriptifTechniquePENA.js +40 -0
- package/lib/model/DescriptifTechniquePENAAllOfRealimentation.d.ts +10 -0
- package/lib/model/DescriptifTechniquePENAAllOfRealimentation.js +9 -0
- package/lib/model/DescriptifTechniquePENAAllOfVolumes.d.ts +4 -0
- package/lib/model/DescriptifTechniquePENAAllOfVolumes.js +2 -0
- package/lib/model/DescriptifTechniquePIBI.d.ts +31 -0
- package/lib/model/DescriptifTechniquePIBI.js +25 -0
- package/lib/model/DescriptifTechniquePIBIAllOfPesees.d.ts +6 -0
- package/lib/model/DescriptifTechniquePIBIAllOfPesees.js +2 -0
- package/lib/model/Document.d.ts +3 -0
- package/lib/model/Document.js +2 -0
- package/lib/model/Dossier.d.ts +17 -0
- package/lib/model/Dossier.js +8 -0
- package/lib/model/Email.d.ts +6 -0
- package/lib/model/Email.js +2 -0
- package/lib/model/Evenement.d.ts +14 -0
- package/lib/model/Evenement.js +10 -0
- package/lib/model/Feature.d.ts +6 -0
- package/lib/model/Feature.js +2 -0
- package/lib/model/FeatureGeometry.d.ts +5 -0
- package/lib/model/FeatureGeometry.js +2 -0
- package/lib/model/GetEvenement404Response.d.ts +6 -0
- package/lib/model/GetEvenement404Response.js +2 -0
- package/lib/model/GetEvenementDetails404Response.d.ts +6 -0
- package/lib/model/GetEvenementDetails404Response.js +2 -0
- package/lib/model/GetFeature200Response.d.ts +7 -0
- package/lib/model/GetFeature200Response.js +2 -0
- package/lib/model/GetFeature200ResponseCrs.d.ts +5 -0
- package/lib/model/GetFeature200ResponseCrs.js +2 -0
- package/lib/model/GetFeature200ResponseCrsProperties.d.ts +3 -0
- package/lib/model/GetFeature200ResponseCrsProperties.js +2 -0
- package/lib/model/GetNotification404Response.d.ts +6 -0
- package/lib/model/GetNotification404Response.js +2 -0
- package/lib/model/Notification.d.ts +12 -0
- package/lib/model/Notification.js +2 -0
- package/lib/model/Organisation.d.ts +9 -0
- package/lib/model/Organisation.js +7 -0
- package/lib/model/PEI.d.ts +13 -0
- package/lib/model/PEI.js +2 -0
- package/lib/model/PEIReferencesExterieuresInner.d.ts +4 -0
- package/lib/model/PEIReferencesExterieuresInner.js +2 -0
- package/lib/model/POI.d.ts +13 -0
- package/lib/model/POI.js +2 -0
- package/lib/model/POIReferencesExterieuresInner.d.ts +4 -0
- package/lib/model/POIReferencesExterieuresInner.js +2 -0
- package/lib/model/PatchPoiRequest.d.ts +3 -0
- package/lib/model/PatchPoiRequest.js +2 -0
- package/lib/model/PieceJointe.d.ts +7 -0
- package/lib/model/PieceJointe.js +2 -0
- package/lib/model/Ping200Response.d.ts +3 -0
- package/lib/model/Ping200Response.js +2 -0
- package/lib/model/PostDossierRequest.d.ts +5 -0
- package/lib/model/PostDossierRequest.js +2 -0
- package/lib/model/PostEvenementRequest.d.ts +7 -0
- package/lib/model/PostEvenementRequest.js +2 -0
- package/lib/model/PostNotification400Response.d.ts +6 -0
- package/lib/model/PostNotification400Response.js +2 -0
- package/lib/model/PostNotification500Response.d.ts +6 -0
- package/lib/model/PostNotification500Response.js +2 -0
- package/lib/model/PostNotificationRequest.d.ts +9 -0
- package/lib/model/PostNotificationRequest.js +2 -0
- package/lib/model/PostTicketRequest.d.ts +10 -0
- package/lib/model/PostTicketRequest.js +2 -0
- package/lib/model/SuiviAdministratif.d.ts +6 -0
- package/lib/model/SuiviAdministratif.js +2 -0
- package/lib/model/Tag.d.ts +3 -0
- package/lib/model/Tag.js +2 -0
- package/lib/model/Ticket.d.ts +17 -0
- package/lib/model/Ticket.js +12 -0
- package/lib/model/Type.d.ts +5 -0
- package/lib/model/Type.js +2 -0
- package/lib/model/Utilisateur.d.ts +12 -0
- package/lib/model/Utilisateur.js +2 -0
- package/lib/model/Utilisateur1.d.ts +3 -0
- package/lib/model/Utilisateur1.js +2 -0
- package/lib/model/Workflow.d.ts +4 -0
- package/lib/model/Workflow.js +2 -0
- package/lib/model/WorkflowBase.d.ts +14 -0
- package/lib/model/WorkflowBase.js +2 -0
- package/lib/model/WorkflowDossiersLies.d.ts +4 -0
- package/lib/model/WorkflowDossiersLies.js +2 -0
- package/lib/model/WorkflowPassageCommissionSecurite.d.ts +4 -0
- package/lib/model/WorkflowPassageCommissionSecurite.js +2 -0
- package/lib/model/WorkflowRemiseEnServicePEI.d.ts +5 -0
- package/lib/model/WorkflowRemiseEnServicePEI.js +2 -0
- package/lib/tus.d.ts +7 -0
- package/lib/tus.js +43 -0
- package/lib/utils.d.ts +8 -0
- package/lib/utils.js +21 -0
- package/package.json +25 -18
- package/src/api/DossiersAPI.ts +155 -0
- package/src/api/EvenementsAPI.ts +101 -0
- package/src/api/NotificationsAPI.ts +79 -0
- package/src/api/OrganisationAPI.ts +46 -0
- package/src/api/OrganisationsAPI.ts +46 -0
- package/src/api/PEIAPI.ts +103 -0
- package/src/api/POIAPI.ts +124 -0
- package/src/api/PingAPI.ts +27 -0
- package/src/api/SupportAPI.ts +63 -0
- package/src/api/UtilisateursAPI.ts +46 -0
- package/src/auth/oauth2.ts +28 -0
- package/src/client.ts +133 -0
- package/src/collection.ts +85 -0
- package/src/core.ts +70 -0
- package/src/index.ts +22 -1
- package/src/metarisc.ts +67 -54
- package/src/model/AdressePostale.ts +10 -0
- package/src/model/AnomalieDECI.ts +11 -0
- package/src/model/Contact.ts +13 -0
- package/src/model/DescriptifTechnique.ts +46 -0
- package/src/model/DescriptifTechniqueBase.ts +5 -0
- package/src/model/DescriptifTechniqueDECIBase.ts +19 -0
- package/src/model/DescriptifTechniquePENA.ts +49 -0
- package/src/model/DescriptifTechniquePENAAllOfRealimentation.ts +11 -0
- package/src/model/DescriptifTechniquePENAAllOfVolumes.ts +4 -0
- package/src/model/DescriptifTechniquePIBI.ts +36 -0
- package/src/model/DescriptifTechniquePIBIAllOfPesees.ts +6 -0
- package/src/model/Document.ts +3 -0
- package/src/model/Dossier.ts +19 -0
- package/src/model/Email.ts +6 -0
- package/src/model/Evenement.ts +15 -0
- package/src/model/Feature.ts +7 -0
- package/src/model/FeatureGeometry.ts +5 -0
- package/src/model/GetEvenement404Response.ts +6 -0
- package/src/model/GetEvenementDetails404Response.ts +6 -0
- package/src/model/GetFeature200Response.ts +8 -0
- package/src/model/GetFeature200ResponseCrs.ts +6 -0
- package/src/model/GetFeature200ResponseCrsProperties.ts +3 -0
- package/src/model/GetNotification404Response.ts +6 -0
- package/src/model/Notification.ts +12 -0
- package/src/model/Organisation.ts +10 -0
- package/src/model/PEI.ts +14 -0
- package/src/model/PEIReferencesExterieuresInner.ts +4 -0
- package/src/model/POI.ts +14 -0
- package/src/model/POIReferencesExterieuresInner.ts +4 -0
- package/src/model/PatchPoiRequest.ts +3 -0
- package/src/model/PieceJointe.ts +7 -0
- package/src/model/Ping200Response.ts +3 -0
- package/src/model/PostDossierRequest.ts +5 -0
- package/src/model/PostEvenementRequest.ts +7 -0
- package/src/model/PostNotification400Response.ts +6 -0
- package/src/model/PostNotification500Response.ts +6 -0
- package/src/model/PostNotificationRequest.ts +9 -0
- package/src/model/PostTicketRequest.ts +10 -0
- package/src/model/SuiviAdministratif.ts +6 -0
- package/src/model/Tag.ts +3 -0
- package/src/model/Ticket.ts +18 -0
- package/src/model/Type.ts +5 -0
- package/src/model/Utilisateur.ts +12 -0
- package/src/model/Utilisateur1.ts +3 -0
- package/src/model/Workflow.ts +5 -0
- package/src/model/WorkflowBase.ts +14 -0
- package/src/model/WorkflowDossiersLies.ts +5 -0
- package/src/model/WorkflowPassageCommissionSecurite.ts +5 -0
- package/src/model/WorkflowRemiseEnServicePEI.ts +6 -0
- package/src/tus.ts +44 -0
- package/src/utils.ts +23 -0
- package/tsconfig.json +11 -10
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Utilisateur = {
|
|
2
|
+
'id'?: string;
|
|
3
|
+
'first_name'?: string;
|
|
4
|
+
'last_name'?: string;
|
|
5
|
+
'created_at'?: Date;
|
|
6
|
+
'updated_at'?: Date;
|
|
7
|
+
'timezone'?: string;
|
|
8
|
+
'is_active'?: boolean;
|
|
9
|
+
'is_verified'?: boolean;
|
|
10
|
+
'fonction'?: string;
|
|
11
|
+
'avatar_url'?: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { WorkflowDossiersLies } from '../../src/model/WorkflowDossiersLies';
|
|
2
|
+
import { WorkflowPassageCommissionSecurite } from '../../src/model/WorkflowPassageCommissionSecurite';
|
|
3
|
+
import { WorkflowRemiseEnServicePEI } from '../../src/model/WorkflowRemiseEnServicePEI';
|
|
4
|
+
|
|
5
|
+
export type Workflow = WorkflowDossiersLies | WorkflowRemiseEnServicePEI | WorkflowPassageCommissionSecurite;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type WorkflowBase = {
|
|
2
|
+
'id'?: string;
|
|
3
|
+
'titre'?: string;
|
|
4
|
+
'date_de_creation'?: Date;
|
|
5
|
+
'date_de_fin'?: Date;
|
|
6
|
+
'workflow_automatise'?: boolean;
|
|
7
|
+
'etat'?: string;
|
|
8
|
+
'groupe_de_travail'?: string;
|
|
9
|
+
'observations'?: string;
|
|
10
|
+
'est_complet'?: boolean;
|
|
11
|
+
'liste_poi'?: string;
|
|
12
|
+
'documents'?: string;
|
|
13
|
+
'type'?: string;
|
|
14
|
+
};
|
package/src/tus.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Core, MetariscConfig } from "./core";
|
|
2
|
+
import { Upload } from 'tus-js-client';
|
|
3
|
+
import { Client } from "./client";
|
|
4
|
+
|
|
5
|
+
export class Tus extends Core
|
|
6
|
+
{
|
|
7
|
+
constructor(config: MetariscConfig, client: Client) {
|
|
8
|
+
super(config, client);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
upload(file: File, errorFn: (error: Error) => void, chunckFn: (url: string, progress: number) => void, successFn: () => void): void {
|
|
12
|
+
const upload = new Upload(file, {
|
|
13
|
+
endpoint: this.config.metarisc_url + '/resumable-file-uploads/files',
|
|
14
|
+
retryDelays: [0, 3000, 6000, 9000, 12000],
|
|
15
|
+
chunkSize: 1024 * 512,
|
|
16
|
+
metadata: {
|
|
17
|
+
fileName: file.name,
|
|
18
|
+
filetype: file.type,
|
|
19
|
+
},
|
|
20
|
+
headers: {
|
|
21
|
+
Authorization: this.client.getAccessToken() ?? '',
|
|
22
|
+
},
|
|
23
|
+
onError: (error) => {
|
|
24
|
+
errorFn(error);
|
|
25
|
+
},
|
|
26
|
+
onChunkComplete: (chunkSize, bytesAccepted, bytesTotal) => {
|
|
27
|
+
const progress = Math.floor((bytesAccepted * 100) / bytesTotal);
|
|
28
|
+
const url = upload.url;
|
|
29
|
+
chunckFn(url, progress);
|
|
30
|
+
},
|
|
31
|
+
onSuccess: () => {
|
|
32
|
+
successFn();
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
upload.start();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
download(fileId: string) {
|
|
39
|
+
return this.request({
|
|
40
|
+
method: "GET",
|
|
41
|
+
endpoint: "/resumable-file-uploads/files/" + fileId
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default class Utils
|
|
2
|
+
{
|
|
3
|
+
/**
|
|
4
|
+
* Build URL with query params templates
|
|
5
|
+
*/
|
|
6
|
+
static constructPath(data: { [key: string]: string }, url: string) : string
|
|
7
|
+
{
|
|
8
|
+
const r = RegExp('{([^}]*)}', 'g');
|
|
9
|
+
let s = '';
|
|
10
|
+
let idx = 0;
|
|
11
|
+
|
|
12
|
+
for (let a; (a=r.exec(url)) !== null;) {
|
|
13
|
+
s += ( url.substring(idx, r.lastIndex-a[0].length) + data[a[1]] );
|
|
14
|
+
idx = r.lastIndex;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (idx < url.length) {
|
|
18
|
+
s += url.substring(idx,url.length);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return s;
|
|
22
|
+
}
|
|
23
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./lib",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"target": "es2020",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"esModuleInterop": true
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"src/**/*"
|
|
11
|
+
]
|
|
12
|
+
}
|