@attraccess/plugin-wago 0.1.0 → 0.2.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/LICENSE.md +32 -0
- package/dist/index.js +1251 -1236
- package/frontend/{__federation_expose_Plugin-CWwloVtB.js → __federation_expose_Plugin-BLl9hrTn.js} +3443 -3592
- package/frontend/__federation_fn_import-BHGw2mzr.js +1 -0
- package/frontend/{_virtual___federation_fn_import-BXODRNto.js → _virtual___federation_fn_import-D2E5es2p.js} +2 -4
- package/frontend/remoteEntry.js +3 -71
- package/frontend/style.css +3 -98
- package/package.json +20 -12
- package/dist/migrations.js +0 -466
- package/frontend/__federation_fn_import-DAGm_xmC.js +0 -2
package/dist/migrations.js
DELETED
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
20
|
-
|
|
21
|
-
// backend/migrations.ts
|
|
22
|
-
var migrations_exports = {};
|
|
23
|
-
__export(migrations_exports, {
|
|
24
|
-
AddWagoClaimIntent1780010600000: () => AddWagoClaimIntent1780010600000,
|
|
25
|
-
AddWagoCommissioningClaimDetails1780000000006: () => AddWagoCommissioningClaimDetails1780000000006,
|
|
26
|
-
AddWagoCommissioningDeliveryToken1780000000008: () => AddWagoCommissioningDeliveryToken1780000000008,
|
|
27
|
-
AddWagoCommissioningEnrollment1780000000005: () => AddWagoCommissioningEnrollment1780000000005,
|
|
28
|
-
AddWagoCommissioningPrincipal1780000000009: () => AddWagoCommissioningPrincipal1780000000009,
|
|
29
|
-
AddWagoCommissioningProgress1780000000007: () => AddWagoCommissioningProgress1780000000007,
|
|
30
|
-
AddWagoCommissioningSessions1780000000004: () => AddWagoCommissioningSessions1780000000004,
|
|
31
|
-
AddWagoConfigurationRevisions1780000000002: () => AddWagoConfigurationRevisions1780000000002,
|
|
32
|
-
AddWagoEnrollmentRevocation1780000000001: () => AddWagoEnrollmentRevocation1780000000001,
|
|
33
|
-
AddWagoPresetProvenance1780000000003: () => AddWagoPresetProvenance1780000000003,
|
|
34
|
-
AddWagoRejectionAcknowledgement1780010630000: () => AddWagoRejectionAcknowledgement1780010630000,
|
|
35
|
-
AddWagoRevisionEditorMetadata1780010580000: () => AddWagoRevisionEditorMetadata1780010580000,
|
|
36
|
-
CreateWagoControllers1780000000000: () => CreateWagoControllers1780000000000,
|
|
37
|
-
DropWagoCommissioningLease1780010640000: () => DropWagoCommissioningLease1780010640000,
|
|
38
|
-
WagoCommissioningLease1780000000011: () => WagoCommissioningLease1780000000011,
|
|
39
|
-
WagoCredentialRotation1780010610000: () => WagoCredentialRotation1780010610000,
|
|
40
|
-
WagoManagedUpdates1780010650000: () => WagoManagedUpdates1780010650000,
|
|
41
|
-
WagoManagement1780000000010: () => WagoManagement1780000000010,
|
|
42
|
-
WagoNetworkChanges1780010660000: () => WagoNetworkChanges1780010660000
|
|
43
|
-
});
|
|
44
|
-
module.exports = __toCommonJS(migrations_exports);
|
|
45
|
-
|
|
46
|
-
// backend/migrations/1780000000000-create-wago-controllers.ts
|
|
47
|
-
var CreateWagoControllers1780000000000 = class {
|
|
48
|
-
constructor() {
|
|
49
|
-
__publicField(this, "name", "CreateWagoControllers1780000000000");
|
|
50
|
-
}
|
|
51
|
-
async up(queryRunner) {
|
|
52
|
-
await queryRunner.query(`CREATE TABLE IF NOT EXISTS "plugin_wago_controllers" (
|
|
53
|
-
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "hardware_id" varchar NOT NULL,
|
|
54
|
-
"trust_state" varchar NOT NULL, "name" varchar, "mqtt_server_id" integer, "enrollment_id" integer,
|
|
55
|
-
"pairing_code_hash" varchar NOT NULL, "fingerprint" varchar,
|
|
56
|
-
"protocol_version" varchar NOT NULL, "runtime_version" varchar NOT NULL,
|
|
57
|
-
"capabilities" varchar NOT NULL, "last_sequence" integer NOT NULL DEFAULT (0),
|
|
58
|
-
"last_heartbeat_at" varchar, "last_seen_at" varchar NOT NULL,
|
|
59
|
-
"compatibility_error" varchar, "created_at" varchar NOT NULL, "updated_at" varchar NOT NULL,
|
|
60
|
-
CONSTRAINT "UQ_plugin_wago_controllers_hardware_id" UNIQUE ("hardware_id"))`);
|
|
61
|
-
await queryRunner.query(`CREATE TABLE IF NOT EXISTS "plugin_wago_settings" (
|
|
62
|
-
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "default_mqtt_server_id" integer)`);
|
|
63
|
-
await queryRunner.query(`CREATE TABLE IF NOT EXISTS "plugin_wago_enrollments" (
|
|
64
|
-
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "mqtt_server_id" integer NOT NULL, "hardware_id" varchar NOT NULL,
|
|
65
|
-
"secret_hash" varchar NOT NULL, "identity" varchar NOT NULL, "created_at" varchar NOT NULL,
|
|
66
|
-
"expires_at" varchar NOT NULL, "consumed_at" varchar, CONSTRAINT "UQ_plugin_wago_enrollments_secret_hash" UNIQUE ("secret_hash"))`);
|
|
67
|
-
await queryRunner.query(
|
|
68
|
-
'CREATE INDEX IF NOT EXISTS "IDX_plugin_wago_enrollments_active" ON "plugin_wago_enrollments" ("consumed_at", "expires_at")'
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
async down(queryRunner) {
|
|
72
|
-
await queryRunner.query('DROP INDEX IF EXISTS "IDX_plugin_wago_enrollments_active"');
|
|
73
|
-
await queryRunner.query('DROP TABLE "plugin_wago_enrollments"');
|
|
74
|
-
await queryRunner.query('DROP TABLE "plugin_wago_settings"');
|
|
75
|
-
await queryRunner.query('DROP TABLE "plugin_wago_controllers"');
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
// backend/migrations/1780000000001-add-wago-enrollment-revocation.ts
|
|
80
|
-
var AddWagoEnrollmentRevocation1780000000001 = class {
|
|
81
|
-
constructor() {
|
|
82
|
-
__publicField(this, "name", "AddWagoEnrollmentRevocation1780000000001");
|
|
83
|
-
}
|
|
84
|
-
async up(queryRunner) {
|
|
85
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_enrollments" ADD COLUMN "revoked_at" varchar');
|
|
86
|
-
}
|
|
87
|
-
async down(queryRunner) {
|
|
88
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_enrollments" DROP COLUMN "revoked_at"');
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// backend/migrations/1780000000002-add-wago-configuration-revisions.ts
|
|
93
|
-
var AddWagoConfigurationRevisions1780000000002 = class {
|
|
94
|
-
constructor() {
|
|
95
|
-
__publicField(this, "name", "AddWagoConfigurationRevisions1780000000002");
|
|
96
|
-
}
|
|
97
|
-
async up(queryRunner) {
|
|
98
|
-
await queryRunner.query(
|
|
99
|
-
`ALTER TABLE "plugin_wago_settings" ADD COLUMN "operational_prefix" varchar NOT NULL DEFAULT ('attraccess/wago')`
|
|
100
|
-
);
|
|
101
|
-
await queryRunner.query(`CREATE TABLE "plugin_wago_configuration_drafts" (
|
|
102
|
-
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "controller_id" integer NOT NULL,
|
|
103
|
-
"snapshot" text NOT NULL, "reviewed_hash" varchar, "updated_at" varchar NOT NULL,
|
|
104
|
-
CONSTRAINT "UQ_plugin_wago_configuration_drafts_controller_id" UNIQUE ("controller_id"))`);
|
|
105
|
-
await queryRunner.query(`CREATE TABLE "plugin_wago_configuration_revisions" (
|
|
106
|
-
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "controller_id" integer NOT NULL,
|
|
107
|
-
"revision" integer NOT NULL, "snapshot" text NOT NULL, "content_hash" varchar NOT NULL,
|
|
108
|
-
"state" varchar NOT NULL, "rejection_errors" text, "published_at" varchar NOT NULL, "reported_at" varchar,
|
|
109
|
-
CONSTRAINT "UQ_plugin_wago_configuration_revisions_controller_revision" UNIQUE ("controller_id", "revision"))`);
|
|
110
|
-
await queryRunner.query(
|
|
111
|
-
'CREATE INDEX "IDX_plugin_wago_configuration_revisions_controller" ON "plugin_wago_configuration_revisions" ("controller_id", "revision")'
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
async down(queryRunner) {
|
|
115
|
-
await queryRunner.query('DROP INDEX "IDX_plugin_wago_configuration_revisions_controller"');
|
|
116
|
-
await queryRunner.query('DROP TABLE "plugin_wago_configuration_revisions"');
|
|
117
|
-
await queryRunner.query('DROP TABLE "plugin_wago_configuration_drafts"');
|
|
118
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_settings" DROP COLUMN "operational_prefix"');
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// backend/migrations/1780000000003-add-wago-preset-provenance.ts
|
|
123
|
-
var AddWagoPresetProvenance1780000000003 = class {
|
|
124
|
-
constructor() {
|
|
125
|
-
__publicField(this, "name", "AddWagoPresetProvenance1780000000003");
|
|
126
|
-
}
|
|
127
|
-
async up(queryRunner) {
|
|
128
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_configuration_drafts" ADD COLUMN "preset_provenance" text');
|
|
129
|
-
}
|
|
130
|
-
async down(queryRunner) {
|
|
131
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_configuration_drafts" DROP COLUMN "preset_provenance"');
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// backend/migrations/1780000000004-add-wago-commissioning-sessions.ts
|
|
136
|
-
var AddWagoCommissioningSessions1780000000004 = class {
|
|
137
|
-
constructor() {
|
|
138
|
-
__publicField(this, "name", "AddWagoCommissioningSessions1780000000004");
|
|
139
|
-
}
|
|
140
|
-
async up(queryRunner) {
|
|
141
|
-
await queryRunner.query(`CREATE TABLE IF NOT EXISTS "plugin_wago_commissioning_sessions" (
|
|
142
|
-
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "hardware_id" varchar NOT NULL,
|
|
143
|
-
"mqtt_server_id" integer NOT NULL, "target_host" varchar NOT NULL,
|
|
144
|
-
"host_key_fingerprint" varchar NOT NULL, "firmware_baseline" varchar NOT NULL,
|
|
145
|
-
"state" varchar NOT NULL, "enrollment_expires_at" varchar, "codesys_state" varchar,
|
|
146
|
-
"audit_log" varchar NOT NULL, "failure_reason" varchar,
|
|
147
|
-
"created_at" varchar NOT NULL, "updated_at" varchar NOT NULL
|
|
148
|
-
)`);
|
|
149
|
-
}
|
|
150
|
-
async down(queryRunner) {
|
|
151
|
-
await queryRunner.query('DROP TABLE "plugin_wago_commissioning_sessions"');
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// backend/migrations/1780000000005-add-wago-commissioning-enrollment.ts
|
|
156
|
-
var AddWagoCommissioningEnrollment1780000000005 = class {
|
|
157
|
-
constructor() {
|
|
158
|
-
__publicField(this, "name", "AddWagoCommissioningEnrollment1780000000005");
|
|
159
|
-
}
|
|
160
|
-
async up(queryRunner) {
|
|
161
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "enrollment_id" integer');
|
|
162
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "pairing_code" varchar');
|
|
163
|
-
}
|
|
164
|
-
async down(queryRunner) {
|
|
165
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "pairing_code"');
|
|
166
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "enrollment_id"');
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
// backend/migrations/1780000000006-add-wago-commissioning-claim-details.ts
|
|
171
|
-
var AddWagoCommissioningClaimDetails1780000000006 = class {
|
|
172
|
-
constructor() {
|
|
173
|
-
__publicField(this, "name", "AddWagoCommissioningClaimDetails1780000000006");
|
|
174
|
-
}
|
|
175
|
-
async up(queryRunner) {
|
|
176
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "controller_name" varchar');
|
|
177
|
-
}
|
|
178
|
-
async down(queryRunner) {
|
|
179
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "controller_name"');
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
// backend/migrations/1780000000007-add-wago-commissioning-progress.ts
|
|
184
|
-
var AddWagoCommissioningProgress1780000000007 = class {
|
|
185
|
-
constructor() {
|
|
186
|
-
__publicField(this, "name", "AddWagoCommissioningProgress1780000000007");
|
|
187
|
-
}
|
|
188
|
-
async up(queryRunner) {
|
|
189
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "progress_percent" integer');
|
|
190
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "progress_step" varchar');
|
|
191
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "progress_detail" varchar');
|
|
192
|
-
}
|
|
193
|
-
async down(queryRunner) {
|
|
194
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "progress_detail"');
|
|
195
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "progress_step"');
|
|
196
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "progress_percent"');
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
// backend/migrations/1780000000008-add-wago-commissioning-delivery-token.ts
|
|
201
|
-
var AddWagoCommissioningDeliveryToken1780000000008 = class {
|
|
202
|
-
constructor() {
|
|
203
|
-
__publicField(this, "name", "AddWagoCommissioningDeliveryToken1780000000008");
|
|
204
|
-
}
|
|
205
|
-
async up(queryRunner) {
|
|
206
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "delivery_token" varchar');
|
|
207
|
-
}
|
|
208
|
-
async down(queryRunner) {
|
|
209
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "delivery_token"');
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
// backend/migrations/1780000000009-add-wago-commissioning-principal.ts
|
|
214
|
-
var AddWagoCommissioningPrincipal1780000000009 = class {
|
|
215
|
-
async up(queryRunner) {
|
|
216
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "initiating_principal" text');
|
|
217
|
-
await queryRunner.query(
|
|
218
|
-
'ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "runtime_artifact_digest" varchar'
|
|
219
|
-
);
|
|
220
|
-
await queryRunner.query(
|
|
221
|
-
'ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "management_controller_id" integer'
|
|
222
|
-
);
|
|
223
|
-
await queryRunner.query(
|
|
224
|
-
'ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "docker_provision_token" varchar'
|
|
225
|
-
);
|
|
226
|
-
await queryRunner.query(
|
|
227
|
-
'ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "docker_provision_state" varchar'
|
|
228
|
-
);
|
|
229
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" ADD COLUMN "platform_report" text');
|
|
230
|
-
}
|
|
231
|
-
async down(queryRunner) {
|
|
232
|
-
const rows = await queryRunner.query('SELECT COUNT(*) AS count FROM "plugin_wago_commissioning_sessions" WHERE "docker_provision_token" IS NOT NULL');
|
|
233
|
-
if (Number(rows[0].count) !== 0) throw new Error("Recover Docker provisioning before removing its saved ownership tokens");
|
|
234
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "initiating_principal"');
|
|
235
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "runtime_artifact_digest"');
|
|
236
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "management_controller_id"');
|
|
237
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "docker_provision_token"');
|
|
238
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "docker_provision_state"');
|
|
239
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_commissioning_sessions" DROP COLUMN "platform_report"');
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
// backend/management/migration.ts
|
|
244
|
-
var WagoManagement1780000000010 = class {
|
|
245
|
-
constructor() {
|
|
246
|
-
__publicField(this, "name", "WagoManagement1780000000010");
|
|
247
|
-
}
|
|
248
|
-
async up(queryRunner) {
|
|
249
|
-
await queryRunner.query(`CREATE TABLE "plugin_wago_management" (
|
|
250
|
-
"controller_id" integer PRIMARY KEY NOT NULL,
|
|
251
|
-
"metadata_json" text,
|
|
252
|
-
"encrypted_private_key" text,
|
|
253
|
-
"lease_owner" varchar,
|
|
254
|
-
"lease_until" bigint NOT NULL DEFAULT 0
|
|
255
|
-
)`);
|
|
256
|
-
}
|
|
257
|
-
async down(queryRunner) {
|
|
258
|
-
const rows = await queryRunner.query(
|
|
259
|
-
'SELECT COUNT(*) AS count FROM "plugin_wago_management" WHERE "encrypted_private_key" IS NOT NULL OR "lease_owner" IS NOT NULL'
|
|
260
|
-
);
|
|
261
|
-
if (Number(rows[0].count) !== 0)
|
|
262
|
-
throw new Error("Recover management transitions before removing management storage");
|
|
263
|
-
await queryRunner.query('DROP TABLE "plugin_wago_management"');
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// backend/commissioning/sessions/lease.migration.ts
|
|
268
|
-
var WagoCommissioningLease1780000000011 = class {
|
|
269
|
-
constructor() {
|
|
270
|
-
__publicField(this, "name", "WagoCommissioningLease1780000000011");
|
|
271
|
-
}
|
|
272
|
-
async up(queryRunner) {
|
|
273
|
-
await queryRunner.query(`CREATE TABLE "plugin_wago_commissioning_lease" (
|
|
274
|
-
"fingerprint_hash" varchar(64) PRIMARY KEY NOT NULL,
|
|
275
|
-
"owner" varchar NOT NULL,
|
|
276
|
-
"lease_until" bigint NOT NULL,
|
|
277
|
-
"operation_until" bigint NOT NULL,
|
|
278
|
-
"recovery_after" bigint NOT NULL
|
|
279
|
-
)`);
|
|
280
|
-
}
|
|
281
|
-
async down(queryRunner) {
|
|
282
|
-
const rows = await queryRunner.query('SELECT COUNT(*) AS count FROM "plugin_wago_commissioning_lease"');
|
|
283
|
-
if (Number(rows[0].count) !== 0) throw new Error("Recover commissioning leases before removing lease storage");
|
|
284
|
-
await queryRunner.query('DROP TABLE "plugin_wago_commissioning_lease"');
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
// backend/credentials/migration.ts
|
|
289
|
-
var WagoCredentialRotation1780010610000 = class {
|
|
290
|
-
constructor() {
|
|
291
|
-
__publicField(this, "name", "WagoCredentialRotation1780010610000");
|
|
292
|
-
}
|
|
293
|
-
async up(queryRunner) {
|
|
294
|
-
const controllerColumns = await queryRunner.query('PRAGMA table_info("plugin_wago_controllers")');
|
|
295
|
-
if (!controllerColumns.some((column) => column.name === "credential_epoch"))
|
|
296
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_controllers" ADD COLUMN "credential_epoch" varchar');
|
|
297
|
-
const tables = await queryRunner.query(
|
|
298
|
-
"SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'plugin_wago_credential_rotations'"
|
|
299
|
-
);
|
|
300
|
-
if (!tables.length)
|
|
301
|
-
await queryRunner.query(`CREATE TABLE "plugin_wago_credential_rotations" (
|
|
302
|
-
"controller_id" integer PRIMARY KEY NOT NULL REFERENCES "plugin_wago_controllers"("id") ON DELETE CASCADE,
|
|
303
|
-
"revision" integer NOT NULL,
|
|
304
|
-
"credential_epoch" varchar NOT NULL,
|
|
305
|
-
"phase" varchar NOT NULL,
|
|
306
|
-
"mqtt_server_id" integer NOT NULL,
|
|
307
|
-
"prefix" varchar NOT NULL,
|
|
308
|
-
"token" varchar NOT NULL,
|
|
309
|
-
"encrypted_credentials" text
|
|
310
|
-
)`);
|
|
311
|
-
}
|
|
312
|
-
async down(queryRunner) {
|
|
313
|
-
const rows = await queryRunner.query('SELECT COUNT(*) AS count FROM "plugin_wago_credential_rotations"');
|
|
314
|
-
if (Number(rows[0].count))
|
|
315
|
-
throw new Error("Remove controller registrations before removing credential rotation history");
|
|
316
|
-
await queryRunner.query('DROP TABLE "plugin_wago_credential_rotations"');
|
|
317
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_controllers" DROP COLUMN "credential_epoch"');
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
// backend/migrations/1780010580000-add-wago-revision-editor-metadata.ts
|
|
322
|
-
var AddWagoRevisionEditorMetadata1780010580000 = class {
|
|
323
|
-
constructor() {
|
|
324
|
-
__publicField(this, "name", "AddWagoRevisionEditorMetadata1780010580000");
|
|
325
|
-
}
|
|
326
|
-
async up(queryRunner) {
|
|
327
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_configuration_revisions" ADD COLUMN "preset_provenance" text');
|
|
328
|
-
}
|
|
329
|
-
async down(queryRunner) {
|
|
330
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_configuration_revisions" DROP COLUMN "preset_provenance"');
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
// backend/migrations/1780010600000-add-wago-claim-intent.ts
|
|
335
|
-
var AddWagoClaimIntent1780010600000 = class {
|
|
336
|
-
constructor() {
|
|
337
|
-
__publicField(this, "name", "AddWagoClaimIntent1780010600000");
|
|
338
|
-
}
|
|
339
|
-
async up(queryRunner) {
|
|
340
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_controllers" ADD COLUMN "credential_mqtt_server_id" integer');
|
|
341
|
-
}
|
|
342
|
-
async down(queryRunner) {
|
|
343
|
-
const rows = await queryRunner.query(
|
|
344
|
-
'SELECT 1 FROM "plugin_wago_controllers" WHERE "credential_mqtt_server_id" IS NOT NULL LIMIT 1'
|
|
345
|
-
);
|
|
346
|
-
if (rows.length) throw new Error("Revoke tracked WAGO credentials before removing claim recovery metadata.");
|
|
347
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_controllers" DROP COLUMN "credential_mqtt_server_id"');
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
// backend/migrations/1780010630000-add-wago-rejection-acknowledgement.ts
|
|
352
|
-
var AddWagoRejectionAcknowledgement1780010630000 = class {
|
|
353
|
-
constructor() {
|
|
354
|
-
__publicField(this, "name", "AddWagoRejectionAcknowledgement1780010630000");
|
|
355
|
-
}
|
|
356
|
-
async up(queryRunner) {
|
|
357
|
-
await queryRunner.query(
|
|
358
|
-
'ALTER TABLE "plugin_wago_configuration_revisions" ADD COLUMN "rejection_acknowledged_at" varchar'
|
|
359
|
-
);
|
|
360
|
-
await queryRunner.query(
|
|
361
|
-
'ALTER TABLE "plugin_wago_configuration_revisions" ADD COLUMN "rejection_acknowledged_by" integer'
|
|
362
|
-
);
|
|
363
|
-
}
|
|
364
|
-
async down(queryRunner) {
|
|
365
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_configuration_revisions" DROP COLUMN "rejection_acknowledged_by"');
|
|
366
|
-
await queryRunner.query('ALTER TABLE "plugin_wago_configuration_revisions" DROP COLUMN "rejection_acknowledged_at"');
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
// backend/migrations/1780010640000-drop-wago-commissioning-lease.ts
|
|
371
|
-
var DropWagoCommissioningLease1780010640000 = class {
|
|
372
|
-
constructor() {
|
|
373
|
-
__publicField(this, "name", "DropWagoCommissioningLease1780010640000");
|
|
374
|
-
}
|
|
375
|
-
async up(queryRunner) {
|
|
376
|
-
await queryRunner.query('DROP TABLE IF EXISTS "plugin_wago_commissioning_lease"');
|
|
377
|
-
}
|
|
378
|
-
async down(queryRunner) {
|
|
379
|
-
await queryRunner.query(`CREATE TABLE "plugin_wago_commissioning_lease" (
|
|
380
|
-
"fingerprint_hash" varchar(64) PRIMARY KEY NOT NULL,
|
|
381
|
-
"owner" varchar NOT NULL,
|
|
382
|
-
"lease_until" bigint NOT NULL,
|
|
383
|
-
"operation_until" bigint NOT NULL,
|
|
384
|
-
"recovery_after" bigint NOT NULL
|
|
385
|
-
)`);
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
// backend/migrations/1780010650000-add-wago-managed-updates.ts
|
|
390
|
-
var WagoManagedUpdates1780010650000 = class {
|
|
391
|
-
constructor() {
|
|
392
|
-
__publicField(this, "name", "WagoManagedUpdates1780010650000");
|
|
393
|
-
}
|
|
394
|
-
async up(runner) {
|
|
395
|
-
await runner.query(`CREATE TABLE "plugin_wago_managed_access" (
|
|
396
|
-
"session_id" integer PRIMARY KEY NOT NULL, "controller_id" integer,
|
|
397
|
-
"host" varchar NOT NULL, "fingerprint" varchar NOT NULL, "token" varchar NOT NULL,
|
|
398
|
-
"state" varchar NOT NULL, "encrypted_credentials" text NOT NULL, "key_fingerprint" varchar NOT NULL
|
|
399
|
-
)`);
|
|
400
|
-
await runner.query('CREATE INDEX "wago_managed_controller" ON "plugin_wago_managed_access" ("controller_id")');
|
|
401
|
-
await runner.query(
|
|
402
|
-
'CREATE TABLE "plugin_wago_runtime_updates" ("controller_id" integer PRIMARY KEY NOT NULL, "metadata" text)'
|
|
403
|
-
);
|
|
404
|
-
await runner.query(
|
|
405
|
-
'CREATE TABLE "plugin_wago_device_operations" ("fingerprint" varchar PRIMARY KEY NOT NULL, "owner" varchar, "lease_until" bigint NOT NULL DEFAULT 0)'
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
async down(runner) {
|
|
409
|
-
const rows = await runner.query('SELECT COUNT(*) AS count FROM "plugin_wago_managed_access"');
|
|
410
|
-
if (Number(rows[0].count)) throw new Error("Retire managed controller credentials before removing their storage");
|
|
411
|
-
await runner.query('DROP TABLE "plugin_wago_device_operations"');
|
|
412
|
-
await runner.query('DROP TABLE "plugin_wago_runtime_updates"');
|
|
413
|
-
await runner.query('DROP TABLE "plugin_wago_managed_access"');
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
// backend/migrations/1780010660000-add-wago-network-changes.ts
|
|
418
|
-
var WagoNetworkChanges1780010660000 = class {
|
|
419
|
-
constructor() {
|
|
420
|
-
__publicField(this, "name", "WagoNetworkChanges1780010660000");
|
|
421
|
-
}
|
|
422
|
-
async up(runner) {
|
|
423
|
-
await runner.query(`CREATE TABLE "plugin_wago_network_changes" (
|
|
424
|
-
"controller_id" integer PRIMARY KEY NOT NULL REFERENCES "plugin_wago_controllers"("id") ON DELETE CASCADE,
|
|
425
|
-
"session_id" integer NOT NULL, "fingerprint" varchar NOT NULL, "target_host" varchar NOT NULL,
|
|
426
|
-
"mqtt_server_id" integer, "phase" varchar NOT NULL, "failure" varchar,
|
|
427
|
-
"encrypted_payload" text, "updated_at" varchar NOT NULL
|
|
428
|
-
)`);
|
|
429
|
-
await runner.query(`CREATE TABLE "plugin_wago_mqtt_credential_retirements" (
|
|
430
|
-
"controller_id" integer NOT NULL REFERENCES "plugin_wago_controllers"("id") ON DELETE CASCADE,
|
|
431
|
-
"mqtt_server_id" integer NOT NULL, PRIMARY KEY ("controller_id", "mqtt_server_id")
|
|
432
|
-
)`);
|
|
433
|
-
}
|
|
434
|
-
async down(runner) {
|
|
435
|
-
const rows = await runner.query('SELECT COUNT(*) AS count FROM "plugin_wago_network_changes" WHERE phase != ?', [
|
|
436
|
-
"completed"
|
|
437
|
-
]);
|
|
438
|
-
if (Number(rows[0].count)) throw new Error("Finish controller network changes before removing recovery storage");
|
|
439
|
-
const retirements = await runner.query('SELECT COUNT(*) AS count FROM "plugin_wago_mqtt_credential_retirements"');
|
|
440
|
-
if (Number(retirements[0].count)) throw new Error("Retire old broker credentials before removing their records");
|
|
441
|
-
await runner.query('DROP TABLE "plugin_wago_mqtt_credential_retirements"');
|
|
442
|
-
await runner.query('DROP TABLE "plugin_wago_network_changes"');
|
|
443
|
-
}
|
|
444
|
-
};
|
|
445
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
446
|
-
0 && (module.exports = {
|
|
447
|
-
AddWagoClaimIntent1780010600000,
|
|
448
|
-
AddWagoCommissioningClaimDetails1780000000006,
|
|
449
|
-
AddWagoCommissioningDeliveryToken1780000000008,
|
|
450
|
-
AddWagoCommissioningEnrollment1780000000005,
|
|
451
|
-
AddWagoCommissioningPrincipal1780000000009,
|
|
452
|
-
AddWagoCommissioningProgress1780000000007,
|
|
453
|
-
AddWagoCommissioningSessions1780000000004,
|
|
454
|
-
AddWagoConfigurationRevisions1780000000002,
|
|
455
|
-
AddWagoEnrollmentRevocation1780000000001,
|
|
456
|
-
AddWagoPresetProvenance1780000000003,
|
|
457
|
-
AddWagoRejectionAcknowledgement1780010630000,
|
|
458
|
-
AddWagoRevisionEditorMetadata1780010580000,
|
|
459
|
-
CreateWagoControllers1780000000000,
|
|
460
|
-
DropWagoCommissioningLease1780010640000,
|
|
461
|
-
WagoCommissioningLease1780000000011,
|
|
462
|
-
WagoCredentialRotation1780010610000,
|
|
463
|
-
WagoManagedUpdates1780010650000,
|
|
464
|
-
WagoManagement1780000000010,
|
|
465
|
-
WagoNetworkChanges1780010660000
|
|
466
|
-
});
|