Use Item/PrimaryKey from and move Alterations to @directus/types (#22027)

Co-authored-by: ian <licitdev@gmail.com>
This commit is contained in:
Pascal Jufer
2024-04-08 10:12:26 +02:00
committed by GitHub
parent cea3ea9bc6
commit c9105eaead
43 changed files with 106 additions and 123 deletions

View File

@@ -1,11 +1,10 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { Item } from '@directus/types';
import { Router } from 'express';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { CollectionsService } from '../services/collections.js';
import { MetaService } from '../services/meta.js';
import type { Item } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
const router = Router();

View File

@@ -1,12 +1,11 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { DashboardsService } from '../services/dashboards.js';
import { MetaService } from '../services/meta.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,7 +1,7 @@
import { useEnv } from '@directus/env';
import { ErrorCode, InvalidPayloadError, isDirectusError } from '@directus/errors';
import formatTitle from '@directus/format-title';
import type { BusboyFileStream } from '@directus/types';
import type { BusboyFileStream, PrimaryKey } from '@directus/types';
import { toArray } from '@directus/utils';
import Busboy from 'busboy';
import bytes from 'bytes';
@@ -15,7 +15,6 @@ import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { FilesService } from '../services/files.js';
import { MetaService } from '../services/meta.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,14 +1,13 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { UUID_REGEX } from '../constants.js';
import { ErrorCode } from '@directus/errors';
import { getFlowManager } from '../flows.js';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { FlowsService } from '../services/flows.js';
import { MetaService } from '../services/meta.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,12 +1,11 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { FoldersService } from '../services/folders.js';
import { MetaService } from '../services/meta.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,16 +1,15 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, ForbiddenError, RouteNotFoundError, isDirectusError } from '@directus/errors';
import { isSystemCollection } from '@directus/system-data';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { ErrorCode, ForbiddenError, RouteNotFoundError } from '@directus/errors';
import collectionExists from '../middleware/collection-exists.js';
import { mergeContentVersions } from '../middleware/merge-content-versions.js';
import { respond } from '../middleware/respond.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { mergeContentVersions } from '../middleware/merge-content-versions.js';
import { ItemsService } from '../services/items.js';
import { MetaService } from '../services/meta.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';
import { isSystemCollection } from '@directus/system-data';
const router = express.Router();

View File

@@ -1,12 +1,11 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { MetaService } from '../services/meta.js';
import { NotificationsService } from '../services/notifications.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,12 +1,11 @@
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { isDirectusError } from '@directus/errors';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { MetaService } from '../services/meta.js';
import { OperationsService } from '../services/operations.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,12 +1,11 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { MetaService } from '../services/meta.js';
import { PanelsService } from '../services/panels.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,11 +1,11 @@
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { MetaService } from '../services/meta.js';
import { PermissionsService } from '../services/permissions/index.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,12 +1,11 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { MetaService } from '../services/meta.js';
import { PresetsService } from '../services/presets.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,12 +1,11 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { MetaService } from '../services/meta.js';
import { RolesService } from '../services/roles.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,5 +1,6 @@
import { useEnv } from '@directus/env';
import { ErrorCode, InvalidPayloadError, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import Joi from 'joi';
import { REFRESH_COOKIE_OPTIONS, SESSION_COOKIE_OPTIONS, UUID_REGEX } from '../constants.js';
@@ -7,7 +8,7 @@ import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { SharesService } from '../services/shares.js';
import type { AuthenticationMode, PrimaryKey } from '../types/index.js';
import type { AuthenticationMode } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,12 +1,11 @@
import { isDirectusError } from '@directus/errors';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { ErrorCode } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { MetaService } from '../services/meta.js';
import { TranslationsService } from '../services/translations.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,8 +1,13 @@
import { isDirectusError } from '@directus/errors';
import type { Role } from '@directus/types';
import {
ErrorCode,
ForbiddenError,
InvalidCredentialsError,
InvalidPayloadError,
isDirectusError,
} from '@directus/errors';
import type { PrimaryKey, Role } from '@directus/types';
import express from 'express';
import Joi from 'joi';
import { ErrorCode, ForbiddenError, InvalidCredentialsError, InvalidPayloadError } from '@directus/errors';
import { respond } from '../middleware/respond.js';
import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
@@ -11,7 +16,6 @@ import { MetaService } from '../services/meta.js';
import { RolesService } from '../services/roles.js';
import { TFAService } from '../services/tfa.js';
import { UsersService } from '../services/users.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,4 +1,5 @@
import { ErrorCode, InvalidPayloadError, isDirectusError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import express from 'express';
import { assign } from 'lodash-es';
import { respond } from '../middleware/respond.js';
@@ -6,7 +7,6 @@ import useCollection from '../middleware/use-collection.js';
import { validateBatch } from '../middleware/validate-batch.js';
import { MetaService } from '../services/meta.js';
import { VersionsService } from '../services/versions.js';
import type { PrimaryKey } from '../types/index.js';
import asyncHandler from '../utils/async-handler.js';
import { sanitizeQuery } from '../utils/sanitize-query.js';

View File

@@ -1,8 +1,7 @@
import { defineOperationApi } from '@directus/extensions';
import type { Accountability, PrimaryKey } from '@directus/types';
import type { Accountability, Item, PrimaryKey } from '@directus/types';
import { optionToObject, toArray } from '@directus/utils';
import { ItemsService } from '../../services/items.js';
import type { Item } from '../../types/index.js';
import { getAccountabilityForRole } from '../../utils/get-accountability-for-role.js';
type Options = {

View File

@@ -1,8 +1,7 @@
import { defineOperationApi } from '@directus/extensions';
import type { Accountability, PrimaryKey } from '@directus/types';
import type { Accountability, Item, PrimaryKey } from '@directus/types';
import { optionToObject, toArray } from '@directus/utils';
import { ItemsService } from '../../services/items.js';
import type { Item } from '../../types/index.js';
import { getAccountabilityForRole } from '../../utils/get-accountability-for-role.js';
import { sanitizeQuery } from '../../utils/sanitize-query.js';

View File

@@ -1,8 +1,7 @@
import { defineOperationApi } from '@directus/extensions';
import type { Accountability, PrimaryKey } from '@directus/types';
import type { Accountability, Item, PrimaryKey } from '@directus/types';
import { optionToObject, toArray } from '@directus/utils';
import { ItemsService } from '../../services/items.js';
import type { Item } from '../../types/index.js';
import { getAccountabilityForRole } from '../../utils/get-accountability-for-role.js';
import { sanitizeQuery } from '../../utils/sanitize-query.js';

View File

@@ -1,10 +1,10 @@
import { Action } from '@directus/constants';
import { useEnv } from '@directus/env';
import { ErrorCode, isDirectusError } from '@directus/errors';
import type { Accountability } from '@directus/types';
import type { Accountability, Item, PrimaryKey } from '@directus/types';
import { uniq } from 'lodash-es';
import { useLogger } from '../logger.js';
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types/index.js';
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
import { getPermissions } from '../utils/get-permissions.js';
import { isValidUuid } from '../utils/is-valid-uuid.js';
import { Url } from '../utils/url.js';

View File

@@ -3,8 +3,10 @@ import type {
Accountability,
Aggregate,
Filter,
Item,
Permission,
PermissionsAction,
PrimaryKey,
Query,
SchemaOverview,
} from '@directus/types';
@@ -19,9 +21,7 @@ import type {
AbstractServiceOptions,
FieldNode,
FunctionFieldNode,
Item,
NestedCollectionNode,
PrimaryKey,
} from '../types/index.js';
import { getRelationInfo } from '../utils/get-relation-info.js';
import { stripFunction } from '../utils/strip-function.js';

View File

@@ -1,7 +1,7 @@
import { useEnv } from '@directus/env';
import { ContentTooLargeError, ForbiddenError, InvalidPayloadError, ServiceUnavailableError } from '@directus/errors';
import formatTitle from '@directus/format-title';
import type { BusboyFileStream, File } from '@directus/types';
import type { BusboyFileStream, File, PrimaryKey } from '@directus/types';
import { toArray } from '@directus/utils';
import type { AxiosResponse } from 'axios';
import encodeURL from 'encodeurl';
@@ -22,7 +22,7 @@ import emitter from '../emitter.js';
import { useLogger } from '../logger.js';
import { getAxios } from '../request/index.js';
import { getStorage } from '../storage/index.js';
import type { AbstractServiceOptions, MutationOptions, PrimaryKey } from '../types/index.js';
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
import { parseIptc, parseXmp } from '../utils/parse-image-metadata.js';
import { ItemsService } from './items.js';

View File

@@ -1,6 +1,6 @@
import type { FlowRaw } from '@directus/types';
import type { FlowRaw, Item, PrimaryKey } from '@directus/types';
import { getFlowManager } from '../flows.js';
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types/index.js';
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
import { ItemsService } from './items.js';
export class FlowsService extends ItemsService<FlowRaw> {

View File

@@ -2,7 +2,7 @@ import { Action, FUNCTIONS } from '@directus/constants';
import { useEnv } from '@directus/env';
import { ErrorCode, ForbiddenError, InvalidPayloadError, isDirectusError, type DirectusError } from '@directus/errors';
import { isSystemCollection } from '@directus/system-data';
import type { Accountability, Aggregate, Filter, PrimaryKey, Query, SchemaOverview } from '@directus/types';
import type { Accountability, Aggregate, Filter, Item, PrimaryKey, Query, SchemaOverview } from '@directus/types';
import { parseFilterFunctionPath, toBoolean } from '@directus/utils';
import argon2 from 'argon2';
import type {
@@ -54,7 +54,7 @@ import {
SESSION_COOKIE_OPTIONS,
} from '../../constants.js';
import getDatabase from '../../database/index.js';
import type { AbstractServiceOptions, AuthenticationMode, GraphQLParams, Item } from '../../types/index.js';
import type { AbstractServiceOptions, AuthenticationMode, GraphQLParams } from '../../types/index.js';
import { generateHash } from '../../utils/generate-hash.js';
import { getGraphQLType } from '../../utils/get-graphql-type.js';
import { getService } from '../../utils/get-service.js';

View File

@@ -1,7 +1,15 @@
import { Action } from '@directus/constants';
import { useEnv } from '@directus/env';
import { ForbiddenError, InvalidPayloadError } from '@directus/errors';
import type { Accountability, PermissionsAction, Query, SchemaOverview } from '@directus/types';
import { isSystemCollection } from '@directus/system-data';
import type {
Accountability,
Item as AnyItem,
PermissionsAction,
PrimaryKey,
Query,
SchemaOverview,
} from '@directus/types';
import type Keyv from 'keyv';
import type { Knex } from 'knex';
import { assign, clone, cloneDeep, omit, pick, without } from 'lodash-es';
@@ -11,20 +19,12 @@ import { getHelpers } from '../database/helpers/index.js';
import getDatabase from '../database/index.js';
import runAST from '../database/run-ast.js';
import emitter from '../emitter.js';
import type {
AbstractService,
AbstractServiceOptions,
ActionEventParams,
Item as AnyItem,
MutationOptions,
PrimaryKey,
} from '../types/index.js';
import type { AbstractService, AbstractServiceOptions, ActionEventParams, MutationOptions } from '../types/index.js';
import getASTFromQuery from '../utils/get-ast-from-query.js';
import { shouldClearCache } from '../utils/should-clear-cache.js';
import { validateKeys } from '../utils/validate-keys.js';
import { AuthorizationService } from './authorization.js';
import { PayloadService } from './payload.js';
import { isSystemCollection } from '@directus/system-data';
const env = useEnv();

View File

@@ -1,7 +1,7 @@
import { useEnv } from '@directus/env';
import type { Notification } from '@directus/types';
import type { Notification, PrimaryKey } from '@directus/types';
import { useLogger } from '../logger.js';
import type { AbstractServiceOptions, MutationOptions, PrimaryKey } from '../types/index.js';
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
import { md } from '../utils/md.js';
import { Url } from '../utils/url.js';
import { ItemsService } from './items.js';

View File

@@ -1,6 +1,6 @@
import type { OperationRaw } from '@directus/types';
import type { Item, OperationRaw, PrimaryKey } from '@directus/types';
import { getFlowManager } from '../flows.js';
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types/index.js';
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
import { ItemsService } from './items.js';
export class OperationsService extends ItemsService<OperationRaw> {

View File

@@ -1,5 +1,5 @@
import { ForbiddenError, InvalidPayloadError } from '@directus/errors';
import type { Accountability, Query, SchemaOverview } from '@directus/types';
import type { Accountability, Alterations, Item, PrimaryKey, Query, SchemaOverview } from '@directus/types';
import { parseJSON, toArray } from '@directus/utils';
import { format, isValid, parseISO } from 'date-fns';
import { unflatten } from 'flat';
@@ -11,14 +11,7 @@ import { parse as wktToGeoJSON } from 'wellknown';
import type { Helpers } from '../database/helpers/index.js';
import { getHelpers } from '../database/helpers/index.js';
import getDatabase from '../database/index.js';
import type {
AbstractServiceOptions,
ActionEventParams,
Alterations,
Item,
MutationOptions,
PrimaryKey,
} from '../types/index.js';
import type { AbstractServiceOptions, ActionEventParams, MutationOptions } from '../types/index.js';
import { generateHash } from '../utils/generate-hash.js';
import { ItemsService } from './items.js';

View File

@@ -1,8 +1,8 @@
import { ForbiddenError } from '@directus/errors';
import type { ItemPermissions, Permission, PermissionsAction, Query } from '@directus/types';
import type { Item, ItemPermissions, Permission, PermissionsAction, PrimaryKey, Query } from '@directus/types';
import type Keyv from 'keyv';
import { clearSystemCache, getCache } from '../../cache.js';
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../../types/index.js';
import type { AbstractServiceOptions, MutationOptions } from '../../types/index.js';
import { AuthorizationService } from '../authorization.js';
import type { QueryOptions } from '../items.js';
import { ItemsService } from '../items.js';

View File

@@ -1,5 +1,6 @@
import { ForbiddenError, InvalidPayloadError } from '@directus/errors';
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types/index.js';
import type { Item, PrimaryKey } from '@directus/types';
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
import { ItemsService } from './items.js';
export class RevisionsService extends ItemsService {

View File

@@ -1,7 +1,7 @@
import { ForbiddenError, InvalidPayloadError, UnprocessableContentError } from '@directus/errors';
import type { Query, User } from '@directus/types';
import type { Alterations, Item, PrimaryKey, Query, User } from '@directus/types';
import { getMatch } from 'ip-matching';
import type { AbstractServiceOptions, Alterations, Item, MutationOptions, PrimaryKey } from '../types/index.js';
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
import { ItemsService } from './items.js';
import { PermissionsService } from './permissions/index.js';
import { PresetsService } from './presets.js';

View File

@@ -1,14 +1,14 @@
import { useEnv } from '@directus/env';
import { ForbiddenError, InvalidCredentialsError } from '@directus/errors';
import type { Item, PrimaryKey } from '@directus/types';
import argon2 from 'argon2';
import jwt from 'jsonwebtoken';
import { useLogger } from '../logger.js';
import type {
AbstractServiceOptions,
DirectusTokenPayload,
Item,
LoginResult,
MutationOptions,
PrimaryKey,
ShareData,
} from '../types/index.js';
import { getMilliseconds } from '../utils/get-milliseconds.js';
@@ -19,7 +19,6 @@ import { AuthorizationService } from './authorization.js';
import { ItemsService } from './items.js';
import { MailService } from './mail/index.js';
import { UsersService } from './users.js';
import { useLogger } from '../logger.js';
const env = useEnv();
const logger = useLogger();

View File

@@ -1,8 +1,9 @@
import { InvalidPayloadError } from '@directus/errors';
import type { PrimaryKey } from '@directus/types';
import type { Knex } from 'knex';
import { authenticator } from 'otplib';
import getDatabase from '../database/index.js';
import { InvalidPayloadError } from '@directus/errors';
import type { AbstractServiceOptions, PrimaryKey } from '../types/index.js';
import type { AbstractServiceOptions } from '../types/index.js';
import { ItemsService } from './items.js';
export class TFAService {

View File

@@ -1,6 +1,6 @@
import { useEnv } from '@directus/env';
import { ForbiddenError, InvalidPayloadError, RecordNotUniqueError, UnprocessableContentError } from '@directus/errors';
import type { Query } from '@directus/types';
import type { Item, PrimaryKey, Query } from '@directus/types';
import { getSimpleHash, toArray } from '@directus/utils';
import { FailedValidationError, joiValidationErrorItemToErrorExtensions } from '@directus/validation';
import Joi from 'joi';
@@ -8,7 +8,8 @@ import jwt from 'jsonwebtoken';
import { cloneDeep, isEmpty } from 'lodash-es';
import { performance } from 'perf_hooks';
import getDatabase from '../database/index.js';
import type { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types/index.js';
import { useLogger } from '../logger.js';
import type { AbstractServiceOptions, MutationOptions } from '../types/index.js';
import isUrlAllowed from '../utils/is-url-allowed.js';
import { verifyJWT } from '../utils/jwt.js';
import { stall } from '../utils/stall.js';
@@ -16,7 +17,6 @@ import { Url } from '../utils/url.js';
import { ItemsService } from './items.js';
import { MailService } from './mail/index.js';
import { SettingsService } from './settings.js';
import { useLogger } from '../logger.js';
const env = useEnv();
const logger = useLogger();

View File

@@ -1,11 +1,11 @@
import type { Accountability, SchemaOverview } from '@directus/types';
import { ForbiddenError, InvalidPayloadError } from '@directus/errors';
import { systemCollectionRows } from '@directus/system-data';
import type { Accountability, PrimaryKey, SchemaOverview } from '@directus/types';
import type { Knex } from 'knex';
import { flushCaches, getCache } from '../cache.js';
import getDatabase from '../database/index.js';
import { systemCollectionRows } from '@directus/system-data';
import emitter from '../emitter.js';
import { ForbiddenError, InvalidPayloadError } from '@directus/errors';
import type { AbstractServiceOptions, PrimaryKey } from '../types/index.js';
import type { AbstractServiceOptions } from '../types/index.js';
import { shouldClearCache } from '../utils/should-clear-cache.js';
export class UtilsService {

View File

@@ -1,8 +1,9 @@
import { ErrorCode, createError, type DirectusError } from '@directus/errors';
import type { Bus } from '@directus/memory';
import type { PrimaryKey } from '@directus/types';
import { useBus } from '../bus/index.js';
import { useLogger } from '../logger.js';
import type { AbstractServiceOptions, MutationOptions, PrimaryKey, Webhook } from '../types/index.js';
import type { AbstractServiceOptions, MutationOptions, Webhook } from '../types/index.js';
import { ItemsService } from './items.js';
const logger = useLogger();

View File

@@ -1,17 +1,7 @@
import type { DirectusError } from '@directus/errors';
import type { EventContext } from '@directus/types';
import type { EventContext, PrimaryKey } from '@directus/types';
import type { MutationTracker } from '../services/items.js';
export type Item = Record<string, any>;
export type PrimaryKey = string | number;
export type Alterations<T extends Item = Item, K extends keyof T | undefined = undefined> = {
create: Partial<T>[];
update: (K extends keyof T ? Partial<T> & Pick<T, K> : Partial<T>)[];
delete: (K extends keyof T ? T[K] : PrimaryKey)[];
};
export type MutationOptions = {
/**
* Callback function that's fired whenever a revision is made in the mutation

View File

@@ -1,6 +1,5 @@
import type { Accountability, Query, SchemaOverview } from '@directus/types';
import type { Accountability, Item, PrimaryKey, Query, SchemaOverview } from '@directus/types';
import type { Knex } from 'knex';
import type { Item, PrimaryKey } from './items.js';
export type AbstractServiceOptions = {
knex?: Knex | undefined;

View File

@@ -1,7 +1,6 @@
import type { Item, SchemaOverview } from '@directus/types';
import Joi from 'joi';
import type { Alterations } from '../types/index.js';
import type { Alterations, Item, SchemaOverview } from '@directus/types';
import { isObject } from '@directus/utils';
import Joi from 'joi';
import { cloneDeep } from 'lodash-es';
const alterationSchema = Joi.object({

View File

@@ -1,6 +1,5 @@
import { ForbiddenError } from '@directus/errors';
import type { SchemaOverview } from '@directus/types';
import type { PrimaryKey } from '../types/index.js';
import type { PrimaryKey, SchemaOverview } from '@directus/types';
import { isValidUuid } from './is-valid-uuid.js';
/**