@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.
Files changed (182) hide show
  1. package/README.md +439 -89
  2. package/dist/api/definition.d.ts +11 -6
  3. package/dist/api/definition.d.ts.map +1 -1
  4. package/dist/api/definition.js +19 -12
  5. package/dist/api/definition.js.map +1 -1
  6. package/dist/api/definition.test.js +39 -15
  7. package/dist/api/definition.test.js.map +1 -1
  8. package/dist/errors.d.ts +1 -1
  9. package/dist/errors.js +1 -1
  10. package/dist/index.d.ts +10 -11
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +9 -5
  13. package/dist/index.js.map +1 -1
  14. package/dist/integrations/base/index.d.ts +2 -1
  15. package/dist/integrations/base/index.d.ts.map +1 -1
  16. package/dist/integrations/base/index.js +1 -0
  17. package/dist/integrations/base/index.js.map +1 -1
  18. package/dist/integrations/base/rest-api-client-base.d.ts +48 -0
  19. package/dist/integrations/base/rest-api-client-base.d.ts.map +1 -0
  20. package/dist/integrations/base/rest-api-client-base.js +98 -0
  21. package/dist/integrations/base/rest-api-client-base.js.map +1 -0
  22. package/dist/integrations/base/rest-api-integration-client.d.ts +10 -20
  23. package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
  24. package/dist/integrations/base/rest-api-integration-client.js +10 -65
  25. package/dist/integrations/base/rest-api-integration-client.js.map +1 -1
  26. package/dist/integrations/box/types.d.ts +1 -1
  27. package/dist/integrations/declarations.d.ts +5 -73
  28. package/dist/integrations/declarations.d.ts.map +1 -1
  29. package/dist/integrations/declarations.js +5 -68
  30. package/dist/integrations/declarations.js.map +1 -1
  31. package/dist/integrations/documentation.test.js +0 -2
  32. package/dist/integrations/documentation.test.js.map +1 -1
  33. package/dist/integrations/googledrive/types.d.ts +1 -1
  34. package/dist/integrations/index.d.ts +1 -11
  35. package/dist/integrations/index.d.ts.map +1 -1
  36. package/dist/integrations/index.js +1 -7
  37. package/dist/integrations/index.js.map +1 -1
  38. package/dist/integrations/registry.d.ts +1 -11
  39. package/dist/integrations/registry.d.ts.map +1 -1
  40. package/dist/integrations/registry.js +0 -29
  41. package/dist/integrations/registry.js.map +1 -1
  42. package/dist/integrations/slack/client.d.ts +13 -9
  43. package/dist/integrations/slack/client.d.ts.map +1 -1
  44. package/dist/integrations/slack/client.js +60 -8
  45. package/dist/integrations/slack/client.js.map +1 -1
  46. package/dist/integrations/slack/client.test.d.ts +11 -0
  47. package/dist/integrations/slack/client.test.d.ts.map +1 -0
  48. package/dist/integrations/slack/client.test.js +368 -0
  49. package/dist/integrations/slack/client.test.js.map +1 -0
  50. package/dist/integrations/slack/index.d.ts +2 -1
  51. package/dist/integrations/slack/index.d.ts.map +1 -1
  52. package/dist/integrations/slack/index.js +1 -0
  53. package/dist/integrations/slack/index.js.map +1 -1
  54. package/dist/integrations/slack/types.d.ts +127 -28
  55. package/dist/integrations/slack/types.d.ts.map +1 -1
  56. package/dist/integrations/slack/types.js +27 -1
  57. package/dist/integrations/slack/types.js.map +1 -1
  58. package/dist/integrations/snowflake/client.d.ts +2 -2
  59. package/dist/integrations/snowflake/client.js +2 -2
  60. package/dist/runtime/context.d.ts +1 -1
  61. package/dist/runtime/executor.d.ts +2 -2
  62. package/dist/types.d.ts +15 -6
  63. package/dist/types.d.ts.map +1 -1
  64. package/package.json +2 -2
  65. package/src/api/definition.test.ts +40 -15
  66. package/src/api/definition.ts +19 -12
  67. package/src/errors.ts +1 -1
  68. package/src/index.ts +13 -33
  69. package/src/integrations/asana/README.md +12 -12
  70. package/src/integrations/base/index.ts +2 -1
  71. package/src/integrations/base/rest-api-client-base.ts +134 -0
  72. package/src/integrations/base/rest-api-integration-client.ts +12 -89
  73. package/src/integrations/bitbucket/README.md +19 -19
  74. package/src/integrations/box/README.md +24 -24
  75. package/src/integrations/box/types.ts +1 -1
  76. package/src/integrations/circleci/README.md +18 -18
  77. package/src/integrations/declarations.ts +5 -105
  78. package/src/integrations/documentation.test.ts +0 -2
  79. package/src/integrations/googledrive/README.md +25 -22
  80. package/src/integrations/googledrive/types.ts +1 -1
  81. package/src/integrations/graphql/README.md +2 -2
  82. package/src/integrations/groq/README.md +8 -8
  83. package/src/integrations/index.ts +0 -51
  84. package/src/integrations/mongodb/README.md +65 -12
  85. package/src/integrations/perplexity/README.md +39 -48
  86. package/src/integrations/registry.ts +1 -39
  87. package/src/integrations/salesforce/README.md +11 -9
  88. package/src/integrations/slack/README.md +62 -19
  89. package/src/integrations/slack/client.test.ts +553 -0
  90. package/src/integrations/slack/client.ts +92 -12
  91. package/src/integrations/slack/index.ts +6 -1
  92. package/src/integrations/slack/types.ts +142 -29
  93. package/src/integrations/snowflake/client.ts +2 -2
  94. package/src/integrations/zoom/README.md +15 -15
  95. package/src/runtime/context.ts +1 -1
  96. package/src/runtime/executor.ts +2 -2
  97. package/src/types.ts +15 -6
  98. package/dist/integrations/couchbase/client.d.ts +0 -36
  99. package/dist/integrations/couchbase/client.d.ts.map +0 -1
  100. package/dist/integrations/couchbase/client.js +0 -148
  101. package/dist/integrations/couchbase/client.js.map +0 -1
  102. package/dist/integrations/couchbase/index.d.ts +0 -8
  103. package/dist/integrations/couchbase/index.d.ts.map +0 -1
  104. package/dist/integrations/couchbase/index.js +0 -7
  105. package/dist/integrations/couchbase/index.js.map +0 -1
  106. package/dist/integrations/couchbase/types.d.ts +0 -100
  107. package/dist/integrations/couchbase/types.d.ts.map +0 -1
  108. package/dist/integrations/couchbase/types.js +0 -5
  109. package/dist/integrations/couchbase/types.js.map +0 -1
  110. package/dist/integrations/kafka/client.d.ts +0 -25
  111. package/dist/integrations/kafka/client.d.ts.map +0 -1
  112. package/dist/integrations/kafka/client.js +0 -124
  113. package/dist/integrations/kafka/client.js.map +0 -1
  114. package/dist/integrations/kafka/index.d.ts +0 -8
  115. package/dist/integrations/kafka/index.d.ts.map +0 -1
  116. package/dist/integrations/kafka/index.js +0 -7
  117. package/dist/integrations/kafka/index.js.map +0 -1
  118. package/dist/integrations/kafka/types.d.ts +0 -113
  119. package/dist/integrations/kafka/types.d.ts.map +0 -1
  120. package/dist/integrations/kafka/types.js +0 -5
  121. package/dist/integrations/kafka/types.js.map +0 -1
  122. package/dist/integrations/kinesis/client.d.ts +0 -31
  123. package/dist/integrations/kinesis/client.d.ts.map +0 -1
  124. package/dist/integrations/kinesis/client.js +0 -101
  125. package/dist/integrations/kinesis/client.js.map +0 -1
  126. package/dist/integrations/kinesis/index.d.ts +0 -8
  127. package/dist/integrations/kinesis/index.d.ts.map +0 -1
  128. package/dist/integrations/kinesis/index.js +0 -7
  129. package/dist/integrations/kinesis/index.js.map +0 -1
  130. package/dist/integrations/kinesis/types.d.ts +0 -97
  131. package/dist/integrations/kinesis/types.d.ts.map +0 -1
  132. package/dist/integrations/kinesis/types.js +0 -7
  133. package/dist/integrations/kinesis/types.js.map +0 -1
  134. package/dist/integrations/python/client.d.ts +0 -42
  135. package/dist/integrations/python/client.d.ts.map +0 -1
  136. package/dist/integrations/python/client.js +0 -89
  137. package/dist/integrations/python/client.js.map +0 -1
  138. package/dist/integrations/python/client.test.d.ts +0 -5
  139. package/dist/integrations/python/client.test.d.ts.map +0 -1
  140. package/dist/integrations/python/client.test.js +0 -214
  141. package/dist/integrations/python/client.test.js.map +0 -1
  142. package/dist/integrations/python/index.d.ts +0 -6
  143. package/dist/integrations/python/index.d.ts.map +0 -1
  144. package/dist/integrations/python/index.js +0 -5
  145. package/dist/integrations/python/index.js.map +0 -1
  146. package/dist/integrations/python/types.d.ts +0 -85
  147. package/dist/integrations/python/types.d.ts.map +0 -1
  148. package/dist/integrations/python/types.js +0 -5
  149. package/dist/integrations/python/types.js.map +0 -1
  150. package/dist/integrations/redis/client.d.ts +0 -43
  151. package/dist/integrations/redis/client.d.ts.map +0 -1
  152. package/dist/integrations/redis/client.js +0 -142
  153. package/dist/integrations/redis/client.js.map +0 -1
  154. package/dist/integrations/redis/index.d.ts +0 -8
  155. package/dist/integrations/redis/index.d.ts.map +0 -1
  156. package/dist/integrations/redis/index.js +0 -7
  157. package/dist/integrations/redis/index.js.map +0 -1
  158. package/dist/integrations/redis/types.d.ts +0 -137
  159. package/dist/integrations/redis/types.d.ts.map +0 -1
  160. package/dist/integrations/redis/types.js +0 -5
  161. package/dist/integrations/redis/types.js.map +0 -1
  162. package/src/integrations/couchbase/README.md +0 -138
  163. package/src/integrations/couchbase/client.ts +0 -225
  164. package/src/integrations/couchbase/index.ts +0 -8
  165. package/src/integrations/couchbase/types.ts +0 -126
  166. package/src/integrations/kafka/README.md +0 -144
  167. package/src/integrations/kafka/client.ts +0 -216
  168. package/src/integrations/kafka/index.ts +0 -14
  169. package/src/integrations/kafka/types.ts +0 -128
  170. package/src/integrations/kinesis/README.md +0 -153
  171. package/src/integrations/kinesis/client.ts +0 -146
  172. package/src/integrations/kinesis/index.ts +0 -14
  173. package/src/integrations/kinesis/types.ts +0 -114
  174. package/src/integrations/python/README.md +0 -566
  175. package/src/integrations/python/client.test.ts +0 -341
  176. package/src/integrations/python/client.ts +0 -136
  177. package/src/integrations/python/index.ts +0 -6
  178. package/src/integrations/python/types.ts +0 -92
  179. package/src/integrations/redis/README.md +0 -200
  180. package/src/integrations/redis/client.ts +0 -208
  181. package/src/integrations/redis/index.ts +0 -8
  182. package/src/integrations/redis/types.ts +0 -167
@@ -1,14 +0,0 @@
1
- /**
2
- * Kafka integration client.
3
- *
4
- * @module
5
- */
6
-
7
- export type {
8
- KafkaClient,
9
- KafkaOperation,
10
- KafkaSeek,
11
- KafkaConsumeParams,
12
- KafkaProduceParams,
13
- } from "./types.js";
14
- export { KafkaClientImpl } from "./client.js";
@@ -1,128 +0,0 @@
1
- /**
2
- * Kafka client types.
3
- */
4
-
5
- import type { z } from "zod";
6
-
7
- import type { BaseIntegrationClient } from "../../types.js";
8
- import type { TraceMetadata } from "../registry.js";
9
-
10
- /**
11
- * Kafka operation types.
12
- */
13
- export type KafkaOperation = "CONSUME" | "PRODUCE";
14
-
15
- /**
16
- * Seek position for consuming from a specific offset.
17
- */
18
- export interface KafkaSeek {
19
- /** Topic name */
20
- topic: string;
21
- /** Offset to start from */
22
- offset: number;
23
- /** Partition to consume from */
24
- partition: number;
25
- }
26
-
27
- /**
28
- * Parameters for Kafka consume operation.
29
- */
30
- export interface KafkaConsumeParams {
31
- /** Topic to consume from */
32
- topic: string;
33
- /** Where to start consuming from */
34
- from?: "BEGINNING" | "LATEST" | "SEEK";
35
- /** Consumer group ID */
36
- groupId?: string;
37
- /** Client ID */
38
- clientId?: string;
39
- /** Seek position for SEEK mode */
40
- seek?: KafkaSeek;
41
- /** Whether to read uncommitted messages */
42
- readUncommitted?: boolean;
43
- }
44
-
45
- /**
46
- * Parameters for Kafka produce operation.
47
- */
48
- export interface KafkaProduceParams {
49
- /** Messages to produce (JSON string) */
50
- messages: string;
51
- /** Acknowledgment level */
52
- acks?: "NONE" | "LEADER" | "ALL";
53
- /** Client ID */
54
- clientId?: string;
55
- /** Timeout in milliseconds */
56
- timeout?: number;
57
- /** Compression type */
58
- compression?: "GZIP" | "SNAPPY" | "LZ4" | "ZSTD";
59
- /** Transaction ID for transactional produce */
60
- transactionId?: string;
61
- /** Whether to auto-create topic */
62
- autoCreateTopic?: boolean;
63
- /** Whether to enable idempotent delivery */
64
- idempotent?: boolean;
65
- /** Whether to use transactions */
66
- transaction?: boolean;
67
- }
68
-
69
- /**
70
- * Kafka client for message streaming operations.
71
- *
72
- * Provides consume() and produce() methods for Kafka operations.
73
- *
74
- * @example
75
- * ```typescript
76
- * // Declare in api(): integrations: { kafka: kafka(INTEGRATION_ID) }
77
- * // In run(), access via ctx.integrations.kafka
78
- *
79
- * // Consume messages
80
- * const MessageSchema = z.array(z.object({
81
- * topic: z.string(),
82
- * partition: z.number(),
83
- * offset: z.number(),
84
- * value: z.unknown(),
85
- * }));
86
- *
87
- * const messages = await kafka.consume(MessageSchema, {
88
- * topic: 'my-topic',
89
- * from: 'LATEST',
90
- * groupId: 'my-consumer-group',
91
- * });
92
- *
93
- * // Produce messages
94
- * const result = await kafka.produce(z.any(), {
95
- * messages: JSON.stringify([
96
- * { topic: 'my-topic', value: { key: 'value' } }
97
- * ]),
98
- * });
99
- * ```
100
- */
101
- export interface KafkaClient extends BaseIntegrationClient {
102
- /**
103
- * Consume messages from Kafka.
104
- *
105
- * @param schema - Zod schema for validating the result
106
- * @param params - Consume parameters
107
- * @returns The validated result
108
- */
109
- consume<T>(
110
- schema: z.ZodSchema<T>,
111
- params: KafkaConsumeParams,
112
- metadata?: TraceMetadata,
113
- ): Promise<T>;
114
-
115
- /**
116
- * Produce messages to Kafka.
117
- *
118
- * @param schema - Zod schema for validating the result
119
- * @param params - Produce parameters
120
- * @param metadata - Optional trace metadata for diagnostics
121
- * @returns The validated result
122
- */
123
- produce<T>(
124
- schema: z.ZodSchema<T>,
125
- params: KafkaProduceParams,
126
- metadata?: TraceMetadata,
127
- ): Promise<T>;
128
- }
@@ -1,153 +0,0 @@
1
- # Kinesis Client
2
-
3
- Write records to and read records from Amazon Kinesis Data Streams.
4
-
5
- ## Methods
6
-
7
- | Method | Description |
8
- | ------------------------------- | ----------------------------------------- |
9
- | `putRecord(params, metadata?)` | Write a single record to a Kinesis stream |
10
- | `getRecords(params, metadata?)` | Read records from a Kinesis stream shard |
11
-
12
- ## Usage
13
-
14
- ### Put Record
15
-
16
- ```typescript
17
- import { api, z, kinesis } from "@superblocksteam/sdk-api";
18
-
19
- // Integration ID from the integrations panel
20
- const PROD_KINESIS = "a1b2c3d4-5678-90ab-cdef-kinesis00001";
21
-
22
- export default api({
23
- integrations: {
24
- kinesis: kinesis(PROD_KINESIS),
25
- },
26
- name: "KinesisExample",
27
- input: z.object({
28
- userId: z.string(),
29
- event: z.string(),
30
- }),
31
- output: z.object({
32
- success: z.boolean(),
33
- }),
34
- async run(ctx, { userId, event }) {
35
- await kinesis.putRecord({
36
- data: JSON.stringify({ event, userId, timestamp: Date.now() }),
37
- partitionKey: userId,
38
- streamName: "user-events",
39
- });
40
-
41
- return { success: true };
42
- },
43
- });
44
- ```
45
-
46
- ### Put Record with Stream ARN
47
-
48
- ```typescript
49
- await kinesis.putRecord({
50
- data: JSON.stringify({ event: "signup" }),
51
- partitionKey: "user-123",
52
- streamIdentifierType: "STREAM_ARN",
53
- streamArn: "arn:aws:kinesis:us-east-1:123456789:stream/user-events",
54
- });
55
- ```
56
-
57
- ### Get Records
58
-
59
- ```typescript
60
- const records = await kinesis.getRecords({
61
- shardId: "shardId-000000000000",
62
- shardIteratorType: "LATEST",
63
- streamName: "user-events",
64
- limit: 10,
65
- });
66
- ```
67
-
68
- ### Get Records from Specific Sequence Number
69
-
70
- ```typescript
71
- const records = await kinesis.getRecords({
72
- shardId: "shardId-000000000000",
73
- shardIteratorType: "AFTER_SEQUENCE_NUMBER",
74
- startingSequenceNumber:
75
- "49590338271490256608559692538361571095921575989136588898",
76
- streamName: "user-events",
77
- });
78
- ```
79
-
80
- ### Get Records at Timestamp
81
-
82
- ```typescript
83
- const records = await kinesis.getRecords({
84
- shardId: "shardId-000000000000",
85
- shardIteratorType: "AT_TIMESTAMP",
86
- timestamp: "2024-01-15T00:00:00Z",
87
- streamName: "user-events",
88
- });
89
- ```
90
-
91
- ## Parameters
92
-
93
- ### KinesisPutParams
94
-
95
- | Parameter | Type | Required | Description |
96
- | ---------------------- | ------------------------------- | -------- | -------------------------------------------- |
97
- | `data` | `string` | Yes | The data payload (JSON string or raw string) |
98
- | `partitionKey` | `string` | Yes | The partition key for the record |
99
- | `streamIdentifierType` | `'STREAM_NAME' \| 'STREAM_ARN'` | No | How to identify the stream |
100
- | `streamName` | `string` | No | Stream name (when using STREAM_NAME) |
101
- | `streamArn` | `string` | No | Stream ARN (when using STREAM_ARN) |
102
-
103
- ### KinesisGetParams
104
-
105
- | Parameter | Type | Required | Description |
106
- | ------------------------ | ------------------------------- | -------- | ---------------------------------------------- |
107
- | `shardId` | `string` | Yes | The shard ID to read from |
108
- | `shardIteratorType` | `ShardIteratorType` | Yes | How to position the shard iterator |
109
- | `limit` | `number` | No | Maximum number of records to return |
110
- | `pollingCooldownMs` | `number` | No | Polling cooldown in milliseconds |
111
- | `startingSequenceNumber` | `string` | No | Sequence number (for AT/AFTER_SEQUENCE_NUMBER) |
112
- | `timestamp` | `string` | No | ISO timestamp (for AT_TIMESTAMP) |
113
- | `streamIdentifierType` | `'STREAM_NAME' \| 'STREAM_ARN'` | No | How to identify the stream |
114
- | `streamName` | `string` | No | Stream name (when using STREAM_NAME) |
115
- | `streamArn` | `string` | No | Stream ARN (when using STREAM_ARN) |
116
-
117
- ### Shard Iterator Types
118
-
119
- | Type | Description |
120
- | ----------------------- | ----------------------------------------- |
121
- | `AT_SEQUENCE_NUMBER` | Start at the specified sequence number |
122
- | `AFTER_SEQUENCE_NUMBER` | Start after the specified sequence number |
123
- | `AT_TIMESTAMP` | Start at the specified timestamp |
124
- | `TRIM_HORIZON` | Start at the oldest record in the shard |
125
- | `LATEST` | Start at the most recent record |
126
-
127
- ## Trace Metadata
128
-
129
- All methods accept an optional `metadata` parameter as the last argument for diagnostics labeling. See the [root SDK README](../../../README.md#trace-metadata) for details.
130
-
131
- ## Error Handling
132
-
133
- ```typescript
134
- import { IntegrationError } from "@superblocksteam/sdk-api";
135
-
136
- try {
137
- await kinesis.putRecord({
138
- data: JSON.stringify({ event: "test" }),
139
- partitionKey: "key-1",
140
- streamName: "my-stream",
141
- });
142
- } catch (error) {
143
- if (error instanceof IntegrationError) {
144
- console.error("Kinesis error:", error.message);
145
- }
146
- }
147
- ```
148
-
149
- ## API Reference
150
-
151
- - [Amazon Kinesis Data Streams](https://docs.aws.amazon.com/streams/latest/dev/introduction.html)
152
- - [PutRecord](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html)
153
- - [GetRecords](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetRecords.html)
@@ -1,146 +0,0 @@
1
- /**
2
- * Kinesis client implementation.
3
- *
4
- * Uses the native Kinesis plugin type from @superblocksteam/types.
5
- * Supports PUT (write records) and GET (read records) operations.
6
- */
7
-
8
- import { IntegrationError } from "../../runtime/errors.js";
9
- import type { QueryExecutor, TraceMetadata } from "../registry.js";
10
- import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
11
- import type {
12
- KinesisClient,
13
- KinesisPutParams,
14
- KinesisGetParams,
15
- } from "./types.js";
16
-
17
- /**
18
- * Kinesis operation type enum values matching the proto.
19
- */
20
- const OPERATION_TYPE = {
21
- PUT: "OPERATION_TYPE_PUT",
22
- GET: "OPERATION_TYPE_GET",
23
- } as const;
24
-
25
- /**
26
- * Internal implementation of KinesisClient.
27
- *
28
- * Sends requests matching the Kinesis plugin proto structure:
29
- * - `operationType`: PUT or GET
30
- * - `put`: PUT operation parameters
31
- * - `get`: GET operation parameters
32
- */
33
- export class KinesisClientImpl implements KinesisClient, IntegrationClientImpl {
34
- readonly config: IntegrationConfig;
35
- private readonly executeQuery: QueryExecutor;
36
-
37
- constructor(config: IntegrationConfig, executeQuery: QueryExecutor) {
38
- this.config = config;
39
- this.executeQuery = executeQuery;
40
- }
41
-
42
- get name(): string {
43
- return this.config.name;
44
- }
45
-
46
- get pluginId(): string {
47
- return this.config.pluginId;
48
- }
49
-
50
- /**
51
- * Execute a request and wrap errors.
52
- */
53
- private async exec(
54
- request: Record<string, unknown>,
55
- operation: string,
56
- metadata?: TraceMetadata,
57
- ): Promise<unknown> {
58
- try {
59
- return await this.executeQuery(request, undefined, metadata);
60
- } catch (error) {
61
- if (error instanceof IntegrationError) {
62
- throw error;
63
- }
64
-
65
- throw new IntegrationError(this.config.name, operation, error);
66
- }
67
- }
68
-
69
- async putRecord(
70
- params: KinesisPutParams,
71
- metadata?: TraceMetadata,
72
- ): Promise<unknown> {
73
- const put: Record<string, unknown> = {
74
- data: params.data,
75
- partitionKey: params.partitionKey,
76
- };
77
-
78
- if (params.streamIdentifierType) {
79
- put.streamIdentifierType = params.streamIdentifierType;
80
- }
81
-
82
- if (params.streamName) {
83
- put.streamName = params.streamName;
84
- }
85
-
86
- if (params.streamArn) {
87
- put.streamArn = params.streamArn;
88
- }
89
-
90
- return this.exec(
91
- {
92
- operationType: OPERATION_TYPE.PUT,
93
- put,
94
- },
95
- "putRecord",
96
- metadata,
97
- );
98
- }
99
-
100
- async getRecords(
101
- params: KinesisGetParams,
102
- metadata?: TraceMetadata,
103
- ): Promise<unknown> {
104
- const get: Record<string, unknown> = {
105
- shardId: params.shardId,
106
- shardIteratorType: params.shardIteratorType,
107
- };
108
-
109
- if (params.limit !== undefined) {
110
- get.limit = params.limit;
111
- }
112
-
113
- if (params.pollingCooldownMs !== undefined) {
114
- get.pollingCooldownMs = params.pollingCooldownMs;
115
- }
116
-
117
- if (params.startingSequenceNumber) {
118
- get.startingSequenceNumber = params.startingSequenceNumber;
119
- }
120
-
121
- if (params.timestamp) {
122
- get.timestamp = params.timestamp;
123
- }
124
-
125
- if (params.streamIdentifierType) {
126
- get.streamIdentifierType = params.streamIdentifierType;
127
- }
128
-
129
- if (params.streamName) {
130
- get.streamName = params.streamName;
131
- }
132
-
133
- if (params.streamArn) {
134
- get.streamArn = params.streamArn;
135
- }
136
-
137
- return this.exec(
138
- {
139
- operationType: OPERATION_TYPE.GET,
140
- get,
141
- },
142
- "getRecords",
143
- metadata,
144
- );
145
- }
146
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * Kinesis integration client.
3
- *
4
- * @module
5
- */
6
-
7
- export type {
8
- KinesisClient,
9
- KinesisPutParams,
10
- KinesisGetParams,
11
- KinesisStreamIdentifier,
12
- KinesisShardIteratorType,
13
- } from "./types.js";
14
- export { KinesisClientImpl } from "./client.js";
@@ -1,114 +0,0 @@
1
- /**
2
- * Kinesis client types.
3
- *
4
- * Kinesis uses a dedicated plugin (not REST API) with PUT and GET operations.
5
- */
6
-
7
- import type { BaseIntegrationClient } from "../../types.js";
8
- import type { TraceMetadata } from "../registry.js";
9
-
10
- /**
11
- * Stream identifier type for Kinesis operations.
12
- */
13
- export type KinesisStreamIdentifier = "STREAM_NAME" | "STREAM_ARN";
14
-
15
- /**
16
- * Shard iterator type for Kinesis GET operations.
17
- */
18
- export type KinesisShardIteratorType =
19
- | "AT_SEQUENCE_NUMBER"
20
- | "AFTER_SEQUENCE_NUMBER"
21
- | "AT_TIMESTAMP"
22
- | "TRIM_HORIZON"
23
- | "LATEST";
24
-
25
- /**
26
- * Parameters for a Kinesis PUT operation.
27
- */
28
- export interface KinesisPutParams {
29
- /** The data payload (JSON string or raw string) */
30
- data: string;
31
- /** The partition key for the record */
32
- partitionKey: string;
33
- /** How to identify the stream */
34
- streamIdentifierType?: KinesisStreamIdentifier;
35
- /** Stream name (when streamIdentifierType is STREAM_NAME) */
36
- streamName?: string;
37
- /** Stream ARN (when streamIdentifierType is STREAM_ARN) */
38
- streamArn?: string;
39
- }
40
-
41
- /**
42
- * Parameters for a Kinesis GET operation.
43
- */
44
- export interface KinesisGetParams {
45
- /** The shard ID to read from */
46
- shardId: string;
47
- /** How to position the shard iterator */
48
- shardIteratorType: KinesisShardIteratorType;
49
- /** Maximum number of records to return */
50
- limit?: number;
51
- /** Polling cooldown in milliseconds */
52
- pollingCooldownMs?: number;
53
- /** Starting sequence number (for AT/AFTER_SEQUENCE_NUMBER) */
54
- startingSequenceNumber?: string;
55
- /** Timestamp (for AT_TIMESTAMP) */
56
- timestamp?: string;
57
- /** How to identify the stream */
58
- streamIdentifierType?: KinesisStreamIdentifier;
59
- /** Stream name (when streamIdentifierType is STREAM_NAME) */
60
- streamName?: string;
61
- /** Stream ARN (when streamIdentifierType is STREAM_ARN) */
62
- streamArn?: string;
63
- }
64
-
65
- /**
66
- * Kinesis client for Amazon Kinesis Data Streams.
67
- *
68
- * Provides methods for putting records to and getting records from Kinesis streams.
69
- *
70
- * @example
71
- * ```typescript
72
- * // Declare in api(): integrations: { kinesis: kinesis(INTEGRATION_ID) }
73
- * // In run(), access via ctx.integrations.kinesis
74
- *
75
- * // Put a record
76
- * await kinesis.putRecord({
77
- * data: JSON.stringify({ event: 'user_signup', userId: '123' }),
78
- * partitionKey: 'user-123',
79
- * streamName: 'user-events',
80
- * });
81
- *
82
- * // Get records from a shard
83
- * const records = await kinesis.getRecords({
84
- * shardId: 'shardId-000000000000',
85
- * shardIteratorType: 'LATEST',
86
- * streamName: 'user-events',
87
- * limit: 10,
88
- * });
89
- * ```
90
- */
91
- export interface KinesisClient extends BaseIntegrationClient {
92
- /**
93
- * Put a record to a Kinesis stream.
94
- *
95
- * @param params - PUT operation parameters
96
- * @returns The raw result from Kinesis (includes ShardId and SequenceNumber)
97
- */
98
- putRecord(
99
- params: KinesisPutParams,
100
- metadata?: TraceMetadata,
101
- ): Promise<unknown>;
102
-
103
- /**
104
- * Get records from a Kinesis stream shard.
105
- *
106
- * @param params - GET operation parameters
107
- * @param metadata - Optional trace metadata for diagnostics
108
- * @returns The raw result from Kinesis (includes Records array)
109
- */
110
- getRecords(
111
- params: KinesisGetParams,
112
- metadata?: TraceMetadata,
113
- ): Promise<unknown>;
114
- }