@fragno-dev/api-fragment 0.0.0-stage → 0.0.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.md +16 -0
- package/README.md +249 -2
- package/dist/browser/client/client-3ZV9sw3i.js +2580 -0
- package/dist/browser/client/client-3ZV9sw3i.js.map +1 -0
- package/dist/browser/client/client-DPjmoaJQ.d.ts +711 -0
- package/dist/browser/client/client-DPjmoaJQ.d.ts.map +1 -0
- package/dist/browser/client/client.d.ts +1645 -0
- package/dist/browser/client/client.d.ts.map +1 -0
- package/dist/browser/client/client.js +2 -0
- package/dist/browser/client/react.d.ts +1665 -0
- package/dist/browser/client/react.d.ts.map +1 -0
- package/dist/browser/client/react.js +194 -0
- package/dist/browser/client/react.js.map +1 -0
- package/dist/browser/client/solid.d.ts +1668 -0
- package/dist/browser/client/solid.d.ts.map +1 -0
- package/dist/browser/client/solid.js +129 -0
- package/dist/browser/client/solid.js.map +1 -0
- package/dist/browser/client/svelte.d.ts +1668 -0
- package/dist/browser/client/svelte.d.ts.map +1 -0
- package/dist/browser/client/svelte.js +131 -0
- package/dist/browser/client/svelte.js.map +1 -0
- package/dist/browser/client/vanilla.d.ts +1695 -0
- package/dist/browser/client/vanilla.d.ts.map +1 -0
- package/dist/browser/client/vanilla.js +159 -0
- package/dist/browser/client/vanilla.js.map +1 -0
- package/dist/browser/client/vue.d.ts +1668 -0
- package/dist/browser/client/vue.d.ts.map +1 -0
- package/dist/browser/client/vue.js +127 -0
- package/dist/browser/client/vue.js.map +1 -0
- package/dist/browser/client-D4NnY-zV.d.ts +713 -0
- package/dist/browser/client-D4NnY-zV.d.ts.map +1 -0
- package/dist/browser/client-DQE0c7GI.d.ts +711 -0
- package/dist/browser/client-DQE0c7GI.d.ts.map +1 -0
- package/dist/browser/index.d.ts +3130 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/src-BrYPVbAN.js +2404 -0
- package/dist/browser/src-BrYPVbAN.js.map +1 -0
- package/dist/browser/src-t-4wp9-f.js +2400 -0
- package/dist/browser/src-t-4wp9-f.js.map +1 -0
- package/dist/node/api-types.d.ts +731 -0
- package/dist/node/api-types.d.ts.map +1 -0
- package/dist/node/api-types.js +281 -0
- package/dist/node/api-types.js.map +1 -0
- package/dist/node/crypto.d.ts +6 -0
- package/dist/node/crypto.d.ts.map +1 -0
- package/dist/node/crypto.js +103 -0
- package/dist/node/crypto.js.map +1 -0
- package/dist/node/definition.d.ts +638 -0
- package/dist/node/definition.d.ts.map +1 -0
- package/dist/node/definition.js +315 -0
- package/dist/node/definition.js.map +1 -0
- package/dist/node/oauth.js +124 -0
- package/dist/node/oauth.js.map +1 -0
- package/dist/node/routes.d.ts +1585 -0
- package/dist/node/routes.d.ts.map +1 -0
- package/dist/node/routes.js +1100 -0
- package/dist/node/routes.js.map +1 -0
- package/dist/node/schema.d.ts +99 -0
- package/dist/node/schema.d.ts.map +1 -0
- package/dist/node/schema.js +16 -0
- package/dist/node/schema.js.map +1 -0
- package/dist/node/server.d.ts +1585 -0
- package/dist/node/server.d.ts.map +1 -0
- package/dist/node/server.js +12 -0
- package/dist/node/server.js.map +1 -0
- package/dist/node/services.d.ts +10 -0
- package/dist/node/services.d.ts.map +1 -0
- package/dist/node/services.js +304 -0
- package/dist/node/services.js.map +1 -0
- package/dist/node/webhooks/auth.d.ts +133 -0
- package/dist/node/webhooks/auth.d.ts.map +1 -0
- package/dist/node/webhooks/auth.js +268 -0
- package/dist/node/webhooks/auth.js.map +1 -0
- package/dist/node/webhooks/verification.d.ts +102 -0
- package/dist/node/webhooks/verification.d.ts.map +1 -0
- package/dist/node/webhooks/verification.js +119 -0
- package/dist/node/webhooks/verification.js.map +1 -0
- package/package.json +136 -3
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
import { ApiFragmentConfig as ApiFragmentConfig$1, ApiRequestInput, WebhookEndpoint } from "./api-types.js";
|
|
2
|
+
import { AuthPersistenceChanges } from "./services.js";
|
|
3
|
+
import { HookContext, HookFn } from "@fragno-dev/db";
|
|
4
|
+
//#region src/definition.d.ts
|
|
5
|
+
interface ApiConnectionHookSnapshot {
|
|
6
|
+
slug: string;
|
|
7
|
+
name: string | null;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
authMode: string;
|
|
10
|
+
status: string;
|
|
11
|
+
}
|
|
12
|
+
interface ApiConnectionChangedPayload {
|
|
13
|
+
connectionId: string;
|
|
14
|
+
connection: ApiConnectionHookSnapshot;
|
|
15
|
+
}
|
|
16
|
+
interface ApiConnectionDeletedPayload {
|
|
17
|
+
connectionId: string;
|
|
18
|
+
previous: ApiConnectionHookSnapshot;
|
|
19
|
+
}
|
|
20
|
+
interface ApiConnectionReadinessChangedPayload {
|
|
21
|
+
connectionId: string;
|
|
22
|
+
/** Whether stored auth can authorize requests; providers can still reject it. */
|
|
23
|
+
ready: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A readiness change as delivered. The connection is read at delivery rather than stored with the
|
|
27
|
+
* hook, so it is the current connection, or null after it was deleted.
|
|
28
|
+
*/
|
|
29
|
+
interface ApiConnectionReadinessChange extends ApiConnectionReadinessChangedPayload {
|
|
30
|
+
connection: ApiConnectionHookSnapshot | null;
|
|
31
|
+
}
|
|
32
|
+
/** The token stored when expiry was scheduled; a later write replaces it and reports itself. */
|
|
33
|
+
interface InternalAuthExpiredPayload {
|
|
34
|
+
connectionId: string;
|
|
35
|
+
expiresAt: string;
|
|
36
|
+
}
|
|
37
|
+
interface InternalWebhookReceivedPayload {
|
|
38
|
+
endpointId: string;
|
|
39
|
+
deliveryId: string;
|
|
40
|
+
hookId: string;
|
|
41
|
+
receivedAt: string;
|
|
42
|
+
headers: Record<string, string>;
|
|
43
|
+
query: Record<string, string>;
|
|
44
|
+
rawBody: string;
|
|
45
|
+
body: Record<string, unknown>;
|
|
46
|
+
contentType: string | null;
|
|
47
|
+
}
|
|
48
|
+
interface WebhookEndpointHookSnapshot {
|
|
49
|
+
name: WebhookEndpoint["name"];
|
|
50
|
+
status: WebhookEndpoint["status"];
|
|
51
|
+
authConfig: WebhookEndpoint["authConfig"];
|
|
52
|
+
verification: WebhookEndpoint["verification"];
|
|
53
|
+
deliveryIdentity: WebhookEndpoint["deliveryIdentity"];
|
|
54
|
+
secretRefs: WebhookEndpoint["secretRefs"];
|
|
55
|
+
}
|
|
56
|
+
type WebhookEndpointChangedPayload = {
|
|
57
|
+
change: "created";
|
|
58
|
+
endpointId: string;
|
|
59
|
+
endpoint: WebhookEndpointHookSnapshot;
|
|
60
|
+
} | {
|
|
61
|
+
change: "updated";
|
|
62
|
+
endpointId: string;
|
|
63
|
+
endpoint: WebhookEndpointHookSnapshot;
|
|
64
|
+
/** Lets consumers tell whether the write changed if the endpoint accepts deliveries. */
|
|
65
|
+
previousStatus: WebhookEndpoint["status"];
|
|
66
|
+
} | {
|
|
67
|
+
change: "deleted";
|
|
68
|
+
endpointId: string;
|
|
69
|
+
};
|
|
70
|
+
interface WebhookReceivedPayload {
|
|
71
|
+
endpointId: string;
|
|
72
|
+
deliveryId: string;
|
|
73
|
+
hookId: string;
|
|
74
|
+
receivedAt: string;
|
|
75
|
+
headers: Record<string, string>;
|
|
76
|
+
query: Record<string, string>;
|
|
77
|
+
body: Record<string, unknown>;
|
|
78
|
+
contentType: string | null;
|
|
79
|
+
}
|
|
80
|
+
interface ApiFragmentHooksConfig {
|
|
81
|
+
onConnectionChanged?: (payload: ApiConnectionChangedPayload, context: HookContext) => Promise<void> | void;
|
|
82
|
+
onConnectionDeleted?: (payload: ApiConnectionDeletedPayload, context: HookContext) => Promise<void> | void;
|
|
83
|
+
/**
|
|
84
|
+
* Fires when a write changes whether the connection can authorize requests, including creation,
|
|
85
|
+
* and when an access token without a refresh token expires.
|
|
86
|
+
*/
|
|
87
|
+
onConnectionReadinessChanged?: (payload: ApiConnectionReadinessChange, context: HookContext) => Promise<void> | void;
|
|
88
|
+
onWebhookEndpointChanged?: (payload: WebhookEndpointChangedPayload, context: HookContext) => Promise<void> | void;
|
|
89
|
+
onWebhookReceived?: (payload: WebhookReceivedPayload, context: HookContext) => Promise<void> | void;
|
|
90
|
+
}
|
|
91
|
+
type ApiFragmentConfig = ApiFragmentConfig$1 & ApiFragmentHooksConfig;
|
|
92
|
+
type ApiHooksMap = {
|
|
93
|
+
onConnectionChanged: HookFn<ApiConnectionChangedPayload>;
|
|
94
|
+
onConnectionDeleted: HookFn<ApiConnectionDeletedPayload>;
|
|
95
|
+
onConnectionReadinessChanged: HookFn<ApiConnectionReadinessChangedPayload>;
|
|
96
|
+
onAuthExpired: HookFn<InternalAuthExpiredPayload>;
|
|
97
|
+
onWebhookEndpointChanged: HookFn<WebhookEndpointChangedPayload>;
|
|
98
|
+
onWebhookReceived: HookFn<InternalWebhookReceivedPayload>;
|
|
99
|
+
};
|
|
100
|
+
declare const apiFragmentDefinition: import("@fragno-dev/core").FragmentDefinition<ApiFragmentConfig, import("@fragno-dev/db").FragnoPublicConfigWithDatabase, import("@fragno-dev/db").ImplicitDatabaseDependencies<import("@fragno-dev/db/schema").Schema<{
|
|
101
|
+
api_connection: import("@fragno-dev/db/schema").Table<Record<"id", import("@fragno-dev/db/schema").IdColumn<"varchar(128)", string | import("@fragno-dev/db/schema").FragnoId | null, import("@fragno-dev/db/schema").FragnoId>> & Record<"name", import("@fragno-dev/db/schema").Column<"string", string | null, string | null>> & Record<"baseUrl", import("@fragno-dev/db/schema").Column<"string", string, string>> & Record<"authMode", import("@fragno-dev/db/schema").Column<"string", string, string>> & Record<"status", import("@fragno-dev/db/schema").Column<"string", string, string>> & Record<"createdAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date>> & Record<"updatedAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date>>, {}>;
|
|
102
|
+
secret: import("@fragno-dev/db/schema").Table<Record<"id", import("@fragno-dev/db/schema").IdColumn<"varchar(128)", string | import("@fragno-dev/db/schema").FragnoId | null, import("@fragno-dev/db/schema").FragnoId>> & Record<"connectionId", import("@fragno-dev/db/schema").Column<"bigint", string | bigint | import("@fragno-dev/db/schema").FragnoId | import("@fragno-dev/db/schema").FragnoReference, import("@fragno-dev/db/schema").FragnoReference>> & Record<"kind", import("@fragno-dev/db/schema").Column<"string", string, string>> & Record<"payload", import("@fragno-dev/db/schema").Column<"text", string, string>> & Record<"expiresAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date | null>> & Record<"updatedAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date>>, Record<"idx_secret_connection_kind", import("@fragno-dev/db/schema").Index<readonly [import("@fragno-dev/db/schema").Column<"bigint", string | bigint | import("@fragno-dev/db/schema").FragnoId | import("@fragno-dev/db/schema").FragnoReference, import("@fragno-dev/db/schema").FragnoReference>, import("@fragno-dev/db/schema").Column<"string", string, string>] & import("@fragno-dev/db/schema").AnyColumn[], readonly ["connectionId", "kind"]>>>;
|
|
103
|
+
oauthState: import("@fragno-dev/db/schema").Table<Record<"id", import("@fragno-dev/db/schema").IdColumn<"varchar(128)", string | import("@fragno-dev/db/schema").FragnoId | null, import("@fragno-dev/db/schema").FragnoId>> & Record<"connectionId", import("@fragno-dev/db/schema").Column<"bigint", string | bigint | import("@fragno-dev/db/schema").FragnoId | import("@fragno-dev/db/schema").FragnoReference, import("@fragno-dev/db/schema").FragnoReference>> & Record<"codeVerifier", import("@fragno-dev/db/schema").Column<"text", string, string>> & Record<"redirectUri", import("@fragno-dev/db/schema").Column<"string", string, string>> & Record<"scope", import("@fragno-dev/db/schema").Column<"string", string | null, string | null>> & Record<"expiresAt", import("@fragno-dev/db/schema").Column<"timestamp", Date | import("@fragno-dev/db").DbNow, Date>> & Record<"consumedAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date | null>> & Record<"authorizationUrl", import("@fragno-dev/db/schema").Column<"text", string | null, string | null>>, Record<"idx_oauth_state_connection", import("@fragno-dev/db/schema").Index<readonly [import("@fragno-dev/db/schema").Column<"bigint", string | bigint | import("@fragno-dev/db/schema").FragnoId | import("@fragno-dev/db/schema").FragnoReference, import("@fragno-dev/db/schema").FragnoReference>] & import("@fragno-dev/db/schema").AnyColumn[], readonly ["connectionId"]>> & Record<"idx_oauth_state_pending", import("@fragno-dev/db/schema").Index<readonly [import("@fragno-dev/db/schema").Column<"bigint", string | bigint | import("@fragno-dev/db/schema").FragnoId | import("@fragno-dev/db/schema").FragnoReference, import("@fragno-dev/db/schema").FragnoReference>, import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date | null>, import("@fragno-dev/db/schema").Column<"timestamp", Date | import("@fragno-dev/db").DbNow, Date>] & import("@fragno-dev/db/schema").AnyColumn[], readonly ["connectionId", "consumedAt", "expiresAt"]>>>;
|
|
104
|
+
webhookEndpoint: import("@fragno-dev/db/schema").Table<Record<"id", import("@fragno-dev/db/schema").IdColumn<"varchar(128)", string | import("@fragno-dev/db/schema").FragnoId | null, import("@fragno-dev/db/schema").FragnoId>> & Record<"name", import("@fragno-dev/db/schema").Column<"string", string, string>> & Record<"status", import("@fragno-dev/db/schema").Column<"string", string, string>> & Record<"authConfig", import("@fragno-dev/db/schema").Column<"json", {
|
|
105
|
+
type: "none";
|
|
106
|
+
} | {
|
|
107
|
+
type: "bearer";
|
|
108
|
+
tokenRef: string;
|
|
109
|
+
} | {
|
|
110
|
+
type: "apiKey";
|
|
111
|
+
location: "header" | "query";
|
|
112
|
+
name: string;
|
|
113
|
+
secretRef: string;
|
|
114
|
+
} | {
|
|
115
|
+
type: "basic";
|
|
116
|
+
usernameRef: string;
|
|
117
|
+
passwordRef: string;
|
|
118
|
+
} | {
|
|
119
|
+
type: "hmac";
|
|
120
|
+
secretRef: string;
|
|
121
|
+
algorithm: "sha1" | "sha256" | "sha512";
|
|
122
|
+
signature: {
|
|
123
|
+
location: "header" | "query";
|
|
124
|
+
name: string;
|
|
125
|
+
encoding: "hex" | "base64" | "base64url";
|
|
126
|
+
prefix?: string | undefined;
|
|
127
|
+
};
|
|
128
|
+
signedPayload: {
|
|
129
|
+
type: "rawBody";
|
|
130
|
+
} | {
|
|
131
|
+
type: "timestampedBody";
|
|
132
|
+
prefix: string;
|
|
133
|
+
timestampHeader: string;
|
|
134
|
+
delimiter: string;
|
|
135
|
+
toleranceSeconds: number;
|
|
136
|
+
};
|
|
137
|
+
}, {
|
|
138
|
+
type: "none";
|
|
139
|
+
} | {
|
|
140
|
+
type: "bearer";
|
|
141
|
+
tokenRef: string;
|
|
142
|
+
} | {
|
|
143
|
+
type: "apiKey";
|
|
144
|
+
location: "header" | "query";
|
|
145
|
+
name: string;
|
|
146
|
+
secretRef: string;
|
|
147
|
+
} | {
|
|
148
|
+
type: "basic";
|
|
149
|
+
usernameRef: string;
|
|
150
|
+
passwordRef: string;
|
|
151
|
+
} | {
|
|
152
|
+
type: "hmac";
|
|
153
|
+
secretRef: string;
|
|
154
|
+
algorithm: "sha1" | "sha256" | "sha512";
|
|
155
|
+
signature: {
|
|
156
|
+
location: "header" | "query";
|
|
157
|
+
name: string;
|
|
158
|
+
encoding: "hex" | "base64" | "base64url";
|
|
159
|
+
prefix?: string | undefined;
|
|
160
|
+
};
|
|
161
|
+
signedPayload: {
|
|
162
|
+
type: "rawBody";
|
|
163
|
+
} | {
|
|
164
|
+
type: "timestampedBody";
|
|
165
|
+
prefix: string;
|
|
166
|
+
timestampHeader: string;
|
|
167
|
+
delimiter: string;
|
|
168
|
+
toleranceSeconds: number;
|
|
169
|
+
};
|
|
170
|
+
}>> & Record<"verification", import("@fragno-dev/db/schema").Column<"json", {
|
|
171
|
+
type: "none";
|
|
172
|
+
} | {
|
|
173
|
+
type: "challenge";
|
|
174
|
+
method: "GET" | "POST";
|
|
175
|
+
when: {
|
|
176
|
+
type: "present";
|
|
177
|
+
source: {
|
|
178
|
+
type: "header";
|
|
179
|
+
name: string;
|
|
180
|
+
} | {
|
|
181
|
+
type: "query";
|
|
182
|
+
name: string;
|
|
183
|
+
} | {
|
|
184
|
+
type: "jsonBodyPath";
|
|
185
|
+
path: string[];
|
|
186
|
+
};
|
|
187
|
+
} | {
|
|
188
|
+
type: "equals";
|
|
189
|
+
source: {
|
|
190
|
+
type: "header";
|
|
191
|
+
name: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: "query";
|
|
194
|
+
name: string;
|
|
195
|
+
} | {
|
|
196
|
+
type: "jsonBodyPath";
|
|
197
|
+
path: string[];
|
|
198
|
+
};
|
|
199
|
+
value: string;
|
|
200
|
+
};
|
|
201
|
+
response: {
|
|
202
|
+
type: "echoText";
|
|
203
|
+
source: {
|
|
204
|
+
type: "header";
|
|
205
|
+
name: string;
|
|
206
|
+
} | {
|
|
207
|
+
type: "query";
|
|
208
|
+
name: string;
|
|
209
|
+
} | {
|
|
210
|
+
type: "jsonBodyPath";
|
|
211
|
+
path: string[];
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
}, {
|
|
215
|
+
type: "none";
|
|
216
|
+
} | {
|
|
217
|
+
type: "challenge";
|
|
218
|
+
method: "GET" | "POST";
|
|
219
|
+
when: {
|
|
220
|
+
type: "present";
|
|
221
|
+
source: {
|
|
222
|
+
type: "header";
|
|
223
|
+
name: string;
|
|
224
|
+
} | {
|
|
225
|
+
type: "query";
|
|
226
|
+
name: string;
|
|
227
|
+
} | {
|
|
228
|
+
type: "jsonBodyPath";
|
|
229
|
+
path: string[];
|
|
230
|
+
};
|
|
231
|
+
} | {
|
|
232
|
+
type: "equals";
|
|
233
|
+
source: {
|
|
234
|
+
type: "header";
|
|
235
|
+
name: string;
|
|
236
|
+
} | {
|
|
237
|
+
type: "query";
|
|
238
|
+
name: string;
|
|
239
|
+
} | {
|
|
240
|
+
type: "jsonBodyPath";
|
|
241
|
+
path: string[];
|
|
242
|
+
};
|
|
243
|
+
value: string;
|
|
244
|
+
};
|
|
245
|
+
response: {
|
|
246
|
+
type: "echoText";
|
|
247
|
+
source: {
|
|
248
|
+
type: "header";
|
|
249
|
+
name: string;
|
|
250
|
+
} | {
|
|
251
|
+
type: "query";
|
|
252
|
+
name: string;
|
|
253
|
+
} | {
|
|
254
|
+
type: "jsonBodyPath";
|
|
255
|
+
path: string[];
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
}>> & Record<"deliveryIdentity", import("@fragno-dev/db/schema").Column<"json", {
|
|
259
|
+
type: "header";
|
|
260
|
+
name: string;
|
|
261
|
+
} | {
|
|
262
|
+
type: "query";
|
|
263
|
+
name: string;
|
|
264
|
+
} | {
|
|
265
|
+
type: "jsonBodyPath";
|
|
266
|
+
path: string[];
|
|
267
|
+
}, {
|
|
268
|
+
type: "header";
|
|
269
|
+
name: string;
|
|
270
|
+
} | {
|
|
271
|
+
type: "query";
|
|
272
|
+
name: string;
|
|
273
|
+
} | {
|
|
274
|
+
type: "jsonBodyPath";
|
|
275
|
+
path: string[];
|
|
276
|
+
}>> & Record<"createdAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date>> & Record<"updatedAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date>> & Record<"lastAcceptedAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date | null>> & Record<"lastRejectedAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date | null>> & Record<"lastRejectionCode", import("@fragno-dev/db/schema").Column<"string", string | null, string | null>>, {}>;
|
|
277
|
+
webhookSecret: import("@fragno-dev/db/schema").Table<Record<"id", import("@fragno-dev/db/schema").IdColumn<"varchar(128)", string | import("@fragno-dev/db/schema").FragnoId | null, import("@fragno-dev/db/schema").FragnoId>> & Record<"endpointId", import("@fragno-dev/db/schema").Column<"bigint", string | bigint | import("@fragno-dev/db/schema").FragnoId | import("@fragno-dev/db/schema").FragnoReference, import("@fragno-dev/db/schema").FragnoReference>> & Record<"ref", import("@fragno-dev/db/schema").Column<"string", string, string>> & Record<"payload", import("@fragno-dev/db/schema").Column<"text", string, string>> & Record<"updatedAt", import("@fragno-dev/db/schema").Column<"timestamp", (Date | import("@fragno-dev/db").DbNow) | null, Date>>, Record<"idx_webhook_secret_endpoint_ref", import("@fragno-dev/db/schema").Index<readonly [import("@fragno-dev/db/schema").Column<"bigint", string | bigint | import("@fragno-dev/db/schema").FragnoId | import("@fragno-dev/db/schema").FragnoReference, import("@fragno-dev/db/schema").FragnoReference>, import("@fragno-dev/db/schema").Column<"string", string, string>] & import("@fragno-dev/db/schema").AnyColumn[], readonly ["endpointId", "ref"]>>>;
|
|
278
|
+
}>>, {
|
|
279
|
+
startOAuth: (input: {
|
|
280
|
+
connectionId: string;
|
|
281
|
+
stateId: string;
|
|
282
|
+
redirectUri: string;
|
|
283
|
+
scopes?: string[];
|
|
284
|
+
extraAuthorizationParams?: Record<string, string>;
|
|
285
|
+
discardTokens: boolean;
|
|
286
|
+
}) => import("@fragno-dev/db").TxResult<{
|
|
287
|
+
found: false;
|
|
288
|
+
reason: "connection_not_found";
|
|
289
|
+
authorizationUrl?: undefined;
|
|
290
|
+
oauthState?: undefined;
|
|
291
|
+
connectionId?: undefined;
|
|
292
|
+
secretId?: undefined;
|
|
293
|
+
clientPayload?: undefined;
|
|
294
|
+
discardChangesReadiness?: undefined;
|
|
295
|
+
} | {
|
|
296
|
+
found: false;
|
|
297
|
+
reason: "auth_not_configured";
|
|
298
|
+
authorizationUrl?: undefined;
|
|
299
|
+
oauthState?: undefined;
|
|
300
|
+
connectionId?: undefined;
|
|
301
|
+
secretId?: undefined;
|
|
302
|
+
clientPayload?: undefined;
|
|
303
|
+
discardChangesReadiness?: undefined;
|
|
304
|
+
} | {
|
|
305
|
+
found: false;
|
|
306
|
+
reason: "auth_not_oauth";
|
|
307
|
+
authorizationUrl?: undefined;
|
|
308
|
+
oauthState?: undefined;
|
|
309
|
+
connectionId?: undefined;
|
|
310
|
+
secretId?: undefined;
|
|
311
|
+
clientPayload?: undefined;
|
|
312
|
+
discardChangesReadiness?: undefined;
|
|
313
|
+
} | {
|
|
314
|
+
found: true;
|
|
315
|
+
authorizationUrl: string;
|
|
316
|
+
oauthState: {
|
|
317
|
+
id: string;
|
|
318
|
+
connectionId: string;
|
|
319
|
+
authorizationUrl: string;
|
|
320
|
+
codeVerifier: string;
|
|
321
|
+
redirectUri: string;
|
|
322
|
+
scope: string | null;
|
|
323
|
+
expiresAt: Date;
|
|
324
|
+
};
|
|
325
|
+
connectionId: string;
|
|
326
|
+
secretId: import("@fragno-dev/db/schema").FragnoId;
|
|
327
|
+
clientPayload: string;
|
|
328
|
+
discardChangesReadiness: boolean;
|
|
329
|
+
reason?: undefined;
|
|
330
|
+
}, {
|
|
331
|
+
found: false;
|
|
332
|
+
reason: "connection_not_found";
|
|
333
|
+
authorizationUrl?: undefined;
|
|
334
|
+
oauthState?: undefined;
|
|
335
|
+
connectionId?: undefined;
|
|
336
|
+
secretId?: undefined;
|
|
337
|
+
clientPayload?: undefined;
|
|
338
|
+
discardChangesReadiness?: undefined;
|
|
339
|
+
} | {
|
|
340
|
+
found: false;
|
|
341
|
+
reason: "auth_not_configured";
|
|
342
|
+
authorizationUrl?: undefined;
|
|
343
|
+
oauthState?: undefined;
|
|
344
|
+
connectionId?: undefined;
|
|
345
|
+
secretId?: undefined;
|
|
346
|
+
clientPayload?: undefined;
|
|
347
|
+
discardChangesReadiness?: undefined;
|
|
348
|
+
} | {
|
|
349
|
+
found: false;
|
|
350
|
+
reason: "auth_not_oauth";
|
|
351
|
+
authorizationUrl?: undefined;
|
|
352
|
+
oauthState?: undefined;
|
|
353
|
+
connectionId?: undefined;
|
|
354
|
+
secretId?: undefined;
|
|
355
|
+
clientPayload?: undefined;
|
|
356
|
+
discardChangesReadiness?: undefined;
|
|
357
|
+
} | {
|
|
358
|
+
found: true;
|
|
359
|
+
authorizationUrl: string;
|
|
360
|
+
oauthState: {
|
|
361
|
+
id: string;
|
|
362
|
+
connectionId: string;
|
|
363
|
+
authorizationUrl: string;
|
|
364
|
+
codeVerifier: string;
|
|
365
|
+
redirectUri: string;
|
|
366
|
+
scope: string | null;
|
|
367
|
+
expiresAt: Date;
|
|
368
|
+
};
|
|
369
|
+
connectionId: string;
|
|
370
|
+
secretId: import("@fragno-dev/db/schema").FragnoId;
|
|
371
|
+
clientPayload: string;
|
|
372
|
+
discardChangesReadiness: boolean;
|
|
373
|
+
reason?: undefined;
|
|
374
|
+
}>;
|
|
375
|
+
completeOAuthCallback: (input: {
|
|
376
|
+
stateId: string;
|
|
377
|
+
code: string;
|
|
378
|
+
}) => import("@fragno-dev/db").TxResult<{
|
|
379
|
+
found: false;
|
|
380
|
+
reason: "invalid_state";
|
|
381
|
+
connection?: undefined;
|
|
382
|
+
changes?: undefined;
|
|
383
|
+
wasReady?: undefined;
|
|
384
|
+
} | {
|
|
385
|
+
found: false;
|
|
386
|
+
reason: "connection_not_found";
|
|
387
|
+
connection?: undefined;
|
|
388
|
+
changes?: undefined;
|
|
389
|
+
wasReady?: undefined;
|
|
390
|
+
} | {
|
|
391
|
+
found: false;
|
|
392
|
+
reason: "auth_not_configured";
|
|
393
|
+
connection?: undefined;
|
|
394
|
+
changes?: undefined;
|
|
395
|
+
wasReady?: undefined;
|
|
396
|
+
} | {
|
|
397
|
+
found: false;
|
|
398
|
+
reason: "auth_not_oauth";
|
|
399
|
+
connection?: undefined;
|
|
400
|
+
changes?: undefined;
|
|
401
|
+
wasReady?: undefined;
|
|
402
|
+
} | {
|
|
403
|
+
found: true;
|
|
404
|
+
connection: {
|
|
405
|
+
id: import("@fragno-dev/db/schema").FragnoId;
|
|
406
|
+
name: string | null;
|
|
407
|
+
baseUrl: string;
|
|
408
|
+
authMode: string;
|
|
409
|
+
status: string;
|
|
410
|
+
createdAt: Date;
|
|
411
|
+
updatedAt: Date;
|
|
412
|
+
};
|
|
413
|
+
changes: {
|
|
414
|
+
authPayload: string;
|
|
415
|
+
authExpiresAt: Date | null;
|
|
416
|
+
};
|
|
417
|
+
wasReady: boolean;
|
|
418
|
+
reason?: undefined;
|
|
419
|
+
}, {
|
|
420
|
+
found: false;
|
|
421
|
+
reason: "invalid_state";
|
|
422
|
+
connection?: undefined;
|
|
423
|
+
changes?: undefined;
|
|
424
|
+
wasReady?: undefined;
|
|
425
|
+
} | {
|
|
426
|
+
found: false;
|
|
427
|
+
reason: "connection_not_found";
|
|
428
|
+
connection?: undefined;
|
|
429
|
+
changes?: undefined;
|
|
430
|
+
wasReady?: undefined;
|
|
431
|
+
} | {
|
|
432
|
+
found: false;
|
|
433
|
+
reason: "auth_not_configured";
|
|
434
|
+
connection?: undefined;
|
|
435
|
+
changes?: undefined;
|
|
436
|
+
wasReady?: undefined;
|
|
437
|
+
} | {
|
|
438
|
+
found: false;
|
|
439
|
+
reason: "auth_not_oauth";
|
|
440
|
+
connection?: undefined;
|
|
441
|
+
changes?: undefined;
|
|
442
|
+
wasReady?: undefined;
|
|
443
|
+
} | {
|
|
444
|
+
found: true;
|
|
445
|
+
connection: {
|
|
446
|
+
id: import("@fragno-dev/db/schema").FragnoId;
|
|
447
|
+
name: string | null;
|
|
448
|
+
baseUrl: string;
|
|
449
|
+
authMode: string;
|
|
450
|
+
status: string;
|
|
451
|
+
createdAt: Date;
|
|
452
|
+
updatedAt: Date;
|
|
453
|
+
};
|
|
454
|
+
changes: {
|
|
455
|
+
authPayload: string;
|
|
456
|
+
authExpiresAt: Date | null;
|
|
457
|
+
};
|
|
458
|
+
wasReady: boolean;
|
|
459
|
+
reason?: undefined;
|
|
460
|
+
}>;
|
|
461
|
+
executeApiRequest: (input: {
|
|
462
|
+
connectionId: string;
|
|
463
|
+
request: ApiRequestInput;
|
|
464
|
+
}) => import("@fragno-dev/db").TxResult<{
|
|
465
|
+
found: false;
|
|
466
|
+
reason?: undefined;
|
|
467
|
+
connection?: undefined;
|
|
468
|
+
secrets?: undefined;
|
|
469
|
+
authChanges?: undefined;
|
|
470
|
+
response?: undefined;
|
|
471
|
+
} | {
|
|
472
|
+
found: false;
|
|
473
|
+
reason: "connection_disabled";
|
|
474
|
+
connection?: undefined;
|
|
475
|
+
secrets?: undefined;
|
|
476
|
+
authChanges?: undefined;
|
|
477
|
+
response?: undefined;
|
|
478
|
+
} | {
|
|
479
|
+
found: true;
|
|
480
|
+
response: {
|
|
481
|
+
ok: true;
|
|
482
|
+
response: {
|
|
483
|
+
status: number;
|
|
484
|
+
statusText: string;
|
|
485
|
+
headers: Record<string, string>;
|
|
486
|
+
body: {
|
|
487
|
+
type: "json";
|
|
488
|
+
value: unknown;
|
|
489
|
+
} | {
|
|
490
|
+
type: "text";
|
|
491
|
+
value: string;
|
|
492
|
+
} | {
|
|
493
|
+
type: "empty";
|
|
494
|
+
value: null;
|
|
495
|
+
};
|
|
496
|
+
};
|
|
497
|
+
error: null;
|
|
498
|
+
} | {
|
|
499
|
+
ok: false;
|
|
500
|
+
response: {
|
|
501
|
+
status: number;
|
|
502
|
+
statusText: string;
|
|
503
|
+
headers: Record<string, string>;
|
|
504
|
+
body: {
|
|
505
|
+
type: "json";
|
|
506
|
+
value: unknown;
|
|
507
|
+
} | {
|
|
508
|
+
type: "text";
|
|
509
|
+
value: string;
|
|
510
|
+
} | {
|
|
511
|
+
type: "empty";
|
|
512
|
+
value: null;
|
|
513
|
+
};
|
|
514
|
+
} | null;
|
|
515
|
+
error: {
|
|
516
|
+
code: "CONNECTION_NOT_FOUND" | "HTTP_ERROR" | "REQUEST_ERROR" | "RESPONSE_DECODING_ERROR" | "CONNECTION_DISABLED";
|
|
517
|
+
message: string;
|
|
518
|
+
};
|
|
519
|
+
};
|
|
520
|
+
}, {
|
|
521
|
+
found: false;
|
|
522
|
+
reason?: undefined;
|
|
523
|
+
connection?: undefined;
|
|
524
|
+
secrets?: undefined;
|
|
525
|
+
authChanges?: undefined;
|
|
526
|
+
response?: undefined;
|
|
527
|
+
} | {
|
|
528
|
+
found: false;
|
|
529
|
+
reason: "connection_disabled";
|
|
530
|
+
connection?: undefined;
|
|
531
|
+
secrets?: undefined;
|
|
532
|
+
authChanges?: undefined;
|
|
533
|
+
response?: undefined;
|
|
534
|
+
} | {
|
|
535
|
+
found: true;
|
|
536
|
+
connection: {
|
|
537
|
+
id: import("@fragno-dev/db/schema").FragnoId;
|
|
538
|
+
name: string | null;
|
|
539
|
+
baseUrl: string;
|
|
540
|
+
authMode: string;
|
|
541
|
+
status: string;
|
|
542
|
+
createdAt: Date;
|
|
543
|
+
updatedAt: Date;
|
|
544
|
+
};
|
|
545
|
+
secrets: {
|
|
546
|
+
id: import("@fragno-dev/db/schema").FragnoId;
|
|
547
|
+
connectionId: import("@fragno-dev/db/schema").FragnoReference;
|
|
548
|
+
kind: string;
|
|
549
|
+
payload: string;
|
|
550
|
+
expiresAt: Date | null;
|
|
551
|
+
updatedAt: Date;
|
|
552
|
+
}[];
|
|
553
|
+
authChanges: AuthPersistenceChanges | undefined;
|
|
554
|
+
response: {
|
|
555
|
+
ok: true;
|
|
556
|
+
response: {
|
|
557
|
+
status: number;
|
|
558
|
+
statusText: string;
|
|
559
|
+
headers: Record<string, string>;
|
|
560
|
+
body: {
|
|
561
|
+
type: "json";
|
|
562
|
+
value: unknown;
|
|
563
|
+
} | {
|
|
564
|
+
type: "text";
|
|
565
|
+
value: string;
|
|
566
|
+
} | {
|
|
567
|
+
type: "empty";
|
|
568
|
+
value: null;
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
error: null;
|
|
572
|
+
} | {
|
|
573
|
+
ok: false;
|
|
574
|
+
response: {
|
|
575
|
+
status: number;
|
|
576
|
+
statusText: string;
|
|
577
|
+
headers: Record<string, string>;
|
|
578
|
+
body: {
|
|
579
|
+
type: "json";
|
|
580
|
+
value: unknown;
|
|
581
|
+
} | {
|
|
582
|
+
type: "text";
|
|
583
|
+
value: string;
|
|
584
|
+
} | {
|
|
585
|
+
type: "empty";
|
|
586
|
+
value: null;
|
|
587
|
+
};
|
|
588
|
+
} | null;
|
|
589
|
+
error: {
|
|
590
|
+
code: "CONNECTION_NOT_FOUND" | "HTTP_ERROR" | "REQUEST_ERROR" | "RESPONSE_DECODING_ERROR" | "CONNECTION_DISABLED";
|
|
591
|
+
message: string;
|
|
592
|
+
};
|
|
593
|
+
};
|
|
594
|
+
reason?: undefined;
|
|
595
|
+
}>;
|
|
596
|
+
refreshClientCredentialsToken: (input: {
|
|
597
|
+
connectionId: string;
|
|
598
|
+
}) => import("@fragno-dev/db").TxResult<{
|
|
599
|
+
found: false;
|
|
600
|
+
connection?: undefined;
|
|
601
|
+
secrets?: undefined;
|
|
602
|
+
authChanges?: undefined;
|
|
603
|
+
tokenPresent?: undefined;
|
|
604
|
+
} | {
|
|
605
|
+
found: true;
|
|
606
|
+
tokenPresent: boolean;
|
|
607
|
+
}, {
|
|
608
|
+
found: false;
|
|
609
|
+
connection?: undefined;
|
|
610
|
+
secrets?: undefined;
|
|
611
|
+
authChanges?: undefined;
|
|
612
|
+
tokenPresent?: undefined;
|
|
613
|
+
} | {
|
|
614
|
+
found: true;
|
|
615
|
+
connection: {
|
|
616
|
+
id: import("@fragno-dev/db/schema").FragnoId;
|
|
617
|
+
name: string | null;
|
|
618
|
+
baseUrl: string;
|
|
619
|
+
authMode: string;
|
|
620
|
+
status: string;
|
|
621
|
+
createdAt: Date;
|
|
622
|
+
updatedAt: Date;
|
|
623
|
+
};
|
|
624
|
+
secrets: {
|
|
625
|
+
id: import("@fragno-dev/db/schema").FragnoId;
|
|
626
|
+
connectionId: import("@fragno-dev/db/schema").FragnoReference;
|
|
627
|
+
kind: string;
|
|
628
|
+
payload: string;
|
|
629
|
+
expiresAt: Date | null;
|
|
630
|
+
updatedAt: Date;
|
|
631
|
+
}[];
|
|
632
|
+
authChanges: AuthPersistenceChanges | undefined;
|
|
633
|
+
tokenPresent: boolean;
|
|
634
|
+
}>;
|
|
635
|
+
}, {}, {}, {}, import("@fragno-dev/db").DatabaseServiceContext<ApiHooksMap>, import("@fragno-dev/db").DatabaseRequestContext<ApiHooksMap>, import("@fragno-dev/db/fragment-definition-builder").DatabaseRequestStorage, []>;
|
|
636
|
+
//#endregion
|
|
637
|
+
export { ApiConnectionChangedPayload, ApiConnectionDeletedPayload, ApiConnectionHookSnapshot, ApiConnectionReadinessChange, ApiConnectionReadinessChangedPayload, ApiFragmentConfig, ApiFragmentHooksConfig, ApiHooksMap, WebhookEndpointChangedPayload, WebhookEndpointHookSnapshot, WebhookReceivedPayload, apiFragmentDefinition };
|
|
638
|
+
//# sourceMappingURL=definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.d.ts","names":[],"sources":["../../src/definition.ts"],"mappings":";;;;UAmBiB;EACf;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,YAAY;;UAGG;EACf;EACA,UAAU;;UAGK;EACf;;EAEA;;;;;;UAOe,qCAAqC;EACpD,YAAY;;;UAIJ;EACR;EACA;;UAGQ;EACR;EACA;EACA;EACA;EACA,SAAS;EACT,OAAO;EACP;EACA,MAAM;EACN;;UAGe;EACf,MAAM;EACN,QAAQ;EACR,YAAY;EACZ,cAAc;EACd,kBAAkB;EAClB,YAAY;;KAGF;EACN;EAAmB;EAAoB,UAAU;;EAEjD;EACA;EACA,UAAU;;EAEV,gBAAgB;;EAEhB;EAAmB;;UAER;EACf;EACA;EACA;EACA;EACA,SAAS;EACT,OAAO;EACP,MAAM;EACN;;UAGe;EACf,uBACE,SAAS,6BACT,SAAS,gBACN;EACL,uBACE,SAAS,6BACT,SAAS,gBACN;;;;;EAKL,gCACE,SAAS,8BACT,SAAS,gBACN;EACL,4BACE,SAAS,+BACT,SAAS,gBACN;EACL,qBACE,SAAS,wBACT,SAAS,gBACN;;KAGK,oBAAoB,sBAAwB;KAE5C;EACV,qBAAqB,OAAO;EAC5B,qBAAqB,OAAO;EAC5B,8BAA8B,OAAO;EACrC,eAAe,OAAO;EACtB,0BAA0B,OAAO;EACjC,mBAAmB,OAAO;;cAsCf,kDAAqB,mBAAA,4CAAA,yDAAA,6DAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwE1B;IACA;IACA;IACA;IACA,2BAA2B;IAC3B;iCACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuFyC;IAAiB;iCAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuFnC;IAAsB,SAAS;iCAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmFpC;iCAAsB"}
|