@grvpandey11/backstage-plugin-scaffolder-backend-module-ms-teams 2.0.0 → 3.0.0
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/actions/ms-teams/send-ms-teams-message.cjs.js +7 -19
- package/dist/actions/ms-teams/send-ms-teams-message.cjs.js.map +1 -1
- package/dist/actions/ms-teams/send-ms-teams-message.examples.cjs.js +26 -10
- package/dist/actions/ms-teams/send-ms-teams-message.examples.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/module.cjs.js +1 -1
- package/dist/module.cjs.js.map +1 -1
- package/package.json +16 -14
|
@@ -16,22 +16,12 @@ function createSendTeamsMessageViaWebhookAction(options) {
|
|
|
16
16
|
description: "Sends a Microsoft Teams message via a webhook",
|
|
17
17
|
examples: sendMsTeamsMessage_examples.examples,
|
|
18
18
|
schema: {
|
|
19
|
-
input: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
description: "The message to send via webhook",
|
|
26
|
-
type: "string"
|
|
27
|
-
},
|
|
28
|
-
webhookUrl: {
|
|
29
|
-
title: "Webhook URL",
|
|
30
|
-
description: "The Microsoft Teams webhook URL to send the request to. The URL must either be specified here or in the Backstage config",
|
|
31
|
-
type: "string"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
19
|
+
input: (z) => z.object({
|
|
20
|
+
message: z.string().describe("The message to send via webhook"),
|
|
21
|
+
webhookUrl: z.string().describe(
|
|
22
|
+
"The Microsoft Teams webhook URL to send the request to. The URL must either be specified here or in the Backstage config"
|
|
23
|
+
).optional()
|
|
24
|
+
})
|
|
35
25
|
},
|
|
36
26
|
async handler(ctx) {
|
|
37
27
|
const webhookUrl = config.getOptionalString("ms-teams.webhookUrl") ?? ctx.input.webhookUrl;
|
|
@@ -40,9 +30,7 @@ function createSendTeamsMessageViaWebhookAction(options) {
|
|
|
40
30
|
"Webhook URL is not specified in either the app-config or the action input. This must be specified in at least one place in order to send a message"
|
|
41
31
|
);
|
|
42
32
|
}
|
|
43
|
-
const body = {
|
|
44
|
-
text: ctx.input.message
|
|
45
|
-
};
|
|
33
|
+
const body = { text: ctx.input.message };
|
|
46
34
|
const result = await axios__default.default.post(webhookUrl, body);
|
|
47
35
|
if (result.status !== 200) {
|
|
48
36
|
ctx.logger.error(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-ms-teams-message.cjs.js","sources":["../../../src/actions/ms-teams/send-ms-teams-message.ts"],"sourcesContent":["import { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport axios from 'axios';\nimport { Config } from '@backstage/config';\nimport { InputError } from '@backstage/errors';\nimport { examples } from './send-ms-teams-message.examples';\n\n/**\n * Creates a `
|
|
1
|
+
{"version":3,"file":"send-ms-teams-message.cjs.js","sources":["../../../src/actions/ms-teams/send-ms-teams-message.ts"],"sourcesContent":["import { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport axios from 'axios';\nimport { Config } from '@backstage/config';\nimport { InputError } from '@backstage/errors';\nimport { examples } from './send-ms-teams-message.examples';\n\n/**\n * Creates a `ms-teams:sendMessage` Scaffolder action.\n *\n * @public\n */\nexport function createSendTeamsMessageViaWebhookAction(options: { config: Config }) {\n const { config } = options;\n\n return createTemplateAction({\n id: 'ms-teams:sendMessage',\n description: 'Sends a Microsoft Teams message via a webhook',\n examples,\n schema: {\n input: z =>\n z.object({\n message: z.string().describe('The message to send via webhook'),\n webhookUrl: z\n .string()\n .describe(\n 'The Microsoft Teams webhook URL to send the request to. The URL must either be specified here or in the Backstage config',\n )\n .optional(),\n }),\n },\n async handler(ctx) {\n const webhookUrl =\n config.getOptionalString('ms-teams.webhookUrl') ?? ctx.input.webhookUrl;\n\n if (!webhookUrl) {\n throw new InputError(\n 'Webhook URL is not specified in either the app-config or the action input. This must be specified in at least one place in order to send a message',\n );\n }\n\n const body = { text: ctx.input.message };\n const result = await axios.post(webhookUrl, body);\n\n if (result.status !== 200) {\n ctx.logger.error(\n `Something went wrong while trying to send a request to the Teams webhook URL - StatusCode ${result.status}`,\n );\n ctx.logger.debug(`Response body: ${result.data}`);\n ctx.logger.debug(`Webhook URL: ${webhookUrl}`);\n ctx.logger.debug(`Input message: ${ctx.input.message}`);\n throw new Error(\n `Something went wrong while trying to send a request to the Teams webhook URL - StatusCode ${result.status}`,\n );\n }\n },\n });\n}\n"],"names":["createTemplateAction","examples","InputError","axios"],"mappings":";;;;;;;;;;;AAWO,SAAS,uCAAuC,OAAA,EAA6B;AAClF,EAAA,MAAM,EAAE,QAAO,GAAI,OAAA;AAEnB,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,sBAAA;AAAA,IACJ,WAAA,EAAa,+CAAA;AAAA,cACbC,oCAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CAAE,MAAA,CAAO;AAAA,QACP,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,iCAAiC,CAAA;AAAA,QAC9D,UAAA,EAAY,CAAA,CACT,MAAA,EAAO,CACP,QAAA;AAAA,UACC;AAAA,UAED,QAAA;AAAS,OACb;AAAA,KACL;AAAA,IACA,MAAM,QAAQ,GAAA,EAAK;AACjB,MAAA,MAAM,aACJ,MAAA,CAAO,iBAAA,CAAkB,qBAAqB,CAAA,IAAK,IAAI,KAAA,CAAM,UAAA;AAE/D,MAAA,IAAI,CAAC,UAAA,EAAY;AACf,QAAA,MAAM,IAAIC,iBAAA;AAAA,UACR;AAAA,SACF;AAAA;AAGF,MAAA,MAAM,IAAA,GAAO,EAAE,IAAA,EAAM,GAAA,CAAI,MAAM,OAAA,EAAQ;AACvC,MAAA,MAAM,MAAA,GAAS,MAAMC,sBAAA,CAAM,IAAA,CAAK,YAAY,IAAI,CAAA;AAEhD,MAAA,IAAI,MAAA,CAAO,WAAW,GAAA,EAAK;AACzB,QAAA,GAAA,CAAI,MAAA,CAAO,KAAA;AAAA,UACT,CAAA,0FAAA,EAA6F,OAAO,MAAM,CAAA;AAAA,SAC5G;AACA,QAAA,GAAA,CAAI,MAAA,CAAO,KAAA,CAAM,CAAA,eAAA,EAAkB,MAAA,CAAO,IAAI,CAAA,CAAE,CAAA;AAChD,QAAA,GAAA,CAAI,MAAA,CAAO,KAAA,CAAM,CAAA,aAAA,EAAgB,UAAU,CAAA,CAAE,CAAA;AAC7C,QAAA,GAAA,CAAI,OAAO,KAAA,CAAM,CAAA,eAAA,EAAkB,GAAA,CAAI,KAAA,CAAM,OAAO,CAAA,CAAE,CAAA;AACtD,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,CAAA,0FAAA,EAA6F,OAAO,MAAM,CAAA;AAAA,SAC5G;AAAA;AACF;AACF,GACD,CAAA;AACH;;;;"}
|
|
@@ -2,19 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
var yaml = require('yaml');
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function _interopNamespaceCompat(e) {
|
|
6
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
6
22
|
|
|
7
|
-
var
|
|
23
|
+
var yaml__namespace = /*#__PURE__*/_interopNamespaceCompat(yaml);
|
|
8
24
|
|
|
9
25
|
const examples = [
|
|
10
26
|
{
|
|
11
|
-
description: "
|
|
12
|
-
example:
|
|
27
|
+
description: "Sends a simple message to Microsoft Teams using the configured webhook URL.",
|
|
28
|
+
example: yaml__namespace.stringify({
|
|
13
29
|
steps: [
|
|
14
30
|
{
|
|
15
|
-
id: "
|
|
16
|
-
action: "ms-teams:sendMessage",
|
|
31
|
+
id: "send-message",
|
|
17
32
|
name: "Send a message to Teams",
|
|
33
|
+
action: "ms-teams:sendMessage",
|
|
18
34
|
input: {
|
|
19
35
|
message: "Hello, Teams!"
|
|
20
36
|
}
|
|
@@ -23,13 +39,13 @@ const examples = [
|
|
|
23
39
|
})
|
|
24
40
|
},
|
|
25
41
|
{
|
|
26
|
-
description: "
|
|
27
|
-
example:
|
|
42
|
+
description: "Sends a message to Microsoft Teams using a specific webhook URL provided in input.",
|
|
43
|
+
example: yaml__namespace.stringify({
|
|
28
44
|
steps: [
|
|
29
45
|
{
|
|
30
|
-
id: "
|
|
46
|
+
id: "send-message",
|
|
47
|
+
name: "Send a message to Teams with explicit webhook",
|
|
31
48
|
action: "ms-teams:sendMessage",
|
|
32
|
-
name: "Send a message to Teams",
|
|
33
49
|
input: {
|
|
34
50
|
message: "Hello, Teams!",
|
|
35
51
|
webhookUrl: "https://example-teams-webhook.com"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-ms-teams-message.examples.cjs.js","sources":["../../../src/actions/ms-teams/send-ms-teams-message.examples.ts"],"sourcesContent":["import { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: '
|
|
1
|
+
{"version":3,"file":"send-ms-teams-message.examples.cjs.js","sources":["../../../src/actions/ms-teams/send-ms-teams-message.examples.ts"],"sourcesContent":["import { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport * as yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Sends a simple message to Microsoft Teams using the configured webhook URL.',\n example: yaml.stringify({\n steps: [\n {\n id: 'send-message',\n name: 'Send a message to Teams',\n action: 'ms-teams:sendMessage',\n input: {\n message: 'Hello, Teams!',\n },\n },\n ],\n }),\n },\n {\n description: 'Sends a message to Microsoft Teams using a specific webhook URL provided in input.',\n example: yaml.stringify({\n steps: [\n {\n id: 'send-message',\n name: 'Send a message to Teams with explicit webhook',\n action: 'ms-teams:sendMessage',\n input: {\n message: 'Hello, Teams!',\n webhookUrl: 'https://example-teams-webhook.com',\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,QAAA,GAA8B;AAAA,EACzC;AAAA,IACE,WAAA,EAAa,6EAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,cAAA;AAAA,UACJ,IAAA,EAAM,yBAAA;AAAA,UACN,MAAA,EAAQ,sBAAA;AAAA,UACR,KAAA,EAAO;AAAA,YACL,OAAA,EAAS;AAAA;AACX;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAA,EAAa,oFAAA;AAAA,IACb,OAAA,EAASA,gBAAK,SAAA,CAAU;AAAA,MACtB,KAAA,EAAO;AAAA,QACL;AAAA,UACE,EAAA,EAAI,cAAA;AAAA,UACJ,IAAA,EAAM,+CAAA;AAAA,UACN,MAAA,EAAQ,sBAAA;AAAA,UACR,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,eAAA;AAAA,YACT,UAAA,EAAY;AAAA;AACd;AACF;AACF,KACD;AAAA;AAEL;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as _backstage_plugin_scaffolder_node from '@backstage/plugin-scaffolder-node';
|
|
2
|
-
import * as _backstage_types_index from '@backstage/types/index';
|
|
3
2
|
import { Config } from '@backstage/config';
|
|
4
3
|
import * as _backstage_backend_plugin_api from '@backstage/backend-plugin-api';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* Creates a `
|
|
6
|
+
* Creates a `ms-teams:sendMessage` Scaffolder action.
|
|
8
7
|
*
|
|
9
8
|
* @public
|
|
10
9
|
*/
|
|
@@ -12,8 +11,10 @@ declare function createSendTeamsMessageViaWebhookAction(options: {
|
|
|
12
11
|
config: Config;
|
|
13
12
|
}): _backstage_plugin_scaffolder_node.TemplateAction<{
|
|
14
13
|
message: string;
|
|
15
|
-
webhookUrl?: string;
|
|
16
|
-
},
|
|
14
|
+
webhookUrl?: string | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
}, "v2">;
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* A backend module that registers the action into the scaffolder
|
package/dist/module.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ var alpha = require('@backstage/plugin-scaffolder-node/alpha');
|
|
|
5
5
|
var sendMsTeamsMessage = require('./actions/ms-teams/send-ms-teams-message.cjs.js');
|
|
6
6
|
|
|
7
7
|
const scaffolderModuleSendTeamsMessage = backendPluginApi.createBackendModule({
|
|
8
|
-
moduleId: "ms-teams
|
|
8
|
+
moduleId: "ms-teams",
|
|
9
9
|
pluginId: "scaffolder",
|
|
10
10
|
register({ registerInit }) {
|
|
11
11
|
registerInit({
|
package/dist/module.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["import { createBackendModule, coreServices } from \"@backstage/backend-plugin-api\";\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport { createSendTeamsMessageViaWebhookAction } from \"./actions/ms-teams/send-ms-teams-message\";\n\n/**\n * A backend module that registers the action into the scaffolder\n */\nexport const scaffolderModuleSendTeamsMessage = createBackendModule({\n moduleId: 'ms-teams
|
|
1
|
+
{"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["import { createBackendModule, coreServices } from \"@backstage/backend-plugin-api\";\nimport { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';\nimport { createSendTeamsMessageViaWebhookAction } from \"./actions/ms-teams/send-ms-teams-message\";\n\n/**\n * A backend module that registers the action into the scaffolder\n */\nexport const scaffolderModuleSendTeamsMessage = createBackendModule({\n moduleId: 'ms-teams',\n pluginId: 'scaffolder',\n register({ registerInit }) {\n registerInit({\n deps: {\n scaffolderActions: scaffolderActionsExtensionPoint,\n config: coreServices.rootConfig,\n },\n async init({ scaffolderActions, config }) {\n scaffolderActions.addActions(createSendTeamsMessageViaWebhookAction({ config }));\n }\n });\n },\n})\n"],"names":["createBackendModule","scaffolderActionsExtensionPoint","coreServices","createSendTeamsMessageViaWebhookAction"],"mappings":";;;;;;AAOO,MAAM,mCAAmCA,oCAAA,CAAoB;AAAA,EAClE,QAAA,EAAU,UAAA;AAAA,EACV,QAAA,EAAU,YAAA;AAAA,EACV,QAAA,CAAS,EAAE,YAAA,EAAa,EAAG;AACzB,IAAA,YAAA,CAAa;AAAA,MACX,IAAA,EAAM;AAAA,QACJ,iBAAA,EAAmBC,qCAAA;AAAA,QACnB,QAAQC,6BAAA,CAAa;AAAA,OACvB;AAAA,MACA,MAAM,IAAA,CAAK,EAAE,iBAAA,EAAmB,QAAO,EAAG;AACxC,QAAA,iBAAA,CAAkB,UAAA,CAAWC,yDAAA,CAAuC,EAAE,MAAA,EAAQ,CAAC,CAAA;AAAA;AACjF,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grvpandey11/backstage-plugin-scaffolder-backend-module-ms-teams",
|
|
3
3
|
"description": "The Microsoft Teams module for @backstage/plugin-scaffolder-backend",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"private": false,
|
|
9
8
|
"repository": {
|
|
10
9
|
"type": "git",
|
|
11
10
|
"url": "https://github.com/grvpandey11/backstage-plugin-scaffolder-backend-module-ms-teams.git",
|
|
@@ -19,7 +18,10 @@
|
|
|
19
18
|
"backstage": {
|
|
20
19
|
"role": "backend-plugin-module",
|
|
21
20
|
"pluginId": "scaffolder",
|
|
22
|
-
"pluginPackage": "@backstage/plugin-scaffolder-backend"
|
|
21
|
+
"pluginPackage": "@backstage/plugin-scaffolder-backend",
|
|
22
|
+
"features": {
|
|
23
|
+
".": "@backstage/BackendFeature"
|
|
24
|
+
}
|
|
23
25
|
},
|
|
24
26
|
"scripts": {
|
|
25
27
|
"start": "backstage-cli package start",
|
|
@@ -31,25 +33,25 @@
|
|
|
31
33
|
"postpack": "backstage-cli package postpack"
|
|
32
34
|
},
|
|
33
35
|
"dependencies": {
|
|
34
|
-
"@backstage/backend-plugin-api": "^1.
|
|
35
|
-
"@backstage/config": "^1.3.
|
|
36
|
-
"@backstage/errors": "^1.2.
|
|
37
|
-
"@backstage/plugin-scaffolder-node": "^0.
|
|
38
|
-
"axios": "^1.
|
|
39
|
-
"yaml": "^2.
|
|
36
|
+
"@backstage/backend-plugin-api": "^1.4.0",
|
|
37
|
+
"@backstage/config": "^1.3.2",
|
|
38
|
+
"@backstage/errors": "^1.2.7",
|
|
39
|
+
"@backstage/plugin-scaffolder-node": "^0.9.0",
|
|
40
|
+
"axios": "^1.10.0",
|
|
41
|
+
"yaml": "^2.8.0",
|
|
42
|
+
"zod": "^3.25.67"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
42
|
-
"@backstage/cli": "^0.
|
|
43
|
-
"@backstage/plugin-scaffolder-node-test-utils": "^0.
|
|
44
|
-
"winston": "^3.17.0"
|
|
45
|
+
"@backstage/cli": "^0.33.0",
|
|
46
|
+
"@backstage/plugin-scaffolder-node-test-utils": "^0.3.0"
|
|
45
47
|
},
|
|
46
48
|
"files": [
|
|
47
49
|
"dist"
|
|
48
50
|
],
|
|
49
51
|
"typesVersions": {
|
|
50
52
|
"*": {
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
+
"package.json": [
|
|
54
|
+
"package.json"
|
|
53
55
|
]
|
|
54
56
|
}
|
|
55
57
|
}
|