@adminforth/crud-approve-plugin 1.0.14 → 1.0.16
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/custom/ListPageDiffView.vue +1 -1
- package/custom/ShowPageDiffView.vue +1 -1
- package/dist/custom/ListPageDiffView.vue +1 -1
- package/dist/custom/ShowPageDiffView.vue +1 -1
- package/dist/index.js +7 -0
- package/index.ts +7 -0
- package/package.json +3 -3
- package/pnpm-workspace.yaml +4 -0
- package/build.log +0 -15
|
@@ -22,7 +22,7 @@ const diffFile = ref();
|
|
|
22
22
|
async function sendApproveRequest(approved) {
|
|
23
23
|
let code = '123456'
|
|
24
24
|
if (approved) {
|
|
25
|
-
code = await (window).adminforthTwoFaModal
|
|
25
|
+
code = await (window).adminforthTwoFaModal?.get2FaConfirmationResult?.("Approve Action Confirmation");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const data = await callAdminForthApi({
|
|
@@ -24,7 +24,7 @@ const diffFile = ref();
|
|
|
24
24
|
async function sendApproveRequest(approved) {
|
|
25
25
|
let code = '123456'
|
|
26
26
|
if (approved) {
|
|
27
|
-
code = await (window).adminforthTwoFaModal
|
|
27
|
+
code = await (window).adminforthTwoFaModal?.get2FaConfirmationResult?.("Approve Action Confirmation");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const data = await callAdminForthApi({
|
|
@@ -22,7 +22,7 @@ const diffFile = ref();
|
|
|
22
22
|
async function sendApproveRequest(approved) {
|
|
23
23
|
let code = '123456'
|
|
24
24
|
if (approved) {
|
|
25
|
-
code = await (window).adminforthTwoFaModal
|
|
25
|
+
code = await (window).adminforthTwoFaModal?.get2FaConfirmationResult?.("Approve Action Confirmation");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const data = await callAdminForthApi({
|
|
@@ -24,7 +24,7 @@ const diffFile = ref();
|
|
|
24
24
|
async function sendApproveRequest(approved) {
|
|
25
25
|
let code = '123456'
|
|
26
26
|
if (approved) {
|
|
27
|
-
code = await (window).adminforthTwoFaModal
|
|
27
|
+
code = await (window).adminforthTwoFaModal?.get2FaConfirmationResult?.("Approve Action Confirmation");
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const data = await callAdminForthApi({
|
package/dist/index.js
CHANGED
|
@@ -293,6 +293,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
293
293
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, response, cookies }) {
|
|
294
294
|
const authRes = yield this.verifyAuth(cookies);
|
|
295
295
|
if (authRes.error) {
|
|
296
|
+
//@ts-ignore
|
|
296
297
|
response.status = 403;
|
|
297
298
|
return { error: authRes.error };
|
|
298
299
|
}
|
|
@@ -300,10 +301,12 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
300
301
|
const { resourceId, diffId, recordId, action, approved, code } = body;
|
|
301
302
|
const diffRecord = yield this.adminforth.resource(this.diffResource.resourceId).get(Filters.EQ(this.options.resourceColumns.idColumnName, diffId));
|
|
302
303
|
if (!diffRecord) {
|
|
304
|
+
//@ts-ignore
|
|
303
305
|
response.status = 404;
|
|
304
306
|
return { error: 'Diff record not found' };
|
|
305
307
|
}
|
|
306
308
|
if (diffRecord[this.options.resourceColumns.statusColumnName] !== ApprovalStatusEnum.pending) {
|
|
309
|
+
//@ts-ignore
|
|
307
310
|
response.status = 400;
|
|
308
311
|
return { error: 'Diff record is not pending' };
|
|
309
312
|
}
|
|
@@ -320,6 +323,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
320
323
|
}
|
|
321
324
|
beforeSaveResp = yield this.callBeforeSaveHooks(resource, action, diffData['newRecord'], adminUser, diffRecord[this.options.resourceColumns.recordIdColumnName], diffData['newRecord'], oldRecord, this.adminforth, extra);
|
|
322
325
|
if (beforeSaveResp.error && beforeSaveResp.error !== 'Operation aborted by hook') {
|
|
326
|
+
//@ts-ignore
|
|
323
327
|
response.status = 500;
|
|
324
328
|
return { error: `Failed to apply approved changes: ${beforeSaveResp.error}` };
|
|
325
329
|
}
|
|
@@ -336,6 +340,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
336
340
|
recordUpdateResult = yield this.deleteRecord(resource, diffRecord[this.options.resourceColumns.recordIdColumnName], connector);
|
|
337
341
|
}
|
|
338
342
|
if (recordUpdateResult === null || recordUpdateResult === void 0 ? void 0 : recordUpdateResult.error) {
|
|
343
|
+
//@ts-ignore
|
|
339
344
|
response.status = 500;
|
|
340
345
|
console.error('Error applying approved changes:', recordUpdateResult);
|
|
341
346
|
return { error: `Failed to apply approved changes: ${recordUpdateResult.error}` };
|
|
@@ -361,6 +366,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
361
366
|
{}, diffData['oldRecord'], this.adminforth, { body });
|
|
362
367
|
}
|
|
363
368
|
if (afterSaveResp === null || afterSaveResp === void 0 ? void 0 : afterSaveResp.error) {
|
|
369
|
+
//@ts-ignore
|
|
364
370
|
response.status = 500;
|
|
365
371
|
return { error: `Failed to apply approved changes: ${afterSaveResp.error}` };
|
|
366
372
|
}
|
|
@@ -383,6 +389,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
383
389
|
}
|
|
384
390
|
});
|
|
385
391
|
if (r.error) {
|
|
392
|
+
//@ts-ignore
|
|
386
393
|
response.status = 500;
|
|
387
394
|
return { error: `Failed to update diff record status: ${r.error}` };
|
|
388
395
|
}
|
package/index.ts
CHANGED
|
@@ -329,6 +329,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
329
329
|
handler: async ({ body, response, cookies }) => {
|
|
330
330
|
const authRes = await this.verifyAuth(cookies);
|
|
331
331
|
if (authRes.error) {
|
|
332
|
+
//@ts-ignore
|
|
332
333
|
response.status = 403;
|
|
333
334
|
return { error: authRes.error };
|
|
334
335
|
}
|
|
@@ -339,11 +340,13 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
339
340
|
Filters.EQ(this.options.resourceColumns.idColumnName, diffId),
|
|
340
341
|
)
|
|
341
342
|
if (!diffRecord) {
|
|
343
|
+
//@ts-ignore
|
|
342
344
|
response.status = 404;
|
|
343
345
|
return { error: 'Diff record not found' };
|
|
344
346
|
}
|
|
345
347
|
|
|
346
348
|
if (diffRecord[this.options.resourceColumns.statusColumnName] !== ApprovalStatusEnum.pending) {
|
|
349
|
+
//@ts-ignore
|
|
347
350
|
response.status = 400;
|
|
348
351
|
return { error: 'Diff record is not pending' };
|
|
349
352
|
}
|
|
@@ -368,6 +371,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
368
371
|
diffData['newRecord'], oldRecord, this.adminforth, extra
|
|
369
372
|
);
|
|
370
373
|
if (beforeSaveResp.error && beforeSaveResp.error !== 'Operation aborted by hook') {
|
|
374
|
+
//@ts-ignore
|
|
371
375
|
response.status = 500;
|
|
372
376
|
return { error: `Failed to apply approved changes: ${beforeSaveResp.error}` };
|
|
373
377
|
}
|
|
@@ -388,6 +392,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
388
392
|
);
|
|
389
393
|
}
|
|
390
394
|
if (recordUpdateResult?.error) {
|
|
395
|
+
//@ts-ignore
|
|
391
396
|
response.status = 500;
|
|
392
397
|
console.error('Error applying approved changes:', recordUpdateResult);
|
|
393
398
|
return { error: `Failed to apply approved changes: ${recordUpdateResult.error}` };
|
|
@@ -423,6 +428,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
423
428
|
}
|
|
424
429
|
|
|
425
430
|
if (afterSaveResp?.error) {
|
|
431
|
+
//@ts-ignore
|
|
426
432
|
response.status = 500;
|
|
427
433
|
return { error: `Failed to apply approved changes: ${afterSaveResp.error}` };
|
|
428
434
|
}
|
|
@@ -445,6 +451,7 @@ export default class CRUDApprovePlugin extends AdminForthPlugin {
|
|
|
445
451
|
}
|
|
446
452
|
});
|
|
447
453
|
if (r.error) {
|
|
454
|
+
//@ts-ignore
|
|
448
455
|
response.status = 500;
|
|
449
456
|
return { error: `Failed to update diff record status: ${r.error}` };
|
|
450
457
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/crud-approve-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -20,11 +20,10 @@
|
|
|
20
20
|
"license": "ISC",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@adminforth/two-factors-auth": "^2.10.4",
|
|
23
|
-
"adminforth": "next",
|
|
24
23
|
"dayjs": "^1.11.11"
|
|
25
24
|
},
|
|
26
25
|
"peerDependencies": {
|
|
27
|
-
"adminforth": "^
|
|
26
|
+
"adminforth": "^3.1.2"
|
|
28
27
|
},
|
|
29
28
|
"release": {
|
|
30
29
|
"plugins": [
|
|
@@ -53,6 +52,7 @@
|
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
54
|
"@types/node": "^22.10.7",
|
|
55
|
+
"adminforth": "^3.1.2",
|
|
56
56
|
"semantic-release": "^24.2.1",
|
|
57
57
|
"semantic-release-slack-bot": "^4.0.2",
|
|
58
58
|
"typescript": "^5.7.3"
|
package/build.log
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @adminforth/crud-approve-plugin@1.0.13 build
|
|
3
|
-
> tsc && rsync -av --exclude 'node_modules' custom dist/
|
|
4
|
-
|
|
5
|
-
sending incremental file list
|
|
6
|
-
custom/
|
|
7
|
-
custom/ListPageDiffView.vue
|
|
8
|
-
custom/ShowPageDiffView.vue
|
|
9
|
-
custom/package-lock.json
|
|
10
|
-
custom/package.json
|
|
11
|
-
custom/pnpm-lock.yaml
|
|
12
|
-
custom/tsconfig.json
|
|
13
|
-
|
|
14
|
-
sent 32,973 bytes received 134 bytes 66,214.00 bytes/sec
|
|
15
|
-
total size is 32,471 speedup is 0.98
|