@zlooks.cn/global-config-server 1.0.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/command/index.d.ts +3 -0
- package/dist/command/index.d.ts.map +1 -0
- package/dist/command/index.js +24 -0
- package/dist/command/index.js.map +1 -0
- package/dist/config/global-config-revision-conflict-error.d.ts +5 -0
- package/dist/config/global-config-revision-conflict-error.d.ts.map +1 -0
- package/dist/config/global-config-revision-conflict-error.js +9 -0
- package/dist/config/global-config-revision-conflict-error.js.map +1 -0
- package/dist/config/schema.d.ts +14 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +8 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/typeorm-site-presentation-store.d.ts +17 -0
- package/dist/config/typeorm-site-presentation-store.d.ts.map +1 -0
- package/dist/config/typeorm-site-presentation-store.js +131 -0
- package/dist/config/typeorm-site-presentation-store.js.map +1 -0
- package/dist/config/typeorm-site-profile-store.d.ts +16 -0
- package/dist/config/typeorm-site-profile-store.d.ts.map +1 -0
- package/dist/config/typeorm-site-profile-store.js +74 -0
- package/dist/config/typeorm-site-profile-store.js.map +1 -0
- package/dist/mcp/global-config-provider.d.ts +10 -0
- package/dist/mcp/global-config-provider.d.ts.map +1 -0
- package/dist/mcp/global-config-provider.js +160 -0
- package/dist/mcp/global-config-provider.js.map +1 -0
- package/dist/migrations/index.d.ts +3 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +2 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/persistence/entities.d.ts +21 -0
- package/dist/persistence/entities.d.ts.map +1 -0
- package/dist/persistence/entities.js +26 -0
- package/dist/persistence/entities.js.map +1 -0
- package/dist/runtime/config-snapshot-publisher.d.ts +22 -0
- package/dist/runtime/config-snapshot-publisher.d.ts.map +1 -0
- package/dist/runtime/config-snapshot-publisher.js +92 -0
- package/dist/runtime/config-snapshot-publisher.js.map +1 -0
- package/dist/runtime/site-presentation-publisher.d.ts +9 -0
- package/dist/runtime/site-presentation-publisher.d.ts.map +1 -0
- package/dist/runtime/site-presentation-publisher.js +8 -0
- package/dist/runtime/site-presentation-publisher.js.map +1 -0
- package/dist/runtime/site-profile-publisher.d.ts +9 -0
- package/dist/runtime/site-profile-publisher.d.ts.map +1 -0
- package/dist/runtime/site-profile-publisher.js +8 -0
- package/dist/runtime/site-profile-publisher.js.map +1 -0
- package/dist/services/application.service.d.ts +4 -0
- package/dist/services/application.service.d.ts.map +1 -0
- package/dist/services/application.service.js +21 -0
- package/dist/services/application.service.js.map +1 -0
- package/dist/services/config.service.d.ts +3 -0
- package/dist/services/config.service.d.ts.map +1 -0
- package/dist/services/config.service.js +17 -0
- package/dist/services/config.service.js.map +1 -0
- package/dist/services/database.service.d.ts +3 -0
- package/dist/services/database.service.d.ts.map +1 -0
- package/dist/services/database.service.js +23 -0
- package/dist/services/database.service.js.map +1 -0
- package/dist/services/global-config-runtime.service.d.ts +152 -0
- package/dist/services/global-config-runtime.service.d.ts.map +1 -0
- package/dist/services/global-config-runtime.service.js +63 -0
- package/dist/services/global-config-runtime.service.js.map +1 -0
- package/dist/services/global-config.boot.d.ts +3 -0
- package/dist/services/global-config.boot.d.ts.map +1 -0
- package/dist/services/global-config.boot.js +8 -0
- package/dist/services/global-config.boot.js.map +1 -0
- package/dist/services/logger.service.d.ts +4 -0
- package/dist/services/logger.service.d.ts.map +1 -0
- package/dist/services/logger.service.js +8 -0
- package/dist/services/logger.service.js.map +1 -0
- package/dist/services/mcp-provider.service.d.ts +3 -0
- package/dist/services/mcp-provider.service.d.ts.map +1 -0
- package/dist/services/mcp-provider.service.js +19 -0
- package/dist/services/mcp-provider.service.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Application } from '@hile/micro';
|
|
2
|
+
interface VersionedSnapshot {
|
|
3
|
+
readonly revision: number;
|
|
4
|
+
}
|
|
5
|
+
interface SnapshotStore<TSnapshot extends VersionedSnapshot> {
|
|
6
|
+
read(): Promise<TSnapshot>;
|
|
7
|
+
}
|
|
8
|
+
export declare class ConfigSnapshotPublisher<TSnapshot extends VersionedSnapshot> {
|
|
9
|
+
#private;
|
|
10
|
+
private readonly application;
|
|
11
|
+
private readonly topic;
|
|
12
|
+
private readonly description;
|
|
13
|
+
private readonly store;
|
|
14
|
+
private readonly refreshIntervalMs;
|
|
15
|
+
private readonly onError;
|
|
16
|
+
constructor(application: Pick<Application, 'publish'>, topic: string, description: string, store: SnapshotStore<TSnapshot>, refreshIntervalMs: number, onError?: (error: unknown) => void);
|
|
17
|
+
start(): Promise<void>;
|
|
18
|
+
refresh(): Promise<TSnapshot>;
|
|
19
|
+
close(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=config-snapshot-publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-snapshot-publisher.d.ts","sourceRoot":"","sources":["../../src/runtime/config-snapshot-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,UAAU,iBAAiB;IAAG,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE;AACzD,UAAU,aAAa,CAAC,SAAS,SAAS,iBAAiB;IAAI,IAAI,IAAI,OAAO,CAAC,SAAS,CAAC,CAAA;CAAE;AAM3F,qBAAa,uBAAuB,CAAC,SAAS,SAAS,iBAAiB;;IAQpE,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,YACmB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,EACzC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,EAC/B,iBAAiB,EAAE,MAAM,EACzB,OAAO,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAsB,EAClE;IAES,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAQlC;IAEM,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC,CAUnC;IAsBY,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAsBlC;CACF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export class ConfigSnapshotPublisher {
|
|
2
|
+
application;
|
|
3
|
+
topic;
|
|
4
|
+
description;
|
|
5
|
+
store;
|
|
6
|
+
refreshIntervalMs;
|
|
7
|
+
onError;
|
|
8
|
+
#currentRevision = -1;
|
|
9
|
+
#publisher;
|
|
10
|
+
#refreshPromise;
|
|
11
|
+
#refreshRequested = false;
|
|
12
|
+
#timer;
|
|
13
|
+
constructor(application, topic, description, store, refreshIntervalMs, onError = () => undefined) {
|
|
14
|
+
this.application = application;
|
|
15
|
+
this.topic = topic;
|
|
16
|
+
this.description = description;
|
|
17
|
+
this.store = store;
|
|
18
|
+
this.refreshIntervalMs = refreshIntervalMs;
|
|
19
|
+
this.onError = onError;
|
|
20
|
+
}
|
|
21
|
+
async start() {
|
|
22
|
+
if (this.#publisher)
|
|
23
|
+
throw new Error(`${this.description} publisher is already started`);
|
|
24
|
+
const snapshot = await this.store.read();
|
|
25
|
+
this.#publisher = await this.application.publish(this.topic, snapshot);
|
|
26
|
+
this.#currentRevision = snapshot.revision;
|
|
27
|
+
this.#timer = setInterval(() => {
|
|
28
|
+
void this.refresh().catch(this.onError);
|
|
29
|
+
}, this.refreshIntervalMs);
|
|
30
|
+
}
|
|
31
|
+
refresh() {
|
|
32
|
+
this.#refreshRequested = true;
|
|
33
|
+
const existing = this.#refreshPromise;
|
|
34
|
+
if (existing)
|
|
35
|
+
return existing;
|
|
36
|
+
const refresh = this.#drainRefreshes();
|
|
37
|
+
this.#refreshPromise = refresh;
|
|
38
|
+
void refresh.finally(() => {
|
|
39
|
+
if (this.#refreshPromise === refresh)
|
|
40
|
+
this.#refreshPromise = undefined;
|
|
41
|
+
}).catch(() => undefined);
|
|
42
|
+
return refresh;
|
|
43
|
+
}
|
|
44
|
+
async #drainRefreshes() {
|
|
45
|
+
let snapshot;
|
|
46
|
+
do {
|
|
47
|
+
this.#refreshRequested = false;
|
|
48
|
+
snapshot = await this.#refreshOnce();
|
|
49
|
+
} while (this.#refreshRequested);
|
|
50
|
+
return snapshot;
|
|
51
|
+
}
|
|
52
|
+
async #refreshOnce() {
|
|
53
|
+
const snapshot = await this.store.read();
|
|
54
|
+
if (snapshot.revision !== this.#currentRevision) {
|
|
55
|
+
const publisher = this.#publisher;
|
|
56
|
+
if (!publisher)
|
|
57
|
+
throw new Error(`${this.description} publisher is not started`);
|
|
58
|
+
await publisher.update(snapshot);
|
|
59
|
+
this.#currentRevision = snapshot.revision;
|
|
60
|
+
}
|
|
61
|
+
return snapshot;
|
|
62
|
+
}
|
|
63
|
+
async close() {
|
|
64
|
+
if (this.#timer)
|
|
65
|
+
clearInterval(this.#timer);
|
|
66
|
+
this.#timer = undefined;
|
|
67
|
+
const errors = [];
|
|
68
|
+
try {
|
|
69
|
+
await this.#refreshPromise;
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
errors.push(error);
|
|
73
|
+
}
|
|
74
|
+
const publisher = this.#publisher;
|
|
75
|
+
if (publisher) {
|
|
76
|
+
try {
|
|
77
|
+
await publisher.unpublish();
|
|
78
|
+
if (this.#publisher === publisher)
|
|
79
|
+
this.#publisher = undefined;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
errors.push(error);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (errors.length === 1)
|
|
86
|
+
throw errors[0];
|
|
87
|
+
if (errors.length > 1) {
|
|
88
|
+
throw new AggregateError(errors, `Failed to close ${this.description} publisher`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=config-snapshot-publisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-snapshot-publisher.js","sourceRoot":"","sources":["../../src/runtime/config-snapshot-publisher.ts"],"names":[],"mappings":"AASA,MAAM,OAAO,uBAAuB;IAQf,WAAW;IACX,KAAK;IACL,WAAW;IACX,KAAK;IACL,iBAAiB;IACjB,OAAO;IAZ1B,gBAAgB,GAAG,CAAC,CAAC,CAAC;IACtB,UAAU,CAAmC;IAC7C,eAAe,CAAiC;IAChD,iBAAiB,GAAG,KAAK,CAAC;IAC1B,MAAM,CAA6C;IAEnD,YACmB,WAAyC,EACzC,KAAa,EACb,WAAmB,EACnB,KAA+B,EAC/B,iBAAyB,EACzB,OAAO,GAA6B,GAAG,EAAE,CAAC,SAAS;2BALnD,WAAW;qBACX,KAAK;2BACL,WAAW;qBACX,KAAK;iCACL,iBAAiB;uBACjB,OAAO;IACvB,CAAC;IAEG,KAAK,CAAC,KAAK;QAChB,IAAI,IAAI,CAAC,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,+BAA+B,CAAC,CAAC;QACzF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACzC,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAyB,CAAC;QAC/F,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;YAC7B,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAA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AClB,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,IAAI,IAAI,CAAC,MAAM;YAAE,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,MAAM,MAAM,GAAc,EAAE,CAAC;QAC7B,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,eAAe,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC;gBACH,MAAM,SAAS,CAAC,SAAS,EAAE,CAAC;gBAC5B,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS;oBAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YACjE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,cAAc,CAAC,MAAM,EAAE,mBAAmB,IAAI,CAAC,WAAW,YAAY,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Application } from '@hile/micro';
|
|
2
|
+
import { type SitePresentationSnapshot } from '@zlooks.cn/global-config-shared';
|
|
3
|
+
import { ConfigSnapshotPublisher } from './config-snapshot-publisher.js';
|
|
4
|
+
export declare class SitePresentationPublisher extends ConfigSnapshotPublisher<SitePresentationSnapshot> {
|
|
5
|
+
constructor(application: Pick<Application, 'publish'>, store: {
|
|
6
|
+
read(): Promise<SitePresentationSnapshot>;
|
|
7
|
+
}, refreshIntervalMs: number, onError?: (error: unknown) => void);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=site-presentation-publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-presentation-publisher.d.ts","sourceRoot":"","sources":["../../src/runtime/site-presentation-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,qBAAa,yBAA0B,SAAQ,uBAAuB,CAAC,wBAAwB,CAAC;IAC9F,YACE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,EACzC,KAAK,EAAE;QAAE,IAAI,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAAA;KAAE,EACpD,iBAAiB,EAAE,MAAM,EACzB,OAAO,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAsB,EAGpD;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GLOBAL_CONFIG_PUBLIC_TOPIC, } from '@zlooks.cn/global-config-shared';
|
|
2
|
+
import { ConfigSnapshotPublisher } from './config-snapshot-publisher.js';
|
|
3
|
+
export class SitePresentationPublisher extends ConfigSnapshotPublisher {
|
|
4
|
+
constructor(application, store, refreshIntervalMs, onError = () => undefined) {
|
|
5
|
+
super(application, GLOBAL_CONFIG_PUBLIC_TOPIC, 'Site presentation', store, refreshIntervalMs, onError);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=site-presentation-publisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-presentation-publisher.js","sourceRoot":"","sources":["../../src/runtime/site-presentation-publisher.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,GAE3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,OAAO,yBAA0B,SAAQ,uBAAiD;IAC9F,YACE,WAAyC,EACzC,KAAoD,EACpD,iBAAyB,EACzB,OAAO,GAA6B,GAAG,EAAE,CAAC,SAAS;QAEnD,KAAK,CAAC,WAAW,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Application } from '@hile/micro';
|
|
2
|
+
import { type SiteProfileSnapshot } from '@zlooks.cn/global-config-shared';
|
|
3
|
+
import { ConfigSnapshotPublisher } from './config-snapshot-publisher.js';
|
|
4
|
+
export declare class SiteProfilePublisher extends ConfigSnapshotPublisher<SiteProfileSnapshot> {
|
|
5
|
+
constructor(application: Pick<Application, 'publish'>, store: {
|
|
6
|
+
read(): Promise<SiteProfileSnapshot>;
|
|
7
|
+
}, refreshIntervalMs: number, onError?: (error: unknown) => void);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=site-profile-publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-profile-publisher.d.ts","sourceRoot":"","sources":["../../src/runtime/site-profile-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,qBAAa,oBAAqB,SAAQ,uBAAuB,CAAC,mBAAmB,CAAC;IACpF,YACE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,EACzC,KAAK,EAAE;QAAE,IAAI,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAA;KAAE,EAC/C,iBAAiB,EAAE,MAAM,EACzB,OAAO,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAsB,EAGpD;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GLOBAL_CONFIG_PROFILE_TOPIC, } from '@zlooks.cn/global-config-shared';
|
|
2
|
+
import { ConfigSnapshotPublisher } from './config-snapshot-publisher.js';
|
|
3
|
+
export class SiteProfilePublisher extends ConfigSnapshotPublisher {
|
|
4
|
+
constructor(application, store, refreshIntervalMs, onError = () => undefined) {
|
|
5
|
+
super(application, GLOBAL_CONFIG_PROFILE_TOPIC, 'Site profile', store, refreshIntervalMs, onError);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=site-profile-publisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-profile-publisher.js","sourceRoot":"","sources":["../../src/runtime/site-profile-publisher.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,GAE5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,MAAM,OAAO,oBAAqB,SAAQ,uBAA4C;IACpF,YACE,WAAyC,EACzC,KAA+C,EAC/C,iBAAyB,EACzB,OAAO,GAA6B,GAAG,EAAE,CAAC,SAAS;QAEnD,KAAK,CAAC,WAAW,EAAE,2BAA2B,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;IACrG,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.service.d.ts","sourceRoot":"","sources":["../../src/services/application.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineService } from '@hile/core';
|
|
2
|
+
import { Application } from '@hile/micro';
|
|
3
|
+
import { GLOBAL_CONFIG_SERVICE_NAMESPACE } from '@zlooks.cn/global-config-shared';
|
|
4
|
+
import { parseAdvertiseHost, parseRegistryBootstrap, } from '@zlooks.cn/registry-config';
|
|
5
|
+
import { detect } from 'detect-port';
|
|
6
|
+
export default defineService('zlooks.global-config.application', async (shutdown) => {
|
|
7
|
+
const registry = parseRegistryBootstrap({
|
|
8
|
+
REGISTRY_HOST: process.env.REGISTRY_HOST,
|
|
9
|
+
REGISTRY_PORT: process.env.REGISTRY_PORT,
|
|
10
|
+
});
|
|
11
|
+
const advertiseHost = parseAdvertiseHost(process.env.HILE_ADVERTISE_HOST);
|
|
12
|
+
const application = new Application({
|
|
13
|
+
namespace: GLOBAL_CONFIG_SERVICE_NAMESPACE,
|
|
14
|
+
registry,
|
|
15
|
+
...(advertiseHost ? { advertiseHost } : {}),
|
|
16
|
+
});
|
|
17
|
+
const microPort = await detect();
|
|
18
|
+
shutdown(await application.listen(microPort));
|
|
19
|
+
return application;
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=application.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.service.js","sourceRoot":"","sources":["../../src/services/application.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,eAAe,aAAa,CAAC,kCAAkC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAClF,MAAM,QAAQ,GAAG,sBAAsB,CAAC;QACtC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;QACxC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;KACzC,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC1E,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC;QAClC,SAAS,EAAE,+BAA+B;QAC1C,QAAQ;QACR,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,MAAM,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,MAAM,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.service.d.ts","sourceRoot":"","sources":["../../src/services/config.service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineService, loadService } from '@hile/core';
|
|
2
|
+
import { parsePostgresConfig } from '@zlooks.cn/infrastructure';
|
|
3
|
+
import { registryConfigTopic, subscribeRegistryConfig } from '@zlooks.cn/registry-config';
|
|
4
|
+
import { parseGlobalConfigServerConfig, } from '../config/schema.js';
|
|
5
|
+
import applicationService from './application.service.js';
|
|
6
|
+
export default defineService('zlooks.global-config.config', async (shutdown) => {
|
|
7
|
+
const application = await loadService(applicationService);
|
|
8
|
+
const subscriber = await subscribeRegistryConfig(application, {
|
|
9
|
+
sources: {
|
|
10
|
+
postgres: { topic: registryConfigTopic('postgres'), parse: parsePostgresConfig },
|
|
11
|
+
},
|
|
12
|
+
compose: parseGlobalConfigServerConfig,
|
|
13
|
+
});
|
|
14
|
+
shutdown(() => subscriber.close());
|
|
15
|
+
return subscriber;
|
|
16
|
+
});
|
|
17
|
+
//# 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,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1F,OAAO,EACL,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAE1D,eAAe,aAAa,CAAC,6BAA6B,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC7E,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,MAAM,uBAAuB,CAAC,WAAW,EAAE;QAC5D,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE;SACjF;QACD,OAAO,EAAE,6BAA6B;KACvC,CAAC,CAAC;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.service.d.ts","sourceRoot":"","sources":["../../src/services/database.service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineService, loadService } from '@hile/core';
|
|
2
|
+
import { createDataSource } from '@hile/typeorm';
|
|
3
|
+
import { SitePresentationEntity, SiteProfileEntity } from '../persistence/entities.js';
|
|
4
|
+
import configService from './config.service.js';
|
|
5
|
+
export default defineService('zlooks.global-config.database', async (shutdown) => {
|
|
6
|
+
const config = (await loadService(configService)).snapshot().infrastructure.postgres;
|
|
7
|
+
const dataSource = await createDataSource({
|
|
8
|
+
type: 'postgres',
|
|
9
|
+
host: config.host,
|
|
10
|
+
port: config.port,
|
|
11
|
+
username: config.username,
|
|
12
|
+
password: config.password,
|
|
13
|
+
database: config.database,
|
|
14
|
+
ssl: config.ssl,
|
|
15
|
+
synchronize: false,
|
|
16
|
+
migrationsRun: false,
|
|
17
|
+
poolSize: config.poolSize,
|
|
18
|
+
entities: [SitePresentationEntity, SiteProfileEntity],
|
|
19
|
+
});
|
|
20
|
+
shutdown(() => dataSource.destroy());
|
|
21
|
+
return dataSource;
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=database.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.service.js","sourceRoot":"","sources":["../../src/services/database.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,eAAe,aAAa,CAAC,+BAA+B,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC/E,MAAM,MAAM,GAAG,CAAC,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC;IACrF,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC;QACxC,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,WAAW,EAAE,KAAK;QAClB,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,CAAC,sBAAsB,EAAE,iBAAiB,CAAC;KACtD,CAAC,CAAC;IACH,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IACrC,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
declare const _default: import("@hile/core").ServiceRegisterProps<{
|
|
2
|
+
readonly readPresentation: () => Promise<Readonly<{
|
|
3
|
+
schemaVersion: 2;
|
|
4
|
+
revision: number;
|
|
5
|
+
value: {
|
|
6
|
+
identity: {
|
|
7
|
+
name: string;
|
|
8
|
+
homeHref: string;
|
|
9
|
+
backgroundVideoUrl?: string | null | undefined;
|
|
10
|
+
logoUrl?: string | undefined;
|
|
11
|
+
faviconUrl?: string | undefined;
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
linkGroups: {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
links: ({
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
href: string;
|
|
21
|
+
external: false;
|
|
22
|
+
} | {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
href: string;
|
|
26
|
+
external: true;
|
|
27
|
+
})[];
|
|
28
|
+
}[];
|
|
29
|
+
legal: {
|
|
30
|
+
copyright?: string | undefined;
|
|
31
|
+
registrations: {
|
|
32
|
+
id: string;
|
|
33
|
+
kind: "icp" | "other" | "public-security";
|
|
34
|
+
number: string;
|
|
35
|
+
verificationUrl?: string | undefined;
|
|
36
|
+
iconUrl?: string | undefined;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
updatedBy: string;
|
|
42
|
+
}>>;
|
|
43
|
+
readonly updatePresentationFromMcp: (input: unknown & {
|
|
44
|
+
readonly updatedBy?: string;
|
|
45
|
+
}) => Promise<Readonly<{
|
|
46
|
+
schemaVersion: 2;
|
|
47
|
+
revision: number;
|
|
48
|
+
value: {
|
|
49
|
+
identity: {
|
|
50
|
+
name: string;
|
|
51
|
+
homeHref: string;
|
|
52
|
+
backgroundVideoUrl?: string | null | undefined;
|
|
53
|
+
logoUrl?: string | undefined;
|
|
54
|
+
faviconUrl?: string | undefined;
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
linkGroups: {
|
|
58
|
+
id: string;
|
|
59
|
+
label: string;
|
|
60
|
+
links: ({
|
|
61
|
+
id: string;
|
|
62
|
+
label: string;
|
|
63
|
+
href: string;
|
|
64
|
+
external: false;
|
|
65
|
+
} | {
|
|
66
|
+
id: string;
|
|
67
|
+
label: string;
|
|
68
|
+
href: string;
|
|
69
|
+
external: true;
|
|
70
|
+
})[];
|
|
71
|
+
}[];
|
|
72
|
+
legal: {
|
|
73
|
+
copyright?: string | undefined;
|
|
74
|
+
registrations: {
|
|
75
|
+
id: string;
|
|
76
|
+
kind: "icp" | "other" | "public-security";
|
|
77
|
+
number: string;
|
|
78
|
+
verificationUrl?: string | undefined;
|
|
79
|
+
iconUrl?: string | undefined;
|
|
80
|
+
}[];
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
updatedAt: string;
|
|
84
|
+
updatedBy: string;
|
|
85
|
+
}>>;
|
|
86
|
+
readonly readProfile: () => Promise<Readonly<{
|
|
87
|
+
schemaVersion: 1;
|
|
88
|
+
revision: number;
|
|
89
|
+
value: {
|
|
90
|
+
profile: {
|
|
91
|
+
displayName: string;
|
|
92
|
+
avatarUrl?: string | undefined;
|
|
93
|
+
headline: string;
|
|
94
|
+
biography: string;
|
|
95
|
+
};
|
|
96
|
+
topics: {
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
summary: string;
|
|
100
|
+
href?: string | undefined;
|
|
101
|
+
}[];
|
|
102
|
+
featuredLinks: ({
|
|
103
|
+
id: string;
|
|
104
|
+
label: string;
|
|
105
|
+
href: string;
|
|
106
|
+
external: false;
|
|
107
|
+
} | {
|
|
108
|
+
id: string;
|
|
109
|
+
label: string;
|
|
110
|
+
href: string;
|
|
111
|
+
external: true;
|
|
112
|
+
})[];
|
|
113
|
+
};
|
|
114
|
+
updatedAt: string;
|
|
115
|
+
updatedBy: string;
|
|
116
|
+
}>>;
|
|
117
|
+
readonly updateProfileFromMcp: (input: unknown & {
|
|
118
|
+
readonly updatedBy?: string;
|
|
119
|
+
}) => Promise<Readonly<{
|
|
120
|
+
schemaVersion: 1;
|
|
121
|
+
revision: number;
|
|
122
|
+
value: {
|
|
123
|
+
profile: {
|
|
124
|
+
displayName: string;
|
|
125
|
+
avatarUrl?: string | undefined;
|
|
126
|
+
headline: string;
|
|
127
|
+
biography: string;
|
|
128
|
+
};
|
|
129
|
+
topics: {
|
|
130
|
+
id: string;
|
|
131
|
+
name: string;
|
|
132
|
+
summary: string;
|
|
133
|
+
href?: string | undefined;
|
|
134
|
+
}[];
|
|
135
|
+
featuredLinks: ({
|
|
136
|
+
id: string;
|
|
137
|
+
label: string;
|
|
138
|
+
href: string;
|
|
139
|
+
external: false;
|
|
140
|
+
} | {
|
|
141
|
+
id: string;
|
|
142
|
+
label: string;
|
|
143
|
+
href: string;
|
|
144
|
+
external: true;
|
|
145
|
+
})[];
|
|
146
|
+
};
|
|
147
|
+
updatedAt: string;
|
|
148
|
+
updatedBy: string;
|
|
149
|
+
}>>;
|
|
150
|
+
}>;
|
|
151
|
+
export default _default;
|
|
152
|
+
//# sourceMappingURL=global-config-runtime.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-config-runtime.service.d.ts","sourceRoot":"","sources":["../../src/services/global-config-runtime.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gDA+C6C,OAAO,GAAG;QAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAW9C,OAAO,GAAG;QAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineService, loadService } from '@hile/core';
|
|
2
|
+
import { parseGlobalConfigMcpProfileUpdate, parseGlobalConfigMcpUpdate, } from '@zlooks.cn/global-config-shared';
|
|
3
|
+
import { TypeOrmSiteProfileStore } from '../config/typeorm-site-profile-store.js';
|
|
4
|
+
import { TypeOrmSitePresentationStore } from '../config/typeorm-site-presentation-store.js';
|
|
5
|
+
import { SiteProfilePublisher } from '../runtime/site-profile-publisher.js';
|
|
6
|
+
import { SitePresentationPublisher } from '../runtime/site-presentation-publisher.js';
|
|
7
|
+
import applicationService from './application.service.js';
|
|
8
|
+
import configService from './config.service.js';
|
|
9
|
+
import databaseService from './database.service.js';
|
|
10
|
+
import loggerService from './logger.service.js';
|
|
11
|
+
export default defineService('zlooks.global-config.runtime', async (shutdown) => {
|
|
12
|
+
const [application, configs, database, logger] = await Promise.all([
|
|
13
|
+
loadService(applicationService),
|
|
14
|
+
loadService(configService),
|
|
15
|
+
loadService(databaseService),
|
|
16
|
+
loadService(loggerService),
|
|
17
|
+
]);
|
|
18
|
+
const presentationStore = new TypeOrmSitePresentationStore(database);
|
|
19
|
+
const profileStore = new TypeOrmSiteProfileStore(database);
|
|
20
|
+
const presentationPublisher = new SitePresentationPublisher(application, presentationStore, configs.snapshot().publisher.refreshIntervalMs, (error) => logger.error({ err: error, event: 'global-config.publication.failed' }, 'Global configuration publication failed'));
|
|
21
|
+
const profilePublisher = new SiteProfilePublisher(application, profileStore, configs.snapshot().publisher.refreshIntervalMs, (error) => logger.error({ err: error, event: 'global-config.profile-publication.failed' }, 'Site profile publication failed'));
|
|
22
|
+
try {
|
|
23
|
+
await Promise.all([presentationPublisher.start(), profilePublisher.start()]);
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
await Promise.allSettled([presentationPublisher.close(), profilePublisher.close()]);
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
shutdown(() => closePublishers([presentationPublisher, profilePublisher]));
|
|
30
|
+
return {
|
|
31
|
+
readPresentation: () => presentationStore.read(),
|
|
32
|
+
updatePresentationFromMcp: async (input) => {
|
|
33
|
+
if (typeof input !== 'object' || input === null || typeof input.updatedBy !== 'string') {
|
|
34
|
+
throw new TypeError('Verified MCP actor is required');
|
|
35
|
+
}
|
|
36
|
+
const { updatedBy, ...untrustedRequest } = input;
|
|
37
|
+
const request = parseGlobalConfigMcpUpdate(untrustedRequest);
|
|
38
|
+
const snapshot = await presentationStore.update({ ...request, updatedBy });
|
|
39
|
+
await presentationPublisher.refresh();
|
|
40
|
+
return snapshot;
|
|
41
|
+
},
|
|
42
|
+
readProfile: () => profileStore.read(),
|
|
43
|
+
updateProfileFromMcp: async (input) => {
|
|
44
|
+
if (typeof input !== 'object' || input === null || typeof input.updatedBy !== 'string') {
|
|
45
|
+
throw new TypeError('Verified MCP actor is required');
|
|
46
|
+
}
|
|
47
|
+
const { updatedBy, ...untrustedRequest } = input;
|
|
48
|
+
const request = parseGlobalConfigMcpProfileUpdate(untrustedRequest);
|
|
49
|
+
const snapshot = await profileStore.update({ ...request, updatedBy });
|
|
50
|
+
await profilePublisher.refresh();
|
|
51
|
+
return snapshot;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
async function closePublishers(publishers) {
|
|
56
|
+
const results = await Promise.allSettled(publishers.map((publisher) => publisher.close()));
|
|
57
|
+
const errors = results.flatMap((result) => result.status === 'rejected' ? [result.reason] : []);
|
|
58
|
+
if (errors.length === 1)
|
|
59
|
+
throw errors[0];
|
|
60
|
+
if (errors.length > 1)
|
|
61
|
+
throw new AggregateError(errors, 'Failed to close global config publishers');
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=global-config-runtime.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-config-runtime.service.js","sourceRoot":"","sources":["../../src/services/global-config-runtime.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,eAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,eAAe,aAAa,CAAC,8BAA8B,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC9E,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACjE,WAAW,CAAC,kBAAkB,CAAC;QAC/B,WAAW,CAAC,aAAa,CAAC;QAC1B,WAAW,CAAC,eAAe,CAAC;QAC5B,WAAW,CAAC,aAAa,CAAC;KAC3B,CAAC,CAAC;IACH,MAAM,iBAAiB,GAAG,IAAI,4BAA4B,CAAC,QAAQ,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,IAAI,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC3D,MAAM,qBAAqB,GAAG,IAAI,yBAAyB,CACzD,WAAW,EACX,iBAAiB,EACjB,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,iBAAiB,EAC9C,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,K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;QAAE,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,cAAc,CAAC,MAAM,EAAE,0CAA0C,CAAC,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-config.boot.d.ts","sourceRoot":"","sources":["../../src/services/global-config.boot.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineService, loadService } from '@hile/core';
|
|
2
|
+
import globalConfigRuntimeService from './global-config-runtime.service.js';
|
|
3
|
+
import mcpProviderService from './mcp-provider.service.js';
|
|
4
|
+
export default defineService('zlooks.global-config.boot', async () => {
|
|
5
|
+
await loadService(globalConfigRuntimeService);
|
|
6
|
+
return loadService(mcpProviderService);
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=global-config.boot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-config.boot.js","sourceRoot":"","sources":["../../src/services/global-config.boot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,0BAA0B,MAAM,oCAAoC,CAAC;AAC5E,OAAO,kBAAkB,MAAM,2BAA2B,CAAC;AAE3D,eAAe,aAAa,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;IACnE,MAAM,WAAW,CAAC,0BAA0B,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC,kBAAkB,CAAC,CAAC;AACzC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.service.d.ts","sourceRoot":"","sources":["../../src/services/logger.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineService } from '@hile/core';
|
|
2
|
+
import { createLogger } from '@hile/logger';
|
|
3
|
+
export default defineService('zlooks.global-config.logger', async (shutdown) => {
|
|
4
|
+
const { logger, teardown } = createLogger({ level: 'info', pretty: false });
|
|
5
|
+
shutdown(teardown);
|
|
6
|
+
return logger;
|
|
7
|
+
});
|
|
8
|
+
//# sourceMappingURL=logger.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.service.js","sourceRoot":"","sources":["../../src/services/logger.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAe,MAAM,cAAc,CAAC;AAEzD,eAAe,aAAa,CAAC,6BAA6B,EAAE,KAAK,EAAE,QAAQ,EAAmB,EAAE;IAC9F,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-provider.service.d.ts","sourceRoot":"","sources":["../../src/services/mcp-provider.service.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineService, loadService } from '@hile/core';
|
|
2
|
+
import { attachMcpProvider } from '@hile/mcp/micro';
|
|
3
|
+
import { createGlobalConfigMcpProvider } from '../mcp/global-config-provider.js';
|
|
4
|
+
import applicationService from './application.service.js';
|
|
5
|
+
import globalConfigRuntimeService from './global-config-runtime.service.js';
|
|
6
|
+
export default defineService('zlooks.global-config.mcp-provider', async (shutdown) => {
|
|
7
|
+
const [application, runtime] = await Promise.all([
|
|
8
|
+
loadService(applicationService),
|
|
9
|
+
loadService(globalConfigRuntimeService),
|
|
10
|
+
]);
|
|
11
|
+
const attachment = await attachMcpProvider(application, createGlobalConfigMcpProvider(runtime), {
|
|
12
|
+
// Deployment trust boundary: only fully trusted services can reach the internal
|
|
13
|
+
// Hile Micro mesh, so Provider invocation intentionally requires no shared secret.
|
|
14
|
+
invocationSecurity: { mode: 'trusted-internal' },
|
|
15
|
+
});
|
|
16
|
+
shutdown(() => attachment.close());
|
|
17
|
+
return attachment;
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=mcp-provider.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-provider.service.js","sourceRoot":"","sources":["../../src/services/mcp-provider.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,0BAA0B,MAAM,oCAAoC,CAAC;AAE5E,eAAe,aAAa,CAAC,mCAAmC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IACnF,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC/C,WAAW,CAAC,kBAAkB,CAAC;QAC/B,WAAW,CAAC,0BAA0B,CAAC;KACxC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,MAAM,iBAAiB,CACxC,WAAW,EACX,6BAA6B,CAAC,OAAO,CAAC,EACtC;QACE,gFAAgF;QAChF,mFAAmF;QACnF,kBAAkB,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;KACjD,CACF,CAAC;IACF,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IACnC,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC,CAAC"}
|