Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/collaborative-editing/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@directus-labs/collaborative-editing",
"type": "module",
"version": "1.1.1",
"version": "1.1.2",
"icon": "extension",
"description": "A realtime extension that enables data synchronization and collaborative editing across collections.",
"license": "MIT",
Expand Down Expand Up @@ -94,9 +94,10 @@
"@directus/sdk": "^19.1.0",
"@directus/types": "^13.1.1",
"@directus/utils": "^13.0.5",
"vue-i18n": "11.1.1",
"vue": "3.5.13",
"vue-router": "4.5.0"
"vue-i18n": "11.1.1",
"vue-router": "4.5.0",
"zod": "4.1.12"
},
"dependencies": {
"@directus/memory": "^3.0.4",
Expand All @@ -107,7 +108,6 @@
"lib0": "^0.2.107",
"lodash-es": "^4.17.21",
"pinia": "^3.0.2",
"yjs": "^13.6.26",
"zod": "^3.24.4"
"yjs": "^13.6.26"
}
}
4 changes: 2 additions & 2 deletions packages/collaborative-editing/src/module/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const EnabledCollections = z.object({
export type EnabledCollectionsType = z.infer<typeof EnabledCollections>;

export const ModuleSettings = z.object({
enabled_globally: z.boolean().optional().default(true),
hide_current_user_avatar: z.boolean().optional().default(false),
enabled_globally: z.boolean().optional().prefault(true),
hide_current_user_avatar: z.boolean().optional().prefault(false),
collections: z.array(EnabledCollections),
});

Expand Down
7 changes: 4 additions & 3 deletions packages/collaborative-editing/src/module/utils/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export function zodErrorToValidationErrors(
let valid: ValidationError['valid'];

switch (issue.code) {
case 'invalid_enum_value':
case 'invalid_value':
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

z.ZodInvalidEnumValueIssue has merged with ZodIssueInvalidValue

// @ts-expect-error `valid` is not used currently.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
valid = issue.options;
valid = issue.values;
Comment on lines -17 to +18
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.values contains the list of acceptable literals in the case of validating against an enum.

break;
case 'invalid_string':
case 'invalid_format':
Comment on lines -19 to +20
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

z.ZodInvalidStringIssue was renamed to ZodIssueInvalidStringFormat.

type = 'contains';
break;
}
Expand Down
11 changes: 7 additions & 4 deletions packages/command-palette-module/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@directus-labs/command-palette-module",
"type": "module",
"version": "1.1.0",
"version": "1.1.1",
"description": "Command palette module for Directus.",
"repository": {
"type": "git",
Expand All @@ -28,6 +28,9 @@
"dev": "directus-extension build -w --no-minify",
"link": "directus-extension link"
},
"peerDependencies": {
"zod": "4.1.12"
},
"dependencies": {
"@directus/format-title": "^11.0.0",
"@types/lodash-es": "^4.17.12",
Expand All @@ -38,8 +41,7 @@
"sass": "^1.77.8",
"vue": "^3.5.13",
"vue-i18n": "^11.1.1",
"vue-router": "^4.5.0",
"zod": "^3.23.8"
"vue-router": "^4.5.0"
},
"devDependencies": {
"@directus/constants": "^12.0.0",
Expand All @@ -48,6 +50,7 @@
"@directus/utils": "^12.0.0",
"@types/diacritics": "^1.3.3",
"axios": "^1.7.5",
"typescript": "^5.5.4"
"typescript": "^5.5.4",
"vue-tsc": "^3.1.2"
}
}
10 changes: 6 additions & 4 deletions packages/command-palette-module/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ export const SearchCollection = z.object({
descriptionField: z.string().optional().nullable(),
thumbnailField: z.string().optional().nullable(),
fields: z.array(z.string().min(1, 'field name cannot be empty')),
filter: z.object({}).optional().nullable() as z.ZodType<Filter | undefined>,
filter: z.object({}).optional().nullable() as z.ZodNullable<z.ZodOptional<z.ZodType<Filter>>>,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not directly related to the upgrade, but it was causing a type error insystem-colelctions.ts, requiring it explicitly set the filter field to undefined.

sort: z.string().optional().nullable(),
limit: z.number().gte(-1, 'greater than or equal to -1').nullable(),
availableGlobally: z.boolean().optional().default(false),
availableGlobally: z.boolean().optional().prefault(false),
});

export const ModuleSettings = z.object({
searchMode: z.enum(['as_you_type', 'on_submit'], {
errorMap: () => ({ message: 'either as_you_type or on_submit' }),
error: () => 'either as_you_type or on_submit',
}),
collections: z.array(SearchCollection),
triggerRate: z.number().gte(0, 'greater than or equal to 0').optional(),
commandPaletteEnabled: z.boolean().optional().default(true),
commandPaletteEnabled: z.boolean().optional().prefault(true),
recentSearchLimit: z.number().gte(0, 'greater than or equal to 0').optional(),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is used by useRecentCommands() to control how many recent commands are shown at most. Was not present in the schema before.

});

interface CollectionSearchInfo {
Expand All @@ -38,6 +39,7 @@ export const defaultSettings: SearchConfigType = {
collections: [],
triggerRate: 100,
commandPaletteEnabled: true,
recentSearchLimit: 5,
};

export type SearchCollectionType = z.infer<typeof SearchCollection>;
Expand Down
13 changes: 7 additions & 6 deletions packages/command-palette-module/src/utils/errors.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import type { FilterOperator, ValidationError } from '@directus/types';
import type { ZodError, ZodIssue } from 'zod';
import type { core, ZodError } from 'zod';

export function zodErrorToValidationErrors(
error: ZodError,
collection: string,
group: string | null = null,
): ValidationError[] {
return error.issues.map((issue: ZodIssue): ValidationError => {
return error.issues.map((issue: core.$ZodIssue): ValidationError => {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue-related interfaces are moved to a new core namespace.

const field = issue.path.join('.');
let type: FilterOperator = 'eq'; // Default value, modify as necessary
let valid: ValidationError['valid'];

switch (issue.code) {
case 'invalid_enum_value':
case 'invalid_value':
// @ts-expect-error `valid` is not used currently.
// eslint-disable-next-line unused-imports/no-unused-vars
valid = issue.options;
valid = issue.values;
break;
case 'invalid_string':
case 'invalid_format':
type = 'contains';
break;
// Add more mappings as necessary
// Add more mappings as necessary
}

return {
Expand Down
4 changes: 2 additions & 2 deletions packages/command-palette-module/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"target": "ES2019",
"lib": ["ES2019", "DOM"],
"lib": ["ES2021", "DOM"],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extension included uses of String#replaceAll() which is an ES2021 feature.

"rootDir": "./src",
"moduleResolution": "node",
"moduleResolution": "bundler",
Copy link
Author

@lilnasy lilnasy Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"node" (renamed to "node10" then removed from recent versions of typescript) module resolution does not pick up on ESM packages, which some Directus packages from the main repo have upgraded to. "node16" is an alternative that disallows extension-less imports.

"resolveJsonModule": false,
"strict": true,
"strictBindCallApply": true,
Expand Down
Loading