@directus/api 32.1.1 → 33.0.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/ai/chat/constants/system-prompt.d.ts +1 -0
- package/dist/ai/chat/constants/system-prompt.js +51 -0
- package/dist/ai/chat/controllers/chat.post.d.ts +2 -0
- package/dist/ai/chat/controllers/chat.post.js +47 -0
- package/dist/ai/chat/lib/create-ui-stream.d.ts +15 -0
- package/dist/ai/chat/lib/create-ui-stream.js +42 -0
- package/dist/ai/chat/middleware/load-settings.d.ts +2 -0
- package/dist/ai/chat/middleware/load-settings.js +18 -0
- package/dist/ai/chat/models/chat-request.d.ts +34 -0
- package/dist/ai/chat/models/chat-request.js +26 -0
- package/dist/ai/chat/models/providers.d.ts +9 -0
- package/dist/ai/chat/models/providers.js +9 -0
- package/dist/ai/chat/router.d.ts +1 -0
- package/dist/ai/chat/router.js +5 -0
- package/dist/ai/chat/utils/chat-request-tool-to-ai-sdk-tool.d.ts +9 -0
- package/dist/ai/chat/utils/chat-request-tool-to-ai-sdk-tool.js +38 -0
- package/dist/ai/chat/utils/fix-error-tool-calls.d.ts +12 -0
- package/dist/ai/chat/utils/fix-error-tool-calls.js +30 -0
- package/dist/ai/chat/utils/parse-json-schema-7.d.ts +13 -0
- package/dist/ai/chat/utils/parse-json-schema-7.js +75 -0
- package/dist/{mcp → ai/mcp}/server.d.ts +13 -16
- package/dist/{mcp → ai/mcp}/server.js +4 -13
- package/dist/ai/mcp/types.d.ts +15 -0
- package/dist/{mcp/tools/assets.js → ai/tools/assets/index.js} +8 -5
- package/dist/{mcp/tools/collections.js → ai/tools/collections/index.js} +7 -4
- package/dist/{mcp/tools/fields.js → ai/tools/fields/index.js} +12 -9
- package/dist/{mcp/tools/files.js → ai/tools/files/index.js} +11 -5
- package/dist/{mcp/tools/flows.js → ai/tools/flows/index.js} +11 -5
- package/dist/{mcp/tools/folders.js → ai/tools/folders/index.js} +12 -5
- package/dist/ai/tools/index.d.ts +15 -0
- package/dist/ai/tools/index.js +29 -0
- package/dist/{mcp/tools/items.js → ai/tools/items/index.js} +13 -6
- package/dist/{mcp/tools/prompts/items.md → ai/tools/items/prompt.md} +19 -15
- package/dist/{mcp/tools/operations.d.ts → ai/tools/operations/index.d.ts} +46 -0
- package/dist/{mcp/tools/operations.js → ai/tools/operations/index.js} +12 -5
- package/dist/{mcp/tools/relations.js → ai/tools/relations/index.js} +7 -4
- package/dist/{mcp/tools/schema.d.ts → ai/tools/schema/index.d.ts} +1 -1
- package/dist/{mcp/tools/schema.js → ai/tools/schema/index.js} +9 -6
- package/dist/{mcp/tools/system.js → ai/tools/system/index.js} +7 -4
- package/dist/{mcp/tools/trigger-flow.js → ai/tools/trigger-flow/index.js} +8 -5
- package/dist/{mcp → ai/tools}/types.d.ts +1 -17
- package/dist/ai/tools/utils.d.ts +9 -0
- package/dist/ai/tools/utils.js +17 -0
- package/dist/app.js +11 -6
- package/dist/auth/drivers/ldap.js +2 -2
- package/dist/auth/drivers/local.js +1 -1
- package/dist/auth/drivers/oauth2.d.ts +1 -2
- package/dist/auth/drivers/oauth2.js +22 -17
- package/dist/auth/drivers/openid.d.ts +1 -2
- package/dist/auth/drivers/openid.js +18 -13
- package/dist/auth/drivers/saml.js +6 -3
- package/dist/auth/utils/generate-callback-url.d.ts +11 -0
- package/dist/auth/utils/generate-callback-url.js +40 -0
- package/dist/auth/utils/is-login-redirect-allowed.d.ts +7 -0
- package/dist/{utils → auth/utils}/is-login-redirect-allowed.js +12 -9
- package/dist/cache.js +2 -2
- package/dist/cli/commands/bootstrap/index.js +2 -2
- package/dist/cli/commands/database/install.js +1 -1
- package/dist/cli/commands/database/migrate.js +1 -1
- package/dist/cli/commands/init/index.js +2 -2
- package/dist/cli/commands/roles/create.js +4 -4
- package/dist/cli/commands/schema/apply.js +3 -3
- package/dist/cli/commands/schema/snapshot.js +1 -1
- package/dist/cli/utils/create-db-connection.d.ts +1 -1
- package/dist/cli/utils/create-db-connection.js +1 -1
- package/dist/cli/utils/create-env/index.js +1 -1
- package/dist/constants.d.ts +7 -3
- package/dist/constants.js +7 -3
- package/dist/controllers/access.js +1 -1
- package/dist/controllers/assets.js +40 -3
- package/dist/controllers/extensions.js +1 -1
- package/dist/controllers/fields.js +2 -2
- package/dist/controllers/files.js +1 -1
- package/dist/controllers/items.js +1 -1
- package/dist/controllers/mcp.js +1 -1
- package/dist/controllers/not-found.js +1 -1
- package/dist/controllers/relations.js +1 -1
- package/dist/database/errors/dialects/mysql.d.ts +1 -1
- package/dist/database/errors/dialects/postgres.d.ts +1 -1
- package/dist/database/errors/dialects/sqlite.d.ts +1 -1
- package/dist/database/errors/translate.d.ts +1 -1
- package/dist/database/errors/translate.js +1 -1
- package/dist/database/helpers/date/dialects/mssql.js +1 -1
- package/dist/database/helpers/date/dialects/mysql.js +1 -1
- package/dist/database/helpers/date/types.js +1 -1
- package/dist/database/helpers/schema/dialects/cockroachdb.d.ts +1 -0
- package/dist/database/helpers/schema/dialects/cockroachdb.js +24 -1
- package/dist/database/helpers/schema/dialects/mssql.d.ts +1 -1
- package/dist/database/helpers/schema/dialects/mysql.d.ts +2 -1
- package/dist/database/helpers/schema/dialects/mysql.js +16 -3
- package/dist/database/helpers/schema/dialects/postgres.d.ts +1 -1
- package/dist/database/helpers/schema/types.d.ts +13 -0
- package/dist/database/helpers/schema/types.js +24 -0
- package/dist/database/index.js +4 -4
- package/dist/database/migrations/20220429A-add-flows.js +1 -1
- package/dist/database/migrations/20230526A-migrate-translation-strings.js +1 -1
- package/dist/database/migrations/20231009A-update-csv-fields-to-text.js +1 -1
- package/dist/database/migrations/20240204A-marketplace.js +9 -7
- package/dist/database/migrations/20240311A-deprecate-webhooks.d.ts +15 -0
- package/dist/database/migrations/20240311A-deprecate-webhooks.js +1 -1
- package/dist/database/migrations/20240806A-permissions-policies.js +3 -3
- package/dist/database/migrations/20240924A-migrate-legacy-comments.js +1 -1
- package/dist/database/migrations/20251014A-add-project-owner.js +1 -1
- package/dist/database/migrations/20251103A-add-ai-settings.d.ts +3 -0
- package/dist/database/migrations/20251103A-add-ai-settings.js +14 -0
- package/dist/database/migrations/20251224A-remove-webhooks.d.ts +3 -0
- package/dist/database/migrations/20251224A-remove-webhooks.js +19 -0
- package/dist/database/migrations/20260113A-add-revisions-index.d.ts +3 -0
- package/dist/database/migrations/20260113A-add-revisions-index.js +41 -0
- package/dist/database/migrations/run.js +3 -3
- package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.d.ts +2 -2
- package/dist/database/run-ast/lib/apply-query/filter/get-filter-type.js +1 -1
- package/dist/database/run-ast/lib/apply-query/filter/operator.js +1 -1
- package/dist/database/run-ast/lib/apply-query/sort.js +1 -1
- package/dist/database/run-ast/run-ast.js +1 -1
- package/dist/database/run-ast/utils/get-column-pre-processor.js +2 -2
- package/dist/database/run-ast/utils/get-column.js +1 -1
- package/dist/database/seeds/run.js +3 -3
- package/dist/extensions/lib/get-extensions-path.js +1 -1
- package/dist/extensions/lib/get-extensions-settings.js +1 -1
- package/dist/extensions/lib/get-extensions.js +1 -1
- package/dist/extensions/lib/get-shared-deps-mapping.js +3 -3
- package/dist/extensions/lib/installation/manager.js +8 -12
- package/dist/extensions/lib/sandbox/register/route.d.ts +1 -1
- package/dist/extensions/lib/sync/status.d.ts +11 -0
- package/dist/extensions/lib/sync/status.js +34 -0
- package/dist/extensions/lib/sync/sync.d.ts +6 -0
- package/dist/extensions/lib/sync/sync.js +90 -0
- package/dist/extensions/lib/sync/tracker.d.ts +18 -0
- package/dist/extensions/lib/sync/tracker.js +71 -0
- package/dist/extensions/lib/sync/utils.d.ts +24 -0
- package/dist/extensions/lib/sync/utils.js +62 -0
- package/dist/extensions/manager.d.ts +9 -5
- package/dist/extensions/manager.js +36 -19
- package/dist/flows.d.ts +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/logger/logs-stream.d.ts +1 -1
- package/dist/logger/logs-stream.js +1 -1
- package/dist/mailer.js +1 -1
- package/dist/metrics/lib/create-metrics.js +2 -2
- package/dist/middleware/authenticate.js +3 -3
- package/dist/middleware/collection-exists.js +1 -1
- package/dist/middleware/extract-token.js +1 -1
- package/dist/middleware/graphql.js +2 -2
- package/dist/middleware/respond.js +2 -2
- package/dist/middleware/validate-batch.js +1 -1
- package/dist/operations/exec/index.js +2 -1
- package/dist/operations/mail/index.js +1 -1
- package/dist/operations/mail/rate-limiter.js +2 -2
- package/dist/permissions/cache.js +5 -0
- package/dist/permissions/lib/fetch-policies.d.ts +1 -1
- package/dist/permissions/lib/fetch-roles-tree.d.ts +6 -3
- package/dist/permissions/lib/fetch-roles-tree.js +5 -27
- package/dist/permissions/modules/fetch-allowed-collections/fetch-allowed-collections.js +1 -1
- package/dist/permissions/modules/fetch-allowed-field-map/fetch-allowed-field-map.js +1 -1
- package/dist/permissions/modules/fetch-global-access/fetch-global-access.d.ts +9 -7
- package/dist/permissions/modules/fetch-global-access/fetch-global-access.js +17 -9
- package/dist/permissions/modules/fetch-inconsistent-field-map/fetch-inconsistent-field-map.js +2 -2
- package/dist/permissions/modules/fetch-policies-ip-access/fetch-policies-ip-access.d.ts +1 -1
- package/dist/permissions/modules/process-ast/lib/inject-cases.js +1 -1
- package/dist/permissions/modules/process-ast/process-ast.js +1 -1
- package/dist/permissions/modules/process-payload/process-payload.js +1 -1
- package/dist/permissions/modules/validate-access/lib/validate-item-access.d.ts +13 -1
- package/dist/permissions/modules/validate-access/lib/validate-item-access.js +54 -6
- package/dist/permissions/modules/validate-access/validate-access.js +3 -2
- package/dist/permissions/utils/fetch-raw-permissions.d.ts +1 -1
- package/dist/permissions/utils/fetch-share-info.d.ts +1 -1
- package/dist/permissions/utils/fetch-share-info.js +1 -1
- package/dist/permissions/utils/filter-policies-by-ip.js +1 -1
- package/dist/permissions/utils/get-permissions-for-share.js +8 -8
- package/dist/permissions/utils/with-cache.d.ts +8 -6
- package/dist/permissions/utils/with-cache.js +12 -10
- package/dist/rate-limiter.js +1 -1
- package/dist/request/is-denied-ip.js +2 -2
- package/dist/schedules/project.js +1 -1
- package/dist/schedules/telemetry.js +1 -1
- package/dist/schedules/tus.js +1 -1
- package/dist/server.js +4 -4
- package/dist/services/assets/name-deduper.d.ts +7 -0
- package/dist/services/assets/name-deduper.js +23 -0
- package/dist/services/assets.d.ts +17 -3
- package/dist/services/assets.js +133 -13
- package/dist/services/authentication.js +6 -6
- package/dist/services/collections.js +1 -1
- package/dist/services/comments.js +2 -2
- package/dist/services/extensions.d.ts +1 -1
- package/dist/services/extensions.js +4 -0
- package/dist/services/files/utils/get-metadata.d.ts +1 -1
- package/dist/services/files/utils/get-metadata.js +1 -1
- package/dist/services/files.d.ts +1 -1
- package/dist/services/files.js +4 -4
- package/dist/services/folders.d.ts +27 -2
- package/dist/services/folders.js +75 -0
- package/dist/services/graphql/index.d.ts +1 -1
- package/dist/services/graphql/index.js +1 -1
- package/dist/services/graphql/resolvers/mutation.js +1 -1
- package/dist/services/graphql/schema/get-types.d.ts +1 -1
- package/dist/services/graphql/schema/read.js +1 -1
- package/dist/services/graphql/subscription.d.ts +1 -1
- package/dist/services/graphql/types/date.js +1 -1
- package/dist/services/graphql/types/hash.js +1 -1
- package/dist/services/graphql/utils/add-path-to-validation-error.js +1 -1
- package/dist/services/import-export.d.ts +2 -2
- package/dist/services/import-export.js +6 -7
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.js +0 -1
- package/dist/services/mail/index.js +2 -2
- package/dist/services/mail/rate-limiter.js +2 -2
- package/dist/services/notifications.js +2 -2
- package/dist/services/payload.js +21 -1
- package/dist/services/roles.js +2 -2
- package/dist/services/schema.js +1 -1
- package/dist/services/server.js +12 -4
- package/dist/services/settings.js +2 -2
- package/dist/services/tfa.js +1 -1
- package/dist/services/translations.js +1 -1
- package/dist/services/tus/data-store.d.ts +1 -3
- package/dist/services/tus/data-store.js +2 -5
- package/dist/services/tus/server.js +9 -9
- package/dist/services/users.js +4 -4
- package/dist/services/versions.js +1 -1
- package/dist/telemetry/lib/send-report.d.ts +1 -1
- package/dist/telemetry/lib/send-report.js +1 -1
- package/dist/telemetry/lib/track.js +1 -1
- package/dist/telemetry/utils/get-settings.d.ts +15 -0
- package/dist/telemetry/utils/get-settings.js +13 -1
- package/dist/test-utils/README.md +95 -24
- package/dist/test-utils/cache.d.ts +2 -2
- package/dist/test-utils/cache.js +2 -2
- package/dist/test-utils/knex.js +1 -1
- package/dist/test-utils/{fields-service.d.ts → services/fields-service.d.ts} +1 -1
- package/dist/test-utils/{fields-service.js → services/fields-service.js} +3 -2
- package/dist/test-utils/services/files-service.d.ts +28 -0
- package/dist/test-utils/services/files-service.js +34 -0
- package/dist/test-utils/services/folders-service.d.ts +28 -0
- package/dist/test-utils/services/folders-service.js +33 -0
- package/dist/types/collection.d.ts +1 -1
- package/dist/utils/async-handler.d.ts +1 -1
- package/dist/utils/calculate-field-depth.js +1 -1
- package/dist/utils/compress.js +1 -1
- package/dist/utils/deep-map-response.js +2 -2
- package/dist/utils/encrypt.d.ts +2 -0
- package/dist/utils/encrypt.js +64 -0
- package/dist/utils/get-accountability-for-role.js +2 -2
- package/dist/utils/get-accountability-for-token.js +4 -4
- package/dist/utils/get-cache-key.js +3 -3
- package/dist/utils/get-field-system-rows.js +1 -1
- package/dist/utils/get-ip-from-req.d.ts +1 -1
- package/dist/utils/get-ip-from-req.js +1 -1
- package/dist/utils/get-local-type.js +7 -3
- package/dist/utils/get-service.js +1 -3
- package/dist/utils/get-snapshot-diff.js +1 -1
- package/dist/utils/is-url-allowed.js +1 -1
- package/dist/utils/jwt.js +1 -1
- package/dist/utils/require-text.d.ts +1 -0
- package/dist/utils/require-text.js +4 -0
- package/dist/utils/require-yaml.js +2 -2
- package/dist/utils/sanitize-schema.d.ts +1 -1
- package/dist/utils/should-clear-cache.d.ts +1 -1
- package/dist/utils/should-skip-cache.js +2 -2
- package/dist/utils/validate-diff.js +1 -1
- package/dist/utils/validate-snapshot.js +3 -3
- package/dist/utils/validate-storage.js +2 -2
- package/dist/utils/verify-session-jwt.js +1 -1
- package/dist/utils/versioning/deep-map-with-schema.js +2 -2
- package/dist/websocket/controllers/base.d.ts +2 -2
- package/dist/websocket/controllers/base.js +3 -3
- package/dist/websocket/controllers/graphql.d.ts +1 -1
- package/dist/websocket/controllers/graphql.js +1 -1
- package/dist/websocket/controllers/logs.d.ts +1 -1
- package/dist/websocket/controllers/rest.d.ts +1 -1
- package/dist/websocket/controllers/rest.js +2 -2
- package/dist/websocket/handlers/heartbeat.js +1 -1
- package/dist/websocket/handlers/items.js +2 -2
- package/dist/websocket/handlers/subscribe.js +1 -1
- package/dist/websocket/types.d.ts +1 -1
- package/dist/websocket/utils/wait-for-message.js +1 -1
- package/package.json +34 -28
- package/dist/controllers/webhooks.d.ts +0 -2
- package/dist/controllers/webhooks.js +0 -74
- package/dist/extensions/lib/sync-extensions.d.ts +0 -3
- package/dist/extensions/lib/sync-extensions.js +0 -70
- package/dist/extensions/lib/sync-status.d.ts +0 -10
- package/dist/extensions/lib/sync-status.js +0 -27
- package/dist/mcp/tools/index.d.ts +0 -15
- package/dist/mcp/tools/index.js +0 -29
- package/dist/mcp/tools/prompts/index.d.ts +0 -16
- package/dist/mcp/tools/prompts/index.js +0 -19
- package/dist/permissions/modules/fetch-global-access/lib/fetch-global-access-for-roles.d.ts +0 -5
- package/dist/permissions/modules/fetch-global-access/lib/fetch-global-access-for-roles.js +0 -7
- package/dist/permissions/modules/fetch-global-access/lib/fetch-global-access-for-user.d.ts +0 -5
- package/dist/permissions/modules/fetch-global-access/lib/fetch-global-access-for-user.js +0 -10
- package/dist/permissions/modules/fetch-global-access/types.d.ts +0 -4
- package/dist/permissions/modules/fetch-global-access/utils/fetch-global-access-for-query.d.ts +0 -4
- package/dist/permissions/modules/fetch-global-access/utils/fetch-global-access-for-query.js +0 -27
- package/dist/services/webhooks.d.ts +0 -14
- package/dist/services/webhooks.js +0 -32
- package/dist/utils/get-date-formatted.d.ts +0 -1
- package/dist/utils/get-date-formatted.js +0 -10
- package/dist/utils/ip-in-networks.d.ts +0 -6
- package/dist/utils/ip-in-networks.js +0 -13
- package/dist/utils/is-login-redirect-allowed.d.ts +0 -4
- /package/dist/{mcp → ai/mcp}/index.d.ts +0 -0
- /package/dist/{mcp → ai/mcp}/index.js +0 -0
- /package/dist/{mcp → ai/mcp}/transport.d.ts +0 -0
- /package/dist/{mcp → ai/mcp}/transport.js +0 -0
- /package/dist/{mcp → ai/mcp}/types.js +0 -0
- /package/dist/{mcp/tools/assets.d.ts → ai/tools/assets/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/assets.md → ai/tools/assets/prompt.md} +0 -0
- /package/dist/{mcp/tools/collections.d.ts → ai/tools/collections/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/collections.md → ai/tools/collections/prompt.md} +0 -0
- /package/dist/{mcp/define.d.ts → ai/tools/define-tool.d.ts} +0 -0
- /package/dist/{mcp/define.js → ai/tools/define-tool.js} +0 -0
- /package/dist/{mcp/tools/fields.d.ts → ai/tools/fields/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/fields.md → ai/tools/fields/prompt.md} +0 -0
- /package/dist/{mcp/tools/files.d.ts → ai/tools/files/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/files.md → ai/tools/files/prompt.md} +0 -0
- /package/dist/{mcp/tools/flows.d.ts → ai/tools/flows/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/flows.md → ai/tools/flows/prompt.md} +0 -0
- /package/dist/{mcp/tools/folders.d.ts → ai/tools/folders/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/folders.md → ai/tools/folders/prompt.md} +0 -0
- /package/dist/{mcp/tools/items.d.ts → ai/tools/items/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/operations.md → ai/tools/operations/prompt.md} +0 -0
- /package/dist/{mcp/tools/relations.d.ts → ai/tools/relations/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/relations.md → ai/tools/relations/prompt.md} +0 -0
- /package/dist/{mcp/tools/prompts/schema.md → ai/tools/schema/prompt.md} +0 -0
- /package/dist/{mcp → ai/tools}/schema.d.ts +0 -0
- /package/dist/{mcp → ai/tools}/schema.js +0 -0
- /package/dist/{mcp/tools/system.d.ts → ai/tools/system/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/system-prompt-description.md → ai/tools/system/prompt-description.md} +0 -0
- /package/dist/{mcp/tools/prompts/system-prompt.md → ai/tools/system/prompt.md} +0 -0
- /package/dist/{mcp/tools/trigger-flow.d.ts → ai/tools/trigger-flow/index.d.ts} +0 -0
- /package/dist/{mcp/tools/prompts/trigger-flow.md → ai/tools/trigger-flow/prompt.md} +0 -0
- /package/dist/{permissions/modules/fetch-global-access → ai/tools}/types.js +0 -0
- /package/dist/test-utils/{items-service.d.ts → services/items-service.d.ts} +0 -0
- /package/dist/test-utils/{items-service.js → services/items-service.js} +0 -0
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ErrorCode, createError } from '@directus/errors';
|
|
2
|
-
import express from 'express';
|
|
3
|
-
import { respond } from '../middleware/respond.js';
|
|
4
|
-
import useCollection from '../middleware/use-collection.js';
|
|
5
|
-
import { validateBatch } from '../middleware/validate-batch.js';
|
|
6
|
-
import { MetaService } from '../services/meta.js';
|
|
7
|
-
import { WebhooksService } from '../services/webhooks.js';
|
|
8
|
-
import asyncHandler from '../utils/async-handler.js';
|
|
9
|
-
import { sanitizeQuery } from '../utils/sanitize-query.js';
|
|
10
|
-
const router = express.Router();
|
|
11
|
-
router.use(useCollection('directus_webhooks'));
|
|
12
|
-
router.post('/', asyncHandler(async (_req, _res, _next) => {
|
|
13
|
-
// Disallow creation of new Webhooks as part of the deprecation, see https://github.com/directus/directus/issues/15553
|
|
14
|
-
throw new (createError(ErrorCode.MethodNotAllowed, 'Webhooks are deprecated, use Flows instead', 405))();
|
|
15
|
-
}), respond);
|
|
16
|
-
const readHandler = asyncHandler(async (req, res, next) => {
|
|
17
|
-
const service = new WebhooksService({
|
|
18
|
-
accountability: req.accountability,
|
|
19
|
-
schema: req.schema,
|
|
20
|
-
});
|
|
21
|
-
const metaService = new MetaService({
|
|
22
|
-
accountability: req.accountability,
|
|
23
|
-
schema: req.schema,
|
|
24
|
-
});
|
|
25
|
-
const records = await service.readByQuery(req.sanitizedQuery);
|
|
26
|
-
const meta = await metaService.getMetaForQuery(req.collection, req.sanitizedQuery);
|
|
27
|
-
res.locals['payload'] = { data: records || null, meta };
|
|
28
|
-
return next();
|
|
29
|
-
});
|
|
30
|
-
router.get('/', validateBatch('read'), readHandler, respond);
|
|
31
|
-
router.search('/', validateBatch('read'), readHandler, respond);
|
|
32
|
-
router.get('/:pk', asyncHandler(async (req, res, next) => {
|
|
33
|
-
const service = new WebhooksService({
|
|
34
|
-
accountability: req.accountability,
|
|
35
|
-
schema: req.schema,
|
|
36
|
-
});
|
|
37
|
-
const record = await service.readOne(req.params['pk'], req.sanitizedQuery);
|
|
38
|
-
res.locals['payload'] = { data: record || null };
|
|
39
|
-
return next();
|
|
40
|
-
}), respond);
|
|
41
|
-
router.patch('/', validateBatch('update'), asyncHandler(async (_req, _res, _next) => {
|
|
42
|
-
// Disallow patching of Webhooks as part of the deprecation, see https://github.com/directus/directus/issues/15553
|
|
43
|
-
throw new (createError(ErrorCode.MethodNotAllowed, 'Webhooks are deprecated, use Flows instead', 405))();
|
|
44
|
-
}), respond);
|
|
45
|
-
router.patch('/:pk', asyncHandler(async (_req, _res, _next) => {
|
|
46
|
-
// Disallow patching of Webhooks as part of the deprecation, see https://github.com/directus/directus/issues/15553
|
|
47
|
-
throw new (createError(ErrorCode.MethodNotAllowed, 'Webhooks are deprecated, use Flows instead', 405))();
|
|
48
|
-
}), respond);
|
|
49
|
-
router.delete('/', asyncHandler(async (req, _res, next) => {
|
|
50
|
-
const service = new WebhooksService({
|
|
51
|
-
accountability: req.accountability,
|
|
52
|
-
schema: req.schema,
|
|
53
|
-
});
|
|
54
|
-
if (Array.isArray(req.body)) {
|
|
55
|
-
await service.deleteMany(req.body);
|
|
56
|
-
}
|
|
57
|
-
else if (req.body.keys) {
|
|
58
|
-
await service.deleteMany(req.body.keys);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
const sanitizedQuery = await sanitizeQuery(req.body.query, req.schema, req.accountability);
|
|
62
|
-
await service.deleteByQuery(sanitizedQuery);
|
|
63
|
-
}
|
|
64
|
-
return next();
|
|
65
|
-
}), respond);
|
|
66
|
-
router.delete('/:pk', asyncHandler(async (req, _res, next) => {
|
|
67
|
-
const service = new WebhooksService({
|
|
68
|
-
accountability: req.accountability,
|
|
69
|
-
schema: req.schema,
|
|
70
|
-
});
|
|
71
|
-
await service.deleteOne(req.params['pk']);
|
|
72
|
-
return next();
|
|
73
|
-
}), respond);
|
|
74
|
-
export default router;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useEnv } from '@directus/env';
|
|
2
|
-
import { exists } from 'fs-extra';
|
|
3
|
-
import mid from 'node-machine-id';
|
|
4
|
-
import { createWriteStream } from 'node:fs';
|
|
5
|
-
import { mkdir, rm } from 'node:fs/promises';
|
|
6
|
-
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
7
|
-
import { pipeline } from 'node:stream/promises';
|
|
8
|
-
import Queue from 'p-queue';
|
|
9
|
-
import { useBus } from '../../bus/index.js';
|
|
10
|
-
import { useLock } from '../../lock/index.js';
|
|
11
|
-
import { useLogger } from '../../logger/index.js';
|
|
12
|
-
import { getStorage } from '../../storage/index.js';
|
|
13
|
-
import { getExtensionsPath } from './get-extensions-path.js';
|
|
14
|
-
import { SyncStatus, getSyncStatus, setSyncStatus } from './sync-status.js';
|
|
15
|
-
export const syncExtensions = async (options) => {
|
|
16
|
-
const lock = useLock();
|
|
17
|
-
const messenger = useBus();
|
|
18
|
-
const env = useEnv();
|
|
19
|
-
const logger = useLogger();
|
|
20
|
-
if (!options?.force) {
|
|
21
|
-
const isDone = (await getSyncStatus()) === SyncStatus.DONE;
|
|
22
|
-
if (isDone)
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const machineId = await mid.machineId();
|
|
26
|
-
const machineKey = `extensions-sync/${machineId}`;
|
|
27
|
-
const processId = await lock.increment(machineKey);
|
|
28
|
-
const currentProcessShouldHandleSync = processId === 1;
|
|
29
|
-
if (currentProcessShouldHandleSync === false) {
|
|
30
|
-
logger.trace('Extensions already being synced to this machine from another process.');
|
|
31
|
-
// Wait until the process that called the lock publishes a message that the syncing is complete
|
|
32
|
-
return new Promise((resolve) => {
|
|
33
|
-
messenger.subscribe(machineKey, () => resolve());
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
const extensionsPath = getExtensionsPath();
|
|
38
|
-
const storageExtensionsPath = env['EXTENSIONS_PATH'];
|
|
39
|
-
if (await exists(extensionsPath)) {
|
|
40
|
-
// In case the FS still contains the cached extensions from a previous invocation. We have to
|
|
41
|
-
// clear them out to ensure the remote extensions folder remains the source of truth for all
|
|
42
|
-
// extensions that are loaded.
|
|
43
|
-
await rm(extensionsPath, { recursive: true, force: true });
|
|
44
|
-
}
|
|
45
|
-
// Ensure that the local extensions cache path exists
|
|
46
|
-
await mkdir(extensionsPath, { recursive: true });
|
|
47
|
-
await setSyncStatus(SyncStatus.SYNCING);
|
|
48
|
-
logger.trace('Syncing extensions from configured storage location...');
|
|
49
|
-
const storage = await getStorage();
|
|
50
|
-
const disk = storage.location(env['EXTENSIONS_LOCATION']);
|
|
51
|
-
// Make sure we don't overload the file handles
|
|
52
|
-
const queue = new Queue({ concurrency: 1000 });
|
|
53
|
-
for await (const filepath of disk.list(storageExtensionsPath)) {
|
|
54
|
-
const readStream = await disk.read(filepath);
|
|
55
|
-
// We want files to be stored in the root of `$TEMP_PATH/extensions`, so gotta remove the
|
|
56
|
-
// extensions path on disk from the start of the file path
|
|
57
|
-
const destPath = join(extensionsPath, relative(resolve(sep, storageExtensionsPath), resolve(sep, filepath)));
|
|
58
|
-
// Ensure that the directory path exists
|
|
59
|
-
await mkdir(dirname(destPath), { recursive: true });
|
|
60
|
-
const writeStream = createWriteStream(destPath);
|
|
61
|
-
queue.add(() => pipeline(readStream, writeStream));
|
|
62
|
-
}
|
|
63
|
-
await queue.onIdle();
|
|
64
|
-
await setSyncStatus(SyncStatus.DONE);
|
|
65
|
-
messenger.publish(machineKey, { ready: true });
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
await lock.delete(machineKey);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare enum SyncStatus {
|
|
2
|
-
UNKNOWN = "UNKNOWN",
|
|
3
|
-
SYNCING = "SYNCING",
|
|
4
|
-
DONE = "DONE"
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Retrieves the sync status from the `.status` file in the local extensions folder
|
|
8
|
-
*/
|
|
9
|
-
export declare const getSyncStatus: () => Promise<string>;
|
|
10
|
-
export declare const setSyncStatus: (status: SyncStatus) => Promise<void>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { exists } from 'fs-extra';
|
|
2
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { getExtensionsPath } from './get-extensions-path.js';
|
|
5
|
-
export var SyncStatus;
|
|
6
|
-
(function (SyncStatus) {
|
|
7
|
-
SyncStatus["UNKNOWN"] = "UNKNOWN";
|
|
8
|
-
SyncStatus["SYNCING"] = "SYNCING";
|
|
9
|
-
SyncStatus["DONE"] = "DONE";
|
|
10
|
-
})(SyncStatus || (SyncStatus = {}));
|
|
11
|
-
/**
|
|
12
|
-
* Retrieves the sync status from the `.status` file in the local extensions folder
|
|
13
|
-
*/
|
|
14
|
-
export const getSyncStatus = async () => {
|
|
15
|
-
const statusFilePath = join(getExtensionsPath(), '.status');
|
|
16
|
-
if (await exists(statusFilePath)) {
|
|
17
|
-
const status = await readFile(statusFilePath, 'utf8');
|
|
18
|
-
return status;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return SyncStatus.UNKNOWN;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
export const setSyncStatus = async (status) => {
|
|
25
|
-
const statusFilePath = join(getExtensionsPath(), '.status');
|
|
26
|
-
await writeFile(statusFilePath, status);
|
|
27
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ToolConfig } from '../types.js';
|
|
2
|
-
import { collections } from './collections.js';
|
|
3
|
-
import { fields } from './fields.js';
|
|
4
|
-
import { files } from './files.js';
|
|
5
|
-
import { flows } from './flows.js';
|
|
6
|
-
import { items } from './items.js';
|
|
7
|
-
import { operations } from './operations.js';
|
|
8
|
-
import { relations } from './relations.js';
|
|
9
|
-
import { schema } from './schema.js';
|
|
10
|
-
import { system } from './system.js';
|
|
11
|
-
import { triggerFlow } from './trigger-flow.js';
|
|
12
|
-
export declare const ALL_TOOLS: ToolConfig<any>[];
|
|
13
|
-
export declare const getAllMcpTools: () => ToolConfig<any>[];
|
|
14
|
-
export declare const findMcpTool: (name: string) => ToolConfig<any> | undefined;
|
|
15
|
-
export { collections, fields, files, flows, items, operations, relations, schema, system, triggerFlow };
|
package/dist/mcp/tools/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { assets } from './assets.js';
|
|
2
|
-
import { collections } from './collections.js';
|
|
3
|
-
import { fields } from './fields.js';
|
|
4
|
-
import { files } from './files.js';
|
|
5
|
-
import { flows } from './flows.js';
|
|
6
|
-
import { folders } from './folders.js';
|
|
7
|
-
import { items } from './items.js';
|
|
8
|
-
import { operations } from './operations.js';
|
|
9
|
-
import { relations } from './relations.js';
|
|
10
|
-
import { schema } from './schema.js';
|
|
11
|
-
import { system } from './system.js';
|
|
12
|
-
import { triggerFlow } from './trigger-flow.js';
|
|
13
|
-
export const ALL_TOOLS = [
|
|
14
|
-
system,
|
|
15
|
-
items,
|
|
16
|
-
files,
|
|
17
|
-
folders,
|
|
18
|
-
assets,
|
|
19
|
-
flows,
|
|
20
|
-
triggerFlow,
|
|
21
|
-
operations,
|
|
22
|
-
schema,
|
|
23
|
-
collections,
|
|
24
|
-
fields,
|
|
25
|
-
relations,
|
|
26
|
-
];
|
|
27
|
-
export const getAllMcpTools = () => ALL_TOOLS;
|
|
28
|
-
export const findMcpTool = (name) => ALL_TOOLS.find((tool) => tool.name === name);
|
|
29
|
-
export { collections, fields, files, flows, items, operations, relations, schema, system, triggerFlow };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
assets: string;
|
|
3
|
-
collections: string;
|
|
4
|
-
fields: string;
|
|
5
|
-
files: string;
|
|
6
|
-
folders: string;
|
|
7
|
-
flows: string;
|
|
8
|
-
items: string;
|
|
9
|
-
operations: string;
|
|
10
|
-
relations: string;
|
|
11
|
-
schema: string;
|
|
12
|
-
systemPrompt: string;
|
|
13
|
-
systemPromptDescription: string;
|
|
14
|
-
triggerFlow: string;
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import fse from 'fs-extra';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
-
export default {
|
|
6
|
-
assets: fse.readFileSync(join(__dirname, 'assets.md'), 'utf8'),
|
|
7
|
-
collections: fse.readFileSync(join(__dirname, 'collections.md'), 'utf8'),
|
|
8
|
-
fields: fse.readFileSync(join(__dirname, 'fields.md'), 'utf8'),
|
|
9
|
-
files: fse.readFileSync(join(__dirname, 'files.md'), 'utf8'),
|
|
10
|
-
folders: fse.readFileSync(join(__dirname, 'folders.md'), 'utf8'),
|
|
11
|
-
flows: fse.readFileSync(join(__dirname, 'flows.md'), 'utf8'),
|
|
12
|
-
items: fse.readFileSync(join(__dirname, 'items.md'), 'utf8'),
|
|
13
|
-
operations: fse.readFileSync(join(__dirname, 'operations.md'), 'utf8'),
|
|
14
|
-
relations: fse.readFileSync(join(__dirname, 'relations.md'), 'utf8'),
|
|
15
|
-
schema: fse.readFileSync(join(__dirname, 'schema.md'), 'utf8'),
|
|
16
|
-
systemPrompt: fse.readFileSync(join(__dirname, 'system-prompt.md'), 'utf8'),
|
|
17
|
-
systemPromptDescription: fse.readFileSync(join(__dirname, 'system-prompt-description.md'), 'utf8'),
|
|
18
|
-
triggerFlow: fse.readFileSync(join(__dirname, 'trigger-flow.md'), 'utf8'),
|
|
19
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Accountability } from '@directus/types';
|
|
2
|
-
import type { Knex } from 'knex';
|
|
3
|
-
import type { GlobalAccess } from '../types.js';
|
|
4
|
-
export declare const fetchGlobalAccessForRoles: typeof _fetchGlobalAccessForRoles;
|
|
5
|
-
export declare function _fetchGlobalAccessForRoles(accountability: Pick<Accountability, 'roles' | 'ip'>, knex: Knex): Promise<GlobalAccess>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { withCache } from '../../../utils/with-cache.js';
|
|
2
|
-
import { fetchGlobalAccessForQuery } from '../utils/fetch-global-access-for-query.js';
|
|
3
|
-
export const fetchGlobalAccessForRoles = withCache('global-access-role', _fetchGlobalAccessForRoles, ({ roles, ip }) => ({ roles, ip }));
|
|
4
|
-
export async function _fetchGlobalAccessForRoles(accountability, knex) {
|
|
5
|
-
const query = knex.where('role', 'in', accountability.roles);
|
|
6
|
-
return await fetchGlobalAccessForQuery(query, accountability);
|
|
7
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Accountability } from '@directus/types';
|
|
2
|
-
import type { Knex } from 'knex';
|
|
3
|
-
import type { GlobalAccess } from '../types.js';
|
|
4
|
-
export declare const fetchGlobalAccessForUser: typeof _fetchGlobalAccessForUser;
|
|
5
|
-
export declare function _fetchGlobalAccessForUser(accountability: Pick<Accountability, 'user' | 'ip'>, knex: Knex): Promise<GlobalAccess>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { withCache } from '../../../utils/with-cache.js';
|
|
2
|
-
import { fetchGlobalAccessForQuery } from '../utils/fetch-global-access-for-query.js';
|
|
3
|
-
export const fetchGlobalAccessForUser = withCache('global-access-user', _fetchGlobalAccessForUser, ({ user, ip }) => ({
|
|
4
|
-
user,
|
|
5
|
-
ip,
|
|
6
|
-
}));
|
|
7
|
-
export async function _fetchGlobalAccessForUser(accountability, knex) {
|
|
8
|
-
const query = knex.where('user', '=', accountability.user);
|
|
9
|
-
return await fetchGlobalAccessForQuery(query, accountability);
|
|
10
|
-
}
|
package/dist/permissions/modules/fetch-global-access/utils/fetch-global-access-for-query.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Accountability } from '@directus/types';
|
|
2
|
-
import type { Knex } from 'knex';
|
|
3
|
-
import type { GlobalAccess } from '../types.js';
|
|
4
|
-
export declare function fetchGlobalAccessForQuery(query: Knex.QueryBuilder<any, any[]>, accountability: Pick<Accountability, 'ip'>): Promise<GlobalAccess>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { toBoolean, toArray } from '@directus/utils';
|
|
2
|
-
import { ipInNetworks } from '../../../../utils/ip-in-networks.js';
|
|
3
|
-
export async function fetchGlobalAccessForQuery(query, accountability) {
|
|
4
|
-
const globalAccess = {
|
|
5
|
-
app: false,
|
|
6
|
-
admin: false,
|
|
7
|
-
};
|
|
8
|
-
const accessRows = await query
|
|
9
|
-
.select('directus_policies.admin_access', 'directus_policies.app_access', 'directus_policies.ip_access')
|
|
10
|
-
.from('directus_access')
|
|
11
|
-
// @NOTE: `where` clause comes from the caller
|
|
12
|
-
.leftJoin('directus_policies', 'directus_policies.id', 'directus_access.policy');
|
|
13
|
-
// Additively merge access permissions
|
|
14
|
-
for (const { admin_access, app_access, ip_access } of accessRows) {
|
|
15
|
-
if (accountability.ip && ip_access) {
|
|
16
|
-
// Skip row if IP is not in the allowed networks
|
|
17
|
-
const networks = toArray(ip_access);
|
|
18
|
-
if (!ipInNetworks(accountability.ip, networks))
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
globalAccess.admin ||= toBoolean(admin_access);
|
|
22
|
-
globalAccess.app ||= globalAccess.admin || toBoolean(app_access);
|
|
23
|
-
if (globalAccess.admin)
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
return globalAccess;
|
|
27
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type DirectusError } from '@directus/errors';
|
|
2
|
-
import type { Bus } from '@directus/memory';
|
|
3
|
-
import type { AbstractServiceOptions, MutationOptions, PrimaryKey, Webhook } from '@directus/types';
|
|
4
|
-
import { ItemsService } from './items.js';
|
|
5
|
-
export declare class WebhooksService extends ItemsService<Webhook> {
|
|
6
|
-
messenger: Bus;
|
|
7
|
-
errorDeprecation: DirectusError;
|
|
8
|
-
constructor(options: AbstractServiceOptions);
|
|
9
|
-
createOne(): Promise<PrimaryKey>;
|
|
10
|
-
createMany(): Promise<PrimaryKey[]>;
|
|
11
|
-
updateBatch(): Promise<PrimaryKey[]>;
|
|
12
|
-
updateMany(): Promise<PrimaryKey[]>;
|
|
13
|
-
deleteMany(keys: PrimaryKey[], opts?: MutationOptions): Promise<PrimaryKey[]>;
|
|
14
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ErrorCode, createError } from '@directus/errors';
|
|
2
|
-
import { useBus } from '../bus/index.js';
|
|
3
|
-
import { useLogger } from '../logger/index.js';
|
|
4
|
-
import { ItemsService } from './items.js';
|
|
5
|
-
const logger = useLogger();
|
|
6
|
-
export class WebhooksService extends ItemsService {
|
|
7
|
-
messenger;
|
|
8
|
-
errorDeprecation;
|
|
9
|
-
constructor(options) {
|
|
10
|
-
super('directus_webhooks', options);
|
|
11
|
-
this.messenger = useBus();
|
|
12
|
-
this.errorDeprecation = new (createError(ErrorCode.MethodNotAllowed, 'Webhooks are deprecated, use Flows instead', 405))();
|
|
13
|
-
logger.warn('Webhooks are deprecated and the WebhooksService will be removed in an upcoming release. Creating/Updating Webhooks is disabled, use Flows instead');
|
|
14
|
-
}
|
|
15
|
-
async createOne() {
|
|
16
|
-
throw this.errorDeprecation;
|
|
17
|
-
}
|
|
18
|
-
async createMany() {
|
|
19
|
-
throw this.errorDeprecation;
|
|
20
|
-
}
|
|
21
|
-
async updateBatch() {
|
|
22
|
-
throw this.errorDeprecation;
|
|
23
|
-
}
|
|
24
|
-
async updateMany() {
|
|
25
|
-
throw this.errorDeprecation;
|
|
26
|
-
}
|
|
27
|
-
async deleteMany(keys, opts) {
|
|
28
|
-
const result = await super.deleteMany(keys, opts);
|
|
29
|
-
this.messenger.publish('webhooks', { type: 'reload' });
|
|
30
|
-
return result;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getDateFormatted(): string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export function getDateFormatted() {
|
|
2
|
-
const date = new Date();
|
|
3
|
-
let month = String(date.getMonth() + 1);
|
|
4
|
-
if (month.length === 1)
|
|
5
|
-
month = '0' + month;
|
|
6
|
-
let day = String(date.getDate());
|
|
7
|
-
if (day.length === 1)
|
|
8
|
-
day = '0' + day;
|
|
9
|
-
return `${date.getFullYear()}${month}${day}-${date.getHours()}${date.getMinutes()}${date.getSeconds()}`;
|
|
10
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if an IP address is contained in a list of networks
|
|
3
|
-
* @param networks List of IP addresses (192.168.0.1), CIDR notations (192.168.0.0/24) or IP ranges (192-168.0.0-192.168.2.0)
|
|
4
|
-
* @throws Will throw if list contains invalid network definitions
|
|
5
|
-
*/
|
|
6
|
-
export declare function ipInNetworks(ip: string, networks: string[]): boolean;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { matches } from 'ip-matching';
|
|
2
|
-
/**
|
|
3
|
-
* Checks if an IP address is contained in a list of networks
|
|
4
|
-
* @param networks List of IP addresses (192.168.0.1), CIDR notations (192.168.0.0/24) or IP ranges (192-168.0.0-192.168.2.0)
|
|
5
|
-
* @throws Will throw if list contains invalid network definitions
|
|
6
|
-
*/
|
|
7
|
-
export function ipInNetworks(ip, networks) {
|
|
8
|
-
for (const allowedIp of networks) {
|
|
9
|
-
if (matches(ip, allowedIp))
|
|
10
|
-
return true;
|
|
11
|
-
}
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|