@scopieflows/app-google-search 0.0.1 → 0.0.5
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 +6 -21
- package/src/index.d.ts +5 -9
- package/src/index.d.ts.map +1 -0
- package/src/index.js +5 -48
- package/src/index.js.map +1 -1
- package/src/lib/actions/search.d.ts +7 -6
- package/src/lib/actions/search.d.ts.map +1 -0
- package/src/lib/actions/search.js +4 -4
- package/src/lib/actions/search.js.map +1 -1
- package/src/lib/auth.d.ts +6 -0
- package/src/lib/auth.d.ts.map +1 -0
- package/src/lib/auth.js +60 -0
- package/src/lib/auth.js.map +1 -0
- package/README.md +0 -7
package/package.json
CHANGED
|
@@ -1,28 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scopieflows/app-google-search",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"deepmerge-ts": "7.1.0",
|
|
13
|
-
"form-data": "4.0.4",
|
|
14
|
-
"i18next": "23.13.0",
|
|
15
|
-
"mime-types": "2.1.35",
|
|
16
|
-
"nanoid": "3.3.8",
|
|
17
|
-
"semver": "7.6.0",
|
|
18
|
-
"socket.io-client": "4.8.1",
|
|
19
|
-
"tslib": "^2.3.0",
|
|
20
|
-
"zod": "4.1.13",
|
|
21
|
-
"@scopieflows/pieces-common": "0.11.2",
|
|
22
|
-
"@scopieflows/pieces-framework": "0.25.0",
|
|
23
|
-
"@scopieflows/shared": "0.33.0"
|
|
24
|
-
},
|
|
25
|
-
"resolutions": {
|
|
26
|
-
"rollup": "npm:@rollup/wasm-node"
|
|
8
|
+
"@scopieflows/apps-common": "0.12.3",
|
|
9
|
+
"@scopieflows/apps-framework": "0.28.1",
|
|
10
|
+
"@scopieflows/shared": "0.54.0",
|
|
11
|
+
"tslib": "^2.3.0"
|
|
27
12
|
}
|
|
28
|
-
}
|
|
13
|
+
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
apiKey: import("@scopieflows/
|
|
3
|
-
projectId: import("@scopieflows/
|
|
4
|
-
appId: import("@scopieflows/
|
|
5
|
-
}>;
|
|
6
|
-
export declare const googleSearch: import("@scopieflows/pieces-framework").Piece<import("@scopieflows/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
apiKey: import("@scopieflows/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
projectId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
9
|
-
appId: import("@scopieflows/pieces-framework").ShortTextProperty<true>;
|
|
1
|
+
export declare const googleSearch: import("@scopieflows/apps-framework").Piece<import("@scopieflows/apps-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@scopieflows/apps-framework").SecretTextProperty<true>;
|
|
3
|
+
projectId: import("@scopieflows/apps-framework").ShortTextProperty<true>;
|
|
4
|
+
appId: import("@scopieflows/apps-framework").ShortTextProperty<true>;
|
|
10
5
|
}>>;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,YAAY;;;;GASvB,CAAC"}
|
package/src/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.googleSearch =
|
|
4
|
-
const
|
|
5
|
-
const pieces_framework_1 = require("@scopieflows/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@scopieflows/pieces-common");
|
|
3
|
+
exports.googleSearch = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@scopieflows/apps-framework");
|
|
7
5
|
const search_1 = require("./lib/actions/search");
|
|
6
|
+
const auth_1 = require("./lib/auth");
|
|
8
7
|
const markdownDescription = `
|
|
9
8
|
Follow these steps to obtain your Google Cloud API Key:
|
|
10
9
|
|
|
@@ -16,54 +15,12 @@ Follow these steps to obtain your Google Cloud API Key:
|
|
|
16
15
|
6. Click **Create Credentials** > **API key**.
|
|
17
16
|
7. Copy the API key and paste it below.
|
|
18
17
|
`;
|
|
19
|
-
exports.googleSearchAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
20
|
-
description: markdownDescription,
|
|
21
|
-
required: true,
|
|
22
|
-
props: {
|
|
23
|
-
apiKey: pieces_framework_1.PieceAuth.SecretText({
|
|
24
|
-
displayName: 'API Key',
|
|
25
|
-
description: 'Your Google Cloud API key with Vertex AI Search access.',
|
|
26
|
-
required: true,
|
|
27
|
-
}),
|
|
28
|
-
projectId: pieces_framework_1.Property.ShortText({
|
|
29
|
-
displayName: 'Project ID',
|
|
30
|
-
description: 'Your Google Cloud project ID.',
|
|
31
|
-
required: true,
|
|
32
|
-
}),
|
|
33
|
-
appId: pieces_framework_1.Property.ShortText({
|
|
34
|
-
displayName: 'App ID',
|
|
35
|
-
description: 'The Vertex AI Search app (engine) ID.',
|
|
36
|
-
required: true,
|
|
37
|
-
}),
|
|
38
|
-
},
|
|
39
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
40
|
-
try {
|
|
41
|
-
const { apiKey, projectId, appId } = auth;
|
|
42
|
-
const url = `https://discoveryengine.googleapis.com/v1/projects/${projectId}/locations/global/collections/default_collection/engines/${appId}/servingConfigs/default_search:searchLite?key=${apiKey}`;
|
|
43
|
-
yield pieces_common_1.httpClient.sendRequest({
|
|
44
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
45
|
-
url,
|
|
46
|
-
headers: { 'Content-Type': 'application/json' },
|
|
47
|
-
body: {
|
|
48
|
-
query: 'test',
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
return { valid: true };
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
return {
|
|
55
|
-
valid: false,
|
|
56
|
-
error: `Authentication failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}),
|
|
60
|
-
});
|
|
61
18
|
exports.googleSearch = (0, pieces_framework_1.createPiece)({
|
|
62
19
|
displayName: 'Google Search',
|
|
63
20
|
description: 'Search using Vertex AI Search (Discovery Engine)',
|
|
64
|
-
auth:
|
|
21
|
+
auth: auth_1.googleSearchAuth,
|
|
65
22
|
minimumSupportedRelease: '0.36.1',
|
|
66
|
-
logoUrl: '/pieces/google-search.png',
|
|
23
|
+
logoUrl: 'https://cdn.scopieflows.com/pieces/google-search.png',
|
|
67
24
|
authors: ['onyedikachi-david'],
|
|
68
25
|
actions: [search_1.searchAction],
|
|
69
26
|
triggers: [],
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,oEAAiF;AAEjF,iDAAoD;AACpD,qCAA8C;AAE9C,MAAM,mBAAmB,GAAG;;;;;;;;;;CAU3B,CAAC;AAEW,QAAA,YAAY,GAAG,IAAA,8BAAW,EAAC;IACtC,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,kDAAkD;IAC/D,IAAI,EAAE,uBAAgB;IACtB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,sDAAsD;IAC/D,OAAO,EAAE,CAAC,mBAAmB,CAAC;IAC9B,OAAO,EAAE,CAAC,qBAAY,CAAC;IACvB,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export declare const searchAction: import("@scopieflows/
|
|
2
|
-
apiKey: import("@scopieflows/
|
|
3
|
-
projectId: import("@scopieflows/
|
|
4
|
-
appId: import("@scopieflows/
|
|
1
|
+
export declare const searchAction: import("@scopieflows/apps-framework").IAction<import("@scopieflows/apps-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@scopieflows/apps-framework").SecretTextProperty<true>;
|
|
3
|
+
projectId: import("@scopieflows/apps-framework").ShortTextProperty<true>;
|
|
4
|
+
appId: import("@scopieflows/apps-framework").ShortTextProperty<true>;
|
|
5
5
|
}>, {
|
|
6
|
-
query: import("@scopieflows/
|
|
7
|
-
userPseudoId: import("@scopieflows/
|
|
6
|
+
query: import("@scopieflows/apps-framework").ShortTextProperty<true>;
|
|
7
|
+
userPseudoId: import("@scopieflows/apps-framework").ShortTextProperty<false>;
|
|
8
8
|
}>;
|
|
9
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/search.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;;;;EAuCvB,CAAC"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.searchAction = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@scopieflows/
|
|
6
|
-
const pieces_common_1 = require("@scopieflows/
|
|
7
|
-
const
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/apps-framework");
|
|
6
|
+
const pieces_common_1 = require("@scopieflows/apps-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
8
|
exports.searchAction = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth:
|
|
9
|
+
auth: auth_1.googleSearchAuth,
|
|
10
10
|
name: 'search',
|
|
11
11
|
displayName: 'Search',
|
|
12
12
|
description: 'Search for content using Vertex AI Search (searchLite).',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../src/lib/actions/search.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,8DAAoE;AACpE,kCAA2C;AAE9B,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,uBAAgB;IACtB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,QAAQ;IACrB,WAAW,EAAE,yDAAyD;IACtE,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,gBAAgB;YAC7B,WAAW,EACT,oFAAoF;YACtF,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YAChD,MAAM,GAAG,GAAG,sDAAsD,SAAS,4DAA4D,KAAK,iDAAiD,MAAM,EAAE,CAAC;YAEtM,MAAM,IAAI,GAA4B;gBACpC,KAAK,EAAE,UAAU,CAAC,KAAK;aACxB,CAAC;YAEF,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;gBAC5B,IAAI,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC,YAAY,CAAC;YACjD,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG;gBACH,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,IAAI;aACL,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const googleSearchAuth: import("@scopieflows/apps-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@scopieflows/apps-framework").SecretTextProperty<true>;
|
|
3
|
+
projectId: import("@scopieflows/apps-framework").ShortTextProperty<true>;
|
|
4
|
+
appId: import("@scopieflows/apps-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|
|
6
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB;;;;EAwC3B,CAAC"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.googleSearchAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@scopieflows/apps-framework");
|
|
6
|
+
const pieces_common_1 = require("@scopieflows/apps-common");
|
|
7
|
+
const markdownDescription = `
|
|
8
|
+
Follow these steps to obtain your Google Cloud API Key:
|
|
9
|
+
|
|
10
|
+
1. Go to [Google Cloud Console](https://console.cloud.google.com/).
|
|
11
|
+
2. Create or select a project.
|
|
12
|
+
3. Navigate to **APIs & Services** > **Enabled APIs & services**.
|
|
13
|
+
4. Click **+ ENABLE APIS AND SERVICES** and enable **Vertex AI Search** (Discovery Engine API).
|
|
14
|
+
5. Go to **APIs & Services** > **Credentials**.
|
|
15
|
+
6. Click **Create Credentials** > **API key**.
|
|
16
|
+
7. Copy the API key and paste it below.
|
|
17
|
+
`;
|
|
18
|
+
exports.googleSearchAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
19
|
+
description: markdownDescription,
|
|
20
|
+
required: true,
|
|
21
|
+
props: {
|
|
22
|
+
apiKey: pieces_framework_1.PieceAuth.SecretText({
|
|
23
|
+
displayName: 'API Key',
|
|
24
|
+
description: 'Your Google Cloud API key with Vertex AI Search access.',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
projectId: pieces_framework_1.Property.ShortText({
|
|
28
|
+
displayName: 'Project ID',
|
|
29
|
+
description: 'Your Google Cloud project ID.',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
appId: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'App ID',
|
|
34
|
+
description: 'The Vertex AI Search app (engine) ID.',
|
|
35
|
+
required: true,
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
39
|
+
try {
|
|
40
|
+
const { apiKey, projectId, appId } = auth;
|
|
41
|
+
const url = `https://discoveryengine.googleapis.com/v1/projects/${projectId}/locations/global/collections/default_collection/engines/${appId}/servingConfigs/default_search:searchLite?key=${apiKey}`;
|
|
42
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
43
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
44
|
+
url,
|
|
45
|
+
headers: { 'Content-Type': 'application/json' },
|
|
46
|
+
body: {
|
|
47
|
+
query: 'test',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return { valid: true };
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
valid: false,
|
|
55
|
+
error: `Authentication failed: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,oEAAoE;AACpE,8DAAoE;AAEpE,MA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