@superblocksteam/sdk-api 2.0.105 → 2.0.106-next.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 +439 -89
- package/dist/api/definition.d.ts +11 -6
- package/dist/api/definition.d.ts.map +1 -1
- package/dist/api/definition.js +19 -12
- package/dist/api/definition.js.map +1 -1
- package/dist/api/definition.test.js +39 -15
- package/dist/api/definition.test.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/integrations/base/index.d.ts +2 -1
- package/dist/integrations/base/index.d.ts.map +1 -1
- package/dist/integrations/base/index.js +1 -0
- package/dist/integrations/base/index.js.map +1 -1
- package/dist/integrations/base/rest-api-client-base.d.ts +48 -0
- package/dist/integrations/base/rest-api-client-base.d.ts.map +1 -0
- package/dist/integrations/base/rest-api-client-base.js +98 -0
- package/dist/integrations/base/rest-api-client-base.js.map +1 -0
- package/dist/integrations/base/rest-api-integration-client.d.ts +10 -20
- package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
- package/dist/integrations/base/rest-api-integration-client.js +10 -65
- package/dist/integrations/base/rest-api-integration-client.js.map +1 -1
- package/dist/integrations/box/types.d.ts +1 -1
- package/dist/integrations/declarations.d.ts +5 -73
- package/dist/integrations/declarations.d.ts.map +1 -1
- package/dist/integrations/declarations.js +5 -68
- package/dist/integrations/declarations.js.map +1 -1
- package/dist/integrations/documentation.test.js +0 -2
- package/dist/integrations/documentation.test.js.map +1 -1
- package/dist/integrations/googledrive/types.d.ts +1 -1
- package/dist/integrations/index.d.ts +1 -11
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +1 -7
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/registry.d.ts +1 -11
- package/dist/integrations/registry.d.ts.map +1 -1
- package/dist/integrations/registry.js +0 -29
- package/dist/integrations/registry.js.map +1 -1
- package/dist/integrations/slack/client.d.ts +13 -9
- package/dist/integrations/slack/client.d.ts.map +1 -1
- package/dist/integrations/slack/client.js +60 -8
- package/dist/integrations/slack/client.js.map +1 -1
- package/dist/integrations/slack/client.test.d.ts +11 -0
- package/dist/integrations/slack/client.test.d.ts.map +1 -0
- package/dist/integrations/slack/client.test.js +368 -0
- package/dist/integrations/slack/client.test.js.map +1 -0
- package/dist/integrations/slack/index.d.ts +2 -1
- package/dist/integrations/slack/index.d.ts.map +1 -1
- package/dist/integrations/slack/index.js +1 -0
- package/dist/integrations/slack/index.js.map +1 -1
- package/dist/integrations/slack/types.d.ts +127 -28
- package/dist/integrations/slack/types.d.ts.map +1 -1
- package/dist/integrations/slack/types.js +27 -1
- package/dist/integrations/slack/types.js.map +1 -1
- package/dist/integrations/snowflake/client.d.ts +2 -2
- package/dist/integrations/snowflake/client.js +2 -2
- package/dist/runtime/context.d.ts +1 -1
- package/dist/runtime/executor.d.ts +2 -2
- package/dist/types.d.ts +15 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/api/definition.test.ts +40 -15
- package/src/api/definition.ts +19 -12
- package/src/errors.ts +1 -1
- package/src/index.ts +13 -33
- package/src/integrations/asana/README.md +12 -12
- package/src/integrations/base/index.ts +2 -1
- package/src/integrations/base/rest-api-client-base.ts +134 -0
- package/src/integrations/base/rest-api-integration-client.ts +12 -89
- package/src/integrations/bitbucket/README.md +19 -19
- package/src/integrations/box/README.md +24 -24
- package/src/integrations/box/types.ts +1 -1
- package/src/integrations/circleci/README.md +18 -18
- package/src/integrations/declarations.ts +5 -105
- package/src/integrations/documentation.test.ts +0 -2
- package/src/integrations/googledrive/README.md +25 -22
- package/src/integrations/googledrive/types.ts +1 -1
- package/src/integrations/graphql/README.md +2 -2
- package/src/integrations/groq/README.md +8 -8
- package/src/integrations/index.ts +0 -51
- package/src/integrations/mongodb/README.md +65 -12
- package/src/integrations/perplexity/README.md +39 -48
- package/src/integrations/registry.ts +1 -39
- package/src/integrations/salesforce/README.md +11 -9
- package/src/integrations/slack/README.md +62 -19
- package/src/integrations/slack/client.test.ts +553 -0
- package/src/integrations/slack/client.ts +92 -12
- package/src/integrations/slack/index.ts +6 -1
- package/src/integrations/slack/types.ts +142 -29
- package/src/integrations/snowflake/client.ts +2 -2
- package/src/integrations/zoom/README.md +15 -15
- package/src/runtime/context.ts +1 -1
- package/src/runtime/executor.ts +2 -2
- package/src/types.ts +15 -6
- package/dist/integrations/couchbase/client.d.ts +0 -36
- package/dist/integrations/couchbase/client.d.ts.map +0 -1
- package/dist/integrations/couchbase/client.js +0 -148
- package/dist/integrations/couchbase/client.js.map +0 -1
- package/dist/integrations/couchbase/index.d.ts +0 -8
- package/dist/integrations/couchbase/index.d.ts.map +0 -1
- package/dist/integrations/couchbase/index.js +0 -7
- package/dist/integrations/couchbase/index.js.map +0 -1
- package/dist/integrations/couchbase/types.d.ts +0 -100
- package/dist/integrations/couchbase/types.d.ts.map +0 -1
- package/dist/integrations/couchbase/types.js +0 -5
- package/dist/integrations/couchbase/types.js.map +0 -1
- package/dist/integrations/kafka/client.d.ts +0 -25
- package/dist/integrations/kafka/client.d.ts.map +0 -1
- package/dist/integrations/kafka/client.js +0 -124
- package/dist/integrations/kafka/client.js.map +0 -1
- package/dist/integrations/kafka/index.d.ts +0 -8
- package/dist/integrations/kafka/index.d.ts.map +0 -1
- package/dist/integrations/kafka/index.js +0 -7
- package/dist/integrations/kafka/index.js.map +0 -1
- package/dist/integrations/kafka/types.d.ts +0 -113
- package/dist/integrations/kafka/types.d.ts.map +0 -1
- package/dist/integrations/kafka/types.js +0 -5
- package/dist/integrations/kafka/types.js.map +0 -1
- package/dist/integrations/kinesis/client.d.ts +0 -31
- package/dist/integrations/kinesis/client.d.ts.map +0 -1
- package/dist/integrations/kinesis/client.js +0 -101
- package/dist/integrations/kinesis/client.js.map +0 -1
- package/dist/integrations/kinesis/index.d.ts +0 -8
- package/dist/integrations/kinesis/index.d.ts.map +0 -1
- package/dist/integrations/kinesis/index.js +0 -7
- package/dist/integrations/kinesis/index.js.map +0 -1
- package/dist/integrations/kinesis/types.d.ts +0 -97
- package/dist/integrations/kinesis/types.d.ts.map +0 -1
- package/dist/integrations/kinesis/types.js +0 -7
- package/dist/integrations/kinesis/types.js.map +0 -1
- package/dist/integrations/python/client.d.ts +0 -42
- package/dist/integrations/python/client.d.ts.map +0 -1
- package/dist/integrations/python/client.js +0 -89
- package/dist/integrations/python/client.js.map +0 -1
- package/dist/integrations/python/client.test.d.ts +0 -5
- package/dist/integrations/python/client.test.d.ts.map +0 -1
- package/dist/integrations/python/client.test.js +0 -214
- package/dist/integrations/python/client.test.js.map +0 -1
- package/dist/integrations/python/index.d.ts +0 -6
- package/dist/integrations/python/index.d.ts.map +0 -1
- package/dist/integrations/python/index.js +0 -5
- package/dist/integrations/python/index.js.map +0 -1
- package/dist/integrations/python/types.d.ts +0 -85
- package/dist/integrations/python/types.d.ts.map +0 -1
- package/dist/integrations/python/types.js +0 -5
- package/dist/integrations/python/types.js.map +0 -1
- package/dist/integrations/redis/client.d.ts +0 -43
- package/dist/integrations/redis/client.d.ts.map +0 -1
- package/dist/integrations/redis/client.js +0 -142
- package/dist/integrations/redis/client.js.map +0 -1
- package/dist/integrations/redis/index.d.ts +0 -8
- package/dist/integrations/redis/index.d.ts.map +0 -1
- package/dist/integrations/redis/index.js +0 -7
- package/dist/integrations/redis/index.js.map +0 -1
- package/dist/integrations/redis/types.d.ts +0 -137
- package/dist/integrations/redis/types.d.ts.map +0 -1
- package/dist/integrations/redis/types.js +0 -5
- package/dist/integrations/redis/types.js.map +0 -1
- package/src/integrations/couchbase/README.md +0 -138
- package/src/integrations/couchbase/client.ts +0 -225
- package/src/integrations/couchbase/index.ts +0 -8
- package/src/integrations/couchbase/types.ts +0 -126
- package/src/integrations/kafka/README.md +0 -144
- package/src/integrations/kafka/client.ts +0 -216
- package/src/integrations/kafka/index.ts +0 -14
- package/src/integrations/kafka/types.ts +0 -128
- package/src/integrations/kinesis/README.md +0 -153
- package/src/integrations/kinesis/client.ts +0 -146
- package/src/integrations/kinesis/index.ts +0 -14
- package/src/integrations/kinesis/types.ts +0 -114
- package/src/integrations/python/README.md +0 -566
- package/src/integrations/python/client.test.ts +0 -341
- package/src/integrations/python/client.ts +0 -136
- package/src/integrations/python/index.ts +0 -6
- package/src/integrations/python/types.ts +0 -92
- package/src/integrations/redis/README.md +0 -200
- package/src/integrations/redis/client.ts +0 -208
- package/src/integrations/redis/index.ts +0 -8
- package/src/integrations/redis/types.ts +0 -167
package/dist/api/definition.d.ts
CHANGED
|
@@ -39,9 +39,14 @@ export type ExtractApiInput<T> = T extends CompiledApi<infer TInput, any> ? TInp
|
|
|
39
39
|
export type ExtractApiOutput<T> = T extends CompiledApi<any, infer TOutput> ? TOutput : never;
|
|
40
40
|
import { type IntegrationDeclaration } from "../integrations/declarations.js";
|
|
41
41
|
import type { ApiConfig, ApiContext, AnyIntegrationRef } from "../types.js";
|
|
42
|
-
/** Called by the Vite plugin to set the entry point for
|
|
42
|
+
/** Called by the Vite plugin to set the entry point for api() calls in this file. */
|
|
43
43
|
export declare function __setEntryPoint(entryPoint: string): void;
|
|
44
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Returns the current pending entry point without clearing it.
|
|
46
|
+
* This allows multiple api() calls within the same file to share the same
|
|
47
|
+
* entry point (e.g. named exports from a single module).
|
|
48
|
+
*/
|
|
49
|
+
export declare function getEntryPoint(): string | undefined;
|
|
45
50
|
/**
|
|
46
51
|
* A compiled API definition ready for execution.
|
|
47
52
|
*
|
|
@@ -134,10 +139,10 @@ export interface CompiledApi<TInput = unknown, TOutput = unknown> {
|
|
|
134
139
|
* throw new Error('User not found');
|
|
135
140
|
* }
|
|
136
141
|
*
|
|
137
|
-
* await ctx.integrations.notifier.
|
|
138
|
-
* channel: '#user-lookups',
|
|
139
|
-
*
|
|
140
|
-
*
|
|
142
|
+
* await ctx.integrations.notifier.apiRequest(
|
|
143
|
+
* { method: 'POST', path: '/chat.postMessage', body: { channel: '#user-lookups', text: `Fetched user ${user.name}` } },
|
|
144
|
+
* { response: z.object({ ok: z.boolean() }) }
|
|
145
|
+
* );
|
|
141
146
|
*
|
|
142
147
|
* return { user };
|
|
143
148
|
* },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/api/definition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAE3B,CAAC,SAAS,WAAW,CAAC,MAAM,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAE5B,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,MAAM,OAAO,CAAC,GAAG,OAAO,GAAG,KAAK,CAAC;AAC9D,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/api/definition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAE3B,CAAC,SAAS,WAAW,CAAC,MAAM,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,GAAG,KAAK,CAAC;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAE5B,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,MAAM,OA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B,aAAa,SAAS,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,MAAM,CAC9D,MAAM,EACN,KAAK,CACN,EAED,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,GAChD,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAkBhD"}
|
package/dist/api/definition.js
CHANGED
|
@@ -7,18 +7,25 @@
|
|
|
7
7
|
import { extractIntegrationDeclarations, } from "../integrations/declarations.js";
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
// Entry point setter — used by the Vite plugin to stamp the source file path
|
|
10
|
-
// onto
|
|
11
|
-
// synchronous, so the prepended __setEntryPoint() always runs before
|
|
10
|
+
// onto every api()/streamingApi() call in a module. ESM top-level execution
|
|
11
|
+
// is synchronous, so the prepended __setEntryPoint() always runs before any
|
|
12
|
+
// api() call in the same file. The value is intentionally NOT cleared after
|
|
13
|
+
// the first read so that multiple named-exported api() calls in a single file
|
|
14
|
+
// all receive the same entry point. The next file's __setEntryPoint() call
|
|
15
|
+
// naturally overwrites the value.
|
|
12
16
|
// ---------------------------------------------------------------------------
|
|
13
17
|
let __pendingEntryPoint;
|
|
14
|
-
/** Called by the Vite plugin to set the entry point for
|
|
18
|
+
/** Called by the Vite plugin to set the entry point for api() calls in this file. */
|
|
15
19
|
export function __setEntryPoint(entryPoint) {
|
|
16
20
|
__pendingEntryPoint = entryPoint;
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Returns the current pending entry point without clearing it.
|
|
24
|
+
* This allows multiple api() calls within the same file to share the same
|
|
25
|
+
* entry point (e.g. named exports from a single module).
|
|
26
|
+
*/
|
|
27
|
+
export function getEntryPoint() {
|
|
28
|
+
return __pendingEntryPoint;
|
|
22
29
|
}
|
|
23
30
|
/**
|
|
24
31
|
* Define a TypeScript-based API with input/output validation.
|
|
@@ -64,10 +71,10 @@ export function consumeEntryPoint() {
|
|
|
64
71
|
* throw new Error('User not found');
|
|
65
72
|
* }
|
|
66
73
|
*
|
|
67
|
-
* await ctx.integrations.notifier.
|
|
68
|
-
* channel: '#user-lookups',
|
|
69
|
-
*
|
|
70
|
-
*
|
|
74
|
+
* await ctx.integrations.notifier.apiRequest(
|
|
75
|
+
* { method: 'POST', path: '/chat.postMessage', body: { channel: '#user-lookups', text: `Fetched user ${user.name}` } },
|
|
76
|
+
* { response: z.object({ ok: z.boolean() }) }
|
|
77
|
+
* );
|
|
71
78
|
*
|
|
72
79
|
* return { user };
|
|
73
80
|
* },
|
|
@@ -80,7 +87,7 @@ export function api(config) {
|
|
|
80
87
|
const compiled = {
|
|
81
88
|
name: config.name,
|
|
82
89
|
description: config.description,
|
|
83
|
-
entryPoint:
|
|
90
|
+
entryPoint: getEntryPoint(),
|
|
84
91
|
inputSchema: config.input,
|
|
85
92
|
outputSchema: config.output,
|
|
86
93
|
run: config.run,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/api/definition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyCH,OAAO,EACL,8BAA8B,GAE/B,MAAM,iCAAiC,CAAC;AAGzC,8EAA8E;AAC9E,6EAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/api/definition.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyCH,OAAO,EACL,8BAA8B,GAE/B,MAAM,iCAAiC,CAAC;AAGzC,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAC9E,4EAA4E;AAC5E,kCAAkC;AAClC,8EAA8E;AAE9E,IAAI,mBAAuC,CAAC;AAE5C,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,mBAAmB,GAAG,UAAU,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AA2DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,UAAU,GAAG,CAQjB,MAAiD;IAEjD,oDAAoD;IACpD,MAAM,YAAY,GAAG,8BAA8B,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEzE,MAAM,QAAQ,GAAmD;QAC/D,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,UAAU,EAAE,aAAa,EAAE;QAC3B,WAAW,EAAE,MAAM,CAAC,KAAK;QACzB,YAAY,EAAE,MAAM,CAAC,MAAM;QAC3B,GAAG,EAAE,MAAM,CAAC,GAGkB;QAC9B,YAAY;KACb,CAAC;IAEF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
5
|
import { describe, it, expect, expectTypeOf } from "vitest";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
import { api, __setEntryPoint,
|
|
7
|
+
import { api, __setEntryPoint, } from "./definition.js";
|
|
8
8
|
describe("ExtractApiInput", () => {
|
|
9
9
|
it("extracts input type from simple API", () => {
|
|
10
10
|
const _SimpleApi = api({
|
|
@@ -231,33 +231,57 @@ describe("entryPoint mechanism", () => {
|
|
|
231
231
|
});
|
|
232
232
|
expect(compiled.entryPoint).toBe("server/apis/GetUsers/api.ts");
|
|
233
233
|
});
|
|
234
|
-
it("
|
|
235
|
-
__setEntryPoint("server/apis/
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
234
|
+
it("entryPoint persists across multiple api() calls from the same file", () => {
|
|
235
|
+
__setEntryPoint("server/apis/slack/helper.ts");
|
|
236
|
+
const dashboard = api({
|
|
237
|
+
name: "SlackDashboard",
|
|
238
|
+
input: z.object({}),
|
|
239
|
+
output: z.object({}),
|
|
240
|
+
async run() {
|
|
241
|
+
return {};
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
const search = api({
|
|
245
|
+
name: "SlackSearch",
|
|
246
|
+
input: z.object({}),
|
|
247
|
+
output: z.object({}),
|
|
248
|
+
async run() {
|
|
249
|
+
return {};
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
const postMessage = api({
|
|
253
|
+
name: "SlackPostMessage",
|
|
254
|
+
input: z.object({}),
|
|
255
|
+
output: z.object({}),
|
|
256
|
+
async run() {
|
|
257
|
+
return {};
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
expect(dashboard.entryPoint).toBe("server/apis/slack/helper.ts");
|
|
261
|
+
expect(search.entryPoint).toBe("server/apis/slack/helper.ts");
|
|
262
|
+
expect(postMessage.entryPoint).toBe("server/apis/slack/helper.ts");
|
|
240
263
|
});
|
|
241
|
-
it("
|
|
242
|
-
__setEntryPoint("server/apis/
|
|
243
|
-
const
|
|
244
|
-
name: "
|
|
264
|
+
it("new __setEntryPoint overwrites previous value for a different file", () => {
|
|
265
|
+
__setEntryPoint("server/apis/slack/helper.ts");
|
|
266
|
+
const slackApi = api({
|
|
267
|
+
name: "SlackDashboard",
|
|
245
268
|
input: z.object({}),
|
|
246
269
|
output: z.object({}),
|
|
247
270
|
async run() {
|
|
248
271
|
return {};
|
|
249
272
|
},
|
|
250
273
|
});
|
|
251
|
-
|
|
252
|
-
|
|
274
|
+
__setEntryPoint("server/apis/users/api.ts");
|
|
275
|
+
const usersApi = api({
|
|
276
|
+
name: "GetUsers",
|
|
253
277
|
input: z.object({}),
|
|
254
278
|
output: z.object({}),
|
|
255
279
|
async run() {
|
|
256
280
|
return {};
|
|
257
281
|
},
|
|
258
282
|
});
|
|
259
|
-
expect(
|
|
260
|
-
expect(
|
|
283
|
+
expect(slackApi.entryPoint).toBe("server/apis/slack/helper.ts");
|
|
284
|
+
expect(usersApi.entryPoint).toBe("server/apis/users/api.ts");
|
|
261
285
|
});
|
|
262
286
|
});
|
|
263
287
|
//# sourceMappingURL=definition.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.test.js","sourceRoot":"","sources":["../../src/api/definition.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,sDAAsD;AACtD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,GAAG,EACH,eAAe,
|
|
1
|
+
{"version":3,"file":"definition.test.js","sourceRoot":"","sources":["../../src/api/definition.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,sDAAsD;AACtD,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,GAAG,EACH,eAAe,GAIhB,MAAM,iBAAiB,CAAC;AAEzB,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,UAAU,GAAG,GAAG,CAAC;YACrB,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;gBACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;gBAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;aAChB,CAAC;YACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;aACpB,CAAC;YACF,KAAK,CAAC,GAAG;gBACP,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;YAC9B,CAAC;SACF,CAAC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;YACnB,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YACpB,KAAK,CAAC,GAAG;gBACP,OAAO,EAAE,CAAC;YACZ,CAAC;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAChE,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare class QueryValidationError extends Error {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Error thrown when
|
|
56
|
+
* Error thrown when code execution fails.
|
|
57
57
|
*
|
|
58
58
|
* Contains context about the code, bindings, and any validation errors
|
|
59
59
|
* that occurred during execution.
|
package/dist/errors.js
CHANGED
|
@@ -34,7 +34,7 @@ export class QueryValidationError extends Error {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
|
-
* Error thrown when
|
|
37
|
+
* Error thrown when code execution fails.
|
|
38
38
|
*
|
|
39
39
|
* Contains context about the code, bindings, and any validation errors
|
|
40
40
|
* that occurred during execution.
|
package/dist/index.d.ts
CHANGED
|
@@ -38,10 +38,14 @@
|
|
|
38
38
|
* throw new Error('User not found');
|
|
39
39
|
* }
|
|
40
40
|
*
|
|
41
|
-
* await ctx.integrations.notifier.
|
|
42
|
-
* channel: '#user-lookups',
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
* const notifyResult = await ctx.integrations.notifier.apiRequest(
|
|
42
|
+
* { method: 'POST', path: '/chat.postMessage', body: { channel: '#user-lookups', text: `Fetched user ${user.name}` } },
|
|
43
|
+
* { response: z.object({ channel: z.string(), ts: z.string() }) }
|
|
44
|
+
* );
|
|
45
|
+
*
|
|
46
|
+
* if (!notifyResult.ok) {
|
|
47
|
+
* throw new Error(`Slack API error: ${notifyResult.error}`);
|
|
48
|
+
* }
|
|
45
49
|
*
|
|
46
50
|
* return { user };
|
|
47
51
|
* },
|
|
@@ -56,9 +60,9 @@ export type { FileRef, ReadableFile } from "./files.js";
|
|
|
56
60
|
export { api, __setEntryPoint, type CompiledApi } from "./api/index.js";
|
|
57
61
|
export type { ExtractApiInput, ExtractApiOutput } from "./api/definition.js";
|
|
58
62
|
export type { ApiConfig, ApiContext, ApiUser, Logger, BaseIntegrationClient, IntegrationRef, AnyIntegrationRef, IntegrationsMap, } from "./types.js";
|
|
59
|
-
export { postgres, slack, openai, anthropic, stripe, github, notion, snowflake, snowflakeCortex, airtable, asana, bitbucket, box, circleci, cohere, confluence, datadog, dropbox, elasticsearch, fireworks, front, gemini, googleAnalytics, googleDrive, groq, hubspot, intercom, jira, launchDarkly, mistral, pagerDuty, perplexity, segment, sendGrid, stabilityAI, twilio, zendesk, zoom, graphql, mysql, mariadb, mssql, cockroachdb, oracledb, redshift, athena, databricks, bigquery, mongodb, dynamodb, cosmosdb,
|
|
63
|
+
export { postgres, slack, openai, anthropic, stripe, github, notion, snowflake, snowflakeCortex, airtable, asana, bitbucket, box, circleci, cohere, confluence, datadog, dropbox, elasticsearch, fireworks, front, gemini, googleAnalytics, googleDrive, groq, hubspot, intercom, jira, launchDarkly, mistral, pagerDuty, perplexity, segment, sendGrid, stabilityAI, twilio, zendesk, zoom, graphql, mysql, mariadb, mssql, cockroachdb, oracledb, redshift, athena, databricks, bigquery, mongodb, dynamodb, cosmosdb, s3, gcs, googleSheets, salesforce, superblocksOcr, restApiIntegration, getIntegrationDeclarations, lakebase, snowflakePostgres, smtp, type IntegrationDeclaration, type PostgresRef, type SlackRef, type OpenAIRef, type AnthropicRef, type StripeRef, type GitHubRef, type NotionRef, type SnowflakeRef, type SnowflakeCortexRef, type AirtableRef, type AsanaRef, type BitbucketRef, type BoxRef, type CircleCIRef, type CohereRef, type ConfluenceRef, type DatadogRef, type DropboxRef, type ElasticSearchRef, type FireworksRef, type FrontRef, type GeminiRef, type GoogleAnalyticsRef, type GoogleDriveRef, type GroqRef, type HubSpotRef, type IntercomRef, type JiraRef, type LaunchDarklyRef, type MistralRef, type PagerDutyRef, type PerplexityRef, type SegmentRef, type SendGridRef, type StabilityAIRef, type TwilioRef, type ZendeskRef, type ZoomRef, type GraphQLRef, type MySQLRef, type MariaDBRef, type MSSQLRef, type CockroachDBRef, type OracleDBRef, type RedshiftRef, type AthenaRef, type DatabricksRef, type BigQueryRef, type MongoDBRef, type DynamoDBRef, type CosmosDBRef, type S3Ref, type GCSRef, type GoogleSheetsRef, type SalesforceRef, type SuperblocksOCRRef, type RestApiIntegrationRef, type LakebaseRef, type SnowflakePostgresRef, type SmtpRef, } from "./integrations/index.js";
|
|
60
64
|
export type { PostgresClient } from "./integrations/postgres/index.js";
|
|
61
|
-
export type { SlackClient } from "./integrations/slack/index.js";
|
|
65
|
+
export type { SlackClient, SlackResponse, SlackErrorResponse, } from "./integrations/slack/index.js";
|
|
62
66
|
export type { SnowflakeClient } from "./integrations/snowflake/index.js";
|
|
63
67
|
export type { SnowflakeCortexClient } from "./integrations/snowflakecortex/index.js";
|
|
64
68
|
export type { AirtableClient } from "./integrations/airtable/index.js";
|
|
@@ -93,16 +97,11 @@ export type { ZoomClient } from "./integrations/zoom/index.js";
|
|
|
93
97
|
export type { GraphQLClient } from "./integrations/graphql/index.js";
|
|
94
98
|
export type { DynamoDBClient, DynamoDBAttributeValue, } from "./integrations/dynamodb/index.js";
|
|
95
99
|
export type { CosmosDBClient } from "./integrations/cosmosdb/index.js";
|
|
96
|
-
export type { CouchbaseClient, CouchbaseIdentifier, } from "./integrations/couchbase/index.js";
|
|
97
|
-
export type { KinesisClient, KinesisPutParams, KinesisGetParams, KinesisStreamIdentifier, KinesisShardIteratorType, } from "./integrations/kinesis/index.js";
|
|
98
100
|
export type { SalesforceClient, SalesforceCrudAction, SalesforceBulkAction, } from "./integrations/salesforce/index.js";
|
|
99
|
-
export type { RedisClient } from "./integrations/redis/index.js";
|
|
100
|
-
export type { KafkaClient } from "./integrations/kafka/index.js";
|
|
101
101
|
export type { S3Client } from "./integrations/s3/index.js";
|
|
102
102
|
export type { GCSClient } from "./integrations/gcs/index.js";
|
|
103
103
|
export type { GoogleSheetsClient } from "./integrations/gsheets/index.js";
|
|
104
104
|
export type { SuperblocksOCRClient } from "./integrations/superblocks-ocr/index.js";
|
|
105
|
-
export type { PythonClient } from "./integrations/python/index.js";
|
|
106
105
|
export type { RestApiIntegrationPluginClient } from "./integrations/restapiintegration/index.js";
|
|
107
106
|
export type { LakebaseClient } from "./integrations/lakebase/index.js";
|
|
108
107
|
export type { SnowflakePostgresClient } from "./integrations/snowflakepostgres/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGxD,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGxE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG7E,YAAY,EACV,SAAS,EACT,UAAU,EACV,OAAO,EACP,MAAM,EACN,qBAAqB,EACrB,cAAc,EACd,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
|
*
|
|
41
|
-
* await ctx.integrations.notifier.
|
|
42
|
-
* channel: '#user-lookups',
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
* const notifyResult = await ctx.integrations.notifier.apiRequest(
|
|
42
|
+
* { method: 'POST', path: '/chat.postMessage', body: { channel: '#user-lookups', text: `Fetched user ${user.name}` } },
|
|
43
|
+
* { response: z.object({ channel: z.string(), ts: z.string() }) }
|
|
44
|
+
* );
|
|
45
|
+
*
|
|
46
|
+
* if (!notifyResult.ok) {
|
|
47
|
+
* throw new Error(`Slack API error: ${notifyResult.error}`);
|
|
48
|
+
* }
|
|
45
49
|
*
|
|
46
50
|
* return { user };
|
|
47
51
|
* },
|
|
@@ -57,7 +61,7 @@ export { fileRefSchema, readableFileSchema } from "./files.js";
|
|
|
57
61
|
// API definition and registry
|
|
58
62
|
export { api, __setEntryPoint } from "./api/index.js";
|
|
59
63
|
// Integration declaration functions
|
|
60
|
-
export { postgres, slack, openai, anthropic, stripe, github, notion, snowflake, snowflakeCortex, airtable, asana, bitbucket, box, circleci, cohere, confluence, datadog, dropbox, elasticsearch, fireworks, front, gemini, googleAnalytics, googleDrive, groq, hubspot, intercom, jira, launchDarkly, mistral, pagerDuty, perplexity, segment, sendGrid, stabilityAI, twilio, zendesk, zoom, graphql, mysql, mariadb, mssql, cockroachdb, oracledb, redshift, athena, databricks, bigquery, mongodb, dynamodb, cosmosdb,
|
|
64
|
+
export { postgres, slack, openai, anthropic, stripe, github, notion, snowflake, snowflakeCortex, airtable, asana, bitbucket, box, circleci, cohere, confluence, datadog, dropbox, elasticsearch, fireworks, front, gemini, googleAnalytics, googleDrive, groq, hubspot, intercom, jira, launchDarkly, mistral, pagerDuty, perplexity, segment, sendGrid, stabilityAI, twilio, zendesk, zoom, graphql, mysql, mariadb, mssql, cockroachdb, oracledb, redshift, athena, databricks, bigquery, mongodb, dynamodb, cosmosdb, s3, gcs, googleSheets, salesforce, superblocksOcr, restApiIntegration, getIntegrationDeclarations, lakebase, snowflakePostgres, smtp, } from "./integrations/index.js";
|
|
61
65
|
// Runtime (for orchestrator use)
|
|
62
66
|
export {
|
|
63
67
|
// Executor
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,gCAAgC;AAChC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,2BAA2B;AAC3B,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG/D,8BAA8B;AAC9B,OAAO,EAAE,GAAG,EAAE,eAAe,EAAoB,MAAM,gBAAgB,CAAC;AAiBxE,oCAAoC;AACpC,OAAO,EACL,QAAQ,EACR,KAAK,EACL,MAAM,EACN,SAAS,EACT,MAAM,EACN,MAAM,EACN,MAAM,EACN,SAAS,EACT,eAAe,EACf,QAAQ,EACR,KAAK,EACL,SAAS,EACT,GAAG,EACH,QAAQ,EACR,MAAM,EACN,UAAU,EACV,OAAO,EACP,OAAO,EACP,aAAa,EACb,SAAS,EACT,KAAK,EACL,MAAM,EACN,eAAe,EACf,WAAW,EACX,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,SAAS,EACT,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAO,EACP,IAAI,EACJ,OAAO,EACP,KAAK,EACL,OAAO,EACP,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,EAAE,EACF,GAAG,EACH,YAAY,EACZ,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,QAAQ,EACR,iBAAiB,EACjB,IAAI,GA+DL,MAAM,yBAAyB,CAAC;AA8DjC,iCAAiC;AACjC,OAAO;AACL,WAAW;AACX,UAAU;AACV,oBAAoB;AACpB,gBAAgB;AAChB,cAAc;AACd,QAAQ,EACR,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,MAAM,oBAAoB,CAAC;AAY5B,8CAA8C;AAC9C,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,yBAAyB,CAAC;AAWjC,wBAAwB;AACxB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Base clients for integrations.
|
|
3
3
|
*/
|
|
4
|
+
export { RestApiClientBase } from "./rest-api-client-base.js";
|
|
4
5
|
export { RestApiIntegrationClient } from "./rest-api-integration-client.js";
|
|
5
|
-
export type { RestApiRequest } from "./rest-api-
|
|
6
|
+
export type { RestApiRequest } from "./rest-api-client-base.js";
|
|
6
7
|
export { GraphQLIntegrationClient } from "./graphql-integration-client.js";
|
|
7
8
|
export type { ApiRequestOptions, ApiRequestSchema, SupportsApiRequest, } from "./types.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/base/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,YAAY,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/base/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,YAAY,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Base clients for integrations.
|
|
3
3
|
*/
|
|
4
|
+
export { RestApiClientBase } from "./rest-api-client-base.js";
|
|
4
5
|
export { RestApiIntegrationClient } from "./rest-api-integration-client.js";
|
|
5
6
|
export { GraphQLIntegrationClient } from "./graphql-integration-client.js";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/base/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/integrations/base/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base for REST API Integration clients.
|
|
3
|
+
*
|
|
4
|
+
* Owns the shared infrastructure that every REST-API-backed integration
|
|
5
|
+
* needs: config storage, parameter helpers, body validation, request
|
|
6
|
+
* construction, and query execution. Subclasses add their own
|
|
7
|
+
* `apiRequest` with whatever response-handling strategy they need
|
|
8
|
+
* (e.g. direct Zod validation, discriminated-union wrapping).
|
|
9
|
+
*/
|
|
10
|
+
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
import type { Property } from "@superblocksteam/types/dist/src/common/v1/plugin_pb";
|
|
13
|
+
import type { Plugin as RestApiIntegrationPlugin } from "@superblocksteam/types/dist/src/plugins/restapiintegration/v1/plugin_pb";
|
|
14
|
+
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
15
|
+
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
16
|
+
import type { ApiRequestOptions } from "./types.js";
|
|
17
|
+
export type RestApiRequest = PartialMessage<RestApiIntegrationPlugin>;
|
|
18
|
+
/**
|
|
19
|
+
* Shared base for all REST API Integration clients.
|
|
20
|
+
*
|
|
21
|
+
* Provides config fields, parameter helpers, body validation, request
|
|
22
|
+
* building, and query execution. Does NOT define `apiRequest` — each
|
|
23
|
+
* concrete subclass supplies its own return-type contract.
|
|
24
|
+
*/
|
|
25
|
+
export declare abstract class RestApiClientBase implements IntegrationClientImpl {
|
|
26
|
+
readonly name: string;
|
|
27
|
+
readonly pluginId: string;
|
|
28
|
+
readonly config: IntegrationConfig;
|
|
29
|
+
protected readonly executeQuery: QueryExecutor;
|
|
30
|
+
constructor(config: IntegrationConfig, executeQuery: QueryExecutor);
|
|
31
|
+
/**
|
|
32
|
+
* Create a Property object for query params / headers.
|
|
33
|
+
*/
|
|
34
|
+
protected createParam(key: string, value: unknown): PartialMessage<Property>;
|
|
35
|
+
/**
|
|
36
|
+
* Validate the request body, build the proto request, and execute it.
|
|
37
|
+
*
|
|
38
|
+
* Returns the raw (unvalidated) response from the orchestrator.
|
|
39
|
+
* Subclasses call this, then apply their own response handling.
|
|
40
|
+
*
|
|
41
|
+
* @param options - HTTP method, path, body, params, headers
|
|
42
|
+
* @param bodySchema - Optional Zod schema for body validation
|
|
43
|
+
* @param metadata - Optional trace metadata for observability
|
|
44
|
+
* @returns Raw response from the orchestrator
|
|
45
|
+
*/
|
|
46
|
+
protected executeApiRequest<TBody>(options: ApiRequestOptions<TBody>, bodySchema?: z.ZodSchema<TBody>, metadata?: TraceMetadata): Promise<unknown>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=rest-api-client-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest-api-client-base.d.ts","sourceRoot":"","sources":["../../../src/integrations/base/rest-api-client-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qDAAqD,CAAC;AACpF,OAAO,KAAK,EAAE,MAAM,IAAI,wBAAwB,EAAE,MAAM,yEAAyE,CAAC;AAGlI,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,wBAAwB,CAAC,CAAC;AAEtE;;;;;;GAMG;AACH,8BAAsB,iBAAkB,YAAW,qBAAqB;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAEnC,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;gBAEnC,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa;IAOlE;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC;IAO5E;;;;;;;;;;OAUG;cACa,iBAAiB,CAAC,KAAK,EACrC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,EACjC,UAAU,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,EAC/B,QAAQ,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,OAAO,CAAC;CAgEpB"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract base for REST API Integration clients.
|
|
3
|
+
*
|
|
4
|
+
* Owns the shared infrastructure that every REST-API-backed integration
|
|
5
|
+
* needs: config storage, parameter helpers, body validation, request
|
|
6
|
+
* construction, and query execution. Subclasses add their own
|
|
7
|
+
* `apiRequest` with whatever response-handling strategy they need
|
|
8
|
+
* (e.g. direct Zod validation, discriminated-union wrapping).
|
|
9
|
+
*/
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { RestApiValidationError } from "../../errors.js";
|
|
12
|
+
/**
|
|
13
|
+
* Shared base for all REST API Integration clients.
|
|
14
|
+
*
|
|
15
|
+
* Provides config fields, parameter helpers, body validation, request
|
|
16
|
+
* building, and query execution. Does NOT define `apiRequest` — each
|
|
17
|
+
* concrete subclass supplies its own return-type contract.
|
|
18
|
+
*/
|
|
19
|
+
export class RestApiClientBase {
|
|
20
|
+
name;
|
|
21
|
+
pluginId;
|
|
22
|
+
config;
|
|
23
|
+
executeQuery;
|
|
24
|
+
constructor(config, executeQuery) {
|
|
25
|
+
this.name = config.name;
|
|
26
|
+
this.pluginId = config.pluginId;
|
|
27
|
+
this.config = config;
|
|
28
|
+
this.executeQuery = executeQuery;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create a Property object for query params / headers.
|
|
32
|
+
*/
|
|
33
|
+
createParam(key, value) {
|
|
34
|
+
return {
|
|
35
|
+
key,
|
|
36
|
+
value: typeof value === "string" ? value : JSON.stringify(value),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Validate the request body, build the proto request, and execute it.
|
|
41
|
+
*
|
|
42
|
+
* Returns the raw (unvalidated) response from the orchestrator.
|
|
43
|
+
* Subclasses call this, then apply their own response handling.
|
|
44
|
+
*
|
|
45
|
+
* @param options - HTTP method, path, body, params, headers
|
|
46
|
+
* @param bodySchema - Optional Zod schema for body validation
|
|
47
|
+
* @param metadata - Optional trace metadata for observability
|
|
48
|
+
* @returns Raw response from the orchestrator
|
|
49
|
+
*/
|
|
50
|
+
async executeApiRequest(options, bodySchema, metadata) {
|
|
51
|
+
// Validate request body if both body and schema are present.
|
|
52
|
+
if (options.body !== undefined && bodySchema) {
|
|
53
|
+
const bodyParseResult = bodySchema.safeParse(options.body);
|
|
54
|
+
if (!bodyParseResult.success) {
|
|
55
|
+
throw new RestApiValidationError(`Request body validation failed: ${bodyParseResult.error.message}`, {
|
|
56
|
+
zodError: bodyParseResult.error,
|
|
57
|
+
data: options.body,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const headers = [];
|
|
62
|
+
if (options.headers) {
|
|
63
|
+
for (const [key, value] of Object.entries(options.headers)) {
|
|
64
|
+
headers.push(this.createParam(key, value));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const params = [];
|
|
68
|
+
if (options.params) {
|
|
69
|
+
for (const [key, value] of Object.entries(options.params)) {
|
|
70
|
+
params.push(this.createParam(key, value));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const request = {
|
|
74
|
+
openApiAction: "genericHttpRequest",
|
|
75
|
+
httpMethod: options.method.toUpperCase(),
|
|
76
|
+
urlPath: options.path,
|
|
77
|
+
headers,
|
|
78
|
+
params,
|
|
79
|
+
responseType: "json",
|
|
80
|
+
};
|
|
81
|
+
if (options.body !== undefined) {
|
|
82
|
+
request.body = JSON.stringify(options.body);
|
|
83
|
+
request.bodyType = "jsonBody";
|
|
84
|
+
}
|
|
85
|
+
const result = await this.executeQuery(request, undefined, metadata);
|
|
86
|
+
if (result === null || result === undefined) {
|
|
87
|
+
const nonNullResult = z.object({}).safeParse(result);
|
|
88
|
+
if (!nonNullResult.success) {
|
|
89
|
+
throw new RestApiValidationError(`Integration query returned ${String(result)} — expected a JSON response object`, {
|
|
90
|
+
zodError: nonNullResult.error,
|
|
91
|
+
data: result,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=rest-api-client-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest-api-client-base.js","sourceRoot":"","sources":["../../../src/integrations/base/rest-api-client-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAOzD;;;;;;GAMG;AACH,MAAM,OAAgB,iBAAiB;IAC5B,IAAI,CAAS;IACb,QAAQ,CAAS;IACjB,MAAM,CAAoB;IAEhB,YAAY,CAAgB;IAE/C,YAAY,MAAyB,EAAE,YAA2B;QAChE,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACO,WAAW,CAAC,GAAW,EAAE,KAAc;QAC/C,OAAO;YACL,GAAG;YACH,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SACjE,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACO,KAAK,CAAC,iBAAiB,CAC/B,OAAiC,E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AAY,EAAE,MAAM;SACrB,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC5C,OAAO,CAAC,QAAQ,GAAG,UAAU,CAAC;QAChC,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CACpC,OAAkC,EAClC,SAAS,EACT,QAAQ,CACT,CAAC;QAEF,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC5C,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACrD,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,sBAAsB,CAC9B,8BAA8B,MAAM,CAAC,MAAM,CAAC,oCAAoC,EAChF;oBACE,QAAQ,EAAE,aAAa,CAAC,KAAK;oBAC7B,IAAI,EAAE,MAAM;iBACb,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Generic REST API Integration client with Zod response validation.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Extends RestApiClientBase with an apiRequest() that validates the
|
|
5
|
+
* full response against a caller-supplied Zod schema and throws
|
|
6
|
+
* RestApiValidationError on mismatch.
|
|
5
7
|
*/
|
|
6
|
-
import type { PartialMessage } from "@bufbuild/protobuf";
|
|
7
8
|
import type { z } from "zod";
|
|
8
|
-
import type {
|
|
9
|
-
import
|
|
10
|
-
import type { QueryExecutor, TraceMetadata } from "../registry.js";
|
|
11
|
-
import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
|
|
9
|
+
import type { TraceMetadata } from "../registry.js";
|
|
10
|
+
import { RestApiClientBase } from "./rest-api-client-base.js";
|
|
12
11
|
import type { ApiRequestOptions, ApiRequestSchema, SupportsApiRequest } from "./types.js";
|
|
13
|
-
export type RestApiRequest = PartialMessage<RestApiIntegrationPlugin>;
|
|
14
12
|
/**
|
|
15
13
|
* Base implementation for REST API Integration clients.
|
|
16
14
|
*
|
|
17
|
-
* All OpenAPI-based integration clients
|
|
18
|
-
*
|
|
15
|
+
* All OpenAPI-based integration clients (except those with
|
|
16
|
+
* integration-specific response handling) extend this class to
|
|
17
|
+
* inherit the generic apiRequest() method with runtime Zod validation.
|
|
19
18
|
*/
|
|
20
|
-
export declare abstract class RestApiIntegrationClient implements
|
|
21
|
-
readonly name: string;
|
|
22
|
-
readonly pluginId: string;
|
|
23
|
-
readonly config: IntegrationConfig;
|
|
24
|
-
protected readonly executeQuery: QueryExecutor;
|
|
25
|
-
constructor(config: IntegrationConfig, executeQuery: QueryExecutor);
|
|
26
|
-
/**
|
|
27
|
-
* Helper to create a Property object for params.
|
|
28
|
-
*/
|
|
29
|
-
protected createParam(key: string, value: unknown): PartialMessage<Property>;
|
|
19
|
+
export declare abstract class RestApiIntegrationClient extends RestApiClientBase implements SupportsApiRequest {
|
|
30
20
|
apiRequest<TBody, TResponse>(options: ApiRequestOptions<TBody>, schema: ApiRequestSchema<TBody, TResponse> & {
|
|
31
21
|
response: z.ZodSchema<TResponse>;
|
|
32
22
|
}, metadata?: TraceMetadata): Promise<TResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest-api-integration-client.d.ts","sourceRoot":"","sources":["../../../src/integrations/base/rest-api-integration-client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rest-api-integration-client.d.ts","sourceRoot":"","sources":["../../../src/integrations/base/rest-api-integration-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAEpB;;;;;;GAMG;AACH,8BAAsB,wBACpB,SAAQ,iBACR,YAAW,kBAAkB;IAEvB,UAAU,CAAC,KAAK,EAAE,SAAS,EAC/B,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,EACjC,MAAM,EAAE,gBAAgB,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG;QAC3C,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;KAClC,EACD,QAAQ,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,SAAS,CAAC;CAkBtB"}
|