@backstage/backend-defaults 0.14.1-next.0 → 0.15.0-next.2
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 +49 -0
- package/config.d.ts +98 -0
- package/dist/alpha/entrypoints/actions/DefaultActionsService.cjs.js +61 -1
- package/dist/alpha/entrypoints/actions/DefaultActionsService.cjs.js.map +1 -1
- package/dist/entrypoints/urlReader/lib/GoogleGcsUrlReader.cjs.js +25 -5
- package/dist/entrypoints/urlReader/lib/GoogleGcsUrlReader.cjs.js.map +1 -1
- package/dist/package.json.cjs.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @backstage/backend-defaults
|
|
2
2
|
|
|
3
|
+
## 0.15.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6fc00e6: Added action filtering support with glob patterns and attribute constraints.
|
|
8
|
+
|
|
9
|
+
The `ActionsService` now supports filtering actions based on configuration. This allows controlling which actions are exposed to consumers like the MCP backend.
|
|
10
|
+
|
|
11
|
+
Configuration example:
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
backend:
|
|
15
|
+
actions:
|
|
16
|
+
pluginSources:
|
|
17
|
+
- catalog
|
|
18
|
+
- scaffolder
|
|
19
|
+
filter:
|
|
20
|
+
include:
|
|
21
|
+
- id: 'catalog:*'
|
|
22
|
+
attributes:
|
|
23
|
+
destructive: false
|
|
24
|
+
- id: 'scaffolder:*'
|
|
25
|
+
exclude:
|
|
26
|
+
- id: '*:delete-*'
|
|
27
|
+
- attributes:
|
|
28
|
+
readOnly: false
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Filtering logic:
|
|
32
|
+
|
|
33
|
+
- `include`: Rules for actions to include. Each rule can specify an `id` glob pattern and/or `attributes` constraints. An action must match at least one rule to be included. If no include rules are specified, all actions are included by default.
|
|
34
|
+
- `exclude`: Rules for actions to exclude. Takes precedence over include rules.
|
|
35
|
+
- Each rule combines `id` and `attributes` with AND logic (both must match if specified).
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies
|
|
40
|
+
- @backstage/backend-app-api@1.4.0
|
|
41
|
+
- @backstage/plugin-auth-node@0.6.10
|
|
42
|
+
- @backstage/plugin-permission-node@0.10.7
|
|
43
|
+
|
|
44
|
+
## 0.14.1-next.1
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- 3afeab4: Implementing `readTree` for `GoogleGcsReader`
|
|
49
|
+
- Updated dependencies
|
|
50
|
+
- @backstage/integration@1.19.2-next.0
|
|
51
|
+
|
|
3
52
|
## 0.14.1-next.0
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/config.d.ts
CHANGED
|
@@ -154,6 +154,104 @@ export interface Config {
|
|
|
154
154
|
* List of plugin sources to load actions from.
|
|
155
155
|
*/
|
|
156
156
|
pluginSources?: string[];
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Filter configuration for actions. Allows controlling which actions
|
|
160
|
+
* are exposed to consumers based on patterns and attributes.
|
|
161
|
+
*/
|
|
162
|
+
filter?: {
|
|
163
|
+
/**
|
|
164
|
+
* Rules for actions to include. An action must match at least one rule to be included.
|
|
165
|
+
* Each rule can specify an id pattern and/or attribute constraints.
|
|
166
|
+
* If no include rules are specified, all actions are included by default.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```yaml
|
|
170
|
+
* include:
|
|
171
|
+
* - id: 'catalog:*'
|
|
172
|
+
* attributes:
|
|
173
|
+
* destructive: false
|
|
174
|
+
* - id: 'scaffolder:*'
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
include?: Array<{
|
|
178
|
+
/**
|
|
179
|
+
* Glob pattern for action IDs to match.
|
|
180
|
+
* Action IDs have the format `{pluginId}:{actionName}`.
|
|
181
|
+
* @example 'catalog:*'
|
|
182
|
+
*/
|
|
183
|
+
id?: string;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Attribute constraints. All specified attributes must match.
|
|
187
|
+
* Actions are compared against their resolved attributes (with defaults applied).
|
|
188
|
+
*/
|
|
189
|
+
attributes?: {
|
|
190
|
+
/**
|
|
191
|
+
* If specified, only match actions where destructive matches this value.
|
|
192
|
+
* Actions default to destructive: true if not explicitly set.
|
|
193
|
+
*/
|
|
194
|
+
destructive?: boolean;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* If specified, only match actions where readOnly matches this value.
|
|
198
|
+
* Actions default to readOnly: false if not explicitly set.
|
|
199
|
+
*/
|
|
200
|
+
readOnly?: boolean;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* If specified, only match actions where idempotent matches this value.
|
|
204
|
+
* Actions default to idempotent: false if not explicitly set.
|
|
205
|
+
*/
|
|
206
|
+
idempotent?: boolean;
|
|
207
|
+
};
|
|
208
|
+
}>;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Rules for actions to exclude. Exclusions take precedence over inclusions.
|
|
212
|
+
* Each rule can specify an id pattern and/or attribute constraints.
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```yaml
|
|
216
|
+
* exclude:
|
|
217
|
+
* - id: '*:delete-*'
|
|
218
|
+
* - attributes:
|
|
219
|
+
* readOnly: false
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
exclude?: Array<{
|
|
223
|
+
/**
|
|
224
|
+
* Glob pattern for action IDs to match.
|
|
225
|
+
* Action IDs have the format `{pluginId}:{actionName}`.
|
|
226
|
+
* @example '*:delete-*'
|
|
227
|
+
*/
|
|
228
|
+
id?: string;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Attribute constraints. All specified attributes must match.
|
|
232
|
+
* Actions are compared against their resolved attributes (with defaults applied).
|
|
233
|
+
*/
|
|
234
|
+
attributes?: {
|
|
235
|
+
/**
|
|
236
|
+
* If specified, only match actions where destructive matches this value.
|
|
237
|
+
* Actions default to destructive: true if not explicitly set.
|
|
238
|
+
*/
|
|
239
|
+
destructive?: boolean;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* If specified, only match actions where readOnly matches this value.
|
|
243
|
+
* Actions default to readOnly: false if not explicitly set.
|
|
244
|
+
*/
|
|
245
|
+
readOnly?: boolean;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* If specified, only match actions where idempotent matches this value.
|
|
249
|
+
* Actions default to idempotent: false if not explicitly set.
|
|
250
|
+
*/
|
|
251
|
+
idempotent?: boolean;
|
|
252
|
+
};
|
|
253
|
+
}>;
|
|
254
|
+
};
|
|
157
255
|
};
|
|
158
256
|
|
|
159
257
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var errors = require('@backstage/errors');
|
|
4
|
+
var minimatch = require('minimatch');
|
|
4
5
|
|
|
5
6
|
class DefaultActionsService {
|
|
6
7
|
discovery;
|
|
@@ -42,7 +43,7 @@ class DefaultActionsService {
|
|
|
42
43
|
}
|
|
43
44
|
})
|
|
44
45
|
);
|
|
45
|
-
return { actions: remoteActionsList.flat() };
|
|
46
|
+
return { actions: this.applyFilters(remoteActionsList.flat()) };
|
|
46
47
|
}
|
|
47
48
|
async invoke(opts) {
|
|
48
49
|
const pluginId = this.pluginIdFromActionId(opts.id);
|
|
@@ -88,6 +89,65 @@ class DefaultActionsService {
|
|
|
88
89
|
}
|
|
89
90
|
return id.substring(0, colonIndex);
|
|
90
91
|
}
|
|
92
|
+
applyFilters(actions) {
|
|
93
|
+
const filterConfig = this.config.getOptionalConfig(
|
|
94
|
+
"backend.actions.filter"
|
|
95
|
+
);
|
|
96
|
+
if (!filterConfig) {
|
|
97
|
+
return actions;
|
|
98
|
+
}
|
|
99
|
+
const includeRules = this.parseFilterRules(
|
|
100
|
+
filterConfig.getOptionalConfigArray("include") ?? []
|
|
101
|
+
);
|
|
102
|
+
const excludeRules = this.parseFilterRules(
|
|
103
|
+
filterConfig.getOptionalConfigArray("exclude") ?? []
|
|
104
|
+
);
|
|
105
|
+
return actions.filter((action) => {
|
|
106
|
+
const excluded = excludeRules.some(
|
|
107
|
+
(rule) => this.matchesRule(action, rule)
|
|
108
|
+
);
|
|
109
|
+
if (excluded) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
if (includeRules.length === 0) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
return includeRules.some((rule) => this.matchesRule(action, rule));
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
parseFilterRules(configArray) {
|
|
119
|
+
return configArray.map((ruleConfig) => {
|
|
120
|
+
const idPattern = ruleConfig.getOptionalString("id");
|
|
121
|
+
const attributesConfig = ruleConfig.getOptionalConfig("attributes");
|
|
122
|
+
const rule = {};
|
|
123
|
+
if (idPattern) {
|
|
124
|
+
rule.idMatcher = new minimatch.Minimatch(idPattern);
|
|
125
|
+
}
|
|
126
|
+
if (attributesConfig) {
|
|
127
|
+
rule.attributes = {};
|
|
128
|
+
for (const key of ["destructive", "readOnly", "idempotent"]) {
|
|
129
|
+
const value = attributesConfig.getOptionalBoolean(key);
|
|
130
|
+
if (value !== void 0) {
|
|
131
|
+
rule.attributes[key] = value;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return rule;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
matchesRule(action, rule) {
|
|
139
|
+
if (rule.idMatcher && !rule.idMatcher.match(action.id)) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
if (rule.attributes) {
|
|
143
|
+
for (const [key, value] of Object.entries(rule.attributes)) {
|
|
144
|
+
if (action.attributes[key] !== value) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
91
151
|
}
|
|
92
152
|
|
|
93
153
|
exports.DefaultActionsService = DefaultActionsService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultActionsService.cjs.js","sources":["../../../../src/alpha/entrypoints/actions/DefaultActionsService.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 */\nimport {\n AuthService,\n BackstageCredentials,\n DiscoveryService,\n LoggerService,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { JsonObject } from '@backstage/types';\nimport {\n ActionsService,\n ActionsServiceAction,\n} from '@backstage/backend-plugin-api/alpha';\n\nexport class DefaultActionsService implements ActionsService {\n private readonly discovery: DiscoveryService;\n private readonly config: RootConfigService;\n private readonly logger: LoggerService;\n private readonly auth: AuthService;\n\n private constructor(\n discovery: DiscoveryService,\n config: RootConfigService,\n logger: LoggerService,\n auth: AuthService,\n ) {\n this.discovery = discovery;\n this.config = config;\n this.logger = logger;\n this.auth = auth;\n }\n\n static create({\n discovery,\n config,\n logger,\n auth,\n }: {\n discovery: DiscoveryService;\n config: RootConfigService;\n logger: LoggerService;\n auth: AuthService;\n }) {\n return new DefaultActionsService(discovery, config, logger, auth);\n }\n\n async list({ credentials }: { credentials: BackstageCredentials }) {\n const pluginSources =\n this.config.getOptionalStringArray('backend.actions.pluginSources') ?? [];\n\n const remoteActionsList = await Promise.all(\n pluginSources.map(async source => {\n try {\n const response = await this.makeRequest({\n path: `/.backstage/actions/v1/actions`,\n pluginId: source,\n credentials,\n });\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const { actions } = (await response.json()) as {\n actions: ActionsServiceAction;\n };\n\n return actions;\n } catch (error) {\n this.logger.warn(`Failed to fetch actions from ${source}`, error);\n return [];\n }\n }),\n );\n\n return { actions: remoteActionsList.flat() };\n }\n\n async invoke(opts: {\n id: string;\n input?: JsonObject;\n credentials: BackstageCredentials;\n }) {\n const pluginId = this.pluginIdFromActionId(opts.id);\n const response = await this.makeRequest({\n path: `/.backstage/actions/v1/actions/${encodeURIComponent(\n opts.id,\n )}/invoke`,\n pluginId,\n credentials: opts.credentials,\n options: {\n method: 'POST',\n body: JSON.stringify(opts.input),\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { output } = await response.json();\n return { output };\n }\n\n private async makeRequest(opts: {\n path: string;\n pluginId: string;\n options?: RequestInit;\n credentials: BackstageCredentials;\n }) {\n const { path, pluginId, credentials, options } = opts;\n const baseUrl = await this.discovery.getBaseUrl(pluginId);\n\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: credentials,\n targetPluginId: opts.pluginId,\n });\n\n return fetch(`${baseUrl}${path}`, {\n ...options,\n headers: {\n ...options?.headers,\n Authorization: `Bearer ${token}`,\n },\n });\n }\n\n private pluginIdFromActionId(id: string): string {\n const colonIndex = id.indexOf(':');\n if (colonIndex === -1) {\n throw new Error(`Invalid action id: ${id}`);\n }\n return id.substring(0, colonIndex);\n }\n}\n"],"names":["ResponseError"],"mappings":";;;;AA6BO,MAAM,qBAAA,CAAgD;AAAA,EAC1C,SAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EAET,WAAA,CACN,SAAA,EACA,MAAA,EACA,MAAA,EACA,IAAA,EACA;AACA,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA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AAU,KAAK,CAAA;AAAA;AAChC,KACD,CAAA;AAAA,EACH;AAAA,EAEQ,qBAAqB,EAAA,EAAoB;AAC/C,IAAA,MAAM,UAAA,GAAa,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AACjC,IAAA,IAAI,eAAe,EAAA,EAAI;AACrB,MAAA,MAAM,IAAI,KAAA,CAAM,CAAA,mBAAA,EAAsB,EAAE,CAAA,CAAE,CAAA;AAAA,IAC5C;AACA,IAAA,OAAO,EAAA,CAAG,SAAA,CAAU,CAAA,EAAG,UAAU,CAAA;AAAA,EACnC;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"DefaultActionsService.cjs.js","sources":["../../../../src/alpha/entrypoints/actions/DefaultActionsService.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 */\nimport {\n AuthService,\n BackstageCredentials,\n DiscoveryService,\n LoggerService,\n RootConfigService,\n} from '@backstage/backend-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { JsonObject } from '@backstage/types';\nimport {\n ActionsService,\n ActionsServiceAction,\n} from '@backstage/backend-plugin-api/alpha';\nimport { Minimatch } from 'minimatch';\nimport { Config } from '@backstage/config';\n\nexport class DefaultActionsService implements ActionsService {\n private readonly discovery: DiscoveryService;\n private readonly config: RootConfigService;\n private readonly logger: LoggerService;\n private readonly auth: AuthService;\n\n private constructor(\n discovery: DiscoveryService,\n config: RootConfigService,\n logger: LoggerService,\n auth: AuthService,\n ) {\n this.discovery = discovery;\n this.config = config;\n this.logger = logger;\n this.auth = auth;\n }\n\n static create({\n discovery,\n config,\n logger,\n auth,\n }: {\n discovery: DiscoveryService;\n config: RootConfigService;\n logger: LoggerService;\n auth: AuthService;\n }) {\n return new DefaultActionsService(discovery, config, logger, auth);\n }\n\n async list({ credentials }: { credentials: BackstageCredentials }) {\n const pluginSources =\n this.config.getOptionalStringArray('backend.actions.pluginSources') ?? [];\n\n const remoteActionsList = await Promise.all(\n pluginSources.map(async source => {\n try {\n const response = await this.makeRequest({\n path: `/.backstage/actions/v1/actions`,\n pluginId: source,\n credentials,\n });\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n const { actions } = (await response.json()) as {\n actions: ActionsServiceAction;\n };\n\n return actions;\n } catch (error) {\n this.logger.warn(`Failed to fetch actions from ${source}`, error);\n return [];\n }\n }),\n );\n\n return { actions: this.applyFilters(remoteActionsList.flat()) };\n }\n\n async invoke(opts: {\n id: string;\n input?: JsonObject;\n credentials: BackstageCredentials;\n }) {\n const pluginId = this.pluginIdFromActionId(opts.id);\n const response = await this.makeRequest({\n path: `/.backstage/actions/v1/actions/${encodeURIComponent(\n opts.id,\n )}/invoke`,\n pluginId,\n credentials: opts.credentials,\n options: {\n method: 'POST',\n body: JSON.stringify(opts.input),\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { output } = await response.json();\n return { output };\n }\n\n private async makeRequest(opts: {\n path: string;\n pluginId: string;\n options?: RequestInit;\n credentials: BackstageCredentials;\n }) {\n const { path, pluginId, credentials, options } = opts;\n const baseUrl = await this.discovery.getBaseUrl(pluginId);\n\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: credentials,\n targetPluginId: opts.pluginId,\n });\n\n return fetch(`${baseUrl}${path}`, {\n ...options,\n headers: {\n ...options?.headers,\n Authorization: `Bearer ${token}`,\n },\n });\n }\n\n private pluginIdFromActionId(id: string): string {\n const colonIndex = id.indexOf(':');\n if (colonIndex === -1) {\n throw new Error(`Invalid action id: ${id}`);\n }\n return id.substring(0, colonIndex);\n }\n\n private applyFilters(\n actions: ActionsServiceAction[],\n ): ActionsServiceAction[] {\n const filterConfig = this.config.getOptionalConfig(\n 'backend.actions.filter',\n );\n\n if (!filterConfig) {\n return actions;\n }\n\n const includeRules = this.parseFilterRules(\n filterConfig.getOptionalConfigArray('include') ?? [],\n );\n const excludeRules = this.parseFilterRules(\n filterConfig.getOptionalConfigArray('exclude') ?? [],\n );\n\n return actions.filter(action => {\n const excluded = excludeRules.some(rule =>\n this.matchesRule(action, rule),\n );\n\n if (excluded) {\n return false;\n }\n\n // If no include rules, include by default\n if (includeRules.length === 0) {\n return true;\n }\n\n // Must match at least one include rule\n return includeRules.some(rule => this.matchesRule(action, rule));\n });\n }\n\n private parseFilterRules(configArray: Array<Config>): Array<{\n idMatcher?: Minimatch;\n attributes?: Partial<\n Record<'destructive' | 'readOnly' | 'idempotent', boolean>\n >;\n }> {\n return configArray.map(ruleConfig => {\n const idPattern = ruleConfig.getOptionalString('id');\n const attributesConfig = ruleConfig.getOptionalConfig('attributes');\n\n const rule: {\n idMatcher?: Minimatch;\n attributes?: Partial<\n Record<'destructive' | 'readOnly' | 'idempotent', boolean>\n >;\n } = {};\n\n if (idPattern) {\n rule.idMatcher = new Minimatch(idPattern);\n }\n\n if (attributesConfig) {\n rule.attributes = {};\n for (const key of ['destructive', 'readOnly', 'idempotent'] as const) {\n const value = attributesConfig.getOptionalBoolean(key);\n if (value !== undefined) {\n rule.attributes[key] = value;\n }\n }\n }\n\n return rule;\n });\n }\n\n private matchesRule(\n action: ActionsServiceAction,\n rule: {\n idMatcher?: Minimatch;\n attributes?: Partial<\n Record<'destructive' | 'readOnly' | 'idempotent', boolean>\n >;\n },\n ): boolean {\n // If id pattern is specified, it must match\n if (rule.idMatcher && !rule.idMatcher.match(action.id)) {\n return false;\n }\n\n // If attributes are specified, all must match\n if (rule.attributes) {\n for (const [key, value] of Object.entries(rule.attributes)) {\n if (\n action.attributes[\n key as 'destructive' | 'readOnly' | 'idempotent'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AAI,IAAA,CAAK,aAAa,CAAC,IAAA,CAAK,UAAU,KAAA,CAAM,MAAA,CAAO,EAAE,CAAA,EAAG;AACtD,MAAA,OAAO,KAAA;AAAA,IACT;AAGA,IAAA,IAAI,KAAK,UAAA,EAAY;AACnB,MAAA,KAAA,MAAW,CAAC,KAAK,KAAK,CAAA,IAAK,OAAO,OAAA,CAAQ,IAAA,CAAK,UAAU,CAAA,EAAG;AAC1D,QAAA,IACE,MAAA,CAAO,UAAA,CACL,GACF,CAAA,KAAM,KAAA,EACN;AACA,UAAA,OAAO,KAAA;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAEA,IAAA,OAAO,IAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -6,6 +6,7 @@ var integration = require('@backstage/integration');
|
|
|
6
6
|
var ReadUrlResponseFactory = require('./ReadUrlResponseFactory.cjs.js');
|
|
7
7
|
var _package = require('../../../package.json.cjs.js');
|
|
8
8
|
var errors = require('@backstage/errors');
|
|
9
|
+
var posix = require('path/posix');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
12
|
|
|
@@ -44,7 +45,7 @@ const parseURL = (url) => {
|
|
|
44
45
|
};
|
|
45
46
|
};
|
|
46
47
|
class GoogleGcsUrlReader {
|
|
47
|
-
static factory = ({ config, logger }) => {
|
|
48
|
+
static factory = ({ config, logger, treeResponseFactory }) => {
|
|
48
49
|
if (!config.has("integrations.googleGcs")) {
|
|
49
50
|
return [];
|
|
50
51
|
}
|
|
@@ -68,15 +69,19 @@ class GoogleGcsUrlReader {
|
|
|
68
69
|
userAgent: `backstage/backend-defaults.GoogleGcsUrlReader/${_package.default.version}`
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
|
-
const reader = new GoogleGcsUrlReader(gcsConfig, storage
|
|
72
|
+
const reader = new GoogleGcsUrlReader(gcsConfig, storage, {
|
|
73
|
+
treeResponseFactory
|
|
74
|
+
});
|
|
72
75
|
const predicate = (url) => url.host === GOOGLE_GCS_HOST;
|
|
73
76
|
return [{ reader, predicate }];
|
|
74
77
|
};
|
|
75
78
|
integration;
|
|
76
79
|
storage;
|
|
77
|
-
|
|
80
|
+
deps;
|
|
81
|
+
constructor(integration, storage, deps) {
|
|
78
82
|
this.integration = integration;
|
|
79
83
|
this.storage = storage;
|
|
84
|
+
this.deps = deps;
|
|
80
85
|
}
|
|
81
86
|
readStreamFromUrl(url) {
|
|
82
87
|
const { bucket, key } = parseURL(url);
|
|
@@ -93,8 +98,23 @@ class GoogleGcsUrlReader {
|
|
|
93
98
|
const stream = this.readStreamFromUrl(url);
|
|
94
99
|
return ReadUrlResponseFactory.ReadUrlResponseFactory.fromReadable(stream);
|
|
95
100
|
}
|
|
96
|
-
async readTree() {
|
|
97
|
-
|
|
101
|
+
async readTree(url, _options) {
|
|
102
|
+
const { bucket, key } = parseURL(url);
|
|
103
|
+
if (key.match(/[*?]/)) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
"GcsUrlReader readTree does not support glob patterns, use search instead"
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
const [files] = await this.storage.bucket(bucket).getFiles({
|
|
109
|
+
autoPaginate: true,
|
|
110
|
+
prefix: key
|
|
111
|
+
});
|
|
112
|
+
const responses = files.map((file) => ({
|
|
113
|
+
data: file.createReadStream(),
|
|
114
|
+
path: posix.relative(key, file.name),
|
|
115
|
+
lastModifiedAt: file.metadata.updated ? new Date(file.metadata.updated) : void 0
|
|
116
|
+
}));
|
|
117
|
+
return this.deps.treeResponseFactory.fromReadableArray(responses);
|
|
98
118
|
}
|
|
99
119
|
async search(url, options) {
|
|
100
120
|
const { bucket, key: pattern } = parseURL(url);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleGcsUrlReader.cjs.js","sources":["../../../../src/entrypoints/urlReader/lib/GoogleGcsUrlReader.ts"],"sourcesContent":["/*\n * Copyright 2020 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 * as GoogleCloud from '@google-cloud/storage';\nimport {\n UrlReaderService,\n UrlReaderServiceReadTreeResponse,\n UrlReaderServiceReadUrlOptions,\n UrlReaderServiceReadUrlResponse,\n UrlReaderServiceSearchOptions,\n UrlReaderServiceSearchResponse,\n} from '@backstage/backend-plugin-api';\nimport { ReaderFactory } from './types';\nimport getRawBody from 'raw-body';\nimport {\n GoogleGcsIntegrationConfig,\n readGoogleGcsIntegrationConfig,\n} from '@backstage/integration';\nimport { Readable } from 'stream';\nimport { ReadUrlResponseFactory } from './ReadUrlResponseFactory';\nimport packageinfo from '../../../../package.json';\nimport { assertError } from '@backstage/errors';\n\nconst GOOGLE_GCS_HOST = 'storage.cloud.google.com';\n\nconst parseURL = (\n url: string,\n): { host: string; bucket: string; key: string } => {\n const { host, pathname } = new URL(url);\n\n if (host !== GOOGLE_GCS_HOST) {\n throw new Error(`not a valid GCS URL: ${url}`);\n }\n\n const [, bucket, ...key] = pathname.split('/');\n return {\n host: host,\n bucket,\n key: key.join('/'),\n };\n};\n\n/**\n * Implements a {@link @backstage/backend-plugin-api#UrlReaderService} for files on Google GCS.\n *\n * @public\n */\nexport class GoogleGcsUrlReader implements UrlReaderService {\n static factory: ReaderFactory = ({ config, logger }) => {\n if (!config.has('integrations.googleGcs')) {\n return [];\n }\n const gcsConfig = readGoogleGcsIntegrationConfig(\n config.getConfig('integrations.googleGcs'),\n );\n let storage: GoogleCloud.Storage;\n if (!gcsConfig.clientEmail || !gcsConfig.privateKey) {\n logger.info(\n 'googleGcs credentials not found in config. Using default credentials provider.',\n );\n storage = new GoogleCloud.Storage({\n userAgent: `backstage/backend-defaults.GoogleGcsUrlReader/${packageinfo.version}`,\n });\n } else {\n storage = new GoogleCloud.Storage({\n credentials: {\n client_email: gcsConfig.clientEmail || undefined,\n private_key: gcsConfig.privateKey || undefined,\n },\n userAgent: `backstage/backend-defaults.GoogleGcsUrlReader/${packageinfo.version}`,\n });\n }\n const reader = new GoogleGcsUrlReader(gcsConfig, storage);\n const predicate = (url: URL) => url.host === GOOGLE_GCS_HOST;\n return [{ reader, predicate }];\n };\n\n private readonly integration: GoogleGcsIntegrationConfig;\n private readonly storage: GoogleCloud.Storage;\n\n constructor(\n integration: GoogleGcsIntegrationConfig,\n storage: GoogleCloud.Storage,\n ) {\n this.integration = integration;\n this.storage = storage;\n }\n\n private readStreamFromUrl(url: string): Readable {\n const { bucket, key } = parseURL(url);\n return this.storage.bucket(bucket).file(key).createReadStream();\n }\n\n async read(url: string): Promise<Buffer> {\n try {\n return await getRawBody(this.readStreamFromUrl(url));\n } catch (error) {\n throw new Error(`unable to read gcs file from ${url}, ${error}`);\n }\n }\n\n async readUrl(\n url: string,\n _options?: UrlReaderServiceReadUrlOptions,\n ): Promise<UrlReaderServiceReadUrlResponse> {\n // TODO etag is not implemented yet.\n const stream = this.readStreamFromUrl(url);\n return ReadUrlResponseFactory.fromReadable(stream);\n }\n\n async readTree(): Promise<UrlReaderServiceReadTreeResponse> {\n throw new Error('GcsUrlReader does not implement readTree');\n }\n\n async search(\n url: string,\n options?: UrlReaderServiceSearchOptions,\n ): Promise<UrlReaderServiceSearchResponse> {\n const { bucket, key: pattern } = parseURL(url);\n\n // If it's a direct URL we use readUrl instead\n if (!pattern?.match(/[*?]/)) {\n try {\n const data = await this.readUrl(url, options);\n\n return {\n files: [\n {\n url: url,\n content: data.buffer,\n lastModifiedAt: data.lastModifiedAt,\n },\n ],\n etag: data.etag ?? '',\n };\n } catch (error) {\n assertError(error);\n if (error.name === 'NotFoundError') {\n return {\n files: [],\n etag: '',\n };\n }\n throw error;\n }\n }\n\n if (!pattern.endsWith('*') || pattern.indexOf('*') !== pattern.length - 1) {\n throw new Error('GcsUrlReader only supports prefix-based searches');\n }\n\n const [files] = await this.storage.bucket(bucket).getFiles({\n autoPaginate: true,\n prefix: pattern.split('*').join(''),\n });\n\n return {\n files: files.map(file => {\n const fullUrl = ['https:/', GOOGLE_GCS_HOST, bucket, file.name].join(\n '/',\n );\n return {\n url: fullUrl,\n content: async () => {\n const readResponse = await this.readUrl(fullUrl);\n return readResponse.buffer();\n },\n };\n }),\n // TODO etag is not implemented yet.\n etag: 'NOT/IMPLEMENTED',\n };\n }\n\n toString() {\n const key = this.integration.privateKey;\n return `googleGcs{host=${GOOGLE_GCS_HOST},authed=${Boolean(key)}}`;\n }\n}\n"],"names":["readGoogleGcsIntegrationConfig","GoogleCloud","packageinfo","getRawBody","ReadUrlResponseFactory","assertError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,eAAA,GAAkB,0BAAA;AAExB,MAAM,QAAA,GAAW,CACf,GAAA,KACkD;AAClD,EAAA,MAAM,EAAE,IAAA,EAAM,QAAA,EAAS,GAAI,IAAI,IAAI,GAAG,CAAA;AAEtC,EAAA,IAAI,SAAS,eAAA,EAAiB;AAC5B,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,qBAAA,EAAwB,GAAG,CAAA,CAAE,CAAA;AAAA,EAC/C;AAEA,EAAA,MAAM,GAAG,MAAA,EAAQ,GAAG,GAAG,CAAA,GAAI,QAAA,CAAS,MAAM,GAAG,CAAA;AAC7C,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAA,EAAK,GAAA,CAAI,IAAA,CAAK,GAAG;AAAA,GACnB;AACF,CAAA;AAOO,MAAM,kBAAA,CAA+C;AAAA,EAC1D,OAAO,OAAA,GAAyB,CAAC,EAAE,MAAA,EAAQ,QAAO,KAAM;AACtD,IAAA,IAAI,CAAC,MAAA,CAAO,GAAA,CAAI,wBAAwB,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AAA,EAAkB,eAAe,CAAA,QAAA,EAAW,OAAA,CAAQ,GAAG,CAAC,CAAA,CAAA,CAAA;AAAA,EACjE;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"GoogleGcsUrlReader.cjs.js","sources":["../../../../src/entrypoints/urlReader/lib/GoogleGcsUrlReader.ts"],"sourcesContent":["/*\n * Copyright 2020 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 * as GoogleCloud from '@google-cloud/storage';\nimport {\n UrlReaderService,\n UrlReaderServiceReadTreeOptions,\n UrlReaderServiceReadTreeResponse,\n UrlReaderServiceReadUrlOptions,\n UrlReaderServiceReadUrlResponse,\n UrlReaderServiceSearchOptions,\n UrlReaderServiceSearchResponse,\n} from '@backstage/backend-plugin-api';\nimport { ReaderFactory, ReadTreeResponseFactory } from './types';\nimport getRawBody from 'raw-body';\nimport {\n GoogleGcsIntegrationConfig,\n readGoogleGcsIntegrationConfig,\n} from '@backstage/integration';\n\nimport { Readable } from 'stream';\nimport { ReadUrlResponseFactory } from './ReadUrlResponseFactory';\nimport packageinfo from '../../../../package.json';\nimport { assertError } from '@backstage/errors';\nimport { relative } from 'path/posix';\n\nconst GOOGLE_GCS_HOST = 'storage.cloud.google.com';\n\nconst parseURL = (\n url: string,\n): { host: string; bucket: string; key: string } => {\n const { host, pathname } = new URL(url);\n\n if (host !== GOOGLE_GCS_HOST) {\n throw new Error(`not a valid GCS URL: ${url}`);\n }\n\n const [, bucket, ...key] = pathname.split('/');\n return {\n host: host,\n bucket,\n key: key.join('/'),\n };\n};\n\n/**\n * Implements a {@link @backstage/backend-plugin-api#UrlReaderService} for files on Google GCS.\n *\n * @public\n */\nexport class GoogleGcsUrlReader implements UrlReaderService {\n static factory: ReaderFactory = ({ config, logger, treeResponseFactory }) => {\n if (!config.has('integrations.googleGcs')) {\n return [];\n }\n const gcsConfig = readGoogleGcsIntegrationConfig(\n config.getConfig('integrations.googleGcs'),\n );\n let storage: GoogleCloud.Storage;\n if (!gcsConfig.clientEmail || !gcsConfig.privateKey) {\n logger.info(\n 'googleGcs credentials not found in config. Using default credentials provider.',\n );\n storage = new GoogleCloud.Storage({\n userAgent: `backstage/backend-defaults.GoogleGcsUrlReader/${packageinfo.version}`,\n });\n } else {\n storage = new GoogleCloud.Storage({\n credentials: {\n client_email: gcsConfig.clientEmail || undefined,\n private_key: gcsConfig.privateKey || undefined,\n },\n userAgent: `backstage/backend-defaults.GoogleGcsUrlReader/${packageinfo.version}`,\n });\n }\n const reader = new GoogleGcsUrlReader(gcsConfig, storage, {\n treeResponseFactory,\n });\n const predicate = (url: URL) => url.host === GOOGLE_GCS_HOST;\n return [{ reader, predicate }];\n };\n\n private readonly integration: GoogleGcsIntegrationConfig;\n private readonly storage: GoogleCloud.Storage;\n private readonly deps: {\n treeResponseFactory: ReadTreeResponseFactory;\n };\n\n constructor(\n integration: GoogleGcsIntegrationConfig,\n storage: GoogleCloud.Storage,\n deps: {\n treeResponseFactory: ReadTreeResponseFactory;\n },\n ) {\n this.integration = integration;\n this.storage = storage;\n this.deps = deps;\n }\n\n private readStreamFromUrl(url: string): Readable {\n const { bucket, key } = parseURL(url);\n return this.storage.bucket(bucket).file(key).createReadStream();\n }\n\n async read(url: string): Promise<Buffer> {\n try {\n return await getRawBody(this.readStreamFromUrl(url));\n } catch (error) {\n throw new Error(`unable to read gcs file from ${url}, ${error}`);\n }\n }\n\n async readUrl(\n url: string,\n _options?: UrlReaderServiceReadUrlOptions,\n ): Promise<UrlReaderServiceReadUrlResponse> {\n // TODO etag is not implemented yet.\n const stream = this.readStreamFromUrl(url);\n return ReadUrlResponseFactory.fromReadable(stream);\n }\n\n async readTree(\n url: string,\n _options?: UrlReaderServiceReadTreeOptions,\n ): Promise<UrlReaderServiceReadTreeResponse> {\n const { bucket, key } = parseURL(url);\n\n if (key.match(/[*?]/)) {\n throw new Error(\n 'GcsUrlReader readTree does not support glob patterns, use search instead',\n );\n }\n\n const [files] = await this.storage.bucket(bucket).getFiles({\n autoPaginate: true,\n prefix: key,\n });\n\n const responses = files.map(file => ({\n data: file.createReadStream(),\n path: relative(key, file.name),\n lastModifiedAt: file.metadata.updated\n ? new Date(file.metadata.updated as string)\n : undefined,\n }));\n\n return this.deps.treeResponseFactory.fromReadableArray(responses);\n }\n\n async search(\n url: string,\n options?: UrlReaderServiceSearchOptions,\n ): Promise<UrlReaderServiceSearchResponse> {\n const { bucket, key: pattern } = parseURL(url);\n\n // If it's a direct URL we use readUrl instead\n if (!pattern?.match(/[*?]/)) {\n try {\n const data = await this.readUrl(url, options);\n\n return {\n files: [\n {\n url: url,\n content: data.buffer,\n lastModifiedAt: data.lastModifiedAt,\n },\n ],\n etag: data.etag ?? '',\n };\n } catch (error) {\n assertError(error);\n if (error.name === 'NotFoundError') {\n return {\n files: [],\n etag: '',\n };\n }\n throw error;\n }\n }\n\n if (!pattern.endsWith('*') || pattern.indexOf('*') !== pattern.length - 1) {\n throw new Error('GcsUrlReader only supports prefix-based searches');\n }\n\n const [files] = await this.storage.bucket(bucket).getFiles({\n autoPaginate: true,\n prefix: pattern.split('*').join(''),\n });\n\n return {\n files: files.map(file => {\n const fullUrl = ['https:/', GOOGLE_GCS_HOST, bucket, file.name].join(\n '/',\n );\n return {\n url: fullUrl,\n content: async () => {\n const readResponse = await this.readUrl(fullUrl);\n return readResponse.buffer();\n },\n };\n }),\n // TODO etag is not implemented yet.\n etag: 'NOT/IMPLEMENTED',\n };\n }\n\n toString() {\n const key = this.integration.privateKey;\n return `googleGcs{host=${GOOGLE_GCS_HOST},authed=${Boolean(key)}}`;\n }\n}\n"],"names":["readGoogleGcsIntegrationConfig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E,IAAA;AAAA,UAC9D;AAAA,SACF;AACA,QAAA,OAAO;AAAA,UACL,GAAA,EAAK,OAAA;AAAA,UACL,SAAS,YAAY;AACnB,YAAA,MAAM,YAAA,GAAe,MAAM,IAAA,CAAK,OAAA,CAAQ,OAAO,CAAA;AAC/C,YAAA,OAAO,aAAa,MAAA,EAAO;AAAA,UAC7B;AAAA,SACF;AAAA,MACF,CAAC,CAAA;AAAA;AAAA,MAED,IAAA,EAAM;AAAA,KACR;AAAA,EACF;AAAA,EAEA,QAAA,GAAW;AACT,IAAA,MAAM,GAAA,GAAM,KAAK,WAAA,CAAY,UAAA;AAC7B,IAAA,OAAO,CAAA,eAAA,EAAkB,eAAe,CAAA,QAAA,EAAW,OAAA,CAAQ,GAAG,CAAC,CAAA,CAAA,CAAA;AAAA,EACjE;AACF;;;;"}
|
package/dist/package.json.cjs.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-defaults",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0-next.2",
|
|
4
4
|
"description": "Backend defaults used by Backstage backend apps",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "node-library"
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
"@backstage/config": "1.3.6",
|
|
224
224
|
"@backstage/config-loader": "1.10.7",
|
|
225
225
|
"@backstage/errors": "1.2.7",
|
|
226
|
-
"@backstage/integration": "1.19.0",
|
|
226
|
+
"@backstage/integration": "1.19.2-next.0",
|
|
227
227
|
"@backstage/integration-aws-node": "0.1.19",
|
|
228
228
|
"@backstage/plugin-auth-node": "0.6.10",
|
|
229
229
|
"@backstage/plugin-events-node": "0.4.18",
|
|
@@ -284,8 +284,8 @@
|
|
|
284
284
|
"devDependencies": {
|
|
285
285
|
"@aws-sdk/util-stream-node": "^3.350.0",
|
|
286
286
|
"@backstage/backend-plugin-api": "1.6.0",
|
|
287
|
-
"@backstage/backend-test-utils": "1.10.3-next.
|
|
288
|
-
"@backstage/cli": "0.35.2-next.
|
|
287
|
+
"@backstage/backend-test-utils": "1.10.3-next.1",
|
|
288
|
+
"@backstage/cli": "0.35.2-next.1",
|
|
289
289
|
"@google-cloud/cloud-sql-connector": "^1.4.0",
|
|
290
290
|
"@types/archiver": "^7.0.0",
|
|
291
291
|
"@types/base64-stream": "^1.0.2",
|