@kravc/dos 1.10.6 → 1.11.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/package.json +1 -1
- package/src/Service.spec.js +1 -1
- package/src/helpers/logRequest.js +1 -1
- package/src/index.d.ts +31 -6
- package/src/index.js +6 -2
package/package.json
CHANGED
package/src/Service.spec.js
CHANGED
|
@@ -10,8 +10,8 @@ const UpdateProfile = require('examples/UpdateProfile')
|
|
|
10
10
|
const DeleteProfile = require('examples/DeleteProfile')
|
|
11
11
|
const IndexProfiles = require('examples/IndexProfiles')
|
|
12
12
|
|
|
13
|
+
const test = require('src/test')
|
|
13
14
|
const {
|
|
14
|
-
test,
|
|
15
15
|
errors,
|
|
16
16
|
Create,
|
|
17
17
|
Service,
|
package/src/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export declare type QueryMap = Record<string, any>;
|
|
|
6
6
|
export declare type CreateMutationMap = Record<string, any>;
|
|
7
7
|
export declare type UpdateMutationMap = Record<string, any>;
|
|
8
8
|
export declare type AttributesMap = Record<string, any>;
|
|
9
|
+
export declare type OperationParameters = Record<string, unknown>;
|
|
10
|
+
export declare type Headers = Record<string, string>;
|
|
9
11
|
|
|
10
12
|
export declare interface IndexOptions {
|
|
11
13
|
sort?: SortOrder;
|
|
@@ -31,7 +33,7 @@ export declare class Document<T> {
|
|
|
31
33
|
static get idKeyPrefix(): string;
|
|
32
34
|
static get documentName(): string;
|
|
33
35
|
|
|
34
|
-
static set schema(schema: Schema)
|
|
36
|
+
static set schema(schema: Schema);
|
|
35
37
|
static get schema(): Schema;
|
|
36
38
|
|
|
37
39
|
static _read(query: QueryMap): Promise<AttributesMap>;
|
|
@@ -158,7 +160,6 @@ export declare class JwtAuthorization {
|
|
|
158
160
|
static createRequirement(options: {
|
|
159
161
|
publicKey: string;
|
|
160
162
|
name?: string;
|
|
161
|
-
publicKey?: string;
|
|
162
163
|
algorithm?: string;
|
|
163
164
|
cookieName?: string;
|
|
164
165
|
normalizePayload?: Function;
|
|
@@ -170,7 +171,7 @@ export declare class JwtAuthorization {
|
|
|
170
171
|
export declare class SystemAuthorization {
|
|
171
172
|
static createRequirement(options?: {
|
|
172
173
|
name?: string;
|
|
173
|
-
}
|
|
174
|
+
}): Record<string, any>
|
|
174
175
|
};
|
|
175
176
|
|
|
176
177
|
type ComponentConstructor = new (...args: any[]) => any;
|
|
@@ -218,13 +219,13 @@ interface IRequest {
|
|
|
218
219
|
url: string;
|
|
219
220
|
body?: string | Record<string, unknown>;
|
|
220
221
|
method: string;
|
|
221
|
-
headers:
|
|
222
|
+
headers: Headers;
|
|
222
223
|
operationId?: string;
|
|
223
224
|
};
|
|
224
225
|
|
|
225
226
|
interface IResponse {
|
|
226
227
|
body?: string,
|
|
227
|
-
headers:
|
|
228
|
+
headers: Headers,
|
|
228
229
|
statusCode: number,
|
|
229
230
|
}
|
|
230
231
|
|
|
@@ -238,5 +239,29 @@ export declare class Service {
|
|
|
238
239
|
get spec(): ISpec;
|
|
239
240
|
get baseUrl(): string;
|
|
240
241
|
|
|
241
|
-
|
|
242
|
+
handler(request: IRequest, Context): Promise<IResponse>;
|
|
242
243
|
}
|
|
244
|
+
|
|
245
|
+
export declare function createAccessToken(
|
|
246
|
+
options: Record<string, string>,
|
|
247
|
+
payload: Record<string, unknown>
|
|
248
|
+
): string;
|
|
249
|
+
|
|
250
|
+
export declare function wait(ms: number): Promise<void>;
|
|
251
|
+
|
|
252
|
+
export type Data = Record<string, unknown>[] | Record<string, unknown>;
|
|
253
|
+
|
|
254
|
+
interface ExecutionResult {
|
|
255
|
+
error?: {
|
|
256
|
+
code: string,
|
|
257
|
+
message: string,
|
|
258
|
+
}
|
|
259
|
+
data?: Data,
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export declare function execute(service: Service):
|
|
263
|
+
(
|
|
264
|
+
operationId: string,
|
|
265
|
+
parameters: OperationParameters,
|
|
266
|
+
headers: Headers
|
|
267
|
+
) => { statusCode: number, result: ExecutionResult };
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { wait, execute, createAccessToken } = require('./test')
|
|
4
|
+
|
|
3
5
|
module.exports = {
|
|
4
6
|
Document: require('./Document'),
|
|
5
7
|
Operation: require('./Operation'),
|
|
@@ -11,11 +13,13 @@ module.exports = {
|
|
|
11
13
|
Delete: require('./operations/Delete'),
|
|
12
14
|
Component: require('./Component'),
|
|
13
15
|
errors: require('./errors'),
|
|
14
|
-
test: require('./test'),
|
|
15
16
|
handler: require('./helpers/handler'),
|
|
16
17
|
security: require('./security'),
|
|
17
18
|
getOrFail: require('./helpers/getOrFail'),
|
|
18
19
|
verifyToken: require('./security/verifyToken'),
|
|
19
20
|
JwtAuthorization: require('./security/JwtAuthorization'),
|
|
20
|
-
SystemAuthorization: require('./security/SystemAuthorization')
|
|
21
|
+
SystemAuthorization: require('./security/SystemAuthorization'),
|
|
22
|
+
wait,
|
|
23
|
+
execute,
|
|
24
|
+
createAccessToken,
|
|
21
25
|
}
|