@backstage/plugin-scaffolder-backend-module-sentry 0.2.11-next.2 → 0.2.11
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend-module-sentry
|
|
2
2
|
|
|
3
|
+
## 0.2.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 648b3d7: Add optional input to sentry:project:create to set the new Sentry project's platform
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/config@1.3.3
|
|
10
|
+
- @backstage/plugin-scaffolder-node@0.10.0
|
|
11
|
+
- @backstage/backend-plugin-api@1.4.1
|
|
12
|
+
|
|
3
13
|
## 0.2.11-next.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -21,19 +21,25 @@ function createSentryCreateProjectAction(options) {
|
|
|
21
21
|
slug: (z) => z.string({
|
|
22
22
|
description: "Optional slug for the new project. If not provided a slug is generated from the name"
|
|
23
23
|
}).optional(),
|
|
24
|
+
platform: (z) => z.string({
|
|
25
|
+
description: "Optional sentry platform for the new project. "
|
|
26
|
+
}).optional(),
|
|
24
27
|
authToken: (z) => z.string({
|
|
25
28
|
description: "authenticate via bearer auth token. Requires scope: project:write"
|
|
26
29
|
}).optional()
|
|
27
30
|
}
|
|
28
31
|
},
|
|
29
32
|
async handler(ctx) {
|
|
30
|
-
const { organizationSlug, teamSlug, name, slug, authToken } = ctx.input;
|
|
33
|
+
const { organizationSlug, teamSlug, name, slug, platform, authToken } = ctx.input;
|
|
31
34
|
const body = {
|
|
32
35
|
name
|
|
33
36
|
};
|
|
34
37
|
if (slug) {
|
|
35
38
|
body.slug = slug;
|
|
36
39
|
}
|
|
40
|
+
if (platform) {
|
|
41
|
+
body.platform = platform;
|
|
42
|
+
}
|
|
37
43
|
const token = authToken ? authToken : config.getOptionalString("scaffolder.sentry.token");
|
|
38
44
|
if (!token) {
|
|
39
45
|
throw new errors.InputError(`No valid sentry token given`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createProject.cjs.js","sources":["../../src/actions/createProject.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { InputError } from '@backstage/errors';\nimport { Config } from '@backstage/config';\n\n/**\n * Creates the `sentry:project:create` Scaffolder action.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/features/software-templates/writing-custom-actions}.\n *\n * @param options - Configuration of the Sentry API.\n * @public\n */\nexport function createSentryCreateProjectAction(options: { config: Config }) {\n const { config } = options;\n\n return createTemplateAction({\n id: 'sentry:project:create',\n schema: {\n input: {\n organizationSlug: z =>\n z.string({\n description: 'The slug of the organization the team belongs to',\n }),\n teamSlug: z =>\n z.string({\n description: 'The slug of the team to create a new project for',\n }),\n name: z =>\n z.string({\n description: 'The name for the new project',\n }),\n slug: z =>\n z\n .string({\n description:\n 'Optional slug for the new project. If not provided a slug is generated from the name',\n })\n .optional(),\n authToken: z =>\n z\n .string({\n description:\n 'authenticate via bearer auth token. Requires scope: project:write',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const { organizationSlug, teamSlug, name, slug, authToken }
|
|
1
|
+
{"version":3,"file":"createProject.cjs.js","sources":["../../src/actions/createProject.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { InputError } from '@backstage/errors';\nimport { Config } from '@backstage/config';\n\n/**\n * Creates the `sentry:project:create` Scaffolder action.\n *\n * @remarks\n *\n * See {@link https://backstage.io/docs/features/software-templates/writing-custom-actions}.\n *\n * @param options - Configuration of the Sentry API.\n * @public\n */\nexport function createSentryCreateProjectAction(options: { config: Config }) {\n const { config } = options;\n\n return createTemplateAction({\n id: 'sentry:project:create',\n schema: {\n input: {\n organizationSlug: z =>\n z.string({\n description: 'The slug of the organization the team belongs to',\n }),\n teamSlug: z =>\n z.string({\n description: 'The slug of the team to create a new project for',\n }),\n name: z =>\n z.string({\n description: 'The name for the new project',\n }),\n slug: z =>\n z\n .string({\n description:\n 'Optional slug for the new project. If not provided a slug is generated from the name',\n })\n .optional(),\n platform: z =>\n z\n .string({\n description: 'Optional sentry platform for the new project. ',\n })\n .optional(),\n authToken: z =>\n z\n .string({\n description:\n 'authenticate via bearer auth token. Requires scope: project:write',\n })\n .optional(),\n },\n },\n async handler(ctx) {\n const { organizationSlug, teamSlug, name, slug, platform, authToken } =\n ctx.input;\n\n const body: any = {\n name: name,\n };\n\n if (slug) {\n body.slug = slug;\n }\n\n if (platform) {\n body.platform = platform;\n }\n\n const token = authToken\n ? authToken\n : config.getOptionalString('scaffolder.sentry.token');\n\n if (!token) {\n throw new InputError(`No valid sentry token given`);\n }\n\n const { result } = await ctx.checkpoint({\n key: `create.project.${organizationSlug}.${teamSlug}`,\n fn: async () => {\n const response = await fetch(\n `https://sentry.io/api/0/teams/${organizationSlug}/${teamSlug}/projects/`,\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(body),\n },\n );\n\n const contentType = response.headers.get('content-type');\n\n if (contentType !== 'application/json') {\n throw new InputError(\n `Unexpected Sentry Response Type: ${await response.text()}`,\n );\n }\n\n const res = await response.json();\n\n if (response.status !== 201) {\n throw new InputError(`Sentry Response was: ${await res.detail}`);\n }\n\n return {\n code: response.status,\n result: res as { id: string },\n };\n },\n });\n\n ctx.output('id', result.id);\n ctx.output('result', result);\n },\n });\n}\n"],"names":["createTemplateAction","InputError"],"mappings":";;;;;AA8BO,SAAS,gCAAgC,OAA6B,EAAA;AAC3E,EAAM,MAAA,EAAE,QAAW,GAAA,OAAA;AAEnB,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,uBAAA;AAAA,IACJ,MAAQ,EAAA;AAAA,MACN,KAAO,EAAA;AAAA,QACL,gBAAA,EAAkB,CAChB,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACd,CAAA;AAAA,QACH,QAAA,EAAU,CACR,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACd,CAAA;AAAA,QACH,IAAA,EAAM,CACJ,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACd,CAAA;AAAA,QACH,IAAA,EAAM,CACJ,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WACE,EAAA;AAAA,SACH,EACA,QAAS,EAAA;AAAA,QACd,QAAA,EAAU,CACR,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WAAa,EAAA;AAAA,SACd,EACA,QAAS,EAAA;AAAA,QACd,SAAA,EAAW,CACT,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,UACN,WACE,EAAA;AAAA,SACH,EACA,QAAS;AAAA;AAChB,KACF;AAAA,IACA,MAAM,QAAQ,GAAK,EAAA;A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AA,EAAM,CAAA;AAAA,aAC3D;AAAA;AAGF,UAAM,MAAA,GAAA,GAAM,MAAM,QAAA,CAAS,IAAK,EAAA;AAEhC,UAAI,IAAA,QAAA,CAAS,WAAW,GAAK,EAAA;AAC3B,YAAA,MAAM,IAAIA,iBAAW,CAAA,CAAA,qBAAA,EAAwB,MAAM,GAAA,CAAI,MAAM,CAAE,CAAA,CAAA;AAAA;AAGjE,UAAO,OAAA;AAAA,YACL,MAAM,QAAS,CAAA,MAAA;AAAA,YACf,MAAQ,EAAA;AAAA,WACV;AAAA;AACF,OACD,CAAA;AAED,MAAI,GAAA,CAAA,MAAA,CAAO,IAAM,EAAA,MAAA,CAAO,EAAE,CAAA;AAC1B,MAAI,GAAA,CAAA,MAAA,CAAO,UAAU,MAAM,CAAA;AAAA;AAC7B,GACD,CAAA;AACH;;;;"}
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend-module-sentry",
|
|
3
|
-
"version": "0.2.11
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "backend-plugin-module",
|
|
6
6
|
"pluginId": "scaffolder",
|
|
@@ -50,17 +50,17 @@
|
|
|
50
50
|
"test": "backstage-cli package test"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@backstage/backend-plugin-api": "1.4.1
|
|
54
|
-
"@backstage/config": "1.3.3
|
|
55
|
-
"@backstage/errors": "1.2.7",
|
|
56
|
-
"@backstage/plugin-scaffolder-node": "0.10.0
|
|
53
|
+
"@backstage/backend-plugin-api": "^1.4.1",
|
|
54
|
+
"@backstage/config": "^1.3.3",
|
|
55
|
+
"@backstage/errors": "^1.2.7",
|
|
56
|
+
"@backstage/plugin-scaffolder-node": "^0.10.0",
|
|
57
57
|
"yaml": "^2.3.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@backstage/backend-test-utils": "1.7.0
|
|
61
|
-
"@backstage/cli": "0.33.1
|
|
62
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.3.1
|
|
63
|
-
"@backstage/types": "1.2.1",
|
|
60
|
+
"@backstage/backend-test-utils": "^1.7.0",
|
|
61
|
+
"@backstage/cli": "^0.33.1",
|
|
62
|
+
"@backstage/plugin-scaffolder-node-test-utils": "^0.3.1",
|
|
63
|
+
"@backstage/types": "^1.2.1",
|
|
64
64
|
"msw": "^2.0.0"
|
|
65
65
|
}
|
|
66
66
|
}
|