@party-stack/connect 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +189 -2
- package/lib/ServiceConnector.d.ts +68 -0
- package/lib/ServiceConnector.d.ts.map +1 -0
- package/lib/ServiceConnector.js +1 -0
- package/lib/acquireConfiguredConnection.d.ts +32 -0
- package/lib/acquireConfiguredConnection.d.ts.map +1 -0
- package/lib/acquireConfiguredConnection.js +54 -0
- package/lib/acquireConfiguredConnection.js.map +1 -0
- package/lib/authentication.d.ts +76 -0
- package/lib/authentication.d.ts.map +1 -0
- package/lib/authentication.js +95 -0
- package/lib/authentication.js.map +1 -0
- package/lib/authorization.d.ts +43 -0
- package/lib/authorization.d.ts.map +1 -0
- package/lib/authorization.js +175 -0
- package/lib/authorization.js.map +1 -0
- package/lib/core/accessToken.d.ts +10 -0
- package/lib/core/accessToken.d.ts.map +1 -0
- package/lib/core/accessToken.js +87 -0
- package/lib/core/accessToken.js.map +1 -0
- package/lib/core/backend.d.ts +33 -0
- package/lib/core/backend.d.ts.map +1 -0
- package/lib/core/backend.js +249 -0
- package/lib/core/backend.js.map +1 -0
- package/lib/core/errors.d.ts +13 -0
- package/lib/core/errors.d.ts.map +1 -0
- package/lib/core/errors.js +26 -0
- package/lib/core/errors.js.map +1 -0
- package/lib/core/maintenance.d.ts +11 -0
- package/lib/core/maintenance.d.ts.map +1 -0
- package/lib/core/maintenance.js +21 -0
- package/lib/core/maintenance.js.map +1 -0
- package/lib/core/migrate.d.ts +18 -0
- package/lib/core/migrate.d.ts.map +1 -0
- package/lib/core/migrate.js +71 -0
- package/lib/core/migrate.js.map +1 -0
- package/lib/core/oauth.d.ts +27 -0
- package/lib/core/oauth.d.ts.map +1 -0
- package/lib/core/oauth.js +82 -0
- package/lib/core/oauth.js.map +1 -0
- package/lib/core/oauthAuthority.d.ts +90 -0
- package/lib/core/oauthAuthority.d.ts.map +1 -0
- package/lib/core/oauthAuthority.js +382 -0
- package/lib/core/oauthAuthority.js.map +1 -0
- package/lib/core/store.d.ts +48 -0
- package/lib/core/store.d.ts.map +1 -0
- package/lib/core/store.js +92 -0
- package/lib/core/store.js.map +1 -0
- package/lib/createDefaultConnectionEgressHandlers.d.ts +5 -0
- package/lib/createDefaultConnectionEgressHandlers.d.ts.map +1 -0
- package/lib/createDefaultConnectionEgressHandlers.js +20 -0
- package/lib/createDefaultConnectionEgressHandlers.js.map +1 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +17 -0
- package/lib/makeConnectManager.d.ts +90 -0
- package/lib/makeConnectManager.d.ts.map +1 -0
- package/lib/makeConnectManager.js +91 -0
- package/lib/makeConnectManager.js.map +1 -0
- package/lib/oauth/storage.d.ts +9 -0
- package/lib/oauth/storage.d.ts.map +1 -0
- package/lib/oauth/storage.js +16 -0
- package/lib/oauth/storage.js.map +1 -0
- package/lib/publicOntology.d.ts +17 -0
- package/lib/publicOntology.d.ts.map +1 -0
- package/lib/publicOntology.js +86 -0
- package/lib/publicOntology.js.map +1 -0
- package/lib/server/index.d.ts +33 -0
- package/lib/server/index.d.ts.map +1 -0
- package/lib/server/index.js +119 -0
- package/lib/server/index.js.map +1 -0
- package/lib/serverClient.d.ts +28 -0
- package/lib/serverClient.d.ts.map +1 -0
- package/lib/serverClient.js +67 -0
- package/lib/serverClient.js.map +1 -0
- package/lib/serviceConnections.d.ts +39 -0
- package/lib/serviceConnections.d.ts.map +1 -0
- package/lib/serviceConnections.js +277 -0
- package/lib/serviceConnections.js.map +1 -0
- package/lib/spec/index.d.ts +958 -0
- package/lib/spec/index.d.ts.map +1 -0
- package/lib/spec/index.js +565 -0
- package/lib/spec/index.js.map +1 -0
- package/lib/toWebEgress.d.ts +12 -0
- package/lib/toWebEgress.d.ts.map +1 -0
- package/lib/toWebEgress.js +28 -0
- package/lib/toWebEgress.js.map +1 -0
- package/lib/types.d.ts +44 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +25 -0
- package/lib/types.js.map +1 -0
- package/lib/withHttpAuthenticationErrors.d.ts +5 -0
- package/lib/withHttpAuthenticationErrors.d.ts.map +1 -0
- package/lib/withHttpAuthenticationErrors.js +20 -0
- package/lib/withHttpAuthenticationErrors.js.map +1 -0
- package/package.json +34 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/spec/index.ts"],"mappings":";;;;;qBAKa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA8cD,kBAAkB,aAAa;YAC/B,wBAAwB;YACxB,yBAAyB;YACzB,wBAAwB;YACxB,yBAAyB;YACzB,kCAAkC;YAClC,kCAAkC"}
|
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import { defineOntology, o } from "@party-stack/ontology-spec";
|
|
2
|
+
//#region src/spec/index.ts
|
|
3
|
+
/** Portable definitions. Applications may add properties/links before compiling them.
|
|
4
|
+
* Connection and attempt instances are private to the credential authority.
|
|
5
|
+
*/
|
|
6
|
+
const connectOntology = defineOntology({
|
|
7
|
+
types: [],
|
|
8
|
+
objectTypes: [
|
|
9
|
+
{
|
|
10
|
+
name: "ServiceInstance",
|
|
11
|
+
pluralDisplayName: "Service instances",
|
|
12
|
+
displayName: "Service instance",
|
|
13
|
+
primaryKey: "id",
|
|
14
|
+
properties: [
|
|
15
|
+
{
|
|
16
|
+
name: "id",
|
|
17
|
+
displayName: "Id",
|
|
18
|
+
type: o.string({})
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "title",
|
|
22
|
+
displayName: "Title",
|
|
23
|
+
type: o.string({})
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "service",
|
|
27
|
+
displayName: "Service",
|
|
28
|
+
type: o.string({})
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "instanceUrl",
|
|
32
|
+
displayName: "Instance url",
|
|
33
|
+
type: o.string({})
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "OAuthApplication",
|
|
39
|
+
pluralDisplayName: "OAuthApplications",
|
|
40
|
+
displayName: "OAuth application",
|
|
41
|
+
primaryKey: "id",
|
|
42
|
+
properties: [
|
|
43
|
+
{
|
|
44
|
+
name: "id",
|
|
45
|
+
displayName: "Id",
|
|
46
|
+
type: o.string({})
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "title",
|
|
50
|
+
displayName: "Title",
|
|
51
|
+
type: o.string({})
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "serviceInstance",
|
|
55
|
+
displayName: "Service instance",
|
|
56
|
+
type: o.objectReference({ objectType: "ServiceInstance" })
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "flow",
|
|
60
|
+
displayName: "Flow",
|
|
61
|
+
type: o.string({ constraint: o.StringConstraint.enum({ options: [{
|
|
62
|
+
value: "authorization-code",
|
|
63
|
+
label: "authorization-code"
|
|
64
|
+
}, {
|
|
65
|
+
value: "client-credentials",
|
|
66
|
+
label: "client-credentials"
|
|
67
|
+
}] }) })
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "clientId",
|
|
71
|
+
displayName: "Client id",
|
|
72
|
+
type: o.string({})
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "scopes",
|
|
76
|
+
displayName: "Requested scopes",
|
|
77
|
+
type: o.optional({ type: o.list({ elementType: o.string({}) }) })
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "redirectUrl",
|
|
81
|
+
displayName: "Redirect URL",
|
|
82
|
+
type: o.optional({ type: o.string({}) })
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "clientSecret",
|
|
86
|
+
displayName: "Client secret",
|
|
87
|
+
type: o.optional({ type: o.encrypted({ type: o.string({}) }) })
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "serviceAppId",
|
|
91
|
+
displayName: "Service app id",
|
|
92
|
+
type: o.optional({ type: o.string({}) })
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "connection",
|
|
96
|
+
displayName: "Connection",
|
|
97
|
+
type: o.optional({ type: o.objectReference({ objectType: "OAuthConnection" }) })
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "OAuthConnection",
|
|
103
|
+
pluralDisplayName: "OAuthConnections",
|
|
104
|
+
displayName: "OAuth connection",
|
|
105
|
+
primaryKey: "id",
|
|
106
|
+
properties: [
|
|
107
|
+
{
|
|
108
|
+
name: "id",
|
|
109
|
+
displayName: "Id",
|
|
110
|
+
type: o.string({})
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "title",
|
|
114
|
+
displayName: "Title",
|
|
115
|
+
type: o.string({})
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "application",
|
|
119
|
+
displayName: "Application",
|
|
120
|
+
type: o.objectReference({ objectType: "OAuthApplication" })
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "userId",
|
|
124
|
+
displayName: "User id",
|
|
125
|
+
type: o.optional({ type: o.string({}) })
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "status",
|
|
129
|
+
displayName: "Status",
|
|
130
|
+
type: o.string({ constraint: o.StringConstraint.enum({ options: [
|
|
131
|
+
{
|
|
132
|
+
value: "active",
|
|
133
|
+
label: "active"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
value: "needs-auth",
|
|
137
|
+
label: "needs-auth"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
value: "inactive",
|
|
141
|
+
label: "inactive"
|
|
142
|
+
}
|
|
143
|
+
] }) })
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "accessToken",
|
|
147
|
+
displayName: "Access token",
|
|
148
|
+
type: o.optional({ type: o.encrypted({ type: o.string({}) }) })
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "accessTokenExpiresAt",
|
|
152
|
+
displayName: "Access token expires at",
|
|
153
|
+
type: o.optional({ type: o.timestamp({}) })
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "refreshToken",
|
|
157
|
+
displayName: "Refresh token",
|
|
158
|
+
type: o.optional({ type: o.encrypted({ type: o.string({}) }) })
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "refreshTokenExpiresAt",
|
|
162
|
+
displayName: "Refresh token expires at",
|
|
163
|
+
type: o.optional({ type: o.timestamp({}) })
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "grantedScopes",
|
|
167
|
+
displayName: "Granted scopes",
|
|
168
|
+
type: o.optional({ type: o.string({}) })
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "operationId",
|
|
172
|
+
displayName: "Operation id",
|
|
173
|
+
type: o.optional({ type: o.string({}) })
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "operationExpiresAt",
|
|
177
|
+
displayName: "Operation expires at",
|
|
178
|
+
type: o.optional({ type: o.timestamp({}) })
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "ApiKeyConnection",
|
|
184
|
+
pluralDisplayName: "API key connections",
|
|
185
|
+
displayName: "API key connection",
|
|
186
|
+
primaryKey: "id",
|
|
187
|
+
properties: [
|
|
188
|
+
{
|
|
189
|
+
name: "id",
|
|
190
|
+
displayName: "Id",
|
|
191
|
+
type: o.string({})
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: "title",
|
|
195
|
+
displayName: "Title",
|
|
196
|
+
type: o.string({})
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "serviceInstance",
|
|
200
|
+
displayName: "Service instance",
|
|
201
|
+
type: o.objectReference({ objectType: "ServiceInstance" })
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "userId",
|
|
205
|
+
displayName: "User id",
|
|
206
|
+
type: o.string({})
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "status",
|
|
210
|
+
displayName: "Status",
|
|
211
|
+
type: o.string({ constraint: o.StringConstraint.enum({ options: [
|
|
212
|
+
{
|
|
213
|
+
value: "active",
|
|
214
|
+
label: "Active"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
value: "needs-auth",
|
|
218
|
+
label: "Needs authentication"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
value: "inactive",
|
|
222
|
+
label: "Inactive"
|
|
223
|
+
}
|
|
224
|
+
] }) })
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "apiKey",
|
|
228
|
+
displayName: "API key",
|
|
229
|
+
type: o.optional({ type: o.encrypted({ type: o.string({}) }) })
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: "expiresAt",
|
|
233
|
+
displayName: "Expires at",
|
|
234
|
+
type: o.optional({ type: o.timestamp({}) })
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: "ExternalSessionConnection",
|
|
240
|
+
pluralDisplayName: "External session connections",
|
|
241
|
+
displayName: "External session connection",
|
|
242
|
+
primaryKey: "id",
|
|
243
|
+
properties: [
|
|
244
|
+
{
|
|
245
|
+
name: "id",
|
|
246
|
+
displayName: "Id",
|
|
247
|
+
type: o.string({})
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
name: "title",
|
|
251
|
+
displayName: "Title",
|
|
252
|
+
type: o.string({})
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "serviceInstance",
|
|
256
|
+
displayName: "Service instance",
|
|
257
|
+
type: o.objectReference({ objectType: "ServiceInstance" })
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: "userId",
|
|
261
|
+
displayName: "User id",
|
|
262
|
+
type: o.string({})
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: "status",
|
|
266
|
+
displayName: "Status",
|
|
267
|
+
type: o.string({ constraint: o.StringConstraint.enum({ options: [
|
|
268
|
+
{
|
|
269
|
+
value: "active",
|
|
270
|
+
label: "Active"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
value: "needs-auth",
|
|
274
|
+
label: "Needs authentication"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
value: "inactive",
|
|
278
|
+
label: "Inactive"
|
|
279
|
+
}
|
|
280
|
+
] }) })
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: "sessionId",
|
|
284
|
+
displayName: "Session id",
|
|
285
|
+
type: o.string({})
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: "expiresAt",
|
|
289
|
+
displayName: "Expires at",
|
|
290
|
+
type: o.optional({ type: o.timestamp({}) })
|
|
291
|
+
}
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "OAuthAuthorizationAttempt",
|
|
296
|
+
pluralDisplayName: "OAuthAuthorizationAttempts",
|
|
297
|
+
displayName: "OAuth authorization attempt",
|
|
298
|
+
primaryKey: "id",
|
|
299
|
+
properties: [
|
|
300
|
+
{
|
|
301
|
+
name: "id",
|
|
302
|
+
displayName: "Id",
|
|
303
|
+
type: o.string({})
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: "application",
|
|
307
|
+
displayName: "Application",
|
|
308
|
+
type: o.objectReference({ objectType: "OAuthApplication" })
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: "principalId",
|
|
312
|
+
displayName: "Principal id",
|
|
313
|
+
type: o.optional({ type: o.string({}) })
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: "connectionId",
|
|
317
|
+
displayName: "Connection id",
|
|
318
|
+
type: o.string({})
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: "redirectUrl",
|
|
322
|
+
displayName: "Redirect url",
|
|
323
|
+
type: o.string({})
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: "returnUrl",
|
|
327
|
+
displayName: "Return url",
|
|
328
|
+
type: o.optional({ type: o.string({}) })
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
name: "codeVerifier",
|
|
332
|
+
displayName: "Code verifier",
|
|
333
|
+
type: o.encrypted({ type: o.string({}) })
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: "expiresAt",
|
|
337
|
+
displayName: "Expires at",
|
|
338
|
+
type: o.timestamp({})
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "status",
|
|
342
|
+
displayName: "Status",
|
|
343
|
+
type: o.string({ constraint: o.StringConstraint.enum({ options: [
|
|
344
|
+
{
|
|
345
|
+
value: "pending",
|
|
346
|
+
label: "pending"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
value: "exchanging",
|
|
350
|
+
label: "exchanging"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
value: "completed",
|
|
354
|
+
label: "completed"
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
value: "failed",
|
|
358
|
+
label: "failed"
|
|
359
|
+
}
|
|
360
|
+
] }) })
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
linkTypes: [],
|
|
366
|
+
actionTypes: [
|
|
367
|
+
{
|
|
368
|
+
name: "beginAuthorization",
|
|
369
|
+
displayName: "Begin authorization",
|
|
370
|
+
logic: [],
|
|
371
|
+
parameters: [
|
|
372
|
+
{
|
|
373
|
+
name: "applicationId",
|
|
374
|
+
displayName: "Application",
|
|
375
|
+
type: o.objectReference({ objectType: "OAuthApplication" })
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
name: "principalId",
|
|
379
|
+
displayName: "Principal",
|
|
380
|
+
type: o.optional({ type: o.string({}) })
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: "redirectUrl",
|
|
384
|
+
displayName: "Redirect URL",
|
|
385
|
+
type: o.string({})
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
name: "returnUrl",
|
|
389
|
+
displayName: "Return URL",
|
|
390
|
+
type: o.optional({ type: o.string({}) })
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
name: "connectionId",
|
|
394
|
+
displayName: "Connection",
|
|
395
|
+
type: o.optional({ type: o.objectReference({ objectType: "OAuthConnection" }) })
|
|
396
|
+
}
|
|
397
|
+
],
|
|
398
|
+
returnType: o.struct({ fields: [{
|
|
399
|
+
name: "id",
|
|
400
|
+
displayName: "Attempt",
|
|
401
|
+
type: o.string({})
|
|
402
|
+
}, {
|
|
403
|
+
name: "authorizationUrl",
|
|
404
|
+
displayName: "Authorization URL",
|
|
405
|
+
type: o.string({})
|
|
406
|
+
}] })
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
name: "completeAuthorization",
|
|
410
|
+
displayName: "Complete authorization",
|
|
411
|
+
logic: [],
|
|
412
|
+
parameters: [{
|
|
413
|
+
name: "callbackUrl",
|
|
414
|
+
displayName: "Callback URL",
|
|
415
|
+
type: o.string({})
|
|
416
|
+
}, {
|
|
417
|
+
name: "principalId",
|
|
418
|
+
displayName: "Principal",
|
|
419
|
+
type: o.optional({ type: o.string({}) })
|
|
420
|
+
}],
|
|
421
|
+
returnType: o.struct({ fields: [{
|
|
422
|
+
name: "connectionId",
|
|
423
|
+
displayName: "Connection",
|
|
424
|
+
type: o.objectReference({ objectType: "OAuthConnection" })
|
|
425
|
+
}] })
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
name: "connectClientCredentials",
|
|
429
|
+
displayName: "Connect client credentials",
|
|
430
|
+
logic: [],
|
|
431
|
+
parameters: [{
|
|
432
|
+
name: "applicationId",
|
|
433
|
+
displayName: "Application",
|
|
434
|
+
type: o.objectReference({ objectType: "OAuthApplication" })
|
|
435
|
+
}, {
|
|
436
|
+
name: "connectionId",
|
|
437
|
+
displayName: "Connection",
|
|
438
|
+
type: o.optional({ type: o.objectReference({ objectType: "OAuthConnection" }) })
|
|
439
|
+
}],
|
|
440
|
+
returnType: o.struct({ fields: [{
|
|
441
|
+
name: "connectionId",
|
|
442
|
+
displayName: "Connection",
|
|
443
|
+
type: o.objectReference({ objectType: "OAuthConnection" })
|
|
444
|
+
}] })
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: "refreshConnection",
|
|
448
|
+
displayName: "Refresh connection",
|
|
449
|
+
logic: [],
|
|
450
|
+
parameters: [{
|
|
451
|
+
name: "connectionId",
|
|
452
|
+
displayName: "Connection",
|
|
453
|
+
type: o.objectReference({ objectType: "OAuthConnection" })
|
|
454
|
+
}],
|
|
455
|
+
returnType: o.struct({ fields: [{
|
|
456
|
+
name: "connectionId",
|
|
457
|
+
displayName: "Connection",
|
|
458
|
+
type: o.objectReference({ objectType: "OAuthConnection" })
|
|
459
|
+
}] })
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
name: "disconnectConnection",
|
|
463
|
+
displayName: "Disconnect connection",
|
|
464
|
+
logic: [],
|
|
465
|
+
parameters: [{
|
|
466
|
+
name: "connectionId",
|
|
467
|
+
displayName: "Connection",
|
|
468
|
+
type: o.objectReference({ objectType: "OAuthConnection" })
|
|
469
|
+
}]
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
name: "forgetConnection",
|
|
473
|
+
displayName: "Forget connection",
|
|
474
|
+
logic: [],
|
|
475
|
+
parameters: [{
|
|
476
|
+
name: "connectionId",
|
|
477
|
+
displayName: "Connection",
|
|
478
|
+
type: o.objectReference({ objectType: "OAuthConnection" })
|
|
479
|
+
}]
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
name: "connectApiKey",
|
|
483
|
+
displayName: "Connect API key",
|
|
484
|
+
logic: [],
|
|
485
|
+
parameters: [{
|
|
486
|
+
name: "serviceInstanceId",
|
|
487
|
+
displayName: "Service instance",
|
|
488
|
+
type: o.objectReference({ objectType: "ServiceInstance" })
|
|
489
|
+
}, {
|
|
490
|
+
name: "apiKey",
|
|
491
|
+
displayName: "API key",
|
|
492
|
+
type: o.string({})
|
|
493
|
+
}],
|
|
494
|
+
returnType: o.struct({ fields: [{
|
|
495
|
+
name: "connectionId",
|
|
496
|
+
displayName: "Connection",
|
|
497
|
+
type: o.objectReference({ objectType: "ApiKeyConnection" })
|
|
498
|
+
}] })
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
name: "attachExternalSession",
|
|
502
|
+
displayName: "Attach external session",
|
|
503
|
+
logic: [],
|
|
504
|
+
parameters: [{
|
|
505
|
+
name: "serviceInstanceId",
|
|
506
|
+
displayName: "Service instance",
|
|
507
|
+
type: o.objectReference({ objectType: "ServiceInstance" })
|
|
508
|
+
}, {
|
|
509
|
+
name: "sessionId",
|
|
510
|
+
displayName: "Session id",
|
|
511
|
+
type: o.string({})
|
|
512
|
+
}],
|
|
513
|
+
returnType: o.struct({ fields: [{
|
|
514
|
+
name: "connectionId",
|
|
515
|
+
displayName: "Connection",
|
|
516
|
+
type: o.objectReference({ objectType: "ExternalSessionConnection" })
|
|
517
|
+
}] })
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
name: "disconnectApiKey",
|
|
521
|
+
displayName: "Disconnect API key",
|
|
522
|
+
logic: [],
|
|
523
|
+
parameters: [{
|
|
524
|
+
name: "connectionId",
|
|
525
|
+
displayName: "Connection",
|
|
526
|
+
type: o.objectReference({ objectType: "ApiKeyConnection" })
|
|
527
|
+
}]
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: "forgetApiKey",
|
|
531
|
+
displayName: "Forget API key",
|
|
532
|
+
logic: [],
|
|
533
|
+
parameters: [{
|
|
534
|
+
name: "connectionId",
|
|
535
|
+
displayName: "Connection",
|
|
536
|
+
type: o.objectReference({ objectType: "ApiKeyConnection" })
|
|
537
|
+
}]
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
name: "disconnectExternalSession",
|
|
541
|
+
displayName: "Disconnect external session",
|
|
542
|
+
logic: [],
|
|
543
|
+
parameters: [{
|
|
544
|
+
name: "connectionId",
|
|
545
|
+
displayName: "Connection",
|
|
546
|
+
type: o.objectReference({ objectType: "ExternalSessionConnection" })
|
|
547
|
+
}]
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
name: "forgetExternalSession",
|
|
551
|
+
displayName: "Forget external session",
|
|
552
|
+
logic: [],
|
|
553
|
+
parameters: [{
|
|
554
|
+
name: "connectionId",
|
|
555
|
+
displayName: "Connection",
|
|
556
|
+
type: o.objectReference({ objectType: "ExternalSessionConnection" })
|
|
557
|
+
}]
|
|
558
|
+
}
|
|
559
|
+
],
|
|
560
|
+
queryFunctionTypes: []
|
|
561
|
+
});
|
|
562
|
+
//#endregion
|
|
563
|
+
export { connectOntology };
|
|
564
|
+
|
|
565
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/spec/index.ts"],"sourcesContent":["import { defineOntology, o, type Infer } from \"@party-stack/ontology-spec\";\n\n/** Portable definitions. Applications may add properties/links before compiling them.\n * Connection and attempt instances are private to the credential authority.\n */\nexport const connectOntology = defineOntology({\n types: [],\n objectTypes: [\n {\n name: \"ServiceInstance\",\n pluralDisplayName: \"Service instances\",\n displayName: \"Service instance\",\n primaryKey: \"id\",\n properties: [\n { name: \"id\", displayName: \"Id\", type: o.string({}) },\n { name: \"title\", displayName: \"Title\", type: o.string({}) },\n { name: \"service\", displayName: \"Service\", type: o.string({}) },\n { name: \"instanceUrl\", displayName: \"Instance url\", type: o.string({}) },\n ],\n },\n {\n name: \"OAuthApplication\",\n pluralDisplayName: \"OAuthApplications\",\n displayName: \"OAuth application\",\n primaryKey: \"id\",\n properties: [\n { name: \"id\", displayName: \"Id\", type: o.string({}) },\n { name: \"title\", displayName: \"Title\", type: o.string({}) },\n {\n name: \"serviceInstance\",\n displayName: \"Service instance\",\n type: o.objectReference({ objectType: \"ServiceInstance\" }),\n },\n {\n name: \"flow\",\n displayName: \"Flow\",\n type: o.string({\n constraint: o.StringConstraint.enum({\n options: [\n { value: \"authorization-code\", label: \"authorization-code\" },\n { value: \"client-credentials\", label: \"client-credentials\" },\n ],\n }),\n }),\n },\n { name: \"clientId\", displayName: \"Client id\", type: o.string({}) },\n {\n name: \"scopes\",\n displayName: \"Requested scopes\",\n type: o.optional({ type: o.list({ elementType: o.string({}) }) }),\n },\n {\n name: \"redirectUrl\",\n displayName: \"Redirect URL\",\n type: o.optional({ type: o.string({}) }),\n },\n {\n name: \"clientSecret\",\n displayName: \"Client secret\",\n type: o.optional({ type: o.encrypted({ type: o.string({}) }) }),\n },\n {\n name: \"serviceAppId\",\n displayName: \"Service app id\",\n type: o.optional({ type: o.string({}) }),\n },\n {\n name: \"connection\",\n displayName: \"Connection\",\n type: o.optional({ type: o.objectReference({ objectType: \"OAuthConnection\" }) }),\n },\n ],\n },\n {\n name: \"OAuthConnection\",\n pluralDisplayName: \"OAuthConnections\",\n displayName: \"OAuth connection\",\n primaryKey: \"id\",\n properties: [\n { name: \"id\", displayName: \"Id\", type: o.string({}) },\n { name: \"title\", displayName: \"Title\", type: o.string({}) },\n {\n name: \"application\",\n displayName: \"Application\",\n type: o.objectReference({ objectType: \"OAuthApplication\" }),\n },\n {\n name: \"userId\",\n displayName: \"User id\",\n type: o.optional({ type: o.string({}) }),\n },\n {\n name: \"status\",\n displayName: \"Status\",\n type: o.string({\n constraint: o.StringConstraint.enum({\n options: [\n { value: \"active\", label: \"active\" },\n { value: \"needs-auth\", label: \"needs-auth\" },\n { value: \"inactive\", label: \"inactive\" },\n ],\n }),\n }),\n },\n {\n name: \"accessToken\",\n displayName: \"Access token\",\n type: o.optional({ type: o.encrypted({ type: o.string({}) }) }),\n },\n {\n name: \"accessTokenExpiresAt\",\n displayName: \"Access token expires at\",\n type: o.optional({ type: o.timestamp({}) }),\n },\n {\n name: \"refreshToken\",\n displayName: \"Refresh token\",\n type: o.optional({ type: o.encrypted({ type: o.string({}) }) }),\n },\n {\n name: \"refreshTokenExpiresAt\",\n displayName: \"Refresh token expires at\",\n type: o.optional({ type: o.timestamp({}) }),\n },\n {\n name: \"grantedScopes\",\n displayName: \"Granted scopes\",\n type: o.optional({ type: o.string({}) }),\n },\n {\n name: \"operationId\",\n displayName: \"Operation id\",\n type: o.optional({ type: o.string({}) }),\n },\n {\n name: \"operationExpiresAt\",\n displayName: \"Operation expires at\",\n type: o.optional({ type: o.timestamp({}) }),\n },\n ],\n },\n {\n name: \"ApiKeyConnection\",\n pluralDisplayName: \"API key connections\",\n displayName: \"API key connection\",\n primaryKey: \"id\",\n properties: [\n { name: \"id\", displayName: \"Id\", type: o.string({}) },\n { name: \"title\", displayName: \"Title\", type: o.string({}) },\n {\n name: \"serviceInstance\",\n displayName: \"Service instance\",\n type: o.objectReference({ objectType: \"ServiceInstance\" }),\n },\n { name: \"userId\", displayName: \"User id\", type: o.string({}) },\n {\n name: \"status\",\n displayName: \"Status\",\n type: o.string({\n constraint: o.StringConstraint.enum({\n options: [\n { value: \"active\", label: \"Active\" },\n { value: \"needs-auth\", label: \"Needs authentication\" },\n { value: \"inactive\", label: \"Inactive\" },\n ],\n }),\n }),\n },\n {\n name: \"apiKey\",\n displayName: \"API key\",\n type: o.optional({ type: o.encrypted({ type: o.string({}) }) }),\n },\n { name: \"expiresAt\", displayName: \"Expires at\", type: o.optional({ type: o.timestamp({}) }) },\n ],\n },\n {\n name: \"ExternalSessionConnection\",\n pluralDisplayName: \"External session connections\",\n displayName: \"External session connection\",\n primaryKey: \"id\",\n properties: [\n { name: \"id\", displayName: \"Id\", type: o.string({}) },\n { name: \"title\", displayName: \"Title\", type: o.string({}) },\n {\n name: \"serviceInstance\",\n displayName: \"Service instance\",\n type: o.objectReference({ objectType: \"ServiceInstance\" }),\n },\n { name: \"userId\", displayName: \"User id\", type: o.string({}) },\n {\n name: \"status\",\n displayName: \"Status\",\n type: o.string({\n constraint: o.StringConstraint.enum({\n options: [\n { value: \"active\", label: \"Active\" },\n { value: \"needs-auth\", label: \"Needs authentication\" },\n { value: \"inactive\", label: \"Inactive\" },\n ],\n }),\n }),\n },\n // A selector, not a transferable credential. The service must verify its own session.\n { name: \"sessionId\", displayName: \"Session id\", type: o.string({}) },\n { name: \"expiresAt\", displayName: \"Expires at\", type: o.optional({ type: o.timestamp({}) }) },\n ],\n },\n {\n name: \"OAuthAuthorizationAttempt\",\n pluralDisplayName: \"OAuthAuthorizationAttempts\",\n displayName: \"OAuth authorization attempt\",\n primaryKey: \"id\",\n properties: [\n { name: \"id\", displayName: \"Id\", type: o.string({}) },\n {\n name: \"application\",\n displayName: \"Application\",\n type: o.objectReference({ objectType: \"OAuthApplication\" }),\n },\n {\n name: \"principalId\",\n displayName: \"Principal id\",\n type: o.optional({ type: o.string({}) }),\n },\n {\n name: \"connectionId\",\n displayName: \"Connection id\",\n type: o.string({}),\n },\n { name: \"redirectUrl\", displayName: \"Redirect url\", type: o.string({}) },\n { name: \"returnUrl\", displayName: \"Return url\", type: o.optional({ type: o.string({}) }) },\n {\n name: \"codeVerifier\",\n displayName: \"Code verifier\",\n type: o.encrypted({ type: o.string({}) }),\n },\n { name: \"expiresAt\", displayName: \"Expires at\", type: o.timestamp({}) },\n {\n name: \"status\",\n displayName: \"Status\",\n type: o.string({\n constraint: o.StringConstraint.enum({\n options: [\n { value: \"pending\", label: \"pending\" },\n { value: \"exchanging\", label: \"exchanging\" },\n { value: \"completed\", label: \"completed\" },\n { value: \"failed\", label: \"failed\" },\n ],\n }),\n }),\n },\n ],\n },\n ],\n linkTypes: [],\n actionTypes: [\n {\n name: \"beginAuthorization\",\n displayName: \"Begin authorization\",\n logic: [],\n parameters: [\n {\n name: \"applicationId\",\n displayName: \"Application\",\n type: o.objectReference({ objectType: \"OAuthApplication\" }),\n },\n { name: \"principalId\", displayName: \"Principal\", type: o.optional({ type: o.string({}) }) },\n { name: \"redirectUrl\", displayName: \"Redirect URL\", type: o.string({}) },\n { name: \"returnUrl\", displayName: \"Return URL\", type: o.optional({ type: o.string({}) }) },\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.optional({ type: o.objectReference({ objectType: \"OAuthConnection\" }) }),\n },\n ],\n returnType: o.struct({\n fields: [\n { name: \"id\", displayName: \"Attempt\", type: o.string({}) },\n { name: \"authorizationUrl\", displayName: \"Authorization URL\", type: o.string({}) },\n ],\n }),\n },\n {\n name: \"completeAuthorization\",\n displayName: \"Complete authorization\",\n logic: [],\n parameters: [\n { name: \"callbackUrl\", displayName: \"Callback URL\", type: o.string({}) },\n { name: \"principalId\", displayName: \"Principal\", type: o.optional({ type: o.string({}) }) },\n ],\n returnType: o.struct({\n fields: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"OAuthConnection\" }),\n },\n ],\n }),\n },\n {\n name: \"connectClientCredentials\",\n displayName: \"Connect client credentials\",\n logic: [],\n parameters: [\n {\n name: \"applicationId\",\n displayName: \"Application\",\n type: o.objectReference({ objectType: \"OAuthApplication\" }),\n },\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.optional({ type: o.objectReference({ objectType: \"OAuthConnection\" }) }),\n },\n ],\n returnType: o.struct({\n fields: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"OAuthConnection\" }),\n },\n ],\n }),\n },\n {\n name: \"refreshConnection\",\n displayName: \"Refresh connection\",\n logic: [],\n parameters: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"OAuthConnection\" }),\n },\n ],\n returnType: o.struct({\n fields: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"OAuthConnection\" }),\n },\n ],\n }),\n },\n {\n name: \"disconnectConnection\",\n displayName: \"Disconnect connection\",\n logic: [],\n parameters: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"OAuthConnection\" }),\n },\n ],\n },\n {\n name: \"forgetConnection\",\n displayName: \"Forget connection\",\n logic: [],\n parameters: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"OAuthConnection\" }),\n },\n ],\n },\n {\n name: \"connectApiKey\",\n displayName: \"Connect API key\",\n logic: [],\n parameters: [\n {\n name: \"serviceInstanceId\",\n displayName: \"Service instance\",\n type: o.objectReference({ objectType: \"ServiceInstance\" }),\n },\n { name: \"apiKey\", displayName: \"API key\", type: o.string({}) },\n ],\n returnType: o.struct({\n fields: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"ApiKeyConnection\" }),\n },\n ],\n }),\n },\n {\n name: \"attachExternalSession\",\n displayName: \"Attach external session\",\n logic: [],\n parameters: [\n {\n name: \"serviceInstanceId\",\n displayName: \"Service instance\",\n type: o.objectReference({ objectType: \"ServiceInstance\" }),\n },\n { name: \"sessionId\", displayName: \"Session id\", type: o.string({}) },\n ],\n returnType: o.struct({\n fields: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"ExternalSessionConnection\" }),\n },\n ],\n }),\n },\n {\n name: \"disconnectApiKey\",\n displayName: \"Disconnect API key\",\n logic: [],\n parameters: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"ApiKeyConnection\" }),\n },\n ],\n },\n {\n name: \"forgetApiKey\",\n displayName: \"Forget API key\",\n logic: [],\n parameters: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"ApiKeyConnection\" }),\n },\n ],\n },\n {\n name: \"disconnectExternalSession\",\n displayName: \"Disconnect external session\",\n logic: [],\n parameters: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"ExternalSessionConnection\" }),\n },\n ],\n },\n {\n name: \"forgetExternalSession\",\n displayName: \"Forget external session\",\n logic: [],\n parameters: [\n {\n name: \"connectionId\",\n displayName: \"Connection\",\n type: o.objectReference({ objectType: \"ExternalSessionConnection\" }),\n },\n ],\n },\n ],\n queryFunctionTypes: [],\n});\nexport type ConnectOntology = Infer<typeof connectOntology>;\nexport type ServiceInstanceRecord = ConnectOntology[\"objectTypes\"][\"ServiceInstance\"];\nexport type OAuthApplicationRecord = ConnectOntology[\"objectTypes\"][\"OAuthApplication\"];\nexport type OAuthConnectionRecord = ConnectOntology[\"objectTypes\"][\"OAuthConnection\"];\nexport type ApiKeyConnectionRecord = ConnectOntology[\"objectTypes\"][\"ApiKeyConnection\"];\nexport type ExternalSessionConnectionRecord = ConnectOntology[\"objectTypes\"][\"ExternalSessionConnection\"];\nexport type OAuthAuthorizationAttemptRecord = ConnectOntology[\"objectTypes\"][\"OAuthAuthorizationAttempt\"];\n"],"mappings":";;;;;AAKA,MAAa,kBAAkB,eAAe;CAC1C,OAAO,CAAC;CACR,aAAa;EACT;GACI,MAAM;GACN,mBAAmB;GACnB,aAAa;GACb,YAAY;GACZ,YAAY;IACR;KAAE,MAAM;KAAM,aAAa;KAAM,MAAM,EAAE,OAAO,CAAC,CAAC;IAAE;IACpD;KAAE,MAAM;KAAS,aAAa;KAAS,MAAM,EAAE,OAAO,CAAC,CAAC;IAAE;IAC1D;KAAE,MAAM;KAAW,aAAa;KAAW,MAAM,EAAE,OAAO,CAAC,CAAC;IAAE;IAC9D;KAAE,MAAM;KAAe,aAAa;KAAgB,MAAM,EAAE,OAAO,CAAC,CAAC;IAAE;GAC3E;EACJ;EACA;GACI,MAAM;GACN,mBAAmB;GACnB,aAAa;GACb,YAAY;GACZ,YAAY;IACR;KAAE,MAAM;KAAM,aAAa;KAAM,MAAM,EAAE,OAAO,CAAC,CAAC;IAAE;IACpD;KAAE,MAAM;KAAS,aAAa;KAAS,MAAM,EAAE,OAAO,CAAC,CAAC;IAAE;IAC1D;KACI,MAAM;KACN,aAAa;KACb,MAAM,EAAE,gBAAgB,EAAE,YAAY,kBAAkB,CAAC;IAC7D;IACA;KACI,MAAM;KACN,aAAa;KACb,MAAM,EAAE,OAAO,EACX,YAAY,EAAE,iBAAiB,KAAK,EAChC,SAAS,CACL;MA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ACI,MAAM;IACN,aAAa;IACb,MAAM,EAAE,gBAAgB,EAAE,YAAY,mBAAmB,CAAC;GAC9D,CACJ,EACJ,CAAC;EACL;EACA;GACI,MAAM;GACN,aAAa;GACb,OAAO,CAAC;GACR,YAAY,CACR;IACI,MAAM;IACN,aAAa;IACb,MAAM,EAAE,gBAAgB,EAAE,YAAY,kBAAkB,CAAC;GAC7D,GACA;IAAE,MAAM;IAAa,aAAa;IAAc,MAAM,EAAE,OAAO,CAAC,CAAC;GAAE,CACvE;GACA,YAAY,EAAE,OAAO,EACjB,QAAQ,CACJ;IACI,MAAM;IACN,aAAa;IACb,MAAM,EAAE,gBAAgB,EAAE,YAAY,4BAA4B,CAAC;GACvE,CACJ,EACJ,CAAC;EACL;EACA;GACI,MAAM;GACN,aAAa;GACb,OAAO,CAAC;GACR,YAAY,CACR;IACI,MAAM;IACN,aAAa;IACb,MAAM,EAAE,gBAAgB,EAAE,YAAY,mBAAmB,CAAC;GAC9D,CACJ;EACJ;EACA;GACI,MAAM;GACN,aAAa;GACb,OAAO,CAAC;GACR,YAAY,CACR;IACI,MAAM;IACN,aAAa;IACb,MAAM,EAAE,gBAAgB,EAAE,YAAY,mBAAmB,CAAC;GAC9D,CACJ;EACJ;EACA;GACI,MAAM;GACN,aAAa;GACb,OAAO,CAAC;GACR,YAAY,CACR;IACI,MAAM;IACN,aAAa;IACb,MAAM,EAAE,gBAAgB,EAAE,YAAY,4BAA4B,CAAC;GACvE,CACJ;EACJ;EACA;GACI,MAAM;GACN,aAAa;GACb,OAAO,CAAC;GACR,YAAY,CACR;IACI,MAAM;IACN,aAAa;IACb,MAAM,EAAE,gBAAgB,EAAE,YAAY,4BAA4B,CAAC;GACvE,CACJ;EACJ;CACJ;CACA,oBAAoB,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConnectionEgress, ConnectionEgressHandlers } from "./types.js";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
//#region src/toWebEgress.d.ts
|
|
4
|
+
/** Promise boundary for third-party SDKs. Operations remain owned by the
|
|
5
|
+
* acquiring scope; closing it cancels in-flight work and rejects later calls.
|
|
6
|
+
*/
|
|
7
|
+
export declare const toWebEgress: (egress: ConnectionEgress | ConnectionEgressHandlers) => Effect.Effect<{
|
|
8
|
+
fetch: typeof fetch;
|
|
9
|
+
createWebSocket: (url: string | URL, protocols?: string | string[]) => Promise<WebSocket>;
|
|
10
|
+
}, never, import("effect/Scope").Scope>;
|
|
11
|
+
//#endregion
|
|
12
|
+
//# sourceMappingURL=toWebEgress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toWebEgress.d.ts","names":[],"sources":["../src/toWebEgress.ts"],"mappings":";;;;;;qBAOa,cAAW,QAAA,mBAAA,6BAAA,OAAA;;EAsBO,kBAAA,cAAS,KAAG,kCAA+B,QAAA;iCAGxE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BackendError } from "@party-stack/ontology-backend";
|
|
2
|
+
import { Effect, Fiber } from "effect";
|
|
3
|
+
//#region src/toWebEgress.ts
|
|
4
|
+
/** Promise boundary for third-party SDKs. Operations remain owned by the
|
|
5
|
+
* acquiring scope; closing it cancels in-flight work and rejects later calls.
|
|
6
|
+
*/
|
|
7
|
+
const toWebEgress = Effect.fnUntraced(function* (egress) {
|
|
8
|
+
const scope = yield* Effect.scope;
|
|
9
|
+
const run = Effect.runPromiseWith(yield* Effect.context());
|
|
10
|
+
const owned = (work) => Effect.suspend(() => scope.state._tag === "Closed" ? Effect.fail(new BackendError({
|
|
11
|
+
operation: "connect.egress",
|
|
12
|
+
kind: "Unavailable",
|
|
13
|
+
retryable: false,
|
|
14
|
+
message: "The selected connection was released."
|
|
15
|
+
})) : Effect.acquireUseRelease(Effect.forkIn(work, scope), Fiber.join, Fiber.interrupt));
|
|
16
|
+
const fetch = async (input, init) => {
|
|
17
|
+
const request = new Request(input, init);
|
|
18
|
+
return run(owned(egress.fetch(request)), { signal: request.signal });
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
fetch,
|
|
22
|
+
createWebSocket: (url, protocols) => run(owned(egress.createWebSocket(url, protocols)))
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
export { toWebEgress };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=toWebEgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toWebEgress.js","names":[],"sources":["../src/toWebEgress.ts"],"sourcesContent":["import { BackendError } from \"@party-stack/ontology-backend\";\nimport { Effect, Fiber } from \"effect\";\nimport type { ConnectionEgress, ConnectionEgressHandlers } from \"./types.js\";\n\n/** Promise boundary for third-party SDKs. Operations remain owned by the\n * acquiring scope; closing it cancels in-flight work and rejects later calls.\n */\nexport const toWebEgress = Effect.fnUntraced(function* (egress: ConnectionEgress | ConnectionEgressHandlers) {\n const scope = yield* Effect.scope;\n const run = Effect.runPromiseWith(yield* Effect.context<never>());\n const owned = <A>(work: Effect.Effect<A, BackendError>) =>\n Effect.suspend(() =>\n scope.state._tag === \"Closed\"\n ? Effect.fail(\n new BackendError({\n operation: \"connect.egress\",\n kind: \"Unavailable\",\n retryable: false,\n message: \"The selected connection was released.\",\n })\n )\n : Effect.acquireUseRelease(Effect.forkIn(work, scope), Fiber.join, Fiber.interrupt)\n );\n const fetch: typeof globalThis.fetch = async (input, init) => {\n const request = new Request(input, init);\n return run(owned(egress.fetch(request)), { signal: request.signal });\n };\n return {\n fetch,\n createWebSocket: (url: string | URL, protocols?: string | string[]) =>\n run(owned(egress.createWebSocket(url, protocols))),\n };\n});\n"],"mappings":";;;;;;AAOA,MAAa,cAAc,OAAO,WAAW,WAAW,QAAqD;CACzG,MAAM,QAAQ,OAAO,OAAO;CAC5B,MAAM,MAAM,OAAO,eAAe,OAAO,OAAO,QAAe,CAAC;CAChE,MAAM,SAAY,SACd,OAAO,cACH,MAAM,MAAM,SAAS,WACf,OAAO,KACH,IAAI,aAAa;EACb,WAAW;EACX,MAAM;EACN,WAAW;EACX,SAAS;CACb,CAAC,CACL,IACA,OAAO,kBAAkB,OAAO,OAAO,MAAM,KAAK,GAAG,MAAM,MAAM,MAAM,SAAS,CAC1F;CACJ,MAAM,QAAiC,OAAO,OAAO,SAAS;EAC1D,MAAM,UAAU,IAAI,QAAQ,OAAO,IAAI;EACvC,OAAO,IAAI,MAAM,OAAO,MAAM,OAAO,CAAC,GAAG,EAAE,QAAQ,QAAQ,OAAO,CAAC;CACvE;CACA,OAAO;EACH;EACA,kBAAkB,KAAmB,cACjC,IAAI,MAAM,OAAO,gBAAgB,KAAK,SAAS,CAAC,CAAC;CACzD;AACJ,CAAC"}
|