@doppelgangerdev/piece-doppelganger 1.0.0
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/package.json +23 -0
- package/src/actions/execute-task.d.ts +5 -0
- package/src/actions/execute-task.d.ts.map +1 -0
- package/src/actions/execute-task.js +118 -0
- package/src/actions/execute-task.js.map +1 -0
- package/src/actions/execute-task.ts +145 -0
- package/src/auth/doppelganger-auth.d.ts +7 -0
- package/src/auth/doppelganger-auth.d.ts.map +1 -0
- package/src/auth/doppelganger-auth.js +20 -0
- package/src/auth/doppelganger-auth.js.map +1 -0
- package/src/auth/doppelganger-auth.ts +23 -0
- package/src/index.d.ts +5 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +14 -0
- package/src/index.js.map +1 -0
- package/src/index.ts +15 -0
- package/tsconfig.json +45 -0
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@doppelgangerdev/piece-doppelganger",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"build": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"description": "",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/node": "^25.0.10",
|
|
16
|
+
"ts-node": "^10.9.2",
|
|
17
|
+
"typescript": "^5.9.3"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@activepieces/pieces-common": "^0.11.2",
|
|
21
|
+
"@activepieces/pieces-framework": "^0.25.0"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const executeTaskAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>, import("@activepieces/pieces-framework").InputPropertyMap>;
|
|
5
|
+
//# sourceMappingURL=execute-task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-task.d.ts","sourceRoot":"","sources":["execute-task.ts"],"names":[],"mappings":"AA+GA,eAAO,MAAM,iBAAiB;;;8DAiC5B,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createAction, Property } from '@activepieces/pieces-framework';
|
|
2
|
+
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
|
3
|
+
import { doppelgangerAuth } from '../auth/doppelganger-auth.js';
|
|
4
|
+
const trimUrl = (value) => value.replace(/\/+$/, '');
|
|
5
|
+
const requireBaseUrl = (auth) => {
|
|
6
|
+
const raw = auth.props?.baseUrl;
|
|
7
|
+
if (typeof raw !== 'string' || !raw.trim()) {
|
|
8
|
+
throw new Error('Base URL is required for the Doppelganger connection.');
|
|
9
|
+
}
|
|
10
|
+
return trimUrl(raw);
|
|
11
|
+
};
|
|
12
|
+
const requireApiKey = (auth) => {
|
|
13
|
+
const raw = auth.props?.apiKey;
|
|
14
|
+
if (typeof raw !== 'string' || !raw.trim()) {
|
|
15
|
+
throw new Error('API key is required for the Doppelganger connection.');
|
|
16
|
+
}
|
|
17
|
+
return raw.trim();
|
|
18
|
+
};
|
|
19
|
+
const createVariablePayload = (entries) => {
|
|
20
|
+
const payload = {};
|
|
21
|
+
for (const entry of entries ?? []) {
|
|
22
|
+
const key = entry?.name?.trim();
|
|
23
|
+
if (!key) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
payload[key] = entry.value ?? '';
|
|
27
|
+
}
|
|
28
|
+
return payload;
|
|
29
|
+
};
|
|
30
|
+
const fetchTaskOptions = async (auth) => {
|
|
31
|
+
const baseUrl = requireBaseUrl(auth);
|
|
32
|
+
const response = await httpClient.sendRequest({
|
|
33
|
+
method: HttpMethod.GET,
|
|
34
|
+
url: `${baseUrl}/api/tasks/list`,
|
|
35
|
+
headers: {
|
|
36
|
+
'x-api-key': requireApiKey(auth),
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const tasks = response.body?.tasks ?? [];
|
|
40
|
+
const options = tasks
|
|
41
|
+
.filter((task) => Boolean(task?.id))
|
|
42
|
+
.map((task) => ({
|
|
43
|
+
label: task.name ? `${task.name} (${task.id})` : task.id,
|
|
44
|
+
value: task.id,
|
|
45
|
+
}));
|
|
46
|
+
if (options.length === 0) {
|
|
47
|
+
return {
|
|
48
|
+
options,
|
|
49
|
+
placeholder: 'No tasks are available from the configured server.',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return { options };
|
|
53
|
+
};
|
|
54
|
+
const executeTaskProps = {
|
|
55
|
+
taskId: Property.Dropdown({
|
|
56
|
+
displayName: 'Task ID',
|
|
57
|
+
description: 'Select the task to execute.',
|
|
58
|
+
auth: doppelgangerAuth,
|
|
59
|
+
refreshers: ['auth'],
|
|
60
|
+
required: true,
|
|
61
|
+
async options({ auth }) {
|
|
62
|
+
if (!auth) {
|
|
63
|
+
return {
|
|
64
|
+
options: [],
|
|
65
|
+
disabled: true,
|
|
66
|
+
placeholder: 'Set up the Doppelganger connection first.',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return fetchTaskOptions(auth);
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
variables: Property.Array({
|
|
73
|
+
displayName: 'Variables',
|
|
74
|
+
description: 'Optional key/value overrides to pass into the task.',
|
|
75
|
+
required: false,
|
|
76
|
+
defaultValue: [],
|
|
77
|
+
properties: {
|
|
78
|
+
name: Property.ShortText({
|
|
79
|
+
displayName: 'Name',
|
|
80
|
+
required: true,
|
|
81
|
+
}),
|
|
82
|
+
value: Property.ShortText({
|
|
83
|
+
displayName: 'Value',
|
|
84
|
+
required: false,
|
|
85
|
+
}),
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
};
|
|
89
|
+
export const executeTaskAction = createAction({
|
|
90
|
+
name: 'execute_task',
|
|
91
|
+
displayName: 'Execute Doppelganger Task',
|
|
92
|
+
description: 'Run a Doppelganger task and optionally override variables via the API.',
|
|
93
|
+
auth: doppelgangerAuth,
|
|
94
|
+
props: executeTaskProps,
|
|
95
|
+
async run(context) {
|
|
96
|
+
const auth = context.auth;
|
|
97
|
+
if (!auth) {
|
|
98
|
+
throw new Error('Missing Doppelganger connection.');
|
|
99
|
+
}
|
|
100
|
+
const { taskId, variables } = context.propsValue;
|
|
101
|
+
const baseUrl = requireBaseUrl(auth);
|
|
102
|
+
const apiKey = requireApiKey(auth);
|
|
103
|
+
const request = {
|
|
104
|
+
method: HttpMethod.POST,
|
|
105
|
+
url: `${baseUrl}/tasks/${encodeURIComponent(taskId)}/api`,
|
|
106
|
+
headers: {
|
|
107
|
+
'x-api-key': apiKey,
|
|
108
|
+
'Content-Type': 'application/json',
|
|
109
|
+
},
|
|
110
|
+
body: {
|
|
111
|
+
variables: createVariablePayload(variables),
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
const response = await httpClient.sendRequest(request);
|
|
115
|
+
return response.body;
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=execute-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-task.js","sourceRoot":"","sources":["execute-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAA8B,MAAM,8BAA8B,CAAC;AAO5F,MAAM,OAAO,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,OAAO,CA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qB,CAAC,SAAS,CAAC;aAC5C;SACF,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACvD,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { createAction, Property } from '@activepieces/pieces-framework';
|
|
2
|
+
import type { ActionContext, DropdownState } from '@activepieces/pieces-framework';
|
|
3
|
+
import { httpClient, HttpMethod } from '@activepieces/pieces-common';
|
|
4
|
+
import type { HttpRequest } from '@activepieces/pieces-common';
|
|
5
|
+
import { doppelgangerAuth, type DoppelgangerAuthValue } from '../auth/doppelganger-auth.js';
|
|
6
|
+
|
|
7
|
+
type VariablesEntry = {
|
|
8
|
+
name?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const trimUrl = (value: string): string => value.replace(/\/+$/, '');
|
|
13
|
+
|
|
14
|
+
const requireBaseUrl = (auth: DoppelgangerAuthValue): string => {
|
|
15
|
+
const raw = auth.props?.baseUrl;
|
|
16
|
+
if (typeof raw !== 'string' || !raw.trim()) {
|
|
17
|
+
throw new Error('Base URL is required for the Doppelganger connection.');
|
|
18
|
+
}
|
|
19
|
+
return trimUrl(raw);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const requireApiKey = (auth: DoppelgangerAuthValue): string => {
|
|
23
|
+
const raw = auth.props?.apiKey;
|
|
24
|
+
if (typeof raw !== 'string' || !raw.trim()) {
|
|
25
|
+
throw new Error('API key is required for the Doppelganger connection.');
|
|
26
|
+
}
|
|
27
|
+
return raw.trim();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const createVariablePayload = (entries: VariablesEntry[] | undefined): Record<string, string> => {
|
|
31
|
+
const payload: Record<string, string> = {};
|
|
32
|
+
for (const entry of entries ?? []) {
|
|
33
|
+
const key = entry?.name?.trim();
|
|
34
|
+
if (!key) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
payload[key] = entry.value ?? '';
|
|
38
|
+
}
|
|
39
|
+
return payload;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const fetchTaskOptions = async (auth: DoppelgangerAuthValue): Promise<DropdownState<string>> => {
|
|
43
|
+
const baseUrl = requireBaseUrl(auth);
|
|
44
|
+
const response = await httpClient.sendRequest<{ tasks?: Array<{ id?: string; name?: string }> }>({
|
|
45
|
+
method: HttpMethod.GET,
|
|
46
|
+
url: `${baseUrl}/api/tasks/list`,
|
|
47
|
+
headers: {
|
|
48
|
+
'x-api-key': requireApiKey(auth),
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const tasks = response.body?.tasks ?? [];
|
|
53
|
+
const options = tasks
|
|
54
|
+
.filter((task): task is { id: string; name?: string } => Boolean(task?.id))
|
|
55
|
+
.map((task) => ({
|
|
56
|
+
label: task.name ? `${task.name} (${task.id})` : task.id,
|
|
57
|
+
value: task.id,
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
if (options.length === 0) {
|
|
61
|
+
return {
|
|
62
|
+
options,
|
|
63
|
+
placeholder: 'No tasks are available from the configured server.',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return { options };
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const executeTaskProps = {
|
|
71
|
+
taskId: Property.Dropdown({
|
|
72
|
+
displayName: 'Task ID',
|
|
73
|
+
description: 'Select the task to execute.',
|
|
74
|
+
auth: doppelgangerAuth,
|
|
75
|
+
refreshers: ['auth'],
|
|
76
|
+
required: true,
|
|
77
|
+
async options({ auth }: { auth?: DoppelgangerAuthValue }) {
|
|
78
|
+
if (!auth) {
|
|
79
|
+
return {
|
|
80
|
+
options: [],
|
|
81
|
+
disabled: true,
|
|
82
|
+
placeholder: 'Set up the Doppelganger connection first.',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return fetchTaskOptions(auth);
|
|
87
|
+
},
|
|
88
|
+
}),
|
|
89
|
+
variables: Property.Array({
|
|
90
|
+
displayName: 'Variables',
|
|
91
|
+
description: 'Optional key/value overrides to pass into the task.',
|
|
92
|
+
required: false,
|
|
93
|
+
defaultValue: [],
|
|
94
|
+
properties: {
|
|
95
|
+
name: Property.ShortText({
|
|
96
|
+
displayName: 'Name',
|
|
97
|
+
required: true,
|
|
98
|
+
}),
|
|
99
|
+
value: Property.ShortText({
|
|
100
|
+
displayName: 'Value',
|
|
101
|
+
required: false,
|
|
102
|
+
}),
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
} as const;
|
|
106
|
+
|
|
107
|
+
type ExecuteTaskInput = {
|
|
108
|
+
taskId: string;
|
|
109
|
+
variables?: VariablesEntry[];
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const executeTaskAction = createAction({
|
|
113
|
+
name: 'execute_task',
|
|
114
|
+
displayName: 'Execute Doppelganger Task',
|
|
115
|
+
description: 'Run a Doppelganger task and optionally override variables via the API.',
|
|
116
|
+
auth: doppelgangerAuth,
|
|
117
|
+
props: executeTaskProps,
|
|
118
|
+
async run(context: ActionContext<typeof doppelgangerAuth>) {
|
|
119
|
+
const auth = context.auth;
|
|
120
|
+
if (!auth) {
|
|
121
|
+
throw new Error('Missing Doppelganger connection.');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const { taskId, variables } = context.propsValue as ExecuteTaskInput;
|
|
125
|
+
const baseUrl = requireBaseUrl(auth);
|
|
126
|
+
const apiKey = requireApiKey(auth);
|
|
127
|
+
|
|
128
|
+
const request: HttpRequest<{
|
|
129
|
+
variables: Record<string, string>;
|
|
130
|
+
}> = {
|
|
131
|
+
method: HttpMethod.POST,
|
|
132
|
+
url: `${baseUrl}/tasks/${encodeURIComponent(taskId)}/api`,
|
|
133
|
+
headers: {
|
|
134
|
+
'x-api-key': apiKey,
|
|
135
|
+
'Content-Type': 'application/json',
|
|
136
|
+
},
|
|
137
|
+
body: {
|
|
138
|
+
variables: createVariablePayload(variables),
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const response = await httpClient.sendRequest(request);
|
|
143
|
+
return response.body;
|
|
144
|
+
},
|
|
145
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const doppelgangerAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
}>;
|
|
6
|
+
export type DoppelgangerAuthValue = AppConnectionValueForAuthProperty<typeof doppelgangerAuth>;
|
|
7
|
+
//# sourceMappingURL=doppelganger-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doppelganger-auth.d.ts","sourceRoot":"","sources":["doppelganger-auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AAExF,eAAO,MAAM,gBAAgB;;;EAiB3B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,iCAAiC,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PieceAuth, Property } from '@activepieces/pieces-framework';
|
|
2
|
+
export const doppelgangerAuth = PieceAuth.CustomAuth({
|
|
3
|
+
displayName: 'Doppelganger API',
|
|
4
|
+
description: 'Connect to a Doppelganger server (defaults to http://localhost:11345).',
|
|
5
|
+
required: true,
|
|
6
|
+
props: {
|
|
7
|
+
baseUrl: Property.ShortText({
|
|
8
|
+
displayName: 'Base URL',
|
|
9
|
+
description: 'Root URL for your Doppelganger API (without a trailing slash).',
|
|
10
|
+
defaultValue: 'http://localhost:11345',
|
|
11
|
+
required: true,
|
|
12
|
+
}),
|
|
13
|
+
apiKey: PieceAuth.SecretText({
|
|
14
|
+
displayName: 'API Key',
|
|
15
|
+
description: 'x-api-key header value from the Doppelganger settings page.',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=doppelganger-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doppelganger-auth.js","sourceRoot":"","sources":["doppelganger-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAGrE,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC,UAAU,CAAC;IACnD,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,wEAAwE;IACrF,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,gEAAgE;YAC7E,YAAY,EAAE,wBAAwB;YACtC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,SAAS,CAAC,UAAU,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,6DAA6D;YAC1E,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PieceAuth, Property } from '@activepieces/pieces-framework';
|
|
2
|
+
import type { AppConnectionValueForAuthProperty } from '@activepieces/pieces-framework';
|
|
3
|
+
|
|
4
|
+
export const doppelgangerAuth = PieceAuth.CustomAuth({
|
|
5
|
+
displayName: 'Doppelganger API',
|
|
6
|
+
description: 'Connect to a Doppelganger server (defaults to http://localhost:11345).',
|
|
7
|
+
required: true,
|
|
8
|
+
props: {
|
|
9
|
+
baseUrl: Property.ShortText({
|
|
10
|
+
displayName: 'Base URL',
|
|
11
|
+
description: 'Root URL for your Doppelganger API (without a trailing slash).',
|
|
12
|
+
defaultValue: 'http://localhost:11345',
|
|
13
|
+
required: true,
|
|
14
|
+
}),
|
|
15
|
+
apiKey: PieceAuth.SecretText({
|
|
16
|
+
displayName: 'API Key',
|
|
17
|
+
description: 'x-api-key header value from the Doppelganger settings page.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type DoppelgangerAuthValue = AppConnectionValueForAuthProperty<typeof doppelgangerAuth>;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const doppelganger: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>>;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;GAUvB,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createPiece } from '@activepieces/pieces-framework';
|
|
2
|
+
import { executeTaskAction } from './actions/execute-task.js';
|
|
3
|
+
import { doppelgangerAuth } from './auth/doppelganger-auth.js';
|
|
4
|
+
export const doppelganger = createPiece({
|
|
5
|
+
displayName: 'Doppelganger',
|
|
6
|
+
logoUrl: 'https://raw.githubusercontent.com/mnemosyne-artificial-intelligence/n8n-nodes-doppelganger/master/src/nodes/Doppelganger/icon.png',
|
|
7
|
+
authors: ['mnemosyne-artificial-intelligence'],
|
|
8
|
+
description: 'Run Doppelganger tasks through the API exposed by the Doppelganger server.',
|
|
9
|
+
minimumSupportedRelease: '0.2.0',
|
|
10
|
+
auth: doppelgangerAuth,
|
|
11
|
+
actions: [executeTaskAction],
|
|
12
|
+
triggers: [],
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;IACtC,WAAW,EAAE,cAAc;IAC3B,OAAO,EACL,mIAAmI;IACrI,OAAO,EAAE,CAAC,mCAAmC,CAAC;IAC9C,WAAW,EAAE,4EAA4E;IACzF,uBAAuB,EAAE,OAAO;IAChC,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,CAAC,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createPiece } from '@activepieces/pieces-framework';
|
|
2
|
+
import { executeTaskAction } from './actions/execute-task.js';
|
|
3
|
+
import { doppelgangerAuth } from './auth/doppelganger-auth.js';
|
|
4
|
+
|
|
5
|
+
export const doppelganger = createPiece({
|
|
6
|
+
displayName: 'Doppelganger',
|
|
7
|
+
logoUrl:
|
|
8
|
+
'https://raw.githubusercontent.com/mnemosyne-artificial-intelligence/n8n-nodes-doppelganger/master/src/nodes/Doppelganger/icon.png',
|
|
9
|
+
authors: ['mnemosyne-artificial-intelligence'],
|
|
10
|
+
description: 'Run Doppelganger tasks through the API exposed by the Doppelganger server.',
|
|
11
|
+
minimumSupportedRelease: '0.2.0',
|
|
12
|
+
auth: doppelgangerAuth,
|
|
13
|
+
actions: [executeTaskAction],
|
|
14
|
+
triggers: [],
|
|
15
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// File Layout
|
|
5
|
+
// "rootDir": "./src",
|
|
6
|
+
// "outDir": "./dist",
|
|
7
|
+
|
|
8
|
+
// Environment Settings
|
|
9
|
+
// See also https://aka.ms/tsconfig/module
|
|
10
|
+
"module": "nodenext",
|
|
11
|
+
"target": "esnext",
|
|
12
|
+
"types": [],
|
|
13
|
+
// For nodejs:
|
|
14
|
+
// "lib": ["esnext"],
|
|
15
|
+
// "types": ["node"],
|
|
16
|
+
// and npm install -D @types/node
|
|
17
|
+
|
|
18
|
+
// Other Outputs
|
|
19
|
+
"sourceMap": true,
|
|
20
|
+
"declaration": true,
|
|
21
|
+
"declarationMap": true,
|
|
22
|
+
|
|
23
|
+
// Stricter Typechecking Options
|
|
24
|
+
"noUncheckedIndexedAccess": true,
|
|
25
|
+
"exactOptionalPropertyTypes": true,
|
|
26
|
+
|
|
27
|
+
// Style Options
|
|
28
|
+
// "noImplicitReturns": true,
|
|
29
|
+
// "noImplicitOverride": true,
|
|
30
|
+
// "noUnusedLocals": true,
|
|
31
|
+
// "noUnusedParameters": true,
|
|
32
|
+
// "noFallthroughCasesInSwitch": true,
|
|
33
|
+
// "noPropertyAccessFromIndexSignature": true,
|
|
34
|
+
|
|
35
|
+
// Recommended Options
|
|
36
|
+
"strict": true,
|
|
37
|
+
"jsx": "react-jsx",
|
|
38
|
+
"verbatimModuleSyntax": true,
|
|
39
|
+
"isolatedModules": true,
|
|
40
|
+
"noUncheckedSideEffectImports": true,
|
|
41
|
+
"moduleDetection": "force",
|
|
42
|
+
"skipLibCheck": true,
|
|
43
|
+
},
|
|
44
|
+
"include": ["src"]
|
|
45
|
+
}
|