@tangle-network/agent-integrations 0.53.25 → 0.53.26
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/catalog.js +4 -4
- package/dist/{chunk-ACAQVJ4F.js → chunk-M4AXWKHK.js} +2 -2
- package/dist/{chunk-6NICNEJG.js → chunk-WSRMGVHS.js} +3 -3
- package/dist/{chunk-EXPZGJ4A.js → chunk-XZL47RBS.js} +393 -79
- package/dist/{chunk-EXPZGJ4A.js.map → chunk-XZL47RBS.js.map} +1 -1
- package/dist/{chunk-AE7GYW2O.js → chunk-ZR55ERGY.js} +28 -2
- package/dist/{chunk-AE7GYW2O.js.map → chunk-ZR55ERGY.js.map} +1 -1
- package/dist/connectors/adapters/index.d.ts +3 -1
- package/dist/connectors/adapters/index.js +3 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +4 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -4
- package/dist/mcp.js +4 -4
- package/dist/registry.js +4 -4
- package/dist/runtime.js +4 -4
- package/dist/specs.js +3 -3
- package/docs/integration-execution-audit.md +10 -9
- package/docs/integration-execution-matrix.json +19 -14
- package/package.json +1 -1
- /package/dist/{chunk-ACAQVJ4F.js.map → chunk-M4AXWKHK.js.map} +0 -0
- /package/dist/{chunk-6NICNEJG.js.map → chunk-WSRMGVHS.js.map} +0 -0
|
@@ -82,6 +82,7 @@ __export(adapters_exports, {
|
|
|
82
82
|
azureAdConnector: () => azureAdConnector,
|
|
83
83
|
azureBlobStorageConnector: () => azureBlobStorageConnector,
|
|
84
84
|
azureCommunicationServicesConnector: () => azureCommunicationServicesConnector,
|
|
85
|
+
azureEventGridConnector: () => azureEventGridConnector,
|
|
85
86
|
azureOpenaiConnector: () => azureOpenaiConnector,
|
|
86
87
|
azureServiceBusConnector: () => azureServiceBusConnector,
|
|
87
88
|
backblazeConnector: () => backblazeConnector,
|
|
@@ -787,11 +788,11 @@ function declarativeRestConnector(spec) {
|
|
|
787
788
|
const op = readOperation(spec, inv.capabilityName, "read");
|
|
788
789
|
const response = await executeRestRequest(spec, op.request, inv, requiredArgsOf(op.parameters));
|
|
789
790
|
if (response.outcome === "rate-limited") {
|
|
790
|
-
const
|
|
791
|
+
const retryAfterMs7 = response.retryAfterMs ?? DEFAULT_RETRY_AFTER_MS;
|
|
791
792
|
throw new ProviderRateLimited(
|
|
792
|
-
`${spec.displayName} ${inv.capabilityName} rate limit (429); retry after ${
|
|
793
|
+
`${spec.displayName} ${inv.capabilityName} rate limit (429); retry after ${retryAfterMs7}ms`,
|
|
793
794
|
inv.source.id,
|
|
794
|
-
{ status: 429, body: response.data, retryAfterMs:
|
|
795
|
+
{ status: 429, body: response.data, retryAfterMs: retryAfterMs7 }
|
|
795
796
|
);
|
|
796
797
|
}
|
|
797
798
|
if (response.outcome === "conflict") {
|
|
@@ -11929,11 +11930,11 @@ async function azureRequest(credentials, inv, method, pathSegments, query2 = new
|
|
|
11929
11930
|
throw new CredentialsExpired(`Azure Blob Storage rejected credentials (${response.status})`, inv.source.id);
|
|
11930
11931
|
}
|
|
11931
11932
|
if (response.status === 429 || response.status === 503) {
|
|
11932
|
-
const
|
|
11933
|
+
const retryAfterMs7 = retryAfter(response.headers.get("retry-after"));
|
|
11933
11934
|
throw new ProviderRateLimited(
|
|
11934
|
-
`Azure Blob Storage rate limit (${response.status}); retry after ${
|
|
11935
|
+
`Azure Blob Storage rate limit (${response.status}); retry after ${retryAfterMs7}ms`,
|
|
11935
11936
|
inv.source.id,
|
|
11936
|
-
{ status: response.status, retryAfterMs:
|
|
11937
|
+
{ status: response.status, retryAfterMs: retryAfterMs7 }
|
|
11937
11938
|
);
|
|
11938
11939
|
}
|
|
11939
11940
|
if (!response.ok) {
|
|
@@ -12206,6 +12207,317 @@ function numberOrUndefined(value) {
|
|
|
12206
12207
|
return Number.isFinite(parsed) ? parsed : void 0;
|
|
12207
12208
|
}
|
|
12208
12209
|
|
|
12210
|
+
// src/connectors/adapters/azure-event-grid.ts
|
|
12211
|
+
import { createHash as createHash3, timingSafeEqual } from "crypto";
|
|
12212
|
+
var API_VERSION2 = "2018-01-01";
|
|
12213
|
+
var MAX_BATCH_BYTES = 1024 * 1024;
|
|
12214
|
+
var MAX_EVENTS = 5e3;
|
|
12215
|
+
var EVENT_GRID_SUFFIXES = [
|
|
12216
|
+
".eventgrid.azure.net",
|
|
12217
|
+
".eventgrid.azure.us",
|
|
12218
|
+
".eventgrid.azure.cn"
|
|
12219
|
+
];
|
|
12220
|
+
var azureEventGridConnector = {
|
|
12221
|
+
manifest: {
|
|
12222
|
+
kind: "azure-event-grid",
|
|
12223
|
+
displayName: "Azure Event Grid",
|
|
12224
|
+
description: "Publish Event Grid and CloudEvents batches to customer topics and authenticate inbound subscription validation and event delivery.",
|
|
12225
|
+
auth: {
|
|
12226
|
+
kind: "api-key",
|
|
12227
|
+
hint: "JSON containing endpoint, accessKey, and deliverySecret. endpoint is the Azure custom topic or domain /api/events URL. Configure deliverySecret as the static x-tangle-eventgrid-secret delivery header on each Event Grid subscription."
|
|
12228
|
+
},
|
|
12229
|
+
category: "webhook",
|
|
12230
|
+
defaultConsistencyModel: "advisory",
|
|
12231
|
+
rateLimit: { requests: 600, windowMs: 6e4, scope: "data-source" },
|
|
12232
|
+
capabilities: [
|
|
12233
|
+
mutationCapability2(
|
|
12234
|
+
"events.publish",
|
|
12235
|
+
"Publish a bounded batch using the native Azure Event Grid event schema.",
|
|
12236
|
+
"Events require id, eventType, subject, eventTime, dataVersion, and data."
|
|
12237
|
+
),
|
|
12238
|
+
mutationCapability2(
|
|
12239
|
+
"cloudEvents.publish",
|
|
12240
|
+
"Publish a bounded CloudEvents 1.0 batch.",
|
|
12241
|
+
"CloudEvents require id, source, type, specversion=1.0, and data."
|
|
12242
|
+
)
|
|
12243
|
+
]
|
|
12244
|
+
},
|
|
12245
|
+
async executeMutation(inv) {
|
|
12246
|
+
const credentials = parseCredentials(inv.source.credentials, inv.source.id);
|
|
12247
|
+
const events = inv.capabilityName === "events.publish" ? eventGridEvents(inv.args.events) : inv.capabilityName === "cloudEvents.publish" ? cloudEvents(inv.args.events) : void 0;
|
|
12248
|
+
if (!events) throw new Error(`azure-event-grid: unknown mutation capability ${inv.capabilityName}`);
|
|
12249
|
+
const body = JSON.stringify(events);
|
|
12250
|
+
if (Buffer.byteLength(body) > MAX_BATCH_BYTES) {
|
|
12251
|
+
throw new Error(`Azure Event Grid batch exceeds ${MAX_BATCH_BYTES} bytes`);
|
|
12252
|
+
}
|
|
12253
|
+
const response = await fetch(publishUrl(credentials.endpoint), {
|
|
12254
|
+
method: "POST",
|
|
12255
|
+
headers: {
|
|
12256
|
+
"aeg-sas-key": credentials.accessKey,
|
|
12257
|
+
"content-type": inv.capabilityName === "cloudEvents.publish" ? "application/cloudevents-batch+json; charset=utf-8" : "application/json; charset=utf-8",
|
|
12258
|
+
accept: "application/json"
|
|
12259
|
+
},
|
|
12260
|
+
body
|
|
12261
|
+
});
|
|
12262
|
+
const responseBody = await readBoundedText(response, 256 * 1024);
|
|
12263
|
+
if (!response.ok) throwEventGridError(response, responseBody, inv);
|
|
12264
|
+
return {
|
|
12265
|
+
status: "committed",
|
|
12266
|
+
data: { accepted: true, count: events.length, requestId: response.headers.get("x-ms-request-id") ?? void 0 },
|
|
12267
|
+
committedAt: Date.now(),
|
|
12268
|
+
idempotentReplay: false
|
|
12269
|
+
};
|
|
12270
|
+
},
|
|
12271
|
+
verifySignature({ headers, source }) {
|
|
12272
|
+
let credentials;
|
|
12273
|
+
try {
|
|
12274
|
+
credentials = parseCredentials(source.credentials, source.id);
|
|
12275
|
+
} catch {
|
|
12276
|
+
return { valid: false, reason: "Azure Event Grid credentials are invalid" };
|
|
12277
|
+
}
|
|
12278
|
+
const provided = headerValue(headers, "x-tangle-eventgrid-secret");
|
|
12279
|
+
if (!provided) return { valid: false, reason: "Missing x-tangle-eventgrid-secret delivery header" };
|
|
12280
|
+
const expectedDigest = createHash3("sha256").update(credentials.deliverySecret).digest();
|
|
12281
|
+
const providedDigest = createHash3("sha256").update(provided).digest();
|
|
12282
|
+
return timingSafeEqual(expectedDigest, providedDigest) ? { valid: true } : { valid: false, reason: "Invalid x-tangle-eventgrid-secret delivery header" };
|
|
12283
|
+
},
|
|
12284
|
+
async handleInboundEvent({ rawBody }) {
|
|
12285
|
+
if (Buffer.byteLength(rawBody) > MAX_BATCH_BYTES) {
|
|
12286
|
+
throw new Error(`Azure Event Grid delivery exceeds ${MAX_BATCH_BYTES} bytes`);
|
|
12287
|
+
}
|
|
12288
|
+
let parsed;
|
|
12289
|
+
try {
|
|
12290
|
+
parsed = JSON.parse(rawBody);
|
|
12291
|
+
} catch {
|
|
12292
|
+
throw new Error("Azure Event Grid delivery body must be valid JSON");
|
|
12293
|
+
}
|
|
12294
|
+
const entries = Array.isArray(parsed) ? parsed : [parsed];
|
|
12295
|
+
if (entries.length > MAX_EVENTS) throw new Error(`Azure Event Grid delivery exceeds ${MAX_EVENTS} events`);
|
|
12296
|
+
const validation = entries.find((entry) => isValidationEvent(entry));
|
|
12297
|
+
if (validation && isRecord(validation.data) && typeof validation.data.validationCode === "string") {
|
|
12298
|
+
return {
|
|
12299
|
+
events: [],
|
|
12300
|
+
response: { status: 200, body: { validationResponse: validation.data.validationCode } }
|
|
12301
|
+
};
|
|
12302
|
+
}
|
|
12303
|
+
return {
|
|
12304
|
+
events: entries.map((entry, index) => inboundEvent(entry, index))
|
|
12305
|
+
};
|
|
12306
|
+
},
|
|
12307
|
+
async test(source) {
|
|
12308
|
+
try {
|
|
12309
|
+
parseCredentials(source.credentials, source.id);
|
|
12310
|
+
return { ok: true };
|
|
12311
|
+
} catch (error) {
|
|
12312
|
+
return { ok: false, reason: error instanceof Error ? error.message : "Azure Event Grid credentials are invalid" };
|
|
12313
|
+
}
|
|
12314
|
+
}
|
|
12315
|
+
};
|
|
12316
|
+
function mutationCapability2(name, description, eventDescription) {
|
|
12317
|
+
return {
|
|
12318
|
+
name,
|
|
12319
|
+
class: "mutation",
|
|
12320
|
+
description,
|
|
12321
|
+
parameters: {
|
|
12322
|
+
type: "object",
|
|
12323
|
+
properties: {
|
|
12324
|
+
events: {
|
|
12325
|
+
type: "array",
|
|
12326
|
+
minItems: 1,
|
|
12327
|
+
maxItems: MAX_EVENTS,
|
|
12328
|
+
description: eventDescription
|
|
12329
|
+
}
|
|
12330
|
+
},
|
|
12331
|
+
required: ["events"]
|
|
12332
|
+
},
|
|
12333
|
+
cas: "none",
|
|
12334
|
+
externalEffect: true
|
|
12335
|
+
};
|
|
12336
|
+
}
|
|
12337
|
+
function parseCredentials(credentials, dataSourceId) {
|
|
12338
|
+
if (credentials.kind !== "api-key") {
|
|
12339
|
+
throw new CredentialsExpired("Azure Event Grid requires a credential JSON bundle", dataSourceId);
|
|
12340
|
+
}
|
|
12341
|
+
let parsed;
|
|
12342
|
+
try {
|
|
12343
|
+
parsed = JSON.parse(credentials.apiKey);
|
|
12344
|
+
} catch {
|
|
12345
|
+
throw new CredentialsExpired("Azure Event Grid credentials must be valid JSON", dataSourceId);
|
|
12346
|
+
}
|
|
12347
|
+
if (!isRecord(parsed)) throw new CredentialsExpired("Azure Event Grid credentials must be a JSON object", dataSourceId);
|
|
12348
|
+
const endpointValue = credentialString(parsed.endpoint, "endpoint", dataSourceId);
|
|
12349
|
+
const accessKey = credentialString(parsed.accessKey, "accessKey", dataSourceId);
|
|
12350
|
+
const deliverySecret = credentialString(parsed.deliverySecret, "deliverySecret", dataSourceId);
|
|
12351
|
+
let endpoint;
|
|
12352
|
+
try {
|
|
12353
|
+
endpoint = new URL(endpointValue);
|
|
12354
|
+
} catch {
|
|
12355
|
+
throw new CredentialsExpired("Azure Event Grid endpoint is invalid", dataSourceId);
|
|
12356
|
+
}
|
|
12357
|
+
if (endpoint.protocol !== "https:" || endpoint.username || endpoint.password || endpoint.port || endpoint.search || endpoint.hash || endpoint.pathname.replace(/\/$/, "").toLowerCase() !== "/api/events" || !EVENT_GRID_SUFFIXES.some((suffix) => endpoint.hostname.endsWith(suffix))) {
|
|
12358
|
+
throw new CredentialsExpired("Azure Event Grid endpoint must be a public Azure custom topic or domain /api/events URL", dataSourceId);
|
|
12359
|
+
}
|
|
12360
|
+
if (!canonicalBase64(accessKey) || Buffer.from(accessKey, "base64").length < 16) {
|
|
12361
|
+
throw new CredentialsExpired("Azure Event Grid accessKey must be a valid base64 topic key", dataSourceId);
|
|
12362
|
+
}
|
|
12363
|
+
if (deliverySecret.length < 32 || deliverySecret.length > 4096) {
|
|
12364
|
+
throw new CredentialsExpired("Azure Event Grid deliverySecret must contain 32 to 4096 characters", dataSourceId);
|
|
12365
|
+
}
|
|
12366
|
+
endpoint.pathname = "/api/events";
|
|
12367
|
+
return { endpoint, accessKey, deliverySecret };
|
|
12368
|
+
}
|
|
12369
|
+
function publishUrl(endpoint) {
|
|
12370
|
+
const url = new URL(endpoint);
|
|
12371
|
+
url.searchParams.set("api-version", API_VERSION2);
|
|
12372
|
+
return url;
|
|
12373
|
+
}
|
|
12374
|
+
function eventGridEvents(value) {
|
|
12375
|
+
const entries = eventArray(value);
|
|
12376
|
+
return entries.map((entry, index) => {
|
|
12377
|
+
const result = {
|
|
12378
|
+
id: requiredString4(entry.id, `events[${index}].id`),
|
|
12379
|
+
eventType: requiredString4(entry.eventType, `events[${index}].eventType`),
|
|
12380
|
+
subject: requiredString4(entry.subject, `events[${index}].subject`),
|
|
12381
|
+
eventTime: isoDate(entry.eventTime, `events[${index}].eventTime`),
|
|
12382
|
+
dataVersion: requiredString4(entry.dataVersion, `events[${index}].dataVersion`),
|
|
12383
|
+
data: requiredJsonValue(entry.data, `events[${index}].data`)
|
|
12384
|
+
};
|
|
12385
|
+
if (entry.topic !== void 0) result.topic = requiredString4(entry.topic, `events[${index}].topic`);
|
|
12386
|
+
return result;
|
|
12387
|
+
});
|
|
12388
|
+
}
|
|
12389
|
+
function cloudEvents(value) {
|
|
12390
|
+
const entries = eventArray(value);
|
|
12391
|
+
return entries.map((entry, index) => {
|
|
12392
|
+
if (entry.specversion !== "1.0") throw new Error(`events[${index}].specversion must be 1.0`);
|
|
12393
|
+
const result = {
|
|
12394
|
+
specversion: "1.0",
|
|
12395
|
+
id: requiredString4(entry.id, `events[${index}].id`),
|
|
12396
|
+
source: requiredString4(entry.source, `events[${index}].source`),
|
|
12397
|
+
type: requiredString4(entry.type, `events[${index}].type`),
|
|
12398
|
+
data: requiredJsonValue(entry.data, `events[${index}].data`)
|
|
12399
|
+
};
|
|
12400
|
+
if (entry.subject !== void 0) result.subject = requiredString4(entry.subject, `events[${index}].subject`);
|
|
12401
|
+
if (entry.time !== void 0) result.time = isoDate(entry.time, `events[${index}].time`);
|
|
12402
|
+
if (entry.datacontenttype !== void 0) result.datacontenttype = requiredString4(entry.datacontenttype, `events[${index}].datacontenttype`);
|
|
12403
|
+
if (entry.dataschema !== void 0) result.dataschema = requiredString4(entry.dataschema, `events[${index}].dataschema`);
|
|
12404
|
+
return result;
|
|
12405
|
+
});
|
|
12406
|
+
}
|
|
12407
|
+
function eventArray(value) {
|
|
12408
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > MAX_EVENTS) {
|
|
12409
|
+
throw new Error(`events must contain 1 to ${MAX_EVENTS} entries`);
|
|
12410
|
+
}
|
|
12411
|
+
return value.map((entry, index) => {
|
|
12412
|
+
if (!isRecord(entry)) throw new Error(`events[${index}] must be an object`);
|
|
12413
|
+
return entry;
|
|
12414
|
+
});
|
|
12415
|
+
}
|
|
12416
|
+
function inboundEvent(entry, index) {
|
|
12417
|
+
if (!isRecord(entry)) throw new Error(`Azure Event Grid delivery entry ${index} must be an object`);
|
|
12418
|
+
const eventType = typeof entry.eventType === "string" ? entry.eventType : typeof entry.type === "string" ? entry.type : "azure.event-grid.event";
|
|
12419
|
+
return {
|
|
12420
|
+
eventType,
|
|
12421
|
+
providerEventId: typeof entry.id === "string" ? entry.id : void 0,
|
|
12422
|
+
payload: entry
|
|
12423
|
+
};
|
|
12424
|
+
}
|
|
12425
|
+
function isValidationEvent(value) {
|
|
12426
|
+
return isRecord(value) && value.eventType === "Microsoft.EventGrid.SubscriptionValidationEvent";
|
|
12427
|
+
}
|
|
12428
|
+
function throwEventGridError(response, body, inv) {
|
|
12429
|
+
const redacted = body.replace(/[A-Za-z0-9+/]{32,}={0,2}/g, "[redacted]").slice(0, 500);
|
|
12430
|
+
if (response.status === 401) {
|
|
12431
|
+
throw new CredentialsExpired("Azure Event Grid rejected the topic access key", inv.source.id, {
|
|
12432
|
+
status: response.status,
|
|
12433
|
+
body: redacted
|
|
12434
|
+
});
|
|
12435
|
+
}
|
|
12436
|
+
if (response.status === 403) {
|
|
12437
|
+
throw new ProviderConfigError("Azure Event Grid topic policy rejected publishing", inv.source.id, {
|
|
12438
|
+
status: response.status,
|
|
12439
|
+
body: redacted
|
|
12440
|
+
});
|
|
12441
|
+
}
|
|
12442
|
+
if (response.status === 429 || response.status === 503) {
|
|
12443
|
+
throw new ProviderRateLimited("Azure Event Grid is throttling publishes", inv.source.id, {
|
|
12444
|
+
status: response.status,
|
|
12445
|
+
body: redacted,
|
|
12446
|
+
retryAfterMs: retryAfterMs3(response.headers.get("retry-after"))
|
|
12447
|
+
});
|
|
12448
|
+
}
|
|
12449
|
+
throw new Error(`Azure Event Grid publish failed with HTTP ${response.status}: ${redacted}`);
|
|
12450
|
+
}
|
|
12451
|
+
async function readBoundedText(response, limit) {
|
|
12452
|
+
const declared = Number(response.headers.get("content-length"));
|
|
12453
|
+
if (Number.isFinite(declared) && declared > limit) throw new Error(`Azure Event Grid response exceeds ${limit} bytes`);
|
|
12454
|
+
if (!response.body) return "";
|
|
12455
|
+
const reader = response.body.getReader();
|
|
12456
|
+
const chunks = [];
|
|
12457
|
+
let size = 0;
|
|
12458
|
+
while (true) {
|
|
12459
|
+
const { done, value } = await reader.read();
|
|
12460
|
+
if (done) break;
|
|
12461
|
+
size += value.byteLength;
|
|
12462
|
+
if (size > limit) {
|
|
12463
|
+
await reader.cancel();
|
|
12464
|
+
throw new Error(`Azure Event Grid response exceeds ${limit} bytes`);
|
|
12465
|
+
}
|
|
12466
|
+
chunks.push(value);
|
|
12467
|
+
}
|
|
12468
|
+
const body = new Uint8Array(size);
|
|
12469
|
+
let offset = 0;
|
|
12470
|
+
for (const chunk of chunks) {
|
|
12471
|
+
body.set(chunk, offset);
|
|
12472
|
+
offset += chunk.byteLength;
|
|
12473
|
+
}
|
|
12474
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(body);
|
|
12475
|
+
}
|
|
12476
|
+
function headerValue(headers, name) {
|
|
12477
|
+
const match = Object.entries(headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
12478
|
+
return Array.isArray(match) ? match[0] : match;
|
|
12479
|
+
}
|
|
12480
|
+
function credentialString(value, field, dataSourceId) {
|
|
12481
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
12482
|
+
throw new CredentialsExpired(`Azure Event Grid ${field} is missing`, dataSourceId);
|
|
12483
|
+
}
|
|
12484
|
+
return value.trim();
|
|
12485
|
+
}
|
|
12486
|
+
function requiredString4(value, field) {
|
|
12487
|
+
if (typeof value !== "string" || value.trim() === "" || value.length > 4096) {
|
|
12488
|
+
throw new Error(`${field} must be a non-empty string no longer than 4096 characters`);
|
|
12489
|
+
}
|
|
12490
|
+
return value;
|
|
12491
|
+
}
|
|
12492
|
+
function isoDate(value, field) {
|
|
12493
|
+
const parsed = requiredString4(value, field);
|
|
12494
|
+
const date = new Date(parsed);
|
|
12495
|
+
if (!Number.isFinite(date.getTime())) throw new Error(`${field} must be an ISO 8601 timestamp`);
|
|
12496
|
+
return date.toISOString();
|
|
12497
|
+
}
|
|
12498
|
+
function requiredJsonValue(value, field) {
|
|
12499
|
+
if (value === void 0) throw new Error(`${field} is required`);
|
|
12500
|
+
try {
|
|
12501
|
+
if (JSON.stringify(value) === void 0) throw new Error("not JSON");
|
|
12502
|
+
} catch {
|
|
12503
|
+
throw new Error(`${field} must be JSON-serializable`);
|
|
12504
|
+
}
|
|
12505
|
+
return value;
|
|
12506
|
+
}
|
|
12507
|
+
function canonicalBase64(value) {
|
|
12508
|
+
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value) && Buffer.from(value, "base64").toString("base64").replace(/=+$/, "") === value.replace(/=+$/, "");
|
|
12509
|
+
}
|
|
12510
|
+
function retryAfterMs3(value) {
|
|
12511
|
+
if (!value) return 6e4;
|
|
12512
|
+
const seconds = Number(value);
|
|
12513
|
+
if (Number.isFinite(seconds) && seconds >= 0) return seconds * 1e3;
|
|
12514
|
+
const date = Date.parse(value);
|
|
12515
|
+
return Number.isFinite(date) ? Math.max(0, date - Date.now()) : 6e4;
|
|
12516
|
+
}
|
|
12517
|
+
function isRecord(value) {
|
|
12518
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12519
|
+
}
|
|
12520
|
+
|
|
12209
12521
|
// src/connectors/adapters/azure-service-bus.ts
|
|
12210
12522
|
import { createHmac as createHmac3 } from "crypto";
|
|
12211
12523
|
var MANAGEMENT_API_VERSION = "2017-04";
|
|
@@ -12249,22 +12561,22 @@ var azureServiceBusConnector = {
|
|
|
12249
12561
|
topic: { type: "string" },
|
|
12250
12562
|
subscription: { type: "string" }
|
|
12251
12563
|
}, ["topic", "subscription"]),
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12564
|
+
mutationCapability3("queues.send", "Send a UTF-8 or base64 message to a queue.", sendProperties("queue"), ["queue", "content"]),
|
|
12565
|
+
mutationCapability3("topics.send", "Publish a UTF-8 or base64 message to a topic.", sendProperties("topic"), ["topic", "content"]),
|
|
12566
|
+
mutationCapability3("queues.receiveDelete", "Receive and permanently delete the next queue message.", {
|
|
12255
12567
|
queue: { type: "string" },
|
|
12256
12568
|
timeoutSeconds: { type: "integer", minimum: 0, maximum: 55 }
|
|
12257
12569
|
}, ["queue"]),
|
|
12258
|
-
|
|
12570
|
+
mutationCapability3("subscriptions.receiveDelete", "Receive and permanently delete the next message from a topic subscription.", {
|
|
12259
12571
|
topic: { type: "string" },
|
|
12260
12572
|
subscription: { type: "string" },
|
|
12261
12573
|
timeoutSeconds: { type: "integer", minimum: 0, maximum: 55 }
|
|
12262
12574
|
}, ["topic", "subscription"]),
|
|
12263
|
-
|
|
12575
|
+
mutationCapability3("queues.deadLetters.receiveDelete", "Receive and permanently delete the next queue dead-letter message.", {
|
|
12264
12576
|
queue: { type: "string" },
|
|
12265
12577
|
timeoutSeconds: { type: "integer", minimum: 0, maximum: 55 }
|
|
12266
12578
|
}, ["queue"]),
|
|
12267
|
-
|
|
12579
|
+
mutationCapability3("subscriptions.deadLetters.receiveDelete", "Receive and permanently delete the next subscription dead-letter message.", {
|
|
12268
12580
|
topic: { type: "string" },
|
|
12269
12581
|
subscription: { type: "string" },
|
|
12270
12582
|
timeoutSeconds: { type: "integer", minimum: 0, maximum: 55 }
|
|
@@ -12383,7 +12695,7 @@ function readCapability2(name, description, properties, required = []) {
|
|
|
12383
12695
|
parameters: { type: "object", properties, ...required.length ? { required } : {} }
|
|
12384
12696
|
};
|
|
12385
12697
|
}
|
|
12386
|
-
function
|
|
12698
|
+
function mutationCapability3(name, description, properties, required) {
|
|
12387
12699
|
return {
|
|
12388
12700
|
name,
|
|
12389
12701
|
class: "mutation",
|
|
@@ -12471,7 +12783,7 @@ function parseConnectionString(credentials, dataSourceId) {
|
|
|
12471
12783
|
}
|
|
12472
12784
|
async function sendMessage(credentials, inv, entityPath) {
|
|
12473
12785
|
enforceEntityPath(credentials, entityPath);
|
|
12474
|
-
const content =
|
|
12786
|
+
const content = requiredString5(inv.args.content, "content", true);
|
|
12475
12787
|
const encoding = inv.args.encoding === void 0 ? "utf-8" : enumValue(inv.args.encoding, "encoding", ["utf-8", "base64"]);
|
|
12476
12788
|
const body = encoding === "base64" ? strictBase64(content) : Buffer.from(content, "utf8");
|
|
12477
12789
|
if (body.byteLength > MAX_MESSAGE_BYTES) {
|
|
@@ -12563,7 +12875,7 @@ ${expiry}`, "utf8").digest("base64");
|
|
|
12563
12875
|
throw new ProviderRateLimited("Azure Service Bus is throttling requests", inv.source.id, {
|
|
12564
12876
|
status: response.status,
|
|
12565
12877
|
body: redactProviderText(text),
|
|
12566
|
-
retryAfterMs:
|
|
12878
|
+
retryAfterMs: retryAfterMs4(response.headers.get("retry-after"))
|
|
12567
12879
|
});
|
|
12568
12880
|
}
|
|
12569
12881
|
throw new Error(`Azure Service Bus request failed with HTTP ${response.status}: ${redactProviderText(text).slice(0, 500)}`);
|
|
@@ -12573,7 +12885,7 @@ function encodePathSegment2(segment) {
|
|
|
12573
12885
|
return encodeURIComponent(segment);
|
|
12574
12886
|
}
|
|
12575
12887
|
function entityName(value, field) {
|
|
12576
|
-
const name =
|
|
12888
|
+
const name = requiredString5(value, field);
|
|
12577
12889
|
if (!/^[A-Za-z0-9][A-Za-z0-9._~-]{0,259}$/.test(name)) {
|
|
12578
12890
|
throw new Error(`${field} must be a valid Azure Service Bus entity name`);
|
|
12579
12891
|
}
|
|
@@ -12608,7 +12920,7 @@ var BROKER_PROPERTY_NAMES = /* @__PURE__ */ new Set([
|
|
|
12608
12920
|
]);
|
|
12609
12921
|
function allowedBrokerProperties(value) {
|
|
12610
12922
|
if (value === void 0) return void 0;
|
|
12611
|
-
if (!
|
|
12923
|
+
if (!isRecord2(value)) throw new Error("brokerProperties must be an object");
|
|
12612
12924
|
const entries = Object.entries(value);
|
|
12613
12925
|
if (entries.length > BROKER_PROPERTY_NAMES.size) throw new Error("brokerProperties contains too many fields");
|
|
12614
12926
|
const result = {};
|
|
@@ -12631,7 +12943,7 @@ var RESERVED_HEADERS = /* @__PURE__ */ new Set([
|
|
|
12631
12943
|
]);
|
|
12632
12944
|
function applicationPropertyHeaders(value) {
|
|
12633
12945
|
if (value === void 0) return {};
|
|
12634
|
-
if (!
|
|
12946
|
+
if (!isRecord2(value)) throw new Error("applicationProperties must be an object");
|
|
12635
12947
|
const entries = Object.entries(value);
|
|
12636
12948
|
if (entries.length > 64) throw new Error("applicationProperties cannot contain more than 64 entries");
|
|
12637
12949
|
const result = {};
|
|
@@ -12646,10 +12958,10 @@ function applicationPropertyHeaders(value) {
|
|
|
12646
12958
|
if (typeof property === "number" && !Number.isFinite(property)) {
|
|
12647
12959
|
throw new Error(`applicationProperties.${key} must be finite`);
|
|
12648
12960
|
}
|
|
12649
|
-
const
|
|
12650
|
-
size += Buffer.byteLength(key) + Buffer.byteLength(
|
|
12961
|
+
const headerValue2 = requiredHeaderValue(String(property), `applicationProperties.${key}`);
|
|
12962
|
+
size += Buffer.byteLength(key) + Buffer.byteLength(headerValue2);
|
|
12651
12963
|
if (size > 32 * 1024) throw new Error("applicationProperties exceeds 32768 bytes");
|
|
12652
|
-
result[key] =
|
|
12964
|
+
result[key] = headerValue2;
|
|
12653
12965
|
}
|
|
12654
12966
|
return result;
|
|
12655
12967
|
}
|
|
@@ -12727,14 +13039,14 @@ function strictBase64(value) {
|
|
|
12727
13039
|
}
|
|
12728
13040
|
return Buffer.from(value, "base64");
|
|
12729
13041
|
}
|
|
12730
|
-
function
|
|
13042
|
+
function requiredString5(value, field, allowEmpty = false) {
|
|
12731
13043
|
if (typeof value !== "string" || !allowEmpty && value.trim() === "") {
|
|
12732
13044
|
throw new Error(`${field} must be ${allowEmpty ? "a string" : "a non-empty string"}`);
|
|
12733
13045
|
}
|
|
12734
13046
|
return allowEmpty ? value : value.trim();
|
|
12735
13047
|
}
|
|
12736
13048
|
function requiredHeaderValue(value, field) {
|
|
12737
|
-
const parsed =
|
|
13049
|
+
const parsed = requiredString5(value, field);
|
|
12738
13050
|
if (/\r|\n/.test(parsed) || parsed.length > 4096) throw new Error(`${field} is not a safe header value`);
|
|
12739
13051
|
return parsed;
|
|
12740
13052
|
}
|
|
@@ -12753,7 +13065,7 @@ function enumValue(value, field, choices) {
|
|
|
12753
13065
|
function decodeUtf82(value) {
|
|
12754
13066
|
return new TextDecoder("utf-8", { fatal: true }).decode(value);
|
|
12755
13067
|
}
|
|
12756
|
-
function
|
|
13068
|
+
function retryAfterMs4(value) {
|
|
12757
13069
|
if (!value) return 6e4;
|
|
12758
13070
|
const seconds = Number(value);
|
|
12759
13071
|
if (Number.isFinite(seconds) && seconds >= 0) return seconds * 1e3;
|
|
@@ -12763,7 +13075,7 @@ function retryAfterMs3(value) {
|
|
|
12763
13075
|
function redactProviderText(value) {
|
|
12764
13076
|
return value.replace(/SharedAccessSignature\s+[^\s<]+/gi, "SharedAccessSignature [redacted]").replace(/SharedAccessKey=[^;\s<]+/gi, "SharedAccessKey=[redacted]");
|
|
12765
13077
|
}
|
|
12766
|
-
function
|
|
13078
|
+
function isRecord2(value) {
|
|
12767
13079
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
12768
13080
|
}
|
|
12769
13081
|
|
|
@@ -19297,7 +19609,7 @@ var checkoutConnector = declarativeRestConnector({
|
|
|
19297
19609
|
});
|
|
19298
19610
|
|
|
19299
19611
|
// src/connectors/adapters/docuseal.ts
|
|
19300
|
-
import { createHmac as createHmac4, timingSafeEqual } from "crypto";
|
|
19612
|
+
import { createHmac as createHmac4, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
19301
19613
|
var DEFAULT_BASE = "https://api.docuseal.com";
|
|
19302
19614
|
function readDocuSealCredentials(creds) {
|
|
19303
19615
|
if (creds.kind === "api-key" && typeof creds.apiKey === "string" && creds.apiKey.length > 0) {
|
|
@@ -19426,7 +19738,7 @@ function docuseal(opts = {}) {
|
|
|
19426
19738
|
const a = Buffer.from(sig.toLowerCase(), "utf-8");
|
|
19427
19739
|
const b = Buffer.from(expected, "utf-8");
|
|
19428
19740
|
if (a.length !== b.length) return { valid: false, reason: "invalid_signature" };
|
|
19429
|
-
return
|
|
19741
|
+
return timingSafeEqual2(a, b) ? { valid: true } : { valid: false, reason: "invalid_signature" };
|
|
19430
19742
|
},
|
|
19431
19743
|
async handleInboundEvent({ rawBody }) {
|
|
19432
19744
|
let parsed;
|
|
@@ -23044,7 +23356,7 @@ var frontConnector = declarativeRestConnector({
|
|
|
23044
23356
|
});
|
|
23045
23357
|
|
|
23046
23358
|
// src/connectors/oauth.ts
|
|
23047
|
-
import { createHash as
|
|
23359
|
+
import { createHash as createHash4, randomBytes } from "crypto";
|
|
23048
23360
|
var PENDING_TTL_MS = 10 * 60 * 1e3;
|
|
23049
23361
|
var InMemoryOAuthFlowStore = class {
|
|
23050
23362
|
pendingFlows = /* @__PURE__ */ new Map();
|
|
@@ -23072,7 +23384,7 @@ function startOAuthFlow(input) {
|
|
|
23072
23384
|
const now = input.now ?? Date.now();
|
|
23073
23385
|
store.sweep?.(now);
|
|
23074
23386
|
const codeVerifier = base64Url(randomBytes(48));
|
|
23075
|
-
const codeChallenge = base64Url(
|
|
23387
|
+
const codeChallenge = base64Url(createHash4("sha256").update(codeVerifier).digest());
|
|
23076
23388
|
const state = base64Url(randomBytes(24));
|
|
23077
23389
|
store.put(state, {
|
|
23078
23390
|
codeVerifier,
|
|
@@ -24991,7 +25303,7 @@ var googleCloudStorageConnector = declarativeRestConnector({
|
|
|
24991
25303
|
});
|
|
24992
25304
|
|
|
24993
25305
|
// src/connectors/adapters/google-pubsub.ts
|
|
24994
|
-
import { createHash as
|
|
25306
|
+
import { createHash as createHash5, createSign } from "crypto";
|
|
24995
25307
|
var TOKEN_URL3 = "https://oauth2.googleapis.com/token";
|
|
24996
25308
|
var API_ROOT = "https://pubsub.googleapis.com/v1";
|
|
24997
25309
|
var PUBSUB_SCOPE = "https://www.googleapis.com/auth/pubsub";
|
|
@@ -25023,7 +25335,7 @@ var googlePubSubConnector = {
|
|
|
25023
25335
|
readCapability3("topics.get", "Get one topic and its server-side configuration.", {
|
|
25024
25336
|
topic: { type: "string", description: "Topic ID in the service account project." }
|
|
25025
25337
|
}, ["topic"]),
|
|
25026
|
-
|
|
25338
|
+
mutationCapability4("topics.create", "Create a topic in the service account project.", {
|
|
25027
25339
|
topic: { type: "string" },
|
|
25028
25340
|
labels: { type: "object", additionalProperties: { type: "string" } },
|
|
25029
25341
|
allowedPersistenceRegions: { type: "array", items: { type: "string" } },
|
|
@@ -25031,10 +25343,10 @@ var googlePubSubConnector = {
|
|
|
25031
25343
|
schema: { type: "string", description: "Full Pub/Sub schema resource name." },
|
|
25032
25344
|
schemaEncoding: { type: "string", enum: ["JSON", "BINARY"] }
|
|
25033
25345
|
}, ["topic"]),
|
|
25034
|
-
|
|
25346
|
+
mutationCapability4("topics.delete", "Delete a topic. Existing subscriptions remain but stop receiving messages.", {
|
|
25035
25347
|
topic: { type: "string" }
|
|
25036
25348
|
}, ["topic"]),
|
|
25037
|
-
|
|
25349
|
+
mutationCapability4("messages.publish", "Publish up to 1,000 messages to a topic.", {
|
|
25038
25350
|
topic: { type: "string" },
|
|
25039
25351
|
messages: {
|
|
25040
25352
|
type: "array",
|
|
@@ -25050,7 +25362,7 @@ var googlePubSubConnector = {
|
|
|
25050
25362
|
readCapability3("subscriptions.get", "Get one subscription and its delivery configuration.", {
|
|
25051
25363
|
subscription: { type: "string" }
|
|
25052
25364
|
}, ["subscription"]),
|
|
25053
|
-
|
|
25365
|
+
mutationCapability4("subscriptions.create", "Create a pull subscription for a topic.", {
|
|
25054
25366
|
subscription: { type: "string" },
|
|
25055
25367
|
topic: { type: "string" },
|
|
25056
25368
|
ackDeadlineSeconds: { type: "integer", minimum: 10, maximum: 600 },
|
|
@@ -25066,18 +25378,18 @@ var googlePubSubConnector = {
|
|
|
25066
25378
|
enableExactlyOnceDelivery: { type: "boolean" },
|
|
25067
25379
|
labels: { type: "object", additionalProperties: { type: "string" } }
|
|
25068
25380
|
}, ["subscription", "topic"]),
|
|
25069
|
-
|
|
25381
|
+
mutationCapability4("subscriptions.delete", "Delete a subscription and discard its retained messages.", {
|
|
25070
25382
|
subscription: { type: "string" }
|
|
25071
25383
|
}, ["subscription"]),
|
|
25072
|
-
|
|
25384
|
+
mutationCapability4("messages.pull", "Pull messages and make them temporarily unavailable to other subscribers.", {
|
|
25073
25385
|
subscription: { type: "string" },
|
|
25074
25386
|
maxMessages: { type: "integer", minimum: 1, maximum: 1e3 }
|
|
25075
25387
|
}, ["subscription", "maxMessages"]),
|
|
25076
|
-
|
|
25388
|
+
mutationCapability4("messages.acknowledge", "Acknowledge delivered messages by ack ID.", {
|
|
25077
25389
|
subscription: { type: "string" },
|
|
25078
25390
|
ackIds: { type: "array", minItems: 1, maxItems: 1e3, items: { type: "string" } }
|
|
25079
25391
|
}, ["subscription", "ackIds"]),
|
|
25080
|
-
|
|
25392
|
+
mutationCapability4("messages.modifyAckDeadline", "Change the acknowledgement deadline for delivered messages.", {
|
|
25081
25393
|
subscription: { type: "string" },
|
|
25082
25394
|
ackIds: { type: "array", minItems: 1, maxItems: 1e3, items: { type: "string" } },
|
|
25083
25395
|
ackDeadlineSeconds: { type: "integer", minimum: 0, maximum: 600 }
|
|
@@ -25115,10 +25427,10 @@ var googlePubSubConnector = {
|
|
|
25115
25427
|
if (labels) body.labels = labels;
|
|
25116
25428
|
const regions2 = optionalStringArray(inv.args.allowedPersistenceRegions, "allowedPersistenceRegions");
|
|
25117
25429
|
if (regions2) body.messageStoragePolicy = { allowedPersistenceRegions: regions2 };
|
|
25118
|
-
if (inv.args.kmsKeyName !== void 0) body.kmsKeyName =
|
|
25430
|
+
if (inv.args.kmsKeyName !== void 0) body.kmsKeyName = requiredString6(inv.args.kmsKeyName, "kmsKeyName");
|
|
25119
25431
|
if (inv.args.schema !== void 0) {
|
|
25120
25432
|
body.schemaSettings = {
|
|
25121
|
-
schema:
|
|
25433
|
+
schema: requiredString6(inv.args.schema, "schema"),
|
|
25122
25434
|
...inv.args.schemaEncoding === void 0 ? {} : { encoding: enumValue2(inv.args.schemaEncoding, "schemaEncoding", ["JSON", "BINARY"]) }
|
|
25123
25435
|
};
|
|
25124
25436
|
}
|
|
@@ -25217,7 +25529,7 @@ function readCapability3(name, description, properties, required = []) {
|
|
|
25217
25529
|
parameters: { type: "object", properties, ...required.length ? { required } : {} }
|
|
25218
25530
|
};
|
|
25219
25531
|
}
|
|
25220
|
-
function
|
|
25532
|
+
function mutationCapability4(name, description, properties, required) {
|
|
25221
25533
|
return {
|
|
25222
25534
|
name,
|
|
25223
25535
|
class: "mutation",
|
|
@@ -25237,7 +25549,7 @@ function parseServiceAccountCredentials(credentials, dataSourceId) {
|
|
|
25237
25549
|
} catch {
|
|
25238
25550
|
throw new CredentialsExpired("Google Pub/Sub service-account key must be valid JSON", dataSourceId);
|
|
25239
25551
|
}
|
|
25240
|
-
if (!
|
|
25552
|
+
if (!isRecord3(parsed) || parsed.type !== "service_account") {
|
|
25241
25553
|
throw new CredentialsExpired("Google Pub/Sub requires a Google service_account key", dataSourceId);
|
|
25242
25554
|
}
|
|
25243
25555
|
const projectId = requiredCredentialString(parsed.project_id, "project_id", dataSourceId);
|
|
@@ -25255,7 +25567,7 @@ function parseServiceAccountCredentials(credentials, dataSourceId) {
|
|
|
25255
25567
|
return { projectId, clientEmail, privateKey };
|
|
25256
25568
|
}
|
|
25257
25569
|
async function accessToken(credentials, dataSourceId) {
|
|
25258
|
-
const cacheKey =
|
|
25570
|
+
const cacheKey = createHash5("sha256").update(credentials.clientEmail).update("\0").update(credentials.privateKey).digest("hex");
|
|
25259
25571
|
const cached = tokenCache.get(cacheKey);
|
|
25260
25572
|
if (cached && cached.expiresAt > Date.now() + 6e4) {
|
|
25261
25573
|
tokenCache.delete(cacheKey);
|
|
@@ -25297,8 +25609,8 @@ async function exchangeAccessToken(credentials, dataSourceId, cacheKey) {
|
|
|
25297
25609
|
body: form2
|
|
25298
25610
|
});
|
|
25299
25611
|
const body = await readJson(response, 64 * 1024);
|
|
25300
|
-
if (!response.ok || !
|
|
25301
|
-
const reason =
|
|
25612
|
+
if (!response.ok || !isRecord3(body) || typeof body.access_token !== "string" || body.access_token.trim() === "") {
|
|
25613
|
+
const reason = isRecord3(body) && typeof body.error === "string" ? body.error : void 0;
|
|
25302
25614
|
throw new CredentialsExpired("Google rejected the Pub/Sub service-account grant", dataSourceId, {
|
|
25303
25615
|
status: response.status,
|
|
25304
25616
|
reason,
|
|
@@ -25336,7 +25648,7 @@ async function pubSubRequest(credentials, inv, method, path, query2, body) {
|
|
|
25336
25648
|
});
|
|
25337
25649
|
const responseBody = await readJson(response, MAX_RESPONSE_BYTES3);
|
|
25338
25650
|
if (response.ok) return responseBody;
|
|
25339
|
-
const providerError =
|
|
25651
|
+
const providerError = isRecord3(responseBody) && isRecord3(responseBody.error) ? responseBody.error : void 0;
|
|
25340
25652
|
const reason = providerError && typeof providerError.status === "string" ? providerError.status : void 0;
|
|
25341
25653
|
if (response.status === 401) {
|
|
25342
25654
|
throw new CredentialsExpired("Google Pub/Sub credentials were rejected", inv.source.id, {
|
|
@@ -25357,7 +25669,7 @@ async function pubSubRequest(credentials, inv, method, path, query2, body) {
|
|
|
25357
25669
|
status: response.status,
|
|
25358
25670
|
reason,
|
|
25359
25671
|
body: responseBody,
|
|
25360
|
-
retryAfterMs:
|
|
25672
|
+
retryAfterMs: retryAfterMs5(response.headers.get("retry-after"))
|
|
25361
25673
|
});
|
|
25362
25674
|
}
|
|
25363
25675
|
const message = providerError && typeof providerError.message === "string" ? providerError.message : `HTTP ${response.status}`;
|
|
@@ -25373,7 +25685,7 @@ function subscriptionPath(credentials, value) {
|
|
|
25373
25685
|
return `${projectPath(credentials, "subscriptions")}/${encodeURIComponent(resourceId(value, "subscription"))}`;
|
|
25374
25686
|
}
|
|
25375
25687
|
function resourceId(value, field) {
|
|
25376
|
-
const id2 =
|
|
25688
|
+
const id2 = requiredString6(value, field);
|
|
25377
25689
|
if (!/^[A-Za-z][A-Za-z0-9._~+%-]{2,254}$/.test(id2) || id2.toLowerCase().startsWith("goog")) {
|
|
25378
25690
|
throw new Error(`${field} must be a valid Pub/Sub resource ID`);
|
|
25379
25691
|
}
|
|
@@ -25382,7 +25694,7 @@ function resourceId(value, field) {
|
|
|
25382
25694
|
function pagination(args) {
|
|
25383
25695
|
const query2 = new URLSearchParams();
|
|
25384
25696
|
if (args.pageSize !== void 0) query2.set("pageSize", String(boundedInteger2(args.pageSize, "pageSize", 1, 1e3)));
|
|
25385
|
-
if (args.pageToken !== void 0) query2.set("pageToken",
|
|
25697
|
+
if (args.pageToken !== void 0) query2.set("pageToken", requiredString6(args.pageToken, "pageToken"));
|
|
25386
25698
|
return query2;
|
|
25387
25699
|
}
|
|
25388
25700
|
function subscriptionBody(credentials, args) {
|
|
@@ -25391,7 +25703,7 @@ function subscriptionBody(credentials, args) {
|
|
|
25391
25703
|
setOptionalBoolean(body, "retainAckedMessages", args.retainAckedMessages);
|
|
25392
25704
|
setOptionalDuration(body, "messageRetentionDuration", args.messageRetentionDuration);
|
|
25393
25705
|
if (args.expirationTtl !== void 0) body.expirationPolicy = { ttl: duration(args.expirationTtl, "expirationTtl") };
|
|
25394
|
-
if (args.filter !== void 0) body.filter =
|
|
25706
|
+
if (args.filter !== void 0) body.filter = requiredString6(args.filter, "filter");
|
|
25395
25707
|
if (args.deadLetterTopic !== void 0) {
|
|
25396
25708
|
body.deadLetterPolicy = {
|
|
25397
25709
|
deadLetterTopic: topicPath(credentials, args.deadLetterTopic),
|
|
@@ -25417,7 +25729,7 @@ function publishMessages(value) {
|
|
|
25417
25729
|
throw new Error("messages must contain 1 to 1000 entries");
|
|
25418
25730
|
}
|
|
25419
25731
|
return value.map((entry, index) => {
|
|
25420
|
-
if (!
|
|
25732
|
+
if (!isRecord3(entry)) throw new Error(`messages[${index}] must be an object`);
|
|
25421
25733
|
const hasText = typeof entry.text === "string";
|
|
25422
25734
|
const hasData = typeof entry.data === "string";
|
|
25423
25735
|
if (hasText === hasData) throw new Error(`messages[${index}] requires exactly one of text or data`);
|
|
@@ -25425,7 +25737,7 @@ function publishMessages(value) {
|
|
|
25425
25737
|
const message = { data: data4 };
|
|
25426
25738
|
const attributes = optionalStringMap(entry.attributes, `messages[${index}].attributes`);
|
|
25427
25739
|
if (attributes) message.attributes = attributes;
|
|
25428
|
-
if (entry.orderingKey !== void 0) message.orderingKey =
|
|
25740
|
+
if (entry.orderingKey !== void 0) message.orderingKey = requiredString6(entry.orderingKey, `messages[${index}].orderingKey`);
|
|
25429
25741
|
return message;
|
|
25430
25742
|
});
|
|
25431
25743
|
}
|
|
@@ -25466,7 +25778,7 @@ function requiredCredentialString(value, field, dataSourceId) {
|
|
|
25466
25778
|
}
|
|
25467
25779
|
return value.trim();
|
|
25468
25780
|
}
|
|
25469
|
-
function
|
|
25781
|
+
function requiredString6(value, field) {
|
|
25470
25782
|
if (typeof value !== "string" || value.trim() === "") throw new Error(`${field} must be a non-empty string`);
|
|
25471
25783
|
return value.trim();
|
|
25472
25784
|
}
|
|
@@ -25480,7 +25792,7 @@ function requiredStringArray(value, field, maximum) {
|
|
|
25480
25792
|
if (!Array.isArray(value) || value.length < 1 || value.length > maximum) {
|
|
25481
25793
|
throw new Error(`${field} must contain 1 to ${maximum} strings`);
|
|
25482
25794
|
}
|
|
25483
|
-
return value.map((entry, index) =>
|
|
25795
|
+
return value.map((entry, index) => requiredString6(entry, `${field}[${index}]`));
|
|
25484
25796
|
}
|
|
25485
25797
|
function optionalStringArray(value, field) {
|
|
25486
25798
|
if (value === void 0) return void 0;
|
|
@@ -25488,12 +25800,12 @@ function optionalStringArray(value, field) {
|
|
|
25488
25800
|
}
|
|
25489
25801
|
function optionalStringMap(value, field) {
|
|
25490
25802
|
if (value === void 0) return void 0;
|
|
25491
|
-
if (!
|
|
25803
|
+
if (!isRecord3(value)) throw new Error(`${field} must be an object of strings`);
|
|
25492
25804
|
const entries = Object.entries(value);
|
|
25493
25805
|
if (entries.length > 64) throw new Error(`${field} cannot contain more than 64 entries`);
|
|
25494
25806
|
return Object.fromEntries(entries.map(([key, entry]) => [
|
|
25495
|
-
|
|
25496
|
-
|
|
25807
|
+
requiredString6(key, `${field} key`),
|
|
25808
|
+
requiredString6(entry, `${field}.${key}`)
|
|
25497
25809
|
]));
|
|
25498
25810
|
}
|
|
25499
25811
|
function setOptionalInteger(body, key, value, minimum, maximum) {
|
|
@@ -25508,7 +25820,7 @@ function setOptionalDuration(body, key, value) {
|
|
|
25508
25820
|
if (value !== void 0) body[key] = duration(value, key);
|
|
25509
25821
|
}
|
|
25510
25822
|
function duration(value, field) {
|
|
25511
|
-
const parsed =
|
|
25823
|
+
const parsed = requiredString6(value, field);
|
|
25512
25824
|
if (!/^\d+(?:\.\d{1,9})?s$/.test(parsed)) throw new Error(`${field} must be a protobuf duration ending in s`);
|
|
25513
25825
|
return parsed;
|
|
25514
25826
|
}
|
|
@@ -25527,14 +25839,14 @@ function strictBase642(value, field) {
|
|
|
25527
25839
|
function base64UrlJson(value) {
|
|
25528
25840
|
return Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
25529
25841
|
}
|
|
25530
|
-
function
|
|
25842
|
+
function retryAfterMs5(value) {
|
|
25531
25843
|
if (!value) return 6e4;
|
|
25532
25844
|
const seconds = Number(value);
|
|
25533
25845
|
if (Number.isFinite(seconds) && seconds >= 0) return seconds * 1e3;
|
|
25534
25846
|
const date = Date.parse(value);
|
|
25535
25847
|
return Number.isFinite(date) ? Math.max(0, date - Date.now()) : 6e4;
|
|
25536
25848
|
}
|
|
25537
|
-
function
|
|
25849
|
+
function isRecord3(value) {
|
|
25538
25850
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
25539
25851
|
}
|
|
25540
25852
|
|
|
@@ -27310,7 +27622,7 @@ async function ensureFreshAccessToken5(creds, clientId, clientSecret) {
|
|
|
27310
27622
|
}
|
|
27311
27623
|
|
|
27312
27624
|
// src/connectors/adapters/google-sheets.ts
|
|
27313
|
-
import { createHash as
|
|
27625
|
+
import { createHash as createHash6 } from "crypto";
|
|
27314
27626
|
var SCOPES5 = ["https://www.googleapis.com/auth/spreadsheets"];
|
|
27315
27627
|
var AUTH_URL6 = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
27316
27628
|
var TOKEN_URL7 = "https://oauth2.googleapis.com/token";
|
|
@@ -27583,7 +27895,7 @@ async function fetchAllRows(accessToken4, meta) {
|
|
|
27583
27895
|
function rowFingerprint(values) {
|
|
27584
27896
|
const keys = Object.keys(values).sort();
|
|
27585
27897
|
const blob = keys.map((k) => `${k}=${values[k]}`).join("");
|
|
27586
|
-
return
|
|
27898
|
+
return createHash6("sha256").update(blob).digest("hex").slice(0, 16);
|
|
27587
27899
|
}
|
|
27588
27900
|
function matchesPredicate(row, predicate) {
|
|
27589
27901
|
for (const [k, v] of Object.entries(predicate)) {
|
|
@@ -28437,7 +28749,7 @@ var granolaConnector = declarativeRestConnector({
|
|
|
28437
28749
|
});
|
|
28438
28750
|
|
|
28439
28751
|
// src/connectors/adapters/hellosign.ts
|
|
28440
|
-
import { createHmac as createHmac5, timingSafeEqual as
|
|
28752
|
+
import { createHmac as createHmac5, timingSafeEqual as timingSafeEqual3 } from "crypto";
|
|
28441
28753
|
var SCOPES6 = [
|
|
28442
28754
|
"basic_account_info",
|
|
28443
28755
|
"request_signature",
|
|
@@ -28664,7 +28976,7 @@ function hellosign(opts) {
|
|
|
28664
28976
|
const a = Buffer.from(event.event_hash.toLowerCase(), "utf-8");
|
|
28665
28977
|
const b = Buffer.from(expected.toLowerCase(), "utf-8");
|
|
28666
28978
|
if (a.length !== b.length) return { valid: false, reason: "invalid_signature" };
|
|
28667
|
-
return
|
|
28979
|
+
return timingSafeEqual3(a, b) ? { valid: true } : { valid: false, reason: "invalid_signature" };
|
|
28668
28980
|
},
|
|
28669
28981
|
async handleInboundEvent({ rawBody }) {
|
|
28670
28982
|
const parsed = parseInboundBody(rawBody);
|
|
@@ -43143,7 +43455,7 @@ var rssConnector = {
|
|
|
43143
43455
|
if (!res.ok) {
|
|
43144
43456
|
throw new Error(`rss fetch ${res.status} ${res.statusText} for ${url.toString()}`);
|
|
43145
43457
|
}
|
|
43146
|
-
const body = await
|
|
43458
|
+
const body = await readBoundedText2(res, MAX_BODY_BYTES);
|
|
43147
43459
|
const parsed = parseFeed(body, url.toString());
|
|
43148
43460
|
const filtered = filterAndLimit(parsed.entries, since, limit);
|
|
43149
43461
|
const data4 = {
|
|
@@ -43223,7 +43535,7 @@ function readSinceMs(value) {
|
|
|
43223
43535
|
}
|
|
43224
43536
|
return ms;
|
|
43225
43537
|
}
|
|
43226
|
-
async function
|
|
43538
|
+
async function readBoundedText2(res, maxBytes) {
|
|
43227
43539
|
const reader = res.body?.getReader();
|
|
43228
43540
|
if (!reader) return await res.text();
|
|
43229
43541
|
const decoder = new TextDecoder("utf-8", { fatal: false });
|
|
@@ -53257,7 +53569,7 @@ var zohoBookingsConnector = {
|
|
|
53257
53569
|
group_id: { type: "string" },
|
|
53258
53570
|
resource_id: { type: "string" }
|
|
53259
53571
|
}, ["service_id", "selected_date"]),
|
|
53260
|
-
|
|
53572
|
+
mutationCapability5("appointments.book", "Book an appointment for a customer.", {
|
|
53261
53573
|
service_id: { type: "string" },
|
|
53262
53574
|
from_time: { type: "string", description: "Zoho timestamp in dd-MMM-yyyy HH:mm:ss format." },
|
|
53263
53575
|
customer_details: {
|
|
@@ -53273,13 +53585,13 @@ var zohoBookingsConnector = {
|
|
|
53273
53585
|
additional_fields: { type: "object" },
|
|
53274
53586
|
payment_info: { type: "object" }
|
|
53275
53587
|
}, ["service_id", "from_time", "customer_details"]),
|
|
53276
|
-
|
|
53588
|
+
mutationCapability5("appointments.reschedule", "Move an appointment to a new time, staff member, or group.", {
|
|
53277
53589
|
booking_id: { type: "string" },
|
|
53278
53590
|
start_time: { type: "string", description: "Zoho timestamp in dd-MMM-yyyy HH:mm:ss format." },
|
|
53279
53591
|
staff_id: { type: "string" },
|
|
53280
53592
|
group_id: { type: "string" }
|
|
53281
53593
|
}, ["booking_id"]),
|
|
53282
|
-
|
|
53594
|
+
mutationCapability5("appointments.cancel", "Cancel an appointment by booking id.", {
|
|
53283
53595
|
booking_id: { type: "string" }
|
|
53284
53596
|
}, ["booking_id"])
|
|
53285
53597
|
]
|
|
@@ -53405,7 +53717,7 @@ function readCapability4(name, description, properties, required = []) {
|
|
|
53405
53717
|
requiredScopes: ["zohobookings.data.READ"]
|
|
53406
53718
|
};
|
|
53407
53719
|
}
|
|
53408
|
-
function
|
|
53720
|
+
function mutationCapability5(name, description, properties, required) {
|
|
53409
53721
|
return {
|
|
53410
53722
|
name,
|
|
53411
53723
|
class: "mutation",
|
|
@@ -53460,7 +53772,7 @@ async function request2(source, path, options) {
|
|
|
53460
53772
|
throw new ProviderRateLimited("Zoho Bookings rate limit (429)", source.id, {
|
|
53461
53773
|
status: 429,
|
|
53462
53774
|
body: responseBody,
|
|
53463
|
-
retryAfterMs:
|
|
53775
|
+
retryAfterMs: retryAfterMs6(response.headers.get("retry-after"))
|
|
53464
53776
|
});
|
|
53465
53777
|
}
|
|
53466
53778
|
if (!response.ok) throw new Error(`zoho-bookings ${options.method} ${path} HTTP ${response.status}`);
|
|
@@ -53505,7 +53817,7 @@ function exactlyOne(args, keys, label) {
|
|
|
53505
53817
|
const present = keys.filter((key) => args[key] !== void 0 && args[key] !== null && args[key] !== "");
|
|
53506
53818
|
if (present.length !== 1) throw new Error(`zoho-bookings: exactly one ${label} is required`);
|
|
53507
53819
|
}
|
|
53508
|
-
function
|
|
53820
|
+
function retryAfterMs6(value) {
|
|
53509
53821
|
if (!value) return 6e4;
|
|
53510
53822
|
const seconds = Number(value);
|
|
53511
53823
|
return Number.isFinite(seconds) && seconds >= 0 ? Math.max(1e3, seconds * 1e3) : 6e4;
|
|
@@ -54644,11 +54956,11 @@ async function request3(source, path, options) {
|
|
|
54644
54956
|
});
|
|
54645
54957
|
}
|
|
54646
54958
|
if (response.status === 429) {
|
|
54647
|
-
const
|
|
54959
|
+
const retryAfterMs7 = parseRetryAfter(response.headers.get("retry-after"));
|
|
54648
54960
|
throw new ProviderRateLimited("Zoho Campaigns rate limit (429)", source.id, {
|
|
54649
54961
|
status: 429,
|
|
54650
54962
|
body: responseBody,
|
|
54651
|
-
retryAfterMs:
|
|
54963
|
+
retryAfterMs: retryAfterMs7
|
|
54652
54964
|
});
|
|
54653
54965
|
}
|
|
54654
54966
|
if (!response.ok) {
|
|
@@ -62308,6 +62620,7 @@ var CONNECTOR_ADAPTER_FACTORIES = [
|
|
|
62308
62620
|
defineFactoryAdapter(() => googleCloudStorageConnector, googleOAuthEnvMap),
|
|
62309
62621
|
defineFactoryAdapter(() => googlePubSubConnector, {}),
|
|
62310
62622
|
defineFactoryAdapter(() => azureBlobStorageConnector, {}),
|
|
62623
|
+
defineFactoryAdapter(() => azureEventGridConnector, {}),
|
|
62311
62624
|
defineFactoryAdapter(() => azureServiceBusConnector, {}),
|
|
62312
62625
|
defineFactoryAdapter(() => backblazeConnector, {}),
|
|
62313
62626
|
defineFactoryAdapter(() => cloudinaryConnector, {}),
|
|
@@ -63082,11 +63395,11 @@ function validateOutboundStartArgs(args) {
|
|
|
63082
63395
|
assertNonEmptyString(args.agentId, "agentId", 128);
|
|
63083
63396
|
assertE164(args.toNumber, "toNumber");
|
|
63084
63397
|
assertE164(args.fromNumber, "fromNumber");
|
|
63085
|
-
if (!
|
|
63398
|
+
if (!isRecord4(args.mission)) throw new Error("phony start_outbound_call requires mission");
|
|
63086
63399
|
const mission = args.mission;
|
|
63087
63400
|
assertNonEmptyString(mission.goal, "mission.goal", 2e3);
|
|
63088
63401
|
if (mission.goal.trim().length < 8) throw new Error("phony start_outbound_call mission.goal must be at least 8 characters");
|
|
63089
|
-
if (mission.successSchema !== void 0 && !
|
|
63402
|
+
if (mission.successSchema !== void 0 && !isRecord4(mission.successSchema)) {
|
|
63090
63403
|
throw new Error("phony start_outbound_call mission.successSchema must be an object when supplied");
|
|
63091
63404
|
}
|
|
63092
63405
|
if (mission.ivrHints !== void 0) {
|
|
@@ -63100,7 +63413,7 @@ function validateOutboundStartArgs(args) {
|
|
|
63100
63413
|
if (args.missionId !== void 0) assertNonEmptyString(args.missionId, "missionId", 128);
|
|
63101
63414
|
if (args.voiceCloneId !== void 0) assertNonEmptyString(args.voiceCloneId, "voiceCloneId", 128);
|
|
63102
63415
|
if (args.callerProfile !== void 0) {
|
|
63103
|
-
if (!
|
|
63416
|
+
if (!isRecord4(args.callerProfile)) throw new Error("phony start_outbound_call callerProfile must be an object");
|
|
63104
63417
|
if (args.callerProfile.userName !== void 0) assertNonEmptyString(args.callerProfile.userName, "callerProfile.userName", 120);
|
|
63105
63418
|
if (args.callerProfile.companyName !== void 0) {
|
|
63106
63419
|
assertNonEmptyString(args.callerProfile.companyName, "callerProfile.companyName", 120);
|
|
@@ -63127,7 +63440,7 @@ function assertOptionalInteger(value, field, min, max) {
|
|
|
63127
63440
|
throw new Error(`phony start_outbound_call ${field} must be an integer between ${min} and ${max}`);
|
|
63128
63441
|
}
|
|
63129
63442
|
}
|
|
63130
|
-
function
|
|
63443
|
+
function isRecord4(value) {
|
|
63131
63444
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
63132
63445
|
}
|
|
63133
63446
|
async function getJson(inv, token, url, label) {
|
|
@@ -142249,6 +142562,7 @@ export {
|
|
|
142249
142562
|
avalaraConnector,
|
|
142250
142563
|
azureAdConnector,
|
|
142251
142564
|
azureBlobStorageConnector,
|
|
142565
|
+
azureEventGridConnector,
|
|
142252
142566
|
azureServiceBusConnector,
|
|
142253
142567
|
basecampConnector,
|
|
142254
142568
|
backblazeConnector,
|
|
@@ -142818,4 +143132,4 @@ export {
|
|
|
142818
143132
|
demandbaseConnector,
|
|
142819
143133
|
adapters_exports
|
|
142820
143134
|
};
|
|
142821
|
-
//# sourceMappingURL=chunk-
|
|
143135
|
+
//# sourceMappingURL=chunk-XZL47RBS.js.map
|