@backstage/connections 0.0.0-nightly-20260610032156
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 +11 -0
- package/README.md +5 -0
- package/dist/api/DefaultConnectionService.cjs.js +205 -0
- package/dist/api/DefaultConnectionService.cjs.js.map +1 -0
- package/dist/api/declareConnection.cjs.js +14 -0
- package/dist/api/declareConnection.cjs.js.map +1 -0
- package/dist/definitions/lookup.cjs.js +16 -0
- package/dist/definitions/lookup.cjs.js.map +1 -0
- package/dist/definitions/types.cjs.js +32 -0
- package/dist/definitions/types.cjs.js.map +1 -0
- package/dist/index.cjs.js +15 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +311 -0
- package/dist/schema/awsCodeCommit.cjs.js +35 -0
- package/dist/schema/awsCodeCommit.cjs.js.map +1 -0
- package/dist/schema/awsS3.cjs.js +36 -0
- package/dist/schema/awsS3.cjs.js.map +1 -0
- package/dist/schema/azure.cjs.js +45 -0
- package/dist/schema/azure.cjs.js.map +1 -0
- package/dist/schema/azureBlobStorage.cjs.js +49 -0
- package/dist/schema/azureBlobStorage.cjs.js.map +1 -0
- package/dist/schema/bitbucketCloud.cjs.js +41 -0
- package/dist/schema/bitbucketCloud.cjs.js.map +1 -0
- package/dist/schema/bitbucketServer.cjs.js +34 -0
- package/dist/schema/bitbucketServer.cjs.js.map +1 -0
- package/dist/schema/gerrit.cjs.js +30 -0
- package/dist/schema/gerrit.cjs.js.map +1 -0
- package/dist/schema/gitea.cjs.js +28 -0
- package/dist/schema/gitea.cjs.js.map +1 -0
- package/dist/schema/github.cjs.js +49 -0
- package/dist/schema/github.cjs.js.map +1 -0
- package/dist/schema/gitlab.cjs.js +28 -0
- package/dist/schema/gitlab.cjs.js.map +1 -0
- package/dist/schema/googleGcs.cjs.js +27 -0
- package/dist/schema/googleGcs.cjs.js.map +1 -0
- package/dist/schema/harness.cjs.js +23 -0
- package/dist/schema/harness.cjs.js.map +1 -0
- package/dist/service.cjs.js +29 -0
- package/dist/service.cjs.js.map +1 -0
- package/dist/system/combineConnectionSources.cjs.js +26 -0
- package/dist/system/combineConnectionSources.cjs.js.map +1 -0
- package/dist/system/createConnectionType.cjs.js +39 -0
- package/dist/system/createConnectionType.cjs.js.map +1 -0
- package/dist/system/getLegacyIntegrations.cjs.js +332 -0
- package/dist/system/getLegacyIntegrations.cjs.js.map +1 -0
- package/package.json +61 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
## Connections
|
|
2
|
+
|
|
3
|
+
Connection Service for Backstage - a centralized system for configuring and querying connections to external services.
|
|
4
|
+
It replaces the current integrations configuration and provides a shared foundation that the entire plugin ecosystem can build on.
|
|
5
|
+
More details can be found in [BEP-14](https://github.com/backstage/backstage/pull/33921).
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('../schema/awsCodeCommit.cjs.js');
|
|
4
|
+
require('../schema/awsS3.cjs.js');
|
|
5
|
+
require('../schema/azureBlobStorage.cjs.js');
|
|
6
|
+
require('../schema/azure.cjs.js');
|
|
7
|
+
require('../schema/bitbucketCloud.cjs.js');
|
|
8
|
+
require('../schema/bitbucketServer.cjs.js');
|
|
9
|
+
require('../schema/gerrit.cjs.js');
|
|
10
|
+
require('../schema/gitea.cjs.js');
|
|
11
|
+
require('../schema/github.cjs.js');
|
|
12
|
+
require('../schema/gitlab.cjs.js');
|
|
13
|
+
require('../schema/googleGcs.cjs.js');
|
|
14
|
+
require('../schema/harness.cjs.js');
|
|
15
|
+
var lookup = require('../definitions/lookup.cjs.js');
|
|
16
|
+
var errors = require('@backstage/errors');
|
|
17
|
+
var v4 = require('zod/v4');
|
|
18
|
+
var getLegacyIntegrations = require('../system/getLegacyIntegrations.cjs.js');
|
|
19
|
+
var combineConnectionSources = require('../system/combineConnectionSources.cjs.js');
|
|
20
|
+
|
|
21
|
+
function describeError(error) {
|
|
22
|
+
const e = errors.toError(error);
|
|
23
|
+
if (e.name === "ZodError") {
|
|
24
|
+
return v4.z.prettifyError(e);
|
|
25
|
+
}
|
|
26
|
+
return e.message;
|
|
27
|
+
}
|
|
28
|
+
class PluginConnectionsService {
|
|
29
|
+
logger;
|
|
30
|
+
connections;
|
|
31
|
+
constructor(logger, connections) {
|
|
32
|
+
this.logger = logger;
|
|
33
|
+
this.connections = connections;
|
|
34
|
+
}
|
|
35
|
+
async find(options) {
|
|
36
|
+
const result = await this.findOptional(options);
|
|
37
|
+
if (!result) {
|
|
38
|
+
throw new errors.NotFoundError(
|
|
39
|
+
`Connection not found for type "${options.type}" matching url "${options.url}"`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
async findOptional({
|
|
45
|
+
type,
|
|
46
|
+
url,
|
|
47
|
+
authMethods
|
|
48
|
+
}) {
|
|
49
|
+
this.logger.debug(
|
|
50
|
+
`Finding connection of type "${type}" matching url "${url}"`
|
|
51
|
+
);
|
|
52
|
+
let host;
|
|
53
|
+
try {
|
|
54
|
+
host = new URL(url).host;
|
|
55
|
+
} catch {
|
|
56
|
+
throw new errors.InputError(
|
|
57
|
+
`Invalid url "${url}" passed to ConnectionsService.find`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
const connection = this.connections.find(
|
|
61
|
+
(c) => c.type === type && c.host === host
|
|
62
|
+
);
|
|
63
|
+
if (!connection) {
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
if (connection.auth.length === 0) {
|
|
67
|
+
throw new errors.NotAllowedError(
|
|
68
|
+
`Connection of type "${type}" for host "${host}" has no auth method available to this plugin`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
const matchAuth = lookup.getConnectionType(type).matchAuth;
|
|
72
|
+
const selected = matchAuth ? matchAuth(connection.auth, url) : connection.auth[0];
|
|
73
|
+
if (!selected) {
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
if (!authMethods.includes(selected.method)) {
|
|
77
|
+
throw new errors.NotAllowedError(
|
|
78
|
+
`Connection not found for type "${type}" with auth method "${selected.method}"`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
...connection,
|
|
83
|
+
auth: selected
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
class DefaultConnectionsService {
|
|
88
|
+
logger;
|
|
89
|
+
connections;
|
|
90
|
+
config;
|
|
91
|
+
constructor(logger, config) {
|
|
92
|
+
this.logger = logger;
|
|
93
|
+
this.config = config;
|
|
94
|
+
this.connections = [];
|
|
95
|
+
this.#registerConnectionsFromConfig();
|
|
96
|
+
}
|
|
97
|
+
static create(options) {
|
|
98
|
+
return new DefaultConnectionsService(options.logger, options.config);
|
|
99
|
+
}
|
|
100
|
+
#registerConnectionsFromConfig() {
|
|
101
|
+
const legacy = this.#validateLegacy(getLegacyIntegrations.getLegacyIntegrations(this.config));
|
|
102
|
+
const rawConnections = this.config.getOptional("connections");
|
|
103
|
+
if (rawConnections !== void 0 && !Array.isArray(rawConnections)) {
|
|
104
|
+
throw new errors.InputError(
|
|
105
|
+
'Expected "connections" config to be an array of connection objects'
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
const fromConfig = this.#validateConfig(
|
|
109
|
+
rawConnections ?? []
|
|
110
|
+
);
|
|
111
|
+
if (legacy.length === 0 && fromConfig.length === 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
this.connections.push(
|
|
115
|
+
...combineConnectionSources.combineConnectionSources(legacy, fromConfig, this.logger)
|
|
116
|
+
);
|
|
117
|
+
const seen = /* @__PURE__ */ new Set();
|
|
118
|
+
for (const c of this.connections) {
|
|
119
|
+
const host = c.host;
|
|
120
|
+
const key = `${c.type} ${host}`;
|
|
121
|
+
if (seen.has(key)) {
|
|
122
|
+
throw new errors.InputError(
|
|
123
|
+
`Duplicate connection of type "${c.type}" for host "${host}"`
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
seen.add(key);
|
|
127
|
+
}
|
|
128
|
+
this.logger.info(
|
|
129
|
+
`Loaded ${this.connections.length} connection${this.connections.length === 1 ? "" : "s"} from configuration`
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
#validateConfig(raw) {
|
|
133
|
+
return raw.map((v) => {
|
|
134
|
+
try {
|
|
135
|
+
return this.#validateConnection(v);
|
|
136
|
+
} catch (e) {
|
|
137
|
+
const type = typeof v.type === "string" ? v.type : "unknown";
|
|
138
|
+
throw new errors.InputError(
|
|
139
|
+
`Invalid connection of type "${type}" in connections config:
|
|
140
|
+
${describeError(
|
|
141
|
+
e
|
|
142
|
+
)}`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
#validateLegacy(raw) {
|
|
148
|
+
const result = [];
|
|
149
|
+
for (const v of raw) {
|
|
150
|
+
try {
|
|
151
|
+
result.push(this.#validateConnection(v));
|
|
152
|
+
} catch (e) {
|
|
153
|
+
const type = typeof v.type === "string" ? v.type : "unknown";
|
|
154
|
+
this.logger.error(
|
|
155
|
+
`Failed to validate connection of type "${type}":
|
|
156
|
+
${describeError(
|
|
157
|
+
e
|
|
158
|
+
)}`
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
#validateConnection(connection) {
|
|
165
|
+
if (typeof connection.type !== "string") {
|
|
166
|
+
throw new errors.InputError(`Unrecognised connection type ${connection.type}`);
|
|
167
|
+
}
|
|
168
|
+
if (!lookup.isConnectionTypeKey(connection.type)) {
|
|
169
|
+
throw new errors.InputError(`Unrecognised connection type ${connection.type}`);
|
|
170
|
+
}
|
|
171
|
+
return lookup.getConnectionType(connection.type).schema.parse(
|
|
172
|
+
connection
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
#getConnectionsForPlugin(pluginId) {
|
|
176
|
+
return this.connections.flatMap(({ match, auth, ...rest }) => {
|
|
177
|
+
if (match && !match.plugins.includes(pluginId)) {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
const pluginMatched = [];
|
|
181
|
+
const unmatched = [];
|
|
182
|
+
for (const { match: authMatch, ...authRest } of auth) {
|
|
183
|
+
if (authMatch) {
|
|
184
|
+
if (!authMatch.plugins.includes(pluginId)) continue;
|
|
185
|
+
pluginMatched.push(authRest);
|
|
186
|
+
} else {
|
|
187
|
+
unmatched.push(authRest);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return [
|
|
191
|
+
{ ...rest, auth: [...pluginMatched, ...unmatched] }
|
|
192
|
+
];
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
forPlugin(pluginId, options) {
|
|
196
|
+
const logger = options?.logger ?? this.logger;
|
|
197
|
+
return new PluginConnectionsService(
|
|
198
|
+
logger,
|
|
199
|
+
this.#getConnectionsForPlugin(pluginId)
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
exports.DefaultConnectionsService = DefaultConnectionsService;
|
|
205
|
+
//# sourceMappingURL=DefaultConnectionService.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultConnectionService.cjs.js","sources":["../../src/api/DefaultConnectionService.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { ConnectionsService } from './ConnectionsService';\nimport {\n LoggerService,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport {\n ConnectionTypeKey,\n getConnectionType,\n isConnectionTypeKey,\n} from '../definitions';\nimport { ConnectionAuthMethodKey } from './ConnectionType';\nimport { Connection, RootConnection } from './Connection';\nimport { JsonObject } from '@backstage/types';\nimport {\n InputError,\n NotAllowedError,\n NotFoundError,\n toError,\n} from '@backstage/errors';\nimport { z } from 'zod/v4';\nimport { getLegacyIntegrations } from '../system/getLegacyIntegrations';\nimport { combineConnectionSources } from '../system/combineConnectionSources';\n\nfunction describeError(error: unknown): string {\n const e = toError(error);\n if (e.name === 'ZodError') {\n return z.prettifyError(e as unknown as z.ZodError);\n }\n return e.message;\n}\n\nclass PluginConnectionsService implements ConnectionsService {\n private readonly logger: LoggerService;\n private readonly connections: Connection[];\n\n constructor(logger: LoggerService, connections: Connection[]) {\n this.logger = logger;\n this.connections = connections;\n }\n\n async find<\n TType extends ConnectionTypeKey,\n TAuthMethod extends ConnectionAuthMethodKey<TType>,\n >(options: {\n type: TType;\n url: string;\n authMethods: readonly [TAuthMethod, ...TAuthMethod[]];\n }): Promise<Connection<TType, TAuthMethod>> {\n const result = await this.findOptional(options);\n if (!result) {\n throw new NotFoundError(\n `Connection not found for type \"${options.type}\" matching url \"${options.url}\"`,\n );\n }\n return result;\n }\n\n async findOptional<\n TType extends ConnectionTypeKey,\n TAuthMethod extends ConnectionAuthMethodKey<TType>,\n >({\n type,\n url,\n authMethods,\n }: {\n type: TType;\n url: string;\n authMethods: readonly [TAuthMethod, ...TAuthMethod[]];\n }): Promise<Connection<TType, TAuthMethod> | undefined> {\n this.logger.debug(\n `Finding connection of type \"${type}\" matching url \"${url}\"`,\n );\n let host: string;\n try {\n host = new URL(url).host;\n } catch {\n throw new InputError(\n `Invalid url \"${url}\" passed to ConnectionsService.find`,\n );\n }\n\n const connection = this.connections.find(\n c => c.type === type && (c as { host?: unknown }).host === host,\n ) as Connection<TType> | undefined;\n\n if (!connection) {\n return undefined;\n }\n\n if (connection.auth.length === 0) {\n throw new NotAllowedError(\n `Connection of type \"${type}\" for host \"${host}\" has no auth method available to this plugin`,\n );\n }\n\n const matchAuth = getConnectionType(type).matchAuth as\n | ((authMethods: any[], query: string) => any | undefined)\n | undefined;\n\n // We take the host-matched connection and check to see if there's an auth method better suited to the current url\n // e.g. org selection\n const selected = matchAuth\n ? matchAuth(connection.auth, url)\n : connection.auth[0];\n\n if (!selected) {\n return undefined;\n }\n\n // Now we compare user requested auth methods with what the connection can provide\n if (!(authMethods as readonly string[]).includes(selected.method)) {\n throw new NotAllowedError(\n `Connection not found for type \"${type}\" with auth method \"${selected.method}\"`,\n );\n }\n\n return {\n ...connection,\n auth: selected,\n } as Connection<TType, TAuthMethod>;\n }\n}\n\n/** @public */\nexport class DefaultConnectionsService {\n private readonly logger: LoggerService;\n private readonly connections: RootConnection[];\n private readonly config: RootConfigService;\n\n private constructor(logger: LoggerService, config: RootConfigService) {\n this.logger = logger;\n this.config = config;\n this.connections = [];\n this.#registerConnectionsFromConfig();\n }\n\n static create(options: {\n logger: LoggerService;\n config: RootConfigService;\n }): DefaultConnectionsService {\n return new DefaultConnectionsService(options.logger, options.config);\n }\n\n #registerConnectionsFromConfig(): void {\n const legacy = this.#validateLegacy(getLegacyIntegrations(this.config));\n\n const rawConnections = this.config.getOptional('connections');\n if (rawConnections !== undefined && !Array.isArray(rawConnections)) {\n throw new InputError(\n 'Expected \"connections\" config to be an array of connection objects',\n );\n }\n\n const fromConfig = this.#validateConfig(\n (rawConnections as JsonObject[] | undefined) ?? [],\n );\n\n if (legacy.length === 0 && fromConfig.length === 0) {\n return;\n }\n\n this.connections.push(\n ...combineConnectionSources(legacy, fromConfig, this.logger),\n );\n\n const seen = new Set<string>();\n for (const c of this.connections) {\n const host = (c as unknown as { host: string }).host;\n const key = `${c.type} ${host}`;\n if (seen.has(key)) {\n throw new InputError(\n `Duplicate connection of type \"${c.type}\" for host \"${host}\"`,\n );\n }\n seen.add(key);\n }\n\n this.logger.info(\n `Loaded ${this.connections.length} connection${\n this.connections.length === 1 ? '' : 's'\n } from configuration`,\n );\n }\n\n #validateConfig(raw: JsonObject[]): RootConnection[] {\n return raw.map(v => {\n try {\n return this.#validateConnection(v);\n } catch (e) {\n const type = typeof v.type === 'string' ? v.type : 'unknown';\n throw new InputError(\n `Invalid connection of type \"${type}\" in connections config:\\n${describeError(\n e,\n )}`,\n );\n }\n });\n }\n\n #validateLegacy(raw: JsonObject[]): RootConnection[] {\n const result: RootConnection[] = [];\n for (const v of raw) {\n try {\n result.push(this.#validateConnection(v));\n } catch (e) {\n const type = typeof v.type === 'string' ? v.type : 'unknown';\n this.logger.error(\n `Failed to validate connection of type \"${type}\":\\n${describeError(\n e,\n )}`,\n );\n }\n }\n return result;\n }\n\n #validateConnection(connection: JsonObject): RootConnection {\n if (typeof connection.type !== 'string') {\n throw new InputError(`Unrecognised connection type ${connection.type}`);\n }\n\n if (!isConnectionTypeKey(connection.type)) {\n throw new InputError(`Unrecognised connection type ${connection.type}`);\n }\n\n return getConnectionType(connection.type).schema.parse(\n connection,\n ) as RootConnection;\n }\n\n #getConnectionsForPlugin(pluginId: string): Connection[] {\n // Filter connections and hide auth methods based on these conditions:\n // 1. Include Connections with no plugin matcher condition\n // 2. Include Connections with a plugin matcher condition for this plugin\n // 3. Include auth methods with no plugin matcher condition\n // 4. Remove auth methods with a plugin matcher condition for other plugins\n return this.connections.flatMap(({ match, auth, ...rest }) => {\n if (match && !match.plugins.includes(pluginId)) {\n return [];\n }\n\n const pluginMatched: Connection['auth'] = [];\n const unmatched: Connection['auth'] = [];\n for (const { match: authMatch, ...authRest } of auth) {\n if (authMatch) {\n if (!authMatch.plugins.includes(pluginId)) continue;\n pluginMatched.push(authRest as Connection['auth'][number]);\n } else {\n unmatched.push(authRest as Connection['auth'][number]);\n }\n }\n\n return [\n { ...rest, auth: [...pluginMatched, ...unmatched] } as Connection,\n ];\n });\n }\n\n forPlugin(\n pluginId: string,\n options?: {\n logger: LoggerService;\n },\n ): ConnectionsService {\n const logger = options?.logger ?? this.logger;\n return new PluginConnectionsService(\n logger,\n this.#getConnectionsForPlugin(pluginId),\n );\n }\n}\n"],"names":["toError","z","NotFoundError","InputError","NotAllowedError","getConnectionType","getLegacyIntegrations","combineConnectionSources","isConnectionTypeKey"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsCA,SAAS,cAAc,KAAA,EAAwB;AAC7C,EAAA,MAAM,CAAA,GAAIA,eAAQ,KAAK,CAAA;AACvB,EAAA,IAAI,CAAA,CAAE,SAAS,UAAA,EAAY;AACzB,IAAA,OAAOC,IAAA,CAAE,cAAc,CAA0B,CAAA;AAAA,EACnD;AACA,EAAA,OAAO,CAAA,CAAE,OAAA;AACX;AAEA,MAAM,wBAAA,CAAuD;AAAA,EAC1C,MAAA;AAAA,EACA,WAAA;AAAA,EAEjB,WAAA,CAAY,QAAuB,WAAA,EAA2B;AAC5D,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AAAA,EACrB;AAAA,EAEA,MAAM,KAGJ,OAAA,EAI0C;AAC1C,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,YAAA,CAAa,OAAO,CAAA;AAC9C,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,MAAM,IAAIC,oBAAA;AAAA,QACR,CAAA,+BAAA,EAAkC,OAAA,CAAQ,IAAI,CAAA,gBAAA,EAAmB,QAAQ,GAAG,CAAA,CAAA;AAAA,OAC9E;AAAA,IACF;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AAAA,EAEA,MAAM,YAAA,CAGJ;AAAA,IACA,IAAA;AAAA,IACA,GAAA;AAAA,IACA;AAAA,GACF,EAIwD;AACtD,IAAA,IAAA,CAAK,MAAA,CAAO,KAAA;AAAA,MACV,CAAA,4BAAA,EAA+B,IAAI,CAAA,gBAAA,EAAmB,GAAG,CAAA,CAAA;AAAA,KAC3D;AACA,IAAA,IAAI,IAAA;AACJ,IAAA,IAAI;AACF,MAAA,IAAA,GA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C,UAAA,aAAA,CAAc,KAAK,QAAsC,CAAA;AAAA,QAC3D,CAAA,MAAO;AACL,UAAA,SAAA,CAAU,KAAK,QAAsC,CAAA;AAAA,QACvD;AAAA,MACF;AAEA,MAAA,OAAO;AAAA,QACL,EAAE,GAAG,IAAA,EAAM,IAAA,EAAM,CAAC,GAAG,aAAA,EAAe,GAAG,SAAS,CAAA;AAAE,OACpD;AAAA,IACF,CAAC,CAAA;AAAA,EACH;AAAA,EAEA,SAAA,CACE,UACA,OAAA,EAGoB;AACpB,IAAA,MAAM,MAAA,GAAS,OAAA,EAAS,MAAA,IAAU,IAAA,CAAK,MAAA;AACvC,IAAA,OAAO,IAAI,wBAAA;AAAA,MACT,MAAA;AAAA,MACA,IAAA,CAAK,yBAAyB,QAAQ;AAAA,KACxC;AAAA,EACF;AACF;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function declareConnection(reg, registration) {
|
|
4
|
+
const internal = reg;
|
|
5
|
+
if (typeof internal.registerConnection !== "function") {
|
|
6
|
+
throw new Error(
|
|
7
|
+
"declareConnection: the provided registration points object does not support registerConnection. Make sure you are calling this inside a createBackendPlugin or createBackendModule register callback."
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
internal.registerConnection(registration);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.declareConnection = declareConnection;
|
|
14
|
+
//# sourceMappingURL=declareConnection.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declareConnection.cjs.js","sources":["../../src/api/declareConnection.ts"],"sourcesContent":["/*\n * Copyright 2026 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 type {\n BackendModuleRegistrationPoints,\n BackendPluginRegistrationPoints,\n} from '@backstage/backend-plugin-api';\n\nimport type { ConnectionRegistration } from '@backstage/backend-plugin-api/alpha';\n\n/**\n * Declares that a plugin or module uses a particular connection type.\n * Must be called inside the `register` callback, before `registerInit`.\n *\n * @public\n */\nexport function declareConnection(\n reg: BackendPluginRegistrationPoints | BackendModuleRegistrationPoints,\n registration: ConnectionRegistration,\n): void {\n const internal = reg as {\n registerConnection?: (r: ConnectionRegistration) => void;\n };\n if (typeof internal.registerConnection !== 'function') {\n throw new Error(\n 'declareConnection: the provided registration points object does not support registerConnection. ' +\n 'Make sure you are calling this inside a createBackendPlugin or createBackendModule register callback.',\n );\n }\n internal.registerConnection(registration);\n}\n"],"names":[],"mappings":";;AA4BO,SAAS,iBAAA,CACd,KACA,YAAA,EACM;AACN,EAAA,MAAM,QAAA,GAAW,GAAA;AAGjB,EAAA,IAAI,OAAO,QAAA,CAAS,kBAAA,KAAuB,UAAA,EAAY;AACrD,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KAEF;AAAA,EACF;AACA,EAAA,QAAA,CAAS,mBAAmB,YAAY,CAAA;AAC1C;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var types = require('./types.cjs.js');
|
|
4
|
+
|
|
5
|
+
const connectionTypesMap = new Map(Object.entries(types.connectionTypes));
|
|
6
|
+
function getConnectionType(key) {
|
|
7
|
+
return connectionTypesMap.get(key);
|
|
8
|
+
}
|
|
9
|
+
function isConnectionTypeKey(value) {
|
|
10
|
+
if (!value) return false;
|
|
11
|
+
return connectionTypesMap.has(value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.getConnectionType = getConnectionType;
|
|
15
|
+
exports.isConnectionTypeKey = isConnectionTypeKey;
|
|
16
|
+
//# sourceMappingURL=lookup.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lookup.cjs.js","sources":["../../src/definitions/lookup.ts"],"sourcesContent":["/*\n * Copyright 2026 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 LookupConnectionType,\n ConnectionTypeKey,\n connectionTypes,\n} from './types';\n\nconst connectionTypesMap = new Map(Object.entries(connectionTypes));\n\nexport function getConnectionType<T extends ConnectionTypeKey>(\n key: T,\n): LookupConnectionType<T> {\n return connectionTypesMap.get(key) as LookupConnectionType<T>;\n}\n\nexport function isConnectionTypeKey(\n value: string | undefined,\n): value is ConnectionTypeKey {\n if (!value) return false;\n\n return connectionTypesMap.has(value);\n}\n"],"names":["connectionTypes"],"mappings":";;;;AAqBA,MAAM,qBAAqB,IAAI,GAAA,CAAI,MAAA,CAAO,OAAA,CAAQA,qBAAe,CAAC,CAAA;AAE3D,SAAS,kBACd,GAAA,EACyB;AACzB,EAAA,OAAO,kBAAA,CAAmB,IAAI,GAAG,CAAA;AACnC;AAEO,SAAS,oBACd,KAAA,EAC4B;AAC5B,EAAA,IAAI,CAAC,OAAO,OAAO,KAAA;AAEnB,EAAA,OAAO,kBAAA,CAAmB,IAAI,KAAK,CAAA;AACrC;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var awsCodeCommit = require('../schema/awsCodeCommit.cjs.js');
|
|
4
|
+
var awsS3 = require('../schema/awsS3.cjs.js');
|
|
5
|
+
var azureBlobStorage = require('../schema/azureBlobStorage.cjs.js');
|
|
6
|
+
var azure = require('../schema/azure.cjs.js');
|
|
7
|
+
var bitbucketCloud = require('../schema/bitbucketCloud.cjs.js');
|
|
8
|
+
var bitbucketServer = require('../schema/bitbucketServer.cjs.js');
|
|
9
|
+
var gerrit = require('../schema/gerrit.cjs.js');
|
|
10
|
+
var gitea = require('../schema/gitea.cjs.js');
|
|
11
|
+
var github = require('../schema/github.cjs.js');
|
|
12
|
+
var gitlab = require('../schema/gitlab.cjs.js');
|
|
13
|
+
var googleGcs = require('../schema/googleGcs.cjs.js');
|
|
14
|
+
var harness = require('../schema/harness.cjs.js');
|
|
15
|
+
|
|
16
|
+
const connectionTypes = {
|
|
17
|
+
"aws-codecommit": awsCodeCommit.AwsCodeCommitConnectionType,
|
|
18
|
+
"aws-s3": awsS3.AwsS3ConnectionType,
|
|
19
|
+
"azure-blob-storage": azureBlobStorage.AzureBlobStorageConnectionType,
|
|
20
|
+
azure: azure.AzureConnectionType,
|
|
21
|
+
"bitbucket-cloud": bitbucketCloud.BitbucketCloudConnectionType,
|
|
22
|
+
"bitbucket-server": bitbucketServer.BitbucketServerConnectionType,
|
|
23
|
+
gerrit: gerrit.GerritConnectionType,
|
|
24
|
+
gitea: gitea.GiteaConnectionType,
|
|
25
|
+
github: github.GithubConnectionType,
|
|
26
|
+
gitlab: gitlab.GitlabConnectionType,
|
|
27
|
+
"google-gcs": googleGcs.GoogleGcsConnectionType,
|
|
28
|
+
harness: harness.HarnessConnectionType
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.connectionTypes = connectionTypes;
|
|
32
|
+
//# sourceMappingURL=types.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs.js","sources":["../../src/definitions/types.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { AwsCodeCommitConnectionType } from '../schema/awsCodeCommit';\nimport { AwsS3ConnectionType } from '../schema/awsS3';\nimport { AzureBlobStorageConnectionType } from '../schema/azureBlobStorage';\nimport { AzureConnectionType } from '../schema/azure';\nimport { BitbucketCloudConnectionType } from '../schema/bitbucketCloud';\nimport { BitbucketServerConnectionType } from '../schema/bitbucketServer';\nimport { GerritConnectionType } from '../schema/gerrit';\nimport { GiteaConnectionType } from '../schema/gitea';\nimport { GithubConnectionType } from '../schema/github';\nimport { GitlabConnectionType } from '../schema/gitlab';\nimport { GoogleGcsConnectionType } from '../schema/googleGcs';\nimport { HarnessConnectionType } from '../schema/harness';\nimport { ConnectionType } from '../api/ConnectionType';\n\n/** @public */\nexport const connectionTypes = {\n 'aws-codecommit': AwsCodeCommitConnectionType,\n 'aws-s3': AwsS3ConnectionType,\n 'azure-blob-storage': AzureBlobStorageConnectionType,\n azure: AzureConnectionType,\n 'bitbucket-cloud': BitbucketCloudConnectionType,\n 'bitbucket-server': BitbucketServerConnectionType,\n gerrit: GerritConnectionType,\n gitea: GiteaConnectionType,\n github: GithubConnectionType,\n gitlab: GitlabConnectionType,\n 'google-gcs': GoogleGcsConnectionType,\n harness: HarnessConnectionType,\n} as const satisfies { [K in string]: ConnectionType<K> };\n\n/** @public */\nexport type ConnectionTypeKey = keyof typeof connectionTypes;\n\n/** @public */\nexport type LookupConnectionType<T extends ConnectionTypeKey | ConnectionType> =\n T extends ConnectionTypeKey ? (typeof connectionTypes)[T] : T;\n\nexport type ConnectionMatch = {\n plugins: string[];\n};\n"],"names":["AwsCodeCommitConnectionType","AwsS3ConnectionType","AzureBlobStorageConnectionType","AzureConnectionType","BitbucketCloudConnectionType","BitbucketServerConnectionType","GerritConnectionType","GiteaConnectionType","GithubConnectionType","GitlabConnectionType","GoogleGcsConnectionType","HarnessConnectionType"],"mappings":";;;;;;;;;;;;;;;AA8BO,MAAM,eAAA,GAAkB;AAAA,EAC7B,gBAAA,EAAkBA,yCAAA;AAAA,EAClB,QAAA,EAAUC,yBAAA;AAAA,EACV,oBAAA,EAAsBC,+CAAA;AAAA,EACtB,KAAA,EAAOC,yBAAA;AAAA,EACP,iBAAA,EAAmBC,2CAAA;AAAA,EACnB,kBAAA,EAAoBC,6CAAA;AAAA,EACpB,MAAA,EAAQC,2BAAA;AAAA,EACR,KAAA,EAAOC,yBAAA;AAAA,EACP,MAAA,EAAQC,2BAAA;AAAA,EACR,MAAA,EAAQC,2BAAA;AAAA,EACR,YAAA,EAAcC,iCAAA;AAAA,EACd,OAAA,EAASC;AACX;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var service = require('./service.cjs.js');
|
|
4
|
+
var DefaultConnectionService = require('./api/DefaultConnectionService.cjs.js');
|
|
5
|
+
var declareConnection = require('./api/declareConnection.cjs.js');
|
|
6
|
+
var types = require('./definitions/types.cjs.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.connectionsServiceFactory = service.connectionsServiceFactory;
|
|
11
|
+
exports.connectionsServiceRef = service.connectionsServiceRef;
|
|
12
|
+
exports.DefaultConnectionsService = DefaultConnectionService.DefaultConnectionsService;
|
|
13
|
+
exports.declareConnection = declareConnection.declareConnection;
|
|
14
|
+
exports.connectionTypes = types.connectionTypes;
|
|
15
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|