@dougongjs/core 0.0.3 → 0.1.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/README.md +18 -18
- package/dist/change-set.d.ts +27 -27
- package/dist/change-set.d.ts.map +1 -1
- package/dist/configuration.d.ts +4 -0
- package/dist/configuration.d.ts.map +1 -0
- package/dist/contract-registry.d.ts +1 -1
- package/dist/contract-registry.d.ts.map +1 -1
- package/dist/contracts.d.ts +6 -5
- package/dist/contracts.d.ts.map +1 -1
- package/dist/{extension-store.d.ts → contribution-store.d.ts} +14 -15
- package/dist/contribution-store.d.ts.map +1 -0
- package/dist/diagnostics.d.ts +13 -12
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/engine.d.ts +32 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/errors.d.ts +6 -9
- package/dist/errors.d.ts.map +1 -1
- package/dist/event-hub.d.ts +6 -2
- package/dist/event-hub.d.ts.map +1 -1
- package/dist/group-coordinator.d.ts +27 -26
- package/dist/group-coordinator.d.ts.map +1 -1
- package/dist/group-lifecycle.d.ts +2 -2
- package/dist/group-lifecycle.d.ts.map +1 -1
- package/dist/group.d.ts +2 -2
- package/dist/group.d.ts.map +1 -1
- package/dist/host-api.d.ts +72 -0
- package/dist/host-api.d.ts.map +1 -0
- package/dist/host.d.ts +6 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1412 -1166
- package/dist/installation-graph.d.ts +17 -0
- package/dist/installation-graph.d.ts.map +1 -0
- package/dist/installation-registry.d.ts +49 -0
- package/dist/installation-registry.d.ts.map +1 -0
- package/dist/installation.d.ts +46 -0
- package/dist/installation.d.ts.map +1 -0
- package/dist/lifecycle-status.d.ts +2 -0
- package/dist/lifecycle-status.d.ts.map +1 -0
- package/dist/lifetime-diagnostics.d.ts +2 -2
- package/dist/lifetime-diagnostics.d.ts.map +1 -1
- package/dist/lifetime.d.ts +17 -16
- package/dist/lifetime.d.ts.map +1 -1
- package/dist/plugin.d.ts +11 -7
- package/dist/plugin.d.ts.map +1 -1
- package/dist/readonly-map.d.ts.map +1 -1
- package/dist/record.d.ts +8 -0
- package/dist/record.d.ts.map +1 -0
- package/dist/resource.d.ts +7 -3
- package/dist/resource.d.ts.map +1 -1
- package/dist/runtime.d.ts +33 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/snapshot-view.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/application-api.d.ts +0 -51
- package/dist/application-api.d.ts.map +0 -1
- package/dist/application-runtime.d.ts +0 -36
- package/dist/application-runtime.d.ts.map +0 -1
- package/dist/application.d.ts +0 -6
- package/dist/application.d.ts.map +0 -1
- package/dist/extension-store.d.ts.map +0 -1
- package/dist/plugin-graph.d.ts +0 -17
- package/dist/plugin-graph.d.ts.map +0 -1
- package/dist/plugin-installation.d.ts +0 -44
- package/dist/plugin-installation.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -14,15 +14,15 @@ npm install @dougongjs/core
|
|
|
14
14
|
|
|
15
15
|
### 六个原子
|
|
16
16
|
|
|
17
|
-
- **`Service`** —— 稳定的一对一能力。依赖通过 `requires`
|
|
18
|
-
- **`
|
|
17
|
+
- **`Service`** —— 稳定的一对一能力。依赖通过 `requires` 显式声明,Instance 生命周期内不变;提供者变化会重建消费者,不使用 live Proxy。
|
|
18
|
+
- **`ExtensionPoint`** —— 可动态增删的开放贡献集合。Core 只保存原始贡献;排序、领域 key、覆盖和 pipeline 是高层组合策略。
|
|
19
19
|
- **`Event`** —— 不保留状态的瞬时事实。只有一种分发语义:并发广播并等待全部监听器。
|
|
20
20
|
- **`Lifetime`** —— 监听、贡献、任务、子生命周期与清理的结构化所有权。终态资源自动从父级摘除。
|
|
21
21
|
- **`Plugin`** —— 一次 `setup` 产生一组能力。
|
|
22
|
-
- **`
|
|
22
|
+
- **`Host`** / **`ChangeSet`** —— 事务化的安装图;失败回滚,无法可靠回滚时 fail closed。
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
|
-
import {
|
|
25
|
+
import { createHost, definePlugin, service } from "@dougongjs/core"
|
|
26
26
|
|
|
27
27
|
const DATABASE = service<Database>("app/database")
|
|
28
28
|
|
|
@@ -36,16 +36,16 @@ const database = definePlugin({
|
|
|
36
36
|
},
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
await
|
|
39
|
+
const host = createHost({ name: "api" })
|
|
40
|
+
host.install(database)
|
|
41
|
+
await host.start()
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
不使用 Service Locator、环境作用域、原型链注入或 Proxy
|
|
44
|
+
不使用 Service Locator、环境作用域、原型链注入或 Proxy。唯一包依赖 `@standard-schema/spec` 只提供类型契约,不进入运行时 bundle。
|
|
45
45
|
|
|
46
46
|
### 环境要求
|
|
47
47
|
|
|
48
|
-
Node.js ≥ 22 或等价的 ES2024
|
|
48
|
+
Node.js ≥ 22 或等价的 ES2024 运行时。TypeScript 消费者需要
|
|
49
49
|
`"lib": ["ES2024", "DOM", "DOM.Iterable", "ESNext.Disposable"]`。
|
|
50
50
|
|
|
51
51
|
---
|
|
@@ -60,15 +60,15 @@ npm install @dougongjs/core
|
|
|
60
60
|
|
|
61
61
|
### Six atoms
|
|
62
62
|
|
|
63
|
-
- **`Service`** — a stable one-to-one capability. Dependencies are declared explicitly through `requires` and stay fixed for the
|
|
64
|
-
- **`
|
|
63
|
+
- **`Service`** — a stable one-to-one capability. Dependencies are declared explicitly through `requires` and stay fixed for the Instance lifetime; a provider change rebuilds consumers rather than using a live proxy.
|
|
64
|
+
- **`ExtensionPoint`** — an open contribution set that adds and removes live. Core keeps only raw contributions; ordering, domain keys, override and pipelines are higher-level composition policy.
|
|
65
65
|
- **`Event`** — a transient fact retaining no state, with one dispatch semantic: broadcast concurrently and await every listener.
|
|
66
66
|
- **`Lifetime`** — structured ownership of listeners, contributions, tasks, child lifetimes and cleanups. Terminal resources detach from their parent automatically.
|
|
67
67
|
- **`Plugin`** — one `setup` producing a set of capabilities.
|
|
68
|
-
- **`
|
|
68
|
+
- **`Host`** / **`ChangeSet`** — a transactional installation graph; a failure rolls back, and fails closed when it cannot roll back reliably.
|
|
69
69
|
|
|
70
70
|
```ts
|
|
71
|
-
import {
|
|
71
|
+
import { createHost, definePlugin, service } from "@dougongjs/core"
|
|
72
72
|
|
|
73
73
|
const DATABASE = service<Database>("app/database")
|
|
74
74
|
|
|
@@ -82,16 +82,16 @@ const database = definePlugin({
|
|
|
82
82
|
},
|
|
83
83
|
})
|
|
84
84
|
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
await
|
|
85
|
+
const host = createHost({ name: "api" })
|
|
86
|
+
host.install(database)
|
|
87
|
+
await host.start()
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
No service locator, ambient scope, prototype-chain injection or proxy. The only
|
|
90
|
+
No service locator, ambient scope, prototype-chain injection or proxy. The only package dependency, `@standard-schema/spec`, supplies types and does not enter the runtime bundle.
|
|
91
91
|
|
|
92
92
|
### Requirements
|
|
93
93
|
|
|
94
|
-
Node.js ≥ 22 or an equivalent ES2024
|
|
94
|
+
Node.js ≥ 22 or an equivalent ES2024 runtime. TypeScript consumers need
|
|
95
95
|
`"lib": ["ES2024", "DOM", "DOM.Iterable", "ESNext.Disposable"]`.
|
|
96
96
|
|
|
97
97
|
---
|
package/dist/change-set.d.ts
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
type
|
|
1
|
+
import { ChangeSet, Installation, InstallationUpdate } from './host-api';
|
|
2
|
+
import { InstallationRecord } from './installation';
|
|
3
|
+
import { ErasedPlugin, Plugin, Provisions, Requirements } from './plugin';
|
|
4
|
+
type DeclarationUpdate = {
|
|
5
5
|
readonly kind: "plugin";
|
|
6
|
-
readonly plugin:
|
|
6
|
+
readonly plugin: ErasedPlugin;
|
|
7
7
|
} | {
|
|
8
8
|
readonly kind: "config";
|
|
9
9
|
readonly config: unknown;
|
|
10
10
|
} | {
|
|
11
11
|
readonly kind: "plugin-and-config";
|
|
12
|
-
readonly plugin:
|
|
12
|
+
readonly plugin: ErasedPlugin;
|
|
13
13
|
readonly config: unknown;
|
|
14
14
|
};
|
|
15
|
-
export type
|
|
15
|
+
export type ChangeOperation = {
|
|
16
16
|
readonly kind: "install";
|
|
17
|
-
readonly installation:
|
|
17
|
+
readonly installation: InstallationRecord;
|
|
18
18
|
} | {
|
|
19
19
|
readonly kind: "update";
|
|
20
|
-
readonly installation:
|
|
21
|
-
readonly declaration:
|
|
20
|
+
readonly installation: InstallationRecord;
|
|
21
|
+
readonly declaration: DeclarationUpdate;
|
|
22
22
|
} | {
|
|
23
23
|
readonly kind: "remove";
|
|
24
|
-
readonly installation:
|
|
24
|
+
readonly installation: InstallationRecord;
|
|
25
25
|
};
|
|
26
|
-
interface
|
|
27
|
-
create(plugin:
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
26
|
+
interface ChangePort {
|
|
27
|
+
create(plugin: ErasedPlugin, config: unknown): {
|
|
28
|
+
readonly record: InstallationRecord;
|
|
29
|
+
readonly publicInstallation: object;
|
|
30
30
|
};
|
|
31
|
-
resolve(
|
|
32
|
-
execute(operations: ReadonlyArray<
|
|
33
|
-
attach(installation:
|
|
34
|
-
discard(installation:
|
|
31
|
+
resolve(installation: object): InstallationRecord;
|
|
32
|
+
execute(operations: ReadonlyArray<ChangeOperation>): Promise<void>;
|
|
33
|
+
attach(installation: InstallationRecord): void;
|
|
34
|
+
discard(installation: InstallationRecord, error: unknown): void;
|
|
35
35
|
}
|
|
36
|
-
export declare function
|
|
36
|
+
export declare function discardChangeSetDraft(draft: ChangeSetDraft, error: unknown): void;
|
|
37
37
|
/**
|
|
38
38
|
* Rich one-shot draft for the canonical mutation path. It owns target
|
|
39
|
-
* uniqueness,
|
|
40
|
-
*
|
|
39
|
+
* uniqueness, Installation authority, sealing and commit idempotency before
|
|
40
|
+
* the Host ever sees a candidate graph.
|
|
41
41
|
*/
|
|
42
|
-
export declare class
|
|
42
|
+
export declare class ChangeSetDraft implements ChangeSet {
|
|
43
43
|
#private;
|
|
44
|
-
constructor(
|
|
45
|
-
install<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(plugin:
|
|
46
|
-
update<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(
|
|
47
|
-
remove<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(
|
|
44
|
+
constructor(port: ChangePort);
|
|
45
|
+
install<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(plugin: Plugin<Config, Requires, Provides, ConfigInput>, ...config: [ConfigInput] extends [void] ? [config?: ConfigInput] : [config: ConfigInput]): Installation<Config, Requires, Provides, ConfigInput>;
|
|
46
|
+
update<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(installation: Installation<Config, Requires, Provides, ConfigInput>, update: InstallationUpdate<Config, Requires, Provides, ConfigInput>): this;
|
|
47
|
+
remove<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(installation: Installation<Config, Requires, Provides, ConfigInput>): this;
|
|
48
48
|
commit(): Promise<void>;
|
|
49
49
|
}
|
|
50
50
|
export {};
|
package/dist/change-set.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-set.d.ts","sourceRoot":"","sources":["../src/change-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"change-set.d.ts","sourceRoot":"","sources":["../src/change-set.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,YAAY,EAClB,MAA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CAAC;CACjE;AAUD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,QAE1E;AAED;;;;GAIG;AACH,qBAAa,cAAe,YAAW,SAAS;;gBAIlC,IAAI,EAAE,UAAU;IAM5B,OAAO,CAAC,MAAM,EAAE,QAAQ,SAAS,YAAY,EAAE,QAAQ,SAAS,UAAU,EAAE,WAAW,EACrF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,EACvD,GAAG,MAAM,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GACvF,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC;IAQxD,MAAM,CAAC,MAAM,EAAE,QAAQ,SAAS,YAAY,EAAE,QAAQ,SAAS,UAAU,EAAE,WAAW,EACpF,YAAY,EAAE,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,EACnE,MAAM,EAAE,kBAAkB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC;IA8BrE,MAAM,CAAC,MAAM,EAAE,QAAQ,SAAS,YAAY,EAAE,QAAQ,SAAS,UAAU,EAAE,WAAW,EACpF,YAAY,EAAE,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC;IAOrE,MAAM;CAqEP"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
/** Resolves one Plugin config at the Standard Schema trust boundary. */
|
|
3
|
+
export declare function resolvePluginConfig(schema: StandardSchemaV1<unknown, unknown> | undefined, input: unknown, installationId: string): Promise<unknown>;
|
|
4
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,wEAAwE;AACxE,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,SAAS,EACtD,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,MAAM,oBA6BvB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContractIdentity, ContractKind } from './contracts';
|
|
2
|
-
/**
|
|
2
|
+
/** Host-wide identity registry with an explicit draft commit boundary. */
|
|
3
3
|
export declare class ContractRegistry {
|
|
4
4
|
#private;
|
|
5
5
|
get kinds(): ReadonlyMap<string, ContractKind>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-registry.d.ts","sourceRoot":"","sources":["../src/contract-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGlE,
|
|
1
|
+
{"version":3,"file":"contract-registry.d.ts","sourceRoot":"","sources":["../src/contract-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGlE,0EAA0E;AAC1E,qBAAa,gBAAgB;;IAG3B,IAAI,KAAK,IAAI,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAE7C;IAED,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB;IAI3C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB;IAInC,KAAK,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC;IAIvD,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC;CAIhD;AAYD,qBAAa,qBAAqB;;gBAGpB,QAAQ,EAAE,gBAAgB,EAAE,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC;IAKzF,QAAQ,CAAC,QAAQ,EAAE,gBAAgB;IAenC,MAAM;IAON,OAAO;CAGR;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,QAAQ,EAAE,gBAAgB,QAGhG"}
|
package/dist/contracts.d.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
declare const contractType: unique symbol;
|
|
2
|
-
export type ContractKind = "service" | "
|
|
2
|
+
export type ContractKind = "service" | "extensionPoint" | "event";
|
|
3
3
|
export interface ContractIdentity {
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly kind: ContractKind;
|
|
6
6
|
}
|
|
7
7
|
interface Contract<T, K extends ContractKind> extends ContractIdentity {
|
|
8
8
|
readonly kind: K;
|
|
9
|
-
readonly [contractType]
|
|
9
|
+
readonly [contractType]: T;
|
|
10
10
|
}
|
|
11
11
|
export interface Service<T> extends Contract<T, "service"> {
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface ExtensionPoint<T> extends Contract<T, "extensionPoint"> {
|
|
14
14
|
}
|
|
15
15
|
export interface Event<T> extends Contract<T, "event"> {
|
|
16
16
|
}
|
|
17
17
|
export interface OptionalService<T> {
|
|
18
18
|
readonly kind: "optional";
|
|
19
19
|
readonly service: Service<T>;
|
|
20
|
+
readonly [contractType]: T;
|
|
20
21
|
}
|
|
21
|
-
export type Requirement<T = unknown> = Service<T> |
|
|
22
|
+
export type Requirement<T = unknown> = Service<T> | ExtensionPoint<T> | OptionalService<T>;
|
|
22
23
|
export type ContractValue<T> = T extends Contract<infer Value, ContractKind> ? Value : never;
|
|
23
24
|
export declare function isContract(value: unknown, expected?: ContractKind): value is ContractIdentity;
|
|
24
25
|
export declare function assertContract(value: unknown, expected?: ContractKind): asserts value is ContractIdentity;
|
|
25
26
|
export declare function service<T>(id: string): Service<T>;
|
|
26
27
|
export declare function event<T>(id: string): Event<T>;
|
|
27
|
-
export declare function
|
|
28
|
+
export declare function extensionPoint<T>(id: string): ExtensionPoint<T>;
|
|
28
29
|
export declare function optional<T>(token: Service<T>): OptionalService<T>;
|
|
29
30
|
export {};
|
|
30
31
|
//# sourceMappingURL=contracts.d.ts.map
|
package/dist/contracts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY,EAAE,OAAO,MAAwC,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY,EAAE,OAAO,MAAwC,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,gBAAgB,GAAG,OAAO,CAAC;AAElE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;CAC7B;AAED,UAAU,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,YAAY,CAAE,SAAQ,gBAAgB;IACpE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,CAAE,SAAQ,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC;CAAG;AAC7D,MAAM,WAAW,cAAc,CAAC,CAAC,CAAE,SAAQ,QAAQ,CAAC,CAAC,EAAE,gBAAgB,CAAC;CAAG;AAC3E,MAAM,WAAW,KAAK,CAAC,CAAC,CAAE,SAAQ,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC;CAAG;AAEzD,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7B,QAAQ,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;CAC5B;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AAE3F,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,KAAK,EAAE,YAAY,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC;AAgB7F,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,YAAY,GAAG,KAAK,IAAI,gBAAgB,CAY7F;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,YAAY,GACtB,OAAO,CAAC,KAAK,IAAI,gBAAgB,CAGnC;AAQD,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAEjD;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAE7C;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,CAE/D;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAKjE"}
|
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExtensionPoint } from './contracts';
|
|
2
2
|
import { Disposable, Publication, StagedResource } from './resource';
|
|
3
3
|
import { SnapshotView } from './snapshot-view';
|
|
4
4
|
export interface Contribution<T> extends Disposable {
|
|
5
5
|
update(value: T): void;
|
|
6
6
|
}
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
7
|
+
export type ContributionView<T> = SnapshotView<ReadonlyMap<string, T>>;
|
|
8
|
+
export type ContributionLeaseKind = "view" | "subscription";
|
|
9
9
|
declare class ContributionRecord<T> implements StagedResource<Contribution<T>> {
|
|
10
10
|
#private;
|
|
11
11
|
readonly handle: Contribution<T>;
|
|
12
|
-
constructor(store:
|
|
12
|
+
constructor(store: ContributionStore<T>, id: string, initialValue: T, detachFromOwner: (publication: Publication) => void);
|
|
13
13
|
publish(): void;
|
|
14
|
+
commitPublication(): void;
|
|
14
15
|
update(value: T): void;
|
|
15
16
|
dispose(): void;
|
|
16
17
|
[Symbol.dispose](): void;
|
|
17
18
|
}
|
|
18
|
-
export declare class
|
|
19
|
+
export declare class ContributionStore<T> {
|
|
19
20
|
#private;
|
|
20
|
-
constructor(invalidate: (store:
|
|
21
|
+
constructor(invalidate: (store: ContributionStore<unknown>) => void, report: (error: unknown) => void, releaseIfUnused: (store: ContributionStore<unknown>) => void);
|
|
21
22
|
stage(ownerId: string, key: string, value: T, release: (publication: Publication) => void): ContributionRecord<T>;
|
|
22
|
-
view(own: (resource: Disposable, kind:
|
|
23
|
+
view(own: (resource: Disposable, kind: ContributionLeaseKind) => () => void): ContributionView<T>;
|
|
23
24
|
snapshot(): ReadonlyMap<string, T>;
|
|
24
|
-
subscribe(listener: () => void, own: (resource: Disposable, kind:
|
|
25
|
+
subscribe(listener: () => void, own: (resource: Disposable, kind: ContributionLeaseKind) => () => void): ContributionSubscription;
|
|
25
26
|
insert(id: string, contribution: ContributionRecord<T>, value: T): void;
|
|
26
27
|
update(id: string, contribution: ContributionRecord<T>, value: T): void;
|
|
27
28
|
removeContribution(id: string, contribution: ContributionRecord<T>, visibility: "staged" | "published"): void;
|
|
28
29
|
publishSnapshot(): void;
|
|
29
|
-
removeListener(listener: () => void): void;
|
|
30
30
|
}
|
|
31
|
-
declare class
|
|
31
|
+
declare class ContributionSubscription implements Disposable {
|
|
32
32
|
#private;
|
|
33
|
-
constructor(
|
|
33
|
+
constructor(subscription: Disposable, release: () => void);
|
|
34
34
|
dispose(): void;
|
|
35
35
|
[Symbol.dispose](): void;
|
|
36
36
|
}
|
|
37
|
-
export declare class
|
|
37
|
+
export declare class ContributionRegistry {
|
|
38
38
|
#private;
|
|
39
39
|
constructor(report: (error: unknown) => void);
|
|
40
|
-
get<T>(token:
|
|
40
|
+
get<T>(token: ExtensionPoint<T>): ContributionStore<T>;
|
|
41
41
|
beginBatch(): void;
|
|
42
42
|
endBatch(): void;
|
|
43
43
|
}
|
|
44
|
-
export type ExtensionRequirementView<T> = T extends Extension<infer Value> ? ExtensionView<Value> : never;
|
|
45
44
|
export {};
|
|
46
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=contribution-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contribution-store.d.ts","sourceRoot":"","sources":["../src/contribution-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEvE,MAAM,WAAW,YAAY,CAAC,CAAC,CAAE,SAAQ,UAAU;IACjD,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,YAAY,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvE,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,cAAc,CAAC;AAwE5D,cAAM,kBAAkB,CAAC,CAAC,CAAE,YAAW,cAAc,CAAC,YAAY,CAAC,CAAC,CA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E,CAAC;IAMhE,kBAAkB,CAChB,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,kBAAkB,CAAC,CAAC,CAAC,EACnC,UAAU,EAAE,QAAQ,GAAG,WAAW;IAgBpC,eAAe;CA0ChB;AA4BD,cAAM,wBAAyB,YAAW,UAAU;;gBAQtC,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,IAAI;IAKzD,OAAO;IAWP,CAAC,MAAM,CAAC,OAAO,CAAC;CAGjB;AAED,qBAAa,oBAAoB;;gBAMnB,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;IAI5C,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAgBtD,UAAU;IAIV,QAAQ;CA0BT"}
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import { GroupNode } from './group';
|
|
2
|
+
import { InstallationRecord } from './installation';
|
|
2
3
|
import { LifetimeSnapshot } from './lifetime';
|
|
3
|
-
import {
|
|
4
|
+
import { LifecycleStatus } from './lifecycle-status';
|
|
4
5
|
import { SnapshotView } from './snapshot-view';
|
|
5
|
-
export type
|
|
6
|
-
export interface
|
|
6
|
+
export type HostStatus = "idle" | "starting" | "active" | "changing" | "stopping";
|
|
7
|
+
export interface InstallationSnapshot {
|
|
7
8
|
readonly id: string;
|
|
8
|
-
readonly
|
|
9
|
+
readonly pluginName: string;
|
|
9
10
|
readonly groupId: string;
|
|
10
|
-
readonly status:
|
|
11
|
+
readonly status: LifecycleStatus;
|
|
11
12
|
readonly requires: ReadonlyArray<string>;
|
|
12
13
|
readonly provides: ReadonlyArray<string>;
|
|
13
14
|
readonly lifetime?: SnapshotView<LifetimeSnapshot>;
|
|
14
|
-
readonly error?:
|
|
15
|
+
readonly error?: Error;
|
|
15
16
|
}
|
|
16
17
|
export interface GroupSnapshot {
|
|
17
18
|
readonly id: string;
|
|
18
19
|
readonly name: string;
|
|
19
20
|
readonly parentId?: string;
|
|
20
21
|
}
|
|
21
|
-
export interface
|
|
22
|
+
export interface HostSnapshot {
|
|
22
23
|
readonly name: string;
|
|
23
|
-
readonly status:
|
|
24
|
+
readonly status: HostStatus;
|
|
24
25
|
readonly revision: number;
|
|
25
|
-
readonly
|
|
26
|
+
readonly installations: ReadonlyMap<string, InstallationSnapshot>;
|
|
26
27
|
readonly groups: ReadonlyMap<string, GroupSnapshot>;
|
|
27
28
|
}
|
|
28
29
|
/** Immutable operational read model; never a service locator or control plane. */
|
|
29
|
-
export declare class
|
|
30
|
+
export declare class HostDiagnostics {
|
|
30
31
|
#private;
|
|
31
|
-
readonly view: SnapshotView<
|
|
32
|
+
readonly view: SnapshotView<HostSnapshot>;
|
|
32
33
|
constructor(name: string, groups: Iterable<GroupNode>, report: (error: unknown) => void);
|
|
33
|
-
publish(status:
|
|
34
|
+
publish(status: HostStatus, installations: Iterable<InstallationRecord>, groups: Iterable<GroupNode>): void;
|
|
34
35
|
}
|
|
35
36
|
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AA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AAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;IAOvF,OAAO,CACL,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAC3C,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;CAqD9B"}
|
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Service } from './contracts';
|
|
2
|
+
import { InstallationGraph } from './installation-graph';
|
|
3
|
+
import { InstallationRecord } from './installation';
|
|
4
|
+
import { Logger } from './lifetime';
|
|
5
|
+
export type TransitionOutcome = {
|
|
6
|
+
readonly kind: "committed";
|
|
7
|
+
readonly affected: ReadonlySet<InstallationRecord>;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "rolled-back";
|
|
10
|
+
readonly affected: ReadonlySet<InstallationRecord>;
|
|
11
|
+
readonly error: unknown;
|
|
12
|
+
};
|
|
13
|
+
interface EngineOptions {
|
|
14
|
+
readonly hostName: string;
|
|
15
|
+
readonly logger: Logger;
|
|
16
|
+
readonly isInstalled: (installationId: string) => boolean;
|
|
17
|
+
readonly report: (error: unknown) => void;
|
|
18
|
+
}
|
|
19
|
+
type ServiceAvailability = "available" | "unavailable";
|
|
20
|
+
/** Owns the committed plan and its commit, rollback and fail-closed transitions. */
|
|
21
|
+
export declare class Engine {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(options: EngineOptions);
|
|
24
|
+
get hasCommittedPlan(): boolean;
|
|
25
|
+
get<T>(token: Service<T>, availability: ServiceAvailability): T;
|
|
26
|
+
buildPlan(installations: Iterable<InstallationRecord>): InstallationGraph;
|
|
27
|
+
start(plan: InstallationGraph): Promise<void>;
|
|
28
|
+
stop(): Promise<unknown[]>;
|
|
29
|
+
transition(nextPlan: InstallationGraph, changed: ReadonlySet<InstallationRecord>, restoreDeclarations: () => void): Promise<TransitionOutcome>;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
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AAC;IAI/C,KAAK,CAAC,IAAI,EAAE,iBAAiB;IAY7B,IAAI;IAMJ,UAAU,CACd,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC,EACxC,mBAAmB,EAAE,MAAM,IAAI,GAC9B,OAAO,CAAC,iBAAiB,CAAC;CAsI9B"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
+
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
1
2
|
export declare class DougongError extends Error {
|
|
2
3
|
readonly code: string;
|
|
3
4
|
name: string;
|
|
4
5
|
constructor(code: string, message: string, options?: ErrorOptions);
|
|
5
6
|
}
|
|
6
|
-
/** Preserves Error values and classifies non-Error rejection reasons. */
|
|
7
|
+
/** Preserves explicit Error values and classifies non-Error rejection reasons. */
|
|
7
8
|
export declare function normalizeFailure(error: unknown, code: string, message: string): Error;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly path?: ReadonlyArray<PropertyKey | {
|
|
11
|
-
readonly key: PropertyKey;
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
9
|
+
/** Classifies the exact signal reason or a conventional AbortError, but only after abort. */
|
|
10
|
+
export declare function isCancellationReason(signal: AbortSignal, error: unknown): boolean;
|
|
14
11
|
export declare class ConfigValidationError extends DougongError {
|
|
15
12
|
name: string;
|
|
16
|
-
readonly issues: ReadonlyArray<
|
|
17
|
-
constructor(issues: ReadonlyArray<
|
|
13
|
+
readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
|
|
14
|
+
constructor(issues: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
18
15
|
}
|
|
19
16
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;aAInB,IAAI,EAAE,MAAM;IAHrB,IAAI,SAAkB;gBAGb,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY;CAIzB;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,qBAAa,YAAa,SAAQ,KAAK;aAInB,IAAI,EAAE,MAAM;IAHrB,IAAI,SAAkB;gBAGb,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,YAAY;CAIzB;AAKD,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAKrF;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,WAcvE;AAED,qBAAa,qBAAsB,SAAQ,YAAY;IAC5C,IAAI,SAA2B;IACxC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBAE3C,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAC;CAQ1D"}
|
package/dist/event-hub.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Disposable, Publication, StagedResource } from './resource';
|
|
2
2
|
export type EventListener<T> = (payload: T) => unknown;
|
|
3
|
+
interface ListenerSlot<T> {
|
|
4
|
+
readonly listener: EventListener<T>;
|
|
5
|
+
}
|
|
3
6
|
export declare class EventHub {
|
|
4
7
|
#private;
|
|
5
8
|
stage<T>(eventId: string, listener: EventListener<T>, release: (publication: Publication) => void): StagedResource<Disposable>;
|
|
6
|
-
add<T>(eventId: string,
|
|
7
|
-
delete<T>(eventId: string,
|
|
9
|
+
add<T>(eventId: string, slot: ListenerSlot<T>): void;
|
|
10
|
+
delete<T>(eventId: string, slot: ListenerSlot<T>): void;
|
|
8
11
|
emit<T>(eventId: string, payload: T): Promise<void>;
|
|
9
12
|
}
|
|
13
|
+
export {};
|
|
10
14
|
//# sourceMappingURL=event-hub.d.ts.map
|
package/dist/event-hub.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-hub.d.ts","sourceRoot":"","sources":["../src/event-hub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1E,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"event-hub.d.ts","sourceRoot":"","sources":["../src/event-hub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE1E,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC;AAEvD,UAAU,YAAY,CAAC,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;CACrC;AAqED,qBAAa,QAAQ;;IAGnB,KAAK,CAAC,CAAC,EACL,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,GAC1C,cAAc,CAAC,UAAU,CAAC;IAK7B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAM7C,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAO1C,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;CAe1C"}
|
|
@@ -1,45 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Group, Installation } from './host-api';
|
|
2
|
+
import { ChangeSetDraft, ChangeOperation } from './change-set';
|
|
3
3
|
import { GroupConfigurationSession, GroupNode } from './group';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly
|
|
4
|
+
import { InstallationRecord } from './installation';
|
|
5
|
+
import { LifecycleStatus } from './lifecycle-status';
|
|
6
|
+
import { ErasedPlugin, Plugin, Provisions, Requirements } from './plugin';
|
|
7
|
+
export interface GroupCoordinatorPort {
|
|
8
|
+
installations(): Iterable<InstallationRecord>;
|
|
9
|
+
createDraft(group: GroupNode, plugin: ErasedPlugin, config: unknown): {
|
|
10
|
+
readonly record: InstallationRecord;
|
|
11
|
+
readonly publicInstallation: object;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
executeChanges(operations: ReadonlyArray<
|
|
14
|
-
attachInstallation(installation:
|
|
15
|
-
discardInstallation(installation:
|
|
13
|
+
resolveInstallation(installation: object): InstallationRecord;
|
|
14
|
+
executeChanges(group: GroupNode, operations: ReadonlyArray<ChangeOperation>): Promise<void>;
|
|
15
|
+
attachInstallation(installation: InstallationRecord): void;
|
|
16
|
+
discardInstallation(installation: InstallationRecord, error: unknown): void;
|
|
16
17
|
runExclusive(operation: () => Promise<void>): Promise<void>;
|
|
17
|
-
removeInstallations(operations: ReadonlyArray<
|
|
18
|
+
removeInstallations(operations: ReadonlyArray<ChangeOperation>): Promise<void>;
|
|
18
19
|
notifyChanged(): void;
|
|
19
20
|
}
|
|
20
|
-
declare class
|
|
21
|
+
declare class GroupImpl implements Group {
|
|
21
22
|
#private;
|
|
22
|
-
constructor(coordinator: GroupCoordinator, node: GroupNode, configuration?: GroupConfigurationSession<
|
|
23
|
+
constructor(coordinator: GroupCoordinator, node: GroupNode, configuration?: GroupConfigurationSession<ChangeSetDraft>);
|
|
23
24
|
get id(): string;
|
|
24
25
|
get name(): string;
|
|
25
|
-
get status():
|
|
26
|
+
get status(): LifecycleStatus;
|
|
26
27
|
ready(): Promise<void>;
|
|
27
|
-
install<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(plugin:
|
|
28
|
-
change():
|
|
29
|
-
group(name: string, configure: (group:
|
|
28
|
+
install<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(plugin: Plugin<Config, Requires, Provides, ConfigInput>, ...config: [ConfigInput] extends [void] ? [config?: ConfigInput] : [config: ConfigInput]): Installation<Config, Requires, Provides, ConfigInput>;
|
|
29
|
+
change(): ChangeSetDraft;
|
|
30
|
+
group(name: string, configure: (group: Group) => void): GroupImpl;
|
|
30
31
|
remove(): Promise<void>;
|
|
31
32
|
}
|
|
32
|
-
/** Owns the complete structural Group model and compiles it to
|
|
33
|
+
/** Owns the complete structural Group model and compiles it to Installation changes. */
|
|
33
34
|
export declare class GroupCoordinator {
|
|
34
35
|
#private;
|
|
35
36
|
readonly root: GroupNode;
|
|
36
|
-
constructor(rootName: string,
|
|
37
|
+
constructor(rootName: string, port: GroupCoordinatorPort);
|
|
37
38
|
nodes(): GroupNode[];
|
|
38
|
-
install<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(group: GroupNode, plugin:
|
|
39
|
-
change(group: GroupNode, tracking?: "immediate" | "deferred"):
|
|
40
|
-
create(parent: GroupNode, name: string, configure: (group:
|
|
39
|
+
install<Config, Requires extends Requirements, Provides extends Provisions, ConfigInput>(group: GroupNode, plugin: Plugin<Config, Requires, Provides, ConfigInput>, ...config: [ConfigInput] extends [void] ? [config?: ConfigInput] : [config: ConfigInput]): Installation<Config, Requires, Provides, ConfigInput>;
|
|
40
|
+
change(group: GroupNode, tracking?: "immediate" | "deferred"): ChangeSetDraft;
|
|
41
|
+
create(parent: GroupNode, name: string, configure: (group: Group) => void, inherited?: GroupConfigurationSession<ChangeSetDraft>): GroupImpl;
|
|
41
42
|
ready(group: GroupNode): Promise<void>;
|
|
42
|
-
status(group: GroupNode):
|
|
43
|
+
status(group: GroupNode): LifecycleStatus;
|
|
43
44
|
remove(group: GroupNode): Promise<void>;
|
|
44
45
|
}
|
|
45
46
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-coordinator.d.ts","sourceRoot":"","sources":["../src/group-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"group-coordinator.d.ts","sourceRoot":"","sources":["../src/group-coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAyB,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAE3F,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE/E,MAAM,WAAW,oBAAoB;IACnC,aAAa,IAAI,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAC9C,WAAW,CACT,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,OAAO,GACd;QAAE,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;QAAC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAChF,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAC9D,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,CAAC,eAAe,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MAAM,EAAE,QAAQ,SAAS,YAAY,EAAE,QAAQ,SAAS,UAAU,EAAE,WAAW,EACrF,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,EACvD,GAAG,MAAM,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GACvF,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC;IAOxD,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,GAAE,WAAW,GAAG,UAAwB;IA+BzE,MAAM,CACJ,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,EACjC,SAAS,CAAC,EAAE,yBAAyB,CAAC,cAAc,CAAC;IAgDjD,KAAK,CAAC,KAAK,EAAE,SAAS;IAM5B,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,eAAe;IAKzC,MAAM,CAAC,KAAK,EAAE,SAAS;CAkExB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DougongError } from './errors';
|
|
2
2
|
import { GroupNode } from './group';
|
|
3
|
-
import {
|
|
3
|
+
import { LifecycleStatus } from './lifecycle-status';
|
|
4
4
|
/**
|
|
5
5
|
* Owns the readiness barrier for one structural Group node. A failed mutation
|
|
6
6
|
* cannot poison an established Group because transactions expose only the
|
|
@@ -10,7 +10,7 @@ export declare class GroupLifecycle {
|
|
|
10
10
|
#private;
|
|
11
11
|
readonly node: GroupNode;
|
|
12
12
|
constructor(node: GroupNode, initialState: "new" | "established", notifyChanged: () => void);
|
|
13
|
-
status(contents:
|
|
13
|
+
status(contents: LifecycleStatus): LifecycleStatus;
|
|
14
14
|
ready(readyContents: () => Promise<void>): Promise<void>;
|
|
15
15
|
track(operation: Promise<void>): void;
|
|
16
16
|
release(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-lifecycle.d.ts","sourceRoot":"","sources":["../src/group-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"group-lifecycle.d.ts","sourceRoot":"","sources":["../src/group-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAoB,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,cAAc;;IAKvB,QAAQ,CAAC,IAAI,EAAE,SAAS;gBAAf,IAAI,EAAE,SAAS,EACxB,YAAY,EAAE,KAAK,GAAG,aAAa,EACnC,aAAa,EAAE,MAAM,IAAI;IAM3B,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,eAAe;IAQ5C,KAAK,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;IAU9C,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC;IAwC9B,OAAO;CASR;AAaD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,gBAEjD"}
|