@vertebr/admin 0.9.0 → 0.11.0
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/database/connector.d.ts.map +1 -1
- package/dist/database/connector.js +45 -2
- package/dist/database/connector.js.map +1 -1
- package/dist/database/types.d.ts +5 -0
- package/dist/database/types.d.ts.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/api/adapters/express.d.ts +10 -0
- package/dist/runtime/api/adapters/express.d.ts.map +1 -0
- package/dist/runtime/api/adapters/express.js +86 -0
- package/dist/runtime/api/adapters/express.js.map +1 -0
- package/dist/runtime/api/adapters/fastify.d.ts +31 -0
- package/dist/runtime/api/adapters/fastify.d.ts.map +1 -0
- package/dist/runtime/api/adapters/fastify.js +85 -0
- package/dist/runtime/api/adapters/fastify.js.map +1 -0
- package/dist/runtime/api/adapters/hapi.d.ts +6 -0
- package/dist/runtime/api/adapters/hapi.d.ts.map +1 -0
- package/dist/runtime/api/adapters/hapi.js +45 -0
- package/dist/runtime/api/adapters/hapi.js.map +1 -0
- package/dist/runtime/api/adapters/shared.d.ts +17 -0
- package/dist/runtime/api/adapters/shared.d.ts.map +1 -0
- package/dist/runtime/api/adapters/shared.js +37 -0
- package/dist/runtime/api/adapters/shared.js.map +1 -0
- package/dist/runtime/api/audit.d.ts +8 -0
- package/dist/runtime/api/audit.d.ts.map +1 -0
- package/dist/runtime/api/audit.js +30 -0
- package/dist/runtime/api/audit.js.map +1 -0
- package/dist/runtime/api/catalog.d.ts +42 -2
- package/dist/runtime/api/catalog.d.ts.map +1 -1
- package/dist/runtime/api/catalog.js +142 -83
- package/dist/runtime/api/catalog.js.map +1 -1
- package/dist/runtime/api/configs.d.ts +16 -0
- package/dist/runtime/api/configs.d.ts.map +1 -1
- package/dist/runtime/api/configs.js +145 -5
- package/dist/runtime/api/configs.js.map +1 -1
- package/dist/runtime/api/health.d.ts +7 -0
- package/dist/runtime/api/health.d.ts.map +1 -0
- package/dist/runtime/api/health.js +21 -0
- package/dist/runtime/api/health.js.map +1 -0
- package/dist/runtime/api/jobs.d.ts +12 -0
- package/dist/runtime/api/jobs.d.ts.map +1 -0
- package/dist/runtime/api/jobs.js +34 -0
- package/dist/runtime/api/jobs.js.map +1 -0
- package/dist/runtime/api/metrics.d.ts.map +1 -1
- package/dist/runtime/api/metrics.js +2 -0
- package/dist/runtime/api/metrics.js.map +1 -1
- package/dist/runtime/api/public.d.ts.map +1 -1
- package/dist/runtime/api/public.js +2 -1
- package/dist/runtime/api/public.js.map +1 -1
- package/dist/runtime/api/resources.d.ts +29 -0
- package/dist/runtime/api/resources.d.ts.map +1 -1
- package/dist/runtime/api/resources.js +247 -7
- package/dist/runtime/api/resources.js.map +1 -1
- package/dist/runtime/api/revisions.d.ts +35 -0
- package/dist/runtime/api/revisions.d.ts.map +1 -0
- package/dist/runtime/api/revisions.js +174 -0
- package/dist/runtime/api/revisions.js.map +1 -0
- package/dist/runtime/api/routes.d.ts +2 -5
- package/dist/runtime/api/routes.d.ts.map +1 -1
- package/dist/runtime/api/routes.js +51 -40
- package/dist/runtime/api/routes.js.map +1 -1
- package/dist/runtime/api/sync.d.ts.map +1 -1
- package/dist/runtime/api/sync.js +32 -2
- package/dist/runtime/api/sync.js.map +1 -1
- package/dist/runtime/createAdmin.d.ts.map +1 -1
- package/dist/runtime/createAdmin.js +45 -1
- package/dist/runtime/createAdmin.js.map +1 -1
- package/dist/runtime/errors.d.ts +8 -0
- package/dist/runtime/errors.d.ts.map +1 -1
- package/dist/runtime/errors.js +17 -1
- package/dist/runtime/errors.js.map +1 -1
- package/dist/runtime/services/access.d.ts +14 -0
- package/dist/runtime/services/access.d.ts.map +1 -0
- package/dist/runtime/services/access.js +49 -0
- package/dist/runtime/services/access.js.map +1 -0
- package/dist/runtime/services/audit.d.ts +16 -0
- package/dist/runtime/services/audit.d.ts.map +1 -0
- package/dist/runtime/services/audit.js +43 -0
- package/dist/runtime/services/audit.js.map +1 -0
- package/dist/runtime/services/environment.d.ts +4 -1
- package/dist/runtime/services/environment.d.ts.map +1 -1
- package/dist/runtime/services/environment.js +16 -2
- package/dist/runtime/services/environment.js.map +1 -1
- package/dist/runtime/services/state.d.ts +11 -1
- package/dist/runtime/services/state.d.ts.map +1 -1
- package/dist/runtime/types/access.d.ts +28 -0
- package/dist/runtime/types/access.d.ts.map +1 -0
- package/dist/runtime/types/access.js +3 -0
- package/dist/runtime/types/access.js.map +1 -0
- package/dist/runtime/types/actions.d.ts +2 -0
- package/dist/runtime/types/actions.d.ts.map +1 -1
- package/dist/runtime/types/addon.d.ts +9 -1
- package/dist/runtime/types/addon.d.ts.map +1 -1
- package/dist/runtime/types/addon.js.map +1 -1
- package/dist/runtime/types/admin.d.ts +29 -0
- package/dist/runtime/types/admin.d.ts.map +1 -1
- package/dist/runtime/types/audit.d.ts +35 -0
- package/dist/runtime/types/audit.d.ts.map +1 -0
- package/dist/runtime/types/audit.js +3 -0
- package/dist/runtime/types/audit.js.map +1 -0
- package/dist/runtime/types/auth.d.ts +6 -0
- package/dist/runtime/types/auth.d.ts.map +1 -1
- package/dist/runtime/types/config.d.ts +27 -0
- package/dist/runtime/types/config.d.ts.map +1 -1
- package/dist/runtime/types/events.d.ts +63 -0
- package/dist/runtime/types/events.d.ts.map +1 -0
- package/dist/runtime/types/events.js +3 -0
- package/dist/runtime/types/events.js.map +1 -0
- package/dist/runtime/types/health.d.ts +18 -0
- package/dist/runtime/types/health.d.ts.map +1 -0
- package/dist/runtime/types/health.js +3 -0
- package/dist/runtime/types/health.js.map +1 -0
- package/dist/runtime/types/index.d.ts +10 -4
- package/dist/runtime/types/index.d.ts.map +1 -1
- package/dist/runtime/types/jobs.d.ts +21 -0
- package/dist/runtime/types/jobs.d.ts.map +1 -0
- package/dist/runtime/types/jobs.js +3 -0
- package/dist/runtime/types/jobs.js.map +1 -0
- package/dist/runtime/types/resource.d.ts +30 -1
- package/dist/runtime/types/resource.d.ts.map +1 -1
- package/dist/runtime/types/revisions.d.ts +38 -0
- package/dist/runtime/types/revisions.d.ts.map +1 -0
- package/dist/runtime/types/revisions.js +3 -0
- package/dist/runtime/types/revisions.js.map +1 -0
- package/dist/runtime/types/sync.d.ts +39 -0
- package/dist/runtime/types/sync.d.ts.map +1 -1
- package/dist/runtime/utils/resolveSchema.d.ts +11 -0
- package/dist/runtime/utils/resolveSchema.d.ts.map +1 -0
- package/dist/runtime/utils/resolveSchema.js +35 -0
- package/dist/runtime/utils/resolveSchema.js.map +1 -0
- package/dist/schema.d.ts +31 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/store.d.ts +6 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +80 -0
- package/dist/store.js.map +1 -1
- package/package.json +4 -1
- package/static/assets/index-BWs25O1f.js +340 -0
- package/static/assets/index-Bmv5_kD9.css +1 -0
- package/static/index.html +2 -2
- package/static/assets/index-DdklZQ9o.js +0 -338
- package/static/assets/index-IVoZ2rM_.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.js","sourceRoot":"","sources":["../../../src/runtime/api/configs.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"configs.js","sourceRoot":"","sources":["../../../src/runtime/api/configs.ts"],"names":[],"mappings":";;AAoCA,4CA2CC;AAED,4CAyIC;AA1ND,sCAGmB;AACnB,+CAAsD;AACtD,6CAA8D;AAC9D,yDAAyD;AACzD,mDAAkD;AAElD,wCAA0D;AAC1D,uCAImB;AACnB,0DAA6D;AAE7D,SAAS,OAAO,CAAC,KAAiB,EAAE,EAAU;IAC5C,OAAO,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AACnD,CAAC;AAED,SAAS,OAAO,CAAC,KAAiB,EAAE,EAAU;IAC5C,OAAO,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,C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ACZ,KAAK,EAAE,IAAA,kBAAU,EAAC,GAAG,CAAC;gBACtB,SAAS,EAAE,IAAI;aAChB;SACF,CAAC,CAAC;QACH,OAAO;YACL,EAAE,EAAE,IAAI;YACR,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,MAAM,EAAE,MAAM,IAAA,mCAAmB,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;YACrD,WAAW,EAAE,GAAG,CAAC,GAAG;YACpB,KAAK,EAAE,SAAS;YAChB,gBAAgB,EAAE,KAAK;SACxB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../src/runtime/api/health.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO;;;;GAatE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.healthHandler = healthHandler;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
const access_1 = require("../services/access");
|
|
6
|
+
const environment_1 = require("../services/environment");
|
|
7
|
+
async function healthHandler(state, request) {
|
|
8
|
+
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
9
|
+
(0, access_1.assertCapability)(ctx, "health.read");
|
|
10
|
+
if (!state.healthDef) {
|
|
11
|
+
throw new errors_1.VertebrNotFoundError("Health is not configured");
|
|
12
|
+
}
|
|
13
|
+
const checks = await state.healthDef.load(ctx);
|
|
14
|
+
return {
|
|
15
|
+
ok: true,
|
|
16
|
+
environment: ctx.env,
|
|
17
|
+
checks,
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../../src/runtime/api/health.ts"],"names":[],"mappings":";;AAKA,sCAaC;AAlBD,sCAAiD;AACjD,+CAAsD;AACtD,yDAAyD;AAGlD,KAAK,UAAU,aAAa,CAAC,KAAiB,EAAE,OAAgB;IACrE,OAAO,IAAA,4BAAc,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAClD,IAAA,yBAAgB,EAAC,GAAG,EAAE,aAAa,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACrB,MAAM,IAAI,6BAAoB,CAAC,0BAA0B,CAAC,CAAC;QAC7D,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,OAAO;YACL,EAAE,EAAE,IAAI;YACR,WAAW,EAAE,GAAG,CAAC,GAAG;YACpB,MAAM;SACP,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AdminState } from "../services/state";
|
|
2
|
+
export declare function listJobsHandler(state: AdminState, request: unknown): Promise<{
|
|
3
|
+
ok: boolean;
|
|
4
|
+
environment: string;
|
|
5
|
+
items: import("../types").Job[];
|
|
6
|
+
}>;
|
|
7
|
+
export declare function getJobHandler(state: AdminState, request: unknown): Promise<{
|
|
8
|
+
ok: boolean;
|
|
9
|
+
environment: string;
|
|
10
|
+
job: import("../types").Job;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=jobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../../src/runtime/api/jobs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,wBAAsB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO;;;;GASxE;AAED,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO;;;;GAYtE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listJobsHandler = listJobsHandler;
|
|
4
|
+
exports.getJobHandler = getJobHandler;
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const access_1 = require("../services/access");
|
|
7
|
+
const environment_1 = require("../services/environment");
|
|
8
|
+
const request_1 = require("./request");
|
|
9
|
+
async function listJobsHandler(state, request) {
|
|
10
|
+
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
11
|
+
(0, access_1.assertCapability)(ctx, "jobs.read");
|
|
12
|
+
if (!state.jobsDef) {
|
|
13
|
+
throw new errors_1.VertebrNotFoundError("Jobs are not configured");
|
|
14
|
+
}
|
|
15
|
+
const items = await state.jobsDef.list(ctx);
|
|
16
|
+
return { ok: true, environment: ctx.env, items };
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async function getJobHandler(state, request) {
|
|
20
|
+
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
21
|
+
(0, access_1.assertCapability)(ctx, "jobs.read");
|
|
22
|
+
if (!state.jobsDef) {
|
|
23
|
+
throw new errors_1.VertebrNotFoundError("Jobs are not configured");
|
|
24
|
+
}
|
|
25
|
+
const id = (0, request_1.requestParam)(request, "id");
|
|
26
|
+
if (!id)
|
|
27
|
+
throw new errors_1.VertebrNotFoundError("Missing job id");
|
|
28
|
+
const job = await state.jobsDef.get(id, ctx);
|
|
29
|
+
if (!job)
|
|
30
|
+
throw new errors_1.VertebrNotFoundError(`Job "${id}" not found`);
|
|
31
|
+
return { ok: true, environment: ctx.env, job };
|
|
32
|
+
});
|
|
33
|
+
}
|
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M,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QAC7C,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,6BAAoB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QAClE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/runtime/api/metrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/runtime/api/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,wBAAsB,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO;;;;;;;;;;;;;;;;;;GAiCvE"}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.metricsHandler = metricsHandler;
|
|
4
4
|
const environment_1 = require("../services/environment");
|
|
5
|
+
const access_1 = require("../services/access");
|
|
5
6
|
async function metricsHandler(state, request) {
|
|
6
7
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
8
|
+
(0, access_1.assertCapability)(ctx, "overview.read");
|
|
7
9
|
if (!state.metricsDef) {
|
|
8
10
|
return {
|
|
9
11
|
ok: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/runtime/api/metrics.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/runtime/api/metrics.ts"],"names":[],"mappings":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file":"public.d.ts","sourceRoot":"","sources":["../../../src/runtime/api/public.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO;;;;;;GAwBjB;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO;;;;;;GAwBjB;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO;;;;;
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/runtime/api/public.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO;;;;;;GAwBjB;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO;;;;;;GAwBjB;AAED,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO;;;;;GAwBjB"}
|
|
@@ -60,7 +60,8 @@ async function publicResourceHandler(state, request) {
|
|
|
60
60
|
throw new errors_1.VertebrNotFoundError(`Public resource "${id}" not found`);
|
|
61
61
|
}
|
|
62
62
|
const listed = resource.list ? await resource.list(ctx) : [];
|
|
63
|
-
const
|
|
63
|
+
const rows = Array.isArray(listed) ? listed : listed.items ?? [];
|
|
64
|
+
const items = rows.filter((row) => {
|
|
64
65
|
if (!row || typeof row !== "object")
|
|
65
66
|
return false;
|
|
66
67
|
return row.active !== false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/runtime/api/public.ts"],"names":[],"mappings":";;AAMA,sDA0BC;AAED,kDA0BC;AAED,
|
|
1
|
+
{"version":3,"file":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I,6BAAoB,CAAC,qBAAqB,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,QAAQ,GAAG,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACrB,MAAM,IAAI,6BAAoB,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC;QACtE,CAAC;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QACjE,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YAChC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAO,KAAK,CAAC;YAClD,OAAQ,GAA+B,CAAC,MAAM,KAAK,KAAK,CAAC;QAC3D,CAAC,CAAC,CAAC;QACH,OAAO;YACL,EAAE,EAAE,IAAI;YACR,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,WAAW,EAAE,GAAG,CAAC,GAAG;YACpB,KAAK;SACN,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { FieldSchema, ResourceUploadResult } from "../../schema";
|
|
2
2
|
import type { AdminState } from "../services/state";
|
|
3
3
|
export declare function listResourceHandler(state: AdminState, request: unknown): Promise<{
|
|
4
|
+
listQuery?: boolean | Record<string, FieldSchema> | undefined;
|
|
5
|
+
query?: {
|
|
6
|
+
filters?: Record<string, string> | undefined;
|
|
7
|
+
cursor?: string | undefined;
|
|
8
|
+
offset?: number | undefined;
|
|
9
|
+
limit?: number | undefined;
|
|
10
|
+
order?: "asc" | "desc" | undefined;
|
|
11
|
+
sort?: string | undefined;
|
|
12
|
+
q?: string | undefined;
|
|
13
|
+
} | undefined;
|
|
14
|
+
cursor?: string | undefined;
|
|
15
|
+
total?: number | undefined;
|
|
4
16
|
id: string;
|
|
5
17
|
label: string;
|
|
6
18
|
schema: Record<string, FieldSchema>;
|
|
@@ -14,6 +26,11 @@ export declare function listResourceHandler(state: AdminState, request: unknown)
|
|
|
14
26
|
label: string;
|
|
15
27
|
input?: Record<string, FieldSchema>;
|
|
16
28
|
mail?: boolean;
|
|
29
|
+
bulk?: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
bulkActions: Record<string, {
|
|
32
|
+
label: string;
|
|
33
|
+
input?: Record<string, FieldSchema>;
|
|
17
34
|
}>;
|
|
18
35
|
collectionActions: Record<string, {
|
|
19
36
|
label: string;
|
|
@@ -65,6 +82,18 @@ export declare function resourceActionHandler(state: AdminState, request: unknow
|
|
|
65
82
|
environment: string;
|
|
66
83
|
result: unknown;
|
|
67
84
|
}>;
|
|
85
|
+
export declare function bulkActionHandler(state: AdminState, request: unknown): Promise<{
|
|
86
|
+
ok: boolean;
|
|
87
|
+
id: string;
|
|
88
|
+
actionId: string;
|
|
89
|
+
environment: string;
|
|
90
|
+
results: {
|
|
91
|
+
rowId: string;
|
|
92
|
+
ok: boolean;
|
|
93
|
+
result?: unknown;
|
|
94
|
+
error?: string;
|
|
95
|
+
}[];
|
|
96
|
+
}>;
|
|
68
97
|
export declare function mailPreviewHandler(state: AdminState, request: unknown): Promise<{
|
|
69
98
|
to: string | string[];
|
|
70
99
|
subject: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/runtime/api/resources.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,WAAW,EAGX,oBAAoB,EACrB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":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,uBAAuB,CAC3C,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,OAAO;;;;;;GAsCjB"}
|
|
@@ -7,15 +7,54 @@ exports.updateResourceHandler = updateResourceHandler;
|
|
|
7
7
|
exports.createResourceHandler = createResourceHandler;
|
|
8
8
|
exports.deleteResourceHandler = deleteResourceHandler;
|
|
9
9
|
exports.resourceActionHandler = resourceActionHandler;
|
|
10
|
+
exports.bulkActionHandler = bulkActionHandler;
|
|
10
11
|
exports.mailPreviewHandler = mailPreviewHandler;
|
|
11
12
|
exports.collectionActionHandler = collectionActionHandler;
|
|
12
13
|
const constants_1 = require("../constants");
|
|
13
14
|
const errors_1 = require("../errors");
|
|
15
|
+
const access_1 = require("../services/access");
|
|
16
|
+
const audit_1 = require("../services/audit");
|
|
14
17
|
const environment_1 = require("../services/environment");
|
|
15
18
|
const registry_1 = require("../services/registry");
|
|
16
19
|
const uploads_1 = require("../utils/uploads");
|
|
17
20
|
const mail_1 = require("../mail");
|
|
18
21
|
const request_1 = require("./request");
|
|
22
|
+
function normalizeListResult(raw) {
|
|
23
|
+
if (Array.isArray(raw))
|
|
24
|
+
return { items: raw };
|
|
25
|
+
return {
|
|
26
|
+
items: raw.items ?? [],
|
|
27
|
+
...(raw.total != null ? { total: raw.total } : {}),
|
|
28
|
+
...(raw.cursor ? { cursor: raw.cursor } : {}),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function parseListQuery(query) {
|
|
32
|
+
if (!query)
|
|
33
|
+
return {};
|
|
34
|
+
const filters = {};
|
|
35
|
+
for (const [key, value] of Object.entries(query)) {
|
|
36
|
+
if (key.startsWith("filter.") || key.startsWith("filters.")) {
|
|
37
|
+
const field = key.replace(/^filters?\./, "");
|
|
38
|
+
if (field)
|
|
39
|
+
filters[field] = value;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
...(query.q ? { q: query.q } : {}),
|
|
44
|
+
...(query.sort ? { sort: query.sort } : {}),
|
|
45
|
+
...(query.order === "asc" || query.order === "desc"
|
|
46
|
+
? { order: query.order }
|
|
47
|
+
: {}),
|
|
48
|
+
...(query.limit && Number.isFinite(Number(query.limit))
|
|
49
|
+
? { limit: Number(query.limit) }
|
|
50
|
+
: {}),
|
|
51
|
+
...(query.offset && Number.isFinite(Number(query.offset))
|
|
52
|
+
? { offset: Number(query.offset) }
|
|
53
|
+
: {}),
|
|
54
|
+
...(query.cursor ? { cursor: query.cursor } : {}),
|
|
55
|
+
...(Object.keys(filters).length ? { filters } : {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
19
58
|
async function runFieldUpload(resource, field, file, ctx) {
|
|
20
59
|
const def = resource.uploads?.[field];
|
|
21
60
|
if (!def) {
|
|
@@ -58,18 +97,46 @@ function resolvedActions(state, resource) {
|
|
|
58
97
|
{
|
|
59
98
|
label: action.label,
|
|
60
99
|
input: (0, mail_1.normalizeActionInput)(action.input),
|
|
100
|
+
...(action.bulk ? { bulk: true } : {}),
|
|
61
101
|
},
|
|
62
102
|
]))
|
|
63
103
|
: {};
|
|
64
104
|
return { ...fromMail, ...fromResource };
|
|
65
105
|
}
|
|
106
|
+
function resolvedBulkActions(resource) {
|
|
107
|
+
const fromBulk = resource.bulkActions
|
|
108
|
+
? Object.fromEntries(Object.entries(resource.bulkActions).map(([key, action]) => [
|
|
109
|
+
key,
|
|
110
|
+
{
|
|
111
|
+
label: action.label,
|
|
112
|
+
input: (0, mail_1.normalizeActionInput)(action.input),
|
|
113
|
+
},
|
|
114
|
+
]))
|
|
115
|
+
: {};
|
|
116
|
+
const fromRow = resource.actions
|
|
117
|
+
? Object.fromEntries(Object.entries(resource.actions)
|
|
118
|
+
.filter(([, action]) => action.bulk)
|
|
119
|
+
.map(([key, action]) => [
|
|
120
|
+
key,
|
|
121
|
+
{
|
|
122
|
+
label: action.label,
|
|
123
|
+
input: (0, mail_1.normalizeActionInput)(action.input),
|
|
124
|
+
},
|
|
125
|
+
]))
|
|
126
|
+
: {};
|
|
127
|
+
return { ...fromRow, ...fromBulk };
|
|
128
|
+
}
|
|
66
129
|
async function loadResourceRow(resource, rowId, ctx) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
130
|
+
if (resource.get) {
|
|
131
|
+
const row = await resource.get(rowId, ctx);
|
|
132
|
+
return row;
|
|
133
|
+
}
|
|
134
|
+
const raw = await (resource.list?.(ctx) ?? []);
|
|
135
|
+
const items = normalizeListResult(raw).items;
|
|
136
|
+
const row = items.find((item) => String(item.id ?? "") === rowId ||
|
|
137
|
+
String(item.slug ?? "") === rowId ||
|
|
138
|
+
String(item.uid ?? "") === rowId ||
|
|
139
|
+
String(item.email ?? "") === rowId);
|
|
73
140
|
return row;
|
|
74
141
|
}
|
|
75
142
|
async function resolvedCollectionActions(resource, ctx) {
|
|
@@ -88,12 +155,15 @@ async function resolvedCollectionActions(resource, ctx) {
|
|
|
88
155
|
}
|
|
89
156
|
async function listResourceHandler(state, request) {
|
|
90
157
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
158
|
+
(0, access_1.assertCapability)(ctx, "resource.read");
|
|
91
159
|
const id = (0, request_1.requestParam)(request, "id");
|
|
92
160
|
if (!id) {
|
|
93
161
|
throw new errors_1.VertebrNotFoundError("Missing resource id");
|
|
94
162
|
}
|
|
95
163
|
const resource = (0, registry_1.findResource)(state, id);
|
|
96
|
-
const
|
|
164
|
+
const raw = resource.list ? await resource.list(ctx) : [];
|
|
165
|
+
const { items, total, cursor } = normalizeListResult(raw);
|
|
166
|
+
const parsedQuery = parseListQuery(ctx.query);
|
|
97
167
|
return {
|
|
98
168
|
id: resource.id,
|
|
99
169
|
label: resource.label,
|
|
@@ -101,14 +171,24 @@ async function listResourceHandler(state, request) {
|
|
|
101
171
|
environment: ctx.env,
|
|
102
172
|
permissions: await resolvedPermissions(resource, ctx),
|
|
103
173
|
actions: resolvedActions(state, resource),
|
|
174
|
+
bulkActions: resolvedBulkActions(resource),
|
|
104
175
|
collectionActions: await resolvedCollectionActions(resource, ctx),
|
|
105
176
|
uploads: (0, uploads_1.publicUploads)(resource),
|
|
106
177
|
items,
|
|
178
|
+
...(total != null ? { total } : {}),
|
|
179
|
+
...(cursor ? { cursor } : {}),
|
|
180
|
+
...(Object.keys(parsedQuery).length ? { query: parsedQuery } : {}),
|
|
181
|
+
...(resource.listQuery != null
|
|
182
|
+
? {
|
|
183
|
+
listQuery: resource.listQuery === true ? true : resource.listQuery,
|
|
184
|
+
}
|
|
185
|
+
: {}),
|
|
107
186
|
};
|
|
108
187
|
});
|
|
109
188
|
}
|
|
110
189
|
async function uploadResourceFileHandler(state, request) {
|
|
111
190
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
191
|
+
(0, access_1.assertCapability)(ctx, "resource.write");
|
|
112
192
|
const id = (0, request_1.requestParam)(request, "id");
|
|
113
193
|
const field = (0, request_1.requestParam)(request, "field");
|
|
114
194
|
if (!id || !field) {
|
|
@@ -122,6 +202,7 @@ async function uploadResourceFileHandler(state, request) {
|
|
|
122
202
|
}
|
|
123
203
|
async function uploadResourceFilesHandler(state, request) {
|
|
124
204
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
205
|
+
(0, access_1.assertCapability)(ctx, "resource.write");
|
|
125
206
|
const id = (0, request_1.requestParam)(request, "id");
|
|
126
207
|
const field = (0, request_1.requestParam)(request, "field");
|
|
127
208
|
if (!id || !field) {
|
|
@@ -145,6 +226,7 @@ async function uploadResourceFilesHandler(state, request) {
|
|
|
145
226
|
}
|
|
146
227
|
async function updateResourceHandler(state, request) {
|
|
147
228
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
229
|
+
(0, access_1.assertCapability)(ctx, "resource.write");
|
|
148
230
|
const id = (0, request_1.requestParam)(request, "id");
|
|
149
231
|
const rowId = (0, request_1.requestParam)(request, "rowId");
|
|
150
232
|
if (!id || !rowId) {
|
|
@@ -156,11 +238,28 @@ async function updateResourceHandler(state, request) {
|
|
|
156
238
|
}
|
|
157
239
|
const value = (0, request_1.requestObjectPayload)(request);
|
|
158
240
|
const item = await resource.update(rowId, value, ctx);
|
|
241
|
+
await (0, audit_1.afterMutation)(state, ctx, {
|
|
242
|
+
audit: {
|
|
243
|
+
action: "resource.update",
|
|
244
|
+
targetType: "resource",
|
|
245
|
+
targetId: `${id}/${rowId}`,
|
|
246
|
+
summary: `Updated ${resource.label} row ${rowId}`,
|
|
247
|
+
},
|
|
248
|
+
event: {
|
|
249
|
+
type: "resource.written",
|
|
250
|
+
resourceId: id,
|
|
251
|
+
rowId,
|
|
252
|
+
op: "update",
|
|
253
|
+
env: ctx.env,
|
|
254
|
+
actor: (0, audit_1.eventActor)(ctx),
|
|
255
|
+
},
|
|
256
|
+
});
|
|
159
257
|
return { ok: true, id, rowId, environment: ctx.env, item };
|
|
160
258
|
});
|
|
161
259
|
}
|
|
162
260
|
async function createResourceHandler(state, request) {
|
|
163
261
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
262
|
+
(0, access_1.assertCapability)(ctx, "resource.write");
|
|
164
263
|
const id = (0, request_1.requestParam)(request, "id");
|
|
165
264
|
if (!id) {
|
|
166
265
|
throw new errors_1.VertebrNotFoundError("Missing resource id");
|
|
@@ -171,11 +270,31 @@ async function createResourceHandler(state, request) {
|
|
|
171
270
|
}
|
|
172
271
|
const value = (0, request_1.requestObjectPayload)(request);
|
|
173
272
|
const item = await resource.create(value, ctx);
|
|
273
|
+
const rowId = String(item?.id ??
|
|
274
|
+
item?.slug ??
|
|
275
|
+
"");
|
|
276
|
+
await (0, audit_1.afterMutation)(state, ctx, {
|
|
277
|
+
audit: {
|
|
278
|
+
action: "resource.create",
|
|
279
|
+
targetType: "resource",
|
|
280
|
+
targetId: `${id}/${rowId || "new"}`,
|
|
281
|
+
summary: `Created ${resource.label} row`,
|
|
282
|
+
},
|
|
283
|
+
event: {
|
|
284
|
+
type: "resource.written",
|
|
285
|
+
resourceId: id,
|
|
286
|
+
rowId: rowId || "new",
|
|
287
|
+
op: "create",
|
|
288
|
+
env: ctx.env,
|
|
289
|
+
actor: (0, audit_1.eventActor)(ctx),
|
|
290
|
+
},
|
|
291
|
+
});
|
|
174
292
|
return { ok: true, id, environment: ctx.env, item };
|
|
175
293
|
});
|
|
176
294
|
}
|
|
177
295
|
async function deleteResourceHandler(state, request) {
|
|
178
296
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
297
|
+
(0, access_1.assertCapability)(ctx, "resource.delete");
|
|
179
298
|
const id = (0, request_1.requestParam)(request, "id");
|
|
180
299
|
const rowId = (0, request_1.requestParam)(request, "rowId");
|
|
181
300
|
if (!id || !rowId) {
|
|
@@ -186,11 +305,28 @@ async function deleteResourceHandler(state, request) {
|
|
|
186
305
|
throw new errors_1.VertebrNotFoundError(`Resource "${id}" cannot delete`);
|
|
187
306
|
}
|
|
188
307
|
await resource.remove(rowId, ctx);
|
|
308
|
+
await (0, audit_1.afterMutation)(state, ctx, {
|
|
309
|
+
audit: {
|
|
310
|
+
action: "resource.delete",
|
|
311
|
+
targetType: "resource",
|
|
312
|
+
targetId: `${id}/${rowId}`,
|
|
313
|
+
summary: `Deleted ${resource.label} row ${rowId}`,
|
|
314
|
+
},
|
|
315
|
+
event: {
|
|
316
|
+
type: "resource.written",
|
|
317
|
+
resourceId: id,
|
|
318
|
+
rowId,
|
|
319
|
+
op: "delete",
|
|
320
|
+
env: ctx.env,
|
|
321
|
+
actor: (0, audit_1.eventActor)(ctx),
|
|
322
|
+
},
|
|
323
|
+
});
|
|
189
324
|
return { ok: true, id, rowId, environment: ctx.env };
|
|
190
325
|
});
|
|
191
326
|
}
|
|
192
327
|
async function resourceActionHandler(state, request) {
|
|
193
328
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
329
|
+
(0, access_1.assertCapability)(ctx, "resource.action");
|
|
194
330
|
const id = (0, request_1.requestParam)(request, "id");
|
|
195
331
|
const rowId = (0, request_1.requestParam)(request, "rowId");
|
|
196
332
|
const actionId = (0, request_1.requestParam)(request, "actionId");
|
|
@@ -209,11 +345,99 @@ async function resourceActionHandler(state, request) {
|
|
|
209
345
|
}
|
|
210
346
|
const input = (0, request_1.requestOptionalObjectPayload)(request);
|
|
211
347
|
const result = await action.run(row, input, ctx);
|
|
348
|
+
const jobId = result &&
|
|
349
|
+
typeof result === "object" &&
|
|
350
|
+
typeof result.jobId === "string"
|
|
351
|
+
? result.jobId
|
|
352
|
+
: undefined;
|
|
353
|
+
await (0, audit_1.afterMutation)(state, ctx, {
|
|
354
|
+
audit: {
|
|
355
|
+
action: `resource.action.${actionId}`,
|
|
356
|
+
targetType: "resource",
|
|
357
|
+
targetId: `${id}/${rowId}`,
|
|
358
|
+
summary: `Ran ${action.label} on ${rowId}`,
|
|
359
|
+
...(jobId ? { meta: { jobId } } : {}),
|
|
360
|
+
},
|
|
361
|
+
event: {
|
|
362
|
+
type: "resource.action",
|
|
363
|
+
resourceId: id,
|
|
364
|
+
rowId,
|
|
365
|
+
actionId,
|
|
366
|
+
env: ctx.env,
|
|
367
|
+
actor: (0, audit_1.eventActor)(ctx),
|
|
368
|
+
...(jobId ? { jobId } : {}),
|
|
369
|
+
},
|
|
370
|
+
});
|
|
212
371
|
return { ok: true, id, rowId, actionId, environment: ctx.env, result };
|
|
213
372
|
});
|
|
214
373
|
}
|
|
374
|
+
async function bulkActionHandler(state, request) {
|
|
375
|
+
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
376
|
+
(0, access_1.assertCapability)(ctx, "resource.action");
|
|
377
|
+
const id = (0, request_1.requestParam)(request, "id");
|
|
378
|
+
const actionId = (0, request_1.requestParam)(request, "actionId");
|
|
379
|
+
if (!id || !actionId) {
|
|
380
|
+
throw new errors_1.VertebrNotFoundError("Missing resource or action id");
|
|
381
|
+
}
|
|
382
|
+
const resource = (0, registry_1.findResource)(state, id);
|
|
383
|
+
const action = resource.bulkActions?.[actionId] ??
|
|
384
|
+
(resource.actions?.[actionId]?.bulk
|
|
385
|
+
? resource.actions[actionId]
|
|
386
|
+
: undefined);
|
|
387
|
+
if (!action) {
|
|
388
|
+
throw new errors_1.VertebrNotFoundError(`Bulk action "${actionId}" not found`);
|
|
389
|
+
}
|
|
390
|
+
const body = (0, request_1.requestObjectPayload)(request);
|
|
391
|
+
const rowIds = Array.isArray(body.rowIds)
|
|
392
|
+
? body.rowIds.map(String)
|
|
393
|
+
: [];
|
|
394
|
+
if (!rowIds.length) {
|
|
395
|
+
throw new errors_1.VertebrBadRequestError("Provide rowIds: string[]");
|
|
396
|
+
}
|
|
397
|
+
const input = body.input && typeof body.input === "object"
|
|
398
|
+
? body.input
|
|
399
|
+
: undefined;
|
|
400
|
+
const results = [];
|
|
401
|
+
for (const rowId of rowIds) {
|
|
402
|
+
try {
|
|
403
|
+
const row = await loadResourceRow(resource, rowId, ctx);
|
|
404
|
+
if (!row) {
|
|
405
|
+
results.push({ rowId, ok: false, error: "Not found" });
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
const result = await action.run(row, input, ctx);
|
|
409
|
+
results.push({ rowId, ok: true, result });
|
|
410
|
+
}
|
|
411
|
+
catch (error) {
|
|
412
|
+
results.push({
|
|
413
|
+
rowId,
|
|
414
|
+
ok: false,
|
|
415
|
+
error: error instanceof Error ? error.message : "Failed",
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
await (0, audit_1.afterMutation)(state, ctx, {
|
|
420
|
+
audit: {
|
|
421
|
+
action: `resource.bulk.${actionId}`,
|
|
422
|
+
targetType: "resource",
|
|
423
|
+
targetId: id,
|
|
424
|
+
summary: `Bulk ${action.label} on ${rowIds.length} rows`,
|
|
425
|
+
meta: { rowIds },
|
|
426
|
+
},
|
|
427
|
+
event: {
|
|
428
|
+
type: "resource.action",
|
|
429
|
+
resourceId: id,
|
|
430
|
+
actionId,
|
|
431
|
+
env: ctx.env,
|
|
432
|
+
actor: (0, audit_1.eventActor)(ctx),
|
|
433
|
+
},
|
|
434
|
+
});
|
|
435
|
+
return { ok: true, id, actionId, environment: ctx.env, results };
|
|
436
|
+
});
|
|
437
|
+
}
|
|
215
438
|
async function mailPreviewHandler(state, request) {
|
|
216
439
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
440
|
+
(0, access_1.assertCapability)(ctx, "emails.read");
|
|
217
441
|
const id = (0, request_1.requestParam)(request, "id");
|
|
218
442
|
const rowId = (0, request_1.requestParam)(request, "rowId");
|
|
219
443
|
const templateId = (0, request_1.requestParam)(request, "templateId");
|
|
@@ -244,6 +468,7 @@ async function mailPreviewHandler(state, request) {
|
|
|
244
468
|
}
|
|
245
469
|
async function collectionActionHandler(state, request) {
|
|
246
470
|
return (0, environment_1.withEnvContext)(state, request, async (ctx) => {
|
|
471
|
+
(0, access_1.assertCapability)(ctx, "resource.action");
|
|
247
472
|
const id = (0, request_1.requestParam)(request, "id");
|
|
248
473
|
const actionId = (0, request_1.requestParam)(request, "actionId");
|
|
249
474
|
if (!id || !actionId) {
|
|
@@ -261,6 +486,21 @@ async function collectionActionHandler(state, request) {
|
|
|
261
486
|
}
|
|
262
487
|
const input = (0, request_1.requestOptionalObjectPayload)(request);
|
|
263
488
|
const result = await action.run(input, ctx);
|
|
489
|
+
await (0, audit_1.afterMutation)(state, ctx, {
|
|
490
|
+
audit: {
|
|
491
|
+
action: `resource.collection.${actionId}`,
|
|
492
|
+
targetType: "resource",
|
|
493
|
+
targetId: id,
|
|
494
|
+
summary: `Ran collection action ${action.label}`,
|
|
495
|
+
},
|
|
496
|
+
event: {
|
|
497
|
+
type: "resource.action",
|
|
498
|
+
resourceId: id,
|
|
499
|
+
actionId,
|
|
500
|
+
env: ctx.env,
|
|
501
|
+
actor: (0, audit_1.eventActor)(ctx),
|
|
502
|
+
},
|
|
503
|
+
});
|
|
264
504
|
return { ok: true, id, actionId, environment: ctx.env, result };
|
|
265
505
|
});
|
|
266
506
|
}
|