samuel-integrations-sdk 0.0.6 → 0.0.7
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 +5 -109
- package/dist/generated-api.d.ts +19 -45
- package/dist/generated-api.d.ts.map +1 -1
- package/dist/generated-api.js +12 -27
- package/dist/generated-api.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# Samuel Agent Types SDK
|
|
2
2
|
|
|
3
|
-
A TypeScript SDK for
|
|
3
|
+
A TypeScript SDK for Agent Builder types, providing type-safe interfaces and utilities.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- 🎯 **TypeScript First**:
|
|
8
|
-
- 🔧 **
|
|
9
|
-
- 📦 **
|
|
10
|
-
- 🚀 **
|
|
11
|
-
- 🔐 **Type-safe**: Full TypeScript support with strict type checking
|
|
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
|
|
12
11
|
|
|
13
12
|
## Installation
|
|
14
13
|
|
|
@@ -18,66 +17,6 @@ npm install samuel-agent-types-sdk
|
|
|
18
17
|
yarn add samuel-agent-types-sdk
|
|
19
18
|
```
|
|
20
19
|
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
### Basic Usage with Environment Variables
|
|
24
|
-
|
|
25
|
-
Set environment variables:
|
|
26
|
-
```bash
|
|
27
|
-
export INTEGRATION_BASE_URL="https://api.example.com"
|
|
28
|
-
export PROJECT_ACCESS_KEY="your-access-key"
|
|
29
|
-
export DEFAULT_MODEL_ID="gpt-4"
|
|
30
|
-
export DEFAULT_PROVIDER="openai"
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Use the default instance:
|
|
34
|
-
```typescript
|
|
35
|
-
import { llm } from 'samuel-agent-types-sdk';
|
|
36
|
-
|
|
37
|
-
// ModelId and provider come from env vars
|
|
38
|
-
const response = await llm.generate({
|
|
39
|
-
messages: [
|
|
40
|
-
{ role: 'user', content: 'Hello!' }
|
|
41
|
-
]
|
|
42
|
-
});
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Custom Instance with Config
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
import { Llm } from 'samuel-agent-types-sdk';
|
|
49
|
-
|
|
50
|
-
const llm = new Llm({
|
|
51
|
-
accessKey: 'custom-access-key',
|
|
52
|
-
baseUrl: 'https://custom-api.example.com',
|
|
53
|
-
modelId: 'claude-3-opus-20240229',
|
|
54
|
-
provider: 'anthropic'
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Uses the config from constructor
|
|
58
|
-
const response = await llm.generate({
|
|
59
|
-
messages: [
|
|
60
|
-
{ role: 'user', content: 'Hello!' }
|
|
61
|
-
]
|
|
62
|
-
// model and provider will use defaults from constructor if not specified
|
|
63
|
-
});
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Override Defaults Per Call
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
import { llm } from 'samuel-agent-types-sdk';
|
|
70
|
-
|
|
71
|
-
// Override the default provider for this specific call
|
|
72
|
-
const response = await llm.generate({
|
|
73
|
-
messages: [
|
|
74
|
-
{ role: 'user', content: 'Hello!' }
|
|
75
|
-
],
|
|
76
|
-
provider: 'gemini', // Override default
|
|
77
|
-
model: 'gemini-pro' // Override default
|
|
78
|
-
});
|
|
79
|
-
```
|
|
80
|
-
|
|
81
20
|
## Development
|
|
82
21
|
|
|
83
22
|
### Prerequisites
|
|
@@ -102,49 +41,6 @@ const response = await llm.generate({
|
|
|
102
41
|
- `yarn format` - Format code with Prettier
|
|
103
42
|
- `yarn format:check` - Check code formatting
|
|
104
43
|
- `yarn clean` - Clean build artifacts
|
|
105
|
-
- `yarn download:swagger` - Download the latest OpenAPI spec
|
|
106
|
-
- `yarn generate` - Generate SDK wrapper from OpenAPI spec
|
|
107
|
-
- `yarn generate:types` - Generate TypeScript types from OpenAPI spec
|
|
108
|
-
|
|
109
|
-
### Adding Integration-Specific Defaults
|
|
110
|
-
|
|
111
|
-
To add default configuration for an integration, edit `sdk-config.json`:
|
|
112
|
-
|
|
113
|
-
```json
|
|
114
|
-
{
|
|
115
|
-
"llm": {
|
|
116
|
-
"defaults": {
|
|
117
|
-
"modelId": {
|
|
118
|
-
"envVar": "DEFAULT_MODEL_ID",
|
|
119
|
-
"type": "string",
|
|
120
|
-
"description": "Default model ID to use for LLM calls"
|
|
121
|
-
},
|
|
122
|
-
"provider": {
|
|
123
|
-
"envVar": "DEFAULT_PROVIDER",
|
|
124
|
-
"type": "string",
|
|
125
|
-
"description": "Default provider to use"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"applyDefaults": {
|
|
129
|
-
"generate": {
|
|
130
|
-
"model": "modelId",
|
|
131
|
-
"provider": "provider"
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
The `defaults` object defines:
|
|
139
|
-
- Configuration field name (e.g., `modelId`)
|
|
140
|
-
- Environment variable to use as fallback (e.g., `DEFAULT_MODEL_ID`)
|
|
141
|
-
- Type and description
|
|
142
|
-
|
|
143
|
-
The `applyDefaults` object maps operation names to parameter mappings:
|
|
144
|
-
- Key: operation name from OpenAPI (e.g., `generate`)
|
|
145
|
-
- Value: mapping of API parameter name to config field name
|
|
146
|
-
|
|
147
|
-
After modifying `sdk-config.json`, run `yarn generate` to regenerate the SDK wrapper.
|
|
148
44
|
|
|
149
45
|
### Project Structure
|
|
150
46
|
|
package/dist/generated-api.d.ts
CHANGED
|
@@ -1,61 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
* Auth provider to use (defaults to Google)
|
|
3
|
-
*/
|
|
4
|
-
export type GetAuthorizationUrlBodyProvider = typeof GetAuthorizationUrlBodyProvider[keyof typeof GetAuthorizationUrlBodyProvider];
|
|
5
|
-
export declare const GetAuthorizationUrlBodyProvider: {
|
|
6
|
-
readonly Google: "Google";
|
|
7
|
-
readonly EmailPassword: "EmailPassword";
|
|
8
|
-
};
|
|
9
|
-
export type GetAuthorizationUrlBody = {
|
|
10
|
-
/** Auth provider to use (defaults to Google) */
|
|
11
|
-
provider?: GetAuthorizationUrlBodyProvider;
|
|
1
|
+
export type GetGoogleAuthorizationUrlBody = {
|
|
12
2
|
/** State parameter for OAuth flow */
|
|
13
3
|
state?: string;
|
|
14
|
-
/**
|
|
15
|
-
redirectUri
|
|
16
|
-
/** OAuth scopes to request */
|
|
4
|
+
/** Redirect URI where user will be sent after OAuth authorization */
|
|
5
|
+
redirectUri: string;
|
|
6
|
+
/** OAuth scopes to request (default: ["openid", "email", "profile"]) */
|
|
17
7
|
scope?: string[];
|
|
18
8
|
};
|
|
19
|
-
export type
|
|
9
|
+
export type GetGoogleAuthorizationUrl200 = {
|
|
20
10
|
/** Authorization URL to redirect user to */
|
|
21
11
|
url: string;
|
|
22
12
|
};
|
|
23
|
-
export type
|
|
13
|
+
export type GetGoogleAuthorizationUrl500 = {
|
|
24
14
|
error?: string;
|
|
25
15
|
};
|
|
26
|
-
|
|
27
|
-
* Auth provider to use (defaults to Google)
|
|
28
|
-
*/
|
|
29
|
-
export type HandleOAuthCallbackBodyProvider = typeof HandleOAuthCallbackBodyProvider[keyof typeof HandleOAuthCallbackBodyProvider];
|
|
30
|
-
export declare const HandleOAuthCallbackBodyProvider: {
|
|
31
|
-
readonly Google: "Google";
|
|
32
|
-
readonly EmailPassword: "EmailPassword";
|
|
33
|
-
};
|
|
34
|
-
export type HandleOAuthCallbackBody = {
|
|
35
|
-
/** Auth provider to use (defaults to Google) */
|
|
36
|
-
provider?: HandleOAuthCallbackBodyProvider;
|
|
16
|
+
export type HandleGoogleOAuthCallbackBody = {
|
|
37
17
|
/** Authorization code from OAuth provider */
|
|
38
18
|
code: string;
|
|
39
19
|
/** State parameter from OAuth flow */
|
|
40
20
|
state?: string;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* Auth provider used
|
|
44
|
-
*/
|
|
45
|
-
export type HandleOAuthCallback200Provider = typeof HandleOAuthCallback200Provider[keyof typeof HandleOAuthCallback200Provider];
|
|
46
|
-
export declare const HandleOAuthCallback200Provider: {
|
|
47
|
-
readonly Google: "Google";
|
|
48
|
-
readonly EmailPassword: "EmailPassword";
|
|
21
|
+
/** Same redirect URI used in authorization request (must match) */
|
|
22
|
+
redirectUri: string;
|
|
49
23
|
};
|
|
50
24
|
/**
|
|
51
25
|
* Original provider response
|
|
52
26
|
*/
|
|
53
|
-
export type
|
|
27
|
+
export type HandleGoogleOAuthCallback200RawProfile = {
|
|
54
28
|
[key: string]: unknown | null;
|
|
55
29
|
};
|
|
56
|
-
export type
|
|
57
|
-
/** Auth provider used */
|
|
58
|
-
provider:
|
|
30
|
+
export type HandleGoogleOAuthCallback200 = {
|
|
31
|
+
/** Auth provider used (Google) */
|
|
32
|
+
provider: string;
|
|
59
33
|
/** Unique ID from the provider */
|
|
60
34
|
providerId: string;
|
|
61
35
|
/** User email address */
|
|
@@ -65,9 +39,9 @@ export type HandleOAuthCallback200 = {
|
|
|
65
39
|
/** User profile picture URL */
|
|
66
40
|
picture?: string;
|
|
67
41
|
/** Original provider response */
|
|
68
|
-
rawProfile?:
|
|
42
|
+
rawProfile?: HandleGoogleOAuthCallback200RawProfile;
|
|
69
43
|
};
|
|
70
|
-
export type
|
|
44
|
+
export type HandleGoogleOAuthCallback500 = {
|
|
71
45
|
error?: string;
|
|
72
46
|
};
|
|
73
47
|
/**
|
|
@@ -216,13 +190,13 @@ export type CreateStream500 = {
|
|
|
216
190
|
error?: string;
|
|
217
191
|
};
|
|
218
192
|
export declare const getIntegrationsAPI: () => {
|
|
219
|
-
|
|
220
|
-
|
|
193
|
+
getGoogleAuthorizationUrl: (getGoogleAuthorizationUrlBody: GetGoogleAuthorizationUrlBody) => Promise<GetGoogleAuthorizationUrl200>;
|
|
194
|
+
handleGoogleOAuthCallback: (handleGoogleOAuthCallbackBody: HandleGoogleOAuthCallbackBody) => Promise<HandleGoogleOAuthCallback200>;
|
|
221
195
|
generateText: (generateTextBody: GenerateTextBody) => Promise<GenerateText200>;
|
|
222
196
|
createStream: (createStreamBody: CreateStreamBody) => Promise<string>;
|
|
223
197
|
};
|
|
224
|
-
export type
|
|
225
|
-
export type
|
|
198
|
+
export type GetGoogleAuthorizationUrlResult = NonNullable<Awaited<ReturnType<ReturnType<typeof getIntegrationsAPI>['getGoogleAuthorizationUrl']>>>;
|
|
199
|
+
export type HandleGoogleOAuthCallbackResult = NonNullable<Awaited<ReturnType<ReturnType<typeof getIntegrationsAPI>['handleGoogleOAuthCallback']>>>;
|
|
226
200
|
export type GenerateTextResult = NonNullable<Awaited<ReturnType<ReturnType<typeof getIntegrationsAPI>['generateText']>>>;
|
|
227
201
|
export type CreateStreamResult = NonNullable<Awaited<ReturnType<ReturnType<typeof getIntegrationsAPI>['createStream']>>>;
|
|
228
202
|
//# sourceMappingURL=generated-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated-api.d.ts","sourceRoot":"","sources":["../src/generated-api.ts"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"generated-api.d.ts","sourceRoot":"","sources":["../src/generated-api.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,4BAA4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CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AACxH,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
package/dist/generated-api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIntegrationsAPI = exports.CreateStreamBodyProvider = exports.CreateStreamBodyMessagesItemRole = exports.GenerateTextBodyProvider = exports.GenerateTextBodyMessagesItemRole =
|
|
3
|
+
exports.getIntegrationsAPI = exports.CreateStreamBodyProvider = exports.CreateStreamBodyMessagesItemRole = exports.GenerateTextBodyProvider = exports.GenerateTextBodyMessagesItemRole = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Generated by orval v7.21.0 🍺
|
|
6
6
|
* Do not edit manually.
|
|
@@ -10,21 +10,6 @@ exports.getIntegrationsAPI = exports.CreateStreamBodyProvider = exports.CreateSt
|
|
|
10
10
|
*/
|
|
11
11
|
const http_client_1 = require("./http-client");
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
13
|
-
exports.GetAuthorizationUrlBodyProvider = {
|
|
14
|
-
Google: 'Google',
|
|
15
|
-
EmailPassword: 'EmailPassword',
|
|
16
|
-
};
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
18
|
-
exports.HandleOAuthCallbackBodyProvider = {
|
|
19
|
-
Google: 'Google',
|
|
20
|
-
EmailPassword: 'EmailPassword',
|
|
21
|
-
};
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
23
|
-
exports.HandleOAuthCallback200Provider = {
|
|
24
|
-
Google: 'Google',
|
|
25
|
-
EmailPassword: 'EmailPassword',
|
|
26
|
-
};
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
28
13
|
exports.GenerateTextBodyMessagesItemRole = {
|
|
29
14
|
user: 'user',
|
|
30
15
|
assistant: 'assistant',
|
|
@@ -50,23 +35,23 @@ exports.CreateStreamBodyProvider = {
|
|
|
50
35
|
};
|
|
51
36
|
const getIntegrationsAPI = () => {
|
|
52
37
|
/**
|
|
53
|
-
* Generate
|
|
54
|
-
* @summary Get OAuth authorization URL
|
|
38
|
+
* Generate a Google OAuth authorization URL for user sign-in
|
|
39
|
+
* @summary Get Google OAuth authorization URL
|
|
55
40
|
*/
|
|
56
|
-
const
|
|
57
|
-
return (0, http_client_1.customAxios)({ url: `/auth/getAuthorizationUrl`, method: 'POST',
|
|
41
|
+
const getGoogleAuthorizationUrl = (getGoogleAuthorizationUrlBody) => {
|
|
42
|
+
return (0, http_client_1.customAxios)({ url: `/auth/google/getAuthorizationUrl`, method: 'POST',
|
|
58
43
|
headers: { 'Content-Type': 'application/json', },
|
|
59
|
-
data:
|
|
44
|
+
data: getGoogleAuthorizationUrlBody
|
|
60
45
|
});
|
|
61
46
|
};
|
|
62
47
|
/**
|
|
63
|
-
* Exchange OAuth authorization code for user profile information
|
|
64
|
-
* @summary Handle OAuth callback
|
|
48
|
+
* Exchange Google OAuth authorization code for user profile information
|
|
49
|
+
* @summary Handle Google OAuth callback
|
|
65
50
|
*/
|
|
66
|
-
const
|
|
67
|
-
return (0, http_client_1.customAxios)({ url: `/auth/handleOAuthCallback`, method: 'POST',
|
|
51
|
+
const handleGoogleOAuthCallback = (handleGoogleOAuthCallbackBody) => {
|
|
52
|
+
return (0, http_client_1.customAxios)({ url: `/auth/google/handleOAuthCallback`, method: 'POST',
|
|
68
53
|
headers: { 'Content-Type': 'application/json', },
|
|
69
|
-
data:
|
|
54
|
+
data: handleGoogleOAuthCallbackBody
|
|
70
55
|
});
|
|
71
56
|
};
|
|
72
57
|
/**
|
|
@@ -88,7 +73,7 @@ const getIntegrationsAPI = () => {
|
|
|
88
73
|
data: createStreamBody
|
|
89
74
|
});
|
|
90
75
|
};
|
|
91
|
-
return {
|
|
76
|
+
return { getGoogleAuthorizationUrl, handleGoogleOAuthCallback, generateText, createStream };
|
|
92
77
|
};
|
|
93
78
|
exports.getIntegrationsAPI = getIntegrationsAPI;
|
|
94
79
|
//# sourceMappingURL=generated-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generated-api.js","sourceRoot":"","sources":["../src/generated-api.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,+CAA4C;
|
|
1
|
+
{"version":3,"file":"generated-api.js","sourceRoot":"","sources":["../src/generated-api.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,+CAA4C;AA0D5C,2DAA2D;AAC9C,QAAA,gCAAgC,GAAG;IAC9C,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AAeX,2DAA2D;AAC9C,QAAA,wBAAwB,GAAG;IACtC,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAC;AAyEX,2DAA2D;AAC9C,QAAA,gCAAgC,GAAG;IAC9C,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;CACR,CAAC;AAeX,2DAA2D;AAC9C,QAAA,wBAAwB,GAAG;IACtC,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAC;AA0CJ,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACvC;;;OAGG;IACH,MAAM,yBAAyB,GAAG,CAC9B,6BAA4D,EAC7D,EAAE;QACC,OAAO,IAAA,yBAAW,EAClB,EAAC,GAAG,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM;YACxD,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,GAAG;YAC/C,IAAI,EAAE,6BAA6B;SACpC,CACE,CAAC;IACJ,CAAC,CAAA;IAEL;;;OAGG;IACH,MAAM,yBAAyB,GAAG,CAC9B,6BAA4D,EAC7D,EAAE;QACC,OAAO,IAAA,yBAAW,EAClB,EAAC,GAAG,EAAE,kCAAkC,EAAE,MAAM,EAAE,MAAM;YACxD,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,GAAG;YAC/C,IAAI,EAAE,6BAA6B;SACpC,CACE,CAAC;IACJ,CAAC,CAAA;IAEL;;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,OAAO,EAAC,yBAAyB,EAAC,yBAAyB,EAAC,YAAY,EAAC,YAAY,EAAC,CAAA;AAAA,CAAC,CAAC;AA5D3E,QAAA,kBAAkB,sBA4DyD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,16 +13,17 @@ export declare class GoogleAuth {
|
|
|
13
13
|
constructor(options?: {
|
|
14
14
|
accessKey?: string;
|
|
15
15
|
baseUrl?: string;
|
|
16
|
+
redirectUri?: string;
|
|
16
17
|
});
|
|
17
18
|
private withContext;
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
getGoogleAuthorizationUrl: (...args: Parameters<typeof this.api.getGoogleAuthorizationUrl>) => Promise<import("./generated-api").GetGoogleAuthorizationUrl200>;
|
|
20
|
+
handleGoogleOAuthCallback: (...args: Parameters<typeof this.api.handleGoogleOAuthCallback>) => Promise<import("./generated-api").HandleGoogleOAuthCallback200>;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* Default googleAuth instance - ready to use with env vars
|
|
23
24
|
* @example
|
|
24
25
|
* import { googleAuth } from 'uptiq-integration';
|
|
25
|
-
* await googleAuth.
|
|
26
|
+
* await googleAuth.getGoogleAuthorizationUrl({ ... });
|
|
26
27
|
*/
|
|
27
28
|
export declare const googleAuth: GoogleAuth;
|
|
28
29
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CACY;IAC1B,OAAO,CAAC,GAAG,CAAwC;gBAEvC,OAAO,CAAC,EAAE;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB;IAYD,OAAO,CAAC,WAAW;IAInB,yBAAyB,GAAI,GAAG,MAAM,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,qEACrB;IAEtE,yBAAyB,GAAI,GAAG,MAAM,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,qEACrB;CACvE;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,YAAmB,CAAC;AAE3C;;GAEG;AACH,qBAAa,GAAG;IACd,OAAO,CAAC,MAAM,CAES;IACvB,OAAO,CAAC,GAAG,CAAwC;gBAEvC,OAAO,CAAC,EAAE;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAaD,OAAO,CAAC,WAAW;IAInB,YAAY,GAAI,GAAG,MAAM,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,wDAK3D;IAEN,YAAY,GAAI,GAAG,MAAM,UAAU,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,qBAK3D;CACP;AAED;;;;;GAKG;AACH,eAAO,MAAM,GAAG,KAAY,CAAC;AAG7B,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -28,10 +28,14 @@ const http_client_1 = require("./http-client");
|
|
|
28
28
|
*/
|
|
29
29
|
class GoogleAuth {
|
|
30
30
|
constructor(options) {
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
31
|
+
this.getGoogleAuthorizationUrl = (...args) => this.withContext(() => this.api.getGoogleAuthorizationUrl(...args));
|
|
32
|
+
this.handleGoogleOAuthCallback = (...args) => this.withContext(() => this.api.handleGoogleOAuthCallback(...args));
|
|
33
33
|
// Store config for this instance (uses env vars if not provided)
|
|
34
|
-
this.config =
|
|
34
|
+
this.config = {
|
|
35
|
+
...(options?.accessKey ? { accessKey: options.accessKey } : {}),
|
|
36
|
+
...(options?.baseUrl ? { baseUrl: options.baseUrl } : {}),
|
|
37
|
+
...(options?.redirectUri || process.env["GOOGLE_REDIRECT_URI"] ? { redirectUri: options?.redirectUri || process.env["GOOGLE_REDIRECT_URI"] } : {})
|
|
38
|
+
};
|
|
35
39
|
// Get the generated API methods
|
|
36
40
|
this.api = (0, generated_api_1.getIntegrationsAPI)();
|
|
37
41
|
}
|
|
@@ -45,7 +49,7 @@ exports.GoogleAuth = GoogleAuth;
|
|
|
45
49
|
* Default googleAuth instance - ready to use with env vars
|
|
46
50
|
* @example
|
|
47
51
|
* import { googleAuth } from 'uptiq-integration';
|
|
48
|
-
* await googleAuth.
|
|
52
|
+
* await googleAuth.getGoogleAuthorizationUrl({ ... });
|
|
49
53
|
*/
|
|
50
54
|
exports.googleAuth = new GoogleAuth();
|
|
51
55
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAqD;AACrD,+CAA2C;AAE3C;;;;;GAKG;AAEH;;GAEG;AACH,MAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAqD;AACrD,+CAA2C;AAE3C;;;;;GAKG;AAEH;;GAEG;AACH,MAAa,UAAU;IAKrB,YAAY,OAIX;QAgBD,8BAAyB,GAAG,CAAC,GAAG,IAA2D,EAAE,EAAE,CAC7F,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAEtE,8BAAyB,GAAG,CAAC,GAAG,IAA2D,EAAE,EAAE,CAC7F,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QAnBpE,iEAAiE;QACjE,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/D,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAA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