@backstage/plugin-scaffolder-backend-module-gitlab 0.8.2-next.0 → 0.8.2-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,17 @@
1
1
  # @backstage/plugin-scaffolder-backend-module-gitlab
2
2
 
3
+ ## 0.8.2-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 003dc15: Updated the path field in the `gitlab:group:ensureExists` action to support also strings with multiple segments (e.g. `group/subgroup`)
8
+ - Updated dependencies
9
+ - @backstage/integration@1.16.3-next.0
10
+ - @backstage/plugin-scaffolder-node@0.8.1-next.1
11
+ - @backstage/backend-plugin-api@1.2.1
12
+ - @backstage/config@1.3.2
13
+ - @backstage/errors@1.2.7
14
+
3
15
  ## 0.8.2-next.0
4
16
 
5
17
  ### Patch Changes
@@ -43,9 +43,7 @@ const createGitlabGroupEnsureExistsAction = (options) => {
43
43
  const api = util.getClient({ host, integrations, token });
44
44
  let currentPath = null;
45
45
  let parentId = null;
46
- for (const pathElement of path) {
47
- const slug = typeof pathElement === "string" ? pathElement : pathElement.slug;
48
- const name = typeof pathElement === "string" ? pathElement : pathElement.name;
46
+ for (const { name, slug } of pathIterator(path)) {
49
47
  const fullPath = currentPath ? `${currentPath}/${slug}` : slug;
50
48
  const result = await api.Groups.search(
51
49
  fullPath
@@ -79,6 +77,18 @@ const createGitlabGroupEnsureExistsAction = (options) => {
79
77
  }
80
78
  });
81
79
  };
80
+ function* pathIterator(items) {
81
+ for (const item of items) {
82
+ if (typeof item === "string") {
83
+ const parts = item.split("/");
84
+ for (const part of parts) {
85
+ yield { name: part, slug: part };
86
+ }
87
+ } else {
88
+ yield item;
89
+ }
90
+ }
91
+ }
82
92
 
83
93
  exports.createGitlabGroupEnsureExistsAction = createGitlabGroupEnsureExistsAction;
84
94
  //# sourceMappingURL=gitlabGroupEnsureExists.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabGroupEnsureExists.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.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 { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { GroupSchema } from '@gitbeaker/rest';\nimport { z } from 'zod';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getClient, parseRepoUrl } from '../util';\nimport { examples } from './gitlabGroupEnsureExists.examples';\n\n/**\n * Creates an `gitlab:group:ensureExists` Scaffolder action.\n *\n * @public\n */\nexport const createGitlabGroupEnsureExistsAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction({\n id: 'gitlab:group:ensureExists',\n description: 'Ensures a Gitlab group exists',\n supportsDryRun: true,\n examples,\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n path: z\n .array(\n z.string().or(\n z.object({\n name: z.string(),\n slug: z.string(),\n }),\n ),\n {\n description:\n 'A path of group names or objects (name and slug) that is ensured to exist',\n },\n )\n .min(1),\n }),\n ),\n output: z.object({\n groupId: z\n .number({ description: 'The id of the innermost sub-group' })\n .optional(),\n }),\n },\n async handler(ctx) {\n if (ctx.isDryRun) {\n ctx.output('groupId', 42);\n return;\n }\n\n const { token, repoUrl, path } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n\n const api = getClient({ host, integrations, token });\n\n let currentPath: string | null = null;\n let parentId: number | null = null;\n for (const pathElement of path) {\n const slug =\n typeof pathElement === 'string' ? pathElement : pathElement.slug;\n const name =\n typeof pathElement === 'string' ? pathElement : pathElement.name;\n const fullPath: string = currentPath ? `${currentPath}/${slug}` : slug;\n const result = (await api.Groups.search(\n fullPath,\n )) as unknown as Array<GroupSchema>; // recast since the return type for search is wrong in the gitbeaker typings\n const subGroup = result.find(\n searchPathElem => searchPathElem.full_path === fullPath,\n );\n if (!subGroup) {\n ctx.logger.info(`creating missing group ${fullPath}`);\n\n parentId = await ctx.checkpoint({\n key: `ensure.${name}.${slug}.${parentId}`,\n // eslint-disable-next-line no-loop-func\n fn: async () => {\n return (\n await api.Groups.create(\n name,\n slug,\n parentId\n ? {\n parentId: parentId,\n }\n : {},\n )\n )?.id;\n },\n });\n } else {\n parentId = subGroup.id;\n }\n currentPath = fullPath;\n }\n if (parentId !== null) {\n ctx.output('groupId', parentId);\n }\n },\n });\n};\n"],"names":["createTemplateAction","examples","commonGitlabConfig","z","parseRepoUrl","getClient"],"mappings":";;;;;;;;AA6Ba,MAAA,mCAAA,GAAsC,CAAC,OAE9C,KAAA;AACJ,EAAM,MAAA,EAAE,cAAiB,GAAA,OAAA;AAEzB,EAAA,OAAOA,yCAAqB,CAAA;AAAA,IAC1B,EAAI,EAAA,2BAAA;AAAA,IACJ,WAAa,EAAA,+BAAA;AAAA,IACb,cAAgB,EAAA,IAAA;AAAA,cAChBC,yCAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,OAAOC,0BAAmB,CAAA,KAAA;AAAA,QACxBC,MAAE,MAAO,CAAA;AAAA,UACP,MAAMA,KACH,CAAA,KAAA;AAAA,YACCA,KAAA,CAAE,QAAS,CAAA,EAAA;AAAA,cACTA,MAAE,MAAO,CAAA;AAAA,gBACP,IAAA,EAAMA,MAAE,MAAO,EAAA;AAAA,gBACf,IAAA,EAAMA,MAAE,MAAO;AAAA,eAChB;AAAA,aACH;AAAA,YACA;AAAA,cACE,WACE,EAAA;AAAA;AACJ,WACF,CACC,IAAI,CAAC;AAAA,SACT;AAAA,OACH;AAAA,MACA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pD,UAAW,QAAA,GAAA,MAAM,IAAI,UAAW,CAAA;AAAA,YAC9B,KAAK,CAAU,OAAA,EAAA,IAAI,CAAI,CAAA,EAAA,IAAI,IAAI,QAAQ,CAAA,CAAA;AAAA;AAAA,YAEvC,IAAI,YAAY;AACd,cACE,OAAA,CAAA,MAAM,IAAI,MAAO,CAAA,MAAA;AAAA,gBACf,IAAA;AAAA,gBACA,IAAA;AAAA,gBACA,QACI,GAAA;AAAA,kBACE;AAAA,oBAEF;AAAC,eAEN,GAAA,EAAA;AAAA;AACL,WACD,CAAA;AAAA,SACI,MAAA;AACL,UAAA,QAAA,GAAW,QAAS,CAAA,EAAA;AAAA;AAEtB,QAAc,WAAA,GAAA,QAAA;AAAA;AAEhB,MAAA,IAAI,aAAa,IAAM,EAAA;AACrB,QAAI,GAAA,CAAA,MAAA,CAAO,WAAW,QAAQ,CAAA;AAAA;AAChC;AACF,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"gitlabGroupEnsureExists.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.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 { ScmIntegrationRegistry } from '@backstage/integration';\nimport { createTemplateAction } from '@backstage/plugin-scaffolder-node';\nimport { GroupSchema } from '@gitbeaker/rest';\nimport { z } from 'zod';\nimport commonGitlabConfig from '../commonGitlabConfig';\nimport { getClient, parseRepoUrl } from '../util';\nimport { examples } from './gitlabGroupEnsureExists.examples';\n\n/**\n * Creates an `gitlab:group:ensureExists` Scaffolder action.\n *\n * @public\n */\nexport const createGitlabGroupEnsureExistsAction = (options: {\n integrations: ScmIntegrationRegistry;\n}) => {\n const { integrations } = options;\n\n return createTemplateAction({\n id: 'gitlab:group:ensureExists',\n description: 'Ensures a Gitlab group exists',\n supportsDryRun: true,\n examples,\n schema: {\n input: commonGitlabConfig.merge(\n z.object({\n path: z\n .array(\n z.string().or(\n z.object({\n name: z.string(),\n slug: z.string(),\n }),\n ),\n {\n description:\n 'A path of group names or objects (name and slug) that is ensured to exist',\n },\n )\n .min(1),\n }),\n ),\n output: z.object({\n groupId: z\n .number({ description: 'The id of the innermost sub-group' })\n .optional(),\n }),\n },\n async handler(ctx) {\n if (ctx.isDryRun) {\n ctx.output('groupId', 42);\n return;\n }\n\n const { token, repoUrl, path } = ctx.input;\n\n const { host } = parseRepoUrl(repoUrl, integrations);\n\n const api = getClient({ host, integrations, token });\n\n let currentPath: string | null = null;\n let parentId: number | null = null;\n for (const { name, slug } of pathIterator(path)) {\n const fullPath: string = currentPath ? `${currentPath}/${slug}` : slug;\n const result = (await api.Groups.search(\n fullPath,\n )) as unknown as Array<GroupSchema>; // recast since the return type for search is wrong in the gitbeaker typings\n const subGroup = result.find(\n searchPathElem => searchPathElem.full_path === fullPath,\n );\n if (!subGroup) {\n ctx.logger.info(`creating missing group ${fullPath}`);\n\n parentId = await ctx.checkpoint({\n key: `ensure.${name}.${slug}.${parentId}`,\n // eslint-disable-next-line no-loop-func\n fn: async () => {\n return (\n await api.Groups.create(\n name,\n slug,\n parentId\n ? {\n parentId: parentId,\n }\n : {},\n )\n )?.id;\n },\n });\n } else {\n parentId = subGroup.id;\n }\n currentPath = fullPath;\n }\n if (parentId !== null) {\n ctx.output('groupId', parentId);\n }\n },\n });\n};\n\ntype PathPart = { name: string; slug: string };\ntype PathItem = string | PathPart;\n\nfunction* pathIterator(items: PathItem[]): Generator<PathPart> {\n for (const item of items) {\n if (typeof item === 'string') {\n const parts = item.split('/');\n for (const part of parts) {\n yield { name: part, slug: part };\n }\n } else {\n yield item;\n }\n }\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AAO,EAAA;AACxB,IAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,MAAM,MAAA,KAAA,GAAQ,IAAK,CAAA,KAAA,CAAM,GAAG,CAAA;AAC5B,MAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,QAAA,MAAM,EAAE,IAAA,EAAM,IAAM,EAAA,IAAA,EAAM,IAAK,EAAA;AAAA;AACjC,KACK,MAAA;AACL,MAAM,MAAA,IAAA;AAAA;AACR;AAEJ;;;;"}
@@ -91,6 +91,26 @@ const examples = [
91
91
  }
92
92
  ]
93
93
  })
94
+ },
95
+ {
96
+ description: "Create a group nested within another group using path and objects",
97
+ example: yaml__default.default.stringify({
98
+ steps: [
99
+ {
100
+ id: "gitlabGroup",
101
+ name: "Group",
102
+ action: "gitlab:group:ensureExists",
103
+ input: {
104
+ repoUrl: "gitlab.com",
105
+ path: [
106
+ "group1/group2",
107
+ { name: "Group 3", slug: "group3" },
108
+ { name: "Group 4", slug: "group4" }
109
+ ]
110
+ }
111
+ }
112
+ ]
113
+ })
94
114
  }
95
115
  ];
96
116
 
@@ -1 +1 @@
1
- {"version":3,"file":"gitlabGroupEnsureExists.examples.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Creating a group at the top level',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within multiple other groups',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group in dry run mode',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n isDryRun: true,\n input: {\n repoUrl: 'https://gitlab.com/my-repo',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group using objects',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: [\n { name: 'Group 1', slug: 'group1' },\n { name: 'Group 2', slug: 'group2' },\n { name: 'Group 3', slug: 'group3' },\n ],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,mCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAA,EAAM,CAAC,QAAQ;AAAA;AACjB;AACF;AACF,KACD;AAAA,GACH;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aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAM,EAAA;AAAA,cACJ,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,cAClC,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,cAClC,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS;AAAA;AACpC;AACF;AACF;AACF,KACD;AAAA;AAEL;;;;"}
1
+ {"version":3,"file":"gitlabGroupEnsureExists.examples.cjs.js","sources":["../../src/actions/gitlabGroupEnsureExists.examples.ts"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { TemplateExample } from '@backstage/plugin-scaffolder-node';\nimport yaml from 'yaml';\n\nexport const examples: TemplateExample[] = [\n {\n description: 'Creating a group at the top level',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within multiple other groups',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group in dry run mode',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n isDryRun: true,\n input: {\n repoUrl: 'https://gitlab.com/my-repo',\n path: ['group1', 'group2', 'group3'],\n },\n },\n ],\n }),\n },\n {\n description: 'Create a group nested within another group using objects',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: [\n { name: 'Group 1', slug: 'group1' },\n { name: 'Group 2', slug: 'group2' },\n { name: 'Group 3', slug: 'group3' },\n ],\n },\n },\n ],\n }),\n },\n {\n description:\n 'Create a group nested within another group using path and objects',\n example: yaml.stringify({\n steps: [\n {\n id: 'gitlabGroup',\n name: 'Group',\n action: 'gitlab:group:ensureExists',\n input: {\n repoUrl: 'gitlab.com',\n path: [\n 'group1/group2',\n { name: 'Group 3', slug: 'group3' },\n { name: 'Group 4', slug: 'group4' },\n ],\n },\n },\n ],\n }),\n },\n];\n"],"names":["yaml"],"mappings":";;;;;;;;AAkBO,MAAM,QAA8B,GAAA;AAAA,EACzC;AAAA,IACE,WAAa,EAAA,mCAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAA,EAAM,CAAC,QAAQ;AAAA;AACjB;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WAAa,EAAA,4CAAA;AAAA,IACb,OAAA,EAASA,sBAAK,SAAU,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,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAM,EAAA;AAAA,cACJ,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,cAClC,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,cAClC,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS;AAAA;AACpC;AACF;AACF;AACF,KACD;AAAA,GACH;AAAA,EACA;AAAA,IACE,WACE,EAAA,mEAAA;AAAA,IACF,OAAA,EAASA,sBAAK,SAAU,CAAA;AAAA,MACtB,KAAO,EAAA;AAAA,QACL;AAAA,UACE,EAAI,EAAA,aAAA;AAAA,UACJ,IAAM,EAAA,OAAA;AAAA,UACN,MAAQ,EAAA,2BAAA;AAAA,UACR,KAAO,EAAA;AAAA,YACL,OAAS,EAAA,YAAA;AAAA,YACT,IAAM,EAAA;AAAA,cACJ,eAAA;AAAA,cACA,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,cAClC,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,QAAS;AAAA;AACpC;AACF;AACF;AACF,KACD;AAAA;AAEL;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend-module-gitlab",
3
- "version": "0.8.2-next.0",
3
+ "version": "0.8.2-next.1",
4
4
  "backstage": {
5
5
  "role": "backend-plugin-module",
6
6
  "pluginId": "scaffolder",
@@ -49,8 +49,8 @@
49
49
  "@backstage/backend-plugin-api": "1.2.1",
50
50
  "@backstage/config": "1.3.2",
51
51
  "@backstage/errors": "1.2.7",
52
- "@backstage/integration": "1.16.2",
53
- "@backstage/plugin-scaffolder-node": "0.8.1-next.0",
52
+ "@backstage/integration": "1.16.3-next.0",
53
+ "@backstage/plugin-scaffolder-node": "0.8.1-next.1",
54
54
  "@gitbeaker/rest": "^41.2.0",
55
55
  "luxon": "^3.0.0",
56
56
  "winston": "^3.2.1",
@@ -58,9 +58,9 @@
58
58
  "zod": "^3.22.4"
59
59
  },
60
60
  "devDependencies": {
61
- "@backstage/backend-test-utils": "1.3.2-next.0",
62
- "@backstage/cli": "0.32.0-next.0",
61
+ "@backstage/backend-test-utils": "1.3.2-next.1",
62
+ "@backstage/cli": "0.32.0-next.1",
63
63
  "@backstage/core-app-api": "1.16.0",
64
- "@backstage/plugin-scaffolder-node-test-utils": "0.2.1-next.0"
64
+ "@backstage/plugin-scaffolder-node-test-utils": "0.2.1-next.1"
65
65
  }
66
66
  }