@arki/dot 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/LICENSE +21 -0
- package/README.md +201 -0
- package/dist/cli/discover.d.ts +65 -0
- package/dist/cli/discover.d.ts.map +1 -0
- package/dist/cli/discover.js +184 -0
- package/dist/cli/discover.js.map +1 -0
- package/dist/cli/error-codes.d.ts +49 -0
- package/dist/cli/error-codes.d.ts.map +1 -0
- package/dist/cli/error-codes.js +61 -0
- package/dist/cli/error-codes.js.map +1 -0
- package/dist/cli/files.d.ts +67 -0
- package/dist/cli/files.d.ts.map +1 -0
- package/dist/cli/files.js +80 -0
- package/dist/cli/files.js.map +1 -0
- package/dist/cli/index.d.ts +95 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +456 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/json.d.ts +38 -0
- package/dist/cli/json.d.ts.map +1 -0
- package/dist/cli/json.js +18 -0
- package/dist/cli/json.js.map +1 -0
- package/dist/cli/new.d.ts +105 -0
- package/dist/cli/new.d.ts.map +1 -0
- package/dist/cli/new.js +322 -0
- package/dist/cli/new.js.map +1 -0
- package/dist/cli/observability-probe.d.ts +28 -0
- package/dist/cli/observability-probe.d.ts.map +1 -0
- package/dist/cli/observability-probe.js +44 -0
- package/dist/cli/observability-probe.js.map +1 -0
- package/dist/cli/render-doctor.d.ts +26 -0
- package/dist/cli/render-doctor.d.ts.map +1 -0
- package/dist/cli/render-doctor.js +183 -0
- package/dist/cli/render-doctor.js.map +1 -0
- package/dist/cli/render-explain.d.ts +43 -0
- package/dist/cli/render-explain.d.ts.map +1 -0
- package/dist/cli/render-explain.js +127 -0
- package/dist/cli/render-explain.js.map +1 -0
- package/dist/define-app.d.ts +125 -0
- package/dist/define-app.d.ts.map +1 -0
- package/dist/define-app.js +126 -0
- package/dist/define-app.js.map +1 -0
- package/dist/dependency-graph.d.ts +25 -0
- package/dist/dependency-graph.d.ts.map +1 -0
- package/dist/dependency-graph.js +86 -0
- package/dist/dependency-graph.js.map +1 -0
- package/dist/diagnostics.d.ts +83 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +14 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel/app-instance.d.ts +62 -0
- package/dist/kernel/app-instance.d.ts.map +1 -0
- package/dist/kernel/app-instance.js +1040 -0
- package/dist/kernel/app-instance.js.map +1 -0
- package/dist/kernel/otel.d.ts +105 -0
- package/dist/kernel/otel.d.ts.map +1 -0
- package/dist/kernel/otel.js +218 -0
- package/dist/kernel/otel.js.map +1 -0
- package/dist/lifecycle-observer.d.ts +95 -0
- package/dist/lifecycle-observer.d.ts.map +1 -0
- package/dist/lifecycle-observer.js +19 -0
- package/dist/lifecycle-observer.js.map +1 -0
- package/dist/lifecycle.d.ts +94 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +78 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/manifest.d.ts +75 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +14 -0
- package/dist/manifest.js.map +1 -0
- package/dist/pip-contract.d.ts +219 -0
- package/dist/pip-contract.d.ts.map +1 -0
- package/dist/pip-contract.js +90 -0
- package/dist/pip-contract.js.map +1 -0
- package/dist/pip.d.ts +33 -0
- package/dist/pip.d.ts.map +1 -0
- package/dist/pip.js +25 -0
- package/dist/pip.js.map +1 -0
- package/dist/plugin-contract.d.ts +175 -0
- package/dist/plugin-contract.d.ts.map +1 -0
- package/dist/plugin-contract.js +45 -0
- package/dist/plugin-contract.js.map +1 -0
- package/dist/plugin.d.ts +30 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +24 -0
- package/dist/plugin.js.map +1 -0
- package/dist/test-harness.d.ts +42 -0
- package/dist/test-harness.d.ts.map +1 -0
- package/dist/test-harness.js +46 -0
- package/dist/test-harness.js.map +1 -0
- package/dist/timeline.d.ts +43 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +121 -0
- package/dist/timeline.js.map +1 -0
- package/package.json +68 -0
- package/templates/app-minimal/.gitignore.tmpl +6 -0
- package/templates/app-minimal/AGENTS.md.tmpl +66 -0
- package/templates/app-minimal/README.md.tmpl +24 -0
- package/templates/app-minimal/package.json.tmpl +21 -0
- package/templates/app-minimal/src/app.ts.tmpl +20 -0
- package/templates/app-minimal/src/env.ts.tmpl +12 -0
- package/templates/app-minimal/tests/boot.test.ts.tmpl +25 -0
- package/templates/app-minimal/tsconfig.json.tmpl +22 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lifecycle primitives for the DOT kernel.
|
|
3
|
+
*
|
|
4
|
+
* The kernel uses a 5-hook lifecycle that runs in dependency order:
|
|
5
|
+
*
|
|
6
|
+
* - `configure` — synchronous registration of metadata, routes, services
|
|
7
|
+
* - `boot` — async open of resources, publishes services into `app.services`
|
|
8
|
+
* - `start` — async start of active work (workers, schedulers, listeners)
|
|
9
|
+
* - `stop` — async stop of active work, runs in reverse-topological order
|
|
10
|
+
* - `dispose` — async release of booted resources, runs in reverse-topological order
|
|
11
|
+
*
|
|
12
|
+
* Hook semantics, failure ordering, and idempotency rules are documented on the
|
|
13
|
+
* public `DotApp` interface in `./define-app.ts`.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The complete set of lifecycle hooks in topological execution order.
|
|
17
|
+
* `stop` and `dispose` run in reverse-topological order across pips, but the
|
|
18
|
+
* sequence of hooks themselves is always `configure -> boot -> start -> stop -> dispose`.
|
|
19
|
+
*/
|
|
20
|
+
export const DOT_LIFECYCLE_HOOKS = [
|
|
21
|
+
'configure',
|
|
22
|
+
'boot',
|
|
23
|
+
'start',
|
|
24
|
+
'stop',
|
|
25
|
+
'dispose',
|
|
26
|
+
];
|
|
27
|
+
/** Stable error codes for lifecycle failures. */
|
|
28
|
+
export const DotLifecycleErrorCode = {
|
|
29
|
+
/** A `configure` hook attempted async work (returned a Promise). */
|
|
30
|
+
ConfigureAsync: 'DOT_LIFECYCLE_E001',
|
|
31
|
+
/** A `configure` hook threw. */
|
|
32
|
+
ConfigureFailed: 'DOT_LIFECYCLE_E002',
|
|
33
|
+
/** A `boot` hook threw. */
|
|
34
|
+
BootFailed: 'DOT_LIFECYCLE_E003',
|
|
35
|
+
/** A `start` hook threw. */
|
|
36
|
+
StartFailed: 'DOT_LIFECYCLE_E004',
|
|
37
|
+
/** One or more `stop` hooks threw — aggregate. */
|
|
38
|
+
StopFailed: 'DOT_LIFECYCLE_E005',
|
|
39
|
+
/** One or more `dispose` hooks threw — aggregate. */
|
|
40
|
+
DisposeFailed: 'DOT_LIFECYCLE_E006',
|
|
41
|
+
/** Caller tried to reuse the app after dispose. */
|
|
42
|
+
ReuseAfterDispose: 'DOT_LIFECYCLE_E007',
|
|
43
|
+
/** Caller tried to reuse the app after a failed lifecycle. */
|
|
44
|
+
ReuseAfterFailure: 'DOT_LIFECYCLE_E008',
|
|
45
|
+
/** Dependency graph contains a cycle. */
|
|
46
|
+
DependencyCycle: 'DOT_LIFECYCLE_E009',
|
|
47
|
+
/** Pip declared a dependency that isn't registered. */
|
|
48
|
+
MissingDependency: 'DOT_LIFECYCLE_E010',
|
|
49
|
+
/** Pip registered twice. */
|
|
50
|
+
DuplicatePip: 'DOT_LIFECYCLE_E011',
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Structured error thrown for any lifecycle failure or misuse.
|
|
54
|
+
*
|
|
55
|
+
* Carries:
|
|
56
|
+
* - `code` — stable machine-readable error code (see {@link DotLifecycleErrorCode}).
|
|
57
|
+
* - `phase` — which hook (or pseudo-hook) failed.
|
|
58
|
+
* - `pip` — which pip name, when applicable.
|
|
59
|
+
* - `cause` — original error if wrapped from a hook throw.
|
|
60
|
+
* - `failures` — for aggregate errors (stop/dispose), the per-pip failures.
|
|
61
|
+
*/
|
|
62
|
+
export class DotLifecycleError extends Error {
|
|
63
|
+
code;
|
|
64
|
+
phase;
|
|
65
|
+
pip;
|
|
66
|
+
cause;
|
|
67
|
+
failures;
|
|
68
|
+
constructor(args) {
|
|
69
|
+
super(args.message);
|
|
70
|
+
this.name = 'DotLifecycleError';
|
|
71
|
+
this.code = args.code;
|
|
72
|
+
this.phase = args.phase;
|
|
73
|
+
this.pip = args.pip;
|
|
74
|
+
this.cause = args.cause;
|
|
75
|
+
this.failures = args.failures;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=lifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAgC;IAC9D,WAAW;IACX,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;CACD,CAAC;AAiBX,iDAAiD;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,oEAAoE;IACpE,cAAc,EAAE,oBAAoB;IACpC,gCAAgC;IAChC,eAAe,EAAE,oBAAoB;IACrC,2BAA2B;IAC3B,UAAU,EAAE,oBAAoB;IAChC,4BAA4B;IAC5B,WAAW,EAAE,oBAAoB;IACjC,kDAAkD;IAClD,UAAU,EAAE,oBAAoB;IAChC,qDAAqD;IACrD,aAAa,EAAE,oBAAoB;IACnC,mDAAmD;IACnD,iBAAiB,EAAE,oBAAoB;IACvC,8DAA8D;IAC9D,iBAAiB,EAAE,oBAAoB;IACvC,yCAAyC;IACzC,eAAe,EAAE,oBAAoB;IACrC,uDAAuD;IACvD,iBAAiB,EAAE,oBAAoB;IACvC,4BAA4B;IAC5B,YAAY,EAAE,oBAAoB;CAC1B,CAAC;AAIX;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IACjC,IAAI,CAA6B;IACjC,KAAK,CAAmB;IACxB,GAAG,CAAU;IACJ,KAAK,CAAW;IACzB,QAAQ,CAAqC;IAEtD,YAAY,IAOX;QACC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest types for the DOT kernel.
|
|
3
|
+
*
|
|
4
|
+
* A `DotAppManifest` is the static, declarative description of an app: which
|
|
5
|
+
* pips are registered, what routes/services they contribute, and how they
|
|
6
|
+
* depend on each other. It is built up during the `configure` phase from
|
|
7
|
+
* registration calls and finalised once `configure` completes.
|
|
8
|
+
*
|
|
9
|
+
* CONTRACT: `DotAppManifest` always exposes the same five top-level arrays
|
|
10
|
+
* (`pips`, `routes`, `services`, `lifecycle`, `dependencies`). Consumers
|
|
11
|
+
* MUST NOT see an omitted array — empty is empty, but never missing.
|
|
12
|
+
* This shape is referenced by Task 7's scorecard.
|
|
13
|
+
*/
|
|
14
|
+
import type { DotLifecycleHook } from './lifecycle.js';
|
|
15
|
+
/**
|
|
16
|
+
* Kind of service that a pip can publish.
|
|
17
|
+
*
|
|
18
|
+
* Well-known kinds map 1:1 to the canonical `@arki/*` adapters. `custom`
|
|
19
|
+
* is the escape hatch for pip-defined service kinds — use it whenever a
|
|
20
|
+
* pip publishes something that does not fit a reserved shape.
|
|
21
|
+
*/
|
|
22
|
+
export type ServiceKind = 'env' | 'db' | 'kv' | 'queue' | 'auth' | 'email' | 'logger' | 'event-store' | 'message-bus' | 'custom';
|
|
23
|
+
/** Transport that a route is exposed under. */
|
|
24
|
+
export type RouteTransport = 'http' | 'orpc' | 'trpc' | 'rpc' | 'custom';
|
|
25
|
+
/** Kind of dependency edge between two pips. */
|
|
26
|
+
export type DependencyEdgeKind = 'requires' | 'provides' | 'uses';
|
|
27
|
+
/**
|
|
28
|
+
* Top-level manifest describing the static shape of a DOT app.
|
|
29
|
+
*
|
|
30
|
+
* Always carries the five arrays — never omits any of them.
|
|
31
|
+
*/
|
|
32
|
+
export type DotAppManifest = {
|
|
33
|
+
app: {
|
|
34
|
+
name: string;
|
|
35
|
+
version?: string;
|
|
36
|
+
};
|
|
37
|
+
pips: PipManifest[];
|
|
38
|
+
routes: RouteManifest[];
|
|
39
|
+
services: ServiceManifest[];
|
|
40
|
+
lifecycle: LifecycleManifest[];
|
|
41
|
+
dependencies: DependencyEdge[];
|
|
42
|
+
};
|
|
43
|
+
/** Single pip's declarative metadata. */
|
|
44
|
+
export type PipManifest = {
|
|
45
|
+
name: string;
|
|
46
|
+
version?: string;
|
|
47
|
+
dependencies: readonly string[];
|
|
48
|
+
provides: readonly string[];
|
|
49
|
+
};
|
|
50
|
+
/** Single route exposed by a pip. */
|
|
51
|
+
export type RouteManifest = {
|
|
52
|
+
id: string;
|
|
53
|
+
pip: string;
|
|
54
|
+
method?: string;
|
|
55
|
+
path?: string;
|
|
56
|
+
transport: RouteTransport;
|
|
57
|
+
};
|
|
58
|
+
/** Single service published by a pip. */
|
|
59
|
+
export type ServiceManifest = {
|
|
60
|
+
name: string;
|
|
61
|
+
pip: string;
|
|
62
|
+
kind: ServiceKind;
|
|
63
|
+
};
|
|
64
|
+
/** Which lifecycle hooks a pip participates in. */
|
|
65
|
+
export type LifecycleManifest = {
|
|
66
|
+
pip: string;
|
|
67
|
+
hooks: readonly DotLifecycleHook[];
|
|
68
|
+
};
|
|
69
|
+
/** Directed edge in the pip dependency graph. */
|
|
70
|
+
export type DependencyEdge = {
|
|
71
|
+
from: string;
|
|
72
|
+
to: string;
|
|
73
|
+
kind: DependencyEdgeKind;
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GACnB,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,OAAO,GACP,MAAM,GACN,OAAO,GACP,QAAQ,GACR,aAAa,GACb,aAAa,GACb,QAAQ,CAAC;AAEb,+CAA+C;AAC/C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEzE,gDAAgD;AAChD,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAElE;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,YAAY,EAAE,cAAc,EAAE,CAAC;CAChC,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,qCAAqC;AACrC,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC;AAEF,mDAAmD;AACnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACpC,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;CAC1B,CAAC"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest types for the DOT kernel.
|
|
3
|
+
*
|
|
4
|
+
* A `DotAppManifest` is the static, declarative description of an app: which
|
|
5
|
+
* pips are registered, what routes/services they contribute, and how they
|
|
6
|
+
* depend on each other. It is built up during the `configure` phase from
|
|
7
|
+
* registration calls and finalised once `configure` completes.
|
|
8
|
+
*
|
|
9
|
+
* CONTRACT: `DotAppManifest` always exposes the same five top-level arrays
|
|
10
|
+
* (`pips`, `routes`, `services`, `lifecycle`, `dependencies`). Consumers
|
|
11
|
+
* MUST NOT see an omitted array — empty is empty, but never missing.
|
|
12
|
+
* This shape is referenced by Task 7's scorecard.
|
|
13
|
+
*/
|
|
14
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public pip contract for the DOT kernel.
|
|
3
|
+
*
|
|
4
|
+
* A `DotPip` is a plain object with a name, optional dependency list, and
|
|
5
|
+
* up to five lifecycle hooks. The kernel calls each hook in dependency order
|
|
6
|
+
* (or reverse-dependency order for `stop`/`dispose`).
|
|
7
|
+
*
|
|
8
|
+
* Design constraints:
|
|
9
|
+
*
|
|
10
|
+
* - `configure` is SYNC. Returning a Promise is an error — the kernel will
|
|
11
|
+
* throw {@link DotLifecycleError} with code `DOT_LIFECYCLE_E001`.
|
|
12
|
+
* - `boot` may publish services into the app; downstream pips see them via
|
|
13
|
+
* {@link DotBootContext.services}.
|
|
14
|
+
* - `stop` and `dispose` continue through individual pip failures and
|
|
15
|
+
* report an aggregate error.
|
|
16
|
+
*/
|
|
17
|
+
import type { DotLifecycleHook } from './lifecycle.js';
|
|
18
|
+
import type { DependencyEdgeKind, RouteTransport, ServiceKind } from './manifest.js';
|
|
19
|
+
/**
|
|
20
|
+
* Aggregate registration record produced during the `configure` phase.
|
|
21
|
+
*
|
|
22
|
+
* The kernel exposes one of these to each pip via {@link DotConfigureContext}
|
|
23
|
+
* and uses the merged result to build the final `DotAppManifest`.
|
|
24
|
+
*/
|
|
25
|
+
export type DotManifestContribution = {
|
|
26
|
+
/** Services this pip publishes. */
|
|
27
|
+
services?: readonly {
|
|
28
|
+
name: string;
|
|
29
|
+
kind: ServiceKind;
|
|
30
|
+
}[];
|
|
31
|
+
/** Routes this pip exposes. */
|
|
32
|
+
routes?: readonly {
|
|
33
|
+
id: string;
|
|
34
|
+
method?: string;
|
|
35
|
+
path?: string;
|
|
36
|
+
transport: RouteTransport;
|
|
37
|
+
}[];
|
|
38
|
+
/** Additional `provides` capability strings (joined with the pip's `provides`). */
|
|
39
|
+
provides?: readonly string[];
|
|
40
|
+
/** Additional dependency edges. */
|
|
41
|
+
dependencies?: readonly {
|
|
42
|
+
to: string;
|
|
43
|
+
kind?: DependencyEdgeKind;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
/** Context provided to a `manifest` callback. */
|
|
47
|
+
export type DotManifestContext<TServices extends Record<string, unknown>> = {
|
|
48
|
+
pipName: string;
|
|
49
|
+
/** Services published by dependencies that have already booted (read-only). */
|
|
50
|
+
services: Readonly<Partial<TServices>>;
|
|
51
|
+
};
|
|
52
|
+
/** Context provided to a `configure` hook. */
|
|
53
|
+
export type DotConfigureContext = {
|
|
54
|
+
pipName: string;
|
|
55
|
+
/** App name. */
|
|
56
|
+
appName: string;
|
|
57
|
+
/**
|
|
58
|
+
* Register a service this pip publishes.
|
|
59
|
+
* Registration is metadata-only — the actual service instance is returned
|
|
60
|
+
* from the `boot` hook in `DotBootResult.services`.
|
|
61
|
+
*/
|
|
62
|
+
registerService(name: string, kind: ServiceKind): void;
|
|
63
|
+
/** Register a route this pip exposes. */
|
|
64
|
+
registerRoute(route: {
|
|
65
|
+
id: string;
|
|
66
|
+
method?: string;
|
|
67
|
+
path?: string;
|
|
68
|
+
transport: RouteTransport;
|
|
69
|
+
}): void;
|
|
70
|
+
/** Mark the pip as participating in a lifecycle hook. */
|
|
71
|
+
registerLifecycleHook(hook: DotLifecycleHook): void;
|
|
72
|
+
/** Append `provides` capability strings. */
|
|
73
|
+
declareProvides(...capabilities: string[]): void;
|
|
74
|
+
/** Append an extra dependency edge (alongside `pip.dependencies`). */
|
|
75
|
+
declareDependency(to: string, kind?: DependencyEdgeKind): void;
|
|
76
|
+
};
|
|
77
|
+
/** Context provided to a `boot` hook. */
|
|
78
|
+
export type DotBootContext = {
|
|
79
|
+
pipName: string;
|
|
80
|
+
appName: string;
|
|
81
|
+
/**
|
|
82
|
+
* Services published by prior-booted pips, keyed by service name.
|
|
83
|
+
* Use this for dependency injection between pips.
|
|
84
|
+
*/
|
|
85
|
+
services: ReadonlyMap<string, unknown>;
|
|
86
|
+
/** Read-only configuration bag. */
|
|
87
|
+
config: Readonly<Record<string, unknown>>;
|
|
88
|
+
};
|
|
89
|
+
/** Context provided to a `start` hook. */
|
|
90
|
+
export type DotStartContext<TServices extends Record<string, unknown>> = {
|
|
91
|
+
pipName: string;
|
|
92
|
+
appName: string;
|
|
93
|
+
services: TServices;
|
|
94
|
+
};
|
|
95
|
+
/** Context provided to a `stop` hook. */
|
|
96
|
+
export type DotStopContext<TServices extends Record<string, unknown>> = {
|
|
97
|
+
pipName: string;
|
|
98
|
+
appName: string;
|
|
99
|
+
services: TServices;
|
|
100
|
+
};
|
|
101
|
+
/** Context provided to a `dispose` hook. */
|
|
102
|
+
export type DotDisposeContext<TServices extends Record<string, unknown>> = {
|
|
103
|
+
pipName: string;
|
|
104
|
+
appName: string;
|
|
105
|
+
services: TServices;
|
|
106
|
+
};
|
|
107
|
+
/** Return value of a `boot` hook. */
|
|
108
|
+
export type DotBootResult<TServices extends Record<string, unknown>> = {
|
|
109
|
+
/** Services this pip publishes — added to `app.services` and visible to dependent pips. */
|
|
110
|
+
services?: TServices;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* The DOT pip contract.
|
|
114
|
+
*
|
|
115
|
+
* Default `TServices` is `Record<string, never>` so pips that don't publish
|
|
116
|
+
* services don't have to specify a type argument. Default `TManifest` is the
|
|
117
|
+
* full contribution shape.
|
|
118
|
+
*/
|
|
119
|
+
export type DotPip<TServices extends Record<string, unknown> = Record<string, never>, TManifest extends DotManifestContribution = DotManifestContribution> = {
|
|
120
|
+
/** Unique identifier for this pip within the app. */
|
|
121
|
+
name: string;
|
|
122
|
+
/** Optional semantic version string. */
|
|
123
|
+
version?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Names of pips this one depends on.
|
|
126
|
+
* The kernel ensures dependencies are configured/booted/started first, and
|
|
127
|
+
* stopped/disposed last.
|
|
128
|
+
*/
|
|
129
|
+
dependencies?: readonly string[];
|
|
130
|
+
/** Capability strings this pip advertises (for `dependencies` resolution by capability). */
|
|
131
|
+
provides?: readonly string[];
|
|
132
|
+
/**
|
|
133
|
+
* Optional static or callback-form manifest contribution. The kernel merges
|
|
134
|
+
* this into the final manifest after `configure` runs.
|
|
135
|
+
*/
|
|
136
|
+
manifest?: TManifest | ((ctx: DotManifestContext<TServices>) => TManifest);
|
|
137
|
+
/**
|
|
138
|
+
* SYNC registration hook. Declare metadata, register routes/services/jobs.
|
|
139
|
+
* MUST NOT perform IO, MUST NOT return a Promise.
|
|
140
|
+
*/
|
|
141
|
+
configure?: (ctx: DotConfigureContext) => void;
|
|
142
|
+
/** Async open-resources hook. Returns published services for DI. */
|
|
143
|
+
boot?: (ctx: DotBootContext) => Promise<DotBootResult<TServices>> | DotBootResult<TServices>;
|
|
144
|
+
/** Async begin-active-work hook. Runs after every pip's `boot` succeeds. */
|
|
145
|
+
start?: (ctx: DotStartContext<TServices>) => Promise<void> | void;
|
|
146
|
+
/** Async halt-active-work hook. Runs in reverse-topological order. */
|
|
147
|
+
stop?: (ctx: DotStopContext<TServices>) => Promise<void> | void;
|
|
148
|
+
/** Async release-resources hook. Runs in reverse-topological order. */
|
|
149
|
+
dispose?: (ctx: DotDisposeContext<TServices>) => Promise<void> | void;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Type-narrowing helper for pip authors.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* export const myPip = defineDotPip<{ db: MyDb }>({
|
|
156
|
+
* name: 'my-pip',
|
|
157
|
+
* async boot() {
|
|
158
|
+
* const db = await openDb();
|
|
159
|
+
* return { services: { db } };
|
|
160
|
+
* },
|
|
161
|
+
* async dispose({ services }) {
|
|
162
|
+
* await services.db.close();
|
|
163
|
+
* },
|
|
164
|
+
* });
|
|
165
|
+
*/
|
|
166
|
+
export declare function defineDotPip<TServices extends Record<string, unknown> = Record<string, never>>(pip: DotPip<TServices>): DotPip<TServices>;
|
|
167
|
+
/** Internal type alias used by the kernel to erase pip service generics. */
|
|
168
|
+
export type AnyDotPip = DotPip<Record<string, unknown>, DotManifestContribution>;
|
|
169
|
+
/** Internal helper: extract the `provides` field from a pip (always returns an array). */
|
|
170
|
+
export declare function pipProvides(pip: AnyDotPip): readonly string[];
|
|
171
|
+
/** Internal helper: extract the `dependencies` field from a pip (always returns an array). */
|
|
172
|
+
export declare function pipDependencies(pip: AnyDotPip): readonly string[];
|
|
173
|
+
/**
|
|
174
|
+
* Stable error thrown by DOT pip adapters.
|
|
175
|
+
*
|
|
176
|
+
* Adapters MUST throw `DotPipError` (not raw `Error`) when surfacing a
|
|
177
|
+
* misconfiguration, missing-input, or other fail-fast condition. Consumers
|
|
178
|
+
* and coding agents can then match on a stable `code`, follow `docsUrl`,
|
|
179
|
+
* and apply `remediation` without parsing the message.
|
|
180
|
+
*
|
|
181
|
+
* Codes are per-adapter. Recommended prefix is `<PKG>_PIP_E<NNN>` (e.g.
|
|
182
|
+
* `KV_PIP_E001`, `DB_PIP_E001`). The kernel does not own the code
|
|
183
|
+
* namespace — each adapter defines its own constants and links them in
|
|
184
|
+
* its README.
|
|
185
|
+
*
|
|
186
|
+
* @see packages/dot/docs/principles.md — principle 1.3 ("errors are part
|
|
187
|
+
* of the API") and principle 4 ("agent-discoverable everywhere").
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* import { DotPipError } from '@arki/dot/pip';
|
|
192
|
+
*
|
|
193
|
+
* const KV_PIP_ERROR_CODES = { urlNotConfigured: 'KV_PIP_E001' } as const;
|
|
194
|
+
*
|
|
195
|
+
* throw new DotPipError({
|
|
196
|
+
* code: KV_PIP_ERROR_CODES.urlNotConfigured,
|
|
197
|
+
* message: '[kv] KV URL is not configured.',
|
|
198
|
+
* remediation: 'Pass options.url to kv(...) or set KV_URL in the environment.',
|
|
199
|
+
* docsUrl: 'https://arki.dev/dot/errors/kv-pip-e001',
|
|
200
|
+
* });
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
export declare class DotPipError extends Error {
|
|
204
|
+
/** Stable error code, e.g. `KV_PIP_E001`. */
|
|
205
|
+
readonly code: string;
|
|
206
|
+
/** One-sentence guidance on how to fix the underlying problem. */
|
|
207
|
+
readonly remediation: string;
|
|
208
|
+
/** URL of the documentation page that explains this error. */
|
|
209
|
+
readonly docsUrl: string;
|
|
210
|
+
constructor(args: {
|
|
211
|
+
readonly code: string;
|
|
212
|
+
readonly message: string;
|
|
213
|
+
readonly remediation: string;
|
|
214
|
+
readonly docsUrl: string;
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/** Re-exported for downstream typing. */
|
|
218
|
+
export { type DotAppManifest, type PipManifest } from './manifest.js';
|
|
219
|
+
//# sourceMappingURL=pip-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip-contract.d.ts","sourceRoot":"","sources":["../src/pip-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAErF;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,SAAS;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,WAAW,CAAC;KACnB,EAAE,CAAC;IACJ,+BAA+B;IAC/B,MAAM,CAAC,EAAE,SAAS;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,cAAc,CAAC;KAC3B,EAAE,CAAC;IACJ,mFAAmF;IACnF,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,mCAAmC;IACnC,YAAY,CAAC,EAAE,SAAS;QACtB,EA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,eAAe,CAAC,GAAG,EAAE,SAAS,GAAG,SAAS,MAAM,EAAE,CAEjE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,IAAI,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KAC1B;CAOF;AAED,yCAAyC;AAEzC,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public pip contract for the DOT kernel.
|
|
3
|
+
*
|
|
4
|
+
* A `DotPip` is a plain object with a name, optional dependency list, and
|
|
5
|
+
* up to five lifecycle hooks. The kernel calls each hook in dependency order
|
|
6
|
+
* (or reverse-dependency order for `stop`/`dispose`).
|
|
7
|
+
*
|
|
8
|
+
* Design constraints:
|
|
9
|
+
*
|
|
10
|
+
* - `configure` is SYNC. Returning a Promise is an error — the kernel will
|
|
11
|
+
* throw {@link DotLifecycleError} with code `DOT_LIFECYCLE_E001`.
|
|
12
|
+
* - `boot` may publish services into the app; downstream pips see them via
|
|
13
|
+
* {@link DotBootContext.services}.
|
|
14
|
+
* - `stop` and `dispose` continue through individual pip failures and
|
|
15
|
+
* report an aggregate error.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Type-narrowing helper for pip authors.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* export const myPip = defineDotPip<{ db: MyDb }>({
|
|
22
|
+
* name: 'my-pip',
|
|
23
|
+
* async boot() {
|
|
24
|
+
* const db = await openDb();
|
|
25
|
+
* return { services: { db } };
|
|
26
|
+
* },
|
|
27
|
+
* async dispose({ services }) {
|
|
28
|
+
* await services.db.close();
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
*/
|
|
32
|
+
export function defineDotPip(pip) {
|
|
33
|
+
return pip;
|
|
34
|
+
}
|
|
35
|
+
/** Internal helper: extract the `provides` field from a pip (always returns an array). */
|
|
36
|
+
export function pipProvides(pip) {
|
|
37
|
+
return pip.provides ?? [];
|
|
38
|
+
}
|
|
39
|
+
/** Internal helper: extract the `dependencies` field from a pip (always returns an array). */
|
|
40
|
+
export function pipDependencies(pip) {
|
|
41
|
+
return pip.dependencies ?? [];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Stable error thrown by DOT pip adapters.
|
|
45
|
+
*
|
|
46
|
+
* Adapters MUST throw `DotPipError` (not raw `Error`) when surfacing a
|
|
47
|
+
* misconfiguration, missing-input, or other fail-fast condition. Consumers
|
|
48
|
+
* and coding agents can then match on a stable `code`, follow `docsUrl`,
|
|
49
|
+
* and apply `remediation` without parsing the message.
|
|
50
|
+
*
|
|
51
|
+
* Codes are per-adapter. Recommended prefix is `<PKG>_PIP_E<NNN>` (e.g.
|
|
52
|
+
* `KV_PIP_E001`, `DB_PIP_E001`). The kernel does not own the code
|
|
53
|
+
* namespace — each adapter defines its own constants and links them in
|
|
54
|
+
* its README.
|
|
55
|
+
*
|
|
56
|
+
* @see packages/dot/docs/principles.md — principle 1.3 ("errors are part
|
|
57
|
+
* of the API") and principle 4 ("agent-discoverable everywhere").
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { DotPipError } from '@arki/dot/pip';
|
|
62
|
+
*
|
|
63
|
+
* const KV_PIP_ERROR_CODES = { urlNotConfigured: 'KV_PIP_E001' } as const;
|
|
64
|
+
*
|
|
65
|
+
* throw new DotPipError({
|
|
66
|
+
* code: KV_PIP_ERROR_CODES.urlNotConfigured,
|
|
67
|
+
* message: '[kv] KV URL is not configured.',
|
|
68
|
+
* remediation: 'Pass options.url to kv(...) or set KV_URL in the environment.',
|
|
69
|
+
* docsUrl: 'https://arki.dev/dot/errors/kv-pip-e001',
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export class DotPipError extends Error {
|
|
74
|
+
/** Stable error code, e.g. `KV_PIP_E001`. */
|
|
75
|
+
code;
|
|
76
|
+
/** One-sentence guidance on how to fix the underlying problem. */
|
|
77
|
+
remediation;
|
|
78
|
+
/** URL of the documentation page that explains this error. */
|
|
79
|
+
docsUrl;
|
|
80
|
+
constructor(args) {
|
|
81
|
+
super(args.message);
|
|
82
|
+
this.name = 'DotPipError';
|
|
83
|
+
this.code = args.code;
|
|
84
|
+
this.remediation = args.remediation;
|
|
85
|
+
this.docsUrl = args.docsUrl;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** Re-exported for downstream typing. */
|
|
89
|
+
export {} from './manifest.js';
|
|
90
|
+
//# sourceMappingURL=pip-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip-contract.js","sourceRoot":"","sources":["../src/pip-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAsJH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAC1B,GAAsB;IAEtB,OAAO,GAAG,CAAC;AACb,CAAC;AAKD,0FAA0F;AAC1F,MAAM,UAAU,WAAW,CAAC,GAAc;IACxC,OAAO,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,eAAe,CAAC,GAAc;IAC5C,OAAO,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,6CAA6C;IACpC,IAAI,CAAS;IACtB,kEAAkE;IACzD,WAAW,CAAS;IAC7B,8DAA8D;IACrD,OAAO,CAAS;IAEzB,YAAY,IAKX;QACC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;CACF;AAED,yCAAyC;AAEzC,OAAO,EAAyC,MAAM,eAAe,CAAC"}
|
package/dist/pip.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow public surface for pip authors.
|
|
3
|
+
*
|
|
4
|
+
* Exposes the new-kernel pip contract and the entry points a pip
|
|
5
|
+
* author needs to author + test pips — `defineDotPip`, `defineApp`,
|
|
6
|
+
* `testApp` / `bootTestApp`, plus lifecycle / manifest / diagnostics types.
|
|
7
|
+
*
|
|
8
|
+
* Does NOT re-export the legacy `Dot` / `createDot` builder or the legacy
|
|
9
|
+
* auth/db/event-sourcing modules. Adapter packages (e.g. `@arki/env/dot`,
|
|
10
|
+
* `@arki/kv/dot`, `@arki/db/dot`) import from this subpath so their
|
|
11
|
+
* `*.d.ts` graphs do not pull in the legacy surface — keeping their
|
|
12
|
+
* compile times tight and decoupling adapters from the legacy retirement
|
|
13
|
+
* schedule (Task 12).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { defineDotPip, type DotPip } from '@arki/dot/pip';
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export { defineDotPip, DotPipError } from './pip-contract.js';
|
|
21
|
+
export type { AnyDotPip, DotPip, DotBootContext, DotBootResult, DotConfigureContext, DotDisposeContext, DotManifestContext, DotManifestContribution, DotStartContext, DotStopContext, } from './pip-contract.js';
|
|
22
|
+
export { defineApp } from './define-app.js';
|
|
23
|
+
export type { DotApp, DotAppBuilder, DotAppConfigured } from './define-app.js';
|
|
24
|
+
export { testApp, bootTestApp } from './test-harness.js';
|
|
25
|
+
export type { TestAppOptions } from './test-harness.js';
|
|
26
|
+
export type { DotLifecycleHook, DotLifecycleState, DotLifecyclePipFailure, DotLifecycleErrorCodeValue, } from './lifecycle.js';
|
|
27
|
+
export { DotLifecycleError, DotLifecycleErrorCode, DOT_LIFECYCLE_HOOKS } from './lifecycle.js';
|
|
28
|
+
export type { DotAppManifest, PipManifest, RouteManifest, ServiceManifest, LifecycleManifest, DependencyEdge, DependencyEdgeKind, ServiceKind, RouteTransport, } from './manifest.js';
|
|
29
|
+
export type { DotDiagnosticsSnapshot, PipDiagnostic, RouteDiagnostic, ServiceDiagnostic, LifecycleDiagnostic, DiagnosticIssue, DiagnosticSeverity, DiagnosticStatus, } from './diagnostics.js';
|
|
30
|
+
export type { DotLifecycleEvent, DotLifecycleEventStatus, DotLifecycleObserver, DotPhaseLifecycleEvent, DotPipHookLifecycleEvent, } from './lifecycle-observer.js';
|
|
31
|
+
export { renderTimeline } from './timeline.js';
|
|
32
|
+
export type { RenderTimelineOptions } from './timeline.js';
|
|
33
|
+
//# sourceMappingURL=pip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip.d.ts","sourceRoot":"","sources":["../src/pip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EACV,SAAS,EACT,MAAM,EACN,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE/F,YAAY,EACV,cAAc,EACd,WAAW,EACX,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/pip.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow public surface for pip authors.
|
|
3
|
+
*
|
|
4
|
+
* Exposes the new-kernel pip contract and the entry points a pip
|
|
5
|
+
* author needs to author + test pips — `defineDotPip`, `defineApp`,
|
|
6
|
+
* `testApp` / `bootTestApp`, plus lifecycle / manifest / diagnostics types.
|
|
7
|
+
*
|
|
8
|
+
* Does NOT re-export the legacy `Dot` / `createDot` builder or the legacy
|
|
9
|
+
* auth/db/event-sourcing modules. Adapter packages (e.g. `@arki/env/dot`,
|
|
10
|
+
* `@arki/kv/dot`, `@arki/db/dot`) import from this subpath so their
|
|
11
|
+
* `*.d.ts` graphs do not pull in the legacy surface — keeping their
|
|
12
|
+
* compile times tight and decoupling adapters from the legacy retirement
|
|
13
|
+
* schedule (Task 12).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { defineDotPip, type DotPip } from '@arki/dot/pip';
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export { defineDotPip, DotPipError } from './pip-contract.js';
|
|
21
|
+
export { defineApp } from './define-app.js';
|
|
22
|
+
export { testApp, bootTestApp } from './test-harness.js';
|
|
23
|
+
export { DotLifecycleError, DotLifecycleErrorCode, DOT_LIFECYCLE_HOOKS } from './lifecycle.js';
|
|
24
|
+
export { renderTimeline } from './timeline.js';
|
|
25
|
+
//# sourceMappingURL=pip.js.map
|
package/dist/pip.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip.js","sourceRoot":"","sources":["../src/pip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAc9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AASzD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAiC/F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|