@componentonce/core 0.1.0-beta.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 +39 -0
- package/dist/index.d.ts +143 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +217 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @componentonce/core
|
|
2
|
+
|
|
3
|
+
Renderer, framework, and storage agnostic contracts for trusted versioned components.
|
|
4
|
+
|
|
5
|
+
## Definitions
|
|
6
|
+
|
|
7
|
+
ComponentOnceDefinition carries four independent generic types:
|
|
8
|
+
|
|
9
|
+
- implementation: opaque to core
|
|
10
|
+
- Props: persisted/configured data
|
|
11
|
+
- HostContext: arbitrary runtime capabilities/services owned by the host
|
|
12
|
+
- Payload: arbitrary application/domain data for one invocation
|
|
13
|
+
|
|
14
|
+
Every manifest has an exact id and version and may declare multiple requirements:
|
|
15
|
+
|
|
16
|
+
requirements: [
|
|
17
|
+
{ name: "react", version: "19" },
|
|
18
|
+
{ name: "my-app-sdk", version: "3" }
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
Core does not know what those capabilities mean.
|
|
22
|
+
|
|
23
|
+
## Compatibility
|
|
24
|
+
|
|
25
|
+
Hosts provide ComponentOnceCapability records before executing an implementation.
|
|
26
|
+
|
|
27
|
+
assertComponentOnceCompatible verifies every requirement. Missing capability and incompatible version are separate typed errors. Exact name/version equality is the default. A host may supply ComponentOnceCapabilityCompatibility to implement another policy, such as accepting a compatible React range or application SDK major version.
|
|
28
|
+
|
|
29
|
+
Core has no semver dependency and no React-specific compatibility logic.
|
|
30
|
+
|
|
31
|
+
## Registries
|
|
32
|
+
|
|
33
|
+
ComponentOnceRegistry instances are isolated. Exact id/version lookup is deterministic. Hosts may explicitly configure a default version, but registration never guesses that a newest-looking string should win.
|
|
34
|
+
|
|
35
|
+
Duplicate exact versions throw by default; callers may explicitly keep the existing definition or replace it.
|
|
36
|
+
|
|
37
|
+
## Loaders
|
|
38
|
+
|
|
39
|
+
ComponentOnceLoader is an I/O-free adapter contract. Storage and transport implementations extend ComponentOnceLoadDescriptor with their own data. loadAndRegisterComponentOnce verifies that a loader returned the exact id/version requested before registration.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/** An exact, immutable component identity used for deterministic lookup. */
|
|
2
|
+
export interface ComponentOnceExactReference {
|
|
3
|
+
/** Host-independent component identity. */
|
|
4
|
+
readonly id: string;
|
|
5
|
+
/** Exact component implementation version. */
|
|
6
|
+
readonly version: string;
|
|
7
|
+
}
|
|
8
|
+
/** One named runtime or host capability required by a component implementation. */
|
|
9
|
+
export interface ComponentOnceRequirement {
|
|
10
|
+
/** Stable capability name such as React, browser DOM, or an application SDK id. */
|
|
11
|
+
readonly name: string;
|
|
12
|
+
/** Requirement version interpreted by the host compatibility rule. */
|
|
13
|
+
readonly version: string;
|
|
14
|
+
}
|
|
15
|
+
/** One named runtime or API capability actually available from a host. */
|
|
16
|
+
export interface ComponentOnceCapability {
|
|
17
|
+
/** Stable capability name. */
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/** Version exposed by this host. */
|
|
20
|
+
readonly version: string;
|
|
21
|
+
}
|
|
22
|
+
/** Stable identity and compatibility metadata for one registered component implementation. */
|
|
23
|
+
export interface ComponentOnceManifest extends ComponentOnceExactReference {
|
|
24
|
+
/** Optional human label for editor or catalog surfaces. */
|
|
25
|
+
readonly displayName?: string;
|
|
26
|
+
/** Runtime/application contracts which must all be satisfied before this component can run. */
|
|
27
|
+
readonly requirements?: readonly ComponentOnceRequirement[];
|
|
28
|
+
}
|
|
29
|
+
/** Optional validator used at an adapter boundary rather than on every render. */
|
|
30
|
+
export type ComponentOnceValidator<T> = (input: unknown) => T;
|
|
31
|
+
/** One versioned implementation registered in a ComponentOnce registry. */
|
|
32
|
+
export interface ComponentOnceDefinition<TImplementation = unknown, TProps = unknown, THostContext = unknown, TPayload = unknown> {
|
|
33
|
+
readonly manifest: ComponentOnceManifest;
|
|
34
|
+
readonly implementation: TImplementation;
|
|
35
|
+
readonly validateProps?: ComponentOnceValidator<TProps>;
|
|
36
|
+
readonly validatePayload?: ComponentOnceValidator<TPayload>;
|
|
37
|
+
/** Phantom host-context type carried for compile-time host/module compatibility. */
|
|
38
|
+
readonly __hostContext?: THostContext;
|
|
39
|
+
}
|
|
40
|
+
/** The broad definition type accepted by heterogeneous registries and adapters. */
|
|
41
|
+
export type AnyComponentOnceDefinition = ComponentOnceDefinition<unknown, unknown, unknown, unknown>;
|
|
42
|
+
/** Exact load identity that storage and transport adapters may extend with their own fields. */
|
|
43
|
+
export interface ComponentOnceLoadDescriptor extends ComponentOnceExactReference {
|
|
44
|
+
}
|
|
45
|
+
/** Host-provided loader that maps an adapter descriptor to one typed definition. */
|
|
46
|
+
export interface ComponentOnceLoader<TDefinition extends AnyComponentOnceDefinition = AnyComponentOnceDefinition, TDescriptor extends ComponentOnceLoadDescriptor = ComponentOnceLoadDescriptor> {
|
|
47
|
+
load(descriptor: TDescriptor): Promise<TDefinition>;
|
|
48
|
+
}
|
|
49
|
+
/** Conflict behavior used when an exact id and version is already registered. */
|
|
50
|
+
export type ComponentOnceConflictStrategy = "throw" | "keep-existing" | "replace";
|
|
51
|
+
/** Options applied while registering one exact component definition. */
|
|
52
|
+
export interface ComponentOnceRegistrationOptions {
|
|
53
|
+
/** How to handle an occupied exact id and version. Defaults to `throw`. */
|
|
54
|
+
readonly onConflict?: ComponentOnceConflictStrategy;
|
|
55
|
+
/** Select the registered version as the explicit default for its id. */
|
|
56
|
+
readonly setAsDefault?: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** A request for an exact version or for a host-configured default version. */
|
|
59
|
+
export interface ComponentOnceResolveRequest {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
/** Omit only when the host has explicitly configured a default for this id. */
|
|
62
|
+
readonly version?: string;
|
|
63
|
+
}
|
|
64
|
+
/** Base error for registry, loading, and compatibility contract failures. */
|
|
65
|
+
export declare class ComponentOnceError extends Error {
|
|
66
|
+
constructor(message: string);
|
|
67
|
+
}
|
|
68
|
+
/** Thrown when an id or version is empty. */
|
|
69
|
+
export declare class ComponentOnceInvalidReferenceError extends ComponentOnceError {
|
|
70
|
+
readonly reference: ComponentOnceExactReference;
|
|
71
|
+
constructor(reference: ComponentOnceExactReference);
|
|
72
|
+
}
|
|
73
|
+
/** Thrown when registration finds an existing definition at the same exact id and version. */
|
|
74
|
+
export declare class ComponentOnceDuplicateVersionError extends ComponentOnceError {
|
|
75
|
+
readonly reference: ComponentOnceExactReference;
|
|
76
|
+
readonly existing: AnyComponentOnceDefinition;
|
|
77
|
+
readonly incoming: AnyComponentOnceDefinition;
|
|
78
|
+
constructor(existing: AnyComponentOnceDefinition, incoming: AnyComponentOnceDefinition);
|
|
79
|
+
}
|
|
80
|
+
/** Thrown when an exact component definition cannot be found. */
|
|
81
|
+
export declare class ComponentOnceDefinitionNotFoundError extends ComponentOnceError {
|
|
82
|
+
readonly reference: ComponentOnceExactReference;
|
|
83
|
+
constructor(reference: ComponentOnceExactReference);
|
|
84
|
+
}
|
|
85
|
+
/** Thrown when unversioned resolution has no host-configured default. */
|
|
86
|
+
export declare class ComponentOnceDefaultVersionNotConfiguredError extends ComponentOnceError {
|
|
87
|
+
readonly id: string;
|
|
88
|
+
constructor(id: string);
|
|
89
|
+
}
|
|
90
|
+
/** Thrown when a loader returns a definition other than the exact descriptor requested. */
|
|
91
|
+
export declare class ComponentOnceLoadedDefinitionMismatchError extends ComponentOnceError {
|
|
92
|
+
readonly requested: ComponentOnceExactReference;
|
|
93
|
+
readonly loaded: ComponentOnceExactReference;
|
|
94
|
+
constructor(requested: ComponentOnceExactReference, loaded: ComponentOnceExactReference);
|
|
95
|
+
}
|
|
96
|
+
/** Thrown when a component requires a capability the host did not provide. */
|
|
97
|
+
export declare class ComponentOnceCapabilityMissingError extends ComponentOnceError {
|
|
98
|
+
readonly requirement: ComponentOnceRequirement;
|
|
99
|
+
constructor(requirement: ComponentOnceRequirement);
|
|
100
|
+
}
|
|
101
|
+
/** Thrown when a named host capability exists but its version is incompatible. */
|
|
102
|
+
export declare class ComponentOnceCapabilityVersionError extends ComponentOnceError {
|
|
103
|
+
readonly requirement: ComponentOnceRequirement;
|
|
104
|
+
readonly available: ComponentOnceCapability;
|
|
105
|
+
constructor(requirement: ComponentOnceRequirement, available: ComponentOnceCapability);
|
|
106
|
+
}
|
|
107
|
+
/** Host-supplied compatibility rule for one named requirement and matching available capability. */
|
|
108
|
+
export type ComponentOnceCapabilityCompatibility = (requirement: ComponentOnceRequirement, available: ComponentOnceCapability) => boolean;
|
|
109
|
+
/** Compare one requirement and capability by exact name and version equality. */
|
|
110
|
+
export declare function exactComponentOnceCapabilityCompatibility(requirement: ComponentOnceRequirement, available: ComponentOnceCapability): boolean;
|
|
111
|
+
/** Find the host capability with the exact name required by one component requirement. */
|
|
112
|
+
export declare function findComponentOnceCapability(requirement: ComponentOnceRequirement, available: readonly ComponentOnceCapability[]): ComponentOnceCapability | undefined;
|
|
113
|
+
/** Check whether every manifest requirement is satisfied by host capabilities. */
|
|
114
|
+
export declare function isComponentOnceCompatible(manifest: ComponentOnceManifest, available: readonly ComponentOnceCapability[], isCompatible?: ComponentOnceCapabilityCompatibility): boolean;
|
|
115
|
+
/** Assert every manifest requirement before executing or mounting its implementation. */
|
|
116
|
+
export declare function assertComponentOnceCompatible(manifest: ComponentOnceManifest, available: readonly ComponentOnceCapability[], isCompatible?: ComponentOnceCapabilityCompatibility): void;
|
|
117
|
+
/** An isolated, storage-agnostic registry of exact component definitions. */
|
|
118
|
+
export declare class ComponentOnceRegistry<TDefinition extends AnyComponentOnceDefinition = AnyComponentOnceDefinition> {
|
|
119
|
+
#private;
|
|
120
|
+
/** Register one definition without choosing a version implicitly. */
|
|
121
|
+
register(definition: TDefinition, options?: ComponentOnceRegistrationOptions): TDefinition;
|
|
122
|
+
/** Return an exact definition when present without applying a default. */
|
|
123
|
+
findExact(id: string, version: string): TDefinition | undefined;
|
|
124
|
+
/** Return an exact definition or throw when it is absent. */
|
|
125
|
+
getExact(id: string, version: string): TDefinition;
|
|
126
|
+
/** Report whether an exact id and version is registered. */
|
|
127
|
+
hasExact(id: string, version: string): boolean;
|
|
128
|
+
/** Resolve an exact version, or an explicitly configured default when version is omitted. */
|
|
129
|
+
resolve(request: ComponentOnceResolveRequest): TDefinition;
|
|
130
|
+
/** Configure one already registered exact version as the default for its id. */
|
|
131
|
+
setDefaultVersion(id: string, version: string): void;
|
|
132
|
+
/** Return the configured default version for an id when present. */
|
|
133
|
+
getDefaultVersion(id: string): string | undefined;
|
|
134
|
+
/** Remove the configured default selection for an id. */
|
|
135
|
+
clearDefaultVersion(id: string): boolean;
|
|
136
|
+
/** Remove and return one exact definition, also clearing a matching default. */
|
|
137
|
+
unregister(id: string, version: string): TDefinition | undefined;
|
|
138
|
+
/** List registered versions for an id in deterministic lexical order. */
|
|
139
|
+
listVersions(id: string): readonly string[];
|
|
140
|
+
}
|
|
141
|
+
/** Load one exact definition, verify its identity, and register it in an isolated registry. */
|
|
142
|
+
export declare function loadAndRegisterComponentOnce<TDefinition extends AnyComponentOnceDefinition, TDescriptor extends ComponentOnceLoadDescriptor>(registry: ComponentOnceRegistry<TDefinition>, loader: ComponentOnceLoader<TDefinition, TDescriptor>, descriptor: TDescriptor, options?: ComponentOnceRegistrationOptions): Promise<TDefinition>;
|
|
143
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,WAAW,2BAA2B;IAC1C,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,mFAAmF;AACnF,MAAM,WAAW,wBAAwB;IACvC,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,0EAA0E;AAC1E,MAAM,WAAW,uBAAuB;IACtC,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,8FAA8F;AA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D,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW;IASzD,4DAA4D;IACrD,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAIrD,6FAA6F;IACtF,OAAO,CAAC,OAAO,EAAE,2BAA2B,GAAG,WAAW;IASjE,gFAAgF;IACzE,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAK3D,oEAAoE;IAC7D,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIxD,yDAAyD;IAClD,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI/C,gFAAgF;IACzE,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAWvE,yEAAyE;IAClE,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;CAGnD;AAED,+FAA+F;AAC/F,wBAAsB,4BAA4B,CAChD,WAAW,SAAS,0BAA0B,EAC9C,WAAW,SAAS,2BAA2B,EAE/C,QAAQ,EAAE,qBAAqB,CAAC,WAAW,CAAC,EAC5C,MAAM,EAAE,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,EACrD,UAAU,EAAE,WAAW,EACvB,OAAO,GAAE,gCAAqC,GAC7C,OAAO,CAAC,WAAW,CAAC,CAQtB"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/** Base error for registry, loading, and compatibility contract failures. */
|
|
2
|
+
export class ComponentOnceError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = new.target.name;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** Thrown when an id or version is empty. */
|
|
9
|
+
export class ComponentOnceInvalidReferenceError extends ComponentOnceError {
|
|
10
|
+
reference;
|
|
11
|
+
constructor(reference) {
|
|
12
|
+
super("Component ids and versions must be non-empty strings.");
|
|
13
|
+
this.reference = reference;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Thrown when registration finds an existing definition at the same exact id and version. */
|
|
17
|
+
export class ComponentOnceDuplicateVersionError extends ComponentOnceError {
|
|
18
|
+
reference;
|
|
19
|
+
existing;
|
|
20
|
+
incoming;
|
|
21
|
+
constructor(existing, incoming) {
|
|
22
|
+
const { id, version } = incoming.manifest;
|
|
23
|
+
super(`Component "${id}" version "${version}" is already registered.`);
|
|
24
|
+
this.reference = { id, version };
|
|
25
|
+
this.existing = existing;
|
|
26
|
+
this.incoming = incoming;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Thrown when an exact component definition cannot be found. */
|
|
30
|
+
export class ComponentOnceDefinitionNotFoundError extends ComponentOnceError {
|
|
31
|
+
reference;
|
|
32
|
+
constructor(reference) {
|
|
33
|
+
super(`Component "${reference.id}" version "${reference.version}" is not registered.`);
|
|
34
|
+
this.reference = reference;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Thrown when unversioned resolution has no host-configured default. */
|
|
38
|
+
export class ComponentOnceDefaultVersionNotConfiguredError extends ComponentOnceError {
|
|
39
|
+
id;
|
|
40
|
+
constructor(id) {
|
|
41
|
+
super(`Component "${id}" has no configured default version.`);
|
|
42
|
+
this.id = id;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/** Thrown when a loader returns a definition other than the exact descriptor requested. */
|
|
46
|
+
export class ComponentOnceLoadedDefinitionMismatchError extends ComponentOnceError {
|
|
47
|
+
requested;
|
|
48
|
+
loaded;
|
|
49
|
+
constructor(requested, loaded) {
|
|
50
|
+
super(`Loader returned component "${loaded.id}" version "${loaded.version}" while ` +
|
|
51
|
+
`"${requested.id}" version "${requested.version}" was requested.`);
|
|
52
|
+
this.requested = requested;
|
|
53
|
+
this.loaded = loaded;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Thrown when a component requires a capability the host did not provide. */
|
|
57
|
+
export class ComponentOnceCapabilityMissingError extends ComponentOnceError {
|
|
58
|
+
requirement;
|
|
59
|
+
constructor(requirement) {
|
|
60
|
+
super("Component requires capability \"" + requirement.name + "\" version \"" +
|
|
61
|
+
requirement.version + "\", but the host did not provide that capability.");
|
|
62
|
+
this.requirement = requirement;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Thrown when a named host capability exists but its version is incompatible. */
|
|
66
|
+
export class ComponentOnceCapabilityVersionError extends ComponentOnceError {
|
|
67
|
+
requirement;
|
|
68
|
+
available;
|
|
69
|
+
constructor(requirement, available) {
|
|
70
|
+
super("Component requires capability \"" + requirement.name + "\" version \"" +
|
|
71
|
+
requirement.version + "\", but the host provides version \"" +
|
|
72
|
+
available.version + "\".");
|
|
73
|
+
this.requirement = requirement;
|
|
74
|
+
this.available = available;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Compare one requirement and capability by exact name and version equality. */
|
|
78
|
+
export function exactComponentOnceCapabilityCompatibility(requirement, available) {
|
|
79
|
+
return requirement.name === available.name && requirement.version === available.version;
|
|
80
|
+
}
|
|
81
|
+
/** Find the host capability with the exact name required by one component requirement. */
|
|
82
|
+
export function findComponentOnceCapability(requirement, available) {
|
|
83
|
+
for (const capability of available) {
|
|
84
|
+
if (capability.name === requirement.name)
|
|
85
|
+
return capability;
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
/** Check whether every manifest requirement is satisfied by host capabilities. */
|
|
90
|
+
export function isComponentOnceCompatible(manifest, available, isCompatible = exactComponentOnceCapabilityCompatibility) {
|
|
91
|
+
for (const requirement of manifest.requirements ?? []) {
|
|
92
|
+
const capability = findComponentOnceCapability(requirement, available);
|
|
93
|
+
if (capability === undefined || !isCompatible(requirement, capability))
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
/** Assert every manifest requirement before executing or mounting its implementation. */
|
|
99
|
+
export function assertComponentOnceCompatible(manifest, available, isCompatible = exactComponentOnceCapabilityCompatibility) {
|
|
100
|
+
for (const requirement of manifest.requirements ?? []) {
|
|
101
|
+
const capability = findComponentOnceCapability(requirement, available);
|
|
102
|
+
if (capability === undefined) {
|
|
103
|
+
throw new ComponentOnceCapabilityMissingError(requirement);
|
|
104
|
+
}
|
|
105
|
+
if (!isCompatible(requirement, capability)) {
|
|
106
|
+
throw new ComponentOnceCapabilityVersionError(requirement, capability);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** An isolated, storage-agnostic registry of exact component definitions. */
|
|
111
|
+
export class ComponentOnceRegistry {
|
|
112
|
+
#definitions = new Map();
|
|
113
|
+
#defaultVersions = new Map();
|
|
114
|
+
/** Register one definition without choosing a version implicitly. */
|
|
115
|
+
register(definition, options = {}) {
|
|
116
|
+
assertValidReference(definition.manifest);
|
|
117
|
+
const { id, version } = definition.manifest;
|
|
118
|
+
let versions = this.#definitions.get(id);
|
|
119
|
+
if (versions === undefined) {
|
|
120
|
+
versions = new Map();
|
|
121
|
+
this.#definitions.set(id, versions);
|
|
122
|
+
}
|
|
123
|
+
const existing = versions.get(version);
|
|
124
|
+
let registered = definition;
|
|
125
|
+
if (existing !== undefined) {
|
|
126
|
+
switch (options.onConflict ?? "throw") {
|
|
127
|
+
case "throw":
|
|
128
|
+
throw new ComponentOnceDuplicateVersionError(existing, definition);
|
|
129
|
+
case "keep-existing":
|
|
130
|
+
registered = existing;
|
|
131
|
+
break;
|
|
132
|
+
case "replace":
|
|
133
|
+
versions.set(version, definition);
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
versions.set(version, definition);
|
|
139
|
+
}
|
|
140
|
+
if (options.setAsDefault === true)
|
|
141
|
+
this.#defaultVersions.set(id, version);
|
|
142
|
+
return registered;
|
|
143
|
+
}
|
|
144
|
+
/** Return an exact definition when present without applying a default. */
|
|
145
|
+
findExact(id, version) {
|
|
146
|
+
return this.#definitions.get(id)?.get(version);
|
|
147
|
+
}
|
|
148
|
+
/** Return an exact definition or throw when it is absent. */
|
|
149
|
+
getExact(id, version) {
|
|
150
|
+
assertValidReference({ id, version });
|
|
151
|
+
const definition = this.findExact(id, version);
|
|
152
|
+
if (definition === undefined) {
|
|
153
|
+
throw new ComponentOnceDefinitionNotFoundError({ id, version });
|
|
154
|
+
}
|
|
155
|
+
return definition;
|
|
156
|
+
}
|
|
157
|
+
/** Report whether an exact id and version is registered. */
|
|
158
|
+
hasExact(id, version) {
|
|
159
|
+
return this.findExact(id, version) !== undefined;
|
|
160
|
+
}
|
|
161
|
+
/** Resolve an exact version, or an explicitly configured default when version is omitted. */
|
|
162
|
+
resolve(request) {
|
|
163
|
+
if (request.version !== undefined)
|
|
164
|
+
return this.getExact(request.id, request.version);
|
|
165
|
+
const version = this.#defaultVersions.get(request.id);
|
|
166
|
+
if (version === undefined) {
|
|
167
|
+
throw new ComponentOnceDefaultVersionNotConfiguredError(request.id);
|
|
168
|
+
}
|
|
169
|
+
return this.getExact(request.id, version);
|
|
170
|
+
}
|
|
171
|
+
/** Configure one already registered exact version as the default for its id. */
|
|
172
|
+
setDefaultVersion(id, version) {
|
|
173
|
+
this.getExact(id, version);
|
|
174
|
+
this.#defaultVersions.set(id, version);
|
|
175
|
+
}
|
|
176
|
+
/** Return the configured default version for an id when present. */
|
|
177
|
+
getDefaultVersion(id) {
|
|
178
|
+
return this.#defaultVersions.get(id);
|
|
179
|
+
}
|
|
180
|
+
/** Remove the configured default selection for an id. */
|
|
181
|
+
clearDefaultVersion(id) {
|
|
182
|
+
return this.#defaultVersions.delete(id);
|
|
183
|
+
}
|
|
184
|
+
/** Remove and return one exact definition, also clearing a matching default. */
|
|
185
|
+
unregister(id, version) {
|
|
186
|
+
const versions = this.#definitions.get(id);
|
|
187
|
+
const definition = versions?.get(version);
|
|
188
|
+
if (versions === undefined || definition === undefined)
|
|
189
|
+
return undefined;
|
|
190
|
+
versions.delete(version);
|
|
191
|
+
if (versions.size === 0)
|
|
192
|
+
this.#definitions.delete(id);
|
|
193
|
+
if (this.#defaultVersions.get(id) === version)
|
|
194
|
+
this.#defaultVersions.delete(id);
|
|
195
|
+
return definition;
|
|
196
|
+
}
|
|
197
|
+
/** List registered versions for an id in deterministic lexical order. */
|
|
198
|
+
listVersions(id) {
|
|
199
|
+
return [...(this.#definitions.get(id)?.keys() ?? [])].sort();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** Load one exact definition, verify its identity, and register it in an isolated registry. */
|
|
203
|
+
export async function loadAndRegisterComponentOnce(registry, loader, descriptor, options = {}) {
|
|
204
|
+
assertValidReference(descriptor);
|
|
205
|
+
const definition = await loader.load(descriptor);
|
|
206
|
+
const { id, version } = definition.manifest;
|
|
207
|
+
if (id !== descriptor.id || version !== descriptor.version) {
|
|
208
|
+
throw new ComponentOnceLoadedDefinitionMismatchError(descriptor, { id, version });
|
|
209
|
+
}
|
|
210
|
+
return registry.register(definition, options);
|
|
211
|
+
}
|
|
212
|
+
function assertValidReference(reference) {
|
|
213
|
+
if (reference.id.trim() === "" || reference.version.trim() === "") {
|
|
214
|
+
throw new ComponentOnceInvalidReferenceError(reference);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkFA,6EAA6E;AAC7E,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;IAC9B,CAAC;CACF;AAED,6CAA6C;AAC7C,MAAM,OAAO,kCAAmC,SAAQ,kBAAkB;IACxD,SAA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,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC;QAC3D,MAAM,IAAI,0CAA0C,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,oBAAoB,CAAC,SAAsC;IAClE,IAAI,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAClE,MAAM,IAAI,kCAAkC,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@componentonce/core",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"README.md"
|
|
8
|
+
],
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"typescript": "^5.9.3",
|
|
17
|
+
"vitest": "^4.0.5"
|
|
18
|
+
},
|
|
19
|
+
"description": "Renderer-agnostic registry, versioning, loading, validation, and capability contracts for trusted dynamic components.",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public",
|
|
23
|
+
"tag": "beta"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p tsconfig.json",
|
|
27
|
+
"check": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.test.json",
|
|
28
|
+
"test": "vitest run"
|
|
29
|
+
}
|
|
30
|
+
}
|