@pgds/api-interface 1.2.5 → 1.2.6
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/README.md +19 -16
- package/dist/index.d.ts +4 -0
- package/dist/lib/constants/constants.d.ts +2 -0
- package/dist/lib/index.d.ts +188 -0
- package/dist/lib/models/Http.d.ts +61 -0
- package/dist/lib/models/User.d.ts +8 -0
- package/dist/lib/utils/jsonSchemaUtils.d.ts +7 -0
- package/dist/lib/utils/logger.d.ts +4 -0
- package/dist/lib/utils/metadataUtils.d.ts +2 -0
- package/dist/lib/utils/urlUtils.d.ts +1 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.js.map +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
### hiot-api-interface
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
Examples:
|
|
4
|
+
|
|
5
5
|
- [#Example](#example)
|
|
6
6
|
- [./examples/example.ts](examples/example.ts)
|
|
7
7
|
- [./examples/example.js](examples/example.js)
|
|
@@ -11,14 +11,14 @@ Examples:
|
|
|
11
11
|
Available exports
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
|
-
import { get, post, put, patch, del,
|
|
14
|
+
import { get, post, put, patch, del, internal, JsonResponse, prepareJsonSchemas, Method } from "hiot-api-interface";
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Endpoints
|
|
18
|
+
|
|
18
19
|
<details>
|
|
19
20
|
<summary>The <code>get</code>, <code>post</code>, <code>put</code>, <code>patch</code>, <code>del</code> & <code>internal</code> functions are for registering endpoints. They share the same api</summary>
|
|
20
21
|
|
|
21
|
-
|
|
22
22
|
```typescript
|
|
23
23
|
export default get({
|
|
24
24
|
/** The path to the endpoint */
|
|
@@ -139,6 +139,7 @@ async function getDashboardsEndpoint(req: Request<GetDashboardsRequestSchema>):
|
|
|
139
139
|
</details>
|
|
140
140
|
|
|
141
141
|
## Request schema
|
|
142
|
+
|
|
142
143
|
<details>
|
|
143
144
|
<summary>Request schemas can be either a JSON schema or a typescript type</summary>
|
|
144
145
|
When using typescript types as json schemas:
|
|
@@ -202,13 +203,14 @@ export const GetDashboardsRequestSchema = {
|
|
|
202
203
|
},
|
|
203
204
|
};
|
|
204
205
|
```
|
|
206
|
+
|
|
205
207
|
</details>
|
|
206
208
|
|
|
207
209
|
## Response schema
|
|
210
|
+
|
|
208
211
|
<details>
|
|
209
212
|
<summary>Response schemas can be either a JSON schema or a typescript type</summary>
|
|
210
213
|
|
|
211
|
-
|
|
212
214
|
```typescript
|
|
213
215
|
import { DashboardModel } from "../../models/DashboardModel";
|
|
214
216
|
|
|
@@ -216,6 +218,7 @@ export const GET_DASHBOARDS_RESPONSE_SCHEMA = "GetDashboardsResponseSchema";
|
|
|
216
218
|
|
|
217
219
|
export type GetDashboardsResponseSchema = DashboardModel[];
|
|
218
220
|
```
|
|
221
|
+
|
|
219
222
|
</details>
|
|
220
223
|
|
|
221
224
|
## Json schema setup
|
|
@@ -223,13 +226,12 @@ export type GetDashboardsResponseSchema = DashboardModel[];
|
|
|
223
226
|
<details>
|
|
224
227
|
<summary>Using typescript types as json schemas require them to be converted to json schemas during run time. This is done during the service startup. Schemas are cached so that they are only converted once when running tests (that are restarting the service for each test file).</summary>
|
|
225
228
|
|
|
226
|
-
|
|
227
229
|
```typescript
|
|
228
230
|
import { setupApiInterface } from "hiot-api-interface";
|
|
229
231
|
|
|
230
232
|
const started = hiot
|
|
231
233
|
.startApp({ logger, onUncaughtException: handleException, handleException })
|
|
232
|
-
.then((locator)=>{
|
|
234
|
+
.then((locator) => {
|
|
233
235
|
await setupApiInterface({
|
|
234
236
|
port: PORT,
|
|
235
237
|
apiVersion: "v1",
|
|
@@ -241,7 +243,7 @@ const started = hiot
|
|
|
241
243
|
routes();
|
|
242
244
|
|
|
243
245
|
return locator;
|
|
244
|
-
})
|
|
246
|
+
})
|
|
245
247
|
.then(waitFor)
|
|
246
248
|
.then(db)
|
|
247
249
|
.then(shutdown)
|
|
@@ -251,7 +253,6 @@ const started = hiot
|
|
|
251
253
|
|
|
252
254
|
</details>
|
|
253
255
|
|
|
254
|
-
|
|
255
256
|
## routes.ts
|
|
256
257
|
|
|
257
258
|
<details>
|
|
@@ -295,6 +296,7 @@ export default function (server: restify.Server) {
|
|
|
295
296
|
);
|
|
296
297
|
}
|
|
297
298
|
```
|
|
299
|
+
|
|
298
300
|
</details>
|
|
299
301
|
|
|
300
302
|
## Testing
|
|
@@ -302,7 +304,7 @@ export default function (server: restify.Server) {
|
|
|
302
304
|
<details>
|
|
303
305
|
<summary>Testing is done like any other test.</summary>
|
|
304
306
|
|
|
305
|
-
|
|
307
|
+
````typescript
|
|
306
308
|
|
|
307
309
|
### Through sandbox
|
|
308
310
|
|
|
@@ -317,7 +319,7 @@ describe("getDashboardsEndpoint", () => {
|
|
|
317
319
|
// ...
|
|
318
320
|
});
|
|
319
321
|
});
|
|
320
|
-
|
|
322
|
+
````
|
|
321
323
|
|
|
322
324
|
### Directly on handler
|
|
323
325
|
|
|
@@ -351,14 +353,15 @@ The export of the endpoint file is both a function for registering the endpoint
|
|
|
351
353
|
|
|
352
354
|
</details>
|
|
353
355
|
|
|
356
|
+
# Publishing
|
|
354
357
|
|
|
355
|
-
|
|
356
|
-
# Publishing
|
|
357
358
|
Prerequisites:
|
|
359
|
+
|
|
358
360
|
- You have to be part of the @hiotlabs organization on npm
|
|
359
361
|
- You have to be logged in to npm
|
|
360
362
|
|
|
361
363
|
Then, in root, run:
|
|
364
|
+
|
|
362
365
|
```typescript
|
|
363
366
|
// Check out any untracked/ignored files (e.g. previously built files)
|
|
364
367
|
yarn clean
|
|
@@ -373,15 +376,14 @@ yarn build
|
|
|
373
376
|
yarn test
|
|
374
377
|
|
|
375
378
|
// Publish
|
|
376
|
-
npm publish --access
|
|
379
|
+
npm publish --access public
|
|
377
380
|
|
|
378
381
|
// Or pack (for testing)
|
|
379
382
|
npm pack
|
|
380
383
|
```
|
|
381
384
|
|
|
382
|
-
|
|
383
|
-
|
|
384
385
|
# Adding new directories to the project (@hiotlabs/hiot-api-interface)
|
|
386
|
+
|
|
385
387
|
<details>
|
|
386
388
|
|
|
387
389
|
- Create folder
|
|
@@ -407,4 +409,5 @@ npm pack
|
|
|
407
409
|
"utils/**/*.d.ts"
|
|
408
410
|
],
|
|
409
411
|
```
|
|
410
|
-
|
|
412
|
+
|
|
413
|
+
</details>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { setupApiInterface, JsonResponse, del, endpointMetadata, get, getRouteHelpers, head, options, patch, post, put, internal, Method } from "./lib";
|
|
2
|
+
import { Next, Request, Response } from "./lib/models/Http";
|
|
3
|
+
import { User } from "./lib/models/User";
|
|
4
|
+
export { endpointMetadata, del, get, getRouteHelpers, head, options, patch, post, put, internal, setupApiInterface, JsonResponse, Request, Response, Next, Method, User, };
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/// <reference path="../../types/hiot.d.ts" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import App, { Locator } from "hiot";
|
|
5
|
+
import { RouteOptions } from "restify";
|
|
6
|
+
import { Next, Request, Response } from "./models/Http";
|
|
7
|
+
export declare const readDirAsync: typeof fs.readdir.__promisify__;
|
|
8
|
+
export declare enum Method {
|
|
9
|
+
Post = "post",
|
|
10
|
+
Get = "get",
|
|
11
|
+
Put = "put",
|
|
12
|
+
Patch = "patch",
|
|
13
|
+
Del = "del",
|
|
14
|
+
Head = "head",
|
|
15
|
+
Options = "options"
|
|
16
|
+
}
|
|
17
|
+
type OmittedFields = "internal" | "method";
|
|
18
|
+
export declare function get(options: Omit<EndpointOptions, OmittedFields>): {
|
|
19
|
+
(api: App): void;
|
|
20
|
+
/**
|
|
21
|
+
* Makes it possible to access the requestHandler through the exported function.
|
|
22
|
+
* If you need to test the function separately, without starting the server
|
|
23
|
+
*/
|
|
24
|
+
requestHandler: (req: Request<any, any>, res?: Response<any> | undefined, next?: Next | undefined) => Promise<void | JsonResponse<any>>;
|
|
25
|
+
/** Endpoint's full path (including any version number and internal prefix) */
|
|
26
|
+
PATH: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function post(options: Omit<EndpointOptions, OmittedFields>): {
|
|
29
|
+
(api: App): void;
|
|
30
|
+
/**
|
|
31
|
+
* Makes it possible to access the requestHandler through the exported function.
|
|
32
|
+
* If you need to test the function separately, without starting the server
|
|
33
|
+
*/
|
|
34
|
+
requestHandler: (req: Request<any, any>, res?: Response<any> | undefined, next?: Next | undefined) => Promise<void | JsonResponse<any>>;
|
|
35
|
+
/** Endpoint's full path (including any version number and internal prefix) */
|
|
36
|
+
PATH: string;
|
|
37
|
+
};
|
|
38
|
+
export declare function put(options: Omit<EndpointOptions, OmittedFields>): {
|
|
39
|
+
(api: App): void;
|
|
40
|
+
/**
|
|
41
|
+
* Makes it possible to access the requestHandler through the exported function.
|
|
42
|
+
* If you need to test the function separately, without starting the server
|
|
43
|
+
*/
|
|
44
|
+
requestHandler: (req: Request<any, any>, res?: Response<any> | undefined, next?: Next | undefined) => Promise<void | JsonResponse<any>>;
|
|
45
|
+
/** Endpoint's full path (including any version number and internal prefix) */
|
|
46
|
+
PATH: string;
|
|
47
|
+
};
|
|
48
|
+
export declare function patch(options: Omit<EndpointOptions, OmittedFields>): {
|
|
49
|
+
(api: App): void;
|
|
50
|
+
/**
|
|
51
|
+
* Makes it possible to access the requestHandler through the exported function.
|
|
52
|
+
* If you need to test the function separately, without starting the server
|
|
53
|
+
*/
|
|
54
|
+
requestHandler: (req: Request<any, any>, res?: Response<any> | undefined, next?: Next | undefined) => Promise<void | JsonResponse<any>>;
|
|
55
|
+
/** Endpoint's full path (including any version number and internal prefix) */
|
|
56
|
+
PATH: string;
|
|
57
|
+
};
|
|
58
|
+
export declare function del(options: Omit<EndpointOptions, OmittedFields>): {
|
|
59
|
+
(api: App): void;
|
|
60
|
+
/**
|
|
61
|
+
* Makes it possible to access the requestHandler through the exported function.
|
|
62
|
+
* If you need to test the function separately, without starting the server
|
|
63
|
+
*/
|
|
64
|
+
requestHandler: (req: Request<any, any>, res?: Response<any> | undefined, next?: Next | undefined) => Promise<void | JsonResponse<any>>;
|
|
65
|
+
/** Endpoint's full path (including any version number and internal prefix) */
|
|
66
|
+
PATH: string;
|
|
67
|
+
};
|
|
68
|
+
export declare function head(options: Omit<EndpointOptions, OmittedFields>): {
|
|
69
|
+
(api: App): void;
|
|
70
|
+
/**
|
|
71
|
+
* Makes it possible to access the requestHandler through the exported function.
|
|
72
|
+
* If you need to test the function separately, without starting the server
|
|
73
|
+
*/
|
|
74
|
+
requestHandler: (req: Request<any, any>, res?: Response<any> | undefined, next?: Next | undefined) => Promise<void | JsonResponse<any>>;
|
|
75
|
+
/** Endpoint's full path (including any version number and internal prefix) */
|
|
76
|
+
PATH: string;
|
|
77
|
+
};
|
|
78
|
+
export declare function options(options: Omit<EndpointOptions, OmittedFields>): {
|
|
79
|
+
(api: App): void;
|
|
80
|
+
/**
|
|
81
|
+
* Makes it possible to access the requestHandler through the exported function.
|
|
82
|
+
* If you need to test the function separately, without starting the server
|
|
83
|
+
*/
|
|
84
|
+
requestHandler: (req: Request<any, any>, res?: Response<any> | undefined, next?: Next | undefined) => Promise<void | JsonResponse<any>>;
|
|
85
|
+
/** Endpoint's full path (including any version number and internal prefix) */
|
|
86
|
+
PATH: string;
|
|
87
|
+
};
|
|
88
|
+
/** Internal endpoints are not available through the API */
|
|
89
|
+
export declare function internal(options: Omit<EndpointOptions, "internal">): {
|
|
90
|
+
(api: App): void;
|
|
91
|
+
/**
|
|
92
|
+
* Makes it possible to access the requestHandler through the exported function.
|
|
93
|
+
* If you need to test the function separately, without starting the server
|
|
94
|
+
*/
|
|
95
|
+
requestHandler: (req: Request<any, any>, res?: Response<any> | undefined, next?: Next | undefined) => Promise<void | JsonResponse<any>>;
|
|
96
|
+
/** Endpoint's full path (including any version number and internal prefix) */
|
|
97
|
+
PATH: string;
|
|
98
|
+
};
|
|
99
|
+
export interface JsonResponse<T> {
|
|
100
|
+
/** Response body */
|
|
101
|
+
body?: T;
|
|
102
|
+
/** HTTP status code. @default 200 */
|
|
103
|
+
status?: number;
|
|
104
|
+
/** Additional headers */
|
|
105
|
+
headers?: {
|
|
106
|
+
totalcount?: number;
|
|
107
|
+
[key: string]: any;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
export { Next, Request, Response };
|
|
111
|
+
export interface EndpointOptions {
|
|
112
|
+
/** Whether to add the endpoint to the metadata or not. @default true */
|
|
113
|
+
addToMetadata?: boolean;
|
|
114
|
+
/** Whether the endpoint is internal or not */
|
|
115
|
+
internal?: boolean;
|
|
116
|
+
/** The path to the endpoint */
|
|
117
|
+
path: string;
|
|
118
|
+
/** The activity that is required to access this endpoint */
|
|
119
|
+
authorized?: string;
|
|
120
|
+
/** Whether you need to be logged in or not to access the endpoint. Only needed if authorized is not used. */
|
|
121
|
+
authenticated?: boolean;
|
|
122
|
+
/** HTTP method */
|
|
123
|
+
method: Method;
|
|
124
|
+
/**
|
|
125
|
+
* The request schema, either a JSON schema or the name of a typescript type
|
|
126
|
+
* (See below. The name must match the name of the file in ./api/schemas).
|
|
127
|
+
**/
|
|
128
|
+
requestSchema?: object | string;
|
|
129
|
+
/** Additional route options */
|
|
130
|
+
opts?: RouteOptions;
|
|
131
|
+
/** prefix for the path, e.g. /v1, defaults to what was set in setupApiInterface */
|
|
132
|
+
version?: string;
|
|
133
|
+
/** The documentation for the endpoint */
|
|
134
|
+
documentation?: {
|
|
135
|
+
/** Short description of the endpoint */
|
|
136
|
+
summary: string;
|
|
137
|
+
/** Long description of the endpoint */
|
|
138
|
+
description?: string;
|
|
139
|
+
/** Optional array of tags */
|
|
140
|
+
tags?: string[];
|
|
141
|
+
/**
|
|
142
|
+
* Optional description for query params (can also be defined and described in the json schema,
|
|
143
|
+
* since that's how we validate them)
|
|
144
|
+
**/
|
|
145
|
+
query?: Record<string, string>;
|
|
146
|
+
/**
|
|
147
|
+
* Optional description of url parameters.
|
|
148
|
+
* Usually unnecessary since url params should be self descriptive, e.g. /dashboards/:dashboardId
|
|
149
|
+
**/
|
|
150
|
+
parameters?: Record<string, string>;
|
|
151
|
+
/** Response schemas */
|
|
152
|
+
responses?: {
|
|
153
|
+
/** HTTP status code */
|
|
154
|
+
status: number;
|
|
155
|
+
/** An optional description of the response */
|
|
156
|
+
description?: string;
|
|
157
|
+
/**
|
|
158
|
+
* An optional response schema, either a JSON schema or the name of a typescript type
|
|
159
|
+
* (See below. The name must match the name of the file in ./api/schemas).
|
|
160
|
+
**/
|
|
161
|
+
schema?: any | any[];
|
|
162
|
+
}[];
|
|
163
|
+
};
|
|
164
|
+
/** The request handler function */
|
|
165
|
+
requestHandler: (req: Request<any>, res?: Response<any>, next?: Next) => Promise<JsonResponse<any> | void>;
|
|
166
|
+
}
|
|
167
|
+
export type EndpointMetadata = Omit<EndpointOptions, "requestHandler" | "opts">;
|
|
168
|
+
export declare const endpointMetadata: {
|
|
169
|
+
[key in Method]: Record<string, EndpointMetadata>;
|
|
170
|
+
};
|
|
171
|
+
export declare function getRouteHelpers(): {
|
|
172
|
+
authenticated: () => App.RequestHandlerType;
|
|
173
|
+
authorized: (activity: string) => App.RequestHandlerType;
|
|
174
|
+
};
|
|
175
|
+
export interface ApiInterfaceOptions {
|
|
176
|
+
/** Name of the service */
|
|
177
|
+
serviceName: string;
|
|
178
|
+
/** Default log level for the service */
|
|
179
|
+
serviceLogLevel: string;
|
|
180
|
+
/** Whether to use typescript or not */
|
|
181
|
+
typescript: boolean;
|
|
182
|
+
/** Global version of the API @default v1. Can be overridden per endpoint */
|
|
183
|
+
apiVersion: string;
|
|
184
|
+
/** The base path to the schemas. @default api/schemas */
|
|
185
|
+
schemaBasePath?: string;
|
|
186
|
+
}
|
|
187
|
+
export declare function getApiOptions(): ApiInterfaceOptions;
|
|
188
|
+
export declare function setupApiInterface(options: ApiInterfaceOptions): (locator: Locator) => Promise<App.Locator>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { User } from "./User";
|
|
2
|
+
import { Request as RestifyRequest, Response as RestifyResponse, Next as RestifyNext } from "restify";
|
|
3
|
+
export interface Request<BodyParams = Record<string, any>, QueryParams = any> extends RestifyRequest {
|
|
4
|
+
params: BodyParams;
|
|
5
|
+
user: User;
|
|
6
|
+
query: QueryParams;
|
|
7
|
+
}
|
|
8
|
+
export interface Next extends RestifyNext {
|
|
9
|
+
(err?: any): void;
|
|
10
|
+
}
|
|
11
|
+
export interface Response<Body = Record<string, any>> extends RestifyResponse {
|
|
12
|
+
/**
|
|
13
|
+
* short hand method for:
|
|
14
|
+
* res.contentType = 'json';
|
|
15
|
+
* res.send({hello: 'world'});
|
|
16
|
+
* @param code http status code
|
|
17
|
+
* @param body value to json.stringify
|
|
18
|
+
* @param [headers] headers to set on the response
|
|
19
|
+
*/
|
|
20
|
+
json(code: number, body: Body, headers?: {
|
|
21
|
+
[header: string]: string;
|
|
22
|
+
}): any;
|
|
23
|
+
/**
|
|
24
|
+
* short hand method for:
|
|
25
|
+
* res.contentType = 'json';
|
|
26
|
+
* res.send({hello: 'world'});
|
|
27
|
+
* @param code http status code
|
|
28
|
+
*/
|
|
29
|
+
json(code: number): any;
|
|
30
|
+
/**
|
|
31
|
+
* short hand method for:
|
|
32
|
+
* res.contentType = 'json';
|
|
33
|
+
* res.send({hello: 'world'});
|
|
34
|
+
* @param body value to json.stringify
|
|
35
|
+
* @param [headers] headers to set on the response
|
|
36
|
+
*/
|
|
37
|
+
json(body: Body, headers?: {
|
|
38
|
+
[header: string]: string;
|
|
39
|
+
}): any;
|
|
40
|
+
/**
|
|
41
|
+
* sends the response object. pass through to internal __send that uses a
|
|
42
|
+
* formatter based on the content-type header.
|
|
43
|
+
* @param [code] http status code
|
|
44
|
+
* @param [body] the content to send
|
|
45
|
+
* @param [headers] any add'l headers to set
|
|
46
|
+
* @returns the response object
|
|
47
|
+
*/
|
|
48
|
+
send(code?: number, body?: Body, headers?: {
|
|
49
|
+
[header: string]: string;
|
|
50
|
+
}): any;
|
|
51
|
+
/**
|
|
52
|
+
* sends the response object. pass through to internal __send that uses a
|
|
53
|
+
* formatter based on the content-type header.
|
|
54
|
+
* @param [body] the content to send
|
|
55
|
+
* @param [headers] any add'l headers to set
|
|
56
|
+
* @returns the response object
|
|
57
|
+
*/
|
|
58
|
+
send(body?: Body, headers?: {
|
|
59
|
+
[header: string]: string;
|
|
60
|
+
}): any;
|
|
61
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EndpointOptions } from "..";
|
|
2
|
+
/** Speeds up loading schemas when testing by only loading the schemas once instead of once per test file */
|
|
3
|
+
export declare const schemaCache: Map<string, object>;
|
|
4
|
+
export declare function getSchemas(schemaNames: string[]): void;
|
|
5
|
+
export declare function getSchema(schemaName: string): object | undefined;
|
|
6
|
+
export declare function prepareResponseSchemas(options: EndpointOptions): object[];
|
|
7
|
+
export declare function validateResponseBody(schemas: object[], body: object): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function route(version: string, path: string, internal?: boolean): string;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,kBAKC;AAED,oBAKC;AAED,kBAKC;AAED,sBAKC;AAED,kBAKC;AAYD,4BAEC;AAgXD,sCAEC;AAED,8C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AAA,EAAE,IAAI,MAAA,EAAE,mBAAmB,qBAAA,EAAE,cAAc,gBAAA,EAAE,CAAC,EAAA;;oBAAtF,WAAS,SAA6E;oBAE5F,IAAI,8BAA8B,EAAE,CAAC;wBACnC,wBAAwB,EAAE,CAAC;oBAC7B,CAAC;oBAED,sBAAO,QAAM,EAAC;;;;;CAEjB"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@pgds/api-interface",
|
|
3
3
|
"description": "Api interface for pgds services",
|
|
4
4
|
"authors": "Florry",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.6",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "types/",
|
|
8
8
|
"scripts": {
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@types/restify": "^8.5.12",
|
|
36
36
|
"@types/restify-errors": "^4.3.9",
|
|
37
|
-
"@types/mongodb": "4.0.0",
|
|
38
37
|
"ajv": "8.17.1",
|
|
39
38
|
"ajv-formats": "3.0.1",
|
|
40
39
|
"axios": "1.7.9",
|
|
@@ -101,4 +100,4 @@
|
|
|
101
100
|
"**/*.js.map"
|
|
102
101
|
]
|
|
103
102
|
}
|
|
104
|
-
}
|
|
103
|
+
}
|