@sixb/server 0.1.9 → 0.1.10
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.js +21 -7
- package/dist/index.js.map +5 -5
- package/dist/routes/connector-connection-runs.d.ts.map +1 -1
- package/dist/routes/projections.d.ts +24 -0
- package/dist/routes/projections.d.ts.map +1 -1
- package/dist/routes/webhooks.d.ts.map +1 -1
- package/dist/schemas/projections.d.ts +243 -0
- package/dist/schemas/projections.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/routes/connector-connection-runs.ts +12 -3
- package/src/routes/webhooks.ts +15 -3
- package/src/schemas/projections.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -5037,16 +5037,21 @@ function registerConnectorConnectionRunRoutes(app, host, options) {
|
|
|
5037
5037
|
operationId: "reauthorizeConnectorConnection",
|
|
5038
5038
|
security: SIXB_CSRF_SECURITY_REQUIREMENT
|
|
5039
5039
|
}
|
|
5040
|
-
}).get("/auth/connectors/callback", async ({
|
|
5040
|
+
}).get("/auth/connectors/callback", async ({ request, set }) => {
|
|
5041
5041
|
let callbackCookie;
|
|
5042
5042
|
try {
|
|
5043
|
-
const
|
|
5043
|
+
const parameters = new URL(request.url).searchParams;
|
|
5044
|
+
const callbackParameters = Object.fromEntries([...new Set(parameters.keys())].map((name) => {
|
|
5045
|
+
const values = parameters.getAll(name);
|
|
5046
|
+
return [name, values.length === 1 ? values[0] : values];
|
|
5047
|
+
}));
|
|
5048
|
+
const parsed = ConnectorOAuthCallbackQuerySchema.parse(callbackParameters);
|
|
5044
5049
|
callbackCookie = readConnectorCallbackCookie(request, parsed.state);
|
|
5045
5050
|
const result = await getConnectorConnectionCallbackProcess(host).completeConnectionRun({
|
|
5046
5051
|
state: parsed.state,
|
|
5047
5052
|
redirectUri: options.resolveCallbackUrl(request),
|
|
5048
5053
|
callbackBinding: callbackCookie.value ?? "",
|
|
5049
|
-
...parsed.code === undefined ? { error: parsed.error } : { code: parsed.code }
|
|
5054
|
+
...parsed.code === undefined ? { error: parsed.error } : { code: parsed.code, callbackParameters }
|
|
5050
5055
|
});
|
|
5051
5056
|
return connectorCallbackRedirect(result.returnTo, result.connectorId, result.runId, clearConnectorCallbackCookie(request, callbackCookie.name));
|
|
5052
5057
|
} catch (error) {
|
|
@@ -7952,7 +7957,8 @@ var ProjectionRunBaseSchema = z22.object({
|
|
|
7952
7957
|
attempt: z22.number(),
|
|
7953
7958
|
progress: z22.object({
|
|
7954
7959
|
sourceRowsRead: z22.number(),
|
|
7955
|
-
sourceRowsSkipped: z22.number()
|
|
7960
|
+
sourceRowsSkipped: z22.number(),
|
|
7961
|
+
sourceChangesRead: z22.number().optional()
|
|
7956
7962
|
}),
|
|
7957
7963
|
queuedAt: z22.string(),
|
|
7958
7964
|
startedAt: z22.string().optional(),
|
|
@@ -12975,7 +12981,11 @@ import { createHash as createHash4, randomUUID as randomUUID2 } from "crypto";
|
|
|
12975
12981
|
import { reportRunFailure } from "@sixb/core/internal/error-reporting";
|
|
12976
12982
|
import { captureSixbFailure, createSixbError as createSixbError5, toSixbFailure as toSixbFailure2 } from "@sixb/core/internal/errors";
|
|
12977
12983
|
import { bindDurablePrimitiveExecution } from "@sixb/core/internal/primitive-execution";
|
|
12978
|
-
import {
|
|
12984
|
+
import {
|
|
12985
|
+
admitWebhookRun,
|
|
12986
|
+
createWebhookConnections,
|
|
12987
|
+
isStaticConnectorDefinition
|
|
12988
|
+
} from "@sixb/core/internal/webhooks";
|
|
12979
12989
|
import { WEBHOOK_RUN_FAILURE_CODES as WEBHOOK_RUN_FAILURE_CODES2, WebhookRunError } from "@sixb/core/storage";
|
|
12980
12990
|
var DEFAULT_WEBHOOK_BODY_LIMIT_BYTES = 1024 * 1024;
|
|
12981
12991
|
function registerWebhookRoutes(app, host) {
|
|
@@ -13111,7 +13121,8 @@ async function executeWebhookHandler(options, prepared, admission, logger) {
|
|
|
13111
13121
|
rawBody: prepared.rawBody,
|
|
13112
13122
|
body: prepared.body,
|
|
13113
13123
|
logger,
|
|
13114
|
-
client: createClientResolver(execution.sixb, connector)
|
|
13124
|
+
client: createClientResolver(execution.sixb, connector),
|
|
13125
|
+
connections: createWebhookConnections(execution.sixb.connector, connector)
|
|
13115
13126
|
});
|
|
13116
13127
|
} catch (error) {
|
|
13117
13128
|
const failed = createWebhookRunFailure({
|
|
@@ -13224,6 +13235,9 @@ function parseWebhookBody(webhook, rawBody) {
|
|
|
13224
13235
|
function createClientResolver(sixb, connector) {
|
|
13225
13236
|
let clientPromise = null;
|
|
13226
13237
|
return () => {
|
|
13238
|
+
if (!isStaticConnectorDefinition(connector)) {
|
|
13239
|
+
throw createSixbError5("connector.configuration_invalid", "[SixbServer] OAuth webhook clients require connections.forAccount(accountId), then target.client().");
|
|
13240
|
+
}
|
|
13227
13241
|
clientPromise ??= sixb.connector(connector);
|
|
13228
13242
|
return clientPromise;
|
|
13229
13243
|
};
|
|
@@ -14616,4 +14630,4 @@ export {
|
|
|
14616
14630
|
createSixbServer
|
|
14617
14631
|
};
|
|
14618
14632
|
|
|
14619
|
-
//# debugId=
|
|
14633
|
+
//# debugId=168374855DD168B264756E2164756E21
|