@cra-risk-management/sdk 1.0.0 → 1.0.1
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/client.d.ts +124 -0
- package/dist/models/criticalPoints.d.ts +34 -0
- package/dist/models/eventTypes.d.ts +16 -0
- package/dist/models/eventZones.d.ts +16 -0
- package/dist/models/municipalities.d.ts +13 -0
- package/dist/models/observations.d.ts +22 -0
- package/dist/models/users.d.ts +3 -0
- package/dist/resources/criticalPoints.d.ts +176 -0
- package/dist/resources/municipalities.d.ts +41 -0
- package/dist/resources/users.d.ts +41 -0
- package/package.json +7 -2
- package/src/resources/criticalPoints.js +1 -1
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export = Client;
|
|
2
|
+
declare class Client {
|
|
3
|
+
/**
|
|
4
|
+
* @param {Object} options
|
|
5
|
+
* @param {string} options.baseURL
|
|
6
|
+
* @param {number} [options.timeout]
|
|
7
|
+
* @param {string} [options.username]
|
|
8
|
+
* @param {string} [options.password]
|
|
9
|
+
* @param {string} [options.authEndpoint]
|
|
10
|
+
* @param {number} [options.maxRetries]
|
|
11
|
+
*/
|
|
12
|
+
constructor(options?: {
|
|
13
|
+
baseURL: string;
|
|
14
|
+
timeout?: number | undefined;
|
|
15
|
+
username?: string | undefined;
|
|
16
|
+
password?: string | undefined;
|
|
17
|
+
authEndpoint?: string | undefined;
|
|
18
|
+
maxRetries?: number | undefined;
|
|
19
|
+
});
|
|
20
|
+
baseURL: string;
|
|
21
|
+
authEndpoint: string;
|
|
22
|
+
timeout: number;
|
|
23
|
+
maxRetries: number;
|
|
24
|
+
username: string | null;
|
|
25
|
+
password: string | null;
|
|
26
|
+
token: any;
|
|
27
|
+
tokenExpiry: number | null;
|
|
28
|
+
defaultHeaders: {
|
|
29
|
+
"Content-Type": string;
|
|
30
|
+
};
|
|
31
|
+
municipalities: MunicipalitiesClient;
|
|
32
|
+
criticalPoints: CriticalPointsClient;
|
|
33
|
+
users: UsersClient;
|
|
34
|
+
/**
|
|
35
|
+
* Authenticate
|
|
36
|
+
* @returns {Promise<string>} Access Token
|
|
37
|
+
*/
|
|
38
|
+
authenticate(): Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Check if token is valid.
|
|
41
|
+
* @returns {boolean}
|
|
42
|
+
*/
|
|
43
|
+
isAuthenticated(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Ensures client is authenticated.
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
private ensureAuthenticated;
|
|
49
|
+
/**
|
|
50
|
+
* HTTP request
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
private _request;
|
|
54
|
+
/**
|
|
55
|
+
* Create structured error
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
private _createError;
|
|
59
|
+
/**
|
|
60
|
+
* Check if error is retryable
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
private _isRetryableError;
|
|
64
|
+
/**
|
|
65
|
+
* Delay helper for retry backoff
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
private _delay;
|
|
69
|
+
/**
|
|
70
|
+
* Login with username and password
|
|
71
|
+
* @param {string} username
|
|
72
|
+
* @param {string} password
|
|
73
|
+
* @returns {Promise<string>} Access token
|
|
74
|
+
*/
|
|
75
|
+
login(username: string, password: string): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Logout (clear credentials and token)
|
|
78
|
+
*/
|
|
79
|
+
logout(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Set credentials without authenticating
|
|
82
|
+
* @param {string} username
|
|
83
|
+
* @param {string} password
|
|
84
|
+
*/
|
|
85
|
+
setCredentials(username: string, password: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Set token directly (if you already have one)
|
|
88
|
+
* @param {string} token
|
|
89
|
+
* @param {number} [expiresIn] - Expiry in seconds
|
|
90
|
+
*/
|
|
91
|
+
setToken(token: string, expiresIn?: number): void;
|
|
92
|
+
/**
|
|
93
|
+
* GET request
|
|
94
|
+
* @param {string} endpoint
|
|
95
|
+
* @param {Object} [params]
|
|
96
|
+
*/
|
|
97
|
+
get(endpoint: string, params?: Object): Promise<any>;
|
|
98
|
+
/**
|
|
99
|
+
* POST request
|
|
100
|
+
* @param {string} endpoint
|
|
101
|
+
* @param {Object} [params]
|
|
102
|
+
*/
|
|
103
|
+
post(endpoint: string, data: any): Promise<any>;
|
|
104
|
+
/**
|
|
105
|
+
* PATCH request
|
|
106
|
+
* @param {string} endpoint
|
|
107
|
+
* @param {Object} data
|
|
108
|
+
*/
|
|
109
|
+
patch(endpoint: string, data: Object): Promise<any>;
|
|
110
|
+
/**
|
|
111
|
+
* DELETE request
|
|
112
|
+
* @param {string} endpoint
|
|
113
|
+
*/
|
|
114
|
+
delete(endpoint: string): Promise<any>;
|
|
115
|
+
/**
|
|
116
|
+
* Special request to confirm data
|
|
117
|
+
* @param {string} endpoint
|
|
118
|
+
* @param {number} id
|
|
119
|
+
*/
|
|
120
|
+
confirm(endpoint: string, id: number): Promise<any>;
|
|
121
|
+
}
|
|
122
|
+
import MunicipalitiesClient = require("../src/resources/municipalities");
|
|
123
|
+
import CriticalPointsClient = require("../src/resources/criticalPoints");
|
|
124
|
+
import UsersClient = require("../src/resources/users");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
type CriticalPointCreate = {
|
|
2
|
+
description: string;
|
|
3
|
+
municipality_id: number;
|
|
4
|
+
event_type_id: number;
|
|
5
|
+
event_zone_id: number;
|
|
6
|
+
user_id?: number | undefined;
|
|
7
|
+
image_id?: string | undefined;
|
|
8
|
+
datetime?: Date | undefined;
|
|
9
|
+
confirmed?: number | undefined;
|
|
10
|
+
geometry: string;
|
|
11
|
+
};
|
|
12
|
+
type CriticalPoint = {
|
|
13
|
+
id: number;
|
|
14
|
+
description: string;
|
|
15
|
+
municipality_id: number;
|
|
16
|
+
event_type_id: number;
|
|
17
|
+
event_zone_id: number;
|
|
18
|
+
user_id: number;
|
|
19
|
+
image_id: string;
|
|
20
|
+
datetime: Date;
|
|
21
|
+
confirmed: number;
|
|
22
|
+
geometry: string;
|
|
23
|
+
};
|
|
24
|
+
type CriticalPointUpdate = {
|
|
25
|
+
description?: string | undefined;
|
|
26
|
+
municipality_id?: number | undefined;
|
|
27
|
+
event_type_id?: number | undefined;
|
|
28
|
+
event_zone_id?: number | undefined;
|
|
29
|
+
user_id?: number | undefined;
|
|
30
|
+
image_id?: string | undefined;
|
|
31
|
+
datetime?: Date | undefined;
|
|
32
|
+
confirmed?: number | undefined;
|
|
33
|
+
geometry?: string | undefined;
|
|
34
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type EventTypeCreate = {
|
|
2
|
+
event_type: string;
|
|
3
|
+
icon: string;
|
|
4
|
+
color: string;
|
|
5
|
+
};
|
|
6
|
+
export type EventType = {
|
|
7
|
+
id: number;
|
|
8
|
+
event_type: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
color: string;
|
|
11
|
+
};
|
|
12
|
+
export type EventTypeUpdate = {
|
|
13
|
+
event_type?: string | undefined;
|
|
14
|
+
icon?: string | undefined;
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type EventZoneCreate = {
|
|
2
|
+
event_zone: string;
|
|
3
|
+
icon: string;
|
|
4
|
+
color: string;
|
|
5
|
+
};
|
|
6
|
+
export type EventZone = {
|
|
7
|
+
id: number;
|
|
8
|
+
event_zone: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
color: string;
|
|
11
|
+
};
|
|
12
|
+
export type EventZoneUpdate = {
|
|
13
|
+
event_zone?: string | undefined;
|
|
14
|
+
icon?: string | undefined;
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type MunicipalityCreate = {
|
|
2
|
+
name: string;
|
|
3
|
+
geometry: string;
|
|
4
|
+
};
|
|
5
|
+
export type Municipality = {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
geometry: string;
|
|
9
|
+
};
|
|
10
|
+
export type MunicipalityUpdate = {
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
geometry?: string | undefined;
|
|
13
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ObservationCreate = {
|
|
2
|
+
information: string;
|
|
3
|
+
critical_point_id: string;
|
|
4
|
+
image_id?: string | undefined;
|
|
5
|
+
datetime?: Date | undefined;
|
|
6
|
+
confirmed?: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type Observation = {
|
|
9
|
+
id: number;
|
|
10
|
+
information: string;
|
|
11
|
+
critical_point_id: string;
|
|
12
|
+
image_id: string;
|
|
13
|
+
datetime: Date;
|
|
14
|
+
confirmed: number;
|
|
15
|
+
};
|
|
16
|
+
export type ObservationUpdate = {
|
|
17
|
+
information?: string | undefined;
|
|
18
|
+
critical_point_id?: string | undefined;
|
|
19
|
+
image_id?: string | undefined;
|
|
20
|
+
datetime?: Date | undefined;
|
|
21
|
+
confirmed?: number | undefined;
|
|
22
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export = CriticalPoints;
|
|
2
|
+
declare class CriticalPoints {
|
|
3
|
+
constructor(client: any);
|
|
4
|
+
client: any;
|
|
5
|
+
endpoint: string;
|
|
6
|
+
attributes: CriticalPointAttributes;
|
|
7
|
+
/**
|
|
8
|
+
* List all critical points.
|
|
9
|
+
* @param {Object} [params]
|
|
10
|
+
* @param {number} [params.event_type_id]
|
|
11
|
+
* @param {number} [params.event_zone_id]
|
|
12
|
+
* @param {number} [params.municipality_id]
|
|
13
|
+
* @param {number} [params.user_id]
|
|
14
|
+
* @param {boolean} [params.confirmed]
|
|
15
|
+
* @param {Date} [params.from_datetime]
|
|
16
|
+
* @param {Date} [params.to_datetime]
|
|
17
|
+
* @returns {Promise<import("../models/criticalPoints").CriticalPoint[]>}
|
|
18
|
+
*/
|
|
19
|
+
list(params?: {
|
|
20
|
+
event_type_id?: number | undefined;
|
|
21
|
+
event_zone_id?: number | undefined;
|
|
22
|
+
municipality_id?: number | undefined;
|
|
23
|
+
user_id?: number | undefined;
|
|
24
|
+
confirmed?: boolean | undefined;
|
|
25
|
+
from_datetime?: Date | undefined;
|
|
26
|
+
to_datetime?: Date | undefined;
|
|
27
|
+
}): Promise<any[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Get one critical point by its ID.
|
|
30
|
+
* @param {number} id
|
|
31
|
+
* @param {Object} params
|
|
32
|
+
* @returns {Promise<import("../models/criticalPoints").CriticalPoint>}
|
|
33
|
+
*/
|
|
34
|
+
get(id: number, params?: Object): Promise<any>;
|
|
35
|
+
/**
|
|
36
|
+
* Create a critical point instance.
|
|
37
|
+
* @param {import("../models/criticalPoints").CriticalPointCreate} data
|
|
38
|
+
* @returns {Promise<import("../models/criticalPoints").CriticalPoint>}
|
|
39
|
+
*/
|
|
40
|
+
create(data: any): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Patch critical point.
|
|
43
|
+
* @param {number} id
|
|
44
|
+
* @param {import("../models/criticalPoints").CriticalPointUpdate} data
|
|
45
|
+
* @returns {Promise<import("../models/criticalPoints").CriticalPoint>}
|
|
46
|
+
*/
|
|
47
|
+
update(id: number, data: any): Promise<any>;
|
|
48
|
+
/**
|
|
49
|
+
* Delete a critical point.
|
|
50
|
+
* @param {number} id
|
|
51
|
+
* @returns {Promise<void>}
|
|
52
|
+
*/
|
|
53
|
+
delete(id: number): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
declare class CriticalPointAttributes {
|
|
56
|
+
constructor(client: any);
|
|
57
|
+
client: any;
|
|
58
|
+
endpoint: string;
|
|
59
|
+
eventZones: EventZoneAttribute;
|
|
60
|
+
eventTypes: EventTypeAttribute;
|
|
61
|
+
observations: ObservationAttribute;
|
|
62
|
+
}
|
|
63
|
+
declare class EventZoneAttribute {
|
|
64
|
+
constructor(client: any, parentEndpoint: any);
|
|
65
|
+
client: any;
|
|
66
|
+
endpoint: string;
|
|
67
|
+
/**
|
|
68
|
+
* Get all event zones.
|
|
69
|
+
* @param {Object} [params]
|
|
70
|
+
* @returns {Promise<import("../models/eventZones").EventZone[]>}
|
|
71
|
+
*/
|
|
72
|
+
list(params?: Object): Promise<import("../models/eventZones").EventZone[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Get one event zone by its ID.
|
|
75
|
+
* @param {number} id
|
|
76
|
+
* @param {object} [params]
|
|
77
|
+
* @returns {Promise<import("../models/eventZones").EventZone>}
|
|
78
|
+
*/
|
|
79
|
+
get(id: number, params?: object): Promise<import("../models/eventZones").EventZone>;
|
|
80
|
+
/**
|
|
81
|
+
* Create an event zone instance.
|
|
82
|
+
* @param {import("../models/eventZones").EventZoneCreate} data
|
|
83
|
+
* @returns {Promise<import("../models/eventZones").EventZone>}
|
|
84
|
+
*/
|
|
85
|
+
create(data: import("../models/eventZones").EventZoneCreate): Promise<import("../models/eventZones").EventZone>;
|
|
86
|
+
/**
|
|
87
|
+
* Update event zone.
|
|
88
|
+
* @param {number} id
|
|
89
|
+
* @param {import("../models/eventZones").EventZoneUpdate} data
|
|
90
|
+
* @returns {Promise<import("../models/eventZones").EventZone>}
|
|
91
|
+
*/
|
|
92
|
+
update(id: number, data: import("../models/eventZones").EventZoneUpdate): Promise<import("../models/eventZones").EventZone>;
|
|
93
|
+
/**
|
|
94
|
+
* Delete event zone by ID.
|
|
95
|
+
* @param {number} id
|
|
96
|
+
* @returns {Promise<void>}
|
|
97
|
+
*/
|
|
98
|
+
delete(id: number): Promise<void>;
|
|
99
|
+
}
|
|
100
|
+
declare class EventTypeAttribute {
|
|
101
|
+
constructor(client: any, parentEndpoint: any);
|
|
102
|
+
client: any;
|
|
103
|
+
endpoint: string;
|
|
104
|
+
/**
|
|
105
|
+
* List all event types.
|
|
106
|
+
* @param {Object} [params]
|
|
107
|
+
* @returns {Promise<import("../models/eventTypes").EventType[]>}
|
|
108
|
+
*/
|
|
109
|
+
list(params?: Object): Promise<import("../models/eventTypes").EventType[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Get one event type by its ID.
|
|
112
|
+
* @param {number} id
|
|
113
|
+
* @param {Object} [params]
|
|
114
|
+
* @returns {Promise<import("../models/eventTypes").EventType>}
|
|
115
|
+
*/
|
|
116
|
+
get(id: number, params?: Object): Promise<import("../models/eventTypes").EventType>;
|
|
117
|
+
/**
|
|
118
|
+
* Create event type instance.
|
|
119
|
+
* @param {import("../models/eventTypes").EventTypeCreate} data
|
|
120
|
+
* @returns {Promise<import("../models/eventTypes").EventType>}
|
|
121
|
+
*/
|
|
122
|
+
create(data: import("../models/eventTypes").EventTypeCreate): Promise<import("../models/eventTypes").EventType>;
|
|
123
|
+
/**
|
|
124
|
+
* Update event type.
|
|
125
|
+
* @param {number} id
|
|
126
|
+
* @param {import("../models/eventTypes").EventTypeUpdate} data
|
|
127
|
+
* @returns {Promise<import("../models/eventTypes").EventType>}
|
|
128
|
+
*/
|
|
129
|
+
update(id: number, data: import("../models/eventTypes").EventTypeUpdate): Promise<import("../models/eventTypes").EventType>;
|
|
130
|
+
/**
|
|
131
|
+
* Delete event type instance.
|
|
132
|
+
* @param {number} id
|
|
133
|
+
* @returns {Promise<void>}
|
|
134
|
+
*/
|
|
135
|
+
delete(id: number): Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
declare class ObservationAttribute {
|
|
138
|
+
constructor(client: any, parentEndpoint: any);
|
|
139
|
+
client: any;
|
|
140
|
+
endpoint: string;
|
|
141
|
+
/**
|
|
142
|
+
* List observations.
|
|
143
|
+
* @param {Object} [params]
|
|
144
|
+
* @param {number} [params.critical_point_id]
|
|
145
|
+
* @returns {Promise<import("../models/observations").Observation[]>}
|
|
146
|
+
*/
|
|
147
|
+
list(params?: {
|
|
148
|
+
critical_point_id?: number | undefined;
|
|
149
|
+
}): Promise<import("../models/observations").Observation[]>;
|
|
150
|
+
/**
|
|
151
|
+
* Get one observation by ID.
|
|
152
|
+
* @param {number} id
|
|
153
|
+
* @param {Object} [params]
|
|
154
|
+
* @returns {Promise<import("../models/observations").Observation>}
|
|
155
|
+
*/
|
|
156
|
+
get(id: number, params?: Object): Promise<import("../models/observations").Observation>;
|
|
157
|
+
/**
|
|
158
|
+
* Create observation instance.
|
|
159
|
+
* @param {import("../models/observations").ObservationCreate} data
|
|
160
|
+
* @returns {Promise<import("../models/observations").Observation>}
|
|
161
|
+
*/
|
|
162
|
+
create(data: import("../models/observations").ObservationCreate): Promise<import("../models/observations").Observation>;
|
|
163
|
+
/**
|
|
164
|
+
* Update observation instance.
|
|
165
|
+
* @param {number} id
|
|
166
|
+
* @param {import("../models/observations").ObservationUpdate} data
|
|
167
|
+
* @returns {Promise<import("../models/observations").Observation>}
|
|
168
|
+
*/
|
|
169
|
+
update(id: number, data: import("../models/observations").ObservationUpdate): Promise<import("../models/observations").Observation>;
|
|
170
|
+
/**
|
|
171
|
+
* Delete observation.
|
|
172
|
+
* @param {number} id
|
|
173
|
+
* @returns {Promise<void>}
|
|
174
|
+
*/
|
|
175
|
+
delete(id: number): Promise<void>;
|
|
176
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export = Municipalities;
|
|
2
|
+
declare class Municipalities {
|
|
3
|
+
/**
|
|
4
|
+
* @param {import("../client")} client
|
|
5
|
+
*/
|
|
6
|
+
constructor(client: import("../client"));
|
|
7
|
+
client: import("../client");
|
|
8
|
+
endpoint: string;
|
|
9
|
+
/**
|
|
10
|
+
* List all municipalities.
|
|
11
|
+
* @param {Object} [params]
|
|
12
|
+
* @returns {Promise<import("../models/municipalities").Municipality[]>}
|
|
13
|
+
*/
|
|
14
|
+
list(params?: Object): Promise<import("../models/municipalities").Municipality[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get a municipality instance by id.
|
|
17
|
+
* @param {number} id
|
|
18
|
+
* @param {Object} [params]
|
|
19
|
+
* @returns {Promise<import("../models/municipalities").Municipality>}
|
|
20
|
+
*/
|
|
21
|
+
get(id: number, params?: Object): Promise<import("../models/municipalities").Municipality>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a municipality instance.
|
|
24
|
+
* @param {import("../models/municipalities").MunicipalityCreate} data
|
|
25
|
+
* @returns {Promise<import("../models/municipalities").Municipality>}
|
|
26
|
+
*/
|
|
27
|
+
create(data: import("../models/municipalities").MunicipalityCreate): Promise<import("../models/municipalities").Municipality>;
|
|
28
|
+
/**
|
|
29
|
+
* Update a municipality instance.
|
|
30
|
+
* @param {number} id
|
|
31
|
+
* @param {import("../models/municipalities").MunicipalityUpdate} data
|
|
32
|
+
* @returns {Promise<import("../models/municipalities").Municipality>}
|
|
33
|
+
*/
|
|
34
|
+
update(id: number, data: import("../models/municipalities").MunicipalityUpdate): Promise<import("../models/municipalities").Municipality>;
|
|
35
|
+
/**
|
|
36
|
+
* Delete municipality instance.
|
|
37
|
+
* @param {number} id
|
|
38
|
+
* @returns {Promise<void>}
|
|
39
|
+
*/
|
|
40
|
+
delete(id: number): Promise<void>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export = Users;
|
|
2
|
+
declare class Users {
|
|
3
|
+
/**
|
|
4
|
+
* @param {import("../client")} client
|
|
5
|
+
*/
|
|
6
|
+
constructor(client: import("../client"));
|
|
7
|
+
client: import("../client");
|
|
8
|
+
endpoint: string;
|
|
9
|
+
/**
|
|
10
|
+
* Get all Users.
|
|
11
|
+
* @param {Object} params
|
|
12
|
+
* @returns {Promise<import("../models/users").User[]>}
|
|
13
|
+
*/
|
|
14
|
+
list(params?: Object): Promise<import("../models/users").User[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Get one User by ID.
|
|
17
|
+
* @param {number} id
|
|
18
|
+
* @param {Object} params
|
|
19
|
+
* @returns {Promise<import("../models/users").User>}
|
|
20
|
+
*/
|
|
21
|
+
get(id: number, params?: Object): Promise<import("../models/users").User>;
|
|
22
|
+
/**
|
|
23
|
+
* Create an User instance
|
|
24
|
+
* @param {import("../models/users").UserCreate} data
|
|
25
|
+
* @returns {Promise<import("../models/users").User>}
|
|
26
|
+
*/
|
|
27
|
+
create(data: import("../models/users").UserCreate): Promise<import("../models/users").User>;
|
|
28
|
+
/**
|
|
29
|
+
* Update User instance.
|
|
30
|
+
* @param {number} id
|
|
31
|
+
* @param {import("../models/users").UserUpdate} data
|
|
32
|
+
* @returns {Promise<import("../models/users").User}
|
|
33
|
+
*/
|
|
34
|
+
update(id: number, data: import("../models/users").UserUpdate): Promise<import("../models/users").User>;
|
|
35
|
+
/**
|
|
36
|
+
* Delete user instance.
|
|
37
|
+
* @param {number} id
|
|
38
|
+
* @returns {Promise<void>}
|
|
39
|
+
*/
|
|
40
|
+
delete(id: number): Promise<void>;
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cra-risk-management/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Software Development Kit for JS apps - CRA Risk Management API Client",
|
|
5
5
|
"main": "src/client.js",
|
|
6
6
|
"keywords": [
|
|
@@ -20,8 +20,12 @@
|
|
|
20
20
|
"url": "https://github.com/CRA-Risk-Management/sdk-js/issues"
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/CRA-Risk-Management/sdk-js#readme",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build:types": "tsc"
|
|
25
|
+
},
|
|
23
26
|
"files": [
|
|
24
27
|
"src/",
|
|
28
|
+
"dist/",
|
|
25
29
|
"LICENSE",
|
|
26
30
|
"README.md",
|
|
27
31
|
"CHANGELOG.md"
|
|
@@ -33,6 +37,7 @@
|
|
|
33
37
|
"access": "public"
|
|
34
38
|
},
|
|
35
39
|
"devDependencies": {
|
|
36
|
-
"node-fetch": "^2.7.0"
|
|
40
|
+
"node-fetch": "^2.7.0",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
37
42
|
}
|
|
38
43
|
}
|
|
@@ -79,7 +79,7 @@ class EventZoneAttribute {
|
|
|
79
79
|
/**
|
|
80
80
|
* Get all event zones.
|
|
81
81
|
* @param {Object} [params]
|
|
82
|
-
* @returns {
|
|
82
|
+
* @returns {Promise<import("../models/eventZones").EventZone[]>}
|
|
83
83
|
*/
|
|
84
84
|
async list(params = {}) {
|
|
85
85
|
return this.client.get(`${this.endpoint}/items`, params);
|