@backstage/plugin-catalog-backend 3.6.1-next.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,34 +1,10 @@
1
1
  # @backstage/plugin-catalog-backend
2
2
 
3
- ## 3.6.1-next.0
3
+ ## 3.6.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - b33f845: Fixed several database migration `down` functions that were not properly reversible, causing the SQL report to show warnings:
8
-
9
- - `20241003170511_alter_target_in_locations.js`: both `up` and `down` now include `.notNullable()` when altering the `locations.target` column, preventing the `NOT NULL` constraint from being accidentally dropped when widening the column type from `varchar(255)` to `text`.
10
- - `20220116144621_remove_legacy.js`: the `down` function now properly recreates the three dropped legacy tables (`entities`, `entities_search`, `entities_relations`) with correct columns and indices.
11
- - `20210302150147_refresh_state.js`: the `down` function now drops dependent tables in the correct order (avoiding a FK constraint violation) and fixes a typo where the table was referred to as `references` instead of `refresh_state_references`.
12
- - `20201005122705_add_entity_full_name.js`: the `down` function now drops the `full_name` column from `entities` (not `entities_search`), and restores the `entities_unique_name` index with the correct column order `(kind, name, namespace)`.
13
- - `20200702153613_entities.js`: the `down` function now uses `table.integer('generation')` instead of `table.string('generation')`, restoring the correct column type.
14
-
15
- - cf195de: Fixed a performance regression in the `/entity-facets` endpoint when filters or permission conditions are applied, by routing the EXISTS-based filter through `final_entities` instead of correlating against the much larger `search` table.
16
- - 744fa1f: Removed duplicated entries that appeared in both `dependencies` and `devDependencies`.
17
- - Updated dependencies
18
- - @backstage/errors@1.3.1-next.0
19
- - @backstage/integration@2.0.2-next.0
20
- - @backstage/backend-openapi-utils@0.6.9-next.0
21
- - @backstage/backend-plugin-api@1.9.1-next.0
22
- - @backstage/catalog-client@1.15.1-next.0
23
- - @backstage/catalog-model@1.8.1-next.0
24
- - @backstage/config@1.3.8-next.0
25
- - @backstage/filter-predicates@0.1.3-next.0
26
- - @backstage/plugin-catalog-node@2.2.1-next.0
27
- - @backstage/plugin-events-node@0.4.22-next.0
28
- - @backstage/plugin-permission-common@0.9.9-next.0
29
- - @backstage/plugin-permission-node@0.10.13-next.0
30
- - @backstage/types@1.2.2
31
- - @backstage/plugin-catalog-common@1.1.10-next.0
7
+ - 250778e: Fixed a performance regression in the `/entity-facets` endpoint when filters or permission conditions are applied, by routing the EXISTS-based filter through `final_entities` instead of correlating against the much larger `search` table.
32
8
 
33
9
  ## 3.6.0
34
10
 
@@ -169,7 +169,7 @@ exports.down = async function down(knex) {
169
169
  'An opaque string that changes for each update operation to any part of the entity, including metadata.',
170
170
  );
171
171
  table
172
- .integer('generation')
172
+ .string('generation')
173
173
  .notNullable()
174
174
  .unsigned()
175
175
  .comment(
@@ -52,12 +52,12 @@ exports.down = async function down(knex) {
52
52
  await knex.schema.alterTable('entities', table => {
53
53
  // https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#objectmeta-v1-meta
54
54
  table.dropUnique([], 'entities_unique_full_name');
55
- table.unique(['kind', 'name', 'namespace'], {
55
+ table.unique(['kind', 'namespace', 'name'], {
56
56
  indexName: 'entities_unique_name',
57
57
  });
58
58
  });
59
59
 
60
- await knex.schema.alterTable('entities', table => {
60
+ await knex.schema.alterTable('entities_search', table => {
61
61
  table.dropColumn('full_name');
62
62
  });
63
63
  };
@@ -175,10 +175,33 @@ exports.up = async function up(knex) {
175
175
  * @param {import('knex').Knex} knex
176
176
  */
177
177
  exports.down = async function down(knex) {
178
- // Drop tables that have FK constraints referencing refresh_state first.
179
- await knex.schema.dropTable('refresh_state_references');
178
+ await knex.schema.alterTable('refresh_state_references', table => {
179
+ table.dropIndex([], 'refresh_state_references_source_key_idx');
180
+ table.dropIndex([], 'refresh_state_references_source_entity_ref_idx');
181
+ table.dropIndex([], 'refresh_state_references_target_entity_ref_idx');
182
+ });
183
+ await knex.schema.alterTable('refresh_state', table => {
184
+ table.dropUnique([], 'refresh_state_entity_ref_uniq');
185
+ table.dropIndex([], 'refresh_state_entity_id_idx');
186
+ table.dropIndex([], 'refresh_state_entity_ref_idx');
187
+ table.dropIndex([], 'refresh_state_next_update_at_idx');
188
+ });
189
+ await knex.schema.alterTable('final_entities', table => {
190
+ table.dropIndex([], 'final_entities_entity_id_idx');
191
+ });
192
+ await knex.schema.alterTable('relations', table => {
193
+ table.index('source_entity_ref', 'relations_source_entity_ref_idx');
194
+ table.index('originating_entity_id', 'relations_source_entity_id_idx');
195
+ });
196
+ await knex.schema.alterTable('search', table => {
197
+ table.dropIndex([], 'search_entity_id_idx');
198
+ table.dropIndex([], 'search_key_idx');
199
+ table.dropIndex([], 'search_value_idx');
200
+ });
201
+
180
202
  await knex.schema.dropTable('search');
181
203
  await knex.schema.dropTable('final_entities');
182
204
  await knex.schema.dropTable('relations');
205
+ await knex.schema.dropTable('references');
183
206
  await knex.schema.dropTable('refresh_state');
184
207
  };
@@ -25,89 +25,4 @@ exports.up = async function up(knex) {
25
25
  await knex.schema.dropTable('entities');
26
26
  };
27
27
 
28
- /**
29
- * @param {import('knex').Knex} knex
30
- */
31
- exports.down = async function down(knex) {
32
- await knex.schema.createTable('entities', table => {
33
- table.comment('All entities currently stored in the catalog');
34
- table.uuid('id').primary().comment('Auto-generated ID of the entity');
35
- table
36
- .uuid('location_id')
37
- .references('id')
38
- .inTable('locations')
39
- .nullable()
40
- .comment('The location that originated the entity');
41
- table
42
- .string('etag')
43
- .notNullable()
44
- .comment(
45
- 'An opaque string that changes for each update operation to any part of the entity, including metadata.',
46
- );
47
- table
48
- .integer('generation')
49
- .notNullable()
50
- .unsigned()
51
- .comment(
52
- 'A positive nonzero number that indicates the current generation of data for this entity; the value is incremented each time the spec changes.',
53
- );
54
- table
55
- .string('full_name')
56
- .notNullable()
57
- .comment('The full name of the entity');
58
- table
59
- .text('data')
60
- .notNullable()
61
- .comment('The entire JSON data blob of the entity');
62
- table.unique(['full_name'], { indexName: 'entities_unique_full_name' });
63
- table.index('location_id', 'entity_location_id_idx');
64
- });
65
-
66
- await knex.schema.createTable('entities_search', table => {
67
- table.comment(
68
- 'Flattened key-values from the entities, used for quick filtering',
69
- );
70
- table
71
- .uuid('entity_id')
72
- .references('id')
73
- .inTable('entities')
74
- .onDelete('CASCADE')
75
- .comment('The entity that matches this key/value');
76
- table
77
- .string('key')
78
- .notNullable()
79
- .comment('A key that occurs in the entity');
80
- table
81
- .string('value')
82
- .nullable()
83
- .comment('The corresponding value to match on');
84
- table.index(['key'], 'entities_search_key');
85
- table.index(['value'], 'entities_search_value');
86
- table.index(['entity_id'], 'entity_id_idx');
87
- });
88
-
89
- await knex.schema.createTable('entities_relations', table => {
90
- table.comment('All relations between entities in the catalog');
91
- table
92
- .uuid('originating_entity_id')
93
- .references('id')
94
- .inTable('entities')
95
- .onDelete('CASCADE')
96
- .notNullable()
97
- .comment('The entity that provided the relation');
98
- table
99
- .string('source_full_name')
100
- .notNullable()
101
- .comment('The full name of the source entity of the relation');
102
- table
103
- .string('type')
104
- .notNullable()
105
- .comment('The type of the relation between the entities');
106
- table
107
- .string('target_full_name')
108
- .notNullable()
109
- .comment('The full name of the target entity of the relation');
110
- table.index('source_full_name', 'source_full_name_idx');
111
- table.index('originating_entity_id', 'originating_entity_id_idx');
112
- });
113
- };
28
+ exports.down = async function down() {};
@@ -22,7 +22,7 @@
22
22
  */
23
23
  exports.up = async function up(knex) {
24
24
  await knex.schema.alterTable('locations', table => {
25
- table.text('target').notNullable().alter();
25
+ table.text('target').alter();
26
26
  });
27
27
  };
28
28
 
@@ -42,6 +42,6 @@ exports.down = async function down(knex) {
42
42
  }
43
43
 
44
44
  await knex.schema.alterTable('locations', table => {
45
- table.string('target').notNullable().alter();
45
+ table.string('target').alter();
46
46
  });
47
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend",
3
- "version": "3.6.1-next.0",
3
+ "version": "3.6.1",
4
4
  "description": "The Backstage backend plugin that provides the Backstage catalog",
5
5
  "backstage": {
6
6
  "role": "backend-plugin",
@@ -76,20 +76,20 @@
76
76
  "test": "backstage-cli package test"
77
77
  },
78
78
  "dependencies": {
79
- "@backstage/backend-openapi-utils": "0.6.9-next.0",
80
- "@backstage/backend-plugin-api": "1.9.1-next.0",
81
- "@backstage/catalog-client": "1.15.1-next.0",
82
- "@backstage/catalog-model": "1.8.1-next.0",
83
- "@backstage/config": "1.3.8-next.0",
84
- "@backstage/errors": "1.3.1-next.0",
85
- "@backstage/filter-predicates": "0.1.3-next.0",
86
- "@backstage/integration": "2.0.2-next.0",
87
- "@backstage/plugin-catalog-common": "1.1.10-next.0",
88
- "@backstage/plugin-catalog-node": "2.2.1-next.0",
89
- "@backstage/plugin-events-node": "0.4.22-next.0",
90
- "@backstage/plugin-permission-common": "0.9.9-next.0",
91
- "@backstage/plugin-permission-node": "0.10.13-next.0",
92
- "@backstage/types": "1.2.2",
79
+ "@backstage/backend-openapi-utils": "^0.6.8",
80
+ "@backstage/backend-plugin-api": "^1.9.0",
81
+ "@backstage/catalog-client": "^1.15.0",
82
+ "@backstage/catalog-model": "^1.8.0",
83
+ "@backstage/config": "^1.3.7",
84
+ "@backstage/errors": "^1.3.0",
85
+ "@backstage/filter-predicates": "^0.1.2",
86
+ "@backstage/integration": "^2.0.1",
87
+ "@backstage/plugin-catalog-common": "^1.1.9",
88
+ "@backstage/plugin-catalog-node": "^2.2.0",
89
+ "@backstage/plugin-events-node": "^0.4.21",
90
+ "@backstage/plugin-permission-common": "^0.9.8",
91
+ "@backstage/plugin-permission-node": "^0.10.12",
92
+ "@backstage/types": "^1.2.2",
93
93
  "@opentelemetry/api": "^1.9.0",
94
94
  "ajv": "^8.10.0",
95
95
  "ajv-errors": "^3.0.0",
@@ -113,18 +113,20 @@
113
113
  "zod-validation-error": "^4.0.2"
114
114
  },
115
115
  "devDependencies": {
116
- "@backstage/backend-defaults": "0.17.1-next.0",
117
- "@backstage/backend-test-utils": "1.11.3-next.0",
118
- "@backstage/cli": "0.36.2-next.0",
119
- "@backstage/plugin-catalog-backend-module-logs": "0.1.22-next.0",
120
- "@backstage/plugin-scaffolder-common": "2.1.1-next.0",
121
- "@backstage/repo-tools": "0.17.2-next.0",
116
+ "@backstage/backend-defaults": "^0.17.0",
117
+ "@backstage/backend-test-utils": "^1.11.2",
118
+ "@backstage/cli": "^0.36.1",
119
+ "@backstage/plugin-catalog-backend-module-logs": "^0.1.21",
120
+ "@backstage/plugin-permission-common": "^0.9.8",
121
+ "@backstage/plugin-scaffolder-common": "^2.1.0",
122
+ "@backstage/repo-tools": "^0.17.1",
122
123
  "@types/core-js": "^2.5.4",
123
124
  "@types/express": "^4.17.6",
124
125
  "@types/git-url-parse": "^9.0.0",
125
126
  "@types/lodash": "^4.14.151",
126
127
  "@types/supertest": "^2.0.8",
127
128
  "better-sqlite3": "^12.0.0",
129
+ "luxon": "^3.0.0",
128
130
  "msw": "^2.0.0",
129
131
  "supertest": "^7.0.0",
130
132
  "wait-for-expect": "^4.0.0",