@slates/provider 1.0.0-rc.30 → 1.0.0-rc.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +37 -25
- package/dist/index.d.ts +37 -25
- package/package.json +1 -1
- package/src/auth/types.ts +52 -25
package/dist/index.d.cts
CHANGED
|
@@ -147,6 +147,35 @@ type SlateActionDocsReference = SlateTypedDocsReference<'docs.action.general'>;
|
|
|
147
147
|
type SlateAuthDocsReference = SlateTypedDocsReference<'docs.auth.oauth' | 'docs.auth.oauth_scopes' | 'docs.auth.token' | 'docs.auth.service_account' | 'docs.auth.custom'>;
|
|
148
148
|
|
|
149
149
|
type SlateAuthCallbackConfig = Record<string, any>;
|
|
150
|
+
type SlateOauthAuthorizationUrlContext<InputType> = {
|
|
151
|
+
redirectUri: string;
|
|
152
|
+
state: string;
|
|
153
|
+
input: InputType;
|
|
154
|
+
clientId: string;
|
|
155
|
+
clientSecret: string;
|
|
156
|
+
scopes: string[];
|
|
157
|
+
config?: SlateAuthCallbackConfig;
|
|
158
|
+
};
|
|
159
|
+
type SlateOauthAuthorizationUrlResult<InputType> = {
|
|
160
|
+
url: string;
|
|
161
|
+
input?: InputType;
|
|
162
|
+
callbackState?: Record<string, any>;
|
|
163
|
+
};
|
|
164
|
+
type SlateOauthCallbackContext<InputType> = {
|
|
165
|
+
code: string;
|
|
166
|
+
state: string;
|
|
167
|
+
redirectUri: string;
|
|
168
|
+
input: InputType;
|
|
169
|
+
clientId: string;
|
|
170
|
+
clientSecret: string;
|
|
171
|
+
scopes: string[];
|
|
172
|
+
callbackParams?: Record<string, string>;
|
|
173
|
+
callbackState: Record<string, any>;
|
|
174
|
+
config?: SlateAuthCallbackConfig;
|
|
175
|
+
};
|
|
176
|
+
type SlateOauthAdminCallbackContext<InputType> = Omit<SlateOauthCallbackContext<InputType>, 'code'> & {
|
|
177
|
+
code?: string;
|
|
178
|
+
};
|
|
150
179
|
type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
151
180
|
token: string;
|
|
152
181
|
refreshToken?: string;
|
|
@@ -162,6 +191,12 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
|
162
191
|
}[];
|
|
163
192
|
adapters?: string[];
|
|
164
193
|
syncTokensAcrossConnections?: boolean;
|
|
194
|
+
adminSetup?: {
|
|
195
|
+
getAuthorizationUrl?: (ctx: SlateOauthAuthorizationUrlContext<InputType>) => Promise<SlateOauthAuthorizationUrlResult<InputType>>;
|
|
196
|
+
handleCallback?: (ctx: SlateOauthAdminCallbackContext<InputType>) => Promise<{
|
|
197
|
+
instructions?: string;
|
|
198
|
+
}>;
|
|
199
|
+
};
|
|
165
200
|
docs?: SlateAuthDocsReference[];
|
|
166
201
|
inputSchema?: z.ZodType<InputType>;
|
|
167
202
|
onInputChanged?: (params: {
|
|
@@ -171,31 +206,8 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
|
171
206
|
input?: InputType;
|
|
172
207
|
} | undefined>;
|
|
173
208
|
getDefaultInput?: () => Promise<InputType>;
|
|
174
|
-
getAuthorizationUrl: (ctx:
|
|
175
|
-
|
|
176
|
-
state: string;
|
|
177
|
-
input: InputType;
|
|
178
|
-
clientId: string;
|
|
179
|
-
clientSecret: string;
|
|
180
|
-
scopes: string[];
|
|
181
|
-
config?: SlateAuthCallbackConfig;
|
|
182
|
-
}) => Promise<{
|
|
183
|
-
url: string;
|
|
184
|
-
input?: InputType;
|
|
185
|
-
callbackState?: Record<string, any>;
|
|
186
|
-
}>;
|
|
187
|
-
handleCallback: (ctx: {
|
|
188
|
-
code: string;
|
|
189
|
-
state: string;
|
|
190
|
-
redirectUri: string;
|
|
191
|
-
input: InputType;
|
|
192
|
-
clientId: string;
|
|
193
|
-
clientSecret: string;
|
|
194
|
-
scopes: string[];
|
|
195
|
-
callbackParams?: Record<string, string>;
|
|
196
|
-
callbackState: Record<string, any>;
|
|
197
|
-
config?: SlateAuthCallbackConfig;
|
|
198
|
-
}) => Promise<{
|
|
209
|
+
getAuthorizationUrl: (ctx: SlateOauthAuthorizationUrlContext<InputType>) => Promise<SlateOauthAuthorizationUrlResult<InputType>>;
|
|
210
|
+
handleCallback: (ctx: SlateOauthCallbackContext<InputType>) => Promise<{
|
|
199
211
|
output: OutputType;
|
|
200
212
|
input?: InputType;
|
|
201
213
|
scopes?: string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -147,6 +147,35 @@ type SlateActionDocsReference = SlateTypedDocsReference<'docs.action.general'>;
|
|
|
147
147
|
type SlateAuthDocsReference = SlateTypedDocsReference<'docs.auth.oauth' | 'docs.auth.oauth_scopes' | 'docs.auth.token' | 'docs.auth.service_account' | 'docs.auth.custom'>;
|
|
148
148
|
|
|
149
149
|
type SlateAuthCallbackConfig = Record<string, any>;
|
|
150
|
+
type SlateOauthAuthorizationUrlContext<InputType> = {
|
|
151
|
+
redirectUri: string;
|
|
152
|
+
state: string;
|
|
153
|
+
input: InputType;
|
|
154
|
+
clientId: string;
|
|
155
|
+
clientSecret: string;
|
|
156
|
+
scopes: string[];
|
|
157
|
+
config?: SlateAuthCallbackConfig;
|
|
158
|
+
};
|
|
159
|
+
type SlateOauthAuthorizationUrlResult<InputType> = {
|
|
160
|
+
url: string;
|
|
161
|
+
input?: InputType;
|
|
162
|
+
callbackState?: Record<string, any>;
|
|
163
|
+
};
|
|
164
|
+
type SlateOauthCallbackContext<InputType> = {
|
|
165
|
+
code: string;
|
|
166
|
+
state: string;
|
|
167
|
+
redirectUri: string;
|
|
168
|
+
input: InputType;
|
|
169
|
+
clientId: string;
|
|
170
|
+
clientSecret: string;
|
|
171
|
+
scopes: string[];
|
|
172
|
+
callbackParams?: Record<string, string>;
|
|
173
|
+
callbackState: Record<string, any>;
|
|
174
|
+
config?: SlateAuthCallbackConfig;
|
|
175
|
+
};
|
|
176
|
+
type SlateOauthAdminCallbackContext<InputType> = Omit<SlateOauthCallbackContext<InputType>, 'code'> & {
|
|
177
|
+
code?: string;
|
|
178
|
+
};
|
|
150
179
|
type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
151
180
|
token: string;
|
|
152
181
|
refreshToken?: string;
|
|
@@ -162,6 +191,12 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
|
162
191
|
}[];
|
|
163
192
|
adapters?: string[];
|
|
164
193
|
syncTokensAcrossConnections?: boolean;
|
|
194
|
+
adminSetup?: {
|
|
195
|
+
getAuthorizationUrl?: (ctx: SlateOauthAuthorizationUrlContext<InputType>) => Promise<SlateOauthAuthorizationUrlResult<InputType>>;
|
|
196
|
+
handleCallback?: (ctx: SlateOauthAdminCallbackContext<InputType>) => Promise<{
|
|
197
|
+
instructions?: string;
|
|
198
|
+
}>;
|
|
199
|
+
};
|
|
165
200
|
docs?: SlateAuthDocsReference[];
|
|
166
201
|
inputSchema?: z.ZodType<InputType>;
|
|
167
202
|
onInputChanged?: (params: {
|
|
@@ -171,31 +206,8 @@ type SlateAuthWithOauth<InputType extends {}, OutputType extends {
|
|
|
171
206
|
input?: InputType;
|
|
172
207
|
} | undefined>;
|
|
173
208
|
getDefaultInput?: () => Promise<InputType>;
|
|
174
|
-
getAuthorizationUrl: (ctx:
|
|
175
|
-
|
|
176
|
-
state: string;
|
|
177
|
-
input: InputType;
|
|
178
|
-
clientId: string;
|
|
179
|
-
clientSecret: string;
|
|
180
|
-
scopes: string[];
|
|
181
|
-
config?: SlateAuthCallbackConfig;
|
|
182
|
-
}) => Promise<{
|
|
183
|
-
url: string;
|
|
184
|
-
input?: InputType;
|
|
185
|
-
callbackState?: Record<string, any>;
|
|
186
|
-
}>;
|
|
187
|
-
handleCallback: (ctx: {
|
|
188
|
-
code: string;
|
|
189
|
-
state: string;
|
|
190
|
-
redirectUri: string;
|
|
191
|
-
input: InputType;
|
|
192
|
-
clientId: string;
|
|
193
|
-
clientSecret: string;
|
|
194
|
-
scopes: string[];
|
|
195
|
-
callbackParams?: Record<string, string>;
|
|
196
|
-
callbackState: Record<string, any>;
|
|
197
|
-
config?: SlateAuthCallbackConfig;
|
|
198
|
-
}) => Promise<{
|
|
209
|
+
getAuthorizationUrl: (ctx: SlateOauthAuthorizationUrlContext<InputType>) => Promise<SlateOauthAuthorizationUrlResult<InputType>>;
|
|
210
|
+
handleCallback: (ctx: SlateOauthCallbackContext<InputType>) => Promise<{
|
|
199
211
|
output: OutputType;
|
|
200
212
|
input?: InputType;
|
|
201
213
|
scopes?: string[];
|
package/package.json
CHANGED
package/src/auth/types.ts
CHANGED
|
@@ -3,6 +3,42 @@ import type { SlateAuthDocsReference } from '../docs';
|
|
|
3
3
|
|
|
4
4
|
type SlateAuthCallbackConfig = Record<string, any>;
|
|
5
5
|
|
|
6
|
+
type SlateOauthAuthorizationUrlContext<InputType> = {
|
|
7
|
+
redirectUri: string;
|
|
8
|
+
state: string;
|
|
9
|
+
input: InputType;
|
|
10
|
+
clientId: string;
|
|
11
|
+
clientSecret: string;
|
|
12
|
+
scopes: string[];
|
|
13
|
+
config?: SlateAuthCallbackConfig;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type SlateOauthAuthorizationUrlResult<InputType> = {
|
|
17
|
+
url: string;
|
|
18
|
+
input?: InputType;
|
|
19
|
+
callbackState?: Record<string, any>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type SlateOauthCallbackContext<InputType> = {
|
|
23
|
+
code: string;
|
|
24
|
+
state: string;
|
|
25
|
+
redirectUri: string;
|
|
26
|
+
input: InputType;
|
|
27
|
+
clientId: string;
|
|
28
|
+
clientSecret: string;
|
|
29
|
+
scopes: string[];
|
|
30
|
+
callbackParams?: Record<string, string>;
|
|
31
|
+
callbackState: Record<string, any>;
|
|
32
|
+
config?: SlateAuthCallbackConfig;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type SlateOauthAdminCallbackContext<InputType> = Omit<
|
|
36
|
+
SlateOauthCallbackContext<InputType>,
|
|
37
|
+
'code'
|
|
38
|
+
> & {
|
|
39
|
+
code?: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
6
42
|
export type SlateAuthWithOauth<
|
|
7
43
|
InputType extends {},
|
|
8
44
|
OutputType extends {
|
|
@@ -28,6 +64,18 @@ export type SlateAuthWithOauth<
|
|
|
28
64
|
// connection of one installation, so a refresh must update all of them.
|
|
29
65
|
syncTokensAcrossConnections?: boolean;
|
|
30
66
|
|
|
67
|
+
// Missing hooks fall back to the regular flow (callback output discarded).
|
|
68
|
+
// Returned instructions are markdown shown to the admin.
|
|
69
|
+
adminSetup?: {
|
|
70
|
+
getAuthorizationUrl?: (
|
|
71
|
+
ctx: SlateOauthAuthorizationUrlContext<InputType>
|
|
72
|
+
) => Promise<SlateOauthAuthorizationUrlResult<InputType>>;
|
|
73
|
+
|
|
74
|
+
handleCallback?: (
|
|
75
|
+
ctx: SlateOauthAdminCallbackContext<InputType>
|
|
76
|
+
) => Promise<{ instructions?: string }>;
|
|
77
|
+
};
|
|
78
|
+
|
|
31
79
|
docs?: SlateAuthDocsReference[];
|
|
32
80
|
|
|
33
81
|
inputSchema?: z.ZodType<InputType>;
|
|
@@ -39,32 +87,11 @@ export type SlateAuthWithOauth<
|
|
|
39
87
|
|
|
40
88
|
getDefaultInput?: () => Promise<InputType>;
|
|
41
89
|
|
|
42
|
-
getAuthorizationUrl: (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
input: InputType;
|
|
46
|
-
clientId: string;
|
|
47
|
-
clientSecret: string;
|
|
48
|
-
scopes: string[];
|
|
49
|
-
config?: SlateAuthCallbackConfig;
|
|
50
|
-
}) => Promise<{
|
|
51
|
-
url: string;
|
|
52
|
-
input?: InputType;
|
|
53
|
-
callbackState?: Record<string, any>;
|
|
54
|
-
}>;
|
|
90
|
+
getAuthorizationUrl: (
|
|
91
|
+
ctx: SlateOauthAuthorizationUrlContext<InputType>
|
|
92
|
+
) => Promise<SlateOauthAuthorizationUrlResult<InputType>>;
|
|
55
93
|
|
|
56
|
-
handleCallback: (ctx: {
|
|
57
|
-
code: string;
|
|
58
|
-
state: string;
|
|
59
|
-
redirectUri: string;
|
|
60
|
-
input: InputType;
|
|
61
|
-
clientId: string;
|
|
62
|
-
clientSecret: string;
|
|
63
|
-
scopes: string[];
|
|
64
|
-
callbackParams?: Record<string, string>;
|
|
65
|
-
callbackState: Record<string, any>;
|
|
66
|
-
config?: SlateAuthCallbackConfig;
|
|
67
|
-
}) => Promise<{
|
|
94
|
+
handleCallback: (ctx: SlateOauthCallbackContext<InputType>) => Promise<{
|
|
68
95
|
output: OutputType;
|
|
69
96
|
input?: InputType;
|
|
70
97
|
scopes?: string[];
|