Skip to content

Commit 10e6edb

Browse files
authored
feat: code cleanup (#5)
* feat: code cleanup * feat: remove compose function and actor resource locator * feat: Removed hooks
1 parent 762b7dc commit 10e6edb

File tree

12 files changed

+6
-655
lines changed

12 files changed

+6
-655
lines changed

nodes/ApifyContentCrawler/resources/actorResourceLocator.ts

Lines changed: 0 additions & 169 deletions
This file was deleted.

nodes/ApifyContentCrawler/resources/actorTaskResourceLocator.ts

Lines changed: 0 additions & 109 deletions
This file was deleted.

nodes/ApifyContentCrawler/resources/actors/run-actor-advanced/hooks.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import { INodePropertyOptions } from 'n8n-workflow';
22

3-
import { properties as rawProperties } from './properties';
4-
import { runHooks } from './hooks';
3+
import { properties } from './properties';
54

65
export const name = 'Run Actor Advanced';
76

8-
const rawOption: INodePropertyOptions = {
7+
const option: INodePropertyOptions = {
98
name: 'Advanced Settings',
109
value: 'Run Actor Advanced',
1110
action: 'Crawl a Website (Advanced Settings)',
1211
description:
1312
'Use advanced options for crawling including crawling type, crawling depth, and max pages',
1413
};
1514

16-
const { properties, option } = runHooks(rawOption, rawProperties);
17-
1815
export { option, properties };

nodes/ApifyContentCrawler/resources/actors/run-actor-standard/hooks.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import { INodePropertyOptions } from 'n8n-workflow';
22

3-
import { properties as rawProperties } from './properties';
4-
import { runHooks } from './hooks';
3+
import { properties } from './properties';
54

65
export const name = 'Run Actor Standard';
76

8-
const rawOption: INodePropertyOptions = {
7+
const option: INodePropertyOptions = {
98
name: 'Standard Settings',
109
value: 'Run Actor Standard',
1110
action: 'Crawl a Website (Standard Settings)',
1211
description: 'Crawl any website with our standard settings',
1312
};
1413

15-
const { properties, option } = runHooks(rawOption, rawProperties);
16-
1714
export { option, properties };

nodes/ApifyContentCrawler/resources/genericFunctions.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -154,28 +154,3 @@ export async function getResults(this: IExecuteFunctions, datasetId: string): Pr
154154

155155
return this.helpers.returnJsonArray(results);
156156
}
157-
158-
export function getCondition(this: IHookFunctions, resource: string, id: string): object {
159-
return resource === 'actor' ? { actorId: id } : { actorTaskId: id };
160-
}
161-
162-
export function normalizeEventTypes(selected: string[]): string[] {
163-
if (selected.includes('any')) {
164-
return ['ACTOR.RUN.SUCCEEDED', 'ACTOR.RUN.FAILED', 'ACTOR.RUN.TIMED_OUT', 'ACTOR.RUN.ABORTED'];
165-
}
166-
return selected;
167-
}
168-
169-
export function generateIdempotencyKey(
170-
resource: string,
171-
actorOrTaskId: string,
172-
eventTypes: string[],
173-
): string {
174-
const sortedEventTypes = [...eventTypes].sort();
175-
const raw = `${resource}:${actorOrTaskId}:${sortedEventTypes.join(',')}`;
176-
return Buffer.from(raw).toString('base64');
177-
}
178-
179-
export function compose(...fns: Function[]) {
180-
return (x: any) => fns.reduce((v, f) => f(v), x);
181-
}

0 commit comments

Comments
 (0)