Skip to content

Commit a4d8a32

Browse files
committed
PR feedback updates
1 parent 0ea17b9 commit a4d8a32

File tree

8 files changed

+469
-487
lines changed

8 files changed

+469
-487
lines changed

__tests__/helpers.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ export function mockDirectusCredentials() {
77
};
88
}
99

10-
export function mockSuccessfulHttpRequest(data: any) {
11-
return vi.fn<any>().mockResolvedValue({ data });
12-
}
13-
14-
export function mockFailedHttpRequest(error: string) {
15-
return vi.fn<any>().mockRejectedValue(new Error(error));
16-
}
17-
1810
export function createMockExecuteFunctions(
1911
options: {
2012
nodeParameters: any;

credentials/DirectusApi.credentials.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,6 @@ export class DirectusApi implements ICredentialType {
4343
'Without sufficient permissions, you may encounter 403 Forbidden errors when using this integration.',
4444
required: true,
4545
},
46-
{
47-
displayName: 'Environment',
48-
name: 'environment',
49-
type: 'options',
50-
options: [
51-
{
52-
name: 'Cloud',
53-
value: 'cloud',
54-
},
55-
{
56-
name: 'Self-hosted',
57-
value: 'self-hosted',
58-
},
59-
],
60-
default: 'cloud',
61-
description: 'The type of Directus instance you are connecting to',
62-
},
6346
];
6447

6548
authenticate: IAuthenticateGeneric = {

nodes/Directus/methods/utils.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { IExecuteFunctions } from 'n8n-workflow';
22
import { NodeOperationError } from 'n8n-workflow';
3-
import type { FieldParameter, DirectusField } from '../types';
3+
import type { FieldParameter } from '../types';
44

55
export function buildRequestBody(fieldParams: FieldParameter | undefined): Record<string, unknown> {
66
const body: Record<string, unknown> = {};
@@ -16,18 +16,6 @@ export function buildRequestBody(fieldParams: FieldParameter | undefined): Recor
1616
return body;
1717
}
1818

19-
export function shouldSkipField(field: DirectusField): boolean {
20-
if (!field?.meta) return true;
21-
const special = field.meta.special || [];
22-
return (
23-
special.includes('m2a') ||
24-
field.meta.locked ||
25-
field.meta.hidden ||
26-
field.type === 'alias' ||
27-
field.field?.startsWith('$')
28-
);
29-
}
30-
3119
export function formatFieldName(input: string): string {
3220
if (!input) return '';
3321
return input.replace(/_/g, ' ').replace(/\b\w/g, (l) => l.toUpperCase());

nodes/Directus/types.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { IExecuteFunctions } from 'n8n-workflow';
33
export interface DirectusCredentials {
44
url: string;
55
token: string;
6-
environment: 'cloud' | 'self-hosted';
76
}
87

98
export interface DirectusRelation {
@@ -182,3 +181,12 @@ export interface IExecuteFunctionsWithRequest extends IExecuteFunctions {
182181
request: (options: IRequestOptionsWithFormData) => Promise<unknown>;
183182
};
184183
}
184+
185+
export interface DirectusWebhookPayload {
186+
event: string;
187+
payload: Record<string, unknown>;
188+
collection?: string;
189+
key?: string;
190+
id?: string;
191+
keys?: string[];
192+
}

0 commit comments

Comments
 (0)