@uptiqai/integrations-sdk 1.0.0
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 +69 -0
- package/dist/generated-api.d.ts +264 -0
- package/dist/generated-api.d.ts.map +1 -0
- package/dist/generated-api.js +87 -0
- package/dist/generated-api.js.map +1 -0
- package/dist/http-client.d.ts +9 -0
- package/dist/http-client.d.ts.map +1 -0
- package/dist/http-client.js +52 -0
- package/dist/http-client.js.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/response-type-map.d.ts +19 -0
- package/dist/response-type-map.d.ts.map +1 -0
- package/dist/response-type-map.js +54 -0
- package/dist/response-type-map.js.map +1 -0
- package/package.json +51 -0
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Samuel Agent Types SDK
|
|
2
|
+
|
|
3
|
+
A TypeScript SDK for Agent Builder types, providing type-safe interfaces and utilities.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎯 **TypeScript First**: Built with TypeScript for excellent developer experience
|
|
8
|
+
- 🔧 **Modern Tooling**: ESLint and Prettier for code quality and formatting
|
|
9
|
+
- 📦 **Ready to Publish**: Configured for npm package distribution
|
|
10
|
+
- 🚀 **Zero Config**: Minimal setup required
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install uptiq-v2-integrations-sdk
|
|
16
|
+
# or
|
|
17
|
+
yarn add uptiq-v2-integrations-sdk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Development
|
|
21
|
+
|
|
22
|
+
### Prerequisites
|
|
23
|
+
|
|
24
|
+
- Node.js (v16 or higher)
|
|
25
|
+
- Yarn
|
|
26
|
+
|
|
27
|
+
### Setup
|
|
28
|
+
|
|
29
|
+
1. Clone the repository
|
|
30
|
+
2. Install dependencies:
|
|
31
|
+
```bash
|
|
32
|
+
yarn install
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Available Scripts
|
|
36
|
+
|
|
37
|
+
- `yarn build` - Build the TypeScript code
|
|
38
|
+
- `yarn dev` - Watch mode for development
|
|
39
|
+
- `yarn lint` - Run ESLint
|
|
40
|
+
- `yarn lint:fix` - Fix ESLint issues automatically
|
|
41
|
+
- `yarn format` - Format code with Prettier
|
|
42
|
+
- `yarn format:check` - Check code formatting
|
|
43
|
+
- `yarn clean` - Clean build artifacts
|
|
44
|
+
|
|
45
|
+
### Project Structure
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
samuel-agent-types-sdk/
|
|
49
|
+
├── src/
|
|
50
|
+
│ └── index.ts # Main SDK entry point
|
|
51
|
+
├── dist/ # Compiled output (generated)
|
|
52
|
+
├── eslint.config.js # ESLint configuration
|
|
53
|
+
├── .prettierrc # Prettier configuration
|
|
54
|
+
├── tsconfig.json # TypeScript configuration
|
|
55
|
+
├── package.json # Package configuration
|
|
56
|
+
└── README.md # This file
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
|
|
61
|
+
1. Fork the repository
|
|
62
|
+
2. Create a feature branch
|
|
63
|
+
3. Make your changes
|
|
64
|
+
4. Run linting and formatting: `yarn lint && yarn format`
|
|
65
|
+
5. Submit a pull request
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT License - see LICENSE file for details.
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
export type HandleOAuthCallback500 = {
|
|
2
|
+
error?: string;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Original provider response
|
|
6
|
+
*/
|
|
7
|
+
export type HandleOAuthCallback200RawProfile = {
|
|
8
|
+
[key: string]: unknown | null;
|
|
9
|
+
};
|
|
10
|
+
export type HandleOAuthCallback200 = {
|
|
11
|
+
/** User email address */
|
|
12
|
+
email: string;
|
|
13
|
+
/** User full name */
|
|
14
|
+
name?: string;
|
|
15
|
+
/** User profile picture URL */
|
|
16
|
+
picture?: string;
|
|
17
|
+
/** Auth provider used (Google) */
|
|
18
|
+
provider: string;
|
|
19
|
+
/** Unique ID from the provider */
|
|
20
|
+
providerId: string;
|
|
21
|
+
/** Original provider response */
|
|
22
|
+
rawProfile?: HandleOAuthCallback200RawProfile;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Auth provider used (Google)
|
|
26
|
+
*/
|
|
27
|
+
export type HandleOAuthCallbackBodyProvider = typeof HandleOAuthCallbackBodyProvider[keyof typeof HandleOAuthCallbackBodyProvider];
|
|
28
|
+
export declare const HandleOAuthCallbackBodyProvider: {
|
|
29
|
+
readonly Google: "Google";
|
|
30
|
+
};
|
|
31
|
+
export type HandleOAuthCallbackBody = {
|
|
32
|
+
/** Authorization code from OAuth provider */
|
|
33
|
+
code: string;
|
|
34
|
+
/** Auth provider used (Google) */
|
|
35
|
+
provider: HandleOAuthCallbackBodyProvider;
|
|
36
|
+
/** State parameter from OAuth flow */
|
|
37
|
+
state?: string;
|
|
38
|
+
};
|
|
39
|
+
export type GetAuthorizationUrl500 = {
|
|
40
|
+
error?: string;
|
|
41
|
+
};
|
|
42
|
+
export type GetAuthorizationUrl200 = {
|
|
43
|
+
/** Authorization URL to redirect user to */
|
|
44
|
+
url: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Auth provider used (Google)
|
|
48
|
+
*/
|
|
49
|
+
export type GetAuthorizationUrlBodyProvider = typeof GetAuthorizationUrlBodyProvider[keyof typeof GetAuthorizationUrlBodyProvider];
|
|
50
|
+
export declare const GetAuthorizationUrlBodyProvider: {
|
|
51
|
+
readonly Google: "Google";
|
|
52
|
+
};
|
|
53
|
+
export type GetAuthorizationUrlBody = {
|
|
54
|
+
/** Auth provider used (Google) */
|
|
55
|
+
provider: GetAuthorizationUrlBodyProvider;
|
|
56
|
+
/** OAuth scopes to request (default: ["openid", "email", "profile"]) */
|
|
57
|
+
scope?: string[];
|
|
58
|
+
/** State parameter for OAuth flow */
|
|
59
|
+
state?: string;
|
|
60
|
+
};
|
|
61
|
+
export type CreateStream500 = {
|
|
62
|
+
error?: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* LLM provider to use
|
|
66
|
+
*/
|
|
67
|
+
export type CreateStreamBodyProvider = typeof CreateStreamBodyProvider[keyof typeof CreateStreamBodyProvider];
|
|
68
|
+
export declare const CreateStreamBodyProvider: {
|
|
69
|
+
readonly Anthropic: "Anthropic";
|
|
70
|
+
readonly OpenAI: "OpenAI";
|
|
71
|
+
readonly Gemini: "Gemini";
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Schema for structured output
|
|
75
|
+
* @nullable
|
|
76
|
+
*/
|
|
77
|
+
export type CreateStreamBodyOutputSchema = unknown | null;
|
|
78
|
+
export type CreateStreamBodyOptions = {
|
|
79
|
+
/**
|
|
80
|
+
* Maximum tokens to generate
|
|
81
|
+
* @minimum 0
|
|
82
|
+
* @exclusiveMinimum
|
|
83
|
+
*/
|
|
84
|
+
maxTokens?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Sampling temperature (0-2)
|
|
87
|
+
* @minimum 0
|
|
88
|
+
* @maximum 2
|
|
89
|
+
*/
|
|
90
|
+
temperature?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Top-p sampling parameter
|
|
93
|
+
* @minimum 0
|
|
94
|
+
* @maximum 1
|
|
95
|
+
*/
|
|
96
|
+
topP?: number;
|
|
97
|
+
};
|
|
98
|
+
export type CreateStreamBody = {
|
|
99
|
+
/**
|
|
100
|
+
* Array of chat messages
|
|
101
|
+
* @minItems 1
|
|
102
|
+
*/
|
|
103
|
+
messages: CreateStreamBodyMessagesItem[];
|
|
104
|
+
/** Specific model to use (defaults to provider default) */
|
|
105
|
+
model?: string;
|
|
106
|
+
options?: CreateStreamBodyOptions;
|
|
107
|
+
/**
|
|
108
|
+
* Schema for structured output
|
|
109
|
+
* @nullable
|
|
110
|
+
*/
|
|
111
|
+
outputSchema?: CreateStreamBodyOutputSchema;
|
|
112
|
+
/** LLM provider to use */
|
|
113
|
+
provider: CreateStreamBodyProvider;
|
|
114
|
+
/** Whether to stream the response */
|
|
115
|
+
stream?: boolean;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Role of the message sender
|
|
119
|
+
*/
|
|
120
|
+
export type CreateStreamBodyMessagesItemRole = typeof CreateStreamBodyMessagesItemRole[keyof typeof CreateStreamBodyMessagesItemRole];
|
|
121
|
+
export declare const CreateStreamBodyMessagesItemRole: {
|
|
122
|
+
readonly user: "user";
|
|
123
|
+
readonly assistant: "assistant";
|
|
124
|
+
readonly system: "system";
|
|
125
|
+
};
|
|
126
|
+
export type CreateStreamBodyMessagesItemPartsItem = {
|
|
127
|
+
/** Filename for file parts */
|
|
128
|
+
filename?: string;
|
|
129
|
+
/** MIME type of the media */
|
|
130
|
+
mediaType?: string;
|
|
131
|
+
/** Text content */
|
|
132
|
+
text?: string;
|
|
133
|
+
/** Type of message part (text, file, etc.) */
|
|
134
|
+
type: string;
|
|
135
|
+
/** URL for file or media */
|
|
136
|
+
url?: string;
|
|
137
|
+
};
|
|
138
|
+
export type CreateStreamBodyMessagesItem = {
|
|
139
|
+
/** Content of the message */
|
|
140
|
+
content?: string;
|
|
141
|
+
/** Multi-part message content (for files, mixed content, etc.) */
|
|
142
|
+
parts?: CreateStreamBodyMessagesItemPartsItem[];
|
|
143
|
+
/** Role of the message sender */
|
|
144
|
+
role: CreateStreamBodyMessagesItemRole;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Token usage information
|
|
148
|
+
*/
|
|
149
|
+
export type GenerateText200Usage = {
|
|
150
|
+
completionTokens: number;
|
|
151
|
+
promptTokens: number;
|
|
152
|
+
totalTokens: number;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Structured output if schema provided
|
|
156
|
+
* @nullable
|
|
157
|
+
*/
|
|
158
|
+
export type GenerateText200Output = unknown | null;
|
|
159
|
+
export type GenerateText200 = {
|
|
160
|
+
/** Reason for completion */
|
|
161
|
+
finishReason: string;
|
|
162
|
+
/**
|
|
163
|
+
* Structured output if schema provided
|
|
164
|
+
* @nullable
|
|
165
|
+
*/
|
|
166
|
+
output?: GenerateText200Output;
|
|
167
|
+
/** Generated text content */
|
|
168
|
+
text: string;
|
|
169
|
+
/** Token usage information */
|
|
170
|
+
usage: GenerateText200Usage;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* LLM provider to use
|
|
174
|
+
*/
|
|
175
|
+
export type GenerateTextBodyProvider = typeof GenerateTextBodyProvider[keyof typeof GenerateTextBodyProvider];
|
|
176
|
+
export declare const GenerateTextBodyProvider: {
|
|
177
|
+
readonly Anthropic: "Anthropic";
|
|
178
|
+
readonly OpenAI: "OpenAI";
|
|
179
|
+
readonly Gemini: "Gemini";
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Schema for structured output
|
|
183
|
+
* @nullable
|
|
184
|
+
*/
|
|
185
|
+
export type GenerateTextBodyOutputSchema = unknown | null;
|
|
186
|
+
export type GenerateTextBodyOptions = {
|
|
187
|
+
/**
|
|
188
|
+
* Maximum tokens to generate
|
|
189
|
+
* @minimum 0
|
|
190
|
+
* @exclusiveMinimum
|
|
191
|
+
*/
|
|
192
|
+
maxTokens?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Sampling temperature (0-2)
|
|
195
|
+
* @minimum 0
|
|
196
|
+
* @maximum 2
|
|
197
|
+
*/
|
|
198
|
+
temperature?: number;
|
|
199
|
+
/**
|
|
200
|
+
* Top-p sampling parameter
|
|
201
|
+
* @minimum 0
|
|
202
|
+
* @maximum 1
|
|
203
|
+
*/
|
|
204
|
+
topP?: number;
|
|
205
|
+
};
|
|
206
|
+
export type GenerateTextBody = {
|
|
207
|
+
/**
|
|
208
|
+
* Array of chat messages
|
|
209
|
+
* @minItems 1
|
|
210
|
+
*/
|
|
211
|
+
messages: GenerateTextBodyMessagesItem[];
|
|
212
|
+
/** Specific model to use (defaults to provider default) */
|
|
213
|
+
model?: string;
|
|
214
|
+
options?: GenerateTextBodyOptions;
|
|
215
|
+
/**
|
|
216
|
+
* Schema for structured output
|
|
217
|
+
* @nullable
|
|
218
|
+
*/
|
|
219
|
+
outputSchema?: GenerateTextBodyOutputSchema;
|
|
220
|
+
/** LLM provider to use */
|
|
221
|
+
provider: GenerateTextBodyProvider;
|
|
222
|
+
/** Whether to stream the response */
|
|
223
|
+
stream?: boolean;
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Role of the message sender
|
|
227
|
+
*/
|
|
228
|
+
export type GenerateTextBodyMessagesItemRole = typeof GenerateTextBodyMessagesItemRole[keyof typeof GenerateTextBodyMessagesItemRole];
|
|
229
|
+
export declare const GenerateTextBodyMessagesItemRole: {
|
|
230
|
+
readonly user: "user";
|
|
231
|
+
readonly assistant: "assistant";
|
|
232
|
+
readonly system: "system";
|
|
233
|
+
};
|
|
234
|
+
export type GenerateTextBodyMessagesItemPartsItem = {
|
|
235
|
+
/** Filename for file parts */
|
|
236
|
+
filename?: string;
|
|
237
|
+
/** MIME type of the media */
|
|
238
|
+
mediaType?: string;
|
|
239
|
+
/** Text content */
|
|
240
|
+
text?: string;
|
|
241
|
+
/** Type of message part (text, file, etc.) */
|
|
242
|
+
type: string;
|
|
243
|
+
/** URL for file or media */
|
|
244
|
+
url?: string;
|
|
245
|
+
};
|
|
246
|
+
export type GenerateTextBodyMessagesItem = {
|
|
247
|
+
/** Content of the message */
|
|
248
|
+
content?: string;
|
|
249
|
+
/** Multi-part message content (for files, mixed content, etc.) */
|
|
250
|
+
parts?: GenerateTextBodyMessagesItemPartsItem[];
|
|
251
|
+
/** Role of the message sender */
|
|
252
|
+
role: GenerateTextBodyMessagesItemRole;
|
|
253
|
+
};
|
|
254
|
+
export declare const getIntegrationsAPI: () => {
|
|
255
|
+
generateText: (generateTextBody: GenerateTextBody) => Promise<GenerateText200>;
|
|
256
|
+
createStream: (createStreamBody: CreateStreamBody) => Promise<string>;
|
|
257
|
+
getAuthorizationUrl: (getAuthorizationUrlBody: GetAuthorizationUrlBody) => Promise<GetAuthorizationUrl200>;
|
|
258
|
+
handleOAuthCallback: (handleOAuthCallbackBody: HandleOAuthCallbackBody) => Promise<HandleOAuthCallback200>;
|
|
259
|
+
};
|
|
260
|
+
export type GenerateTextResult = NonNullable<Awaited<ReturnType<ReturnType<typeof getIntegrationsAPI>['generateText']>>>;
|
|
261
|
+
export type CreateStreamResult = NonNullable<Awaited<ReturnType<ReturnType<typeof getIntegrationsAPI>['createStream']>>>;
|
|
262
|
+
export type GetAuthorizationUrlResult = NonNullable<Awaited<ReturnType<ReturnType<typeof getIntegrationsAPI>['getAuthorizationUrl']>>>;
|
|
263
|
+
export type HandleOAuthCallbackResult = NonNullable<Awaited<ReturnType<ReturnType<typeof getIntegrationsAPI>['handleOAuthCallback']>>>;
|
|
264
|
+
//# sourceMappingURL=generated-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-api.d.ts","sourceRoot":"","sources":["../src/generated-api.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;CAAC,CAAC;AAE/E,MAAM,MAAM,sBAAsB,GAAG;IACnC,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC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defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getIntegrationsAPI = exports.GenerateTextBodyMessagesItemRole = exports.GenerateTextBodyProvider = exports.CreateStreamBodyMessagesItemRole = exports.CreateStreamBodyProvider = exports.GetAuthorizationUrlBodyProvider = exports.HandleOAuthCallbackBodyProvider = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Generated by orval v7.1.0 🍺
|
|
6
|
+
* Do not edit manually.
|
|
7
|
+
* Integrations API
|
|
8
|
+
* API for integrating with external services like LLMs, Stripe, etc.
|
|
9
|
+
* OpenAPI spec version: 1.0.0
|
|
10
|
+
*/
|
|
11
|
+
const http_client_1 = require("./http-client");
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
13
|
+
exports.HandleOAuthCallbackBodyProvider = {
|
|
14
|
+
Google: 'Google',
|
|
15
|
+
};
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
17
|
+
exports.GetAuthorizationUrlBodyProvider = {
|
|
18
|
+
Google: 'Google',
|
|
19
|
+
};
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
21
|
+
exports.CreateStreamBodyProvider = {
|
|
22
|
+
Anthropic: 'Anthropic',
|
|
23
|
+
OpenAI: 'OpenAI',
|
|
24
|
+
Gemini: 'Gemini',
|
|
25
|
+
};
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
27
|
+
exports.CreateStreamBodyMessagesItemRole = {
|
|
28
|
+
user: 'user',
|
|
29
|
+
assistant: 'assistant',
|
|
30
|
+
system: 'system',
|
|
31
|
+
};
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
33
|
+
exports.GenerateTextBodyProvider = {
|
|
34
|
+
Anthropic: 'Anthropic',
|
|
35
|
+
OpenAI: 'OpenAI',
|
|
36
|
+
Gemini: 'Gemini',
|
|
37
|
+
};
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
39
|
+
exports.GenerateTextBodyMessagesItemRole = {
|
|
40
|
+
user: 'user',
|
|
41
|
+
assistant: 'assistant',
|
|
42
|
+
system: 'system',
|
|
43
|
+
};
|
|
44
|
+
const getIntegrationsAPI = () => {
|
|
45
|
+
/**
|
|
46
|
+
* @summary Chat with LLM
|
|
47
|
+
*/
|
|
48
|
+
const generateText = (generateTextBody) => {
|
|
49
|
+
return (0, http_client_1.customAxios)({ url: `/llm/generateText`, method: 'POST',
|
|
50
|
+
headers: { 'Content-Type': 'application/json', },
|
|
51
|
+
data: generateTextBody
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Creates a Server-Sent Events (SSE) stream that returns UI message chunks. Each event contains JSON with types like "text-delta", "tool-call", "finish", etc. Compatible with Vercel AI SDK client libraries.
|
|
56
|
+
* @summary Stream text generation from LLM
|
|
57
|
+
*/
|
|
58
|
+
const createStream = (createStreamBody) => {
|
|
59
|
+
return (0, http_client_1.customAxios)({ url: `/llm/createStream`, method: 'POST',
|
|
60
|
+
headers: { 'Content-Type': 'application/json', },
|
|
61
|
+
data: createStreamBody
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Generate OAuth authorization URL for user sign-in
|
|
66
|
+
* @summary Get OAuth authorization URL
|
|
67
|
+
*/
|
|
68
|
+
const getAuthorizationUrl = (getAuthorizationUrlBody) => {
|
|
69
|
+
return (0, http_client_1.customAxios)({ url: `/oauth/getAuthorizationUrl`, method: 'POST',
|
|
70
|
+
headers: { 'Content-Type': 'application/json', },
|
|
71
|
+
data: getAuthorizationUrlBody
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Exchange OAuth authorization code for user profile information
|
|
76
|
+
* @summary Handle OAuth callback
|
|
77
|
+
*/
|
|
78
|
+
const handleOAuthCallback = (handleOAuthCallbackBody) => {
|
|
79
|
+
return (0, http_client_1.customAxios)({ url: `/oauth/handleOAuthCallback`, method: 'POST',
|
|
80
|
+
headers: { 'Content-Type': 'application/json', },
|
|
81
|
+
data: handleOAuthCallbackBody
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
return { generateText, createStream, getAuthorizationUrl, handleOAuthCallback };
|
|
85
|
+
};
|
|
86
|
+
exports.getIntegrationsAPI = getIntegrationsAPI;
|
|
87
|
+
//# sourceMappingURL=generated-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-api.js","sourceRoot":"","sources":["../src/generated-api.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,+CAA4C;AA+B5C,2DAA2D;AAC9C,QAAA,+BAA+B,GAAG;IAC7C,MAAM,EAAE,QAAQ;CACR,CAAC;AA0BX,2DAA2D;AAC9C,QAAA,+BAA+B,GAAG;IAC7C,MAAM,EAAE,QAAQ;CACR,CAAC;AAqBX,2DAA2D;AAC9C,QAAA,wBAAwB,GAAG;IACtC,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAC;AAuDX,2DAA2D;AAC9C,QAAA,gCAAgC,GAAG;IAC9C,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AA2DX,2DAA2D;AAC9C,QAAA,wBAAwB,GAAG;IACtC,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAC;AAuDX,2DAA2D;AAC9C,QAAA,gCAAgC,GAAG;IAC9C,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AA4BF,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACzC;;OAEG;IACH,MAAM,YAAY,GAAG,CACjB,gBAAkC,EACnC,EAAE;QACC,OAAO,IAAA,yBAAW,EAClB,EAAC,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM;YACzC,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,GAAG;YAC/C,IAAI,EAAE,gBAAgB;SACvB,CACE,CAAC;IACJ,CAAC,CAAA;IAEL;;;OAGG;IACH,MAAM,YAAY,GAAG,CACjB,gBAAkC,EACnC,EAAE;QACC,OAAO,IAAA,yBAAW,EAClB,EAAC,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM;YACzC,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,GAAG;YAC/C,IAAI,EAAE,gBAAgB;SACvB,CACE,CAAC;IACJ,CAAC,CAAA;IAEL;;;OAGG;IACH,MAAM,mBAAmB,GAAG,CACxB,uBAAgD,EACjD,EAAE;QACC,OAAO,IAAA,yBAAW,EAClB,EAAC,GAAG,EAAE,4BAA4B,EAAE,MAAM,EAAE,MAAM;YAClD,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,GAAG;YAC/C,IAAI,EAAE,uBAAuB;SAC9B,CACE,CAAC;IACJ,CAAC,CAAA;IAEL;;;OAGG;IACH,MAAM,mBAAmB,GAAG,CACxB,uBAAgD,EACjD,EAAE;QACC,OAAO,IAAA,yBAAW,EAClB,EAAC,GAAG,EAAE,4BAA4B,EAAE,MAAM,EAAE,MAAM;YAClD,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,GAAG;YAC/C,IAAI,EAAE,uBAAuB;SAC9B,CACE,CAAC;IACJ,CAAC,CAAA;IAEL,OAAO,EAAC,YAAY,EAAC,YAAY,EAAC,mBAAmB,EAAC,mBAAmB,EAAC,CAAA;AAAA,CAAC,CAAC;AA5D7D,QAAA,kBAAkB,sBA4D2C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* Custom Axios wrapper that handles different response types based on OpenAPI spec
|
|
4
|
+
* - JSON: Returns data directly (backward compatible)
|
|
5
|
+
* - Stream: Returns full AxiosResponse with stream for piping
|
|
6
|
+
* - Binary: Returns full AxiosResponse with arraybuffer
|
|
7
|
+
*/
|
|
8
|
+
export declare const customAxios: <T>(config: AxiosRequestConfig) => Promise<T>;
|
|
9
|
+
//# sourceMappingURL=http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAuBlD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAU,CAAC,EACjC,QAAQ,kBAAkB,KACzB,OAAO,CAAC,CAAC,CAmBX,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.customAxios = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const response_type_map_1 = require("./response-type-map");
|
|
9
|
+
const axiosInstance = axios_1.default.create();
|
|
10
|
+
axiosInstance.interceptors.request.use(config => {
|
|
11
|
+
const baseURL = process.env['INTEGRATION_BASE_URL'];
|
|
12
|
+
if (baseURL) {
|
|
13
|
+
config.baseURL = baseURL;
|
|
14
|
+
}
|
|
15
|
+
const nodeEnv = process.env['NODE_ENV'] === 'production' ? 'production' : 'development';
|
|
16
|
+
const accessKey = process.env['PROJECT_ACCESS_KEY'];
|
|
17
|
+
const tenantId = process.env['TENANT_ID'];
|
|
18
|
+
if (accessKey) {
|
|
19
|
+
config.headers = config.headers || {};
|
|
20
|
+
config.headers['x-project-access-key'] = accessKey;
|
|
21
|
+
config.headers['x-app-env'] = nodeEnv;
|
|
22
|
+
config.headers['x-tenant-id'] = tenantId;
|
|
23
|
+
}
|
|
24
|
+
return config;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Custom Axios wrapper that handles different response types based on OpenAPI spec
|
|
28
|
+
* - JSON: Returns data directly (backward compatible)
|
|
29
|
+
* - Stream: Returns full AxiosResponse with stream for piping
|
|
30
|
+
* - Binary: Returns full AxiosResponse with arraybuffer
|
|
31
|
+
*/
|
|
32
|
+
const customAxios = async (config) => {
|
|
33
|
+
// Detect response type from OpenAPI spec via response-type-map
|
|
34
|
+
const responseType = (0, response_type_map_1.getResponseTypeFromUrl)(config.url || '');
|
|
35
|
+
if (responseType === 'stream') {
|
|
36
|
+
// For streaming (SSE): return full response so headers and stream are accessible
|
|
37
|
+
config.responseType = 'stream';
|
|
38
|
+
const response = await axiosInstance(config);
|
|
39
|
+
return response; // Return full AxiosResponse for piping
|
|
40
|
+
}
|
|
41
|
+
else if (responseType === 'arraybuffer') {
|
|
42
|
+
// For binary data (audio, video, images): return full response for headers and arraybuffer
|
|
43
|
+
config.responseType = 'arraybuffer';
|
|
44
|
+
const response = await axiosInstance(config);
|
|
45
|
+
return response; // Return full AxiosResponse
|
|
46
|
+
}
|
|
47
|
+
// For JSON: just return data (existing behavior, backward compatible)
|
|
48
|
+
const { data } = await axiosInstance(config);
|
|
49
|
+
return data;
|
|
50
|
+
};
|
|
51
|
+
exports.customAxios = customAxios;
|
|
52
|
+
//# sourceMappingURL=http-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../src/http-client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAkD;AAClD,2DAA6D;AAE7D,MAAM,aAAa,GAAG,eAAK,CAAC,MAAM,EAAE,CAAC;AAErC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;IAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpD,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,CAAC,OAAO,GAAG,OA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,sEAAsE;IACtE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AArBW,QAAA,WAAW,eAqBtB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { CreateStreamBody, GenerateText200, GenerateTextBody, GenerateTextBodyProvider, GetAuthorizationUrl200, GetAuthorizationUrlBody, GetAuthorizationUrlBodyProvider, HandleOAuthCallback200, HandleOAuthCallbackBody } from './generated-api';
|
|
2
|
+
import { AxiosResponse } from 'axios';
|
|
3
|
+
/**
|
|
4
|
+
* UPTIQ Integrations SDK
|
|
5
|
+
*
|
|
6
|
+
* Auto-generated from OpenAPI specification.
|
|
7
|
+
* Do not edit this file manually - it will be overwritten on next generation.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Llm integration module
|
|
11
|
+
*/
|
|
12
|
+
export declare class Llm {
|
|
13
|
+
private config;
|
|
14
|
+
private api;
|
|
15
|
+
constructor(options: {
|
|
16
|
+
provider: LlmProvider;
|
|
17
|
+
});
|
|
18
|
+
getConfig(): {
|
|
19
|
+
provider: LlmProvider;
|
|
20
|
+
};
|
|
21
|
+
/** Chat with LLM */
|
|
22
|
+
generateText(body: Omit<GenerateTextBody, 'provider'>): Promise<GenerateText200>;
|
|
23
|
+
/** Stream text generation from LLM */
|
|
24
|
+
createStream(body: Omit<CreateStreamBody, 'provider'>): Promise<AxiosResponse>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* OAuth integration module
|
|
28
|
+
*/
|
|
29
|
+
export declare class OAuth {
|
|
30
|
+
private config;
|
|
31
|
+
private api;
|
|
32
|
+
constructor(options: {
|
|
33
|
+
provider: OAuthProvider;
|
|
34
|
+
});
|
|
35
|
+
getConfig(): {
|
|
36
|
+
provider: OAuthProvider;
|
|
37
|
+
};
|
|
38
|
+
/** Get OAuth authorization URL */
|
|
39
|
+
getAuthorizationUrl(body: Omit<GetAuthorizationUrlBody, 'provider'>): Promise<GetAuthorizationUrl200>;
|
|
40
|
+
/** Handle OAuth callback */
|
|
41
|
+
handleOAuthCallback(body: Omit<HandleOAuthCallbackBody, 'provider'>): Promise<HandleOAuthCallback200>;
|
|
42
|
+
}
|
|
43
|
+
export * from './generated-api';
|
|
44
|
+
/**
|
|
45
|
+
* Llm provider type alias
|
|
46
|
+
* Friendly name for GenerateTextBodyProvider
|
|
47
|
+
*/
|
|
48
|
+
export type LlmProvider = GenerateTextBodyProvider;
|
|
49
|
+
export declare const LlmProvider: {
|
|
50
|
+
readonly Anthropic: "Anthropic";
|
|
51
|
+
readonly OpenAI: "OpenAI";
|
|
52
|
+
readonly Gemini: "Gemini";
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* OAuth provider type alias
|
|
56
|
+
* Friendly name for GetAuthorizationUrlBodyProvider
|
|
57
|
+
*/
|
|
58
|
+
export type OAuthProvider = GetAuthorizationUrlBodyProvider;
|
|
59
|
+
export declare const OAuthProvider: {
|
|
60
|
+
readonly Google: "Google";
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AACvQ,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC;;;;;GAKG;AAEH;;GAEG;AACH,qBAAa,GAAG;IACd,OAAO,CAAC,MAAM,CAEZ;IACF,OAAO,CAAC,GAAG,CAAwC;gBAEvC,OAAO,EAAE;QACnB,QAAQ,EAAE,WAAW,CAAC;KACvB;IASD,SAAS;kBAfG,WAAW;;IAoBvB,oBAAoB;IACpB,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAKhF,sCAAsC;IACtC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC;CAG/E;AAED;;GAEG;AACH,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAEZ;IACF,OAAO,CAAC,GAAG,CAAwC;gBAEvC,OAAO,EAAE;QACnB,QAAQ,EAAE,aAAa,CAAC;KACzB;IASD,SAAS;kBAfG,aAAa;;IAoBzB,kCAAkC;IAClC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAKrG,4BAA4B;IAC5B,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAGtG;AAGD,cAAc,iBAAiB,CAAC;AAIhC;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,wBAAwB,CAAC;AACnD,eAAO,MAAM,WAAW;;;;CAA2B,CAAC;AACpD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,+BAA+B,CAAC;AAC5D,eAAO,MAAM,aAAa;;CAAkC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.OAuthProvider = exports.LlmProvider = exports.OAuth = exports.Llm = void 0;
|
|
18
|
+
const generated_api_1 = require("./generated-api");
|
|
19
|
+
/**
|
|
20
|
+
* UPTIQ Integrations SDK
|
|
21
|
+
*
|
|
22
|
+
* Auto-generated from OpenAPI specification.
|
|
23
|
+
* Do not edit this file manually - it will be overwritten on next generation.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Llm integration module
|
|
27
|
+
*/
|
|
28
|
+
class Llm {
|
|
29
|
+
constructor(options) {
|
|
30
|
+
// Store config for this instance
|
|
31
|
+
this.config = options;
|
|
32
|
+
// Get the generated API methods
|
|
33
|
+
this.api = (0, generated_api_1.getIntegrationsAPI)();
|
|
34
|
+
}
|
|
35
|
+
// Get the current configuration
|
|
36
|
+
getConfig() {
|
|
37
|
+
return this.config;
|
|
38
|
+
}
|
|
39
|
+
/** Chat with LLM */
|
|
40
|
+
generateText(body) {
|
|
41
|
+
return this.api.generateText({ ...body, ...this.config });
|
|
42
|
+
}
|
|
43
|
+
/** Stream text generation from LLM */
|
|
44
|
+
createStream(body) {
|
|
45
|
+
return this.api.createStream({ ...body, ...this.config });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.Llm = Llm;
|
|
49
|
+
/**
|
|
50
|
+
* OAuth integration module
|
|
51
|
+
*/
|
|
52
|
+
class OAuth {
|
|
53
|
+
constructor(options) {
|
|
54
|
+
// Store config for this instance
|
|
55
|
+
this.config = options;
|
|
56
|
+
// Get the generated API methods
|
|
57
|
+
this.api = (0, generated_api_1.getIntegrationsAPI)();
|
|
58
|
+
}
|
|
59
|
+
// Get the current configuration
|
|
60
|
+
getConfig() {
|
|
61
|
+
return this.config;
|
|
62
|
+
}
|
|
63
|
+
/** Get OAuth authorization URL */
|
|
64
|
+
getAuthorizationUrl(body) {
|
|
65
|
+
return this.api.getAuthorizationUrl({ ...body, ...this.config });
|
|
66
|
+
}
|
|
67
|
+
/** Handle OAuth callback */
|
|
68
|
+
handleOAuthCallback(body) {
|
|
69
|
+
return this.api.handleOAuthCallback({ ...body, ...this.config });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.OAuth = OAuth;
|
|
73
|
+
// Re-export all types from generated API
|
|
74
|
+
__exportStar(require("./generated-api"), exports);
|
|
75
|
+
exports.LlmProvider = generated_api_1.GenerateTextBodyProvider;
|
|
76
|
+
exports.OAuthProvider = generated_api_1.GetAuthorizationUrlBodyProvider;
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAuQ;AAGvQ;;;;;GAKG;AAEH;;GAEG;AACH,MAAa,GAAG;IAMd,YAAY,OAEX;QACC,iCAAiC;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,gCAAgC;QAChC,IAAI,CAAC,GAAG,GAAG,IAAA,kCAAkB,GAAE,CAAC;IAClC,CAAC;IAGD,gCAAgC;IAChC,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAGD,oBAAoB;IACpB,YAAY,CAAC,IAAwC;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAAsB,CAAC,CAAC;IAChF,CAAC;IAGD,sCAAsC;IACtC,YAAY,CAAC,IAAwC;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAAsB,CAAsC,CAAC;IACrH,CAAC;CACF;AAhCD,kBAgCC;AAED;;GAEG;AACH,MAAa,KAAK;IAMhB,YAAY,OAEX;QACC,iCAAiC;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;QACtB,gCAAgC;QAChC,IAAI,CAAC,GAAG,GAAG,IAAA,kCAAkB,GAAE,CAAC;IAClC,CAAC;IAGD,gCAAgC;IAChC,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAGD,kCAAkC;IAClC,mBAAmB,CAAC,IAA+C;QACjE,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAA6B,CAAC,CAAC;IAC9F,CAAC;IAGD,4BAA4B;IAC5B,mBAAmB,CAAC,IAA+C;QACjE,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,EAA6B,CAAC,CAAC;IAC9F,CAAC;CACF;AAhCD,sBAgCC;AAED,yCAAyC;AACzC,kDAAgC;AASnB,QAAA,WAAW,GAAG,wCAAwB,CAAC;AAMvC,QAAA,aAAa,GAAG,+CAA+B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response Type Mapping
|
|
3
|
+
*
|
|
4
|
+
* Auto-generated from OpenAPI specification.
|
|
5
|
+
* Maps operation IDs to their expected Axios response types.
|
|
6
|
+
*
|
|
7
|
+
* DO NOT EDIT - regenerated on each build.
|
|
8
|
+
*/
|
|
9
|
+
export declare const RESPONSE_TYPE_MAP: Record<string, 'json' | 'stream' | 'arraybuffer'>;
|
|
10
|
+
export declare const OPERATION_PATHS: Record<string, string>;
|
|
11
|
+
/**
|
|
12
|
+
* Get the response type for a given operation ID
|
|
13
|
+
*/
|
|
14
|
+
export declare function getResponseType(operationId: string): 'json' | 'stream' | 'arraybuffer';
|
|
15
|
+
/**
|
|
16
|
+
* Get response type from URL by matching against operation paths
|
|
17
|
+
*/
|
|
18
|
+
export declare function getResponseTypeFromUrl(url: string): 'json' | 'stream' | 'arraybuffer';
|
|
19
|
+
//# sourceMappingURL=response-type-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-type-map.d.ts","sourceRoot":"","sources":["../src/response-type-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,aAAa,CAK/E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKlD,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,CAEtF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,aAAa,CAsBrF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Response Type Mapping
|
|
4
|
+
*
|
|
5
|
+
* Auto-generated from OpenAPI specification.
|
|
6
|
+
* Maps operation IDs to their expected Axios response types.
|
|
7
|
+
*
|
|
8
|
+
* DO NOT EDIT - regenerated on each build.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.OPERATION_PATHS = exports.RESPONSE_TYPE_MAP = void 0;
|
|
12
|
+
exports.getResponseType = getResponseType;
|
|
13
|
+
exports.getResponseTypeFromUrl = getResponseTypeFromUrl;
|
|
14
|
+
exports.RESPONSE_TYPE_MAP = {
|
|
15
|
+
"generateText": "json",
|
|
16
|
+
"createStream": "stream",
|
|
17
|
+
"getAuthorizationUrl": "json",
|
|
18
|
+
"handleOAuthCallback": "json"
|
|
19
|
+
};
|
|
20
|
+
exports.OPERATION_PATHS = {
|
|
21
|
+
"generateText": "/llm/generateText",
|
|
22
|
+
"createStream": "/llm/createStream",
|
|
23
|
+
"getAuthorizationUrl": "/oauth/getAuthorizationUrl",
|
|
24
|
+
"handleOAuthCallback": "/oauth/handleOAuthCallback"
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Get the response type for a given operation ID
|
|
28
|
+
*/
|
|
29
|
+
function getResponseType(operationId) {
|
|
30
|
+
return exports.RESPONSE_TYPE_MAP[operationId] || 'json';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get response type from URL by matching against operation paths
|
|
34
|
+
*/
|
|
35
|
+
function getResponseTypeFromUrl(url) {
|
|
36
|
+
// Clean URL (handle empty or undefined)
|
|
37
|
+
if (!url)
|
|
38
|
+
return 'json';
|
|
39
|
+
const cleanUrl = url.split('?')[0];
|
|
40
|
+
// Try to match by operationId in URL
|
|
41
|
+
for (const [opId, responseType] of Object.entries(exports.RESPONSE_TYPE_MAP)) {
|
|
42
|
+
const opPath = exports.OPERATION_PATHS[opId];
|
|
43
|
+
// Check if URL contains the operation path
|
|
44
|
+
if (opPath && cleanUrl && cleanUrl.includes(opPath)) {
|
|
45
|
+
return responseType;
|
|
46
|
+
}
|
|
47
|
+
// Fallback: check if operationId is in URL
|
|
48
|
+
if (cleanUrl && cleanUrl.includes(opId)) {
|
|
49
|
+
return responseType;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return 'json'; // default fallback
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=response-type-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-type-map.js","sourceRoot":"","sources":["../src/response-type-map.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;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|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SDK for UPTIQ integrations",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"download:swagger": "bash scripts/download-swagger.sh",
|
|
12
|
+
"generate:api": "orval",
|
|
13
|
+
"generate:wrapper": "node scripts/generate-wrapper.ts",
|
|
14
|
+
"generate": "yarn generate:api && yarn generate:wrapper",
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"prepublishOnly": "yarn generate && yarn build",
|
|
17
|
+
"dev": "tsc --watch",
|
|
18
|
+
"lint": "eslint src/**/*.ts",
|
|
19
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
20
|
+
"format": "prettier --write src/**/*.ts",
|
|
21
|
+
"format:check": "prettier --check src/**/*.ts",
|
|
22
|
+
"clean": "rm -rf dist",
|
|
23
|
+
"prebuild": "yarn clean"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"samuel",
|
|
27
|
+
"integrations",
|
|
28
|
+
"sdk"
|
|
29
|
+
],
|
|
30
|
+
"author": "UPTIQ",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"orval": "7.1.0",
|
|
34
|
+
"@types/node": "^24.0.3",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.35.0",
|
|
36
|
+
"@typescript-eslint/parser": "^8.35.0",
|
|
37
|
+
"eslint": "^9.29.0",
|
|
38
|
+
"eslint-config-prettier": "^10.1.5",
|
|
39
|
+
"eslint-plugin-prettier": "^5.5.0",
|
|
40
|
+
"prettier": "^3.6.0",
|
|
41
|
+
"typescript": "^5.8.3"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"axios": "^1.6.0",
|
|
45
|
+
"zod": "^4.0.10"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"registry": "https://registry.npmjs.org/",
|
|
49
|
+
"access": "public"
|
|
50
|
+
}
|
|
51
|
+
}
|