@directus/api 16.0.0 → 17.0.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/controllers/items.js +8 -7
- package/dist/controllers/permissions.js +11 -2
- package/dist/controllers/utils.js +13 -32
- package/dist/extensions/lib/sandbox/generate-api-extensions-sandbox-entrypoint.d.ts +1 -1
- package/dist/flows.js +2 -1
- package/dist/middleware/collection-exists.js +6 -6
- package/dist/middleware/respond.js +1 -1
- package/dist/operations/request/index.js +5 -5
- package/dist/request/agent-with-ip-validation.d.ts +11 -0
- package/dist/request/agent-with-ip-validation.js +34 -0
- package/dist/request/index.js +6 -5
- package/dist/request/is-denied-ip.d.ts +1 -0
- package/dist/request/{validate-ip.js → is-denied-ip.js} +10 -12
- package/dist/services/assets.js +1 -3
- package/dist/services/authorization.d.ts +1 -1
- package/dist/services/authorization.js +15 -3
- package/dist/services/collections.d.ts +3 -2
- package/dist/services/collections.js +1 -1
- package/dist/services/fields.js +2 -1
- package/dist/services/files.js +4 -3
- package/dist/services/graphql/index.js +3 -2
- package/dist/services/{import-export/index.d.ts → import-export.d.ts} +1 -1
- package/dist/services/{import-export/index.js → import-export.js} +12 -11
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/items.js +2 -1
- package/dist/services/permissions.d.ts +3 -2
- package/dist/services/permissions.js +77 -2
- package/dist/services/relations.js +1 -1
- package/dist/services/roles.js +83 -15
- package/dist/services/server.js +2 -1
- package/dist/services/specifications.js +4 -3
- package/dist/services/utils.js +1 -1
- package/dist/telemetry/utils/get-user-item-count.js +2 -1
- package/dist/types/collection.d.ts +2 -13
- package/dist/types/items.d.ts +4 -12
- package/dist/types/items.js +0 -4
- package/dist/utils/get-field-system-rows.d.ts +2 -0
- package/dist/utils/get-field-system-rows.js +17 -0
- package/dist/utils/get-permissions.js +1 -1
- package/dist/utils/get-schema.js +3 -2
- package/dist/utils/merge-permissions-for-share.js +1 -1
- package/dist/utils/should-skip-cache.js +1 -1
- package/dist/websocket/handlers/items.js +2 -1
- package/dist/websocket/messages.d.ts +18 -18
- package/package.json +36 -35
- package/dist/database/system-data/app-access-permissions/app-access-permissions.yaml +0 -107
- package/dist/database/system-data/app-access-permissions/index.d.ts +0 -3
- package/dist/database/system-data/app-access-permissions/index.js +0 -17
- package/dist/database/system-data/app-access-permissions/schema-access-permissions.yaml +0 -17
- package/dist/database/system-data/collections/collections.yaml +0 -103
- package/dist/database/system-data/collections/index.d.ts +0 -2
- package/dist/database/system-data/collections/index.js +0 -9
- package/dist/database/system-data/fields/_defaults.yaml +0 -16
- package/dist/database/system-data/fields/activity.yaml +0 -83
- package/dist/database/system-data/fields/collections.yaml +0 -249
- package/dist/database/system-data/fields/dashboards.yaml +0 -20
- package/dist/database/system-data/fields/extensions.yaml +0 -10
- package/dist/database/system-data/fields/fields.yaml +0 -104
- package/dist/database/system-data/fields/files.yaml +0 -160
- package/dist/database/system-data/fields/flows.yaml +0 -26
- package/dist/database/system-data/fields/folders.yaml +0 -14
- package/dist/database/system-data/fields/index.d.ts +0 -2
- package/dist/database/system-data/fields/index.js +0 -33
- package/dist/database/system-data/fields/migrations.yaml +0 -10
- package/dist/database/system-data/fields/notifications.yaml +0 -15
- package/dist/database/system-data/fields/operations.yaml +0 -23
- package/dist/database/system-data/fields/panels.yaml +0 -29
- package/dist/database/system-data/fields/permissions.yaml +0 -37
- package/dist/database/system-data/fields/presets.yaml +0 -56
- package/dist/database/system-data/fields/relations.yaml +0 -34
- package/dist/database/system-data/fields/revisions.yaml +0 -30
- package/dist/database/system-data/fields/roles.yaml +0 -61
- package/dist/database/system-data/fields/sessions.yaml +0 -16
- package/dist/database/system-data/fields/settings.yaml +0 -471
- package/dist/database/system-data/fields/shares.yaml +0 -83
- package/dist/database/system-data/fields/translations.yaml +0 -27
- package/dist/database/system-data/fields/users.yaml +0 -224
- package/dist/database/system-data/fields/versions.yaml +0 -38
- package/dist/database/system-data/fields/webhooks.yaml +0 -141
- package/dist/database/system-data/relations/index.d.ts +0 -2
- package/dist/database/system-data/relations/index.js +0 -9
- package/dist/database/system-data/relations/relations.yaml +0 -197
- package/dist/request/request-interceptor.d.ts +0 -2
- package/dist/request/request-interceptor.js +0 -28
- package/dist/request/response-interceptor.d.ts +0 -2
- package/dist/request/response-interceptor.js +0 -5
- package/dist/request/validate-ip.d.ts +0 -1
- package/dist/services/import-export/import-worker.d.ts +0 -9
- package/dist/services/import-export/import-worker.js +0 -9
- package/dist/worker-pool.d.ts +0 -2
- package/dist/worker-pool.js +0 -19
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { lookup } from 'node:dns/promises';
|
|
3
|
-
import { isIP } from 'node:net';
|
|
4
|
-
import { URL } from 'node:url';
|
|
5
|
-
import { useLogger } from '../logger.js';
|
|
6
|
-
import { validateIp } from './validate-ip.js';
|
|
7
|
-
export const requestInterceptor = async (config) => {
|
|
8
|
-
const logger = useLogger();
|
|
9
|
-
const uri = axios.getUri(config);
|
|
10
|
-
const { hostname } = new URL(uri);
|
|
11
|
-
let ip;
|
|
12
|
-
if (isIP(hostname) === 0) {
|
|
13
|
-
try {
|
|
14
|
-
const dns = await lookup(hostname);
|
|
15
|
-
ip = dns.address;
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
logger.warn(`Couldn't lookup the DNS for URL "${uri}"`);
|
|
19
|
-
logger.warn(error);
|
|
20
|
-
throw new Error(`Requested URL "${uri}" resolves to a denied IP address`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
ip = hostname;
|
|
25
|
-
}
|
|
26
|
-
validateIp(ip, uri);
|
|
27
|
-
return config;
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function validateIp(ip: string, url: string): void;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Accountability, SchemaOverview } from '@directus/types';
|
|
2
|
-
export type ImportWorkerData = {
|
|
3
|
-
collection: string;
|
|
4
|
-
mimeType: string;
|
|
5
|
-
filePath: string;
|
|
6
|
-
accountability: Accountability | undefined;
|
|
7
|
-
schema: SchemaOverview;
|
|
8
|
-
};
|
|
9
|
-
export default function ({ collection, mimeType, filePath, accountability, schema }: ImportWorkerData): Promise<void>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createReadStream } from 'node:fs';
|
|
2
|
-
import { ImportService } from './index.js';
|
|
3
|
-
export default async function ({ collection, mimeType, filePath, accountability, schema }) {
|
|
4
|
-
const service = new ImportService({
|
|
5
|
-
accountability: accountability,
|
|
6
|
-
schema: schema,
|
|
7
|
-
});
|
|
8
|
-
await service.import(collection, mimeType, createReadStream(filePath));
|
|
9
|
-
}
|
package/dist/worker-pool.d.ts
DELETED
package/dist/worker-pool.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import os from 'node:os';
|
|
2
|
-
import Tinypool from 'tinypool';
|
|
3
|
-
let workerPool;
|
|
4
|
-
export function getWorkerPool() {
|
|
5
|
-
if (!workerPool) {
|
|
6
|
-
workerPool = new Tinypool({
|
|
7
|
-
minThreads: 0,
|
|
8
|
-
maxQueue: 'auto',
|
|
9
|
-
});
|
|
10
|
-
// TODO Workaround currently required for failing CPU count on ARM in Tinypool,
|
|
11
|
-
// remove again once fixed upstream
|
|
12
|
-
if (workerPool.options.maxThreads === 0) {
|
|
13
|
-
const availableParallelism = os.availableParallelism();
|
|
14
|
-
workerPool.options.maxThreads = availableParallelism;
|
|
15
|
-
workerPool.options.maxQueue = availableParallelism ** 2;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return workerPool;
|
|
19
|
-
}
|