@taskmagic/apps-peekshot 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 +3 -0
- package/package.json +47 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +45 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/capture-screenshot.d.ts +10 -0
- package/src/lib/actions/capture-screenshot.js +100 -0
- package/src/lib/actions/capture-screenshot.js.map +1 -0
- package/src/lib/common/auth.d.ts +1 -0
- package/src/lib/common/auth.js +28 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/props.d.ts +1 -0
- package/src/lib/common/props.js +51 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/common/types.d.ts +27 -0
- package/src/lib/common/types.js +3 -0
- package/src/lib/common/types.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taskmagic/apps-peekshot",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@anthropic-ai/sdk": "0.33.1",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.17.0",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"mime-types": "2.1.35",
|
|
11
|
+
"nanoid": "3.3.8",
|
|
12
|
+
"openai": "4.67.1",
|
|
13
|
+
"replicate": "0.34.1",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"zod": "3.25.76",
|
|
16
|
+
"@taskmagic/pieces-common": "0.4.4",
|
|
17
|
+
"@taskmagic/pieces-framework": "0.7.46",
|
|
18
|
+
"@taskmagic/shared": "0.10.171",
|
|
19
|
+
"tslib": "1.14.1"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"cross-spawn": "7.0.6",
|
|
23
|
+
"elliptic": "^6.6.1",
|
|
24
|
+
"fast-xml-parser": "^4.4.1",
|
|
25
|
+
"protobufjs": "^7.5.5",
|
|
26
|
+
"tmp": "^0.2.4",
|
|
27
|
+
"koa": "^2.16.4",
|
|
28
|
+
"picomatch": "^4.0.4",
|
|
29
|
+
"langsmith": "^0.6.0",
|
|
30
|
+
"serialize-javascript": "^6.0.2",
|
|
31
|
+
"elevenlabs": {
|
|
32
|
+
"form-data": "^4.0.4"
|
|
33
|
+
},
|
|
34
|
+
"@tryfabric/martian": {
|
|
35
|
+
"@notionhq/client": "$@notionhq/client"
|
|
36
|
+
},
|
|
37
|
+
"vite": {
|
|
38
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"resolutions": {
|
|
42
|
+
"rollup": "npm:@rollup/wasm-node@^4.61.1"
|
|
43
|
+
},
|
|
44
|
+
"types": "./src/index.d.ts",
|
|
45
|
+
"main": "./src/index.js",
|
|
46
|
+
"type": "commonjs"
|
|
47
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const peekshot: import("@taskmagic/pieces-framework").Piece<import("@taskmagic/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.peekshot = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const shared_1 = require("@taskmagic/shared");
|
|
7
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
8
|
+
const auth_1 = require("./lib/common/auth");
|
|
9
|
+
const capture_screenshot_1 = require("./lib/actions/capture-screenshot");
|
|
10
|
+
exports.peekshot = (0, pieces_framework_1.createPiece)({
|
|
11
|
+
displayName: 'PeekShot',
|
|
12
|
+
auth: auth_1.peekshotAuth,
|
|
13
|
+
minimumSupportedRelease: '0.30.0',
|
|
14
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/peekshot.png',
|
|
15
|
+
categories: [shared_1.PieceCategory.PRODUCTIVITY],
|
|
16
|
+
authors: ['balwant1707'],
|
|
17
|
+
description: 'Capture screenshots of any web page URL with PeekShot: set viewport width/height, choose PNG or JPEG, take full-page shots, and inject custom CSS or JavaScript before rendering.',
|
|
18
|
+
ai: {
|
|
19
|
+
description: 'Render a live web page to an image with PeekShot: capture a screenshot of a URL with optional viewport width/height, PNG/JPEG output, full-page mode, and injected custom CSS/JS.',
|
|
20
|
+
keywords: [
|
|
21
|
+
'screenshot',
|
|
22
|
+
'capture screenshot',
|
|
23
|
+
'web page screenshot',
|
|
24
|
+
'url to image',
|
|
25
|
+
'render web page',
|
|
26
|
+
'full page screenshot',
|
|
27
|
+
'website snapshot',
|
|
28
|
+
'peekshot',
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
actions: [
|
|
32
|
+
capture_screenshot_1.captureScreenshot,
|
|
33
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
34
|
+
auth: auth_1.peekshotAuth,
|
|
35
|
+
baseUrl: () => 'https://api.peekshot.com/api/v1',
|
|
36
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
return {
|
|
38
|
+
'x-api-key': auth,
|
|
39
|
+
};
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
triggers: [],
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/peekshot/src/index.ts"],"names":[],"mappings":";;;;AAAA,kEAA0D;AAC1D,8CAAkD;AAClD,4DAAqE;AACrE,4CAAiD;AACjD,yEAAqE;AAExD,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,mBAAY;IAClB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,WAAW,EACT,mLAAmL;IACrL,EAAE,EAAE;QACF,WAAW,EACT,mLAAmL;QACrL,QAAQ,EAAE;YACR,YAAY;YACZ,oBAAoB;YACpB,qBAAqB;YACrB,cAAc;YACd,iBAAiB;YACjB,sBAAsB;YACtB,kBAAkB;YAClB,UAAU;SACX;KACF;IACD,OAAO,EAAE;QACP,sCAAiB;QACjB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,mBAAY;YAClB,OAAO,EAAE,GAAG,EAAE,CAAC,iCAAiC;YAChD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,WAAW,EAAE,IAAc;iBAC5B,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const captureScreenshot: import("@taskmagic/pieces-framework").IAction<import("@taskmagic/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
projectId: import("@taskmagic/pieces-framework").DropdownProperty<number, true>;
|
|
3
|
+
url: import("@taskmagic/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
width: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
height: import("@taskmagic/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
file_type: import("@taskmagic/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
inject_css: import("@taskmagic/pieces-framework").LongTextProperty<false>;
|
|
8
|
+
inject_js: import("@taskmagic/pieces-framework").LongTextProperty<false>;
|
|
9
|
+
full_page: import("@taskmagic/pieces-framework").CheckboxProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.captureScreenshot = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
exports.captureScreenshot = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.peekshotAuth,
|
|
11
|
+
name: 'captureScreenshot',
|
|
12
|
+
displayName: 'Capture Screenshot',
|
|
13
|
+
description: 'Captures Screenshot of a URL.',
|
|
14
|
+
props: {
|
|
15
|
+
projectId: props_1.projectId,
|
|
16
|
+
url: pieces_framework_1.Property.ShortText({ displayName: 'Target URL', required: true }),
|
|
17
|
+
width: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Custom Screenshot Width',
|
|
19
|
+
required: false,
|
|
20
|
+
}),
|
|
21
|
+
height: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Custom Screenshot Height',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
file_type: pieces_framework_1.Property.StaticDropdown({
|
|
26
|
+
displayName: 'Image Format',
|
|
27
|
+
description: 'Output format for the screenshot.',
|
|
28
|
+
required: false,
|
|
29
|
+
options: {
|
|
30
|
+
disabled: false,
|
|
31
|
+
options: [
|
|
32
|
+
{ label: 'PNG', value: 'png' },
|
|
33
|
+
{ label: 'JPEG', value: 'jpeg' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
inject_css: pieces_framework_1.Property.LongText({
|
|
38
|
+
displayName: 'Custom CSS',
|
|
39
|
+
description: 'Custom CSS to apply.',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
inject_js: pieces_framework_1.Property.LongText({
|
|
43
|
+
displayName: 'Custom JavaScript',
|
|
44
|
+
description: 'Custom JavaScript to apply.',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
full_page: pieces_framework_1.Property.Checkbox({
|
|
48
|
+
displayName: 'Full Page?',
|
|
49
|
+
description: 'To capture the entire page.',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
run(_a) {
|
|
54
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ propsValue, auth }) {
|
|
55
|
+
var _b, _c;
|
|
56
|
+
const { projectId, url, width, height, file_type, full_page, inject_css, inject_js, } = propsValue;
|
|
57
|
+
const res = yield pieces_common_1.httpClient.sendRequest({
|
|
58
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
59
|
+
url: 'https://api.peekshot.com/api/v1/screenshots',
|
|
60
|
+
headers: {
|
|
61
|
+
'x-api-key': auth,
|
|
62
|
+
'Content-Type': 'application/json',
|
|
63
|
+
},
|
|
64
|
+
body: {
|
|
65
|
+
project_id: projectId.toString(),
|
|
66
|
+
url,
|
|
67
|
+
width,
|
|
68
|
+
height,
|
|
69
|
+
inject_css,
|
|
70
|
+
inject_js,
|
|
71
|
+
file_type,
|
|
72
|
+
full_page: full_page ? 'true' : 'false',
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
if (!res.body || !res.body.data || !res.body.data.requestId) {
|
|
76
|
+
throw new Error('Failed to initiate screenshot request');
|
|
77
|
+
}
|
|
78
|
+
const requestId = res.body.data.requestId;
|
|
79
|
+
let status = res.body.status;
|
|
80
|
+
const timeoutAt = Date.now() + 5 * 60 * 1000;
|
|
81
|
+
while (status !== 'COMPLETE' && Date.now() < timeoutAt) {
|
|
82
|
+
yield new Promise((resolve) => setTimeout(resolve, 5000));
|
|
83
|
+
const pollRes = yield pieces_common_1.httpClient.sendRequest({
|
|
84
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
85
|
+
url: `https://api.peekshot.com/api/v1/screenshots/${requestId}`,
|
|
86
|
+
headers: {
|
|
87
|
+
'x-api-key': auth,
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
status = (_c = (_b = pollRes.body) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.status;
|
|
92
|
+
if (status === 'COMPLETE') {
|
|
93
|
+
return pollRes.body;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
throw new Error('Screenshot generation timed out or failed.');
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=capture-screenshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-screenshot.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/peekshot/src/lib/actions/capture-screenshot.ts"],"names":[],"mappings":";;;;AAAA,kEAAqE;AACrE,4DAAkE;AAClE,yCAA8C;AAC9C,2CAA4C;AAM/B,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,+BAA+B;IAC5C,KAAK,EAAE;QACL,SAAS,EAAE,iBAAS;QACpB,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACtE,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,yBAAyB;YACtC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACjC,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,m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ework").SecretTextProperty<true>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.peekshotAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
7
|
+
exports.peekshotAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
8
|
+
displayName: 'API Key',
|
|
9
|
+
required: true,
|
|
10
|
+
description: `You can obtain your API key by navigating to [API Keys](https://dashboard.peekshot.com/dashboard/api-keys) menu.`,
|
|
11
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
12
|
+
try {
|
|
13
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
14
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
15
|
+
url: 'https://api.peekshot.com/api/v1/projects',
|
|
16
|
+
headers: {
|
|
17
|
+
'x-api-key': auth,
|
|
18
|
+
'Content-Type': 'application/json',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return { valid: true };
|
|
22
|
+
}
|
|
23
|
+
catch (_b) {
|
|
24
|
+
return { valid: false, error: 'Invalid API Key.' };
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/peekshot/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,kEAAwD;AACxD,4DAAkE;AAErD,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,kHAAkH;IAC/H,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,0CAA0C;gBAC/C,OAAO,EAAE;oBACP,WAAW,EAAE,IAAc;oBAC3B,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;QACrD,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const projectId: import("@taskmagic/pieces-framework").DropdownProperty<number, true>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.projectId = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@taskmagic/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@taskmagic/pieces-framework");
|
|
7
|
+
exports.projectId = pieces_framework_1.Property.Dropdown({
|
|
8
|
+
displayName: 'Project',
|
|
9
|
+
required: true,
|
|
10
|
+
refreshers: [],
|
|
11
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
12
|
+
var _b;
|
|
13
|
+
if (!auth) {
|
|
14
|
+
return {
|
|
15
|
+
disabled: true,
|
|
16
|
+
placeholder: 'Please connect your account first.',
|
|
17
|
+
options: [],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
22
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
23
|
+
url: 'https://api.peekshot.com/api/v1/projects',
|
|
24
|
+
headers: {
|
|
25
|
+
'x-api-key': auth,
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
const responseData = response.body;
|
|
30
|
+
if ((responseData === null || responseData === void 0 ? void 0 : responseData.status) === 'success' && ((_b = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _b === void 0 ? void 0 : _b.projects)) {
|
|
31
|
+
const projects = responseData.data.projects;
|
|
32
|
+
const projectOptions = projects.map((project) => ({
|
|
33
|
+
label: project.name,
|
|
34
|
+
value: project.id,
|
|
35
|
+
}));
|
|
36
|
+
return {
|
|
37
|
+
options: projectOptions,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
options: [],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return {
|
|
46
|
+
options: [],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/peekshot/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,4DAAkE;AAClE,kEAAuD;AAG1C,QAAA,SAAS,GAAG,2BAAQ,CAAC,QAAQ,CAAC;IACzC,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,EAAE;IACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;;QACtB,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,oCAAoC;gBACjD,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAuB;gBAClE,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,0CAA0C;gBAC/C,OAAO,EAAE;oBACP,WAAW,EAAE,IAAc;oBAC3B,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC,CAAC;YAEH,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;YACnC,IAAI,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,MAAM,MAAK,SAAS,KAAI,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,0CAAE,QAAQ,CAAA,EAAE,CAAC;gBACvE,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAE5C,MAAM,cAAc,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;oBAChD,KAAK,EAAE,OAAO,CAAC,IAAI;oBACnB,KAAK,EAAE,OAAO,CAAC,EAAE;iBAClB,CAAC,CAAC,CAAC;gBAEJ,OAAO;oBACL,OAAO,EAAE,cAAc;iBACxB,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,EAAE;aACZ,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ListProjectsResponse {
|
|
2
|
+
status: string;
|
|
3
|
+
message: string;
|
|
4
|
+
data: {
|
|
5
|
+
projects: Array<{
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface CreateScreenshotResponse {
|
|
12
|
+
status: string;
|
|
13
|
+
message: string;
|
|
14
|
+
data: {
|
|
15
|
+
url: string;
|
|
16
|
+
requestId: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface GetScreenshotResponse {
|
|
20
|
+
status: string;
|
|
21
|
+
message: string;
|
|
22
|
+
data: {
|
|
23
|
+
url: string;
|
|
24
|
+
id: number;
|
|
25
|
+
status: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/peekshot/src/lib/common/types.ts"],"names":[],"mappings":""}
|