@futo-org/backups-orchestrator-api 0.45.0 → 0.46.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/dist/controllers/config.controller.d.ts +8 -0
- package/dist/controllers/config.controller.js +52 -0
- package/dist/controllers/config.controller.js.map +1 -0
- package/dist/controllers/integrations.controller.d.ts +3 -1
- package/dist/controllers/integrations.controller.js +19 -0
- package/dist/controllers/integrations.controller.js.map +1 -1
- package/dist/dto/config.dto.d.ts +24 -0
- package/dist/dto/config.dto.js +26 -0
- package/dist/dto/config.dto.js.map +1 -0
- package/dist/dto/integrations.dto.d.ts +17 -0
- package/dist/dto/integrations.dto.js +18 -1
- package/dist/dto/integrations.dto.js.map +1 -1
- package/dist/enum.d.ts +4 -1
- package/dist/enum.js +3 -0
- package/dist/enum.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/moduleConfig.d.ts +10 -1
- package/dist/moduleConfig.js.map +1 -1
- package/dist/orchestrationApi.module.d.ts +4 -2
- package/dist/orchestrationApi.module.js +4 -0
- package/dist/orchestrationApi.module.js.map +1 -1
- package/dist/proxy/resticProxy.d.ts +8 -1
- package/dist/proxy/resticProxy.js +13 -4
- package/dist/proxy/resticProxy.js.map +1 -1
- package/dist/proxy/resticProxyPool.d.ts +11 -3
- package/dist/proxy/resticProxyPool.js +35 -4
- package/dist/proxy/resticProxyPool.js.map +1 -1
- package/dist/repositories/config.repository.d.ts +6 -0
- package/dist/repositories/config.repository.js +26 -6
- package/dist/repositories/config.repository.js.map +1 -1
- package/dist/services/bootstrap.service.d.ts +3 -1
- package/dist/services/bootstrap.service.js +6 -1
- package/dist/services/bootstrap.service.js.map +1 -1
- package/dist/services/config.service.d.ts +11 -0
- package/dist/services/config.service.js +46 -0
- package/dist/services/config.service.js.map +1 -0
- package/dist/services/integrations.service.d.ts +6 -2
- package/dist/services/integrations.service.js +22 -3
- package/dist/services/integrations.service.js.map +1 -1
- package/dist/services/repository.service.js +14 -1
- package/dist/services/repository.service.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,15 +5,29 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
8
11
|
var ResticProxyPool_1;
|
|
9
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
13
|
exports.ResticProxyPool = void 0;
|
|
11
14
|
const common_1 = require("@nestjs/common");
|
|
15
|
+
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
16
|
+
const enum_1 = require("../enum");
|
|
17
|
+
const moduleConfig_repository_1 = require("../repositories/moduleConfig.repository");
|
|
12
18
|
const resticProxy_1 = require("./resticProxy");
|
|
13
19
|
let ResticProxyPool = class ResticProxyPool {
|
|
14
20
|
static { ResticProxyPool_1 = this; }
|
|
21
|
+
moduleConfig;
|
|
15
22
|
static pool = new Map();
|
|
16
23
|
static available;
|
|
24
|
+
static throttle = resticProxy_1.UNTHROTTLED;
|
|
25
|
+
constructor(moduleConfig) {
|
|
26
|
+
this.moduleConfig = moduleConfig;
|
|
27
|
+
}
|
|
28
|
+
onApplicationBootstrap() {
|
|
29
|
+
ResticProxyPool_1.throttle = this.moduleConfig?.get().throttle ?? resticProxy_1.UNTHROTTLED;
|
|
30
|
+
}
|
|
17
31
|
isAvailable() {
|
|
18
32
|
ResticProxyPool_1.available ??= resticProxy_1.ResticProxy.isAvailable();
|
|
19
33
|
return ResticProxyPool_1.available;
|
|
@@ -23,7 +37,7 @@ let ResticProxyPool = class ResticProxyPool {
|
|
|
23
37
|
if (existing) {
|
|
24
38
|
return existing;
|
|
25
39
|
}
|
|
26
|
-
const pending = resticProxy_1.ResticProxy.create(apiUrl).then((proxy) => {
|
|
40
|
+
const pending = resticProxy_1.ResticProxy.create(apiUrl, ResticProxyPool_1.throttle).then((proxy) => {
|
|
27
41
|
proxy.process.once('exit', () => ResticProxyPool_1.pool.delete(apiUrl));
|
|
28
42
|
return proxy;
|
|
29
43
|
});
|
|
@@ -31,14 +45,31 @@ let ResticProxyPool = class ResticProxyPool {
|
|
|
31
45
|
ResticProxyPool_1.pool.set(apiUrl, pending);
|
|
32
46
|
return pending;
|
|
33
47
|
}
|
|
48
|
+
async onModuleConfigUpdate({ throttle }) {
|
|
49
|
+
ResticProxyPool_1.throttle = throttle ?? resticProxy_1.UNTHROTTLED;
|
|
50
|
+
const running = await this.running();
|
|
51
|
+
for (const proxy of running) {
|
|
52
|
+
proxy.throttle(ResticProxyPool_1.throttle);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
34
55
|
async onApplicationShutdown() {
|
|
35
|
-
const
|
|
36
|
-
const running = outcomes.filter((outcome) => outcome.status === 'fulfilled').map((outcome) => outcome.value);
|
|
56
|
+
const running = await this.running();
|
|
37
57
|
await Promise.all(running.map((proxy) => proxy.stop()));
|
|
38
58
|
}
|
|
59
|
+
async running() {
|
|
60
|
+
const outcomes = await Promise.allSettled(ResticProxyPool_1.pool.values());
|
|
61
|
+
return outcomes.filter((outcome) => outcome.status === 'fulfilled').map((outcome) => outcome.value);
|
|
62
|
+
}
|
|
39
63
|
};
|
|
40
64
|
exports.ResticProxyPool = ResticProxyPool;
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, event_emitter_1.OnEvent)(enum_1.InternalEvent.ModuleConfigUpdated),
|
|
67
|
+
__metadata("design:type", Function),
|
|
68
|
+
__metadata("design:paramtypes", [Object]),
|
|
69
|
+
__metadata("design:returntype", Promise)
|
|
70
|
+
], ResticProxyPool.prototype, "onModuleConfigUpdate", null);
|
|
41
71
|
exports.ResticProxyPool = ResticProxyPool = ResticProxyPool_1 = __decorate([
|
|
42
|
-
(0, common_1.Injectable)()
|
|
72
|
+
(0, common_1.Injectable)(),
|
|
73
|
+
__metadata("design:paramtypes", [moduleConfig_repository_1.ModuleConfigRepository])
|
|
43
74
|
], ResticProxyPool);
|
|
44
75
|
//# sourceMappingURL=resticProxyPool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resticProxyPool.js","sourceRoot":"","sources":["../../src/proxy/resticProxyPool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resticProxyPool.js","sourceRoot":"","sources":["../../src/proxy/resticProxyPool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA2F;AAC3F,yDAAgD;AAChD,kCAAwC;AAExC,qFAAiF;AACjF,+CAA8E;AAGvE,IAAM,eAAe,GAArB,MAAM,eAAe;;IAKG;IAJ7B,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,EAAgC,CAAC;IACtD,MAAM,CAAC,SAAS,CAA+B;IAC/C,MAAM,CAAC,QAAQ,GAAwB,yBAAW,CAAC;IAEnD,YAA6B,YAAqC;QAArC,iBAAY,GAAZ,YAAY,CAAyB;IAAG,CAAC;IAEtE,sBAAsB;QACpB,iBAAe,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,IAAI,yBAAW,CAAC;IAC9E,CAAC;IAED,WAAW;QACT,iBAAe,CAAC,SAAS,KAAK,yBAAW,CAAC,WAAW,EAAE,CAAC;QACxD,OAAO,iBAAe,CAAC,SAAS,CAAC;IACnC,CAAC;IAED,QAAQ,CAAC,MAAc;QACrB,MAAM,QAAQ,GAAG,iBAAe,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,OAAO,GAAG,yBAAW,CAAC,MAAM,C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AAO,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtG,CAAC;;AAnDU,0CAAe;AAkCpB;IADL,IAAA,uBAAO,EAAC,oBAAa,CAAC,mBAAmB,CAAC;;;;2DAQ1C;0BAzCU,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCAMiC,gDAAsB;GALvD,eAAe,CAoD3B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Kysely } from 'kysely';
|
|
2
2
|
import { type ModuleConfig } from '../moduleConfig';
|
|
3
|
+
import type { ResticProxyThrottle } from '../proxy/resticProxy';
|
|
3
4
|
import { DB } from '../schema';
|
|
4
5
|
import { LoggingRepository } from './logging.repository';
|
|
5
6
|
export type ResticPlacement = {
|
|
@@ -20,6 +21,7 @@ export declare class ConfigRepository {
|
|
|
20
21
|
private assertStateIsEmpty;
|
|
21
22
|
private recordStatePath;
|
|
22
23
|
private set;
|
|
24
|
+
private setAll;
|
|
23
25
|
private get;
|
|
24
26
|
private getOptional;
|
|
25
27
|
private has;
|
|
@@ -33,8 +35,12 @@ export declare class ConfigRepository {
|
|
|
33
35
|
enableTelemetry(): Promise<void>;
|
|
34
36
|
hasSkippedExtraConfig(): Promise<boolean>;
|
|
35
37
|
skipExtraConfig(): Promise<void>;
|
|
38
|
+
hasIgnoredImmichDatabaseDumpWarning(): Promise<boolean>;
|
|
39
|
+
ignoreImmichDatabaseDumpWarning(): Promise<void>;
|
|
36
40
|
hasSessionSecret(): Promise<boolean>;
|
|
37
41
|
getSessionSecret(): Promise<Buffer>;
|
|
42
|
+
getThrottle(): Promise<ResticProxyThrottle | undefined>;
|
|
43
|
+
setThrottle({ bytesPerSec, quietHours }: ResticProxyThrottle): Promise<void>;
|
|
38
44
|
getResticOptions(placement: ResticPlacement): Promise<{
|
|
39
45
|
connections: number;
|
|
40
46
|
packSizeMib: number | undefined;
|
|
@@ -82,14 +82,14 @@ let ConfigRepository = ConfigRepository_1 = class ConfigRepository {
|
|
|
82
82
|
await this.set(enum_1.ConfigurationKey.StatePath, statePath);
|
|
83
83
|
}
|
|
84
84
|
async set(key, value) {
|
|
85
|
+
await this.setAll({ [key]: value });
|
|
86
|
+
}
|
|
87
|
+
async setAll(values) {
|
|
85
88
|
await this.db
|
|
86
89
|
.insertInto('config')
|
|
87
|
-
.values({
|
|
88
|
-
key
|
|
89
|
-
|
|
90
|
-
})
|
|
91
|
-
.onConflict((oc) => oc.doUpdateSet({ value }))
|
|
92
|
-
.executeTakeFirstOrThrow();
|
|
90
|
+
.values(Object.entries(values).map(([key, value]) => ({ key, value })))
|
|
91
|
+
.onConflict((oc) => oc.column('key').doUpdateSet((eb) => ({ value: eb.ref('excluded.value') })))
|
|
92
|
+
.execute();
|
|
93
93
|
}
|
|
94
94
|
async get(key) {
|
|
95
95
|
const { value } = await this.db
|
|
@@ -149,12 +149,32 @@ let ConfigRepository = ConfigRepository_1 = class ConfigRepository {
|
|
|
149
149
|
async skipExtraConfig() {
|
|
150
150
|
return this.set(enum_1.ConfigurationKey.SkippedOnboardingExtraConfig, '1');
|
|
151
151
|
}
|
|
152
|
+
async hasIgnoredImmichDatabaseDumpWarning() {
|
|
153
|
+
return this.has(enum_1.ConfigurationKey.IgnoredImmichDatabaseDumpWarning);
|
|
154
|
+
}
|
|
155
|
+
async ignoreImmichDatabaseDumpWarning() {
|
|
156
|
+
return this.set(enum_1.ConfigurationKey.IgnoredImmichDatabaseDumpWarning, '1');
|
|
157
|
+
}
|
|
152
158
|
async hasSessionSecret() {
|
|
153
159
|
return this.has(enum_1.ConfigurationKey.SessionSecret);
|
|
154
160
|
}
|
|
155
161
|
async getSessionSecret() {
|
|
156
162
|
return Buffer.from(await this.get(enum_1.ConfigurationKey.SessionSecret), 'hex');
|
|
157
163
|
}
|
|
164
|
+
async getThrottle() {
|
|
165
|
+
const bytesPerSec = await this.getOptional(enum_1.ConfigurationKey.ThrottleBytesPerSec);
|
|
166
|
+
if (bytesPerSec === undefined) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const quietHours = await this.getOptional(enum_1.ConfigurationKey.ThrottleQuietHours);
|
|
170
|
+
return { bytesPerSec: Number.parseInt(bytesPerSec), quietHours: quietHours || undefined };
|
|
171
|
+
}
|
|
172
|
+
async setThrottle({ bytesPerSec, quietHours }) {
|
|
173
|
+
await this.setAll({
|
|
174
|
+
[enum_1.ConfigurationKey.ThrottleBytesPerSec]: String(bytesPerSec),
|
|
175
|
+
[enum_1.ConfigurationKey.ThrottleQuietHours]: quietHours ?? '',
|
|
176
|
+
});
|
|
177
|
+
}
|
|
158
178
|
async getResticOptions(placement) {
|
|
159
179
|
const siteCode = placement.siteCode ?? undefined;
|
|
160
180
|
const clusterCode = placement.storageClusterCode ?? undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.repository.js","sourceRoot":"","sources":["../../src/repositories/config.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAAgC;AAChC,iDAA6C;AAC7C,6CAA0C;AAC1C,qCAA+C;AAC/C,yCAAoC;AACpC,kCAA2C;AAC3C,kDAA0E;
|
|
1
|
+
{"version":3,"file":"config.repository.js","sourceRoot":"","sources":["../../src/repositories/config.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,mCAAgC;AAChC,iDAA6C;AAC7C,6CAA0C;AAC1C,qCAA+C;AAC/C,yCAAoC;AACpC,kCAA2C;AAC3C,kDAA0E;AAG1E,4CAA8C;AAC9C,6DAAyD;AAKlD,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAEa;IACA;IACrB;IAHnB,YACwC,EAAc,EACd,YAA0B,EAC/C,MAAyB;QAFJ,OAAE,GAAF,EAAE,CAAY;QACd,iBAAY,GAAZ,YAAY,CAAc;QAC/C,WAAM,GAAN,MAAM,CAAmB;QAE1C,IAAI,C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AQ,EAAE,WAAW,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC;QAEnF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,0BAAc,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,CAAC;IAClG,CAAC;CACF,CAAA;AA9NY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,4BAAY,EAAC,cAAc,CAAC,CAAA;IAC5B,WAAA,IAAA,eAAM,EAAC,mCAAoB,CAAC,CAAA;qCADa,eAAM,UAEvB,sCAAiB;GAJjC,gBAAgB,CA8N5B"}
|
|
@@ -4,16 +4,18 @@ import { ConfigRepository } from '../repositories/config.repository';
|
|
|
4
4
|
import { DatabaseRepository } from '../repositories/database.repository';
|
|
5
5
|
import { LoggingRepository } from '../repositories/logging.repository';
|
|
6
6
|
import { ModuleConfigRepository } from '../repositories/moduleConfig.repository';
|
|
7
|
+
import { ConfigService } from './config.service';
|
|
7
8
|
import { RunHistoryService } from './runHistory.service';
|
|
8
9
|
import { ScheduleService } from './schedule.service';
|
|
9
10
|
export declare class BootstrapService implements OnApplicationBootstrap {
|
|
10
11
|
private readonly logger;
|
|
11
12
|
private readonly database;
|
|
12
13
|
private readonly config;
|
|
14
|
+
private readonly configService;
|
|
13
15
|
private readonly schedule;
|
|
14
16
|
private readonly bootstrap;
|
|
15
17
|
private readonly runHistory;
|
|
16
18
|
private readonly moduleConfig;
|
|
17
|
-
constructor(logger: LoggingRepository, database: DatabaseRepository, config: ConfigRepository, schedule: ScheduleService, bootstrap: BootstrapRepository, runHistory: RunHistoryService, moduleConfig: ModuleConfigRepository);
|
|
19
|
+
constructor(logger: LoggingRepository, database: DatabaseRepository, config: ConfigRepository, configService: ConfigService, schedule: ScheduleService, bootstrap: BootstrapRepository, runHistory: RunHistoryService, moduleConfig: ModuleConfigRepository);
|
|
18
20
|
onApplicationBootstrap(): Promise<void>;
|
|
19
21
|
}
|
|
@@ -18,20 +18,23 @@ const database_repository_1 = require("../repositories/database.repository");
|
|
|
18
18
|
const logging_repository_1 = require("../repositories/logging.repository");
|
|
19
19
|
const moduleConfig_repository_1 = require("../repositories/moduleConfig.repository");
|
|
20
20
|
const cache_1 = require("../utils/cache");
|
|
21
|
+
const config_service_1 = require("./config.service");
|
|
21
22
|
const runHistory_service_1 = require("./runHistory.service");
|
|
22
23
|
const schedule_service_1 = require("./schedule.service");
|
|
23
24
|
let BootstrapService = BootstrapService_1 = class BootstrapService {
|
|
24
25
|
logger;
|
|
25
26
|
database;
|
|
26
27
|
config;
|
|
28
|
+
configService;
|
|
27
29
|
schedule;
|
|
28
30
|
bootstrap;
|
|
29
31
|
runHistory;
|
|
30
32
|
moduleConfig;
|
|
31
|
-
constructor(logger, database, config, schedule, bootstrap, runHistory, moduleConfig) {
|
|
33
|
+
constructor(logger, database, config, configService, schedule, bootstrap, runHistory, moduleConfig) {
|
|
32
34
|
this.logger = logger;
|
|
33
35
|
this.database = database;
|
|
34
36
|
this.config = config;
|
|
37
|
+
this.configService = configService;
|
|
35
38
|
this.schedule = schedule;
|
|
36
39
|
this.bootstrap = bootstrap;
|
|
37
40
|
this.runHistory = runHistory;
|
|
@@ -45,6 +48,7 @@ let BootstrapService = BootstrapService_1 = class BootstrapService {
|
|
|
45
48
|
}
|
|
46
49
|
await this.database.runMigrations();
|
|
47
50
|
await this.config.bootstrap();
|
|
51
|
+
await this.configService.bootstrap();
|
|
48
52
|
await this.schedule.bootstrap();
|
|
49
53
|
await this.runHistory.reconcileInterruptedRuns();
|
|
50
54
|
const { backends, repositories, activeSchedules } = await this.config.getStateSummary();
|
|
@@ -64,6 +68,7 @@ exports.BootstrapService = BootstrapService = BootstrapService_1 = __decorate([
|
|
|
64
68
|
__metadata("design:paramtypes", [logging_repository_1.LoggingRepository,
|
|
65
69
|
database_repository_1.DatabaseRepository,
|
|
66
70
|
config_repository_1.ConfigRepository,
|
|
71
|
+
config_service_1.ConfigService,
|
|
67
72
|
schedule_service_1.ScheduleService,
|
|
68
73
|
bootstrap_repository_1.BootstrapRepository,
|
|
69
74
|
runHistory_service_1.RunHistoryService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.service.js","sourceRoot":"","sources":["../../src/services/bootstrap.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoE;AACpE,+EAA2E;AAC3E,yEAAqE;AACrE,6EAAyE;AACzE,2EAAuE;AACvE,qFAAiF;AACjF,0CAA4D;AAC5D,6DAAyD;AACzD,yDAAqD;AAG9C,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAER;IACA;IACA;IACA;IACA;IACA;IACA;
|
|
1
|
+
{"version":3,"file":"bootstrap.service.js","sourceRoot":"","sources":["../../src/services/bootstrap.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoE;AACpE,+EAA2E;AAC3E,yEAAqE;AACrE,6EAAyE;AACzE,2EAAuE;AACvE,qFAAiF;AACjF,0CAA4D;AAC5D,qDAAiD;AACjD,6DAAyD;AACzD,yDAAqD;AAG9C,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAER;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IARnB,YACmB,MAAyB,EACzB,QAA4B,EAC5B,MAAwB,EACxB,aAA4B,EAC5B,QAAyB,EACzB,SAA8B,EAC9B,UAA6B,EAC7B,YAAoC;QAPpC,WAAM,GAAN,MAAM,CAAmB;QACzB,aAAQ,GAAR,QAAQ,CAAoB;QAC5B,WAAM,GAAN,MAAM,CAAkB;QACxB,kBAAa,GAAb,aAAa,CAAe;QAC5B,aAAQ,GAAR,QAAQ,CAAiB;QACzB,cAAS,GAAT,SAAS,CAAqB;QAC9B,eAAU,GAAV,UAAU,CAAmB;QAC7B,iBAAY,GAAZ,YAAY,CAAwB;QAErD,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,KAA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AAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAGgB,sCAAiB;QACf,wCAAkB;QACpB,oCAAgB;QACT,8BAAa;QAClB,kCAAe;QACd,0CAAmB;QAClB,sCAAiB;QACf,gDAAsB;GAT5C,gBAAgB,CAsC5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConfigResponseDto, ConfigUpdateRequestDto } from '../dto/config.dto';
|
|
2
|
+
import { ConfigRepository } from '../repositories/config.repository';
|
|
3
|
+
import { ModuleConfigRepository } from '../repositories/moduleConfig.repository';
|
|
4
|
+
export declare class ConfigService {
|
|
5
|
+
private readonly config;
|
|
6
|
+
private readonly moduleConfig;
|
|
7
|
+
constructor(config: ConfigRepository, moduleConfig: ModuleConfigRepository);
|
|
8
|
+
bootstrap(): Promise<void>;
|
|
9
|
+
getConfig(): ConfigResponseDto;
|
|
10
|
+
updateConfig({ bandwidth }: ConfigUpdateRequestDto): Promise<ConfigResponseDto>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ConfigService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const resticProxy_1 = require("../proxy/resticProxy");
|
|
15
|
+
const config_repository_1 = require("../repositories/config.repository");
|
|
16
|
+
const moduleConfig_repository_1 = require("../repositories/moduleConfig.repository");
|
|
17
|
+
let ConfigService = class ConfigService {
|
|
18
|
+
config;
|
|
19
|
+
moduleConfig;
|
|
20
|
+
constructor(config, moduleConfig) {
|
|
21
|
+
this.config = config;
|
|
22
|
+
this.moduleConfig = moduleConfig;
|
|
23
|
+
}
|
|
24
|
+
async bootstrap() {
|
|
25
|
+
const stored = await this.config.getThrottle();
|
|
26
|
+
if (!stored) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.moduleConfig.update({ throttle: stored });
|
|
30
|
+
}
|
|
31
|
+
getConfig() {
|
|
32
|
+
return { bandwidth: this.moduleConfig.get().throttle ?? resticProxy_1.UNTHROTTLED };
|
|
33
|
+
}
|
|
34
|
+
async updateConfig({ bandwidth }) {
|
|
35
|
+
await this.config.setThrottle(bandwidth);
|
|
36
|
+
this.moduleConfig.update({ throttle: bandwidth });
|
|
37
|
+
return { bandwidth };
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.ConfigService = ConfigService;
|
|
41
|
+
exports.ConfigService = ConfigService = __decorate([
|
|
42
|
+
(0, common_1.Injectable)(),
|
|
43
|
+
__metadata("design:paramtypes", [config_repository_1.ConfigRepository,
|
|
44
|
+
moduleConfig_repository_1.ModuleConfigRepository])
|
|
45
|
+
], ConfigService);
|
|
46
|
+
//# sourceMappingURL=config.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.service.js","sourceRoot":"","sources":["../../src/services/config.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,sDAAmD;AACnD,yEAAqE;AACrE,qFAAiF;AAG1E,IAAM,aAAa,GAAnB,MAAM,aAAa;IAEL;IACA;IAFnB,YACmB,MAAwB,EACxB,YAAoC;QADpC,WAAM,GAAN,MAAM,CAAkB;QACxB,iBAAY,GAAZ,YAAY,CAAwB;IACpD,CAAC;IAEJ,KAAK,CAAC,SAAS;QACb,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;QACT,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,SAAS;QACP,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,QAAQ,IAAI,yBAAW,EAAE,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAE,SAAS,EAA0B;QACtD,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;QAElD,OAAO,EAAE,SAAS,EAAE,CAAC;IACvB,CAAC;CACF,CAAA;AAzBY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAGgB,oCAAgB;QACV,gDAAsB;GAH5C,aAAa,CAyBzB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ConfigureImmichIntegrationRequestDto, ImmichBackupStatusDto, ImmichRollbackRequestDto, IntegrationsResponseDto } from '../dto/integrations.dto';
|
|
1
|
+
import { ConfigureImmichDatabaseDumpRequestDto, ConfigureImmichIntegrationRequestDto, ImmichBackupStatusDto, ImmichRollbackRequestDto, IntegrationsResponseDto } from '../dto/integrations.dto';
|
|
2
2
|
import { EventsGateway } from '../events/events.gateway';
|
|
3
3
|
import type { ModuleConfig } from '../moduleConfig';
|
|
4
|
+
import { ConfigRepository } from '../repositories/config.repository';
|
|
4
5
|
import { LockRepository } from '../repositories/lock.repository';
|
|
5
6
|
import { ModuleConfigRepository } from '../repositories/moduleConfig.repository';
|
|
6
7
|
import { RepositoryRepository } from '../repositories/repository.repository';
|
|
@@ -16,6 +17,7 @@ export declare class IntegrationsService {
|
|
|
16
17
|
private readonly backendService;
|
|
17
18
|
private readonly events;
|
|
18
19
|
private readonly moduleConfig;
|
|
20
|
+
private readonly config;
|
|
19
21
|
private readonly repositoryIntegrationImmich;
|
|
20
22
|
private readonly repositoryPath;
|
|
21
23
|
private readonly repositoryService;
|
|
@@ -25,7 +27,7 @@ export declare class IntegrationsService {
|
|
|
25
27
|
private readonly scheduleService;
|
|
26
28
|
private readonly telemetry;
|
|
27
29
|
private readonly lock;
|
|
28
|
-
constructor(backendService: BackendService, events: EventsGateway, moduleConfig: ModuleConfigRepository, repositoryIntegrationImmich: RepositoryIntegrationImmichRepository, repositoryPath: RepositoryPathRepository, repositoryService: RepositoryService, repository: RepositoryRepository, runHistory: RunHistoryRepository, schedule: ScheduleRepository, scheduleService: ScheduleService, telemetry: TelemetryService, lock: LockRepository);
|
|
30
|
+
constructor(backendService: BackendService, events: EventsGateway, moduleConfig: ModuleConfigRepository, config: ConfigRepository, repositoryIntegrationImmich: RepositoryIntegrationImmichRepository, repositoryPath: RepositoryPathRepository, repositoryService: RepositoryService, repository: RepositoryRepository, runHistory: RunHistoryRepository, schedule: ScheduleRepository, scheduleService: ScheduleService, telemetry: TelemetryService, lock: LockRepository);
|
|
29
31
|
onModuleConfigUpdate(moduleConfig: ModuleConfig): Promise<void>;
|
|
30
32
|
getIntegrationsConfig(): Promise<IntegrationsResponseDto>;
|
|
31
33
|
getImmichBackupStatus(): Promise<ImmichBackupStatusDto>;
|
|
@@ -33,6 +35,8 @@ export declare class IntegrationsService {
|
|
|
33
35
|
configureImmichIntegration(dto: ConfigureImmichIntegrationRequestDto): Promise<{
|
|
34
36
|
repositoryId: string;
|
|
35
37
|
}>;
|
|
38
|
+
ignoreImmichDatabaseDumpWarning(): Promise<void>;
|
|
39
|
+
configureImmichDatabaseDump(dto: ConfigureImmichDatabaseDumpRequestDto): Promise<void>;
|
|
36
40
|
enterImmichMaintenanceRollback(dto: ImmichRollbackRequestDto): Promise<{
|
|
37
41
|
jwt: string;
|
|
38
42
|
}>;
|
|
@@ -16,6 +16,7 @@ const event_emitter_1 = require("@nestjs/event-emitter");
|
|
|
16
16
|
const node_path_1 = require("node:path");
|
|
17
17
|
const enum_1 = require("../enum");
|
|
18
18
|
const events_gateway_1 = require("../events/events.gateway");
|
|
19
|
+
const config_repository_1 = require("../repositories/config.repository");
|
|
19
20
|
const lock_repository_1 = require("../repositories/lock.repository");
|
|
20
21
|
const moduleConfig_repository_1 = require("../repositories/moduleConfig.repository");
|
|
21
22
|
const repository_repository_1 = require("../repositories/repository.repository");
|
|
@@ -32,6 +33,7 @@ let IntegrationsService = class IntegrationsService {
|
|
|
32
33
|
backendService;
|
|
33
34
|
events;
|
|
34
35
|
moduleConfig;
|
|
36
|
+
config;
|
|
35
37
|
repositoryIntegrationImmich;
|
|
36
38
|
repositoryPath;
|
|
37
39
|
repositoryService;
|
|
@@ -41,10 +43,11 @@ let IntegrationsService = class IntegrationsService {
|
|
|
41
43
|
scheduleService;
|
|
42
44
|
telemetry;
|
|
43
45
|
lock;
|
|
44
|
-
constructor(backendService, events, moduleConfig, repositoryIntegrationImmich, repositoryPath, repositoryService, repository, runHistory, schedule, scheduleService, telemetry, lock) {
|
|
46
|
+
constructor(backendService, events, moduleConfig, config, repositoryIntegrationImmich, repositoryPath, repositoryService, repository, runHistory, schedule, scheduleService, telemetry, lock) {
|
|
45
47
|
this.backendService = backendService;
|
|
46
48
|
this.events = events;
|
|
47
49
|
this.moduleConfig = moduleConfig;
|
|
50
|
+
this.config = config;
|
|
48
51
|
this.repositoryIntegrationImmich = repositoryIntegrationImmich;
|
|
49
52
|
this.repositoryPath = repositoryPath;
|
|
50
53
|
this.repositoryService = repositoryService;
|
|
@@ -73,15 +76,18 @@ let IntegrationsService = class IntegrationsService {
|
|
|
73
76
|
};
|
|
74
77
|
}
|
|
75
78
|
async getImmichBackupStatus() {
|
|
79
|
+
const { immichIntegration } = this.moduleConfig.get();
|
|
76
80
|
const integration = await this.repositoryIntegrationImmich.get();
|
|
77
|
-
if (!integration) {
|
|
81
|
+
if (!integration || !immichIntegration) {
|
|
78
82
|
return {};
|
|
79
83
|
}
|
|
80
|
-
const [{ repositories }, { backends }, schedule, latestBackupRun] = await Promise.all([
|
|
84
|
+
const [{ repositories }, { backends }, schedule, latestBackupRun, databaseDump, databaseDumpWarningIgnored] = await Promise.all([
|
|
81
85
|
this.repositoryService.getRepositories(),
|
|
82
86
|
this.backendService.getBackends(),
|
|
83
87
|
this.schedule.get(integration.scheduleId),
|
|
84
88
|
this.runHistory.getLatest(integration.id, enum_1.TaskType.Backup),
|
|
89
|
+
immichIntegration.hooks.getImmichDatabaseDumpConfig(),
|
|
90
|
+
this.config.hasIgnoredImmichDatabaseDumpWarning(),
|
|
85
91
|
]);
|
|
86
92
|
const repository = repositories.find((entry) => entry.id === integration.id);
|
|
87
93
|
return {
|
|
@@ -90,6 +96,8 @@ let IntegrationsService = class IntegrationsService {
|
|
|
90
96
|
backend: backends.find((entry) => entry.id === repository?.backends?.primary.id),
|
|
91
97
|
schedule,
|
|
92
98
|
latestBackupRun,
|
|
99
|
+
databaseDump,
|
|
100
|
+
databaseDumpWarningIgnored,
|
|
93
101
|
};
|
|
94
102
|
}
|
|
95
103
|
static ImmichIntegrationConfig = Symbol('ImmichIntegrationConfig');
|
|
@@ -161,6 +169,16 @@ let IntegrationsService = class IntegrationsService {
|
|
|
161
169
|
};
|
|
162
170
|
});
|
|
163
171
|
}
|
|
172
|
+
async ignoreImmichDatabaseDumpWarning() {
|
|
173
|
+
await this.config.ignoreImmichDatabaseDumpWarning();
|
|
174
|
+
}
|
|
175
|
+
async configureImmichDatabaseDump(dto) {
|
|
176
|
+
const { immichIntegration } = this.moduleConfig.get();
|
|
177
|
+
if (!immichIntegration) {
|
|
178
|
+
throw new common_1.BadRequestException('Immich integration is not enabled.');
|
|
179
|
+
}
|
|
180
|
+
await immichIntegration.hooks.configureImmichDatabaseDump(dto);
|
|
181
|
+
}
|
|
164
182
|
async enterImmichMaintenanceRollback(dto) {
|
|
165
183
|
const { immichIntegration } = this.moduleConfig.get();
|
|
166
184
|
if (!immichIntegration) {
|
|
@@ -218,6 +236,7 @@ exports.IntegrationsService = IntegrationsService = IntegrationsService_1 = __de
|
|
|
218
236
|
__metadata("design:paramtypes", [backend_service_1.BackendService,
|
|
219
237
|
events_gateway_1.EventsGateway,
|
|
220
238
|
moduleConfig_repository_1.ModuleConfigRepository,
|
|
239
|
+
config_repository_1.ConfigRepository,
|
|
221
240
|
repositoryIntegrationImmich_repository_1.RepositoryIntegrationImmichRepository,
|
|
222
241
|
repositoryPath_repository_1.RepositoryPathRepository,
|
|
223
242
|
repository_service_1.RepositoryService,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.service.js","sourceRoot":"","sources":["../../src/services/integrations.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoF;AACpF,yDAAgD;AAChD,yCAAiC;
|
|
1
|
+
{"version":3,"file":"integrations.service.js","sourceRoot":"","sources":["../../src/services/integrations.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoF;AACpF,yDAAgD;AAChD,yCAAiC;AAQjC,kCAAkD;AAClD,6DAAyD;AAEzD,yEAAqE;AACrE,qEAAiE;AACjE,qFAAiF;AACjF,iFAA6E;AAC7E,mHAA+G;AAC/G,yFAAqF;AACrF,iFAA6E;AAC7E,6EAAyE;AAEzE,uDAAmD;AACnD,6DAAyD;AACzD,yDAAqD;AACrD,2DAAuD;AAGhD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;;IAEX;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAbnB,YACmB,cAA8B,EAC9B,MAAqB,EACrB,YAAoC,EACpC,MAAwB,EACxB,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AAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7B,CAAC;;AAxNU,kDAAmB;AAkBxB;IADL,IAAA,uBAAO,EAAC,oBAAa,CAAC,mBAAmB,CAAC;;;;+DAU1C;8BA3BU,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAGwB,gCAAc;QACtB,8BAAa;QACP,gDAAsB;QAC5B,oCAAgB;QACK,8EAAqC;QAClD,oDAAwB;QACrB,sCAAiB;QACxB,4CAAoB;QACpB,4CAAoB;QACtB,wCAAkB;QACX,kCAAe;QACrB,oCAAgB;QACrB,gCAAc;GAd5B,mBAAmB,CAyN/B"}
|
|
@@ -486,15 +486,17 @@ let RepositoryService = RepositoryService_1 = class RepositoryService {
|
|
|
486
486
|
try {
|
|
487
487
|
const taskSignal = this.tasks.startTask(id, enum_1.TaskType.Backup, logId, signal);
|
|
488
488
|
const tags = [];
|
|
489
|
+
let immichHooks;
|
|
489
490
|
const config = this.moduleConfig.get();
|
|
490
491
|
if (config.immichIntegration) {
|
|
491
492
|
const immichIntegration = await this.repositoryIntegrationImmich.get();
|
|
492
493
|
if (id === immichIntegration?.id) {
|
|
494
|
+
immichHooks = config.immichIntegration.hooks;
|
|
493
495
|
this.telemetry.submitStructuredLog('Creating Immich database backup', {
|
|
494
496
|
repositoryId: id,
|
|
495
497
|
});
|
|
496
498
|
try {
|
|
497
|
-
const backupFileName = await
|
|
499
|
+
const backupFileName = await immichHooks.createDatabaseBackup(taskSignal);
|
|
498
500
|
tags.push(`${enum_1.ResticTagPrefix.ImmichBackupFileName}=${backupFileName}`);
|
|
499
501
|
this.telemetry.submitStructuredLog('Created Immich database backup', {
|
|
500
502
|
repositoryId: id,
|
|
@@ -514,6 +516,17 @@ let RepositoryService = RepositoryService_1 = class RepositoryService {
|
|
|
514
516
|
repositoryId: id,
|
|
515
517
|
summary,
|
|
516
518
|
});
|
|
519
|
+
if (immichHooks) {
|
|
520
|
+
try {
|
|
521
|
+
await immichHooks.cleanupDatabaseBackups();
|
|
522
|
+
}
|
|
523
|
+
catch (error) {
|
|
524
|
+
this.telemetry.submitStructuredLog('Failed to clean up Immich database backups', {
|
|
525
|
+
repositoryId: id,
|
|
526
|
+
error,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
517
530
|
if (retentionPolicy) {
|
|
518
531
|
await this.runForgetAndPrune(endpoint, key, placement, retentionPolicy, logWriter, taskSignal);
|
|
519
532
|
this.telemetry.submitStructuredLog('Finished prune on primary backend', {
|