@activepieces/piece-griptape 0.0.1
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/README.md +7 -0
- package/package.json +26 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +50 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-assistant-run.d.ts +10 -0
- package/src/lib/actions/create-assistant-run.js +69 -0
- package/src/lib/actions/create-assistant-run.js.map +1 -0
- package/src/lib/actions/create-structure-run.d.ts +4 -0
- package/src/lib/actions/create-structure-run.js +42 -0
- package/src/lib/actions/create-structure-run.js.map +1 -0
- package/src/lib/actions/get-assistant-run.d.ts +4 -0
- package/src/lib/actions/get-assistant-run.js +27 -0
- package/src/lib/actions/get-assistant-run.js.map +1 -0
- package/src/lib/actions/get-structure-run.d.ts +4 -0
- package/src/lib/actions/get-structure-run.js +27 -0
- package/src/lib/actions/get-structure-run.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +27 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +3 -0
- package/src/lib/common/client.js +27 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/props.d.ts +9 -0
- package/src/lib/common/props.js +310 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/triggers/assistant-run-completes.d.ts +8 -0
- package/src/lib/triggers/assistant-run-completes.js +72 -0
- package/src/lib/triggers/assistant-run-completes.js.map +1 -0
- package/src/lib/triggers/assistant-run-succeedes.d.ts +8 -0
- package/src/lib/triggers/assistant-run-succeedes.js +72 -0
- package/src/lib/triggers/assistant-run-succeedes.js.map +1 -0
- package/src/lib/triggers/structure-run-completes.d.ts +8 -0
- package/src/lib/triggers/structure-run-completes.js +65 -0
- package/src/lib/triggers/structure-run-completes.js.map +1 -0
- package/src/lib/triggers/structure-run-succeeds.d.ts +8 -0
- package/src/lib/triggers/structure-run-succeeds.js +65 -0
- package/src/lib/triggers/structure-run-succeeds.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-griptape",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@sinclair/typebox": "0.34.11",
|
|
9
|
+
"axios": "1.8.3",
|
|
10
|
+
"axios-retry": "4.4.1",
|
|
11
|
+
"dayjs": "1.11.9",
|
|
12
|
+
"deepmerge-ts": "7.1.0",
|
|
13
|
+
"mime-types": "2.1.35",
|
|
14
|
+
"nanoid": "3.3.8",
|
|
15
|
+
"semver": "7.6.0",
|
|
16
|
+
"socket.io-client": "4.8.1",
|
|
17
|
+
"tslib": "^2.3.0",
|
|
18
|
+
"zod": "3.25.76",
|
|
19
|
+
"@activepieces/pieces-common": "0.8.1",
|
|
20
|
+
"@activepieces/pieces-framework": "0.20.2",
|
|
21
|
+
"@activepieces/shared": "0.26.0"
|
|
22
|
+
},
|
|
23
|
+
"resolutions": {
|
|
24
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const griptape: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.griptape = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("./lib/common/auth");
|
|
7
|
+
const shared_1 = require("@activepieces/shared");
|
|
8
|
+
const create_assistant_run_1 = require("./lib/actions/create-assistant-run");
|
|
9
|
+
const create_structure_run_1 = require("./lib/actions/create-structure-run");
|
|
10
|
+
const get_assistant_run_1 = require("./lib/actions/get-assistant-run");
|
|
11
|
+
const get_structure_run_1 = require("./lib/actions/get-structure-run");
|
|
12
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
13
|
+
const client_1 = require("./lib/common/client");
|
|
14
|
+
const assistant_run_completes_1 = require("./lib/triggers/assistant-run-completes");
|
|
15
|
+
const assistant_run_succeedes_1 = require("./lib/triggers/assistant-run-succeedes");
|
|
16
|
+
const structure_run_completes_1 = require("./lib/triggers/structure-run-completes");
|
|
17
|
+
const structure_run_succeeds_1 = require("./lib/triggers/structure-run-succeeds");
|
|
18
|
+
exports.griptape = (0, pieces_framework_1.createPiece)({
|
|
19
|
+
displayName: 'Griptape Cloud',
|
|
20
|
+
auth: auth_1.griptapeAuth,
|
|
21
|
+
minimumSupportedRelease: '0.36.1',
|
|
22
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/griptape.png',
|
|
23
|
+
categories: [
|
|
24
|
+
shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE,
|
|
25
|
+
shared_1.PieceCategory.DEVELOPER_TOOLS,
|
|
26
|
+
],
|
|
27
|
+
authors: ['sanket-a11y'],
|
|
28
|
+
actions: [
|
|
29
|
+
create_assistant_run_1.createAssistantRun,
|
|
30
|
+
create_structure_run_1.createStructureRun,
|
|
31
|
+
get_assistant_run_1.getAssistantRun,
|
|
32
|
+
get_structure_run_1.getStructureRun,
|
|
33
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
34
|
+
auth: auth_1.griptapeAuth,
|
|
35
|
+
baseUrl: () => client_1.BASE_URL,
|
|
36
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
return {
|
|
38
|
+
Authorization: `Bearer ${auth}`,
|
|
39
|
+
};
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
triggers: [
|
|
44
|
+
assistant_run_completes_1.assistantRunCompletes,
|
|
45
|
+
assistant_run_succeedes_1.assistantRunSucceedes,
|
|
46
|
+
structure_run_completes_1.structureRunCompletes,
|
|
47
|
+
structure_run_succeeds_1.structureRunSucceeds,
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/griptape/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,4CAAiD;AACjD,iDAAqD;AACrD,6EAAwE;AACxE,6EAAwE;AACxE,uEAAkE;AAClE,uEAAkE;AAClE,+DAAwE;AACxE,gDAA+C;AAC/C,oFAA+E;AAC/E,oFAA+E;AAC/E,oFAA+E;AAC/E,kFAA6E;AAEhE,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,mBAAY;IAClB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAE;QACV,sBAAa,CAAC,uBAAuB;QACrC,sBAAa,CAAC,eAAe;KAC9B;IACD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,yCAAkB;QAClB,yCAAkB;QAClB,mCAAe;QACf,mCAAe;QACf,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,mBAAY;YAClB,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAQ;YACvB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,aAAa,EAAE,UAAU,IAAI,EAAE;iBAChC,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE;QACR,+CAAqB;QACrB,+CAAqB;QACrB,+CAAqB;QACrB,6CAAoB;KACrB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const createAssistantRun: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
assistant_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
3
|
+
input: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
4
|
+
knowledgeBaseIds: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
5
|
+
rulesets: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
6
|
+
structures: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
7
|
+
tools: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
8
|
+
thread: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
9
|
+
create_new_thread: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAssistantRun = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.createAssistantRun = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.griptapeAuth,
|
|
12
|
+
name: 'createAssistantRun',
|
|
13
|
+
displayName: 'Create Assistant Run',
|
|
14
|
+
description: 'Create a run for an assistant with optional additional resources',
|
|
15
|
+
props: {
|
|
16
|
+
assistant_id: props_1.assistantIdDropdown,
|
|
17
|
+
input: pieces_framework_1.Property.LongText({
|
|
18
|
+
displayName: 'Input',
|
|
19
|
+
description: 'Input to provide to the assistant',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
knowledgeBaseIds: props_1.knowledgeBaseIdsDropdown,
|
|
23
|
+
rulesets: props_1.rulesetIdsDropdown,
|
|
24
|
+
structures: props_1.structuresIdsDropdown,
|
|
25
|
+
tools: props_1.toolsIdsDropdown,
|
|
26
|
+
thread: props_1.threadIdsDropdown,
|
|
27
|
+
create_new_thread: pieces_framework_1.Property.Checkbox({
|
|
28
|
+
displayName: 'Create New Thread',
|
|
29
|
+
description: 'Create a new thread for this run',
|
|
30
|
+
required: false,
|
|
31
|
+
defaultValue: false,
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
run(context) {
|
|
35
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const { assistant_id, input, knowledgeBaseIds, rulesets, structures, tools, thread, create_new_thread, } = context.propsValue;
|
|
37
|
+
const requestBody = {
|
|
38
|
+
input,
|
|
39
|
+
};
|
|
40
|
+
if (knowledgeBaseIds && knowledgeBaseIds.length > 0) {
|
|
41
|
+
requestBody['additional_knowledge_base_ids'] = knowledgeBaseIds;
|
|
42
|
+
}
|
|
43
|
+
if (rulesets && rulesets.length > 0) {
|
|
44
|
+
requestBody['additional_ruleset_ids'] = rulesets;
|
|
45
|
+
}
|
|
46
|
+
if (structures && structures.length > 0) {
|
|
47
|
+
requestBody['additional_structure_ids'] = structures;
|
|
48
|
+
}
|
|
49
|
+
if (tools && tools.length > 0) {
|
|
50
|
+
requestBody['additional_tool_ids'] = tools;
|
|
51
|
+
}
|
|
52
|
+
requestBody['create_new_thread'] = create_new_thread;
|
|
53
|
+
if (thread && thread.length > 0) {
|
|
54
|
+
requestBody['thread_id'] = Array.isArray(thread) ? thread[0] : thread;
|
|
55
|
+
}
|
|
56
|
+
const response = yield (0, client_1.makeRequest)(context.auth, pieces_common_1.HttpMethod.POST, `/assistants/${assistant_id}/runs`, requestBody);
|
|
57
|
+
const assistantRunId = response.assistant_run_id;
|
|
58
|
+
let runStatus = response.status;
|
|
59
|
+
let runData = response;
|
|
60
|
+
while (runStatus !== 'SUCCEEDED') {
|
|
61
|
+
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
62
|
+
runData = yield (0, client_1.makeRequest)(context.auth, pieces_common_1.HttpMethod.GET, `/assistant-runs/${assistantRunId}`);
|
|
63
|
+
runStatus = runData.status;
|
|
64
|
+
}
|
|
65
|
+
return runData;
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=create-assistant-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-assistant-run.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/actions/create-assistant-run.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,yCAA8C;AAC9C,6CAA+C;AAC/C,2CAOyB;AAEZ,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,kEAAkE;IACpE,KAAK,EAAE;QACL,YAAY,EAAE,2BAAmB;QACjC,KAAK,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,gBAAgB,EAAE,gCAAwB;QAC1C,QAAQ,EAAE,0BAAkB;QAC5B,UAAU,EAAE,6BAAqB;QACjC,KAAK,EAAE,wBAAgB;QACvB,MAAM,EAAE,yBAAiB;QACzB,iBAAiB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACnC,WAAW,EAAE,mBAAmB;YAChC,WAAW,EAAE,kCAAkC;YAC/C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EACJ,YAAY,EACZ,KAAK,E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AQ,CAAC;YAEvB,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;gBACjC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;gBAE1D,OAAO,GAAG,MAAM,IAAA,oBAAW,EACzB,OAAO,CAAC,IAAc,EACtB,0BAAU,CAAC,GAAG,EACd,mBAAmB,cAAc,EAAE,CACpC,CAAC;gBAEF,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;YAC7B,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const createStructureRun: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
structure_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
3
|
+
input_args: import("@activepieces/pieces-framework").ArrayProperty<true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStructureRun = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
+
exports.createStructureRun = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.griptapeAuth,
|
|
12
|
+
name: 'createStructureRun',
|
|
13
|
+
displayName: 'Create Structure Run',
|
|
14
|
+
description: 'Create a run for a structure and wait for completion',
|
|
15
|
+
props: {
|
|
16
|
+
structure_id: props_1.structureIdDropdown,
|
|
17
|
+
input_args: pieces_framework_1.Property.Array({
|
|
18
|
+
displayName: 'Input Arguments',
|
|
19
|
+
description: 'Input arguments for the structure run',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
run(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const { structure_id, input_args } = context.propsValue;
|
|
26
|
+
const requestBody = {
|
|
27
|
+
args: input_args,
|
|
28
|
+
};
|
|
29
|
+
const response = yield (0, client_1.makeRequest)(context.auth, pieces_common_1.HttpMethod.POST, `/structures/${structure_id}/runs`, requestBody);
|
|
30
|
+
const structureRunId = response.structure_run_id;
|
|
31
|
+
let runStatus = response.status;
|
|
32
|
+
let runData = response;
|
|
33
|
+
while (runStatus !== 'SUCCEEDED') {
|
|
34
|
+
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
35
|
+
runData = yield (0, client_1.makeRequest)(context.auth, pieces_common_1.HttpMethod.GET, `/structure-runs/${structureRunId}`);
|
|
36
|
+
runStatus = runData.status;
|
|
37
|
+
}
|
|
38
|
+
return runData;
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=create-structure-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-structure-run.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/actions/create-structure-run.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA8C;AAC9C,2CAAsD;AACtD,6CAA+C;AAC/C,+DAAyD;AAE5C,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,sDAAsD;IACnE,KAAK,EAAE;QACL,YAAY,EAAE,2BAAmB;QACjC,UAAU,EAAE,2BAAQ,CAAC,KAAK,CAAC;YACzB,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAExD,MAAM,WAAW,GAA4B;gBAC3C,IAAI,EAAE,UAAU;aACjB,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,CAAC,IAAc,EACtB,0BAAU,CAAC,IAAI,EACf,eAAe,YAAY,OAAO,EAClC,WAAW,CACZ,CAAC;YAEF,MAAM,cAAc,GAAG,QAAQ,CAAC,gBAAgB,CAAC;YAEjD,IAAI,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC;YAChC,IAAI,OAAO,GAAG,QAAQ,CAAC;YAEvB,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;gBACjC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;gBAE1D,OAAO,GAAG,MAAM,IAAA,oBAAW,EACzB,OAAO,CAAC,IAAc,EACtB,0BAAU,CAAC,GAAG,EACd,mBAAmB,cAAc,EAAE,CACpC,CAAC;gBAEF,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;YAC7B,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getAssistantRun: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
assistant_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
3
|
+
assistant_run_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAssistantRun = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.getAssistantRun = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.griptapeAuth,
|
|
12
|
+
name: 'getAssistantRun',
|
|
13
|
+
displayName: 'Get Assistant Run',
|
|
14
|
+
description: 'Get details of a specific assistant run',
|
|
15
|
+
props: {
|
|
16
|
+
assistant_id: props_1.assistantIdDropdown,
|
|
17
|
+
assistant_run_id: props_1.assistantRunsDropdown,
|
|
18
|
+
},
|
|
19
|
+
run(context) {
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const { assistant_run_id } = context.propsValue;
|
|
22
|
+
const response = yield (0, client_1.makeRequest)(context.auth, pieces_common_1.HttpMethod.GET, `/assistant-runs/${assistant_run_id}`);
|
|
23
|
+
return response;
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=get-assistant-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-assistant-run.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/actions/get-assistant-run.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAyD;AACzD,yCAA8C;AAC9C,6CAA+C;AAC/C,2CAA6E;AAEhE,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACL,YAAY,EAAE,2BAAmB;QACjC,gBAAgB,EAAE,6BAAqB;KACxC;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEhD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,CAAC,IAAc,EACtB,0BAAU,CAAC,GAAG,EACd,mBAAmB,gBAAgB,EAAE,CACtC,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getStructureRun: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
structure_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
3
|
+
structure_run_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
4
|
+
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStructureRun = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const props_1 = require("../common/props");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
10
|
+
exports.getStructureRun = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.griptapeAuth,
|
|
12
|
+
name: 'getStructureRun',
|
|
13
|
+
displayName: 'Get Structure Run',
|
|
14
|
+
description: 'Get details of a specific structure run',
|
|
15
|
+
props: {
|
|
16
|
+
structure_id: props_1.structureIdDropdown,
|
|
17
|
+
structure_run_id: props_1.structureRunsDropdown,
|
|
18
|
+
},
|
|
19
|
+
run(context) {
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const { structure_run_id } = context.propsValue;
|
|
22
|
+
const response = yield (0, client_1.makeRequest)(context.auth, pieces_common_1.HttpMethod.GET, `/structure-runs/${structure_run_id}`);
|
|
23
|
+
return response;
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=get-structure-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-structure-run.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/actions/get-structure-run.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAA8C;AAC9C,2CAA6E;AAC7E,6CAA+C;AAC/C,+DAAyD;AAE5C,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,yCAAyC;IACtD,KAAK,EAAE;QACL,YAAY,EAAE,2BAAmB;QACjC,gBAAgB,EAAE,6BAAqB;KACxC;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEhD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,CAAC,IAAc,EACtB,0BAAU,CAAC,GAAG,EACd,mBAAmB,gBAAgB,EAAE,CACtC,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const griptapeAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.griptapeAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
exports.griptapeAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
+
displayName: 'API Key',
|
|
10
|
+
description: '',
|
|
11
|
+
required: true,
|
|
12
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
13
|
+
try {
|
|
14
|
+
yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/organizations`);
|
|
15
|
+
return {
|
|
16
|
+
valid: true,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return {
|
|
21
|
+
valid: false,
|
|
22
|
+
error: 'Invalid API key. Please check your Griptape Cloud API key.',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA2D;AAC3D,qCAAuC;AAE1B,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,IAAA,oBAAW,EAAC,IAAI,EAAE,0BAAU,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;YAC1D,OAAO;gBACL,KAAK,EAAE,IAAI;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,4DAA4D;aACpE,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASE_URL = void 0;
|
|
4
|
+
exports.makeRequest = makeRequest;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
exports.BASE_URL = `https://cloud.griptape.ai/api`;
|
|
8
|
+
function makeRequest(api_key, method, path, body) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
try {
|
|
11
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
12
|
+
method,
|
|
13
|
+
url: `${exports.BASE_URL}${path}`,
|
|
14
|
+
headers: {
|
|
15
|
+
Authorization: `Bearer ${api_key}`,
|
|
16
|
+
'Content-Type': 'application/json',
|
|
17
|
+
},
|
|
18
|
+
body,
|
|
19
|
+
});
|
|
20
|
+
return response.body;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new Error(`Unexpected error: ${error.message || String(error)}`);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/common/client.ts"],"names":[],"mappings":";;;AAIA,kCAoBC;;AAxBD,+DAAqE;AAExD,QAAA,QAAQ,GAAG,+BAA+B,CAAC;AAExD,SAAsB,WAAW,CAC/B,OAAe,EACf,MAAkB,EAClB,IAAY,EACZ,IAAc;;QAEd,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM;gBACN,GAAG,EAAE,GAAG,gBAAQ,GAAG,IAAI,EAAE;gBACzB,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,EAAE;oBAClC,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const assistantIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
2
|
+
export declare const knowledgeBaseIdsDropdown: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
3
|
+
export declare const rulesetIdsDropdown: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
4
|
+
export declare const structuresIdsDropdown: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
5
|
+
export declare const toolsIdsDropdown: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
6
|
+
export declare const threadIdsDropdown: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false>;
|
|
7
|
+
export declare const structureIdDropdown: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
export declare const assistantRunsDropdown: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
9
|
+
export declare const structureRunsDropdown: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.structureRunsDropdown = exports.assistantRunsDropdown = exports.structureIdDropdown = exports.threadIdsDropdown = exports.toolsIdsDropdown = exports.structuresIdsDropdown = exports.rulesetIdsDropdown = exports.knowledgeBaseIdsDropdown = exports.assistantIdDropdown = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
exports.assistantIdDropdown = pieces_framework_1.Property.Dropdown({
|
|
9
|
+
displayName: 'Assistant',
|
|
10
|
+
description: 'Select the assistant',
|
|
11
|
+
required: true,
|
|
12
|
+
refreshers: [],
|
|
13
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
14
|
+
if (!auth) {
|
|
15
|
+
return {
|
|
16
|
+
disabled: true,
|
|
17
|
+
options: [],
|
|
18
|
+
placeholder: 'Please connect your account first',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, '/assistants');
|
|
23
|
+
return {
|
|
24
|
+
disabled: false,
|
|
25
|
+
options: response.assistants.map((assistant) => ({
|
|
26
|
+
label: assistant.name,
|
|
27
|
+
value: assistant.assistant_id,
|
|
28
|
+
})),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return {
|
|
33
|
+
disabled: true,
|
|
34
|
+
options: [],
|
|
35
|
+
placeholder: 'Could not fetch assistants',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
exports.knowledgeBaseIdsDropdown = pieces_framework_1.Property.MultiSelectDropdown({
|
|
41
|
+
displayName: 'Knowledge Bases',
|
|
42
|
+
description: 'Select knowledge bases to use',
|
|
43
|
+
required: false,
|
|
44
|
+
refreshers: [],
|
|
45
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
46
|
+
if (!auth) {
|
|
47
|
+
return {
|
|
48
|
+
disabled: true,
|
|
49
|
+
options: [],
|
|
50
|
+
placeholder: 'Please connect your account first',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, '/knowledge-bases');
|
|
55
|
+
return {
|
|
56
|
+
disabled: false,
|
|
57
|
+
options: response.knowledge_bases.map((kb) => ({
|
|
58
|
+
label: kb.name,
|
|
59
|
+
value: kb.knowledge_base_id,
|
|
60
|
+
})),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return {
|
|
65
|
+
disabled: true,
|
|
66
|
+
options: [],
|
|
67
|
+
placeholder: 'Could not fetch knowledge bases',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
});
|
|
72
|
+
exports.rulesetIdsDropdown = pieces_framework_1.Property.MultiSelectDropdown({
|
|
73
|
+
displayName: 'Rulesets',
|
|
74
|
+
description: 'Select rulesets to apply',
|
|
75
|
+
required: false,
|
|
76
|
+
refreshers: [],
|
|
77
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
78
|
+
if (!auth) {
|
|
79
|
+
return {
|
|
80
|
+
disabled: true,
|
|
81
|
+
options: [],
|
|
82
|
+
placeholder: 'Please connect your account first',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, '/rulesets');
|
|
87
|
+
return {
|
|
88
|
+
disabled: false,
|
|
89
|
+
options: response.rulesets.map((rs) => ({
|
|
90
|
+
label: rs.name,
|
|
91
|
+
value: rs.ruleset_id,
|
|
92
|
+
})),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return {
|
|
97
|
+
disabled: true,
|
|
98
|
+
options: [],
|
|
99
|
+
placeholder: 'Could not fetch rulesets',
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}),
|
|
103
|
+
});
|
|
104
|
+
exports.structuresIdsDropdown = pieces_framework_1.Property.MultiSelectDropdown({
|
|
105
|
+
displayName: 'Structures',
|
|
106
|
+
description: 'Select structures to use',
|
|
107
|
+
required: false,
|
|
108
|
+
refreshers: [],
|
|
109
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
110
|
+
if (!auth) {
|
|
111
|
+
return {
|
|
112
|
+
disabled: true,
|
|
113
|
+
options: [],
|
|
114
|
+
placeholder: 'Please connect your account first',
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, '/structures');
|
|
119
|
+
return {
|
|
120
|
+
disabled: false,
|
|
121
|
+
options: response.structures.map((structure) => ({
|
|
122
|
+
label: structure.name,
|
|
123
|
+
value: structure.structure_id,
|
|
124
|
+
})),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
return {
|
|
129
|
+
disabled: true,
|
|
130
|
+
options: [],
|
|
131
|
+
placeholder: 'Could not fetch structures',
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}),
|
|
135
|
+
});
|
|
136
|
+
exports.toolsIdsDropdown = pieces_framework_1.Property.MultiSelectDropdown({
|
|
137
|
+
displayName: 'Tools',
|
|
138
|
+
description: 'Select tools to use',
|
|
139
|
+
required: false,
|
|
140
|
+
refreshers: [],
|
|
141
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
142
|
+
if (!auth) {
|
|
143
|
+
return {
|
|
144
|
+
disabled: true,
|
|
145
|
+
options: [],
|
|
146
|
+
placeholder: 'Please connect your account first',
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, '/tools');
|
|
151
|
+
return {
|
|
152
|
+
disabled: false,
|
|
153
|
+
options: response.tools.map((tool) => ({
|
|
154
|
+
label: tool.name,
|
|
155
|
+
value: tool.tool_id,
|
|
156
|
+
})),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
return {
|
|
161
|
+
disabled: true,
|
|
162
|
+
options: [],
|
|
163
|
+
placeholder: 'Could not fetch tools',
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}),
|
|
167
|
+
});
|
|
168
|
+
exports.threadIdsDropdown = pieces_framework_1.Property.MultiSelectDropdown({
|
|
169
|
+
displayName: 'Thread',
|
|
170
|
+
description: 'Select the thread',
|
|
171
|
+
required: false,
|
|
172
|
+
refreshers: [],
|
|
173
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
174
|
+
if (!auth) {
|
|
175
|
+
return {
|
|
176
|
+
disabled: true,
|
|
177
|
+
options: [],
|
|
178
|
+
placeholder: 'Please connect your account first',
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/threads`);
|
|
183
|
+
return {
|
|
184
|
+
disabled: false,
|
|
185
|
+
options: response.threads.map((thread) => ({
|
|
186
|
+
label: thread.name,
|
|
187
|
+
value: thread.thread_id,
|
|
188
|
+
})),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
return {
|
|
193
|
+
disabled: true,
|
|
194
|
+
options: [],
|
|
195
|
+
placeholder: 'Could not fetch threads',
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}),
|
|
199
|
+
});
|
|
200
|
+
exports.structureIdDropdown = pieces_framework_1.Property.Dropdown({
|
|
201
|
+
displayName: 'Structure',
|
|
202
|
+
description: 'Select the structure',
|
|
203
|
+
required: true,
|
|
204
|
+
refreshers: [],
|
|
205
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
206
|
+
if (!auth) {
|
|
207
|
+
return {
|
|
208
|
+
disabled: true,
|
|
209
|
+
options: [],
|
|
210
|
+
placeholder: 'Please connect your account first',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/structures`);
|
|
215
|
+
return {
|
|
216
|
+
disabled: false,
|
|
217
|
+
options: response.structures.map((structure) => ({
|
|
218
|
+
label: structure.name,
|
|
219
|
+
value: structure.structure_id,
|
|
220
|
+
})),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
return {
|
|
225
|
+
disabled: true,
|
|
226
|
+
options: [],
|
|
227
|
+
placeholder: 'Could not fetch structures',
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
}),
|
|
231
|
+
});
|
|
232
|
+
exports.assistantRunsDropdown = pieces_framework_1.Property.Dropdown({
|
|
233
|
+
displayName: 'Assistant Run',
|
|
234
|
+
description: 'Select the assistant run',
|
|
235
|
+
required: true,
|
|
236
|
+
refreshers: ['assistant_id'],
|
|
237
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, assistant_id }) {
|
|
238
|
+
if (!auth) {
|
|
239
|
+
return {
|
|
240
|
+
disabled: true,
|
|
241
|
+
options: [],
|
|
242
|
+
placeholder: 'Please connect your account first',
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
if (!assistant_id) {
|
|
246
|
+
return {
|
|
247
|
+
disabled: true,
|
|
248
|
+
options: [],
|
|
249
|
+
placeholder: 'Please select an assistant first',
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/assistants/${assistant_id}/runs`);
|
|
254
|
+
return {
|
|
255
|
+
disabled: false,
|
|
256
|
+
options: response.assistant_runs.map((run) => ({
|
|
257
|
+
label: `${run.assistant_run_id} - ${run.status}`,
|
|
258
|
+
value: run.assistant_run_id,
|
|
259
|
+
})),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
return {
|
|
264
|
+
disabled: true,
|
|
265
|
+
options: [],
|
|
266
|
+
placeholder: 'Could not fetch assistant runs',
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
}),
|
|
270
|
+
});
|
|
271
|
+
exports.structureRunsDropdown = pieces_framework_1.Property.Dropdown({
|
|
272
|
+
displayName: 'Structure Run',
|
|
273
|
+
description: 'Select the structure run',
|
|
274
|
+
required: true,
|
|
275
|
+
refreshers: ['structure_id'],
|
|
276
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, structure_id }) {
|
|
277
|
+
if (!auth) {
|
|
278
|
+
return {
|
|
279
|
+
disabled: true,
|
|
280
|
+
options: [],
|
|
281
|
+
placeholder: 'Please connect your account first',
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
if (!structure_id) {
|
|
285
|
+
return {
|
|
286
|
+
disabled: true,
|
|
287
|
+
options: [],
|
|
288
|
+
placeholder: 'Please select a structure first',
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/structures/${structure_id}/runs`);
|
|
293
|
+
return {
|
|
294
|
+
disabled: false,
|
|
295
|
+
options: response.runs.map((run) => ({
|
|
296
|
+
label: `${run.structure_run_id} - ${run.status}`,
|
|
297
|
+
value: run.structure_run_id,
|
|
298
|
+
})),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
return {
|
|
303
|
+
disabled: true,
|
|
304
|
+
options: [],
|
|
305
|
+
placeholder: 'Could not fetch structure runs',
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}),
|
|
309
|
+
});
|
|
310
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":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AAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const assistantRunCompletes: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
assistant_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
assistant_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
assistant_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assistantRunCompletes = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const props_1 = require("../common/props");
|
|
11
|
+
const props = {
|
|
12
|
+
assistant_id: props_1.assistantIdDropdown,
|
|
13
|
+
};
|
|
14
|
+
const polling = {
|
|
15
|
+
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
16
|
+
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ propsValue, auth, lastFetchEpochMS }) {
|
|
17
|
+
const { assistant_id } = propsValue;
|
|
18
|
+
try {
|
|
19
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/assistants/${assistant_id}/runs?status=SUCCEEDED,FAILED,ERROR,CANCELLED&page_size=100`);
|
|
20
|
+
const items = response.assistant_runs || [];
|
|
21
|
+
const completedRuns = items.filter((run) => ['SUCCEEDED', 'FAILED', 'ERROR', 'CANCELLED'].includes(run.status) &&
|
|
22
|
+
(0, dayjs_1.default)(run.completed_at || run.updated_at).valueOf() > lastFetchEpochMS);
|
|
23
|
+
return completedRuns.map((run) => ({
|
|
24
|
+
epochMilliSeconds: (0, dayjs_1.default)(run.completed_at || run.updated_at).valueOf(),
|
|
25
|
+
data: run,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching assistant runs:', error);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
exports.assistantRunCompletes = (0, pieces_framework_1.createTrigger)({
|
|
35
|
+
auth: auth_1.griptapeAuth,
|
|
36
|
+
name: 'assistantRunCompletes',
|
|
37
|
+
displayName: 'Assistant Run Completes',
|
|
38
|
+
description: 'Trigger when an assistant run is completed (succeeded, failed, or cancelled)',
|
|
39
|
+
props,
|
|
40
|
+
sampleData: {
|
|
41
|
+
assistant_run_id: 'sample-run-id',
|
|
42
|
+
assistant_id: 'sample-assistant-id',
|
|
43
|
+
status: 'SUCCEEDED',
|
|
44
|
+
output: 'Sample output from assistant run',
|
|
45
|
+
created_at: new Date().toISOString(),
|
|
46
|
+
completed_at: new Date().toISOString(),
|
|
47
|
+
},
|
|
48
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
49
|
+
test(context) {
|
|
50
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return yield pieces_common_1.pollingHelper.test(polling, context);
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
onEnable(context) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const { store, auth, propsValue } = context;
|
|
57
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
onDisable(context) {
|
|
61
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const { store, auth, propsValue } = context;
|
|
63
|
+
yield pieces_common_1.pollingHelper.onDisable(polling, { store, auth, propsValue });
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
run(context) {
|
|
67
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
return yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=assistant-run-completes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-run-completes.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/triggers/assistant-run-completes.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAKqC;AACrC,0DAA0B;AAC1B,yCAA8C;AAC9C,6CAA+C;AAC/C,2CAAsD;AAEtD,MAAM,KAAK,GAAG;IACZ,YAAY,EAAE,2BAAmB;CAClC,CAAC;AAEF,MAAM,OAAO,GAAoD;IAC/D,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE;QAClD,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;QAEpC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAc,EACd,0BAAU,CAAC,GAAG,EACd,eAAe,YAAY,6DAA6D,CACzF,CAAC;YAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,IAAI,EAAE,CAAC;YAE5C,MAAM,aAAa,GAAG,K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AAO;;YACpB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACrE,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACtE,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const assistantRunSucceedes: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
assistant_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
assistant_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
assistant_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assistantRunSucceedes = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const props_1 = require("../common/props");
|
|
11
|
+
const props = {
|
|
12
|
+
assistant_id: props_1.assistantIdDropdown,
|
|
13
|
+
};
|
|
14
|
+
const polling = {
|
|
15
|
+
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
16
|
+
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ propsValue, auth, lastFetchEpochMS }) {
|
|
17
|
+
const { assistant_id } = propsValue;
|
|
18
|
+
try {
|
|
19
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/assistants/${assistant_id}/runs?status=SUCCEEDED&page_size=100`);
|
|
20
|
+
const items = response.assistant_runs || [];
|
|
21
|
+
const succeededRuns = items.filter((run) => run.status === 'SUCCEEDED' &&
|
|
22
|
+
(0, dayjs_1.default)(run.completed_at || run.updated_at).valueOf() > lastFetchEpochMS);
|
|
23
|
+
return succeededRuns.map((run) => ({
|
|
24
|
+
epochMilliSeconds: (0, dayjs_1.default)(run.completed_at || run.updated_at).valueOf(),
|
|
25
|
+
data: run,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching assistant runs:', error);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
exports.assistantRunSucceedes = (0, pieces_framework_1.createTrigger)({
|
|
35
|
+
auth: auth_1.griptapeAuth,
|
|
36
|
+
name: 'assistantRunSucceedes',
|
|
37
|
+
displayName: 'Assistant Run Succeeds',
|
|
38
|
+
description: 'Trigger when an assistant run succeeds',
|
|
39
|
+
props,
|
|
40
|
+
sampleData: {
|
|
41
|
+
assistant_run_id: 'sample-run-id',
|
|
42
|
+
assistant_id: 'sample-assistant-id',
|
|
43
|
+
status: 'SUCCEEDED',
|
|
44
|
+
output: 'Sample output from assistant run',
|
|
45
|
+
created_at: new Date().toISOString(),
|
|
46
|
+
completed_at: new Date().toISOString(),
|
|
47
|
+
},
|
|
48
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
49
|
+
test(context) {
|
|
50
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
return yield pieces_common_1.pollingHelper.test(polling, context);
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
onEnable(context) {
|
|
55
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const { store, auth, propsValue } = context;
|
|
57
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
onDisable(context) {
|
|
61
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const { store, auth, propsValue } = context;
|
|
63
|
+
yield pieces_common_1.pollingHelper.onDisable(polling, { store, auth, propsValue });
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
run(context) {
|
|
67
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
return yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=assistant-run-succeedes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-run-succeedes.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/triggers/assistant-run-succeedes.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,+DAKqC;AACrC,0DAA0B;AAC1B,yCAA8C;AAC9C,6CAA+C;AAC/C,2CAAsD;AAEtD,MAAM,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ACL,UAAU,EAAE;QACV,gBAAgB,EAAE,eAAe;QACjC,YAAY,EAAE,qBAAqB;QACnC,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,kCAAkC;QAC1C,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACvC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACK,QAAQ,CAAC,OAAO;;YACpB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACrE,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACtE,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const structureRunCompletes: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
structure_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
structure_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
structure_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.structureRunCompletes = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
const client_1 = require("../common/client");
|
|
11
|
+
const props = {
|
|
12
|
+
structure_id: props_1.structureIdDropdown,
|
|
13
|
+
};
|
|
14
|
+
const polling = {
|
|
15
|
+
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
16
|
+
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ propsValue, auth, lastFetchEpochMS }) {
|
|
17
|
+
const { structure_id } = propsValue;
|
|
18
|
+
try {
|
|
19
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/structures/${structure_id}/runs?status=SUCCEEDED,FAILED,ERROR,CANCELLED&page_size=100`);
|
|
20
|
+
const items = response.structure_runs || [];
|
|
21
|
+
const completedRuns = items.filter((run) => ['SUCCEEDED', 'FAILED', 'ERROR', 'CANCELLED'].includes(run.status) &&
|
|
22
|
+
(0, dayjs_1.default)(run.completed_at || run.updated_at).valueOf() > lastFetchEpochMS);
|
|
23
|
+
return completedRuns.map((run) => ({
|
|
24
|
+
epochMilliSeconds: (0, dayjs_1.default)(run.completed_at || run.updated_at).valueOf(),
|
|
25
|
+
data: run,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching assistant runs:', error);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
exports.structureRunCompletes = (0, pieces_framework_1.createTrigger)({
|
|
35
|
+
auth: auth_1.griptapeAuth,
|
|
36
|
+
name: 'structureRunCompletes',
|
|
37
|
+
displayName: 'Structure Run Completes',
|
|
38
|
+
description: '',
|
|
39
|
+
props,
|
|
40
|
+
sampleData: {},
|
|
41
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
42
|
+
test(context) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return yield pieces_common_1.pollingHelper.test(polling, context);
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
onEnable(context) {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const { store, auth, propsValue } = context;
|
|
50
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
onDisable(context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const { store, auth, propsValue } = context;
|
|
56
|
+
yield pieces_common_1.pollingHelper.onDisable(polling, { store, auth, propsValue });
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
run(context) {
|
|
60
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=structure-run-completes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure-run-completes.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/triggers/structure-run-completes.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,+DAKqC;AACrC,0DAA0B;AAC1B,2CAAsD;AACtD,yCAA8C;AAC9C,6CAA+C;AAE/C,MAAM,KAAK,GAAG;IACZ,YAAY,EAAE,2BAAmB;CAClC,CAAC;AAEF,MAAM,OAAO,GAAoD;IAC/D,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,UAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE;QAClD,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;QACpC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAc,EACd,0BAAU,CAAC,GAAG,EACd,eAAe,YAAY,6DAA6D,CACzF,CAAC;YAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,IAAI,EAAE,CAAC;YAE5C,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAChC,CAAC,GAAQ,EAAE,EAAE,CACX,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;gBAClE,IAAA,eAAK,EAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,GAAG,gBAAgB,CACzE,CAAC;YAEF,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC;gBACtC,iBAAiB,EAAE,IAAA,eAAK,EAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;gBACtE,IAAI,EAAE,GAAG;aACV,CAAC,CAAC,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACvD,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAA;CACF,CAAC;AAEW,QAAA,qBAAqB,GAAG,IAAA,gCAAa,EAAC;IACjD,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,EAAE;IACf,KAAK;IACL,UAAU,EAAE,EAAE;IACd,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACK,QAAQ,CAAC,OAAO;;YACpB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACrE,CAAC;KAAA;IAEK,SAAS,CAAC,OAAO;;YACrB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;YAC5C,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;QACtE,CAAC;KAAA;IAEK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const structureRunSucceeds: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
structure_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
structure_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
structure_id: import("@activepieces/pieces-framework").DropdownProperty<unknown, true>;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.structureRunSucceeds = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
const auth_1 = require("../common/auth");
|
|
10
|
+
const client_1 = require("../common/client");
|
|
11
|
+
const props = {
|
|
12
|
+
structure_id: props_1.structureIdDropdown,
|
|
13
|
+
};
|
|
14
|
+
const polling = {
|
|
15
|
+
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
16
|
+
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
|
|
17
|
+
const { structure_id } = propsValue;
|
|
18
|
+
try {
|
|
19
|
+
const response = yield (0, client_1.makeRequest)(auth, pieces_common_1.HttpMethod.GET, `/structures/${structure_id}/runs?status=SUCCEEDED&page_size=100`);
|
|
20
|
+
const items = response.structure_runs || [];
|
|
21
|
+
const succeededRuns = items.filter((run) => run.status === 'SUCCEEDED' &&
|
|
22
|
+
(0, dayjs_1.default)(run.completed_at || run.updated_at).valueOf() > lastFetchEpochMS);
|
|
23
|
+
return succeededRuns.map((run) => ({
|
|
24
|
+
epochMilliSeconds: (0, dayjs_1.default)(run.completed_at || run.updated_at).valueOf(),
|
|
25
|
+
data: run,
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error('Error fetching assistant runs:', error);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
exports.structureRunSucceeds = (0, pieces_framework_1.createTrigger)({
|
|
35
|
+
auth: auth_1.griptapeAuth,
|
|
36
|
+
name: 'structureRunSucceeds',
|
|
37
|
+
displayName: 'Structure Run Succeeds',
|
|
38
|
+
description: '',
|
|
39
|
+
props,
|
|
40
|
+
sampleData: {},
|
|
41
|
+
type: pieces_framework_1.TriggerStrategy.POLLING,
|
|
42
|
+
test(context) {
|
|
43
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return yield pieces_common_1.pollingHelper.test(polling, context);
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
onEnable(context) {
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const { store, auth, propsValue } = context;
|
|
50
|
+
yield pieces_common_1.pollingHelper.onEnable(polling, { store, auth, propsValue });
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
onDisable(context) {
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
const { store, auth, propsValue } = context;
|
|
56
|
+
yield pieces_common_1.pollingHelper.onDisable(polling, { store, auth, propsValue });
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
run(context) {
|
|
60
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=structure-run-succeeds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure-run-succeeds.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/griptape/src/lib/triggers/structure-run-succeeds.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,+DAKqC;AACrC,0DAA0B;AAC1B,2CAAsD;AACtD,yCAA8C;AAC9C,6CAA+C;AAE/C,MAAM,KAAK,GAAG;IACZ,YAAY,EAAE,2BAAmB;CAClC,CAAC;AAEF,MAAM,OAAO,GAAoD;IAC/D,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;QAClD,MAAM,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;QAEpC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,IAAc,EACd,0BAAU,CAAC,GAAG,EACd,eAAe,YAAY,sCAAsC,CAClE,CAAC;YAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,IAAI,EAAE,CAAC;YAE5C,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAChC,CAAC,GAAQ,EAAE,EAAE,CACX,GAAG,CAAC,MAAM,KAAK,WAAW;gBAC1B,IAAA,eAAK,EAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,GAAG,gBAAgB,CACzE,CAAC;YAEF,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,CAAC;gBACtC,iBAAiB,EAAE,IAAA,eAAK,EAAC,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;gBACtE,IAAI,EAAE,GAAG;aACV,CAAC,CAAC,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACvD,OAA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