@junando/worker 0.10.0 → 0.10.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/dist/handler.cjs +63 -7
- package/package.json +2 -2
package/dist/handler.cjs
CHANGED
|
@@ -59921,6 +59921,50 @@ function createLLMProvider(provider, apiKey, model, options) {
|
|
|
59921
59921
|
return factory(apiKey, model, options);
|
|
59922
59922
|
}
|
|
59923
59923
|
|
|
59924
|
+
// ../core/src/shared/factory-registry.ts
|
|
59925
|
+
var FactoryRegistry = class {
|
|
59926
|
+
_factories = /* @__PURE__ */ new Map();
|
|
59927
|
+
_default = () => {
|
|
59928
|
+
throw new Error(`No factory registered and no default available`);
|
|
59929
|
+
};
|
|
59930
|
+
/**
|
|
59931
|
+
* Register a factory for a given key.
|
|
59932
|
+
* Overwrites any existing registration for that key.
|
|
59933
|
+
*/
|
|
59934
|
+
register(key, factory) {
|
|
59935
|
+
this._factories.set(key, factory);
|
|
59936
|
+
}
|
|
59937
|
+
/**
|
|
59938
|
+
* Set the default factory to use when no key matches.
|
|
59939
|
+
*/
|
|
59940
|
+
registerDefault(factory) {
|
|
59941
|
+
this._default = factory;
|
|
59942
|
+
}
|
|
59943
|
+
/**
|
|
59944
|
+
* Resolve the factory for a given key.
|
|
59945
|
+
* Returns the default if no specific factory is registered for that key.
|
|
59946
|
+
*/
|
|
59947
|
+
resolve(key) {
|
|
59948
|
+
const factory = this._factories.get(key);
|
|
59949
|
+
if (factory) {
|
|
59950
|
+
return factory();
|
|
59951
|
+
}
|
|
59952
|
+
return this._default();
|
|
59953
|
+
}
|
|
59954
|
+
/**
|
|
59955
|
+
* Check if a factory is registered for a given key.
|
|
59956
|
+
*/
|
|
59957
|
+
has(key) {
|
|
59958
|
+
return this._factories.has(key);
|
|
59959
|
+
}
|
|
59960
|
+
/**
|
|
59961
|
+
* Return all registered keys.
|
|
59962
|
+
*/
|
|
59963
|
+
keys() {
|
|
59964
|
+
return Array.from(this._factories.keys());
|
|
59965
|
+
}
|
|
59966
|
+
};
|
|
59967
|
+
|
|
59924
59968
|
// ../core/src/infrastructure/notifier/slack.adapter.ts
|
|
59925
59969
|
createLogger();
|
|
59926
59970
|
function sanitizeEndpointPath(endpointPath) {
|
|
@@ -60230,14 +60274,26 @@ var TeamsNotifier = class {
|
|
|
60230
60274
|
};
|
|
60231
60275
|
|
|
60232
60276
|
// ../core/src/infrastructure/notifier/factory.ts
|
|
60277
|
+
function buildNotifierRegistry(config) {
|
|
60278
|
+
const registry2 = new FactoryRegistry();
|
|
60279
|
+
registry2.register("teams", () => {
|
|
60280
|
+
if (!config.teamsWebhookUrl) {
|
|
60281
|
+
throw new Error("NOTIFIER_TYPE=teams requires TEAMS_WEBHOOK_URL to be set");
|
|
60282
|
+
}
|
|
60283
|
+
return new TeamsNotifier(config.teamsWebhookUrl);
|
|
60284
|
+
});
|
|
60285
|
+
registry2.register("slack", () => {
|
|
60286
|
+
if (!config.slackBotToken || !config.slackChannel) {
|
|
60287
|
+
throw new Error("NOTIFIER_TYPE=slack requires SLACK_BOT_TOKEN and SLACK_CHANNEL to be set");
|
|
60288
|
+
}
|
|
60289
|
+
return new SlackNotifier(config.slackBotToken, config.slackChannel);
|
|
60290
|
+
});
|
|
60291
|
+
registry2.registerDefault(() => new SlackNotifier("dummy-token", "#alerts"));
|
|
60292
|
+
return registry2;
|
|
60293
|
+
}
|
|
60233
60294
|
function createNotifier(config) {
|
|
60234
|
-
|
|
60235
|
-
|
|
60236
|
-
return new TeamsNotifier(config.teamsWebhookUrl);
|
|
60237
|
-
case "slack":
|
|
60238
|
-
default:
|
|
60239
|
-
return new SlackNotifier(config.slackBotToken, config.slackChannel);
|
|
60240
|
-
}
|
|
60295
|
+
const registry2 = buildNotifierRegistry(config);
|
|
60296
|
+
return registry2.resolve(config.notifierType);
|
|
60241
60297
|
}
|
|
60242
60298
|
|
|
60243
60299
|
// ../../node_modules/.pnpm/@aws-sdk+client-sqs@3.1045.0/node_modules/@aws-sdk/client-sqs/dist-es/SQSClient.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@junando/worker",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "AWS Lambda SQS worker — processes alert events and dispatches notifications for Junando",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@aws-sdk/client-ssm": "^3.600.0",
|
|
23
23
|
"ioredis": "^5.4.1",
|
|
24
24
|
"zod": "^3.23.0",
|
|
25
|
-
"@junando/core": "0.10.
|
|
25
|
+
"@junando/core": "0.10.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/aws-lambda": "^8.10.145",
|