@backstage/plugin-scaffolder-backend-module-gitlab 0.9.7-next.0 → 0.10.0-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-gitlab
2
2
 
3
+ ## 0.10.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - ff96d7e: fix scaffolder action createDeployToken to allow usage of oauth tokens
8
+
9
+ ### Patch Changes
10
+
11
+ - b2bef92: Convert all enums to erasable-syntax compliant patterns
12
+ - Updated dependencies
13
+ - @backstage/backend-plugin-api@1.5.0-next.1
14
+ - @backstage/plugin-scaffolder-node@0.12.1-next.1
15
+
3
16
  ## 0.9.7-next.0
4
17
 
5
18
  ### Patch Changes
@@ -2,7 +2,6 @@
2
2
 
3
3
  var errors = require('@backstage/errors');
4
4
  var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
5
- var rest = require('@gitbeaker/rest');
6
5
  var util = require('../util.cjs.js');
7
6
  var gitlabProjectDeployTokenCreate_examples = require('./gitlabProjectDeployTokenCreate.examples.cjs.js');
8
7
 
@@ -43,17 +42,14 @@ const createGitlabProjectDeployTokenAction = (options) => {
43
42
  },
44
43
  async handler(ctx) {
45
44
  ctx.logger.info(`Creating Token for Project "${ctx.input.projectId}"`);
46
- const { projectId, name, username, scopes } = ctx.input;
47
- const { token, integrationConfig } = util.getToken(ctx.input, integrations);
45
+ const { projectId, name, username, scopes, repoUrl, token } = ctx.input;
48
46
  if (scopes.length === 0) {
49
47
  throw new errors.InputError(
50
48
  `Could not create token for project "${ctx.input.projectId}": scopes cannot be empty.`
51
49
  );
52
50
  }
53
- const api = new rest.Gitlab({
54
- host: integrationConfig.config.baseUrl,
55
- token
56
- });
51
+ const { host } = util.parseRepoUrl(repoUrl, integrations);
52
+ const api = util.getClient({ host, integrations, token });
57
53
  const { deployToken, deployUsername } = await ctx.checkpoint({
58
54
  key: `create.deploy.token.${projectId}.${name}`,
59
55
  fn: async () => {
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabProjectDeployTokenCreate.cjs.js","sources":["../../src/actions/gitlabProjectDeployTokenCreate.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 { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { DeployTokenScope, Gitlab } from '@gitbeaker/rest';\nimport { getToken } from '../util';\nimport { examples } from './gitlabProjectDeployTokenCreate.examples';\n\n/**\n * Creates a `gitlab:projectDeployToken:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabProjectDeployTokenAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:projectDeployToken:create',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n projectId: z =>\n z.union([z.number(), z.string()], {\n description: 'Project ID',\n }),\n name: z =>\n z.string({\n description: 'Deploy Token Name',\n }),\n username: z =>\n z\n .string({\n description: 'Deploy Token Username',\n })\n .optional(),\n scopes: z =>\n z.array(z.string(), {\n description: 'Scopes',\n }),\n },\n output: {\n deploy_token: z =>\n z.string({\n description: 'Deploy Token',\n }),\n user: z =>\n z.string({\n description: 'User',\n }),\n },\n },\n async handler(ctx) {\n ctx.logger.info(`Creating Token for Project \"${ctx.input.projectId}\"`);\n const { projectId, name, username, scopes } = ctx.input;\n const { token, integrationConfig } = getToken(ctx.input, integrations);\n\n if (scopes.length === 0) {\n throw new InputError(\n `Could not create token for project \"${ctx.input.projectId}\": scopes cannot be empty.`,\n );\n }\n\n const api = new Gitlab({\n host: integrationConfig.config.baseUrl,\n token: token,\n });\n\n const { deployToken, deployUsername } = await ctx.checkpoint({\n key: `create.deploy.token.${projectId}.${name}`,\n fn: async () => {\n const res = await api.DeployTokens.create(\n name,\n scopes as DeployTokenScope[],\n {\n projectId,\n username,\n },\n );\n\n if (!res.hasOwnProperty('token')) {\n throw new InputError(`No deploy_token given from gitlab instance`);\n }\n\n return {\n deployToken: res.token as string,\n deployUsername: res.username,\n };\n },\n });\n\n ctx.output('deploy_token', deployToken);\n ctx.output('user', deployUsername);\n },\n });\n};\n"],"names":["createTemplateAction","examples","getToken","InputError","Gitlab"],"mappings":";;;;;;;;AA6BO,MAAM,oCAAA,GAAuC,CAAC,OAAA,KAE/C;AACJ,EAAA,MAAM,EAAE,cAAa,GAAI,OAAA;AACzB,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,kCAAA;AAAA,cACJC,gDAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,SAAA,EAAW,CAAA,CAAA,KACT,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,CAAE,MAAA,EAAO,EAAG,CAAA,CAAE,MAAA,EAAQ,CAAA,EAAG;AAA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AAO,OAAA;AAAA,QAC/B;AAAA,OACD,CAAA;AAED,MAAA,MAAM,EAAE,WAAA,EAAa,cAAA,EAAe,GAAI,MAAM,IAAI,UAAA,CAAW;AAAA,QAC3D,GAAA,EAAK,CAAA,oBAAA,EAAuB,SAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAAA,QAC7C,IAAI,YAAY;AACd,UAAA,MAAM,GAAA,GAAM,MAAM,GAAA,CAAI,YAAA,CAAa,MAAA;AAAA,YACjC,IAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA,cACE,SAAA;AAAA,cACA;AAAA;AACF,WACF;AAEA,UAAA,IAAI,CAAC,GAAA,CAAI,cAAA,CAAe,OAAO,CAAA,EAAG;AAChC,YAAA,MAAM,IAAID,kBAAW,CAAA,0CAAA,CAA4C,CAAA;AAAA,UACnE;AAEA,UAAA,OAAO;AAAA,YACL,aAAa,GAAA,CAAI,KAAA;AAAA,YACjB,gBAAgB,GAAA,CAAI;AAAA,WACtB;AAAA,QACF;AAAA,OACD,CAAA;AAED,MAAA,GAAA,CAAI,MAAA,CAAO,gBAAgB,WAAW,CAAA;AACtC,MAAA,GAAA,CAAI,MAAA,CAAO,QAAQ,cAAc,CAAA;AAAA,IACnC;AAAA,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"gitlabProjectDeployTokenCreate.cjs.js","sources":["../../src/actions/gitlabProjectDeployTokenCreate.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 { InputError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { DeployTokenScope } from '@gitbeaker/rest';\nimport { getClient, parseRepoUrl } from '../util';\nimport { examples } from './gitlabProjectDeployTokenCreate.examples';\n\n/**\n * Creates a `gitlab:projectDeployToken:create` Scaffolder action.\n *\n * @param options - Templating configuration.\n * @public\n */\nexport const createGitlabProjectDeployTokenAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n return createTemplateAction({\n id: 'gitlab:projectDeployToken:create',\n examples,\n schema: {\n input: {\n repoUrl: z =>\n z.string({\n description: `Accepts the format 'gitlab.com?repo=project_name&owner=group_name' where 'project_name' is the repository name and 'group_name' is a group or username`,\n }),\n token: z =>\n z\n .string({\n description: 'The token to use for authorization to GitLab',\n })\n .optional(),\n projectId: z =>\n z.union([z.number(), z.string()], {\n description: 'Project ID',\n }),\n name: z =>\n z.string({\n description: 'Deploy Token Name',\n }),\n username: z =>\n z\n .string({\n description: 'Deploy Token Username',\n })\n .optional(),\n scopes: z =>\n z.array(z.string(), {\n description: 'Scopes',\n }),\n },\n output: {\n deploy_token: z =>\n z.string({\n description: 'Deploy Token',\n }),\n user: z =>\n z.string({\n description: 'User',\n }),\n },\n },\n async handler(ctx) {\n ctx.logger.info(`Creating Token for Project \"${ctx.input.projectId}\"`);\n const { projectId, name, username, scopes, repoUrl, token } = ctx.input;\n\n if (scopes.length === 0) {\n throw new InputError(\n `Could not create token for project \"${ctx.input.projectId}\": scopes cannot be empty.`,\n );\n }\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n const api = getClient({ host, integrations, token });\n\n const { deployToken, deployUsername } = await ctx.checkpoint({\n key: `create.deploy.token.${projectId}.${name}`,\n fn: async () => {\n const res = await api.DeployTokens.create(\n name,\n scopes as DeployTokenScope[],\n {\n projectId,\n username,\n },\n );\n\n if (!res.hasOwnProperty('token')) {\n throw new InputError(`No deploy_token given from gitlab instance`);\n }\n\n return {\n deployToken: res.token as string,\n deployUsername: res.username,\n };\n },\n });\n\n ctx.output('deploy_token', deployToken);\n ctx.output('user', deployUsername);\n },\n });\n};\n"],"names":["createTemplateAction","examples","InputError","parseRepoUrl","getClient"],"mappings":";;;;;;;AA6BO,MAAM,oCAAA,GAAuC,CAAC,OAAA,KAE/C;AACJ,EAAA,MAAM,EAAE,cAAa,GAAI,OAAA;AACzB,EAAA,OAAOA,yCAAA,CAAqB;AAAA,IAC1B,EAAA,EAAI,kCAAA;AAAA,cACJC,gDAAA;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO;AAAA,QACL,OAAA,EAAS,CAAA,CAAA,KACP,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa,CAAA,sJAAA;AAAA,SACd,CAAA;AAAA,QACH,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,SAAA,EAAW,CAAA,CAAA,KACT,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,CAAE,MAAA,EAAO,EAAG,CAAA,CAAE,MAAA,EAAQ,CAAA,EAAG;AAAA,UAChC,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,QACH,IAAA,EAAM,CAAA,CAAA,KACJ,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa;AAAA,SACd,CAAA;AAAA,QACH,QAAA,EAAU,CAAA,CAAA,KACR,CAAA,CACG,MAAA,CAAO;AAAA,UACN,WAAA,EAAa;AAAA,SACd,EACA,QAAA,EAAS;AAAA,QACd,QAAQ,CAAA,CAAA,KACN,CAAA,CAAE,KAAA,CAAM,CAAA,CAAE,QAAO,EAAG;AAAA,UAClB,WAAA,EAAa;AAAA,SACd;AAAA,OACL;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,YAAA,EAAc,CAAA,CAAA,KACZ,CAAA,CAAE,MAAA,CAAO;AAAA,UACP,WAAA,EAAa;AAAA,SACd,CAAA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AI,KAAA;AAAA,YACjB,gBAAgB,GAAA,CAAI;AAAA,WACtB;AAAA,QACF;AAAA,OACD,CAAA;AAED,MAAA,GAAA,CAAI,MAAA,CAAO,gBAAgB,WAAW,CAAA;AACtC,MAAA,GAAA,CAAI,MAAA,CAAO,QAAQ,cAAc,CAAA;AAAA,IACnC;AAAA,GACD,CAAA;AACH;;;;"}
@@ -10,18 +10,16 @@ const commonGitlabConfigExample = {
10
10
  repoUrl: "gitlab.com?owner=namespace-or-owner&repo=project-name",
11
11
  token: "${{ secrets.USER_OAUTH_TOKEN }}"
12
12
  };
13
- var IssueType = /* @__PURE__ */ ((IssueType2) => {
14
- IssueType2["ISSUE"] = "issue";
15
- IssueType2["INCIDENT"] = "incident";
16
- IssueType2["TEST"] = "test_case";
17
- IssueType2["TASK"] = "task";
18
- return IssueType2;
19
- })(IssueType || {});
20
- var IssueStateEvent = /* @__PURE__ */ ((IssueStateEvent2) => {
21
- IssueStateEvent2["CLOSE"] = "close";
22
- IssueStateEvent2["REOPEN"] = "reopen";
23
- return IssueStateEvent2;
24
- })(IssueStateEvent || {});
13
+ const IssueType = {
14
+ ISSUE: "issue",
15
+ INCIDENT: "incident",
16
+ TEST: "test_case",
17
+ TASK: "task"
18
+ };
19
+ const IssueStateEvent = {
20
+ CLOSE: "close",
21
+ REOPEN: "reopen"
22
+ };
25
23
 
26
24
  exports.IssueStateEvent = IssueStateEvent;
27
25
  exports.IssueType = IssueType;
@@ -1 +1 @@
1
- {"version":3,"file":"commonGitlabConfig.cjs.js","sources":["../src/commonGitlabConfig.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 { z } from 'zod';\n\nconst commonGitlabConfig = z.object({\n repoUrl: z.string({ description: 'Repository Location' }),\n token: z\n .string({ description: 'The token to use for authorization to GitLab' })\n .optional(),\n});\n\nexport default commonGitlabConfig;\n\nexport const commonGitlabConfigExample = {\n repoUrl: 'gitlab.com?owner=namespace-or-owner&repo=project-name',\n token: '${{ secrets.USER_OAUTH_TOKEN }}',\n};\n\n/**\n * Gitlab issue types as specified by gitlab api\n *\n * @public\n */\nexport enum IssueType {\n ISSUE = 'issue',\n INCIDENT = 'incident',\n TEST = 'test_case',\n TASK = 'task',\n}\n\n/**\n * Gitlab issue state events for modifications\n *\n * @public\n */\nexport enum IssueStateEvent {\n CLOSE = 'close',\n REOPEN = 'reopen',\n}\n"],"names":["z","IssueType","IssueStateEvent"],"mappings":";;;;AAkB2BA,MAAE,MAAA,CAAO;AAAA,EAClC,SAASA,KAAA,CAAE,MAAA,CAAO,EAAE,WAAA,EAAa,uBAAuB,CAAA;AAAA,EACxD,KAAA,EAAOA,MACJ,MAAA,CAAO,EAAE,aAAa,8CAAA,EAAgD,EACtE,QAAA;AACL,CAAC;AAIM,MAAM,yBAAA,GAA4B;AAAA,EACvC,OAAA,EAAS,uDAAA;AAAA,EACT,KAAA,EAAO;AACT;AAOO,IAAK,SAAA,qBAAAC,UAAAA,KAAL;AACL,EAAAA,WAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,WAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,WAAA,MAAA,CAAA,GAAO,WAAA;AACP,EAAAA,WAAA,MAAA,CAAA,GAAO,MAAA;AAJG,EAAA,OAAAA,UAAAA;AAAA,CAAA,EAAA,SAAA,IAAA,EAAA;AAYL,IAAK,eAAA,qBAAAC,gBAAAA,KAAL;AACL,EAAAA,iBAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,iBAAA,QAAA,CAAA,GAAS,QAAA;AAFC,EAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA;;;;;;"}
1
+ {"version":3,"file":"commonGitlabConfig.cjs.js","sources":["../src/commonGitlabConfig.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/* We want to maintain the same information as an enum, so we disable the redeclaration warning */\n/* eslint-disable @typescript-eslint/no-redeclare */\n\nimport { z } from 'zod';\n\nconst commonGitlabConfig = z.object({\n repoUrl: z.string({ description: 'Repository Location' }),\n token: z\n .string({ description: 'The token to use for authorization to GitLab' })\n .optional(),\n});\n\nexport default commonGitlabConfig;\n\nexport const commonGitlabConfigExample = {\n repoUrl: 'gitlab.com?owner=namespace-or-owner&repo=project-name',\n token: '${{ secrets.USER_OAUTH_TOKEN }}',\n};\n\n/**\n * Gitlab issue types as specified by gitlab api\n *\n * @public\n */\nexport const IssueType = {\n ISSUE: 'issue',\n INCIDENT: 'incident',\n TEST: 'test_case',\n TASK: 'task',\n} as const;\n\n/**\n * @public\n */\nexport type IssueType = (typeof IssueType)[keyof typeof IssueType];\n\n/**\n * @public\n */\nexport namespace IssueType {\n export type ISSUE = typeof IssueType.ISSUE;\n export type INCIDENT = typeof IssueType.INCIDENT;\n export type TEST = typeof IssueType.TEST;\n export type TASK = typeof IssueType.TASK;\n}\n\n/**\n * Gitlab issue state events for modifications\n *\n * @public\n */\nexport const IssueStateEvent = {\n CLOSE: 'close',\n REOPEN: 'reopen',\n} as const;\n\n/**\n * @public\n */\nexport type IssueStateEvent =\n (typeof IssueStateEvent)[keyof typeof IssueStateEvent];\n\n/**\n * @public\n */\nexport namespace IssueStateEvent {\n export type CLOSE = typeof IssueStateEvent.CLOSE;\n export type REOPEN = typeof IssueStateEvent.REOPEN;\n}\n"],"names":["z"],"mappings":";;;;AAoB2BA,MAAE,MAAA,CAAO;AAAA,EAClC,SAASA,KAAA,CAAE,MAAA,CAAO,EAAE,WAAA,EAAa,uBAAuB,CAAA;AAAA,EACxD,KAAA,EAAOA,MACJ,MAAA,CAAO,EAAE,aAAa,8CAAA,EAAgD,EACtE,QAAA;AACL,CAAC;AAIM,MAAM,yBAAA,GAA4B;AAAA,EACvC,OAAA,EAAS,uDAAA;AAAA,EACT,KAAA,EAAO;AACT;AAOO,MAAM,SAAA,GAAY;AAAA,EACvB,KAAA,EAAO,OAAA;AAAA,EACP,QAAA,EAAU,UAAA;AAAA,EACV,IAAA,EAAM,WAAA;AAAA,EACN,IAAA,EAAM;AACR;AAsBO,MAAM,eAAA,GAAkB;AAAA,EAC7B,KAAA,EAAO,OAAA;AAAA,EACP,MAAA,EAAQ;AACV;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -80,27 +80,6 @@ declare const createGitlabGroupEnsureExistsAction: (options: {
80
80
  groupId?: number | undefined;
81
81
  }, "v2">;
82
82
 
83
- /**
84
- * Gitlab issue types as specified by gitlab api
85
- *
86
- * @public
87
- */
88
- declare enum IssueType {
89
- ISSUE = "issue",
90
- INCIDENT = "incident",
91
- TEST = "test_case",
92
- TASK = "task"
93
- }
94
- /**
95
- * Gitlab issue state events for modifications
96
- *
97
- * @public
98
- */
99
- declare enum IssueStateEvent {
100
- CLOSE = "close",
101
- REOPEN = "reopen"
102
- }
103
-
104
83
  /**
105
84
  * Creates a `gitlab:issues:create` Scaffolder action.
106
85
  *
@@ -122,7 +101,7 @@ declare const createGitlabIssueAction: (options: {
122
101
  discussionToResolve?: string | undefined;
123
102
  epicId?: number | undefined;
124
103
  labels?: string | undefined;
125
- issueType?: IssueType | undefined;
104
+ issueType?: "issue" | "task" | "incident" | "test_case" | undefined;
126
105
  mergeRequestToResolveDiscussionsOf?: number | undefined;
127
106
  milestoneId?: number | undefined;
128
107
  weight?: number | undefined;
@@ -152,11 +131,11 @@ declare const editGitlabIssueAction: (options: {
152
131
  discussionLocked?: boolean | undefined;
153
132
  dueDate?: string | undefined;
154
133
  epicId?: number | undefined;
155
- issueType?: IssueType | undefined;
134
+ issueType?: "issue" | "task" | "incident" | "test_case" | undefined;
156
135
  labels?: string | undefined;
157
136
  milestoneId?: number | undefined;
158
137
  removeLabels?: string | undefined;
159
- stateEvent?: IssueStateEvent | undefined;
138
+ stateEvent?: "close" | "reopen" | undefined;
160
139
  title?: string | undefined;
161
140
  updatedAt?: string | undefined;
162
141
  weight?: number | undefined;
@@ -303,6 +282,51 @@ declare const createGitlabRepoPushAction: (options: {
303
282
  commitHash: string;
304
283
  }, "v2">;
305
284
 
285
+ /**
286
+ * Gitlab issue types as specified by gitlab api
287
+ *
288
+ * @public
289
+ */
290
+ declare const IssueType: {
291
+ readonly ISSUE: "issue";
292
+ readonly INCIDENT: "incident";
293
+ readonly TEST: "test_case";
294
+ readonly TASK: "task";
295
+ };
296
+ /**
297
+ * @public
298
+ */
299
+ type IssueType = (typeof IssueType)[keyof typeof IssueType];
300
+ /**
301
+ * @public
302
+ */
303
+ declare namespace IssueType {
304
+ type ISSUE = typeof IssueType.ISSUE;
305
+ type INCIDENT = typeof IssueType.INCIDENT;
306
+ type TEST = typeof IssueType.TEST;
307
+ type TASK = typeof IssueType.TASK;
308
+ }
309
+ /**
310
+ * Gitlab issue state events for modifications
311
+ *
312
+ * @public
313
+ */
314
+ declare const IssueStateEvent: {
315
+ readonly CLOSE: "close";
316
+ readonly REOPEN: "reopen";
317
+ };
318
+ /**
319
+ * @public
320
+ */
321
+ type IssueStateEvent = (typeof IssueStateEvent)[keyof typeof IssueStateEvent];
322
+ /**
323
+ * @public
324
+ */
325
+ declare namespace IssueStateEvent {
326
+ type CLOSE = typeof IssueStateEvent.CLOSE;
327
+ type REOPEN = typeof IssueStateEvent.REOPEN;
328
+ }
329
+
306
330
  /**
307
331
  * @public
308
332
  * The GitLab Module for the Scaffolder Backend
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-gitlab",
3
- "version": "0.9.7-next.0",
3
+ "version": "0.10.0-next.1",
4
4
  "backstage": {
5
5
  "role": "backend-plugin-module",
6
6
  "pluginId": "scaffolder",
@@ -53,11 +53,11 @@
53
53
  "test": "backstage-cli package test"
54
54
  },
55
55
  "dependencies": {
56
- "@backstage/backend-plugin-api": "1.4.5-next.0",
56
+ "@backstage/backend-plugin-api": "1.5.0-next.1",
57
57
  "@backstage/config": "1.3.6-next.0",
58
58
  "@backstage/errors": "1.2.7",
59
59
  "@backstage/integration": "1.18.2-next.0",
60
- "@backstage/plugin-scaffolder-node": "0.12.1-next.0",
60
+ "@backstage/plugin-scaffolder-node": "0.12.1-next.1",
61
61
  "@gitbeaker/requester-utils": "^41.2.0",
62
62
  "@gitbeaker/rest": "^41.2.0",
63
63
  "luxon": "^3.0.0",
@@ -65,8 +65,8 @@
65
65
  "zod": "^3.22.4"
66
66
  },
67
67
  "devDependencies": {
68
- "@backstage/backend-test-utils": "1.10.0-next.0",
69
- "@backstage/cli": "0.34.5-next.0",
70
- "@backstage/plugin-scaffolder-node-test-utils": "0.3.5-next.0"
68
+ "@backstage/backend-test-utils": "1.10.0-next.1",
69
+ "@backstage/cli": "0.34.5-next.1",
70
+ "@backstage/plugin-scaffolder-node-test-utils": "0.3.5-next.1"
71
71
  }
72
72
  }