@backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor 2.9.0 → 2.11.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +26 -0
  3. package/dist/ScaffolderRelationEntityProcessor.cjs.js +3 -3
  4. package/dist/ScaffolderRelationEntityProcessor.cjs.js.map +1 -1
  5. package/dist/constants.cjs.js +16 -0
  6. package/dist/constants.cjs.js.map +1 -1
  7. package/dist/index.cjs.js +8 -3
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.d.ts +56 -16
  10. package/dist/module.cjs.js +29 -4
  11. package/dist/module.cjs.js.map +1 -1
  12. package/dist/pullRequests/comparison/differ.cjs.js +52 -0
  13. package/dist/pullRequests/comparison/differ.cjs.js.map +1 -0
  14. package/dist/pullRequests/comparison/index.cjs.js +43 -0
  15. package/dist/pullRequests/comparison/index.cjs.js.map +1 -0
  16. package/dist/pullRequests/index.cjs.js +190 -0
  17. package/dist/pullRequests/index.cjs.js.map +1 -0
  18. package/dist/pullRequests/template/entity.cjs.js +48 -0
  19. package/dist/pullRequests/template/entity.cjs.js.map +1 -0
  20. package/dist/pullRequests/template/regex.cjs.js +10 -0
  21. package/dist/pullRequests/template/regex.cjs.js.map +1 -0
  22. package/dist/pullRequests/template/variables.cjs.js +84 -0
  23. package/dist/pullRequests/template/variables.cjs.js.map +1 -0
  24. package/dist/pullRequests/vcs/BaseVcsProvider.cjs.js +74 -0
  25. package/dist/pullRequests/vcs/BaseVcsProvider.cjs.js.map +1 -0
  26. package/dist/pullRequests/vcs/VcsProviderRegistry.cjs.js +48 -0
  27. package/dist/pullRequests/vcs/VcsProviderRegistry.cjs.js.map +1 -0
  28. package/dist/pullRequests/vcs/providers/github/GitHubProvider.cjs.js +175 -0
  29. package/dist/pullRequests/vcs/providers/github/GitHubProvider.cjs.js.map +1 -0
  30. package/dist/pullRequests/vcs/providers/gitlab/GitLabProvider.cjs.js +283 -0
  31. package/dist/pullRequests/vcs/providers/gitlab/GitLabProvider.cjs.js.map +1 -0
  32. package/dist/pullRequests/vcs/utils/fileOperations.cjs.js +29 -0
  33. package/dist/pullRequests/vcs/utils/fileOperations.cjs.js.map +1 -0
  34. package/dist/pullRequests/vcs/utils/prFormatting.cjs.js +46 -0
  35. package/dist/pullRequests/vcs/utils/prFormatting.cjs.js.map +1 -0
  36. package/dist/templateVersionUtils.cjs.js +84 -28
  37. package/dist/templateVersionUtils.cjs.js.map +1 -1
  38. package/package.json +17 -12
  39. package/dist/relations.cjs.js +0 -8
  40. package/dist/relations.cjs.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @backstage-community/plugin-catalog-backend-module-scaffolder-relation-processor
2
2
 
3
+ ## 2.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 76bfe5a: Adds ability to automatically create PRs/MRs to keep scaffolded repositories in sync with their source templates. Includes file comparison, multi-VCS support (GitHub/GitLab), and automatic reviewer assignment. By default, the feature is disabled and can be enabled in config.
8
+
9
+ ## 2.10.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 80d2a5b: Backstage version bump to v1.45.3
14
+
3
15
  ## 2.9.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -117,3 +117,29 @@ Both the title and description support the following template variables:
117
117
  ### Disabling Notifications
118
118
 
119
119
  To disable the notification feature, set `scaffolder.notifications.templateUpdate.enabled` to `false` in your configuration, or simply omit the entire `scaffolder.notifications.templateUpdate` section from your config (notifications are disabled by default).
120
+
121
+ ## Template Update Pull Requests
122
+
123
+ In addition to notifications, this plugin can automatically create pull requests (or merge requests for GitLab) to keep scaffolded repositories in sync with their source templates. When a template version changes, the plugin compares files and creates PRs with any necessary updates.
124
+
125
+ ### Quick Start
126
+
127
+ Enable the PR feature in your `app-config.yaml`:
128
+
129
+ ```yaml
130
+ scaffolder:
131
+ pullRequests:
132
+ templateUpdate:
133
+ enabled: true
134
+ ```
135
+
136
+ ### Key Features
137
+
138
+ - **Automatic file comparison**: Detects added, modified, and deleted files between template and scaffolded repositories
139
+ - **Multi-VCS support**: Works with both GitHub and GitLab
140
+ - **Automatic reviewer assignment**: Assigns the entity owner as a reviewer if they are a User
141
+ - **Integration with notifications**: Can send notifications with links to created PRs
142
+
143
+ > ⚠️ **Important**: Always manually review the generated pull requests before merging. The automatic comparison may include changes that are intentionally different in your scaffolded repository.
144
+
145
+ For detailed configuration options, prerequisites, and troubleshooting, see the [Template Update PRs documentation](./docs/templateUpdatePRs.md).
@@ -2,8 +2,8 @@
2
2
 
3
3
  var catalogModel = require('@backstage/catalog-model');
4
4
  var pluginCatalogNode = require('@backstage/plugin-catalog-node');
5
- var relations = require('./relations.cjs.js');
6
5
  var templateVersionUtils = require('./templateVersionUtils.cjs.js');
6
+ var constants = require('./constants.cjs.js');
7
7
 
8
8
  class ScaffolderRelationEntityProcessor {
9
9
  constructor(eventsService) {
@@ -65,8 +65,8 @@ class ScaffolderRelationEntityProcessor {
65
65
  doEmit(
66
66
  arbitraryEntity.spec?.scaffoldedFrom,
67
67
  { defaultKind: "Template", defaultNamespace: selfRef.namespace },
68
- relations.RELATION_SCAFFOLDED_FROM,
69
- relations.RELATION_SCAFFOLDER_OF
68
+ constants.RELATION_SCAFFOLDED_FROM,
69
+ constants.RELATION_SCAFFOLDER_OF
70
70
  );
71
71
  return entity;
72
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ScaffolderRelationEntityProcessor.cjs.js","sources":["../src/ScaffolderRelationEntityProcessor.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport type { LocationSpec } from '@backstage/plugin-catalog-common';\nimport {\n CatalogProcessor,\n CatalogProcessorCache,\n CatalogProcessorEmit,\n processingResult,\n} from '@backstage/plugin-catalog-node';\nimport type { EventsService } from '@backstage/plugin-events-node';\n\nimport { RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF } from './relations';\nimport type { ScaffoldedFromSpec } from './types';\nimport { handleTemplateVersion } from './templateVersionUtils';\n\n/** @public */\nexport class ScaffolderRelationEntityProcessor implements CatalogProcessor {\n constructor(private readonly eventsService?: EventsService) {}\n\n getProcessorName(): string {\n return 'ScaffolderRelationEntityProcessor';\n }\n\n async preProcessEntity(\n entity: Entity,\n _location: LocationSpec,\n _emit: CatalogProcessorEmit,\n _originLocation: LocationSpec,\n cache: CatalogProcessorCache,\n ): Promise<Entity> {\n if (entity.kind !== 'Template') {\n return entity;\n }\n\n const currentVersion =\n entity.metadata.annotations?.['backstage.io/template-version'];\n if (!currentVersion) {\n return entity;\n }\n\n const entityRef = stringifyEntityRef(entity);\n\n await handleTemplateVersion(\n entityRef,\n currentVersion,\n cache,\n this.eventsService,\n );\n\n return entity;\n }\n\n async postProcessEntity(\n entity: Entity,\n _location: LocationSpec,\n emit: CatalogProcessorEmit,\n ): Promise<Entity> {\n const selfRef = getCompoundEntityRef(entity);\n\n /**\n * Utilities\n */\n function doEmit(\n targets: string | string[] | undefined,\n context: { defaultKind?: string; defaultNamespace: string },\n outgoingRelation: string,\n incomingRelation: string,\n ): void {\n if (!targets) {\n return;\n }\n for (const target of [targets].flat()) {\n const targetRef = parseEntityRef(target, context);\n emit(\n processingResult.relation({\n source: selfRef,\n type: outgoingRelation,\n target: {\n kind: targetRef.kind,\n namespace: targetRef.namespace,\n name: targetRef.name,\n },\n }),\n );\n emit(\n processingResult.relation({\n source: {\n kind: targetRef.kind,\n namespace: targetRef.namespace,\n name: targetRef.name,\n },\n type: incomingRelation,\n target: selfRef,\n }),\n );\n }\n }\n\n /**\n * Emit relations for entities generated by templates (can be any entity type)\n */\n const arbitraryEntity = entity as Entity & Partial<ScaffoldedFromSpec>;\n doEmit(\n arbitraryEntity.spec?.scaffoldedFrom,\n { defaultKind: 'Template', defaultNamespace: selfRef.namespace },\n RELATION_SCAFFOLDED_FROM,\n RELATION_SCAFFOLDER_OF,\n );\n return entity;\n }\n}\n"],"names":["stringifyEntityRef","handleTemplateVersion","getCompoundEntityRef","parseEntityRef","processingResult","RELATION_SCAFFOLDED_FROM","RELATION_SCAFFOLDER_OF"],"mappings":";;;;;;;AAmCO,MAAM,iCAA8D,CAAA;AAAA,EACzE,YAA6B,aAA+B,EAAA;AAA/B,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA;AAAA;AAAgC,EAE7D,gBAA2B,GAAA;AACzB,IAAO,OAAA,mCAAA;AAAA;AACT,EAEA,MAAM,gBACJ,CAAA,MAAA,EACA,SACA,EAAA,KAAA,EACA,iBACA,KACiB,EAAA;AACjB,IAAI,IAAA,MAAA,CAAO,SAAS,UAAY,EAAA;AAC9B,MAAO,OAAA,MAAA;AAAA;AAGT,IAAA,MAAM,cACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,+BAA+B,CAAA;AAC/D,IAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,MAAO,OAAA,MAAA;AAAA;AAGT,IAAM,MAAA,SAAA,GAAYA,gCAAmB,MAAM,CAAA;AAE3C,IAAM,MAAAC,0CAAA;AAAA,MACJ,SAAA;AAAA,MACA,cAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAK,CAAA;AAAA,KACP;AAEA,IAAO,OAAA,MAAA;AAAA;AACT,EAEA,MAAM,iBAAA,CACJ,MACA,EAAA,SAAA,EACA,IACiB,EAAA;AACjB,IAAM,MAAA,OAAA,GAAUC,kCAAqB,MAAM,CAAA;AAK3C,IAAA,SAAS,MACP,CAAA,OAAA,EACA,OACA,EAAA,gBAAA,EACA,gBACM,EAAA;AACN,MAAA,IAAI,CAAC,OAAS,EAAA;AACZ,QAAA;AAAA;AAEF,MAAA,KAAA,MAAW,MAAU,IAAA,CAAC,OAAO,CAAA,CAAE,MAAQ,EAAA;AACrC,QAAM,MAAA,SAAA,GAAYC,2BAAe,CAAA,MAAA,EAAQ,OAAO,CAAA;AAChD,QAAA,IAAA;AAAA,UACEC,mCAAiB,QAAS,CAAA;AAAA,YACxB,MAAQ,EAAA,OAAA;AAAA,YACR,IAAM,EAAA,gBAAA;AAAA,YACN,MAAQ,EAAA;AAAA,cACN,MAAM,SAAU,CAAA,IAAA;AAAA,cAChB,WAAW,SAAU,CAAA,SAAA;AAAA,cACrB,MAAM,SAAU,CAAA;AAAA;AAClB,WACD;AAAA,SACH;AACA,QAAA,IAAA;AAAA,UACEA,mCAAiB,QAAS,CAAA;AAAA,YACxB,MAAQ,EAAA;AAAA,cACN,MAAM,SAAU,CAAA,IAAA;AAAA,cAChB,WAAW,SAAU,CAAA,SAAA;AAAA,cACrB,MAAM,SAAU,CAAA;AAAA,aAClB;AAAA,YACA,IAAM,EAAA,gBAAA;AAAA,YACN,MAAQ,EAAA;AAAA,WACT;AAAA,SACH;AAAA;AACF;AAMF,IAAA,MAAM,eAAkB,GAAA,MAAA;AACxB,IAAA,MAAA;AAAA,MACE,gBAAgB,IAAM,EAAA,cAAA;AAAA,MACtB,EAAE,WAAA,EAAa,UAAY,EAAA,gBAAA,EAAkB,QAAQ,SAAU,EAAA;AAAA,MAC/DC,kCAAA;AAAA,MACAC;AAAA,KACF;AACA,IAAO,OAAA,MAAA;AAAA;AAEX;;;;"}
1
+ {"version":3,"file":"ScaffolderRelationEntityProcessor.cjs.js","sources":["../src/ScaffolderRelationEntityProcessor.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n Entity,\n getCompoundEntityRef,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport type { LocationSpec } from '@backstage/plugin-catalog-common';\nimport {\n CatalogProcessor,\n CatalogProcessorCache,\n CatalogProcessorEmit,\n processingResult,\n} from '@backstage/plugin-catalog-node';\nimport type { EventsService } from '@backstage/plugin-events-node';\n\nimport type { ScaffoldedFromSpec } from './types';\nimport { handleTemplateVersion } from './templateVersionUtils';\nimport { RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF } from './constants';\n\n/** @public */\nexport class ScaffolderRelationEntityProcessor implements CatalogProcessor {\n constructor(private readonly eventsService?: EventsService) {}\n\n getProcessorName(): string {\n return 'ScaffolderRelationEntityProcessor';\n }\n\n async preProcessEntity(\n entity: Entity,\n _location: LocationSpec,\n _emit: CatalogProcessorEmit,\n _originLocation: LocationSpec,\n cache: CatalogProcessorCache,\n ): Promise<Entity> {\n if (entity.kind !== 'Template') {\n return entity;\n }\n\n const currentVersion =\n entity.metadata.annotations?.['backstage.io/template-version'];\n if (!currentVersion) {\n return entity;\n }\n\n const entityRef = stringifyEntityRef(entity);\n\n await handleTemplateVersion(\n entityRef,\n currentVersion,\n cache,\n this.eventsService,\n );\n\n return entity;\n }\n\n async postProcessEntity(\n entity: Entity,\n _location: LocationSpec,\n emit: CatalogProcessorEmit,\n ): Promise<Entity> {\n const selfRef = getCompoundEntityRef(entity);\n\n /**\n * Utilities\n */\n function doEmit(\n targets: string | string[] | undefined,\n context: { defaultKind?: string; defaultNamespace: string },\n outgoingRelation: string,\n incomingRelation: string,\n ): void {\n if (!targets) {\n return;\n }\n for (const target of [targets].flat()) {\n const targetRef = parseEntityRef(target, context);\n emit(\n processingResult.relation({\n source: selfRef,\n type: outgoingRelation,\n target: {\n kind: targetRef.kind,\n namespace: targetRef.namespace,\n name: targetRef.name,\n },\n }),\n );\n emit(\n processingResult.relation({\n source: {\n kind: targetRef.kind,\n namespace: targetRef.namespace,\n name: targetRef.name,\n },\n type: incomingRelation,\n target: selfRef,\n }),\n );\n }\n }\n\n /**\n * Emit relations for entities generated by templates (can be any entity type)\n */\n const arbitraryEntity = entity as Entity & Partial<ScaffoldedFromSpec>;\n doEmit(\n arbitraryEntity.spec?.scaffoldedFrom,\n { defaultKind: 'Template', defaultNamespace: selfRef.namespace },\n RELATION_SCAFFOLDED_FROM,\n RELATION_SCAFFOLDER_OF,\n );\n return entity;\n }\n}\n"],"names":["stringifyEntityRef","handleTemplateVersion","getCompoundEntityRef","parseEntityRef","processingResult","RELATION_SCAFFOLDED_FROM","RELATION_SCAFFOLDER_OF"],"mappings":";;;;;;;AAmCO,MAAM,iCAA8D,CAAA;AAAA,EACzE,YAA6B,aAA+B,EAAA;AAA/B,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA;AAAA;AAAgC,EAE7D,gBAA2B,GAAA;AACzB,IAAO,OAAA,mCAAA;AAAA;AACT,EAEA,MAAM,gBACJ,CAAA,MAAA,EACA,SACA,EAAA,KAAA,EACA,iBACA,KACiB,EAAA;AACjB,IAAI,IAAA,MAAA,CAAO,SAAS,UAAY,EAAA;AAC9B,MAAO,OAAA,MAAA;AAAA;AAGT,IAAA,MAAM,cACJ,GAAA,MAAA,CAAO,QAAS,CAAA,WAAA,GAAc,+BAA+B,CAAA;AAC/D,IAAA,IAAI,CAAC,cAAgB,EAAA;AACnB,MAAO,OAAA,MAAA;AAAA;AAGT,IAAM,MAAA,SAAA,GAAYA,gCAAmB,MAAM,CAAA;AAE3C,IAAM,MAAAC,0CAAA;AAAA,MACJ,SAAA;AAAA,MACA,cAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAK,CAAA;AAAA,KACP;AAEA,IAAO,OAAA,MAAA;AAAA;AACT,EAEA,MAAM,iBAAA,CACJ,MACA,EAAA,SAAA,EACA,IACiB,EAAA;AACjB,IAAM,MAAA,OAAA,GAAUC,kCAAqB,MAAM,CAAA;AAK3C,IAAA,SAAS,MACP,CAAA,OAAA,EACA,OACA,EAAA,gBAAA,EACA,gBACM,EAAA;AACN,MAAA,IAAI,CAAC,OAAS,EAAA;AACZ,QAAA;AAAA;AAEF,MAAA,KAAA,MAAW,MAAU,IAAA,CAAC,OAAO,CAAA,CAAE,MAAQ,EAAA;AACrC,QAAM,MAAA,SAAA,GAAYC,2BAAe,CAAA,MAAA,EAAQ,OAAO,CAAA;AAChD,QAAA,IAAA;AAAA,UACEC,mCAAiB,QAAS,CAAA;AAAA,YACxB,MAAQ,EAAA,OAAA;AAAA,YACR,IAAM,EAAA,gBAAA;AAAA,YACN,MAAQ,EAAA;AAAA,cACN,MAAM,SAAU,CAAA,IAAA;AAAA,cAChB,WAAW,SAAU,CAAA,SAAA;AAAA,cACrB,MAAM,SAAU,CAAA;AAAA;AAClB,WACD;AAAA,SACH;AACA,QAAA,IAAA;AAAA,UACEA,mCAAiB,QAAS,CAAA;AAAA,YACxB,MAAQ,EAAA;AAAA,cACN,MAAM,SAAU,CAAA,IAAA;AAAA,cAChB,WAAW,SAAU,CAAA,SAAA;AAAA,cACrB,MAAM,SAAU,CAAA;AAAA,aAClB;AAAA,YACA,IAAM,EAAA,gBAAA;AAAA,YACN,MAAQ,EAAA;AAAA,WACT;AAAA,SACH;AAAA;AACF;AAMF,IAAA,MAAM,eAAkB,GAAA,MAAA;AACxB,IAAA,MAAA;AAAA,MACE,gBAAgB,IAAM,EAAA,cAAA;AAAA,MACtB,EAAE,WAAA,EAAa,UAAY,EAAA,gBAAA,EAAkB,QAAQ,SAAU,EAAA;AAAA,MAC/DC,kCAAA;AAAA,MACAC;AAAA,KACF;AACA,IAAO,OAAA,MAAA;AAAA;AAEX;;;;"}
@@ -5,10 +5,26 @@ const ENTITY_DISPLAY_NAME_TEMPLATE_VAR = "$ENTITY_DISPLAY_NAME";
5
5
  const DEFAULT_NOTIFICATION_TITLE = `${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} is out of sync with template`;
6
6
  const DEFAULT_NOTIFICATION_DESCRIPTION = `The template used to create ${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} has been updated to a new version. Review and update your entity to stay in sync with the template.`;
7
7
  const DEFAULT_NOTIFICATION_ENABLED = false;
8
+ const DEFAULT_PR_ENABLED = false;
9
+ const PR_LINK_TEMPLATE_VAR = "$PR_LINK";
10
+ const DEFAULT_NOTIFICATION_TITLE_WITH_PR = `${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} has a template update PR ready`;
11
+ const DEFAULT_NOTIFICATION_DESCRIPTION_WITH_PR = `The template used to create ${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} has been updated to a new version. A pull request has been created to sync the changes: ${PR_LINK_TEMPLATE_VAR}`;
12
+ const PR_CREATION_FAILED_PREFIX = "Failed to create template update PR";
13
+ const TEMPLATE_UPDATE_PRS_DOCS_URL = "https://github.com/backstage/community-plugins/tree/main/workspaces/scaffolder-relation-processor/plugins/catalog-backend-module-scaffolder-relation-processor/docs/templateUpdatePRs.md";
14
+ const RELATION_SCAFFOLDER_OF = "scaffolderOf";
15
+ const RELATION_SCAFFOLDED_FROM = "scaffoldedFrom";
8
16
 
9
17
  exports.DEFAULT_NOTIFICATION_DESCRIPTION = DEFAULT_NOTIFICATION_DESCRIPTION;
18
+ exports.DEFAULT_NOTIFICATION_DESCRIPTION_WITH_PR = DEFAULT_NOTIFICATION_DESCRIPTION_WITH_PR;
10
19
  exports.DEFAULT_NOTIFICATION_ENABLED = DEFAULT_NOTIFICATION_ENABLED;
11
20
  exports.DEFAULT_NOTIFICATION_TITLE = DEFAULT_NOTIFICATION_TITLE;
21
+ exports.DEFAULT_NOTIFICATION_TITLE_WITH_PR = DEFAULT_NOTIFICATION_TITLE_WITH_PR;
22
+ exports.DEFAULT_PR_ENABLED = DEFAULT_PR_ENABLED;
12
23
  exports.ENTITY_DISPLAY_NAME_TEMPLATE_VAR = ENTITY_DISPLAY_NAME_TEMPLATE_VAR;
24
+ exports.PR_CREATION_FAILED_PREFIX = PR_CREATION_FAILED_PREFIX;
25
+ exports.PR_LINK_TEMPLATE_VAR = PR_LINK_TEMPLATE_VAR;
26
+ exports.RELATION_SCAFFOLDED_FROM = RELATION_SCAFFOLDED_FROM;
27
+ exports.RELATION_SCAFFOLDER_OF = RELATION_SCAFFOLDER_OF;
28
+ exports.TEMPLATE_UPDATE_PRS_DOCS_URL = TEMPLATE_UPDATE_PRS_DOCS_URL;
13
29
  exports.TEMPLATE_VERSION_UPDATED_TOPIC = TEMPLATE_VERSION_UPDATED_TOPIC;
14
30
  //# sourceMappingURL=constants.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs.js","sources":["../src/constants.ts"],"sourcesContent":["/*\n * Copyright 2024 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\n/**\n * Topic for template version update events\n *\n * @public\n */\nexport const TEMPLATE_VERSION_UPDATED_TOPIC =\n 'relationProcessor.template:version_updated';\n\n/**\n * Template variable name for entity name in notification messages\n *\n * @public\n */\nexport const ENTITY_DISPLAY_NAME_TEMPLATE_VAR = '$ENTITY_DISPLAY_NAME';\n\n/**\n * Default template update notification title\n *\n * @public\n */\nexport const DEFAULT_NOTIFICATION_TITLE = `${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} is out of sync with template`;\n\n/**\n * Default template update notification description\n *\n * @public\n */\nexport const DEFAULT_NOTIFICATION_DESCRIPTION = `The template used to create ${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} has been updated to a new version. Review and update your entity to stay in sync with the template.`;\n\n/**\n * Default notification enabled\n *\n * @public\n */\nexport const DEFAULT_NOTIFICATION_ENABLED = false;\n"],"names":[],"mappings":";;AAqBO,MAAM,8BACX,GAAA;AAOK,MAAM,gCAAmC,GAAA;AAOnC,MAAA,0BAAA,GAA6B,GAAG,gCAAgC,CAAA,6BAAA;AAOhE,MAAA,gCAAA,GAAmC,+BAA+B,gCAAgC,CAAA,oGAAA;AAOxG,MAAM,4BAA+B,GAAA;;;;;;;;"}
1
+ {"version":3,"file":"constants.cjs.js","sources":["../src/constants.ts"],"sourcesContent":["/*\n * Copyright 2024 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\n/**\n * Topic for template version update events\n *\n * @public\n */\nexport const TEMPLATE_VERSION_UPDATED_TOPIC =\n 'relationProcessor.template:version_updated';\n\n/**\n * Template variable name for entity name in notification messages\n *\n * @public\n */\nexport const ENTITY_DISPLAY_NAME_TEMPLATE_VAR = '$ENTITY_DISPLAY_NAME';\n\n/**\n * Default template update notification title\n *\n * @public\n */\nexport const DEFAULT_NOTIFICATION_TITLE = `${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} is out of sync with template`;\n\n/**\n * Default template update notification description\n *\n * @public\n */\nexport const DEFAULT_NOTIFICATION_DESCRIPTION = `The template used to create ${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} has been updated to a new version. Review and update your entity to stay in sync with the template.`;\n\n/**\n * Default notification enabled\n *\n * @public\n */\nexport const DEFAULT_NOTIFICATION_ENABLED = false;\n\n/**\n * Default pull request creation enabled\n *\n * @public\n */\nexport const DEFAULT_PR_ENABLED = false;\n\n/**\n * Template variable name for PR link in notification messages\n *\n * @public\n */\nexport const PR_LINK_TEMPLATE_VAR = '$PR_LINK';\n\n/**\n * Default template update notification title when PR is created\n *\n * @public\n */\nexport const DEFAULT_NOTIFICATION_TITLE_WITH_PR = `${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} has a template update PR ready`;\n\n/**\n * Default template update notification description when PR is created\n *\n * @public\n */\nexport const DEFAULT_NOTIFICATION_DESCRIPTION_WITH_PR = `The template used to create ${ENTITY_DISPLAY_NAME_TEMPLATE_VAR} has been updated to a new version. A pull request has been created to sync the changes: ${PR_LINK_TEMPLATE_VAR}`;\n\n/**\n * Prefix for notification description when PR creation fails\n *\n * @public\n */\nexport const PR_CREATION_FAILED_PREFIX = 'Failed to create template update PR';\n\n/**\n * Documentation URL for the Template Update PRs feature\n *\n * @public\n */\nexport const TEMPLATE_UPDATE_PRS_DOCS_URL =\n 'https://github.com/backstage/community-plugins/tree/main/workspaces/scaffolder-relation-processor/plugins/catalog-backend-module-scaffolder-relation-processor/docs/templateUpdatePRs.md';\n\n/**\n * A relation from a scaffolder template entity to the entity it generated.\n * Reverse direction of {@link RELATION_SCAFFOLDED_FROM}\n *\n * @public\n */\nexport const RELATION_SCAFFOLDER_OF = 'scaffolderOf';\n\n/**\n * A relation of an entity generated from a scaffolder template entity\n * Reverse direction of {@link RELATION_SCAFFOLDER_OF}\n *\n * @public\n */\nexport const RELATION_SCAFFOLDED_FROM = 'scaffoldedFrom';\n"],"names":[],"mappings":";;AAqBO,MAAM,8BACX,GAAA;AAOK,MAAM,gCAAmC,GAAA;AAOnC,MAAA,0BAAA,GAA6B,GAAG,gCAAgC,CAAA,6BAAA;AAOhE,MAAA,gCAAA,GAAmC,+BAA+B,gCAAgC,CAAA,oGAAA;AAOxG,MAAM,4BAA+B,GAAA;AAOrC,MAAM,kBAAqB,GAAA;AAO3B,MAAM,oBAAuB,GAAA;AAOvB,MAAA,kCAAA,GAAqC,GAAG,gCAAgC,CAAA,+BAAA;AAO9E,MAAM,wCAA2C,GAAA,CAAA,4BAAA,EAA+B,gCAAgC,CAAA,yFAAA,EAA4F,oBAAoB,CAAA;AAOhO,MAAM,yBAA4B,GAAA;AAOlC,MAAM,4BACX,GAAA;AAQK,MAAM,sBAAyB,GAAA;AAQ/B,MAAM,wBAA2B,GAAA;;;;;;;;;;;;;;;;"}
package/dist/index.cjs.js CHANGED
@@ -2,19 +2,24 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var relations = require('./relations.cjs.js');
6
5
  var constants = require('./constants.cjs.js');
7
6
  var module$1 = require('./module.cjs.js');
8
7
  var ScaffolderRelationEntityProcessor = require('./ScaffolderRelationEntityProcessor.cjs.js');
9
8
 
10
9
 
11
10
 
12
- exports.RELATION_SCAFFOLDED_FROM = relations.RELATION_SCAFFOLDED_FROM;
13
- exports.RELATION_SCAFFOLDER_OF = relations.RELATION_SCAFFOLDER_OF;
14
11
  exports.DEFAULT_NOTIFICATION_DESCRIPTION = constants.DEFAULT_NOTIFICATION_DESCRIPTION;
12
+ exports.DEFAULT_NOTIFICATION_DESCRIPTION_WITH_PR = constants.DEFAULT_NOTIFICATION_DESCRIPTION_WITH_PR;
15
13
  exports.DEFAULT_NOTIFICATION_ENABLED = constants.DEFAULT_NOTIFICATION_ENABLED;
16
14
  exports.DEFAULT_NOTIFICATION_TITLE = constants.DEFAULT_NOTIFICATION_TITLE;
15
+ exports.DEFAULT_NOTIFICATION_TITLE_WITH_PR = constants.DEFAULT_NOTIFICATION_TITLE_WITH_PR;
16
+ exports.DEFAULT_PR_ENABLED = constants.DEFAULT_PR_ENABLED;
17
17
  exports.ENTITY_DISPLAY_NAME_TEMPLATE_VAR = constants.ENTITY_DISPLAY_NAME_TEMPLATE_VAR;
18
+ exports.PR_CREATION_FAILED_PREFIX = constants.PR_CREATION_FAILED_PREFIX;
19
+ exports.PR_LINK_TEMPLATE_VAR = constants.PR_LINK_TEMPLATE_VAR;
20
+ exports.RELATION_SCAFFOLDED_FROM = constants.RELATION_SCAFFOLDED_FROM;
21
+ exports.RELATION_SCAFFOLDER_OF = constants.RELATION_SCAFFOLDER_OF;
22
+ exports.TEMPLATE_UPDATE_PRS_DOCS_URL = constants.TEMPLATE_UPDATE_PRS_DOCS_URL;
18
23
  exports.TEMPLATE_VERSION_UPDATED_TOPIC = constants.TEMPLATE_VERSION_UPDATED_TOPIC;
19
24
  exports.default = module$1.catalogModuleScaffolderRelationProcessor;
20
25
  exports.ScaffolderRelationEntityProcessor = ScaffolderRelationEntityProcessor.ScaffolderRelationEntityProcessor;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -4,21 +4,6 @@ import { LocationSpec } from '@backstage/plugin-catalog-common';
4
4
  import { CatalogProcessor, CatalogProcessorEmit, CatalogProcessorCache } from '@backstage/plugin-catalog-node';
5
5
  import { EventsService } from '@backstage/plugin-events-node';
6
6
 
7
- /**
8
- * A relation from a scaffolder template entity to the entity it generated.
9
- * Reverse direction of {@link RELATION_SCAFFOLDED_FROM}
10
- *
11
- * @public
12
- */
13
- declare const RELATION_SCAFFOLDER_OF = "scaffolderOf";
14
- /**
15
- * A relation of an entity generated from a scaffolder template entity
16
- * Reverse direction of {@link RELATION_SCAFFOLDER_OF}
17
- *
18
- * @public
19
- */
20
- declare const RELATION_SCAFFOLDED_FROM = "scaffoldedFrom";
21
-
22
7
  /**
23
8
  * Extension of the `spec` field of the entity model
24
9
  * Used to form relations between entities and the scaffolder templates that generated them
@@ -45,6 +30,11 @@ interface ScaffolderRelationProcessorConfig {
45
30
  };
46
31
  };
47
32
  };
33
+ pullRequests?: {
34
+ templateUpdate?: {
35
+ enabled: boolean;
36
+ };
37
+ };
48
38
  }
49
39
 
50
40
  /**
@@ -77,6 +67,56 @@ declare const DEFAULT_NOTIFICATION_DESCRIPTION = "The template used to create $E
77
67
  * @public
78
68
  */
79
69
  declare const DEFAULT_NOTIFICATION_ENABLED = false;
70
+ /**
71
+ * Default pull request creation enabled
72
+ *
73
+ * @public
74
+ */
75
+ declare const DEFAULT_PR_ENABLED = false;
76
+ /**
77
+ * Template variable name for PR link in notification messages
78
+ *
79
+ * @public
80
+ */
81
+ declare const PR_LINK_TEMPLATE_VAR = "$PR_LINK";
82
+ /**
83
+ * Default template update notification title when PR is created
84
+ *
85
+ * @public
86
+ */
87
+ declare const DEFAULT_NOTIFICATION_TITLE_WITH_PR = "$ENTITY_DISPLAY_NAME has a template update PR ready";
88
+ /**
89
+ * Default template update notification description when PR is created
90
+ *
91
+ * @public
92
+ */
93
+ declare const DEFAULT_NOTIFICATION_DESCRIPTION_WITH_PR = "The template used to create $ENTITY_DISPLAY_NAME has been updated to a new version. A pull request has been created to sync the changes: $PR_LINK";
94
+ /**
95
+ * Prefix for notification description when PR creation fails
96
+ *
97
+ * @public
98
+ */
99
+ declare const PR_CREATION_FAILED_PREFIX = "Failed to create template update PR";
100
+ /**
101
+ * Documentation URL for the Template Update PRs feature
102
+ *
103
+ * @public
104
+ */
105
+ declare const TEMPLATE_UPDATE_PRS_DOCS_URL = "https://github.com/backstage/community-plugins/tree/main/workspaces/scaffolder-relation-processor/plugins/catalog-backend-module-scaffolder-relation-processor/docs/templateUpdatePRs.md";
106
+ /**
107
+ * A relation from a scaffolder template entity to the entity it generated.
108
+ * Reverse direction of {@link RELATION_SCAFFOLDED_FROM}
109
+ *
110
+ * @public
111
+ */
112
+ declare const RELATION_SCAFFOLDER_OF = "scaffolderOf";
113
+ /**
114
+ * A relation of an entity generated from a scaffolder template entity
115
+ * Reverse direction of {@link RELATION_SCAFFOLDER_OF}
116
+ *
117
+ * @public
118
+ */
119
+ declare const RELATION_SCAFFOLDED_FROM = "scaffoldedFrom";
80
120
 
81
121
  /**
82
122
  * Catalog processor that adds link relation between scaffolder templates and their generated entities
@@ -94,4 +134,4 @@ declare class ScaffolderRelationEntityProcessor implements CatalogProcessor {
94
134
  postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
95
135
  }
96
136
 
97
- export { DEFAULT_NOTIFICATION_DESCRIPTION, DEFAULT_NOTIFICATION_ENABLED, DEFAULT_NOTIFICATION_TITLE, ENTITY_DISPLAY_NAME_TEMPLATE_VAR, RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF, type ScaffoldedFromSpec, ScaffolderRelationEntityProcessor, type ScaffolderRelationProcessorConfig, TEMPLATE_VERSION_UPDATED_TOPIC, catalogModuleScaffolderRelationProcessor as default };
137
+ export { DEFAULT_NOTIFICATION_DESCRIPTION, DEFAULT_NOTIFICATION_DESCRIPTION_WITH_PR, DEFAULT_NOTIFICATION_ENABLED, DEFAULT_NOTIFICATION_TITLE, DEFAULT_NOTIFICATION_TITLE_WITH_PR, DEFAULT_PR_ENABLED, ENTITY_DISPLAY_NAME_TEMPLATE_VAR, PR_CREATION_FAILED_PREFIX, PR_LINK_TEMPLATE_VAR, RELATION_SCAFFOLDED_FROM, RELATION_SCAFFOLDER_OF, type ScaffoldedFromSpec, ScaffolderRelationEntityProcessor, type ScaffolderRelationProcessorConfig, TEMPLATE_UPDATE_PRS_DOCS_URL, TEMPLATE_VERSION_UPDATED_TOPIC, catalogModuleScaffolderRelationProcessor as default };
@@ -8,6 +8,9 @@ var catalogClient = require('@backstage/catalog-client');
8
8
  var ScaffolderRelationEntityProcessor = require('./ScaffolderRelationEntityProcessor.cjs.js');
9
9
  var templateVersionUtils = require('./templateVersionUtils.cjs.js');
10
10
  var constants = require('./constants.cjs.js');
11
+ var VcsProviderRegistry = require('./pullRequests/vcs/VcsProviderRegistry.cjs.js');
12
+ var GitHubProvider = require('./pullRequests/vcs/providers/github/GitHubProvider.cjs.js');
13
+ var GitLabProvider = require('./pullRequests/vcs/providers/gitlab/GitLabProvider.cjs.js');
11
14
 
12
15
  const catalogModuleScaffolderRelationProcessor = backendPluginApi.createBackendModule({
13
16
  pluginId: "catalog",
@@ -21,7 +24,8 @@ const catalogModuleScaffolderRelationProcessor = backendPluginApi.createBackendM
21
24
  events: pluginEventsNode.eventsServiceRef,
22
25
  notifications: pluginNotificationsNode.notificationService,
23
26
  auth: backendPluginApi.coreServices.auth,
24
- discovery: backendPluginApi.coreServices.discovery
27
+ discovery: backendPluginApi.coreServices.discovery,
28
+ urlReader: backendPluginApi.coreServices.urlReader
25
29
  },
26
30
  async init({
27
31
  catalog,
@@ -30,14 +34,31 @@ const catalogModuleScaffolderRelationProcessor = backendPluginApi.createBackendM
30
34
  events,
31
35
  notifications,
32
36
  auth,
33
- discovery
37
+ discovery,
38
+ urlReader
34
39
  }) {
35
40
  logger.debug(
36
41
  "Registering the scaffolder-relation-processor catalog module"
37
42
  );
38
43
  const processorConfig = templateVersionUtils.readScaffolderRelationProcessorConfig(config);
39
44
  const catalogClient$1 = new catalogClient.CatalogClient({ discoveryApi: discovery });
40
- if (processorConfig.notifications?.templateUpdate?.enabled) {
45
+ const vcsRegistry = new VcsProviderRegistry.VcsProviderRegistry();
46
+ const githubProvider = new GitHubProvider.GitHubProvider(
47
+ logger,
48
+ config,
49
+ catalogClient$1
50
+ );
51
+ vcsRegistry.registerProvider(githubProvider);
52
+ const gitlabProvider = new GitLabProvider.GitLabProvider(
53
+ logger,
54
+ config,
55
+ catalogClient$1
56
+ );
57
+ vcsRegistry.registerProvider(gitlabProvider);
58
+ logger.debug("Registered VCS providers: github, gitlab");
59
+ const notificationsEnabled = processorConfig.notifications?.templateUpdate?.enabled;
60
+ const pullRequestsEnabled = processorConfig.pullRequests?.templateUpdate?.enabled;
61
+ if (notificationsEnabled || pullRequestsEnabled) {
41
62
  await events.subscribe({
42
63
  id: "scaffolder-relation-processor",
43
64
  topics: [constants.TEMPLATE_VERSION_UPDATED_TOPIC],
@@ -51,7 +72,11 @@ const catalogModuleScaffolderRelationProcessor = backendPluginApi.createBackendM
51
72
  notifications,
52
73
  auth,
53
74
  processorConfig,
54
- payload
75
+ payload,
76
+ logger,
77
+ urlReader,
78
+ vcsRegistry,
79
+ config
55
80
  );
56
81
  }
57
82
  });
@@ -1 +1 @@
1
- {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\nimport { notificationService } from '@backstage/plugin-notifications-node';\nimport { CatalogClient } from '@backstage/catalog-client';\n\nimport { ScaffolderRelationEntityProcessor } from './ScaffolderRelationEntityProcessor';\nimport { handleTemplateUpdateNotifications } from './templateVersionUtils';\nimport { readScaffolderRelationProcessorConfig } from './templateVersionUtils';\nimport { TEMPLATE_VERSION_UPDATED_TOPIC } from './constants';\n\n/**\n * Catalog processor that adds link relation between scaffolder templates and their generated entities\n *\n * @public\n */\nexport const catalogModuleScaffolderRelationProcessor = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'scaffolder-relation-processor',\n register(env) {\n env.registerInit({\n deps: {\n catalog: catalogProcessingExtensionPoint,\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n events: eventsServiceRef,\n notifications: notificationService,\n auth: coreServices.auth,\n discovery: coreServices.discovery,\n },\n async init({\n catalog,\n logger,\n config,\n events,\n notifications,\n auth,\n discovery,\n }) {\n logger.debug(\n 'Registering the scaffolder-relation-processor catalog module',\n );\n\n const processorConfig = readScaffolderRelationProcessorConfig(config);\n\n const catalogClient = new CatalogClient({ discoveryApi: discovery });\n\n // Only subscribe to events if notifications are enabled\n if (processorConfig.notifications?.templateUpdate?.enabled) {\n await events.subscribe({\n id: 'scaffolder-relation-processor',\n topics: [TEMPLATE_VERSION_UPDATED_TOPIC],\n async onEvent(params) {\n const payload = params.eventPayload as {\n entityRef: string;\n previousVersion: string;\n currentVersion: string;\n };\n\n logger.info(\n `Received template update event for ${payload.entityRef}: ` +\n `${payload.previousVersion} -> ${payload.currentVersion}`,\n );\n\n handleTemplateUpdateNotifications(\n catalogClient,\n notifications,\n auth,\n processorConfig,\n payload,\n );\n },\n });\n }\n\n catalog.addProcessor(new ScaffolderRelationEntityProcessor(events));\n },\n });\n },\n});\n"],"names":["createBackendModule","catalogProcessingExtensionPoint","coreServices","eventsServiceRef","notificationService","readScaffolderRelationProcessorConfig","catalogClient","CatalogClient","TEMPLATE_VERSION_UPDATED_TOPIC","handleTemplateUpdateNotifications","ScaffolderRelationEntityProcessor"],"mappings":";;;;;;;;;;;AAkCO,MAAM,2CAA2CA,oCAAoB,CAAA;AAAA,EAC1E,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,+BAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,OAAS,EAAAC,qCAAA;AAAA,QACT,QAAQC,6BAAa,CAAA,MAAA;AAAA,QACrB,QAAQA,6BAAa,CAAA,UAAA;AAAA,QACrB,MAAQ,EAAAC,iCAAA;AAAA,QACR,aAAe,EAAAC,2CAAA;AAAA,QACf,MAAMF,6BAAa,CAAA,IAAA;AAAA,QACnB,WAAWA,6BAAa,CAAA;AAAA,OAC1B;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,OAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,aAAA;AAAA,QACA,IAAA;AAAA,QACA;AAAA,OACC,EAAA;AACD,QAAO,MAAA,CAAA,KAAA;AAAA,UACL;AAAA,SACF;AAEA,QAAM,MAAA,eAAA,GAAkBG,2DAAsC,MAAM,CAAA;AAEpE,QAAA,MAAMC,kBAAgB,IAAIC,2BAAA,CAAc,EAAE,YAAA,EAAc,WAAW,CAAA;AAGnE,QAAI,IAAA,eAAA,CAAgB,aAAe,EAAA,cAAA,EAAgB,OAAS,EAAA;AAC1D,UAAA,MAAM,OAAO,SAAU,CAAA;AAAA,YACrB,EAAI,EAAA,+BAAA;AAAA,YACJ,MAAA,EAAQ,CAACC,wCAA8B,CAAA;AAAA,YACvC,MAAM,QAAQ,MAAQ,EAAA;AACpB,cAAA,MAAM,UAAU,MAAO,CAAA,YAAA;AAMvB,cAAO,MAAA,CAAA,IAAA;AAAA,gBACL,CAAA,mCAAA,EAAsC,QAAQ,SAAS,CAAA,EAAA,EAClD,QAAQ,eAAe,CAAA,IAAA,EAAO,QAAQ,cAAc,CAAA;AAAA,eAC3D;AAEA,cAAAC,sDAAA;AAAA,gBACEH,eAAA;AAAA,gBACA,aAAA;AAAA,gBACA,IAAA;AAAA,gBACA,eAAA;AAAA,gBACA;AAAA,eACF;AAAA;AACF,WACD,CAAA;AAAA;AAGH,QAAA,OAAA,CAAQ,YAAa,CAAA,IAAII,mEAAkC,CAAA,MAAM,CAAC,CAAA;AAAA;AACpE,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
1
+ {"version":3,"file":"module.cjs.js","sources":["../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\nimport { eventsServiceRef } from '@backstage/plugin-events-node';\nimport { notificationService } from '@backstage/plugin-notifications-node';\nimport { CatalogClient } from '@backstage/catalog-client';\n\nimport { ScaffolderRelationEntityProcessor } from './ScaffolderRelationEntityProcessor';\nimport { handleTemplateUpdateNotifications } from './templateVersionUtils';\nimport { readScaffolderRelationProcessorConfig } from './templateVersionUtils';\nimport { TEMPLATE_VERSION_UPDATED_TOPIC } from './constants';\nimport { VcsProviderRegistry } from './pullRequests/vcs/VcsProviderRegistry';\nimport { GitHubProvider } from './pullRequests/vcs/providers/github/GitHubProvider';\nimport { GitLabProvider } from './pullRequests/vcs/providers/gitlab/GitLabProvider';\n\n/**\n * Catalog processor that adds link relation between scaffolder templates and their generated entities\n *\n * @public\n */\nexport const catalogModuleScaffolderRelationProcessor = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'scaffolder-relation-processor',\n register(env) {\n env.registerInit({\n deps: {\n catalog: catalogProcessingExtensionPoint,\n logger: coreServices.logger,\n config: coreServices.rootConfig,\n events: eventsServiceRef,\n notifications: notificationService,\n auth: coreServices.auth,\n discovery: coreServices.discovery,\n urlReader: coreServices.urlReader,\n },\n async init({\n catalog,\n logger,\n config,\n events,\n notifications,\n auth,\n discovery,\n urlReader,\n }) {\n logger.debug(\n 'Registering the scaffolder-relation-processor catalog module',\n );\n\n const processorConfig = readScaffolderRelationProcessorConfig(config);\n\n const catalogClient = new CatalogClient({ discoveryApi: discovery });\n\n // Initialize VCS provider registry\n const vcsRegistry = new VcsProviderRegistry();\n\n // Register GitHub provider\n const githubProvider = new GitHubProvider(\n logger,\n config,\n catalogClient,\n );\n vcsRegistry.registerProvider(githubProvider);\n\n // Register GitLab provider\n const gitlabProvider = new GitLabProvider(\n logger,\n config,\n catalogClient,\n );\n vcsRegistry.registerProvider(gitlabProvider);\n\n logger.debug('Registered VCS providers: github, gitlab');\n\n const notificationsEnabled =\n processorConfig.notifications?.templateUpdate?.enabled;\n const pullRequestsEnabled =\n processorConfig.pullRequests?.templateUpdate?.enabled;\n\n // Subscribe to events if either notifications or pull requests are enabled\n if (notificationsEnabled || pullRequestsEnabled) {\n await events.subscribe({\n id: 'scaffolder-relation-processor',\n topics: [TEMPLATE_VERSION_UPDATED_TOPIC],\n async onEvent(params) {\n const payload = params.eventPayload as {\n entityRef: string;\n previousVersion: string;\n currentVersion: string;\n };\n\n logger.info(\n `Received template update event for ${payload.entityRef}: ` +\n `${payload.previousVersion} -> ${payload.currentVersion}`,\n );\n\n handleTemplateUpdateNotifications(\n catalogClient,\n notifications,\n auth,\n processorConfig,\n payload,\n logger,\n urlReader,\n vcsRegistry,\n config,\n );\n },\n });\n }\n\n catalog.addProcessor(new ScaffolderRelationEntityProcessor(events));\n },\n });\n },\n});\n"],"names":["createBackendModule","catalogProcessingExtensionPoint","coreServices","eventsServiceRef","notificationService","readScaffolderRelationProcessorConfig","catalogClient","CatalogClient","VcsProviderRegistry","GitHubProvider","GitLabProvider","TEMPLATE_VERSION_UPDATED_TOPIC","handleTemplateUpdateNotifications","ScaffolderRelationEntityProcessor"],"mappings":";;;;;;;;;;;;;;AAqCO,MAAM,2CAA2CA,oCAAoB,CAAA;AAAA,EAC1E,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,+BAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,OAAS,EAAAC,qCAAA;AAAA,QACT,QAAQC,6BAAa,CAAA,MAAA;AAAA,QACrB,QAAQA,6BAAa,CAAA,UAAA;AAAA,QACrB,MAAQ,EAAAC,iCAAA;AAAA,QACR,aAAe,EAAAC,2CAAA;AAAA,QACf,MAAMF,6BAAa,CAAA,IAAA;AAAA,QACnB,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,WAAWA,6BAAa,CAAA;AAAA,OAC1B;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,OAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,aAAA;AAAA,QACA,IAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA,OACC,EAAA;AACD,QAAO,MAAA,CAAA,KAAA;AAAA,UACL;AAAA,SACF;AAEA,QAAM,MAAA,eAAA,GAAkBG,2DAAsC,MAAM,CAAA;AAEpE,QAAA,MAAMC,kBAAgB,IAAIC,2BAAA,CAAc,EAAE,YAAA,EAAc,WAAW,CAAA;AAGnE,QAAM,MAAA,WAAA,GAAc,IAAIC,uCAAoB,EAAA;AAG5C,QAAA,MAAM,iBAAiB,IAAIC,6BAAA;AAAA,UACzB,MAAA;AAAA,UACA,MAAA;AAAA,UACAH;AAAA,SACF;AACA,QAAA,WAAA,CAAY,iBAAiB,cAAc,CAAA;AAG3C,QAAA,MAAM,iBAAiB,IAAII,6BAAA;AAAA,UACzB,MAAA;AAAA,UACA,MAAA;AAAA,UACAJ;AAAA,SACF;AACA,QAAA,WAAA,CAAY,iBAAiB,cAAc,CAAA;AAE3C,QAAA,MAAA,CAAO,MAAM,0CAA0C,CAAA;AAEvD,QAAM,MAAA,oBAAA,GACJ,eAAgB,CAAA,aAAA,EAAe,cAAgB,EAAA,OAAA;AACjD,QAAM,MAAA,mBAAA,GACJ,eAAgB,CAAA,YAAA,EAAc,cAAgB,EAAA,OAAA;AAGhD,QAAA,IAAI,wBAAwB,mBAAqB,EAAA;AAC/C,UAAA,MAAM,OAAO,SAAU,CAAA;AAAA,YACrB,EAAI,EAAA,+BAAA;AAAA,YACJ,MAAA,EAAQ,CAACK,wCAA8B,CAAA;AAAA,YACvC,MAAM,QAAQ,MAAQ,EAAA;AACpB,cAAA,MAAM,UAAU,MAAO,CAAA,YAAA;AAMvB,cAAO,MAAA,CAAA,IAAA;AAAA,gBACL,CAAA,mCAAA,EAAsC,QAAQ,SAAS,CAAA,EAAA,EAClD,QAAQ,eAAe,CAAA,IAAA,EAAO,QAAQ,cAAc,CAAA;AAAA,eAC3D;AAEA,cAAAC,sDAAA;AAAA,gBACEN,eAAA;AAAA,gBACA,aAAA;AAAA,gBACA,IAAA;AAAA,gBACA,eAAA;AAAA,gBACA,OAAA;AAAA,gBACA,MAAA;AAAA,gBACA,SAAA;AAAA,gBACA,WAAA;AAAA,gBACA;AAAA,eACF;AAAA;AACF,WACD,CAAA;AAAA;AAGH,QAAA,OAAA,CAAQ,YAAa,CAAA,IAAIO,mEAAkC,CAAA,MAAM,CAAC,CAAA;AAAA;AACpE,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ var crypto = require('crypto');
4
+ var variables = require('../template/variables.cjs.js');
5
+
6
+ function hashContent(content) {
7
+ return crypto.createHash("sha256").update(content).digest("hex");
8
+ }
9
+ function compareFilesByHash(templateContent, scaffoldedContent) {
10
+ return hashContent(templateContent) === hashContent(scaffoldedContent);
11
+ }
12
+ function findTemplateOnlyFiles(templateFiles, scaffoldedFiles) {
13
+ return Array.from(templateFiles.keys()).filter(
14
+ (file) => !scaffoldedFiles.has(file)
15
+ );
16
+ }
17
+ function findScaffoldedOnlyFiles(templateFiles, scaffoldedFiles) {
18
+ return Array.from(scaffoldedFiles.keys()).filter(
19
+ (file) => !templateFiles.has(file)
20
+ );
21
+ }
22
+ function compareCommonFiles(commonFiles, templateFiles, scaffoldedFiles) {
23
+ const filesToUpdate = /* @__PURE__ */ new Map();
24
+ if (commonFiles.length === 0) {
25
+ return filesToUpdate;
26
+ }
27
+ for (const file of commonFiles) {
28
+ const templateContent = templateFiles.get(file);
29
+ const scaffoldedContent = scaffoldedFiles.get(file);
30
+ if (!templateContent || !scaffoldedContent) {
31
+ continue;
32
+ }
33
+ const preprocessedTemplate = variables.preprocessTemplate(
34
+ templateContent,
35
+ scaffoldedContent
36
+ );
37
+ const isIdentical = compareFilesByHash(
38
+ preprocessedTemplate,
39
+ scaffoldedContent
40
+ );
41
+ if (!isIdentical) {
42
+ filesToUpdate.set(file, preprocessedTemplate);
43
+ }
44
+ }
45
+ return filesToUpdate;
46
+ }
47
+
48
+ exports.compareCommonFiles = compareCommonFiles;
49
+ exports.compareFilesByHash = compareFilesByHash;
50
+ exports.findScaffoldedOnlyFiles = findScaffoldedOnlyFiles;
51
+ exports.findTemplateOnlyFiles = findTemplateOnlyFiles;
52
+ //# sourceMappingURL=differ.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"differ.cjs.js","sources":["../../../src/pullRequests/comparison/differ.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createHash } from 'crypto';\nimport { preprocessTemplate } from '../template/variables';\n\n/**\n * Creates a hash of file content for comparison\n *\n * @param content - File content to hash\n * @returns SHA-256 hash of the content\n *\n * @internal\n */\nfunction hashContent(content: string): string {\n return createHash('sha256').update(content).digest('hex');\n}\n\n/**\n * Compares two files by comparing their hashes\n *\n * @param templateContent - Preprocessed template content (with variables replaced)\n * @param scaffoldedContent - Content from scaffolded file\n * @returns True if files are identical, false if difference found\n *\n * @internal\n */\nexport function compareFilesByHash(\n templateContent: string,\n scaffoldedContent: string,\n): boolean {\n return hashContent(templateContent) === hashContent(scaffoldedContent);\n}\n\n/**\n * Finds files that exist only in the template repository\n *\n * @param templateFiles - Map of template file paths to content\n * @param scaffoldedFiles - Map of scaffolded file paths to content\n * @returns Array of file paths that should be added to scaffolded repo\n *\n * @internal\n */\nexport function findTemplateOnlyFiles(\n templateFiles: Map<string, string>,\n scaffoldedFiles: Map<string, string>,\n): string[] {\n return Array.from(templateFiles.keys()).filter(\n file => !scaffoldedFiles.has(file),\n );\n}\n\n/**\n * Finds files that exist only in the scaffolded repository\n *\n * @param templateFiles - Map of template file paths to content\n * @param scaffoldedFiles - Map of scaffolded file paths to content\n * @returns Array of file paths that should be removed from scaffolded repo\n *\n * @internal\n */\nexport function findScaffoldedOnlyFiles(\n templateFiles: Map<string, string>,\n scaffoldedFiles: Map<string, string>,\n): string[] {\n return Array.from(scaffoldedFiles.keys()).filter(\n file => !templateFiles.has(file),\n );\n}\n\n/**\n * Compares common files and collects files that need updating\n *\n * @param commonFiles - Array of common file paths\n * @param templateFiles - Map of template file paths to content\n * @param scaffoldedFiles - Map of scaffolded file paths to content\n * @returns Map of file paths to preprocessed template content that need updating\n *\n * @internal\n */\nexport function compareCommonFiles(\n commonFiles: string[],\n templateFiles: Map<string, string>,\n scaffoldedFiles: Map<string, string>,\n): Map<string, string> {\n const filesToUpdate = new Map<string, string>();\n\n if (commonFiles.length === 0) {\n return filesToUpdate;\n }\n\n for (const file of commonFiles) {\n const templateContent = templateFiles.get(file);\n const scaffoldedContent = scaffoldedFiles.get(file);\n\n if (!templateContent || !scaffoldedContent) {\n continue;\n }\n\n // Preprocess template by replacing template variables with scaffolded values\n const preprocessedTemplate = preprocessTemplate(\n templateContent,\n scaffoldedContent,\n );\n\n const isIdentical = compareFilesByHash(\n preprocessedTemplate,\n scaffoldedContent,\n );\n\n if (!isIdentical) {\n filesToUpdate.set(file, preprocessedTemplate);\n }\n }\n\n return filesToUpdate;\n}\n"],"names":["createHash","preprocessTemplate"],"mappings":";;;;;AA2BA,SAAS,YAAY,OAAyB,EAAA;AAC5C,EAAA,OAAOA,kBAAW,QAAQ,CAAA,CAAE,OAAO,OAAO,CAAA,CAAE,OAAO,KAAK,CAAA;AAC1D;AAWgB,SAAA,kBAAA,CACd,iBACA,iBACS,EAAA;AACT,EAAA,OAAO,WAAY,CAAA,eAAe,CAAM,KAAA,WAAA,CAAY,iBAAiB,CAAA;AACvE;AAWgB,SAAA,qBAAA,CACd,eACA,eACU,EAAA;AACV,EAAA,OAAO,KAAM,CAAA,IAAA,CAAK,aAAc,CAAA,IAAA,EAAM,CAAE,CAAA,MAAA;AAAA,IACtC,CAAQ,IAAA,KAAA,CAAC,eAAgB,CAAA,GAAA,CAAI,IAAI;AAAA,GACnC;AACF;AAWgB,SAAA,uBAAA,CACd,eACA,eACU,EAAA;AACV,EAAA,OAAO,KAAM,CAAA,IAAA,CAAK,eAAgB,CAAA,IAAA,EAAM,CAAE,CAAA,MAAA;AAAA,IACxC,CAAQ,IAAA,KAAA,CAAC,aAAc,CAAA,GAAA,CAAI,IAAI;AAAA,GACjC;AACF;AAYgB,SAAA,kBAAA,CACd,WACA,EAAA,aAAA,EACA,eACqB,EAAA;AACrB,EAAM,MAAA,aAAA,uBAAoB,GAAoB,EAAA;AAE9C,EAAI,IAAA,WAAA,CAAY,WAAW,CAAG,EAAA;AAC5B,IAAO,OAAA,aAAA;AAAA;AAGT,EAAA,KAAA,MAAW,QAAQ,WAAa,EAAA;AAC9B,IAAM,MAAA,eAAA,GAAkB,aAAc,CAAA,GAAA,CAAI,IAAI,CAAA;AAC9C,IAAM,MAAA,iBAAA,GAAoB,eAAgB,CAAA,GAAA,CAAI,IAAI,CAAA;AAElD,IAAI,IAAA,CAAC,eAAmB,IAAA,CAAC,iBAAmB,EAAA;AAC1C,MAAA;AAAA;AAIF,IAAA,MAAM,oBAAuB,GAAAC,4BAAA;AAAA,MAC3B,eAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,MAAM,WAAc,GAAA,kBAAA;AAAA,MAClB,oBAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAc,aAAA,CAAA,GAAA,CAAI,MAAM,oBAAoB,CAAA;AAAA;AAC9C;AAGF,EAAO,OAAA,aAAA;AACT;;;;;;;"}
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var fileOperations = require('../vcs/utils/fileOperations.cjs.js');
4
+ var differ = require('./differ.cjs.js');
5
+
6
+ async function fetchAndCompareFiles(urlReader, scaffoldedUrl, templateFiles) {
7
+ try {
8
+ const scaffoldedFiles = await fileOperations.fetchRepoFiles(urlReader, scaffoldedUrl);
9
+ const filesToUpdate = /* @__PURE__ */ new Map();
10
+ const commonFiles = fileOperations.findCommonFiles(templateFiles, scaffoldedFiles);
11
+ const commonFileUpdates = differ.compareCommonFiles(
12
+ commonFiles,
13
+ templateFiles,
14
+ scaffoldedFiles
15
+ );
16
+ for (const [filePath, content] of commonFileUpdates.entries()) {
17
+ filesToUpdate.set(filePath, content);
18
+ }
19
+ const templateOnlyFiles = differ.findTemplateOnlyFiles(
20
+ templateFiles,
21
+ scaffoldedFiles
22
+ );
23
+ for (const file of templateOnlyFiles) {
24
+ const templateContent = templateFiles.get(file);
25
+ if (typeof templateContent === "string") {
26
+ filesToUpdate.set(file, templateContent);
27
+ }
28
+ }
29
+ const scaffoldedOnlyFiles = differ.findScaffoldedOnlyFiles(
30
+ templateFiles,
31
+ scaffoldedFiles
32
+ );
33
+ for (const file of scaffoldedOnlyFiles) {
34
+ filesToUpdate.set(file, null);
35
+ }
36
+ return filesToUpdate;
37
+ } catch (error) {
38
+ return null;
39
+ }
40
+ }
41
+
42
+ exports.fetchAndCompareFiles = fetchAndCompareFiles;
43
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../src/pullRequests/comparison/index.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { UrlReaderService } from '@backstage/backend-plugin-api';\nimport { fetchRepoFiles, findCommonFiles } from '../vcs/utils/fileOperations';\nimport {\n compareCommonFiles,\n findScaffoldedOnlyFiles,\n findTemplateOnlyFiles,\n} from './differ';\n\n/**\n * Fetches and compares files between template and scaffolded repositories\n *\n * @param urlReader - UrlReaderService instance\n * @param scaffoldedUrl - Scaffolded repository URL\n * @param templateFiles - Pre-fetched template files\n * @returns Map of files that need creating/updating (string) or deleting (null), or null if error occurs\n *\n * @internal\n */\nexport async function fetchAndCompareFiles(\n urlReader: UrlReaderService,\n scaffoldedUrl: string,\n templateFiles: Map<string, string>,\n): Promise<Map<string, string | null> | null> {\n try {\n const scaffoldedFiles = await fetchRepoFiles(urlReader, scaffoldedUrl);\n\n const filesToUpdate = new Map<string, string | null>();\n const commonFiles = findCommonFiles(templateFiles, scaffoldedFiles);\n const commonFileUpdates = compareCommonFiles(\n commonFiles,\n templateFiles,\n scaffoldedFiles,\n );\n\n for (const [filePath, content] of commonFileUpdates.entries()) {\n filesToUpdate.set(filePath, content);\n }\n\n const templateOnlyFiles = findTemplateOnlyFiles(\n templateFiles,\n scaffoldedFiles,\n );\n for (const file of templateOnlyFiles) {\n const templateContent = templateFiles.get(file);\n if (typeof templateContent === 'string') {\n filesToUpdate.set(file, templateContent);\n }\n }\n\n const scaffoldedOnlyFiles = findScaffoldedOnlyFiles(\n templateFiles,\n scaffoldedFiles,\n );\n for (const file of scaffoldedOnlyFiles) {\n filesToUpdate.set(file, null);\n }\n\n return filesToUpdate;\n } catch (error) {\n return null;\n }\n}\n"],"names":["fetchRepoFiles","findCommonFiles","compareCommonFiles","findTemplateOnlyFiles","findScaffoldedOnlyFiles"],"mappings":";;;;;AAkCsB,eAAA,oBAAA,CACpB,SACA,EAAA,aAAA,EACA,aAC4C,EAAA;AAC5C,EAAI,IAAA;AACF,IAAA,MAAM,eAAkB,GAAA,MAAMA,6BAAe,CAAA,SAAA,EAAW,aAAa,CAAA;AAErE,IAAM,MAAA,aAAA,uBAAoB,GAA2B,EAAA;AACrD,IAAM,MAAA,WAAA,GAAcC,8BAAgB,CAAA,aAAA,EAAe,eAAe,CAAA;AAClE,IAAA,MAAM,iBAAoB,GAAAC,yBAAA;AAAA,MACxB,WAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,KAAA,MAAW,CAAC,QAAU,EAAA,OAAO,CAAK,IAAA,iBAAA,CAAkB,SAAW,EAAA;AAC7D,MAAc,aAAA,CAAA,GAAA,CAAI,UAAU,OAAO,CAAA;AAAA;AAGrC,IAAA,MAAM,iBAAoB,GAAAC,4BAAA;AAAA,MACxB,aAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,KAAA,MAAW,QAAQ,iBAAmB,EAAA;AACpC,MAAM,MAAA,eAAA,GAAkB,aAAc,CAAA,GAAA,CAAI,IAAI,CAAA;AAC9C,MAAI,IAAA,OAAO,oBAAoB,QAAU,EAAA;AACvC,QAAc,aAAA,CAAA,GAAA,CAAI,MAAM,eAAe,CAAA;AAAA;AACzC;AAGF,IAAA,MAAM,mBAAsB,GAAAC,8BAAA;AAAA,MAC1B,aAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,KAAA,MAAW,QAAQ,mBAAqB,EAAA;AACtC,MAAc,aAAA,CAAA,GAAA,CAAI,MAAM,IAAI,CAAA;AAAA;AAG9B,IAAO,OAAA,aAAA;AAAA,WACA,KAAO,EAAA;AACd,IAAO,OAAA,IAAA;AAAA;AAEX;;;;"}