@kravc/dos 1.12.0 → 1.12.2
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 +2 -2
- package/src/Document.js +4 -4
- package/src/index.d.ts +34 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kravc/dos",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.2",
|
|
4
4
|
"description": "Convention-based, easy-to-use library for building API-driven serverless services.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Service",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"author": "Alexander Kravets <a@kra.vc>",
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@kravc/schema": "^2.7.
|
|
28
|
+
"@kravc/schema": "^2.7.6",
|
|
29
29
|
"cookie": "^1.0.1",
|
|
30
30
|
"js-yaml": "^4.1.0",
|
|
31
31
|
"jsonwebtoken": "^9.0.2",
|
package/src/Document.js
CHANGED
|
@@ -221,14 +221,14 @@ class Document extends Component {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
static async delete(context, query) {
|
|
224
|
-
if (this.beforeDelete) {
|
|
225
|
-
await this.beforeDelete(context, query)
|
|
226
|
-
}
|
|
227
|
-
|
|
228
224
|
/* NOTE: ensure that document to be removed exists and save it in the
|
|
229
225
|
context so can be referenced in the after action helper */
|
|
230
226
|
const originalDocument = await this.read(context, query)
|
|
231
227
|
|
|
228
|
+
if (this.beforeDelete) {
|
|
229
|
+
await this.beforeDelete(context, query, originalDocument)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
232
|
this._extendWithPartition(context, query)
|
|
233
233
|
|
|
234
234
|
await this._delete(context, query)
|
package/src/index.d.ts
CHANGED
|
@@ -104,36 +104,37 @@ export declare class Document<T> {
|
|
|
104
104
|
mutation: CreateMutationMap
|
|
105
105
|
): Promise<void>;
|
|
106
106
|
|
|
107
|
-
static afterCreate<T, D extends Document<T> = Document<T>>(
|
|
108
|
-
context: Context,
|
|
109
|
-
query: QueryMap,
|
|
110
|
-
mutation: CreateMutationMap,
|
|
111
|
-
originalDocument: D
|
|
112
|
-
): Promise<void>;
|
|
113
|
-
|
|
114
107
|
static beforeUpdate(
|
|
115
108
|
context: Context,
|
|
116
109
|
query: QueryMap,
|
|
117
110
|
mutation: UpdateMutationMap,
|
|
118
111
|
): Promise<void>;
|
|
119
112
|
|
|
120
|
-
static
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
113
|
+
// static beforeDelete<T, D extends Document<T> = Document<T>>(
|
|
114
|
+
// context: Context,
|
|
115
|
+
// query: QueryMap,
|
|
116
|
+
// originalDocument: D
|
|
117
|
+
// ): Promise<void>;
|
|
118
|
+
|
|
119
|
+
// static afterCreate<T, D extends Document<T> = Document<T>>(
|
|
120
|
+
// context: Context,
|
|
121
|
+
// query: QueryMap,
|
|
122
|
+
// mutation: CreateMutationMap,
|
|
123
|
+
// originalDocument: D
|
|
124
|
+
// ): Promise<void>;
|
|
125
|
+
|
|
126
|
+
// static afterUpdate<T, D extends Document<T> = Document<T>>(
|
|
127
|
+
// context: Context,
|
|
128
|
+
// query: QueryMap,
|
|
129
|
+
// mutation: UpdateMutationMap,
|
|
130
|
+
// originalDocument: D
|
|
131
|
+
// ): Promise<void>;
|
|
132
|
+
|
|
133
|
+
// static afterDelete<T, D extends Document<T> = Document<T>>(
|
|
134
|
+
// context: Context,
|
|
135
|
+
// query: QueryMap,
|
|
136
|
+
// originalDocument: D
|
|
137
|
+
// ): Promise<void>;
|
|
137
138
|
|
|
138
139
|
get id(): string;
|
|
139
140
|
get context(): Context;
|
|
@@ -172,14 +173,14 @@ export declare class JwtAuthorization {
|
|
|
172
173
|
tokenVerificationMethod?: Function;
|
|
173
174
|
accessVerificationMethod?: (context: Context, payload: Record<string, unknown>) => [boolean, string?];
|
|
174
175
|
}): Record<string, any>
|
|
175
|
-
}
|
|
176
|
+
}
|
|
176
177
|
|
|
177
178
|
export declare class SystemAuthorization {
|
|
178
179
|
static createRequirement(options?: {
|
|
179
180
|
name?: string;
|
|
180
181
|
accessVerificationMethod?: (context: Context) => [boolean, string?];
|
|
181
182
|
}): Record<string, any>
|
|
182
|
-
}
|
|
183
|
+
}
|
|
183
184
|
|
|
184
185
|
export type ComponentConstructor = new (...args: any[]) => any;
|
|
185
186
|
type OperationConstructor = new (...args: any[]) => any;
|
|
@@ -306,31 +307,31 @@ export declare class CommonError extends Error {
|
|
|
306
307
|
constructor(code: string, message: string);
|
|
307
308
|
get code(): string;
|
|
308
309
|
get isCommonError(): boolean;
|
|
309
|
-
}
|
|
310
|
+
}
|
|
310
311
|
|
|
311
312
|
export declare class UnauthorizedError extends CommonError {
|
|
312
313
|
constructor(message: string);
|
|
313
|
-
}
|
|
314
|
+
}
|
|
314
315
|
|
|
315
316
|
export declare class AccessDeniedError extends CommonError {
|
|
316
317
|
constructor(message: string);
|
|
317
|
-
}
|
|
318
|
+
}
|
|
318
319
|
|
|
319
320
|
export declare class InvalidParametersError extends CommonError {
|
|
320
321
|
constructor(message: string)
|
|
321
|
-
}
|
|
322
|
+
}
|
|
322
323
|
|
|
323
324
|
export declare class UnprocessibleConditionError extends CommonError {
|
|
324
325
|
constructor(message: string)
|
|
325
|
-
}
|
|
326
|
+
}
|
|
326
327
|
|
|
327
328
|
export declare class DocumentExistsError extends CommonError {
|
|
328
329
|
constructor(Document: { name: string }, parameters: Record<string, unknown>);
|
|
329
|
-
}
|
|
330
|
+
}
|
|
330
331
|
|
|
331
332
|
export declare class DocumentNotFoundError extends CommonError {
|
|
332
333
|
constructor(Document: { name: string }, parameters: Record<string, unknown>);
|
|
333
|
-
}
|
|
334
|
+
}
|
|
334
335
|
|
|
335
336
|
interface Identity {
|
|
336
337
|
sub: string;
|