@directus/api 35.2.0 → 36.0.0-rc.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/dist/ai/chat/models/chat-request.js +48 -48
- package/dist/ai/chat/models/object-request.js +6 -6
- package/dist/ai/chat/models/providers.js +14 -14
- package/dist/ai/chat/utils/parse-json-schema-7.js +22 -22
- package/dist/ai/mcp/server.js +44 -6
- package/dist/ai/mcp/utils.js +31 -0
- package/dist/ai/tools/assets/index.js +3 -3
- package/dist/ai/tools/collections/index.js +18 -18
- package/dist/ai/tools/fields/index.js +18 -18
- package/dist/ai/tools/files/index.js +18 -18
- package/dist/ai/tools/flows/index.js +16 -16
- package/dist/ai/tools/folders/index.js +18 -18
- package/dist/ai/tools/items/index.js +17 -17
- package/dist/ai/tools/operations/index.js +16 -16
- package/dist/ai/tools/relations/index.js +22 -22
- package/dist/ai/tools/schema/index.js +3 -3
- package/dist/ai/tools/schema.js +159 -159
- package/dist/ai/tools/system/index.js +3 -3
- package/dist/ai/tools/trigger-flow/index.js +3 -3
- package/dist/app.js +35 -11
- package/dist/auth/drivers/ldap.js +3 -1
- package/dist/auth/drivers/local.js +2 -0
- package/dist/auth/drivers/oauth2.js +3 -1
- package/dist/auth/drivers/openid.js +3 -1
- package/dist/auth/drivers/saml.js +2 -0
- package/dist/auth/utils/check-local-disabled.js +16 -0
- package/dist/auth/utils/check-sso-enabled.js +14 -0
- package/dist/auth.js +8 -5
- package/dist/cli/commands/bootstrap/index.js +3 -0
- package/dist/cli/commands/cache/clear.js +6 -1
- package/dist/cli/commands/roles/create.js +4 -1
- package/dist/cli/commands/users/create.js +3 -0
- package/dist/constants.js +8 -1
- package/dist/controllers/access.js +1 -1
- package/dist/controllers/activity.js +2 -1
- package/dist/controllers/assets.js +2 -0
- package/dist/controllers/auth.js +13 -5
- package/dist/controllers/collections.js +1 -1
- package/dist/controllers/comments.js +1 -1
- package/dist/controllers/dashboards.js +1 -1
- package/dist/controllers/fields.js +1 -1
- package/dist/controllers/files.js +3 -1
- package/dist/controllers/flows.js +6 -5
- package/dist/controllers/folders.js +1 -1
- package/dist/controllers/graphql.js +2 -0
- package/dist/controllers/items.js +3 -1
- package/dist/controllers/license.js +119 -0
- package/dist/controllers/mcp/index.js +38 -0
- package/dist/controllers/mcp/oauth-clients.js +68 -0
- package/dist/controllers/mcp/oauth-consent-page.js +316 -0
- package/dist/controllers/mcp/oauth.js +381 -0
- package/dist/controllers/mcp/templates/oauth-consent.liquid +62 -0
- package/dist/controllers/mcp/templates/oauth-error.liquid +28 -0
- package/dist/controllers/notifications.js +1 -1
- package/dist/controllers/operations.js +1 -1
- package/dist/controllers/panels.js +1 -1
- package/dist/controllers/permissions.js +1 -1
- package/dist/controllers/policies.js +1 -1
- package/dist/controllers/presets.js +1 -1
- package/dist/controllers/revisions.js +3 -2
- package/dist/controllers/roles.js +1 -1
- package/dist/controllers/server.js +38 -10
- package/dist/controllers/shares.js +1 -1
- package/dist/controllers/translations.js +1 -1
- package/dist/controllers/users.js +1 -1
- package/dist/controllers/utils.js +2 -2
- package/dist/controllers/versions.js +12 -5
- package/dist/database/get-ast-from-query/lib/convert-wildcards.js +10 -1
- package/dist/database/get-ast-from-query/lib/parse-fields.js +2 -1
- package/dist/database/helpers/fn/dialects/mysql.js +7 -12
- package/dist/database/helpers/fn/dialects/oracle.js +3 -4
- package/dist/database/helpers/fn/dialects/postgres.js +4 -26
- package/dist/database/helpers/fn/json/mysql-json-path.js +22 -0
- package/dist/database/helpers/fn/json/parse-function.js +14 -6
- package/dist/database/helpers/fn/json/postgres-json-path.js +54 -0
- package/dist/database/migrations/20260110A-add-ai-provider-settings.js +4 -4
- package/dist/database/migrations/20260217A-null-item-versions.js +14 -0
- package/dist/database/migrations/20260312A-add-ai-translation-settings.js +18 -0
- package/dist/database/migrations/20260507A-add-licensing.js +22 -0
- package/dist/database/migrations/20260512A-add-autosave-revision-interval.js +14 -0
- package/dist/database/migrations/20260512B-add-mcp-oauth.js +87 -0
- package/dist/database/run-ast/lib/apply-query/filter/operator.js +116 -33
- package/dist/database/run-ast/lib/apply-query/index.js +4 -1
- package/dist/database/run-ast/lib/apply-query/sort.js +17 -7
- package/dist/database/run-ast/lib/get-db-query.js +21 -9
- package/dist/database/run-ast/lib/parse-current-level.js +2 -1
- package/dist/database/run-ast/run-ast.js +2 -1
- package/dist/database/run-ast/utils/get-column.js +2 -1
- package/dist/database/run-ast/utils/merge-with-parent-items.js +5 -3
- package/dist/extensions/lib/installation/manager.js +1 -1
- package/dist/extensions/lib/sandbox/register/operation.js +1 -1
- package/dist/extensions/lib/sync/sync.js +1 -1
- package/dist/extensions/manager.js +3 -3
- package/dist/flows.js +5 -5
- package/dist/license/entitlements/lib/collections.js +37 -0
- package/dist/license/entitlements/lib/custom-llms-enabled.js +18 -0
- package/dist/license/entitlements/lib/custom-permission-rules-enabled.js +41 -0
- package/dist/license/entitlements/lib/flows.js +29 -0
- package/dist/license/entitlements/lib/seats.js +103 -0
- package/dist/license/entitlements/lib/sso-enabled.js +45 -0
- package/dist/license/entitlements/manager.js +256 -0
- package/dist/license/index.js +4 -0
- package/dist/license/manager.js +505 -0
- package/dist/license/utils/compute-license-status.js +27 -0
- package/dist/license/utils/get-core-grace-expires-at.js +38 -0
- package/dist/license/utils/get-license-key.js +23 -0
- package/dist/license/utils/get-license-token.js +23 -0
- package/dist/license/utils/handle-license-error.js +41 -0
- package/dist/license/utils/is-in-core-grace-period.js +11 -0
- package/dist/license/utils/is-sso-bypass-allowed.js +21 -0
- package/dist/license/utils/use-rpc.js +33 -0
- package/dist/middleware/cache.js +4 -1
- package/dist/middleware/error-handler.js +11 -0
- package/dist/middleware/extract-token.js +11 -2
- package/dist/middleware/is-admin.js +16 -0
- package/dist/middleware/is-locked.js +16 -0
- package/dist/middleware/mcp-oauth-guard.js +23 -0
- package/dist/middleware/request-counter.js +5 -2
- package/dist/packages/types/dist/index.js +117 -122
- package/dist/permissions/modules/process-ast/utils/extract-paths-from-query.js +10 -1
- package/dist/permissions/utils/get-unaliased-field-key.js +2 -1
- package/dist/request/is-denied-ip.js +2 -0
- package/dist/schedules/license.js +31 -0
- package/dist/schedules/oauth-cleanup.js +26 -0
- package/dist/schedules/retention.js +1 -1
- package/dist/schedules/telemetry.js +4 -1
- package/dist/schedules/tus.js +1 -1
- package/dist/schedules/utils/duration-to-cron.js +36 -0
- package/dist/services/activity.js +15 -0
- package/dist/services/authentication.js +12 -5
- package/dist/services/collections.js +40 -10
- package/dist/services/fields.js +6 -6
- package/dist/services/flows.js +12 -0
- package/dist/services/graphql/resolvers/system-admin.js +2 -2
- package/dist/services/graphql/resolvers/system-global.js +1 -1
- package/dist/services/graphql/resolvers/system.js +43 -27
- package/dist/services/graphql/schema/get-types.js +28 -7
- package/dist/services/graphql/schema/parse-query.js +8 -0
- package/dist/services/graphql/schema/read.js +12 -0
- package/dist/services/graphql/types/json-filter.js +30 -0
- package/dist/services/index.js +6 -6
- package/dist/services/items.js +32 -14
- package/dist/services/mcp-oauth/cimd.js +307 -0
- package/dist/services/mcp-oauth/index.js +1185 -0
- package/dist/services/mcp-oauth/types/error.js +22 -0
- package/dist/services/mcp-oauth/utils/cimd-egress.js +182 -0
- package/dist/services/mcp-oauth/utils/domain.js +21 -0
- package/dist/services/mcp-oauth/utils/loopback.js +11 -0
- package/dist/services/mcp-oauth/utils/redirect.js +84 -0
- package/dist/services/mcp-oauth/utils/registration-debug.js +131 -0
- package/dist/services/payload.js +2 -1
- package/dist/services/permissions.js +31 -9
- package/dist/services/revisions.js +15 -0
- package/dist/services/server.js +66 -68
- package/dist/services/settings.js +37 -3
- package/dist/services/users.js +23 -6
- package/dist/services/utils.js +6 -1
- package/dist/services/versions.js +160 -70
- package/dist/utils/calculate-field-depth.js +1 -0
- package/dist/utils/create-admin.js +3 -3
- package/dist/utils/deep-freeze.js +24 -0
- package/dist/utils/extract-function-name.js +13 -0
- package/dist/utils/generate-translations.js +5 -5
- package/dist/utils/get-accountability-for-token.js +13 -1
- package/dist/utils/get-cache-key.js +1 -1
- package/dist/utils/get-history-filter-query.js +22 -0
- package/dist/utils/get-schema.js +2 -2
- package/dist/utils/get-service.js +3 -3
- package/dist/utils/is-admin.js +9 -0
- package/dist/utils/is-unauthenticated.js +15 -0
- package/dist/utils/parse-oauth-scope.js +12 -0
- package/dist/utils/sanitize-query.js +2 -2
- package/dist/utils/split-field-path.js +29 -0
- package/dist/utils/store.js +1 -1
- package/dist/utils/transaction.js +2 -2
- package/dist/utils/translations-validation.js +2 -2
- package/dist/utils/validate-query.js +35 -4
- package/dist/utils/validate-user-count-integrity.js +28 -5
- package/dist/utils/verify-session-jwt.js +5 -2
- package/dist/utils/versioning/handle-version.js +131 -48
- package/dist/utils/versioning/remove-circular.js +17 -0
- package/dist/websocket/authenticate.js +2 -1
- package/dist/websocket/collab/collab.js +1 -1
- package/dist/websocket/collab/room.js +1 -1
- package/dist/websocket/controllers/base.js +12 -0
- package/dist/websocket/controllers/graphql.js +1 -1
- package/dist/websocket/handlers/subscribe.js +1 -1
- package/dist/websocket/messages.js +64 -64
- package/dist/websocket/utils/items.js +2 -2
- package/license +90 -80
- package/package.json +33 -32
- package/dist/controllers/mcp.js +0 -31
|
@@ -5,43 +5,43 @@ import { FolderItemInputSchema, FolderItemValidateSchema, PrimaryKeyInputSchema,
|
|
|
5
5
|
import { buildSanitizedQueryFromArgs } from "../utils.js";
|
|
6
6
|
import { toArray } from "@directus/utils";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { z } from "zod";
|
|
8
|
+
import { z as z$1 } from "zod";
|
|
9
9
|
import { dirname, resolve } from "node:path";
|
|
10
10
|
|
|
11
11
|
//#region src/ai/tools/folders/index.ts
|
|
12
12
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
-
const FoldersValidateSchema = z.discriminatedUnion("action", [
|
|
14
|
-
z.strictObject({
|
|
15
|
-
action: z.literal("create"),
|
|
16
|
-
data: z.union([z.array(FolderItemValidateSchema), FolderItemValidateSchema]),
|
|
13
|
+
const FoldersValidateSchema = z$1.discriminatedUnion("action", [
|
|
14
|
+
z$1.strictObject({
|
|
15
|
+
action: z$1.literal("create"),
|
|
16
|
+
data: z$1.union([z$1.array(FolderItemValidateSchema), FolderItemValidateSchema]),
|
|
17
17
|
query: QueryValidateSchema.optional()
|
|
18
18
|
}),
|
|
19
|
-
z.strictObject({
|
|
20
|
-
action: z.literal("read"),
|
|
21
|
-
keys: z.array(PrimaryKeyValidateSchema).optional(),
|
|
19
|
+
z$1.strictObject({
|
|
20
|
+
action: z$1.literal("read"),
|
|
21
|
+
keys: z$1.array(PrimaryKeyValidateSchema).optional(),
|
|
22
22
|
query: QueryValidateSchema.optional()
|
|
23
23
|
}),
|
|
24
|
-
z.strictObject({
|
|
25
|
-
action: z.literal("update"),
|
|
24
|
+
z$1.strictObject({
|
|
25
|
+
action: z$1.literal("update"),
|
|
26
26
|
data: FolderItemValidateSchema,
|
|
27
|
-
keys: z.array(PrimaryKeyValidateSchema).optional(),
|
|
27
|
+
keys: z$1.array(PrimaryKeyValidateSchema).optional(),
|
|
28
28
|
query: QueryValidateSchema.optional()
|
|
29
29
|
}),
|
|
30
|
-
z.strictObject({
|
|
31
|
-
action: z.literal("delete"),
|
|
32
|
-
keys: z.array(PrimaryKeyValidateSchema)
|
|
30
|
+
z$1.strictObject({
|
|
31
|
+
action: z$1.literal("delete"),
|
|
32
|
+
keys: z$1.array(PrimaryKeyValidateSchema)
|
|
33
33
|
})
|
|
34
34
|
]);
|
|
35
|
-
const FoldersInputSchema = z.object({
|
|
36
|
-
action: z.enum([
|
|
35
|
+
const FoldersInputSchema = z$1.object({
|
|
36
|
+
action: z$1.enum([
|
|
37
37
|
"create",
|
|
38
38
|
"read",
|
|
39
39
|
"update",
|
|
40
40
|
"delete"
|
|
41
41
|
]).describe("The operation to perform"),
|
|
42
42
|
query: QueryInputSchema.optional(),
|
|
43
|
-
keys: z.array(PrimaryKeyInputSchema).optional(),
|
|
44
|
-
data: z.array(FolderItemInputSchema).optional()
|
|
43
|
+
keys: z$1.array(PrimaryKeyInputSchema).optional(),
|
|
44
|
+
data: z$1.array(FolderItemInputSchema).optional()
|
|
45
45
|
});
|
|
46
46
|
const folders = defineTool({
|
|
47
47
|
name: "folders",
|
|
@@ -6,47 +6,47 @@ import { buildSanitizedQueryFromArgs } from "../utils.js";
|
|
|
6
6
|
import { ForbiddenError, InvalidPayloadError } from "@directus/errors";
|
|
7
7
|
import { toArray } from "@directus/utils";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
import { z } from "zod";
|
|
9
|
+
import { z as z$1 } from "zod";
|
|
10
10
|
import { dirname, resolve } from "node:path";
|
|
11
11
|
import { isSystemCollection } from "@directus/system-data";
|
|
12
12
|
import { isObject as isObject$1 } from "graphql-compose";
|
|
13
13
|
|
|
14
14
|
//#region src/ai/tools/items/index.ts
|
|
15
15
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
-
const PartialItemInputSchema = z.strictObject({ collection: z.string() });
|
|
17
|
-
const ItemsValidateSchema = z.discriminatedUnion("action", [
|
|
16
|
+
const PartialItemInputSchema = z$1.strictObject({ collection: z$1.string() });
|
|
17
|
+
const ItemsValidateSchema = z$1.discriminatedUnion("action", [
|
|
18
18
|
PartialItemInputSchema.extend({
|
|
19
|
-
action: z.literal("create"),
|
|
20
|
-
data: z.union([z.array(ItemValidateSchema), ItemValidateSchema]),
|
|
19
|
+
action: z$1.literal("create"),
|
|
20
|
+
data: z$1.union([z$1.array(ItemValidateSchema), ItemValidateSchema]),
|
|
21
21
|
query: QueryValidateSchema.optional()
|
|
22
22
|
}),
|
|
23
23
|
PartialItemInputSchema.extend({
|
|
24
|
-
action: z.literal("read"),
|
|
25
|
-
keys: z.array(PrimaryKeyValidateSchema).optional(),
|
|
24
|
+
action: z$1.literal("read"),
|
|
25
|
+
keys: z$1.array(PrimaryKeyValidateSchema).optional(),
|
|
26
26
|
query: QueryValidateSchema.optional()
|
|
27
27
|
}),
|
|
28
28
|
PartialItemInputSchema.extend({
|
|
29
|
-
action: z.literal("update"),
|
|
30
|
-
data: z.union([z.array(ItemValidateSchema), ItemValidateSchema]),
|
|
31
|
-
keys: z.array(PrimaryKeyValidateSchema).optional(),
|
|
29
|
+
action: z$1.literal("update"),
|
|
30
|
+
data: z$1.union([z$1.array(ItemValidateSchema), ItemValidateSchema]),
|
|
31
|
+
keys: z$1.array(PrimaryKeyValidateSchema).optional(),
|
|
32
32
|
query: QueryValidateSchema.optional()
|
|
33
33
|
}),
|
|
34
34
|
PartialItemInputSchema.extend({
|
|
35
|
-
action: z.literal("delete"),
|
|
36
|
-
keys: z.array(PrimaryKeyValidateSchema)
|
|
35
|
+
action: z$1.literal("delete"),
|
|
36
|
+
keys: z$1.array(PrimaryKeyValidateSchema)
|
|
37
37
|
})
|
|
38
38
|
]);
|
|
39
|
-
const ItemsInputSchema = z.object({
|
|
40
|
-
action: z.enum([
|
|
39
|
+
const ItemsInputSchema = z$1.object({
|
|
40
|
+
action: z$1.enum([
|
|
41
41
|
"create",
|
|
42
42
|
"read",
|
|
43
43
|
"update",
|
|
44
44
|
"delete"
|
|
45
45
|
]).describe("The operation to perform"),
|
|
46
|
-
collection: z.string().describe("The name of the collection"),
|
|
46
|
+
collection: z$1.string().describe("The name of the collection"),
|
|
47
47
|
query: QueryInputSchema.optional(),
|
|
48
|
-
keys: z.array(PrimaryKeyInputSchema).optional(),
|
|
49
|
-
data: z.union([z.array(ItemInputSchema), ItemInputSchema]).optional().describe("Object when using keys, array with PKs for batch updates")
|
|
48
|
+
keys: z$1.array(PrimaryKeyInputSchema).optional(),
|
|
49
|
+
data: z$1.union([z$1.array(ItemInputSchema), ItemInputSchema]).optional().describe("Object when using keys, array with PKs for batch updates")
|
|
50
50
|
});
|
|
51
51
|
const items = defineTool({
|
|
52
52
|
name: "items",
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { requireText } from "../../../utils/require-text.js";
|
|
2
2
|
import { defineTool } from "../define-tool.js";
|
|
3
|
+
import { OperationsService } from "../../../services/operations.js";
|
|
3
4
|
import { OperationItemInputSchema, OperationItemValidateSchema, QueryInputSchema, QueryValidateSchema } from "../schema.js";
|
|
4
5
|
import { buildSanitizedQueryFromArgs } from "../utils.js";
|
|
5
|
-
import { OperationsService } from "../../../services/operations.js";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { z } from "zod";
|
|
7
|
+
import { z as z$1 } from "zod";
|
|
8
8
|
import { dirname, resolve } from "node:path";
|
|
9
9
|
|
|
10
10
|
//#region src/ai/tools/operations/index.ts
|
|
11
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
const OperationsValidationSchema = z.discriminatedUnion("action", [
|
|
13
|
-
z.strictObject({
|
|
14
|
-
action: z.literal("create"),
|
|
12
|
+
const OperationsValidationSchema = z$1.discriminatedUnion("action", [
|
|
13
|
+
z$1.strictObject({
|
|
14
|
+
action: z$1.literal("create"),
|
|
15
15
|
data: OperationItemValidateSchema
|
|
16
16
|
}),
|
|
17
|
-
z.strictObject({
|
|
18
|
-
action: z.literal("read"),
|
|
17
|
+
z$1.strictObject({
|
|
18
|
+
action: z$1.literal("read"),
|
|
19
19
|
query: QueryValidateSchema.optional()
|
|
20
20
|
}),
|
|
21
|
-
z.strictObject({
|
|
22
|
-
action: z.literal("update"),
|
|
21
|
+
z$1.strictObject({
|
|
22
|
+
action: z$1.literal("update"),
|
|
23
23
|
data: OperationItemValidateSchema,
|
|
24
|
-
key: z.string(),
|
|
24
|
+
key: z$1.string(),
|
|
25
25
|
query: QueryValidateSchema.optional()
|
|
26
26
|
}),
|
|
27
|
-
z.strictObject({
|
|
28
|
-
action: z.literal("delete"),
|
|
29
|
-
key: z.string()
|
|
27
|
+
z$1.strictObject({
|
|
28
|
+
action: z$1.literal("delete"),
|
|
29
|
+
key: z$1.string()
|
|
30
30
|
})
|
|
31
31
|
]);
|
|
32
|
-
const OperationsInputSchema = z.object({
|
|
33
|
-
action: z.enum([
|
|
32
|
+
const OperationsInputSchema = z$1.object({
|
|
33
|
+
action: z$1.enum([
|
|
34
34
|
"create",
|
|
35
35
|
"read",
|
|
36
36
|
"update",
|
|
@@ -38,7 +38,7 @@ const OperationsInputSchema = z.object({
|
|
|
38
38
|
]).describe("The operation to perform"),
|
|
39
39
|
query: QueryInputSchema.optional(),
|
|
40
40
|
data: OperationItemInputSchema.optional(),
|
|
41
|
-
key: z.string().optional()
|
|
41
|
+
key: z$1.string().optional()
|
|
42
42
|
});
|
|
43
43
|
const operations = defineTool({
|
|
44
44
|
name: "operations",
|
|
@@ -4,44 +4,44 @@ import { RelationsService } from "../../../services/relations.js";
|
|
|
4
4
|
import { RelationItemInputSchema, RelationItemValidateCreateSchema, RelationItemValidateUpdateSchema } from "../schema.js";
|
|
5
5
|
import { InvalidPayloadError } from "@directus/errors";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { z } from "zod";
|
|
7
|
+
import { z as z$1 } from "zod";
|
|
8
8
|
import { dirname, resolve } from "node:path";
|
|
9
9
|
|
|
10
10
|
//#region src/ai/tools/relations/index.ts
|
|
11
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
const RelationsValidateSchema = z.discriminatedUnion("action", [
|
|
13
|
-
z.object({
|
|
14
|
-
action: z.literal("create"),
|
|
15
|
-
collection: z.string(),
|
|
16
|
-
field: z.string().optional(),
|
|
12
|
+
const RelationsValidateSchema = z$1.discriminatedUnion("action", [
|
|
13
|
+
z$1.object({
|
|
14
|
+
action: z$1.literal("create"),
|
|
15
|
+
collection: z$1.string(),
|
|
16
|
+
field: z$1.string().optional(),
|
|
17
17
|
data: RelationItemValidateCreateSchema
|
|
18
18
|
}),
|
|
19
|
-
z.object({
|
|
20
|
-
action: z.literal("read"),
|
|
21
|
-
collection: z.string().optional(),
|
|
22
|
-
field: z.string().optional()
|
|
19
|
+
z$1.object({
|
|
20
|
+
action: z$1.literal("read"),
|
|
21
|
+
collection: z$1.string().optional(),
|
|
22
|
+
field: z$1.string().optional()
|
|
23
23
|
}),
|
|
24
|
-
z.object({
|
|
25
|
-
action: z.literal("update"),
|
|
26
|
-
collection: z.string(),
|
|
27
|
-
field: z.string(),
|
|
24
|
+
z$1.object({
|
|
25
|
+
action: z$1.literal("update"),
|
|
26
|
+
collection: z$1.string(),
|
|
27
|
+
field: z$1.string(),
|
|
28
28
|
data: RelationItemValidateUpdateSchema
|
|
29
29
|
}),
|
|
30
|
-
z.object({
|
|
31
|
-
action: z.literal("delete"),
|
|
32
|
-
collection: z.string(),
|
|
33
|
-
field: z.string()
|
|
30
|
+
z$1.object({
|
|
31
|
+
action: z$1.literal("delete"),
|
|
32
|
+
collection: z$1.string(),
|
|
33
|
+
field: z$1.string()
|
|
34
34
|
})
|
|
35
35
|
]);
|
|
36
|
-
const RelationsInputSchema = z.object({
|
|
37
|
-
action: z.enum([
|
|
36
|
+
const RelationsInputSchema = z$1.object({
|
|
37
|
+
action: z$1.enum([
|
|
38
38
|
"create",
|
|
39
39
|
"read",
|
|
40
40
|
"update",
|
|
41
41
|
"delete"
|
|
42
42
|
]).describe("The operation to perform"),
|
|
43
|
-
collection: z.string().describe("The name of the collection (required for create, update, delete)").optional(),
|
|
44
|
-
field: z.string().describe("The name of the field (required for create, update, delete)").optional(),
|
|
43
|
+
collection: z$1.string().describe("The name of the collection (required for create, update, delete)").optional(),
|
|
44
|
+
field: z$1.string().describe("The name of the field (required for create, update, delete)").optional(),
|
|
45
45
|
data: RelationItemInputSchema.optional().describe("The relation data. (required for create, update)")
|
|
46
46
|
});
|
|
47
47
|
const relations = defineTool({
|
|
@@ -4,13 +4,13 @@ import { RelationsService } from "../../../services/relations.js";
|
|
|
4
4
|
import { FieldsService } from "../../../services/fields.js";
|
|
5
5
|
import { CollectionsService } from "../../../services/collections.js";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { z } from "zod";
|
|
7
|
+
import { z as z$1 } from "zod";
|
|
8
8
|
import { dirname, resolve } from "node:path";
|
|
9
9
|
|
|
10
10
|
//#region src/ai/tools/schema/index.ts
|
|
11
11
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
12
|
-
const SchemaValidateSchema = z.strictObject({ keys: z.array(z.string()).optional() });
|
|
13
|
-
const SchemaInputSchema = z.object({ keys: z.array(z.string()).optional().describe("Collection names to get detailed schema for. If omitted, returns a lightweight list of all collections.") });
|
|
12
|
+
const SchemaValidateSchema = z$1.strictObject({ keys: z$1.array(z$1.string()).optional() });
|
|
13
|
+
const SchemaInputSchema = z$1.object({ keys: z$1.array(z$1.string()).optional().describe("Collection names to get detailed schema for. If omitted, returns a lightweight list of all collections.") });
|
|
14
14
|
const schema = defineTool({
|
|
15
15
|
name: "schema",
|
|
16
16
|
description: requireText(resolve(__dirname, "./prompt.md")),
|
package/dist/ai/tools/schema.js
CHANGED
|
@@ -1,209 +1,209 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
1
|
+
import { z as z$1 } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/ai/tools/schema.ts
|
|
4
|
-
const PrimaryKeyInputSchema = z.union([z.number(), z.string()]);
|
|
5
|
-
const PrimaryKeyValidateSchema = z.union([z.number(), z.string()]);
|
|
6
|
-
const ItemInputSchema = z.record(z.string(), z.any());
|
|
7
|
-
const ItemValidateSchema = z.record(z.string(), z.any());
|
|
8
|
-
const QueryInputSchema = z.object({
|
|
9
|
-
fields: z.array(z.string()),
|
|
10
|
-
sort: z.array(z.string()),
|
|
11
|
-
filter: z.record(z.string(), z.any()),
|
|
12
|
-
limit: z.number(),
|
|
13
|
-
offset: z.number(),
|
|
14
|
-
page: z.number(),
|
|
15
|
-
search: z.string(),
|
|
16
|
-
deep: z.record(z.string(), z.any()),
|
|
17
|
-
alias: z.record(z.string(), z.string()),
|
|
18
|
-
aggregate: z.object({
|
|
19
|
-
count: z.array(z.string()).optional(),
|
|
20
|
-
sum: z.array(z.string()).optional(),
|
|
21
|
-
avg: z.array(z.string()).optional(),
|
|
22
|
-
min: z.array(z.string()).optional(),
|
|
23
|
-
max: z.array(z.string()).optional()
|
|
4
|
+
const PrimaryKeyInputSchema = z$1.union([z$1.number(), z$1.string()]);
|
|
5
|
+
const PrimaryKeyValidateSchema = z$1.union([z$1.number(), z$1.string()]);
|
|
6
|
+
const ItemInputSchema = z$1.record(z$1.string(), z$1.any());
|
|
7
|
+
const ItemValidateSchema = z$1.record(z$1.string(), z$1.any());
|
|
8
|
+
const QueryInputSchema = z$1.object({
|
|
9
|
+
fields: z$1.array(z$1.string()),
|
|
10
|
+
sort: z$1.array(z$1.string()),
|
|
11
|
+
filter: z$1.record(z$1.string(), z$1.any()),
|
|
12
|
+
limit: z$1.number(),
|
|
13
|
+
offset: z$1.number(),
|
|
14
|
+
page: z$1.number(),
|
|
15
|
+
search: z$1.string(),
|
|
16
|
+
deep: z$1.record(z$1.string(), z$1.any()),
|
|
17
|
+
alias: z$1.record(z$1.string(), z$1.string()),
|
|
18
|
+
aggregate: z$1.object({
|
|
19
|
+
count: z$1.array(z$1.string()).optional(),
|
|
20
|
+
sum: z$1.array(z$1.string()).optional(),
|
|
21
|
+
avg: z$1.array(z$1.string()).optional(),
|
|
22
|
+
min: z$1.array(z$1.string()).optional(),
|
|
23
|
+
max: z$1.array(z$1.string()).optional()
|
|
24
24
|
}),
|
|
25
|
-
backlink: z.boolean(),
|
|
26
|
-
version: z.string(),
|
|
27
|
-
versionRaw: z.boolean(),
|
|
28
|
-
export: z.string(),
|
|
29
|
-
groupBy: z.array(z.string())
|
|
25
|
+
backlink: z$1.boolean(),
|
|
26
|
+
version: z$1.string(),
|
|
27
|
+
versionRaw: z$1.boolean(),
|
|
28
|
+
export: z$1.string(),
|
|
29
|
+
groupBy: z$1.array(z$1.string())
|
|
30
30
|
}).partial();
|
|
31
31
|
const QueryValidateSchema = QueryInputSchema;
|
|
32
|
-
const RawFieldItemInputSchema = z.object({
|
|
33
|
-
field: z.string(),
|
|
34
|
-
type: z.string(),
|
|
35
|
-
name: z.string().optional(),
|
|
36
|
-
children: z.union([z.array(z.record(z.string(), z.any())), z.null()]).optional(),
|
|
37
|
-
collection: z.string().optional(),
|
|
38
|
-
schema: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
39
|
-
meta: z.union([z.record(z.string(), z.any()), z.null()]).optional()
|
|
32
|
+
const RawFieldItemInputSchema = z$1.object({
|
|
33
|
+
field: z$1.string(),
|
|
34
|
+
type: z$1.string(),
|
|
35
|
+
name: z$1.string().optional(),
|
|
36
|
+
children: z$1.union([z$1.array(z$1.record(z$1.string(), z$1.any())), z$1.null()]).optional(),
|
|
37
|
+
collection: z$1.string().optional(),
|
|
38
|
+
schema: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]).optional(),
|
|
39
|
+
meta: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]).optional()
|
|
40
40
|
});
|
|
41
41
|
const RawFieldItemValidateSchema = RawFieldItemInputSchema;
|
|
42
|
-
const FieldItemInputSchema = z.object({
|
|
43
|
-
field: z.string(),
|
|
44
|
-
type: z.string().nullable(),
|
|
45
|
-
name: z.string().optional(),
|
|
46
|
-
collection: z.string().optional(),
|
|
47
|
-
schema: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
48
|
-
meta: z.union([z.record(z.string(), z.any()), z.null()]).optional()
|
|
42
|
+
const FieldItemInputSchema = z$1.object({
|
|
43
|
+
field: z$1.string(),
|
|
44
|
+
type: z$1.string().nullable(),
|
|
45
|
+
name: z$1.string().optional(),
|
|
46
|
+
collection: z$1.string().optional(),
|
|
47
|
+
schema: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]).optional(),
|
|
48
|
+
meta: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]).optional()
|
|
49
49
|
});
|
|
50
50
|
const FieldItemValidateSchema = FieldItemInputSchema;
|
|
51
|
-
const CollectionItemInputSchema = z.object({
|
|
52
|
-
collection: z.string(),
|
|
53
|
-
fields: z.array(RawFieldItemInputSchema).optional(),
|
|
54
|
-
meta: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
55
|
-
schema: z.union([z.object({}), z.null()]).optional().describe("ALWAYS an empty object for new collections. Only send `null` or `undefined` for folder collections.")
|
|
51
|
+
const CollectionItemInputSchema = z$1.object({
|
|
52
|
+
collection: z$1.string(),
|
|
53
|
+
fields: z$1.array(RawFieldItemInputSchema).optional(),
|
|
54
|
+
meta: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]).optional(),
|
|
55
|
+
schema: z$1.union([z$1.object({}), z$1.null()]).optional().describe("ALWAYS an empty object for new collections. Only send `null` or `undefined` for folder collections.")
|
|
56
56
|
});
|
|
57
57
|
const CollectionItemValidateCreateSchema = CollectionItemInputSchema;
|
|
58
|
-
const CollectionItemValidateUpdateSchema = z.object({
|
|
59
|
-
collection: z.string(),
|
|
60
|
-
meta: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
61
|
-
schema: z.union([z.record(z.string(), z.any()), z.null()]).optional()
|
|
58
|
+
const CollectionItemValidateUpdateSchema = z$1.object({
|
|
59
|
+
collection: z$1.string(),
|
|
60
|
+
meta: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]).optional(),
|
|
61
|
+
schema: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]).optional()
|
|
62
62
|
});
|
|
63
|
-
const FileItemInputSchema = z.object({
|
|
64
|
-
id: z.string(),
|
|
65
|
-
storage: z.string(),
|
|
66
|
-
filename_disk: z.string(),
|
|
67
|
-
filename_download: z.string(),
|
|
68
|
-
title: z.union([z.string(), z.null()]),
|
|
69
|
-
type: z.union([z.string(), z.null()]),
|
|
70
|
-
folder: z.union([z.string(), z.null()]),
|
|
71
|
-
created_on: z.string(),
|
|
72
|
-
uploaded_by: z.union([z.string(), z.null()]),
|
|
73
|
-
uploaded_on: z.union([z.string(), z.null()]),
|
|
74
|
-
modified_by: z.union([z.string(), z.null()]),
|
|
75
|
-
modified_on: z.string(),
|
|
76
|
-
charset: z.union([z.string(), z.null()]),
|
|
77
|
-
filesize: z.number(),
|
|
78
|
-
width: z.union([z.number(), z.null()]),
|
|
79
|
-
height: z.union([z.number(), z.null()]),
|
|
80
|
-
duration: z.union([z.number(), z.null()]),
|
|
81
|
-
embed: z.union([z.string(), z.null()]),
|
|
82
|
-
description: z.union([z.string(), z.null()]),
|
|
83
|
-
location: z.union([z.string(), z.null()]),
|
|
84
|
-
tags: z.union([z.string(), z.null()]),
|
|
85
|
-
metadata: z.union([z.record(z.string(), z.any()), z.null()]),
|
|
86
|
-
focal_point_x: z.union([z.number(), z.null()]),
|
|
87
|
-
focal_point_y: z.union([z.number(), z.null()]),
|
|
88
|
-
tus_id: z.union([z.string(), z.null()]),
|
|
89
|
-
tus_data: z.union([z.record(z.string(), z.any()), z.null()])
|
|
63
|
+
const FileItemInputSchema = z$1.object({
|
|
64
|
+
id: z$1.string(),
|
|
65
|
+
storage: z$1.string(),
|
|
66
|
+
filename_disk: z$1.string(),
|
|
67
|
+
filename_download: z$1.string(),
|
|
68
|
+
title: z$1.union([z$1.string(), z$1.null()]),
|
|
69
|
+
type: z$1.union([z$1.string(), z$1.null()]),
|
|
70
|
+
folder: z$1.union([z$1.string(), z$1.null()]),
|
|
71
|
+
created_on: z$1.string(),
|
|
72
|
+
uploaded_by: z$1.union([z$1.string(), z$1.null()]),
|
|
73
|
+
uploaded_on: z$1.union([z$1.string(), z$1.null()]),
|
|
74
|
+
modified_by: z$1.union([z$1.string(), z$1.null()]),
|
|
75
|
+
modified_on: z$1.string(),
|
|
76
|
+
charset: z$1.union([z$1.string(), z$1.null()]),
|
|
77
|
+
filesize: z$1.number(),
|
|
78
|
+
width: z$1.union([z$1.number(), z$1.null()]),
|
|
79
|
+
height: z$1.union([z$1.number(), z$1.null()]),
|
|
80
|
+
duration: z$1.union([z$1.number(), z$1.null()]),
|
|
81
|
+
embed: z$1.union([z$1.string(), z$1.null()]),
|
|
82
|
+
description: z$1.union([z$1.string(), z$1.null()]),
|
|
83
|
+
location: z$1.union([z$1.string(), z$1.null()]),
|
|
84
|
+
tags: z$1.union([z$1.string(), z$1.null()]),
|
|
85
|
+
metadata: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]),
|
|
86
|
+
focal_point_x: z$1.union([z$1.number(), z$1.null()]),
|
|
87
|
+
focal_point_y: z$1.union([z$1.number(), z$1.null()]),
|
|
88
|
+
tus_id: z$1.union([z$1.string(), z$1.null()]),
|
|
89
|
+
tus_data: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()])
|
|
90
90
|
}).partial();
|
|
91
91
|
const FileItemValidateSchema = FileItemInputSchema;
|
|
92
|
-
const FileImportItemInputSchema = z.object({
|
|
93
|
-
url: z.string(),
|
|
92
|
+
const FileImportItemInputSchema = z$1.object({
|
|
93
|
+
url: z$1.string(),
|
|
94
94
|
file: FileItemInputSchema
|
|
95
95
|
});
|
|
96
|
-
const FileImportItemValidateSchema = z.object({
|
|
97
|
-
url: z.string(),
|
|
96
|
+
const FileImportItemValidateSchema = z$1.object({
|
|
97
|
+
url: z$1.string(),
|
|
98
98
|
file: FileItemValidateSchema
|
|
99
99
|
});
|
|
100
|
-
const OperationItemInputSchema = z.object({
|
|
101
|
-
id: z.string(),
|
|
102
|
-
name: z.union([z.string(), z.null()]),
|
|
103
|
-
key: z.string(),
|
|
104
|
-
type: z.string(),
|
|
105
|
-
position_x: z.number(),
|
|
106
|
-
position_y: z.number(),
|
|
107
|
-
options: z.record(z.string(), z.any()),
|
|
108
|
-
resolve: z.union([z.string(), z.null()]),
|
|
109
|
-
reject: z.union([z.string(), z.null()]),
|
|
110
|
-
flow: z.string(),
|
|
111
|
-
date_created: z.string(),
|
|
112
|
-
user_created: z.string()
|
|
100
|
+
const OperationItemInputSchema = z$1.object({
|
|
101
|
+
id: z$1.string(),
|
|
102
|
+
name: z$1.union([z$1.string(), z$1.null()]),
|
|
103
|
+
key: z$1.string(),
|
|
104
|
+
type: z$1.string(),
|
|
105
|
+
position_x: z$1.number(),
|
|
106
|
+
position_y: z$1.number(),
|
|
107
|
+
options: z$1.record(z$1.string(), z$1.any()),
|
|
108
|
+
resolve: z$1.union([z$1.string(), z$1.null()]),
|
|
109
|
+
reject: z$1.union([z$1.string(), z$1.null()]),
|
|
110
|
+
flow: z$1.string(),
|
|
111
|
+
date_created: z$1.string(),
|
|
112
|
+
user_created: z$1.string()
|
|
113
113
|
}).partial();
|
|
114
114
|
const OperationItemValidateSchema = OperationItemInputSchema;
|
|
115
|
-
const FlowItemInputSchema = z.object({
|
|
116
|
-
id: z.string(),
|
|
117
|
-
name: z.string(),
|
|
118
|
-
icon: z.union([z.string(), z.null()]),
|
|
119
|
-
color: z.union([z.string(), z.null()]),
|
|
120
|
-
description: z.union([z.string(), z.null()]),
|
|
121
|
-
status: z.enum(["active", "inactive"]),
|
|
122
|
-
trigger: z.enum([
|
|
115
|
+
const FlowItemInputSchema = z$1.object({
|
|
116
|
+
id: z$1.string(),
|
|
117
|
+
name: z$1.string(),
|
|
118
|
+
icon: z$1.union([z$1.string(), z$1.null()]),
|
|
119
|
+
color: z$1.union([z$1.string(), z$1.null()]),
|
|
120
|
+
description: z$1.union([z$1.string(), z$1.null()]),
|
|
121
|
+
status: z$1.enum(["active", "inactive"]),
|
|
122
|
+
trigger: z$1.enum([
|
|
123
123
|
"event",
|
|
124
124
|
"schedule",
|
|
125
125
|
"operation",
|
|
126
126
|
"webhook",
|
|
127
127
|
"manual"
|
|
128
128
|
]),
|
|
129
|
-
options: z.union([z.record(z.string(), z.any()), z.null()]),
|
|
130
|
-
operation: z.union([z.string(), z.null()]),
|
|
131
|
-
operations: z.array(OperationItemInputSchema),
|
|
132
|
-
date_created: z.string(),
|
|
133
|
-
user_created: z.string(),
|
|
134
|
-
accountability: z.enum(["all", "activity"])
|
|
129
|
+
options: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]),
|
|
130
|
+
operation: z$1.union([z$1.string(), z$1.null()]),
|
|
131
|
+
operations: z$1.array(OperationItemInputSchema),
|
|
132
|
+
date_created: z$1.string(),
|
|
133
|
+
user_created: z$1.string(),
|
|
134
|
+
accountability: z$1.enum(["all", "activity"])
|
|
135
135
|
}).partial();
|
|
136
136
|
const FlowItemValidateSchema = FlowItemInputSchema;
|
|
137
|
-
const TriggerFlowInputSchema = z.object({
|
|
137
|
+
const TriggerFlowInputSchema = z$1.object({
|
|
138
138
|
id: PrimaryKeyInputSchema,
|
|
139
|
-
collection: z.string(),
|
|
140
|
-
keys: z.array(PrimaryKeyInputSchema).optional(),
|
|
141
|
-
headers: z.record(z.string(), z.any()).optional(),
|
|
142
|
-
query: z.record(z.string(), z.any()).optional(),
|
|
143
|
-
data: z.record(z.string(), z.any()).optional()
|
|
139
|
+
collection: z$1.string(),
|
|
140
|
+
keys: z$1.array(PrimaryKeyInputSchema).optional(),
|
|
141
|
+
headers: z$1.record(z$1.string(), z$1.any()).optional(),
|
|
142
|
+
query: z$1.record(z$1.string(), z$1.any()).optional(),
|
|
143
|
+
data: z$1.record(z$1.string(), z$1.any()).optional()
|
|
144
144
|
});
|
|
145
|
-
const TriggerFlowValidateSchema = z.strictObject({
|
|
145
|
+
const TriggerFlowValidateSchema = z$1.strictObject({
|
|
146
146
|
id: PrimaryKeyValidateSchema,
|
|
147
|
-
collection: z.string(),
|
|
148
|
-
keys: z.array(PrimaryKeyValidateSchema).optional(),
|
|
149
|
-
query: z.record(z.string(), z.any()).optional(),
|
|
150
|
-
headers: z.record(z.string(), z.any()).optional(),
|
|
151
|
-
data: z.record(z.string(), z.any()).optional()
|
|
147
|
+
collection: z$1.string(),
|
|
148
|
+
keys: z$1.array(PrimaryKeyValidateSchema).optional(),
|
|
149
|
+
query: z$1.record(z$1.string(), z$1.any()).optional(),
|
|
150
|
+
headers: z$1.record(z$1.string(), z$1.any()).optional(),
|
|
151
|
+
data: z$1.record(z$1.string(), z$1.any()).optional()
|
|
152
152
|
});
|
|
153
|
-
const FolderItemInputSchema = z.object({
|
|
153
|
+
const FolderItemInputSchema = z$1.object({
|
|
154
154
|
id: PrimaryKeyInputSchema.optional(),
|
|
155
|
-
name: z.string(),
|
|
156
|
-
parent: z.string().optional()
|
|
155
|
+
name: z$1.string(),
|
|
156
|
+
parent: z$1.string().optional()
|
|
157
157
|
});
|
|
158
158
|
const FolderItemValidateSchema = FolderItemInputSchema;
|
|
159
|
-
const RelationItemInputSchema = z.object({
|
|
160
|
-
collection: z.string(),
|
|
161
|
-
field: z.string(),
|
|
162
|
-
related_collection: z.union([z.string(), z.null()]),
|
|
163
|
-
schema: z.union([z.record(z.string(), z.any()), z.null()]),
|
|
164
|
-
meta: z.union([z.record(z.string(), z.any()), z.null()])
|
|
159
|
+
const RelationItemInputSchema = z$1.object({
|
|
160
|
+
collection: z$1.string(),
|
|
161
|
+
field: z$1.string(),
|
|
162
|
+
related_collection: z$1.union([z$1.string(), z$1.null()]),
|
|
163
|
+
schema: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()]),
|
|
164
|
+
meta: z$1.union([z$1.record(z$1.string(), z$1.any()), z$1.null()])
|
|
165
165
|
});
|
|
166
|
-
const RelationMetaSchema = z.object({
|
|
167
|
-
id: z.number(),
|
|
168
|
-
many_collection: z.string(),
|
|
169
|
-
many_field: z.string(),
|
|
170
|
-
one_collection: z.string().nullable(),
|
|
171
|
-
one_field: z.string().nullable(),
|
|
172
|
-
one_collection_field: z.string().nullable(),
|
|
173
|
-
one_allowed_collections: z.array(z.string()).nullable(),
|
|
174
|
-
one_deselect_action: z.enum(["nullify", "delete"]),
|
|
175
|
-
junction_field: z.string().nullable(),
|
|
176
|
-
sort_field: z.string().nullable(),
|
|
177
|
-
system: z.boolean().optional()
|
|
166
|
+
const RelationMetaSchema = z$1.object({
|
|
167
|
+
id: z$1.number(),
|
|
168
|
+
many_collection: z$1.string(),
|
|
169
|
+
many_field: z$1.string(),
|
|
170
|
+
one_collection: z$1.string().nullable(),
|
|
171
|
+
one_field: z$1.string().nullable(),
|
|
172
|
+
one_collection_field: z$1.string().nullable(),
|
|
173
|
+
one_allowed_collections: z$1.array(z$1.string()).nullable(),
|
|
174
|
+
one_deselect_action: z$1.enum(["nullify", "delete"]),
|
|
175
|
+
junction_field: z$1.string().nullable(),
|
|
176
|
+
sort_field: z$1.string().nullable(),
|
|
177
|
+
system: z$1.boolean().optional()
|
|
178
178
|
});
|
|
179
|
-
const FkActionEnum = z.enum([
|
|
179
|
+
const FkActionEnum = z$1.enum([
|
|
180
180
|
"NO ACTION",
|
|
181
181
|
"RESTRICT",
|
|
182
182
|
"CASCADE",
|
|
183
183
|
"SET NULL",
|
|
184
184
|
"SET DEFAULT"
|
|
185
185
|
]);
|
|
186
|
-
const ForeignKeySchema = z.object({
|
|
187
|
-
table: z.string(),
|
|
188
|
-
column: z.string(),
|
|
189
|
-
foreign_key_table: z.string(),
|
|
190
|
-
foreign_key_column: z.string(),
|
|
191
|
-
foreign_key_schema: z.string().optional(),
|
|
192
|
-
constraint_name: z.union([z.string(), z.null()]),
|
|
193
|
-
on_update: z.union([FkActionEnum, z.null()]),
|
|
194
|
-
on_delete: z.union([FkActionEnum, z.null()])
|
|
186
|
+
const ForeignKeySchema = z$1.object({
|
|
187
|
+
table: z$1.string(),
|
|
188
|
+
column: z$1.string(),
|
|
189
|
+
foreign_key_table: z$1.string(),
|
|
190
|
+
foreign_key_column: z$1.string(),
|
|
191
|
+
foreign_key_schema: z$1.string().optional(),
|
|
192
|
+
constraint_name: z$1.union([z$1.string(), z$1.null()]),
|
|
193
|
+
on_update: z$1.union([FkActionEnum, z$1.null()]),
|
|
194
|
+
on_delete: z$1.union([FkActionEnum, z$1.null()])
|
|
195
195
|
});
|
|
196
|
-
const RelationItemValidateCreateSchema = z.object({
|
|
197
|
-
collection: z.string(),
|
|
198
|
-
field: z.string(),
|
|
199
|
-
related_collection: z.string().nullable(),
|
|
196
|
+
const RelationItemValidateCreateSchema = z$1.object({
|
|
197
|
+
collection: z$1.string(),
|
|
198
|
+
field: z$1.string(),
|
|
199
|
+
related_collection: z$1.string().nullable(),
|
|
200
200
|
schema: ForeignKeySchema.partial().nullable().optional(),
|
|
201
201
|
meta: RelationMetaSchema.partial().nullable()
|
|
202
202
|
});
|
|
203
|
-
const RelationItemValidateUpdateSchema = z.object({
|
|
204
|
-
collection: z.string(),
|
|
205
|
-
field: z.string(),
|
|
206
|
-
related_collection: z.string().nullable().optional(),
|
|
203
|
+
const RelationItemValidateUpdateSchema = z$1.object({
|
|
204
|
+
collection: z$1.string(),
|
|
205
|
+
field: z$1.string(),
|
|
206
|
+
related_collection: z$1.string().nullable().optional(),
|
|
207
207
|
schema: ForeignKeySchema.partial().nullable().optional(),
|
|
208
208
|
meta: RelationMetaSchema.partial().nullable().optional()
|
|
209
209
|
}).optional();
|