@jskit-ai/crud-core 0.1.256 → 0.1.257
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/crud-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.257",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0"
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"./server/routeContracts": "./src/server/routeContracts.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
30
|
-
"@jskit-ai/json-rest-api-core": "0.1.
|
|
31
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
29
|
+
"@jskit-ai/database-runtime": "0.1.246",
|
|
30
|
+
"@jskit-ai/json-rest-api-core": "0.1.190",
|
|
31
|
+
"@jskit-ai/resource-crud-core": "0.1.188",
|
|
32
32
|
"json-rest-schema": "^1.0.17",
|
|
33
|
-
"json-rest-api": "2.
|
|
33
|
+
"json-rest-api": "2.1.0"
|
|
34
34
|
},
|
|
35
35
|
"description": "Shared server-side CRUD service, repository, route, and query helpers.",
|
|
36
36
|
"jskit": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
53
|
-
"@jskit-ai/kernel": "0.1.
|
|
52
|
+
"@jskit-ai/http-runtime": "0.1.244",
|
|
53
|
+
"@jskit-ai/kernel": "0.1.246"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"./shared": "./src/shared/index.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@jskit-ai/crud-core": "0.1.
|
|
12
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
11
|
+
"@jskit-ai/crud-core": "0.1.257",
|
|
12
|
+
"@jskit-ai/resource-crud-core": "0.1.188"
|
|
13
13
|
},
|
|
14
14
|
"jskit": {
|
|
15
15
|
"kind": "runtime",
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
} from "@jskit-ai/kernel/shared/validators";
|
|
6
6
|
import { RestApiWriteError } from "json-rest-api";
|
|
7
7
|
import { normalizeJsonApiFieldsets } from "@jskit-ai/kernel/shared/support/jsonApiFieldsets";
|
|
8
|
+
import { ARCHITECTURE_ID_PATTERN } from "@jskit-ai/kernel/shared/capabilities";
|
|
8
9
|
import { createEntityChangedActionEvent } from "@jskit-ai/kernel/server/actions";
|
|
9
10
|
import {
|
|
10
11
|
decodeJsonApiResourceResponse,
|
|
@@ -507,7 +508,7 @@ function normalizeAdditionalActions(value = {}, {
|
|
|
507
508
|
|
|
508
509
|
return Object.freeze(Object.entries(value).map(([name, definition]) => {
|
|
509
510
|
const actionName = String(name || "").trim();
|
|
510
|
-
if (
|
|
511
|
+
if (!ARCHITECTURE_ID_PATTERN.test(actionName)) {
|
|
511
512
|
throw new TypeError(`CRUD custom action name "${actionName}" is invalid.`);
|
|
512
513
|
}
|
|
513
514
|
if (CRUD_OPERATION_NAMES.includes(actionName)) {
|
|
@@ -537,8 +538,6 @@ function normalizeAdditionalActions(value = {}, {
|
|
|
537
538
|
? composeSchemaDefinitions([scopeInputValidator, definition.input])
|
|
538
539
|
: definition.input,
|
|
539
540
|
idempotency: definition.idempotency || (kind === "query" ? "none" : "optional"),
|
|
540
|
-
audit: definition.audit || { actionName: String(definition.id || `${namespace}.${actionName}`).trim() },
|
|
541
|
-
observability: definition.observability || {},
|
|
542
541
|
events: definition.events || []
|
|
543
542
|
});
|
|
544
543
|
}));
|
|
@@ -713,8 +712,6 @@ function createCrudJsonApiActions({
|
|
|
713
712
|
assistant: createCrudAssistantExtension(resource, namespace, definition.operation)
|
|
714
713
|
}),
|
|
715
714
|
idempotency: definition.idempotency,
|
|
716
|
-
audit: { actionName: id },
|
|
717
|
-
observability: {},
|
|
718
715
|
events: definition.events || [],
|
|
719
716
|
execute: definition.execute
|
|
720
717
|
});
|
|
@@ -729,8 +726,6 @@ function createCrudJsonApiActions({
|
|
|
729
726
|
output: definition.output || null,
|
|
730
727
|
idempotency: definition.idempotency,
|
|
731
728
|
permission: definition.permission,
|
|
732
|
-
audit: definition.audit,
|
|
733
|
-
observability: definition.observability,
|
|
734
729
|
extensions: definition.extensions || {},
|
|
735
730
|
events: definition.events,
|
|
736
731
|
async execute(value, context) {
|
|
@@ -9,7 +9,7 @@ import { AppError } from "@jskit-ai/kernel/server/runtime/errors";
|
|
|
9
9
|
import { RECORD_ID_PATTERN } from "@jskit-ai/kernel/shared/validators";
|
|
10
10
|
import { normalizeRecordId, normalizeText } from "@jskit-ai/kernel/shared/support/normalize";
|
|
11
11
|
import { normalizeObjectInput } from "@jskit-ai/kernel/shared/validators/inputNormalization";
|
|
12
|
-
import {
|
|
12
|
+
import { normalizeSingleSchemaDefinition } from "@jskit-ai/kernel/shared/validators";
|
|
13
13
|
import {
|
|
14
14
|
buildCrudFieldContractMap,
|
|
15
15
|
resolveCrudFieldSchemaProperties,
|
|
@@ -138,7 +138,7 @@ function requireFieldDefinitions(definition, {
|
|
|
138
138
|
schemaLabel = "schema definition",
|
|
139
139
|
defaultMode = "patch"
|
|
140
140
|
} = {}) {
|
|
141
|
-
const normalized =
|
|
141
|
+
const normalized = normalizeSingleSchemaDefinition(definition, {
|
|
142
142
|
context: `${context} ${schemaLabel}`,
|
|
143
143
|
defaultMode
|
|
144
144
|
});
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
resolveCrudIdColumn
|
|
21
21
|
} from "../repositorySupport.js";
|
|
22
22
|
import {
|
|
23
|
-
|
|
23
|
+
resolveSchemaTransportSchemaDefinition,
|
|
24
24
|
validateSchemaPayload
|
|
25
25
|
} from "@jskit-ai/kernel/shared/validators";
|
|
26
26
|
import {
|
|
@@ -297,7 +297,7 @@ function resolveRecordOutputValidator(resource = {}, { context = "crudRepository
|
|
|
297
297
|
if (!output || typeof output !== "object" || Array.isArray(output)) {
|
|
298
298
|
throw new TypeError(`${context} requires operations.view.output.`);
|
|
299
299
|
}
|
|
300
|
-
const schema =
|
|
300
|
+
const schema = resolveSchemaTransportSchemaDefinition(output, {
|
|
301
301
|
context: `${context} operations.view.output`,
|
|
302
302
|
defaultMode: "replace"
|
|
303
303
|
});
|