@awsless/cli 0.1.46 → 0.1.48
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/bin.js +38304 -47797
- package/dist/handlers/bundle.js +17 -17
- package/dist/handlers/icon.js +3216 -3216
- package/dist/handlers/on-error-log.js +17 -20
- package/dist/handlers/on-failure.js +1 -1
- package/dist/handlers/pubsub-publisher.js +146 -146
- package/dist/handlers/pubsub-server.js +6315 -6366
- package/dist/handlers/rolldown-worker.js +376 -376
- package/dist/test-global-setup.js +12 -105
- package/package.json +29 -29
package/dist/handlers/bundle.js
CHANGED
|
@@ -234,8 +234,8 @@ var pubsubHandler = (event, routes) => {
|
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
236
|
const eventType = record.Sns.MessageAttributes?.event?.Value;
|
|
237
|
-
const listeners = routes.filter((
|
|
238
|
-
const [, type, id] =
|
|
237
|
+
const listeners = routes.filter((route) => {
|
|
238
|
+
const [, type, id] = route.split(":");
|
|
239
239
|
return type === "pubsub" && id === `${pubsubId}-${eventType}`;
|
|
240
240
|
});
|
|
241
241
|
if (!listeners.length) {
|
|
@@ -386,8 +386,8 @@ var topicHandler = (event, routes) => {
|
|
|
386
386
|
if (resourceType !== "topic") {
|
|
387
387
|
return;
|
|
388
388
|
}
|
|
389
|
-
const subscribers = routes.filter((
|
|
390
|
-
const [, type, id] =
|
|
389
|
+
const subscribers = routes.filter((route) => {
|
|
390
|
+
const [, type, id] = route.split(":");
|
|
391
391
|
return type === "topic" && id === topicId;
|
|
392
392
|
});
|
|
393
393
|
if (!subscribers.length) {
|
|
@@ -434,30 +434,30 @@ var createBundle = (handlers) => {
|
|
|
434
434
|
};
|
|
435
435
|
return async (event, context) => {
|
|
436
436
|
captureInvokedQualifier(context);
|
|
437
|
-
const handleRoute = (
|
|
438
|
-
const load = handlers[
|
|
437
|
+
const handleRoute = (match) => {
|
|
438
|
+
const load = handlers[match.key];
|
|
439
439
|
if (!load) {
|
|
440
|
-
if (routeType(
|
|
440
|
+
if (routeType(match.key) === "function") {
|
|
441
441
|
return invoke({
|
|
442
|
-
name: getStandaloneFunctionName(
|
|
442
|
+
name: getStandaloneFunctionName(match.key),
|
|
443
443
|
qualifier: getInvokedQualifier() ?? LIVE_BUNDLE_ALIAS,
|
|
444
|
-
payload:
|
|
444
|
+
payload: match.payload
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
|
-
throw new Error("Unknown bundle route: " +
|
|
447
|
+
throw new Error("Unknown bundle route: " + match.key);
|
|
448
448
|
}
|
|
449
|
-
return withBundleRouteContext(
|
|
449
|
+
return withBundleRouteContext(match.key, internalInvoke, async () => {
|
|
450
450
|
const handle = await load();
|
|
451
|
-
const routedContext = { ...context, route:
|
|
452
|
-
return handle(
|
|
453
|
-
}, { throwExpectedErrors:
|
|
451
|
+
const routedContext = { ...context, route: match.key };
|
|
452
|
+
return handle(match.payload ?? {}, routedContext);
|
|
453
|
+
}, { throwExpectedErrors: match.throwExpectedErrors });
|
|
454
454
|
};
|
|
455
455
|
const internalInvoke = async (key, payload) => {
|
|
456
|
-
const
|
|
457
|
-
if (Array.isArray(
|
|
456
|
+
const match = matchRoute(formatRoutePayload(key, unpatch(payload ?? {})));
|
|
457
|
+
if (Array.isArray(match)) {
|
|
458
458
|
throw new Error("Unknown bundle route: " + key);
|
|
459
459
|
}
|
|
460
|
-
const result = await handleRoute(
|
|
460
|
+
const result = await handleRoute(match);
|
|
461
461
|
const response = result === undefined ? undefined : patch(result);
|
|
462
462
|
if (isErrorResponse(response)) {
|
|
463
463
|
const { type, message, data } = response.__error__;
|