@keystrokehq/serpapi 0.0.9 → 0.0.15

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/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
- import { i as createOfficialOperationFactory, n as serpApiBundle, r as serpApiOfficialIntegration, t as serpApi } from "./integration-CLoyNwR6.mjs";
1
+ import { n as serpApiBundle, r as serpApiOfficialIntegration, t as serpApi } from "./integration-bOOYwziK.mjs";
2
2
  import { z } from "zod";
3
3
  import { getAccount, getJson, getJsonBySearchId, getLocations } from "serpapi";
4
+ import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
4
5
 
5
6
  //#region src/client.ts
6
7
  async function serpApiSearch(credentials, engine, params) {
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
3
+ import * as _keystrokehq_core0 from "@keystrokehq/core";
4
+ import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
+
6
+ //#region src/integration.d.ts
7
+ declare const serpApiOfficialIntegration: {
8
+ id: "serpapi";
9
+ name: string;
10
+ description: string;
11
+ credentialType: "manual";
12
+ auth: z.ZodObject<{
13
+ SERPAPI_API_KEY: z.ZodString;
14
+ }, z.core.$strip>;
15
+ proxy: {
16
+ hosts: string[];
17
+ };
18
+ };
19
+ declare const serpApiBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"serpapi", z.ZodObject<{
20
+ SERPAPI_API_KEY: z.ZodString;
21
+ }, z.core.$strip>>;
22
+ declare const serpApi: _keystrokehq_core0.CredentialSet<"keystroke:serpapi", z.ZodObject<{
23
+ SERPAPI_API_KEY: z.ZodString;
24
+ }, z.core.$strip>>;
25
+ type SerpApiCredentials = InferCredentialSetAuth<typeof serpApi>;
26
+ //#endregion
27
+ export { serpApiOfficialIntegration as i, serpApi as n, serpApiBundle as r, SerpApiCredentials as t };
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { defineOfficialIntegration } from "@keystrokehq/integration-authoring/official";
3
+
4
+ //#region src/integration.ts
5
+ const serpApiAuthSchema = z.object({ SERPAPI_API_KEY: z.string().min(1) });
6
+ const serpApiOfficialIntegration = {
7
+ id: "serpapi",
8
+ name: "SerpApi",
9
+ description: "Search engine results from Google, Bing, Yahoo, YouTube, and 90+ other engines",
10
+ credentialType: "manual",
11
+ auth: serpApiAuthSchema,
12
+ proxy: { hosts: ["serpapi.com"] }
13
+ };
14
+ const serpApiBundle = defineOfficialIntegration(serpApiOfficialIntegration);
15
+ const serpApi = serpApiBundle.credentialSet;
16
+
17
+ //#endregion
18
+ export { serpApiBundle as n, serpApiOfficialIntegration as r, serpApi as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keystrokehq/serpapi",
3
- "version": "0.0.9",
3
+ "version": "0.0.15",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -20,21 +20,21 @@
20
20
  "LICENSE"
21
21
  ],
22
22
  "dependencies": {
23
+ "@keystrokehq/integration-authoring": "^0.0.9",
23
24
  "serpapi": "^2.2.1",
24
25
  "zod": "^4.3.6"
25
26
  },
26
27
  "peerDependencies": {
27
- "@keystrokehq/core": ">=0.0.8 <0.1.0"
28
+ "@keystrokehq/core": ">=0.0.13 <0.1.0"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@types/node": "^22.19.11",
31
32
  "tsdown": "^0.20.3",
32
33
  "typescript": "^5.9.3",
33
34
  "vitest": "^4.0.18",
34
- "@keystrokehq/core": "^0.0.12",
35
+ "@keystrokehq/core": "^0.0.13",
35
36
  "@keystrokehq/test-utils": "0.0.0",
36
- "@keystrokehq/typescript-config": "0.0.0",
37
- "@keystrokehq/integration-authoring": "0.0.9"
37
+ "@keystrokehq/typescript-config": "0.0.0"
38
38
  },
39
39
  "keywords": [
40
40
  "serpapi",
@@ -1,39 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
- import { CredentialSet, Operation } from "@keystrokehq/core";
4
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
5
- import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
6
-
7
- //#region ../../packages/integration-authoring/dist/official/index.d.mts
8
- /**
9
- * Creates a factory for Keystroke-official integration operations.
10
- *
11
- * It keeps the same flat `run(input, credentials)` ergonomics as the generic
12
- * operation factory, while registering official metadata for builder/runtime
13
- * operation metadata.
14
- */
15
- declare function createOfficialOperationFactory(credentialSet: any): (config: any) => Operation<any, any, any[], undefined>;
16
- //#endregion
17
- //#region src/integration.d.ts
18
- declare const serpApiOfficialIntegration: {
19
- id: "serpapi";
20
- name: string;
21
- description: string;
22
- auth: z.ZodObject<{
23
- SERPAPI_API_KEY: z.ZodString;
24
- }, z.core.$strip>;
25
- proxy: {
26
- hosts: string[];
27
- };
28
- };
29
- declare const serpApiBundle: undefined<"serpapi", z.ZodObject<{
30
- SERPAPI_API_KEY: z.ZodString;
31
- }, z.core.$strip>>;
32
- declare const serpApi: _keystrokehq_core0.CredentialSet<"serpapi", z.ZodObject<{
33
- SERPAPI_API_KEY: z.ZodString;
34
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
35
- SERPAPI_API_KEY: z.ZodString;
36
- }, z.core.$strip>>[] | undefined>;
37
- type SerpApiCredentials = InferCredentialSetAuth<typeof serpApi>;
38
- //#endregion
39
- export { createOfficialOperationFactory as a, serpApiOfficialIntegration as i, serpApi as n, serpApiBundle as r, SerpApiCredentials as t };
@@ -1,107 +0,0 @@
1
- import { z } from "zod";
2
- import { CredentialSet, Operation } from "@keystrokehq/core";
3
-
4
- //#region ../../packages/integration-authoring/dist/official/runtime.mjs
5
- const REGISTRY_KEY = "__ks_official_integration_metadata_registry";
6
- function getRegistry() {
7
- const globalStore = globalThis;
8
- if (!globalStore[REGISTRY_KEY]) globalStore[REGISTRY_KEY] = /* @__PURE__ */ new WeakMap();
9
- return globalStore[REGISTRY_KEY];
10
- }
11
- function registerOfficialOperation(operation, metadata) {
12
- getRegistry().set(operation, Object.freeze({ ...metadata }));
13
- }
14
-
15
- //#endregion
16
- //#region ../../packages/integration-authoring/dist/official/index.mjs
17
- const OFFICIAL_CREDENTIAL_SET_ID_PREFIX = "keystroke:";
18
- function stripOfficialCredentialSetIdPrefix(id) {
19
- return id.startsWith(OFFICIAL_CREDENTIAL_SET_ID_PREFIX) ? id.slice(10) : id;
20
- }
21
- /**
22
- * Creates a factory for Keystroke-official integration operations.
23
- *
24
- * It keeps the same flat `run(input, credentials)` ergonomics as the generic
25
- * operation factory, while registering official metadata for builder/runtime
26
- * operation metadata.
27
- */
28
- function createOfficialOperationFactory(credentialSet) {
29
- const integrationId = stripOfficialCredentialSetIdPrefix(credentialSet.id);
30
- return (config) => {
31
- const wrappedRun = async (input, ctx) => {
32
- const creds = ctx.credentials[credentialSet.id];
33
- return config.run(input, creds);
34
- };
35
- const operation = new Operation({
36
- id: config.id,
37
- name: config.name,
38
- description: config.description,
39
- input: config.input,
40
- output: config.output,
41
- credentialSets: [credentialSet],
42
- ...config.tags !== void 0 ? { tags: config.tags } : {},
43
- ...config.needsApproval !== void 0 ? { needsApproval: config.needsApproval } : {},
44
- ...config.requiredOAuthScopes !== void 0 ? { requiredOAuthScopes: config.requiredOAuthScopes } : {},
45
- ...config.retries !== void 0 ? { retries: config.retries } : {},
46
- ...config.timeout !== void 0 ? { timeout: config.timeout } : {},
47
- ...config.maxDurationMs !== void 0 ? { maxDurationMs: config.maxDurationMs } : {},
48
- run: wrappedRun
49
- });
50
- registerOfficialOperation(operation, { integrationId });
51
- return operation;
52
- };
53
- }
54
- /**
55
- * Creates an official integration bundle from a single config object.
56
- *
57
- * - Creates the public `CredentialSet` internally.
58
- * - Accepts optional `internal` fields for Keystroke-owned platform credentials.
59
- */
60
- function defineOfficialIntegration(config) {
61
- const internalCredentialSets = config.internal ?? {};
62
- const allInternalCredentialSets = [
63
- ...internalCredentialSets.providerApp ? [internalCredentialSets.providerApp] : [],
64
- ...internalCredentialSets.providerAppVariants ?? [],
65
- ...internalCredentialSets.webhookVerification ? [internalCredentialSets.webhookVerification] : [],
66
- ...internalCredentialSets.other ?? []
67
- ];
68
- const credentialSet = new CredentialSet({
69
- id: config.id,
70
- name: config.name,
71
- description: config.description,
72
- auth: config.auth,
73
- ...config.connections ? { connections: config.connections } : {},
74
- ...config.proxy ? { proxy: config.proxy } : {},
75
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {}
76
- });
77
- return Object.freeze({
78
- integration: {
79
- id: config.id,
80
- name: config.name,
81
- ...config.description !== void 0 ? { description: config.description } : {},
82
- auth: config.auth,
83
- ...config.proxy ? { proxy: config.proxy } : {},
84
- ...config.needsRawSecret === true ? { needsRawSecret: true } : {},
85
- ...config.connections ? { connections: config.connections } : {}
86
- },
87
- credentialSet,
88
- internalCredentialSets,
89
- allInternalCredentialSets
90
- });
91
- }
92
-
93
- //#endregion
94
- //#region src/integration.ts
95
- const serpApiAuthSchema = z.object({ SERPAPI_API_KEY: z.string().min(1) });
96
- const serpApiOfficialIntegration = {
97
- id: "serpapi",
98
- name: "SerpApi",
99
- description: "Search engine results from Google, Bing, Yahoo, YouTube, and 90+ other engines",
100
- auth: serpApiAuthSchema,
101
- proxy: { hosts: ["serpapi.com"] }
102
- };
103
- const serpApiBundle = defineOfficialIntegration(serpApiOfficialIntegration);
104
- const serpApi = serpApiBundle.credentialSet;
105
-
106
- //#endregion
107
- export { createOfficialOperationFactory as i, serpApiBundle as n, serpApiOfficialIntegration as r, serpApi as t };