@backstage/plugin-events-backend-module-google-pubsub 0.2.4-next.0 → 0.2.5-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @backstage/plugin-events-backend-module-google-pubsub
2
2
 
3
+ ## 0.2.5-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/filter-predicates@0.1.4-next.0
9
+ - @backstage/backend-plugin-api@1.9.3-next.0
10
+ - @backstage/plugin-events-node@0.4.24-next.0
11
+
12
+ ## 0.2.4
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+ - @backstage/backend-plugin-api@1.9.2
18
+ - @backstage/plugin-events-node@0.4.23
19
+
3
20
  ## 0.2.4-next.0
4
21
 
5
22
  ### Patch Changes
@@ -0,0 +1,420 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "events": {
6
+ "type": "object",
7
+ "properties": {
8
+ "modules": {
9
+ "type": "object",
10
+ "properties": {
11
+ "googlePubSub": {
12
+ "type": "object",
13
+ "properties": {
14
+ "googlePubSubConsumingEventPublisher": {
15
+ "type": "object",
16
+ "properties": {
17
+ "subscriptions": {
18
+ "type": "object",
19
+ "additionalProperties": {
20
+ "type": "object",
21
+ "properties": {
22
+ "subscriptionName": {
23
+ "type": "string",
24
+ "description": "The complete name of the Pub/Sub subscription to be used, on the form `projects/PROJECT_ID/subscriptions/SUBSCRIPTION_ID`."
25
+ },
26
+ "targetTopic": {
27
+ "type": "string",
28
+ "description": "The name of the events backend topic to which the messages are to be forwarded."
29
+ },
30
+ "filter": {
31
+ "anyOf": [
32
+ {
33
+ "type": "object",
34
+ "additionalProperties": {
35
+ "anyOf": [
36
+ {
37
+ "not": {}
38
+ },
39
+ {
40
+ "type": [
41
+ "string",
42
+ "number",
43
+ "boolean",
44
+ "object"
45
+ ]
46
+ }
47
+ ]
48
+ },
49
+ "properties": {},
50
+ "description": "A filter predicate expression that matches against one or more object properties."
51
+ },
52
+ {
53
+ "type": [
54
+ "string",
55
+ "number",
56
+ "boolean"
57
+ ],
58
+ "description": "A primitive value that can be used in filter predicates."
59
+ },
60
+ {
61
+ "type": "object",
62
+ "properties": {
63
+ "$all": {
64
+ "type": "array",
65
+ "items": {
66
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893"
67
+ },
68
+ "description": "Asserts that all of the given predicates must be true."
69
+ }
70
+ },
71
+ "required": [
72
+ "$all"
73
+ ]
74
+ },
75
+ {
76
+ "type": "object",
77
+ "properties": {
78
+ "$any": {
79
+ "type": "array",
80
+ "items": {
81
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893"
82
+ },
83
+ "description": "Asserts that at least one of the given predicates must be true."
84
+ }
85
+ },
86
+ "required": [
87
+ "$any"
88
+ ]
89
+ },
90
+ {
91
+ "type": "object",
92
+ "properties": {
93
+ "$not": {
94
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893",
95
+ "description": "Asserts that the given predicate must not be true."
96
+ }
97
+ },
98
+ "required": [
99
+ "$not"
100
+ ]
101
+ },
102
+ {
103
+ "type": "object",
104
+ "additionalProperties": {
105
+ "type": [
106
+ "object",
107
+ "number",
108
+ "string",
109
+ "boolean",
110
+ "null"
111
+ ]
112
+ },
113
+ "properties": {
114
+ "$all": {
115
+ "not": {}
116
+ },
117
+ "$any": {
118
+ "not": {}
119
+ },
120
+ "$not": {
121
+ "not": {}
122
+ }
123
+ },
124
+ "required": [
125
+ "$all",
126
+ "$any",
127
+ "$not"
128
+ ],
129
+ "description": "Represents future additions to the set of filter predicate operators."
130
+ }
131
+ ],
132
+ "description": "Message filter predicate expression."
133
+ },
134
+ "eventMetadata": {
135
+ "type": "object",
136
+ "additionalProperties": {
137
+ "type": "string"
138
+ },
139
+ "description": "Pub/Sub message attributes are by default copied to the event metadata field. This setting allows you to override or amend that metadata."
140
+ }
141
+ },
142
+ "required": [
143
+ "subscriptionName",
144
+ "targetTopic"
145
+ ],
146
+ "description": "The name can be anything, but it is recommended to use only letters, numbers, and hyphens for this identifier since it will appear in logs and metric names etc."
147
+ },
148
+ "description": "Generally contains a record per subscription to consume."
149
+ }
150
+ },
151
+ "required": [
152
+ "subscriptions"
153
+ ],
154
+ "description": "Configuration for `GooglePubSubConsumingEventPublisher`, which consumes messages from a Google Pub/Sub subscription and forwards them into the Backstage events system."
155
+ },
156
+ "eventConsumingGooglePubSubPublisher": {
157
+ "type": "object",
158
+ "properties": {
159
+ "subscriptions": {
160
+ "type": "object",
161
+ "additionalProperties": {
162
+ "type": "object",
163
+ "properties": {
164
+ "sourceTopic": {
165
+ "anyOf": [
166
+ {
167
+ "type": "string"
168
+ },
169
+ {
170
+ "type": "array",
171
+ "items": {
172
+ "type": "string"
173
+ }
174
+ }
175
+ ],
176
+ "description": "The name of the events backend topic(s) that messages are consumed from."
177
+ },
178
+ "targetTopicName": {
179
+ "type": "string",
180
+ "description": "The complete name of the Google Pub/Sub subscription to forward events to, on the form `projects/PROJECT_ID/topics/TOPIC_ID`.\n\nThe value can contain placeholders on the form `{{ message.attributes.foo }}`, to mirror attribute `foo` as the whole or part of the topic name."
181
+ },
182
+ "filter": {
183
+ "anyOf": [
184
+ {
185
+ "type": "object",
186
+ "additionalProperties": {
187
+ "anyOf": [
188
+ {
189
+ "not": {}
190
+ },
191
+ {
192
+ "type": [
193
+ "string",
194
+ "number",
195
+ "boolean",
196
+ "object"
197
+ ]
198
+ }
199
+ ]
200
+ },
201
+ "properties": {},
202
+ "description": "A filter predicate expression that matches against one or more object properties."
203
+ },
204
+ {
205
+ "type": [
206
+ "string",
207
+ "number",
208
+ "boolean"
209
+ ],
210
+ "description": "A primitive value that can be used in filter predicates."
211
+ },
212
+ {
213
+ "type": "object",
214
+ "properties": {
215
+ "$all": {
216
+ "type": "array",
217
+ "items": {
218
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893"
219
+ },
220
+ "description": "Asserts that all of the given predicates must be true."
221
+ }
222
+ },
223
+ "required": [
224
+ "$all"
225
+ ]
226
+ },
227
+ {
228
+ "type": "object",
229
+ "properties": {
230
+ "$any": {
231
+ "type": "array",
232
+ "items": {
233
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893"
234
+ },
235
+ "description": "Asserts that at least one of the given predicates must be true."
236
+ }
237
+ },
238
+ "required": [
239
+ "$any"
240
+ ]
241
+ },
242
+ {
243
+ "type": "object",
244
+ "properties": {
245
+ "$not": {
246
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893",
247
+ "description": "Asserts that the given predicate must not be true."
248
+ }
249
+ },
250
+ "required": [
251
+ "$not"
252
+ ]
253
+ },
254
+ {
255
+ "type": "object",
256
+ "additionalProperties": {
257
+ "type": [
258
+ "object",
259
+ "number",
260
+ "string",
261
+ "boolean",
262
+ "null"
263
+ ]
264
+ },
265
+ "properties": {
266
+ "$all": {
267
+ "not": {}
268
+ },
269
+ "$any": {
270
+ "not": {}
271
+ },
272
+ "$not": {
273
+ "not": {}
274
+ }
275
+ },
276
+ "required": [
277
+ "$all",
278
+ "$any",
279
+ "$not"
280
+ ],
281
+ "description": "Represents future additions to the set of filter predicate operators."
282
+ }
283
+ ],
284
+ "description": "Event filter predicate expression."
285
+ },
286
+ "messageAttributes": {
287
+ "type": "object",
288
+ "additionalProperties": {
289
+ "type": "string"
290
+ },
291
+ "description": "Event metadata fields are by default copied to the Pub/Sub message attribute. This setting allows you to override or amend those attributes."
292
+ }
293
+ },
294
+ "required": [
295
+ "sourceTopic",
296
+ "targetTopicName"
297
+ ]
298
+ }
299
+ }
300
+ },
301
+ "required": [
302
+ "subscriptions"
303
+ ],
304
+ "description": "Configuration for `EventConsumingGooglePubSubPublisher`, which consumes messages from the Backstage events system and forwards them into Google Pub/Sub topics."
305
+ }
306
+ },
307
+ "description": "events-backend-module-google-pubsub configuration."
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+ },
314
+ "definitions": {
315
+ "cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893": {
316
+ "anyOf": [
317
+ {
318
+ "type": "object",
319
+ "additionalProperties": {
320
+ "anyOf": [
321
+ {
322
+ "not": {}
323
+ },
324
+ {
325
+ "type": [
326
+ "string",
327
+ "number",
328
+ "boolean",
329
+ "object"
330
+ ]
331
+ }
332
+ ]
333
+ },
334
+ "properties": {},
335
+ "description": "A filter predicate expression that matches against one or more object properties."
336
+ },
337
+ {
338
+ "type": [
339
+ "string",
340
+ "number",
341
+ "boolean"
342
+ ],
343
+ "description": "A primitive value that can be used in filter predicates."
344
+ },
345
+ {
346
+ "type": "object",
347
+ "properties": {
348
+ "$all": {
349
+ "type": "array",
350
+ "items": {
351
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893"
352
+ },
353
+ "description": "Asserts that all of the given predicates must be true."
354
+ }
355
+ },
356
+ "required": [
357
+ "$all"
358
+ ]
359
+ },
360
+ {
361
+ "type": "object",
362
+ "properties": {
363
+ "$any": {
364
+ "type": "array",
365
+ "items": {
366
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893"
367
+ },
368
+ "description": "Asserts that at least one of the given predicates must be true."
369
+ }
370
+ },
371
+ "required": [
372
+ "$any"
373
+ ]
374
+ },
375
+ {
376
+ "type": "object",
377
+ "properties": {
378
+ "$not": {
379
+ "$ref": "#/definitions/cc2c2cdc26854516b7dc39e32cb7372424bf2d99100f58072c5f0b5c419eefb1-alias-pes.ts-1100-3142-pes.ts-0-5325235801893",
380
+ "description": "Asserts that the given predicate must not be true."
381
+ }
382
+ },
383
+ "required": [
384
+ "$not"
385
+ ]
386
+ },
387
+ {
388
+ "type": "object",
389
+ "additionalProperties": {
390
+ "type": [
391
+ "object",
392
+ "number",
393
+ "string",
394
+ "boolean",
395
+ "null"
396
+ ]
397
+ },
398
+ "properties": {
399
+ "$all": {
400
+ "not": {}
401
+ },
402
+ "$any": {
403
+ "not": {}
404
+ },
405
+ "$not": {
406
+ "not": {}
407
+ }
408
+ },
409
+ "required": [
410
+ "$all",
411
+ "$any",
412
+ "$not"
413
+ ],
414
+ "description": "Represents future additions to the set of filter predicate operators."
415
+ }
416
+ ],
417
+ "description": "A filter predicate that can be evaluated against a value."
418
+ }
419
+ }
420
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-events-backend-module-google-pubsub",
3
- "version": "0.2.4-next.0",
3
+ "version": "0.2.5-next.0",
4
4
  "description": "The google-pubsub backend module for the events plugin.",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module",
@@ -24,7 +24,7 @@
24
24
  "main": "dist/index.cjs.js",
25
25
  "types": "dist/index.d.ts",
26
26
  "files": [
27
- "config.d.ts",
27
+ "config.schema.json",
28
28
  "dist"
29
29
  ],
30
30
  "scripts": {
@@ -37,22 +37,22 @@
37
37
  "test": "backstage-cli package test"
38
38
  },
39
39
  "dependencies": {
40
- "@backstage/backend-plugin-api": "1.9.2-next.0",
40
+ "@backstage/backend-plugin-api": "1.9.3-next.0",
41
41
  "@backstage/config": "1.3.8",
42
42
  "@backstage/errors": "1.3.1",
43
- "@backstage/filter-predicates": "0.1.3",
44
- "@backstage/plugin-events-node": "0.4.23-next.0",
43
+ "@backstage/filter-predicates": "0.1.4-next.0",
44
+ "@backstage/plugin-events-node": "0.4.24-next.0",
45
45
  "@backstage/types": "1.2.2",
46
46
  "@google-cloud/pubsub": "^4.10.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@backstage/backend-defaults": "0.17.2-next.0",
50
- "@backstage/backend-test-utils": "1.11.4-next.0",
51
- "@backstage/cli": "0.36.3-next.0",
52
- "@backstage/plugin-events-backend": "0.6.3-next.0",
49
+ "@backstage/backend-defaults": "0.17.4-next.0",
50
+ "@backstage/backend-test-utils": "1.11.5-next.0",
51
+ "@backstage/cli": "0.36.4-next.0",
52
+ "@backstage/plugin-events-backend": "0.6.4-next.0",
53
53
  "wait-for-expect": "^4.0.0"
54
54
  },
55
- "configSchema": "config.d.ts",
55
+ "configSchema": "config.schema.json",
56
56
  "typesVersions": {
57
57
  "*": {
58
58
  "package.json": [
package/config.d.ts DELETED
@@ -1,224 +0,0 @@
1
- /*
2
- * Copyright 2022 The Backstage Authors
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { FilterPredicate } from '@backstage/filter-predicates';
18
-
19
- export interface Config {
20
- events?: {
21
- modules?: {
22
- /**
23
- * events-backend-module-google-pubsub configuration.
24
- */
25
- googlePubSub?: {
26
- /**
27
- * Configuration for `GooglePubSubConsumingEventPublisher`, which
28
- * consumes messages from a Google Pub/Sub subscription and forwards
29
- * them into the Backstage events system.
30
- */
31
- googlePubSubConsumingEventPublisher?: {
32
- /**
33
- * Generally contains a record per subscription to consume.
34
- */
35
- subscriptions: {
36
- /**
37
- * The name can be anything, but it is recommended to use only
38
- * letters, numbers, and hyphens for this identifier since it will
39
- * appear in logs and metric names etc.
40
- */
41
- [name: string]: {
42
- /**
43
- * The complete name of the Pub/Sub subscription to be used, on the
44
- * form
45
- * `projects/PROJECT_ID/subscriptions/SUBSCRIPTION_ID`.
46
- */
47
- subscriptionName: string;
48
-
49
- /**
50
- * The name of the events backend topic to which the messages are
51
- * to be forwarded.
52
- *
53
- * @remarks
54
- *
55
- * The value can contain placeholders on the form `{{ message.attributes.foo }}`,
56
- * to mirror attribute `foo` as the whole or part of the topic name.
57
- *
58
- * @example
59
- *
60
- * This example expects the Pub/Sub topic to contain GitHub
61
- * webhook events where the HTTP headers were mapped into
62
- * message attributes. The outcome should be that messages
63
- * end up on event topics such as `github.push`,
64
- * `github.repository` etc which matches the [`@backstage/plugin-events-backend-module-github`](https://github.com/backstage/backstage/tree/master/plugins/events-backend-module-github) structure.
65
- *
66
- * ```yaml
67
- * targetTopic: 'github.{{ message.attributes.x-github-event }}'
68
- * ```
69
- */
70
- targetTopic: string;
71
-
72
- /**
73
- * Message filter predicate expression.
74
- *
75
- * @remarks
76
- *
77
- * The value should be a JSON object that represents a filter predicate expression.
78
- * The object being passed to the filter is on the following form:
79
- *
80
- * ```js
81
- * {
82
- * message: {
83
- * // The raw JSON parsed message data
84
- * data: { ... },
85
- * // The message attributes as key-value pairs
86
- * attributes: { key: 'value', ... },
87
- * }
88
- * }
89
- * ```
90
- *
91
- * @example
92
- *
93
- * ```yaml
94
- * filter:
95
- * $any:
96
- * - 'message.attributes.x-github-event': 'push'
97
- * - 'message.attributes.x-github-event': 'repository'
98
- * 'message.data.action': { $in: ['created', 'deleted'] }
99
- * ```
100
- */
101
- filter?: FilterPredicate;
102
-
103
- /**
104
- * Pub/Sub message attributes are by default copied to the event
105
- * metadata field. This setting allows you to override or amend
106
- * that metadata.
107
- *
108
- * @remarks
109
- *
110
- * The values can contain placeholders on the form `{{ message.attributes.foo }}`,
111
- * to mirror attribute `foo` as the whole or part of a metadata value.
112
- *
113
- * @example
114
- *
115
- * ```yaml
116
- * eventMetadata:
117
- * x-gitHub-event: '{{ message.attributes.event }}'
118
- * ```
119
- */
120
- eventMetadata?: {
121
- [key: string]: string;
122
- };
123
- };
124
- };
125
- };
126
-
127
- /**
128
- * Configuration for `EventConsumingGooglePubSubPublisher`, which
129
- * consumes messages from the Backstage events system and forwards them
130
- * into Google Pub/Sub topics.
131
- */
132
- eventConsumingGooglePubSubPublisher?: {
133
- subscriptions: {
134
- [name: string]: {
135
- /**
136
- * The name of the events backend topic(s) that messages are
137
- * consumed from.
138
- */
139
- sourceTopic: string | string[];
140
-
141
- /**
142
- * The complete name of the Google Pub/Sub subscription to forward
143
- * events to, on the form
144
- * `projects/PROJECT_ID/topics/TOPIC_ID`.
145
- *
146
- * The value can contain placeholders on the form `{{
147
- * message.attributes.foo }}`, to mirror attribute `foo` as the
148
- * whole or part of the topic name.
149
- *
150
- * @example
151
- *
152
- * This example expects the events topic to contain GitHub
153
- * webhook events where the HTTP headers were mapped into
154
- * event metadata fields. The outcome should be that messages
155
- * end up on event topics such as `github.push`,
156
- * `github.repository` etc which matches the [`@backstage/plugin-events-backend-module-github`](https://github.com/backstage/backstage/tree/master/plugins/events-backend-module-github) structure.
157
- *
158
- * ```yaml
159
- * targetTopic: 'projects/my-project/topics/github.{{ event.metadata.x-github-event }}'
160
- * ```
161
- */
162
- targetTopicName: string;
163
-
164
- /**
165
- * Event filter predicate expression.
166
- *
167
- * @remarks
168
- *
169
- * The value should be a JSON object that represents a filter predicate expression.
170
- * The object being passed to the filter is on the following form:
171
- *
172
- * ```js
173
- * {
174
- * event: {
175
- * // The event topic
176
- * topic: '...',
177
- * // The raw event payload
178
- * eventPayload: { ... },
179
- * // The event metadata as key-value pairs
180
- * metadata: { key: 'value', ... },
181
- * }
182
- * }
183
- * ```
184
- *
185
- * @example
186
- *
187
- * ```yaml
188
- * filter:
189
- * $any:
190
- * - 'event.topic': 'github.push'
191
- * - 'event.topic': 'github.repository'
192
- * 'event.eventPayload.action': { $in: ['created', 'deleted'] }
193
- * ```
194
- */
195
- filter?: FilterPredicate;
196
-
197
- /**
198
- * Event metadata fields are by default copied to the Pub/Sub
199
- * message attribute. This setting allows you to override or amend
200
- * those attributes.
201
- *
202
- * @remarks
203
- *
204
- * The values can contain placeholders on the form `{{ event.metadata.foo }}`,
205
- * to mirror metadata field `foo` as the whole or part of a
206
- * message attribute value.
207
- *
208
- * @example
209
- *
210
- * ```yaml
211
- * messageAttributes:
212
- * x-gitHub-event: '{{ event.metadata.event }}'
213
- * ```
214
- */
215
- messageAttributes?: {
216
- [key: string]: string;
217
- };
218
- };
219
- };
220
- };
221
- };
222
- };
223
- };
224
- }