@semiont/core 0.5.4 → 0.5.5
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/config/node-config-loader.d.ts +615 -4
- package/dist/index.d.ts +6623 -59
- package/package.json +4 -2
- package/dist/annotation-assembly.d.ts +0 -54
- package/dist/annotation-assembly.d.ts.map +0 -1
- package/dist/annotation-types.d.ts +0 -30
- package/dist/annotation-types.d.ts.map +0 -1
- package/dist/annotation-utils.d.ts +0 -43
- package/dist/annotation-utils.d.ts.map +0 -1
- package/dist/auth-types.d.ts +0 -8
- package/dist/auth-types.d.ts.map +0 -1
- package/dist/branded-types.d.ts +0 -70
- package/dist/branded-types.d.ts.map +0 -1
- package/dist/bridged-channels.d.ts +0 -18
- package/dist/bridged-channels.d.ts.map +0 -1
- package/dist/bus-log.d.ts +0 -25
- package/dist/bus-log.d.ts.map +0 -1
- package/dist/bus-protocol.d.ts +0 -510
- package/dist/bus-protocol.d.ts.map +0 -1
- package/dist/config/config.types.d.ts +0 -563
- package/dist/config/config.types.d.ts.map +0 -1
- package/dist/config/configuration-error.d.ts +0 -17
- package/dist/config/configuration-error.d.ts.map +0 -1
- package/dist/config/environment-validator.d.ts +0 -28
- package/dist/config/environment-validator.d.ts.map +0 -1
- package/dist/config/node-config-loader.d.ts.map +0 -1
- package/dist/config/platform-types.d.ts +0 -26
- package/dist/config/platform-types.d.ts.map +0 -1
- package/dist/config/toml-loader.d.ts +0 -59
- package/dist/config/toml-loader.d.ts.map +0 -1
- package/dist/did-utils.d.ts +0 -76
- package/dist/did-utils.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -48
- package/dist/errors.d.ts.map +0 -1
- package/dist/event-base.d.ts +0 -70
- package/dist/event-base.d.ts.map +0 -1
- package/dist/event-bus.d.ts +0 -141
- package/dist/event-bus.d.ts.map +0 -1
- package/dist/event-utils.d.ts +0 -43
- package/dist/event-utils.d.ts.map +0 -1
- package/dist/fuzzy-anchor.d.ts +0 -81
- package/dist/fuzzy-anchor.d.ts.map +0 -1
- package/dist/graph.d.ts +0 -44
- package/dist/graph.d.ts.map +0 -1
- package/dist/id-generation.d.ts +0 -8
- package/dist/id-generation.d.ts.map +0 -1
- package/dist/identifiers.d.ts +0 -24
- package/dist/identifiers.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/locales.d.ts +0 -31
- package/dist/locales.d.ts.map +0 -1
- package/dist/logger.d.ts +0 -56
- package/dist/logger.d.ts.map +0 -1
- package/dist/mime-utils.d.ts +0 -38
- package/dist/mime-utils.d.ts.map +0 -1
- package/dist/operators/burst-buffer.d.ts +0 -61
- package/dist/operators/burst-buffer.d.ts.map +0 -1
- package/dist/payload-types.d.ts +0 -16
- package/dist/payload-types.d.ts.map +0 -1
- package/dist/persisted-events.d.ts +0 -76
- package/dist/persisted-events.d.ts.map +0 -1
- package/dist/project.d.ts +0 -69
- package/dist/project.d.ts.map +0 -1
- package/dist/resource-types.d.ts +0 -15
- package/dist/resource-types.d.ts.map +0 -1
- package/dist/resource-utils.d.ts +0 -97
- package/dist/resource-utils.d.ts.map +0 -1
- package/dist/serialize-per-key.d.ts +0 -51
- package/dist/serialize-per-key.d.ts.map +0 -1
- package/dist/svg-utils.d.ts +0 -44
- package/dist/svg-utils.d.ts.map +0 -1
- package/dist/tag-schemas.d.ts +0 -27
- package/dist/tag-schemas.d.ts.map +0 -1
- package/dist/text-context.d.ts +0 -85
- package/dist/text-context.d.ts.map +0 -1
- package/dist/text-encoding.d.ts +0 -34
- package/dist/text-encoding.d.ts.map +0 -1
- package/dist/transport.d.ts +0 -274
- package/dist/transport.d.ts.map +0 -1
- package/dist/type-guards.d.ts +0 -44
- package/dist/type-guards.d.ts.map +0 -1
- package/dist/types.d.ts +0 -3517
- package/dist/types.d.ts.map +0 -1
- package/dist/validation.d.ts +0 -57
- package/dist/validation.d.ts.map +0 -1
- package/dist/web-annotation-utils.d.ts +0 -154
- package/dist/web-annotation-utils.d.ts.map +0 -1
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TOML Config Loader
|
|
3
|
-
*
|
|
4
|
-
* Reads ~/.semiontconfig (TOML) and .semiont/config (TOML) and produces
|
|
5
|
-
* an EnvironmentConfig for the requested environment.
|
|
6
|
-
*
|
|
7
|
-
* File format: see TOML-XDG-CONFIG.md
|
|
8
|
-
*
|
|
9
|
-
* Loading sequence:
|
|
10
|
-
* 1. Read .semiont/config → projectName, site, environments.<env>.* (project base)
|
|
11
|
-
* 2. Read ~/.semiontconfig → defaults, environments.<env>.* (user overrides)
|
|
12
|
-
* 3. Deep-merge: project base ← user overrides (user wins on conflicts)
|
|
13
|
-
* Any environment name is valid (local, staging, production, custom, ...)
|
|
14
|
-
* 4. Resolve ${VAR} references from process.env
|
|
15
|
-
* 5. Apply inheritance: workers.<name> → workers.default → error
|
|
16
|
-
* 6. Map to EnvironmentConfig shape
|
|
17
|
-
*/
|
|
18
|
-
import type { EnvironmentConfig } from './config.types';
|
|
19
|
-
export interface InferenceConfig {
|
|
20
|
-
type: 'anthropic' | 'ollama';
|
|
21
|
-
model: string;
|
|
22
|
-
maxTokens?: number;
|
|
23
|
-
apiKey?: string;
|
|
24
|
-
endpoint?: string;
|
|
25
|
-
baseURL?: string;
|
|
26
|
-
}
|
|
27
|
-
export interface ActorInferenceConfig {
|
|
28
|
-
gatherer?: InferenceConfig;
|
|
29
|
-
matcher?: InferenceConfig;
|
|
30
|
-
}
|
|
31
|
-
export interface WorkerInferenceConfig {
|
|
32
|
-
default?: InferenceConfig;
|
|
33
|
-
'reference-annotation'?: InferenceConfig;
|
|
34
|
-
'highlight-annotation'?: InferenceConfig;
|
|
35
|
-
'assessment-annotation'?: InferenceConfig;
|
|
36
|
-
'comment-annotation'?: InferenceConfig;
|
|
37
|
-
'tag-annotation'?: InferenceConfig;
|
|
38
|
-
'generation'?: InferenceConfig;
|
|
39
|
-
}
|
|
40
|
-
export type TomlFileReader = {
|
|
41
|
-
readIfExists: (path: string) => string | null;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Parse ~/.semiontconfig and .semiont/config and return EnvironmentConfig.
|
|
45
|
-
*
|
|
46
|
-
* @param projectRoot - Path to the project root (contains .semiont/config)
|
|
47
|
-
* @param environment - Environment name (e.g. 'local', 'production')
|
|
48
|
-
* @param globalConfigPath - Path to ~/.semiontconfig (caller resolves ~ expansion)
|
|
49
|
-
* @param reader - File reader abstraction
|
|
50
|
-
* @param env - Environment variables for ${VAR} resolution
|
|
51
|
-
*/
|
|
52
|
-
export declare function loadTomlConfig(projectRoot: string | null, environment: string, globalConfigPath: string, reader: TomlFileReader, env: Record<string, string | undefined>): EnvironmentConfig;
|
|
53
|
-
/**
|
|
54
|
-
* Create a TOML config loader backed by a file reader.
|
|
55
|
-
* Drop-in replacement for createConfigLoader that reads TOML instead of JSON.
|
|
56
|
-
* The caller must resolve globalConfigPath (e.g. expand '~' using process.env.HOME).
|
|
57
|
-
*/
|
|
58
|
-
export declare function createTomlConfigLoader(reader: TomlFileReader, globalConfigPath: string, env: Record<string, string | undefined>): (projectRoot: string | null, environment: string) => EnvironmentConfig;
|
|
59
|
-
//# sourceMappingURL=toml-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toml-loader.d.ts","sourceRoot":"","sources":["../../src/config/toml-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAiD,MAAM,gBAAgB,CAAC;AAkDvG,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,sBAAsB,CAAC,EAAE,eAAe,CAAC;IACzC,uBAAuB,CAAC,EAAE,eAAe,CAAC;IAC1C,oBAAoB,CAAC,EAAE,eAAe,CAAC;IACvC,gBAAgB,CAAC,EAAE,eAAe,CAAC;IACnC,YAAY,CAAC,EAAE,eAAe,CAAC;CAChC;AAmHD,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;CAC/C,CAAC;AAWF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,EACxB,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACtC,iBAAiB,CAkRnB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,cAAc,EACtB,gBAAgB,EAAE,MAAM,EACxB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,IAE/B,aAAa,MAAM,GAAG,IAAI,EAAE,aAAa,MAAM,KAAG,iBAAiB,CAG5E"}
|
package/dist/did-utils.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DID (Decentralized Identifier) and W3C Agent utilities
|
|
3
|
-
*
|
|
4
|
-
* DID:WEB shapes used in Semiont:
|
|
5
|
-
*
|
|
6
|
-
* Person: did:web:<host>:users:<email%40host>
|
|
7
|
-
* Software: did:web:<host>:agents:<provider>:<model>
|
|
8
|
-
*
|
|
9
|
-
* `didToAgent` is the inverse: parse the DID, recognize whether the
|
|
10
|
-
* subject is a person or a software peer, and return a typed Agent.
|
|
11
|
-
*
|
|
12
|
-
* Humans and software peers share the same identity *shape* (a DID
|
|
13
|
-
* with a typed Agent on read). What differs is the path segment
|
|
14
|
-
* (`:users:` vs `:agents:`) and the schema-typed fields each kind
|
|
15
|
-
* carries on its Agent record.
|
|
16
|
-
*/
|
|
17
|
-
import type { components } from './types';
|
|
18
|
-
type Agent = components['schemas']['Agent'];
|
|
19
|
-
/**
|
|
20
|
-
* Convert a user object to a DID:WEB identifier.
|
|
21
|
-
*
|
|
22
|
-
* Format: did:web:<domain>:users:<email%40domain>
|
|
23
|
-
*/
|
|
24
|
-
export declare function userToDid(user: {
|
|
25
|
-
email: string;
|
|
26
|
-
domain: string;
|
|
27
|
-
}): string;
|
|
28
|
-
/**
|
|
29
|
-
* Convert a software peer's (provider, model) configuration to a DID:WEB
|
|
30
|
-
* identifier. Pool-vs-individual deployment is not part of identity —
|
|
31
|
-
* one DID per (provider, model) on this host.
|
|
32
|
-
*
|
|
33
|
-
* Format: did:web:<domain>:agents:<provider>:<model%2F-encoded>
|
|
34
|
-
*
|
|
35
|
-
* Model strings often contain `:` and `/` (e.g. `gemma2:27b`,
|
|
36
|
-
* `library/llama3`); both must be URI-encoded so DID parsing isn't
|
|
37
|
-
* ambiguous.
|
|
38
|
-
*/
|
|
39
|
-
export declare function agentToDid(agent: {
|
|
40
|
-
domain: string;
|
|
41
|
-
provider: string;
|
|
42
|
-
model: string;
|
|
43
|
-
}): string;
|
|
44
|
-
/**
|
|
45
|
-
* Convert a user object to a typed Person Agent with a DID:WEB identifier.
|
|
46
|
-
*/
|
|
47
|
-
export declare function userToAgent(user: {
|
|
48
|
-
id: string;
|
|
49
|
-
domain: string;
|
|
50
|
-
name: string | null;
|
|
51
|
-
email: string;
|
|
52
|
-
}): Agent;
|
|
53
|
-
/**
|
|
54
|
-
* Convert a software peer's configuration to a typed Software Agent.
|
|
55
|
-
* The `name` is a stable human-friendly label, not a parseable join —
|
|
56
|
-
* UI composes display from `provider`/`model` at render time.
|
|
57
|
-
*/
|
|
58
|
-
export declare function softwareToAgent(software: {
|
|
59
|
-
domain: string;
|
|
60
|
-
provider: string;
|
|
61
|
-
model: string;
|
|
62
|
-
parameters?: Record<string, unknown>;
|
|
63
|
-
}): Agent;
|
|
64
|
-
/**
|
|
65
|
-
* Parse a DID:WEB string into a typed Agent.
|
|
66
|
-
*
|
|
67
|
-
* Recognizes:
|
|
68
|
-
* did:web:<host>:users:<email> → Person (name = decoded email)
|
|
69
|
-
* did:web:<host>:agents:<provider>:<model> → Software (provider + model)
|
|
70
|
-
*
|
|
71
|
-
* Anything else falls back to a Person with the trailing segment as
|
|
72
|
-
* `name`. This is the read-side inverse of `userToDid`/`agentToDid`.
|
|
73
|
-
*/
|
|
74
|
-
export declare function didToAgent(did: string | undefined | null): Agent;
|
|
75
|
-
export {};
|
|
76
|
-
//# sourceMappingURL=did-utils.d.ts.map
|
package/dist/did-utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"did-utils.d.ts","sourceRoot":"","sources":["../src/did-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,KAAK,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE7F;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,KAAK,CAMR;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC,GAAG,KAAK,CASR;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAyChE"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Common error classes — the unified Semiont error hierarchy.
|
|
3
|
-
*
|
|
4
|
-
* `SemiontError` is the base every other Semiont error class extends:
|
|
5
|
-
* `APIError` (api-client), `BusRequestError` and `SemiontSessionError` (sdk),
|
|
6
|
-
* `ValidationError`, `ScriptError`, `NotFoundError`, `UnauthorizedError`,
|
|
7
|
-
* `ConflictError` (here), and `AWSError` (cli). Subclasses tighten the
|
|
8
|
-
* `code` field to a literal-union for discriminated handling.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Transport-neutral error vocabulary. Every transport that surfaces
|
|
12
|
-
* errors over `ITransport.errors$` maps its native failure modes to one
|
|
13
|
-
* of these codes — HTTP `APIError` maps from status code, in-process
|
|
14
|
-
* transports map from local failure shape, gRPC would map from status
|
|
15
|
-
* code, etc. Routing layers (e.g. `SemiontBrowser`'s session-expired /
|
|
16
|
-
* permission-denied modal routing) match on this vocabulary so they
|
|
17
|
-
* stay transport-agnostic.
|
|
18
|
-
*
|
|
19
|
-
* - `unauthorized` — auth required / token missing or expired (HTTP 401)
|
|
20
|
-
* - `forbidden` — auth ok but lacks permission (HTTP 403)
|
|
21
|
-
* - `not-found` — resource missing (HTTP 404)
|
|
22
|
-
* - `conflict` — concurrent modification, duplicate, etc. (HTTP 409)
|
|
23
|
-
* - `bad-request` — request malformed (HTTP 400)
|
|
24
|
-
* - `unavailable` — backend unreachable, network error, 5xx
|
|
25
|
-
* - `error` — unclassified fallback
|
|
26
|
-
*/
|
|
27
|
-
export type TransportErrorCode = 'unauthorized' | 'forbidden' | 'not-found' | 'conflict' | 'bad-request' | 'unavailable' | 'error';
|
|
28
|
-
export declare class SemiontError extends Error {
|
|
29
|
-
code: string;
|
|
30
|
-
details?: Record<string, unknown> | undefined;
|
|
31
|
-
constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
|
|
32
|
-
}
|
|
33
|
-
export declare class ValidationError extends SemiontError {
|
|
34
|
-
constructor(message: string, details?: Record<string, unknown>);
|
|
35
|
-
}
|
|
36
|
-
export declare class ScriptError extends SemiontError {
|
|
37
|
-
constructor(message: string, code?: string, details?: Record<string, unknown>);
|
|
38
|
-
}
|
|
39
|
-
export declare class NotFoundError extends SemiontError {
|
|
40
|
-
constructor(resource: string, id?: string);
|
|
41
|
-
}
|
|
42
|
-
export declare class UnauthorizedError extends SemiontError {
|
|
43
|
-
constructor(message?: string, details?: Record<string, unknown>);
|
|
44
|
-
}
|
|
45
|
-
export declare class ConflictError extends SemiontError {
|
|
46
|
-
constructor(message: string, details?: Record<string, unknown>);
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,kBAAkB,GAC1B,cAAc,GACd,WAAW,GACX,WAAW,GACX,UAAU,GACV,aAAa,GACb,aAAa,GACb,OAAO,CAAC;AAEZ,qBAAa,YAAa,SAAQ,KAAK;IAG5B,IAAI,EAAE,MAAM;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFxC,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAM3C;AAED,qBAAa,eAAgB,SAAQ,YAAY;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,WAAY,SAAQ,YAAY;gBAC/B,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAuB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI9F;AAED,qBAAa,aAAc,SAAQ,YAAY;gBACjC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM;CAK1C;AAED,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,GAAE,MAAuB,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAIhF;AAED,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D"}
|
package/dist/event-base.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event Base Types
|
|
3
|
-
*
|
|
4
|
-
* Core shapes for the event-sourced persistence model.
|
|
5
|
-
* EventBase is the common shape for all domain events.
|
|
6
|
-
* StoredEvent wraps an event with persistence metadata.
|
|
7
|
-
*
|
|
8
|
-
* These types are referenced by event-catalog.ts (domain events)
|
|
9
|
-
* and bus-protocol.ts (the full EventMap).
|
|
10
|
-
*/
|
|
11
|
-
import type { components } from './types';
|
|
12
|
-
import type { ResourceId, UserId } from './identifiers';
|
|
13
|
-
import type { PersistedEvent } from './persisted-events';
|
|
14
|
-
/**
|
|
15
|
-
* Narrow an OpenAPI-generated type by overriding specific fields with branded types.
|
|
16
|
-
*
|
|
17
|
-
* OpenAPI schemas use plain `string` for identifiers. TypeScript branded types
|
|
18
|
-
* (ResourceId, AnnotationId, UserId, JobId) add compile-time safety. Brand<T, B>
|
|
19
|
-
* takes the OpenAPI type T and replaces the fields listed in B with their branded
|
|
20
|
-
* counterparts, preserving all other fields from the schema.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* type MyCommand = Brand<components['schemas']['YieldCreateCommand'], { userId: UserId }>;
|
|
24
|
-
* // Result: YieldCreateCommand with userId narrowed from string to UserId
|
|
25
|
-
*/
|
|
26
|
-
export type Brand<T, Overrides> = Omit<T, keyof Overrides> & Overrides;
|
|
27
|
-
/** Fields common to ALL domain events (system and resource-scoped). */
|
|
28
|
-
export interface EventBase {
|
|
29
|
-
id: string;
|
|
30
|
-
timestamp: string;
|
|
31
|
-
resourceId?: ResourceId;
|
|
32
|
-
userId: UserId;
|
|
33
|
-
version: number;
|
|
34
|
-
}
|
|
35
|
-
/** Persistence metadata attached to every stored event. */
|
|
36
|
-
export type EventMetadata = components['schemas']['EventMetadata'];
|
|
37
|
-
/** Optional cryptographic signature on a stored event. */
|
|
38
|
-
export interface EventSignature {
|
|
39
|
-
algorithm: 'ed25519';
|
|
40
|
-
publicKey: string;
|
|
41
|
-
signature: string;
|
|
42
|
-
keyId?: string;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* A domain event with persistence metadata.
|
|
46
|
-
* Flat intersection — no nesting (event.type, not event.event.type).
|
|
47
|
-
*/
|
|
48
|
-
export type StoredEvent<T extends EventBase = PersistedEvent> = T & {
|
|
49
|
-
metadata: EventMetadata;
|
|
50
|
-
signature?: EventSignature;
|
|
51
|
-
};
|
|
52
|
-
export type BodyItem = components['schemas']['TextualBody'] | components['schemas']['SpecificResource'];
|
|
53
|
-
export type BodyOperation = components['schemas']['BodyOperationAdd'] | components['schemas']['BodyOperationRemove'] | components['schemas']['BodyOperationReplace'];
|
|
54
|
-
import type { Annotation } from './annotation-types';
|
|
55
|
-
export interface EventQuery {
|
|
56
|
-
resourceId?: ResourceId;
|
|
57
|
-
userId?: string;
|
|
58
|
-
eventTypes?: string[];
|
|
59
|
-
fromTimestamp?: string;
|
|
60
|
-
toTimestamp?: string;
|
|
61
|
-
fromSequence?: number;
|
|
62
|
-
limit?: number;
|
|
63
|
-
}
|
|
64
|
-
export interface ResourceAnnotations {
|
|
65
|
-
resourceId: ResourceId;
|
|
66
|
-
annotations: Annotation[];
|
|
67
|
-
version: number;
|
|
68
|
-
updatedAt: string;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=event-base.d.ts.map
|
package/dist/event-base.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-base.d.ts","sourceRoot":"","sources":["../src/event-base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIzD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,SAAS,IAC5B,IAAI,CAAC,CAAC,EAAE,MAAM,SAAS,CAAC,GAAG,SAAS,CAAC;AAIvC,uEAAuE;AACvE,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,2DAA2D;AAC3D,MAA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}
|
package/dist/event-bus.d.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RxJS-based Event Bus
|
|
3
|
-
*
|
|
4
|
-
* Framework-agnostic event bus providing direct access to typed RxJS Subjects.
|
|
5
|
-
*
|
|
6
|
-
* Can be used in Node.js, browser, workers, CLI - anywhere RxJS runs.
|
|
7
|
-
*/
|
|
8
|
-
import { Subject } from 'rxjs';
|
|
9
|
-
import type { EventMap } from './bus-protocol';
|
|
10
|
-
import type { StoredEvent } from './event-base';
|
|
11
|
-
import type { PersistedEventType } from './persisted-events';
|
|
12
|
-
/**
|
|
13
|
-
* RxJS-based event bus
|
|
14
|
-
*
|
|
15
|
-
* Provides direct access to RxJS Subjects for each event type.
|
|
16
|
-
* Use standard RxJS patterns for emitting and subscribing.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const eventBus = new EventBus();
|
|
21
|
-
*
|
|
22
|
-
* // Emit events
|
|
23
|
-
* eventBus.get('beckon:hover').next({ annotationId: 'ann-1' });
|
|
24
|
-
*
|
|
25
|
-
* // Subscribe to events
|
|
26
|
-
* const subscription = eventBus.get('beckon:hover').subscribe(({ annotationId }) => {
|
|
27
|
-
* console.log('Hover:', annotationId);
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* // Use RxJS operators
|
|
31
|
-
* import { debounceTime } from 'rxjs/operators';
|
|
32
|
-
* eventBus.get('beckon:hover')
|
|
33
|
-
* .pipe(debounceTime(100))
|
|
34
|
-
* .subscribe(handleHover);
|
|
35
|
-
*
|
|
36
|
-
* // Cleanup
|
|
37
|
-
* subscription.unsubscribe();
|
|
38
|
-
* eventBus.destroy();
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export declare class EventBus {
|
|
42
|
-
private subjects;
|
|
43
|
-
private isDestroyed;
|
|
44
|
-
constructor();
|
|
45
|
-
/**
|
|
46
|
-
* Get the RxJS Subject for an event
|
|
47
|
-
*
|
|
48
|
-
* Returns a typed Subject that can be used with all RxJS operators.
|
|
49
|
-
* Subjects are created lazily on first access.
|
|
50
|
-
*
|
|
51
|
-
* @param eventName - The event name
|
|
52
|
-
* @returns The RxJS Subject for this event
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* // Emit
|
|
57
|
-
* eventBus.get('beckon:hover').next({ annotationId: 'ann-1' });
|
|
58
|
-
*
|
|
59
|
-
* // Subscribe
|
|
60
|
-
* const sub = eventBus.get('beckon:hover').subscribe(handleHover);
|
|
61
|
-
*
|
|
62
|
-
* // With operators
|
|
63
|
-
* eventBus.get('beckon:hover')
|
|
64
|
-
* .pipe(debounceTime(100), distinctUntilChanged())
|
|
65
|
-
* .subscribe(handleHover);
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
get<K extends keyof EventMap>(eventName: K): Subject<EventMap[K]>;
|
|
69
|
-
/**
|
|
70
|
-
* Get the RxJS Subject for a domain event type (PersistedEventType).
|
|
71
|
-
*
|
|
72
|
-
* Domain event channels carry `StoredEvent`. This method avoids the need
|
|
73
|
-
* for `as keyof EventMap` casts when subscribing to domain event channels
|
|
74
|
-
* using runtime `PersistedEventType` strings.
|
|
75
|
-
*/
|
|
76
|
-
getDomainEvent(eventType: PersistedEventType): Subject<StoredEvent>;
|
|
77
|
-
/**
|
|
78
|
-
* Destroy the event bus and complete all subjects
|
|
79
|
-
*
|
|
80
|
-
* After calling destroy(), no new events can be emitted or subscribed to.
|
|
81
|
-
* All active subscriptions will be completed.
|
|
82
|
-
*/
|
|
83
|
-
destroy(): void;
|
|
84
|
-
/**
|
|
85
|
-
* Check if the event bus has been destroyed
|
|
86
|
-
*/
|
|
87
|
-
get destroyed(): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Create a resource-scoped event bus
|
|
90
|
-
*
|
|
91
|
-
* Events emitted or subscribed through the scoped bus are isolated to that resource.
|
|
92
|
-
* Internally, events are namespaced but the API remains identical to the parent bus.
|
|
93
|
-
*
|
|
94
|
-
* @param resourceId - Resource identifier to scope events to
|
|
95
|
-
* @returns A scoped event bus for this resource
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```typescript
|
|
99
|
-
* const eventBus = new EventBus();
|
|
100
|
-
* const resource1 = eventBus.scope('resource-1');
|
|
101
|
-
* const resource2 = eventBus.scope('resource-2');
|
|
102
|
-
*
|
|
103
|
-
* // These are isolated - only resource1 subscribers will fire
|
|
104
|
-
* resource1.get('detection:progress').next({ status: 'started' });
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
scope(resourceId: string): ScopedEventBus;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Resource-scoped event bus
|
|
111
|
-
*
|
|
112
|
-
* Provides isolated event streams per resource while maintaining the same API
|
|
113
|
-
* as the parent EventBus. Events are internally namespaced by resourceId.
|
|
114
|
-
*/
|
|
115
|
-
export declare class ScopedEventBus {
|
|
116
|
-
private parent;
|
|
117
|
-
private scopePrefix;
|
|
118
|
-
constructor(parent: EventBus, scopePrefix: string);
|
|
119
|
-
/**
|
|
120
|
-
* Get the RxJS Subject for a scoped event
|
|
121
|
-
*
|
|
122
|
-
* Returns the same type as the parent bus, but events are isolated to this scope.
|
|
123
|
-
* Internally uses namespaced keys but preserves type safety.
|
|
124
|
-
*
|
|
125
|
-
* @param event - The event name
|
|
126
|
-
* @returns The RxJS Subject for this scoped event
|
|
127
|
-
*/
|
|
128
|
-
get<E extends keyof EventMap>(event: E): Subject<EventMap[E]>;
|
|
129
|
-
/** Get the RxJS Subject for a domain event type on this scoped bus. */
|
|
130
|
-
getDomainEvent(eventType: PersistedEventType): Subject<StoredEvent>;
|
|
131
|
-
/**
|
|
132
|
-
* Create a nested scope
|
|
133
|
-
*
|
|
134
|
-
* Allows hierarchical scoping like `resource-1:subsystem-a`
|
|
135
|
-
*
|
|
136
|
-
* @param subScope - Additional scope level
|
|
137
|
-
* @returns A nested scoped event bus
|
|
138
|
-
*/
|
|
139
|
-
scope(subScope: string): ScopedEventBus;
|
|
140
|
-
}
|
|
141
|
-
//# sourceMappingURL=event-bus.d.ts.map
|
package/dist/event-bus.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../src/event-bus.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,WAAW,CAAU;;IAO7B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IA+BjE;;;;;;OAMG;IACH,cAAc,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IAInE;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IAaf;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc;CAG1C;AAED;;;;;GAKG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,WAAW;gBADX,MAAM,EAAE,QAAQ,EAChB,WAAW,EAAE,MAAM;IAG7B;;;;;;;;OAQG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,QAAQ,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAa7D,uEAAuE;IACvE,cAAc,CAAC,SAAS,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IAInE;;;;;;;OAOG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc;CAGxC"}
|
package/dist/event-utils.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event Type Guards and Extraction Utilities
|
|
3
|
-
*
|
|
4
|
-
* Domain logic for working with resource events.
|
|
5
|
-
* No React dependencies - safe to use in any JavaScript environment.
|
|
6
|
-
*/
|
|
7
|
-
import type { StoredEvent } from './event-base';
|
|
8
|
-
import type { AnnotationUri } from './branded-types';
|
|
9
|
-
/**
|
|
10
|
-
* Minimal event shape accepted by event utility functions.
|
|
11
|
-
* Compatible with both the internal `StoredEvent` type and the OpenAPI-derived
|
|
12
|
-
* schema type (`GetEventsResponse['events'][number]`), which lacks `version`.
|
|
13
|
-
*
|
|
14
|
-
* Flat shape — event fields and metadata are peers (no `event` wrapper).
|
|
15
|
-
*/
|
|
16
|
-
export interface StoredEventLike {
|
|
17
|
-
id: string;
|
|
18
|
-
type: string;
|
|
19
|
-
timestamp: string;
|
|
20
|
-
userId: string;
|
|
21
|
-
resourceId?: string;
|
|
22
|
-
payload?: unknown;
|
|
23
|
-
metadata: {
|
|
24
|
-
sequenceNumber: number;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Extract annotation ID from event payload
|
|
29
|
-
* Returns null if event is not annotation-related
|
|
30
|
-
*
|
|
31
|
-
* For mark:added: extracts full URI from payload.annotation.id
|
|
32
|
-
* For mark:removed/mark:body-updated: constructs full URI from payload.annotationId (UUID) + resourceId
|
|
33
|
-
*/
|
|
34
|
-
export declare function getAnnotationUriFromEvent(event: StoredEventLike): AnnotationUri | null;
|
|
35
|
-
/**
|
|
36
|
-
* Check if an event is related to a specific annotation
|
|
37
|
-
*/
|
|
38
|
-
export declare function isEventRelatedToAnnotation(event: StoredEventLike, annotationUri: AnnotationUri): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Type guard to check if an object is a StoredEvent (flat shape)
|
|
41
|
-
*/
|
|
42
|
-
export declare function isStoredEvent(event: any): event is StoredEvent;
|
|
43
|
-
//# sourceMappingURL=event-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-utils.d.ts","sourceRoot":"","sources":["../src/event-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE;QACR,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,eAAe,GAAG,aAAa,GAAG,IAAI,CAoBtF;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAGxG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAO9D"}
|
package/dist/fuzzy-anchor.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fuzzy Anchoring for W3C Web Annotation TextQuoteSelector
|
|
3
|
-
*
|
|
4
|
-
* Uses prefix/suffix context to disambiguate when the same text appears multiple times.
|
|
5
|
-
* Implements fuzzy matching as specified in the W3C Web Annotation Data Model.
|
|
6
|
-
*
|
|
7
|
-
* @see https://www.w3.org/TR/annotation-model/#text-quote-selector
|
|
8
|
-
*/
|
|
9
|
-
export interface TextPosition {
|
|
10
|
-
start: number;
|
|
11
|
-
end: number;
|
|
12
|
-
}
|
|
13
|
-
export type MatchQuality = 'exact' | 'normalized' | 'case-insensitive' | 'fuzzy';
|
|
14
|
-
/**
|
|
15
|
-
* Normalize text for comparison - handles common document editing changes
|
|
16
|
-
*
|
|
17
|
-
* Collapses whitespace, converts curly quotes to straight quotes,
|
|
18
|
-
* and normalizes common punctuation variations.
|
|
19
|
-
*/
|
|
20
|
-
export declare function normalizeText(text: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* Pre-computed content strings for batch fuzzy matching.
|
|
23
|
-
* Avoids recomputing normalizeText(content) and content.toLowerCase()
|
|
24
|
-
* for every annotation when processing many annotations against the same content.
|
|
25
|
-
*/
|
|
26
|
-
export interface ContentCache {
|
|
27
|
-
normalizedContent: string;
|
|
28
|
-
lowerContent: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Build a ContentCache for a given content string.
|
|
32
|
-
* Call once per content, pass to findBestTextMatch/findTextWithContext for all annotations.
|
|
33
|
-
*/
|
|
34
|
-
export declare function buildContentCache(content: string): ContentCache;
|
|
35
|
-
/**
|
|
36
|
-
* Find best match for text in content using multi-strategy search
|
|
37
|
-
*
|
|
38
|
-
* Shared core logic used by both findTextWithContext and validateAndCorrectOffsets.
|
|
39
|
-
*
|
|
40
|
-
* @param content - Full text content to search within
|
|
41
|
-
* @param searchText - The text to find
|
|
42
|
-
* @param positionHint - Hint for where to search (TextPositionSelector.start)
|
|
43
|
-
* @param cache - Pre-computed normalized/lowered content (from buildContentCache)
|
|
44
|
-
* @returns Match with position and quality, or null if not found
|
|
45
|
-
*/
|
|
46
|
-
export declare function findBestTextMatch(content: string, searchText: string, positionHint: number | undefined, cache: ContentCache): {
|
|
47
|
-
start: number;
|
|
48
|
-
end: number;
|
|
49
|
-
matchQuality: MatchQuality;
|
|
50
|
-
} | null;
|
|
51
|
-
/**
|
|
52
|
-
* Find text using exact match with optional prefix/suffix context
|
|
53
|
-
*
|
|
54
|
-
* When the exact text appears multiple times in the content, prefix and suffix
|
|
55
|
-
* are used to disambiguate and find the correct occurrence.
|
|
56
|
-
*
|
|
57
|
-
* If exact text is not found, uses multi-strategy fuzzy matching (normalization,
|
|
58
|
-
* case-insensitive, Levenshtein distance) to locate changed text.
|
|
59
|
-
*
|
|
60
|
-
* @param content - Full text content to search within
|
|
61
|
-
* @param exact - The exact text to find
|
|
62
|
-
* @param prefix - Optional text that should appear immediately before the match
|
|
63
|
-
* @param suffix - Optional text that should appear immediately after the match
|
|
64
|
-
* @param positionHint - Optional position hint (from TextPositionSelector) for fuzzy search
|
|
65
|
-
* @returns Position of the matched text, or null if not found
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* const content = "The cat sat. The cat ran.";
|
|
70
|
-
* // Find second "The cat" occurrence
|
|
71
|
-
* const pos = findTextWithContext(content, "The cat", "sat. ", " ran");
|
|
72
|
-
* // Returns { start: 13, end: 20 }
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
export declare function findTextWithContext(content: string, exact: string, prefix: string | undefined, suffix: string | undefined, positionHint: number | undefined, cache: ContentCache): TextPosition | null;
|
|
76
|
-
/**
|
|
77
|
-
* Verify that a position correctly points to the exact text
|
|
78
|
-
* Useful for debugging and validation
|
|
79
|
-
*/
|
|
80
|
-
export declare function verifyPosition(content: string, position: TextPosition, expectedExact: string): boolean;
|
|
81
|
-
//# sourceMappingURL=fuzzy-anchor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fuzzy-anchor.d.ts","sourceRoot":"","sources":["../src/fuzzy-anchor.ts"],"names":[],"mappings":"AAA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|
-
*/
|
|
4
|
-
import type { components } from './types';
|
|
5
|
-
import type { ResourceId } from './identifiers';
|
|
6
|
-
import type { Annotation } from './annotation-types';
|
|
7
|
-
type RawResourceDescriptor = components['schemas']['ResourceDescriptor'];
|
|
8
|
-
/**
|
|
9
|
-
* Domain-level ResourceDescriptor type. Same shape as the OpenAPI-generated
|
|
10
|
-
* `components['schemas']['ResourceDescriptor']`, but with a branded `ResourceId`
|
|
11
|
-
* for the `@id` field.
|
|
12
|
-
*
|
|
13
|
-
* Implemented by intersection (not `Omit`) because the generated raw type
|
|
14
|
-
* ends in `& { [key: string]: unknown }` — `Omit` on an intersection with
|
|
15
|
-
* an index signature drops almost all named fields.
|
|
16
|
-
*/
|
|
17
|
-
export type ResourceDescriptor = RawResourceDescriptor & {
|
|
18
|
-
'@id': ResourceId;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Represents a connection between resources through annotations
|
|
22
|
-
*/
|
|
23
|
-
export interface GraphConnection {
|
|
24
|
-
targetResource: ResourceDescriptor;
|
|
25
|
-
annotations: Annotation[];
|
|
26
|
-
relationshipType?: string;
|
|
27
|
-
bidirectional: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Represents a path through the graph
|
|
31
|
-
*/
|
|
32
|
-
export interface GraphPath {
|
|
33
|
-
resources: ResourceDescriptor[];
|
|
34
|
-
annotations: Annotation[];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Statistics about entity types in the graph
|
|
38
|
-
*/
|
|
39
|
-
export interface EntityTypeStats {
|
|
40
|
-
type: string;
|
|
41
|
-
count: number;
|
|
42
|
-
}
|
|
43
|
-
export {};
|
|
44
|
-
//# sourceMappingURL=graph.d.ts.map
|
package/dist/graph.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,qBAAqB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,GAAG;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,kBAAkB,CAAC;IACnC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/dist/id-generation.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"id-generation.d.ts","sourceRoot":"","sources":["../src/id-generation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
package/dist/identifiers.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Branded identifier types for compile-time type safety.
|
|
3
|
-
*
|
|
4
|
-
* These types prevent mixing up resource IDs, annotation IDs, and user IDs
|
|
5
|
-
* at compile time while having zero runtime overhead.
|
|
6
|
-
*
|
|
7
|
-
* URI types (ResourceUri, AnnotationUri) are in @semiont/api-client
|
|
8
|
-
* since they deal with HTTP URIs returned by the API.
|
|
9
|
-
*/
|
|
10
|
-
export type ResourceId = string & {
|
|
11
|
-
readonly __brand: 'ResourceId';
|
|
12
|
-
};
|
|
13
|
-
export type AnnotationId = string & {
|
|
14
|
-
readonly __brand: 'AnnotationId';
|
|
15
|
-
};
|
|
16
|
-
export type UserId = string & {
|
|
17
|
-
readonly __brand: 'UserId';
|
|
18
|
-
};
|
|
19
|
-
export declare function isResourceId(value: string): value is ResourceId;
|
|
20
|
-
export declare function isAnnotationId(value: string): value is AnnotationId;
|
|
21
|
-
export declare function resourceId(id: string): ResourceId;
|
|
22
|
-
export declare function annotationId(id: string): AnnotationId;
|
|
23
|
-
export declare function userId(id: string): UserId;
|
|
24
|
-
//# sourceMappingURL=identifiers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC;AACrE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CAAE,CAAC;AACzE,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAG7D,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,CAE/D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAEnE;AAGD,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,CAKjD;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,CAKrD;AAED,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAEzC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,YAAY,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG7D,YAAY,EAEV,UAAU,EACV,aAAa,EAEb,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EAEV,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EAEP,WAAW,EACX,aAAa,EACb,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAEL,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EAEP,WAAW,EACX,aAAa,EACb,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EACL,UAAU,EACV,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,cAAc,GACf,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,eAAe,EACf,SAAS,EACT,eAAe,EACf,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAGjB,YAAY,EACV,KAAK,EACL,SAAS,EACT,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,QAAQ,EACR,UAAU,EACV,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,YAAY,EACV,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,qBAAqB,GACtB,MA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