@mobile-reality/mdma-runtime 0.3.1 → 0.4.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.
@@ -0,0 +1,32 @@
1
+ import type { AttachableDefinition } from '@mobile-reality/mdma-spec';
2
+ import type { AttachableHandler, AttachableRegistry } from './registry.js';
3
+ /** The Zod schema type carried by an attachable definition (avoids a direct zod dep here). */
4
+ type AttachableSchema = AttachableDefinition['schema'];
5
+ /**
6
+ * A custom-component variant's framework-agnostic registration. The variant
7
+ * `name` is `handler.definition.type`, and `handler.definition.schema` is the
8
+ * variant's **props** schema (not the whole envelope — the `custom` envelope is
9
+ * validated by core). Rendering is registered separately, per framework (e.g.
10
+ * the React renderer's `customVariants`), because presentation is host-specific.
11
+ */
12
+ export interface CustomComponentRegistration<TProps = unknown> {
13
+ handler: AttachableHandler<TProps>;
14
+ }
15
+ /**
16
+ * Registries a custom component is wired into. Both are optional so a host can
17
+ * register only what it needs (e.g. schema-only for a presentational variant).
18
+ */
19
+ export interface CustomRegistrationTargets {
20
+ /** Runtime handler registry (behavior). */
21
+ attachables?: AttachableRegistry;
22
+ /** Parser `customSchemas` map — validates a `custom` component's `props` by `name`. */
23
+ customSchemas?: Map<string, AttachableSchema>;
24
+ }
25
+ /**
26
+ * Register a custom component's props schema (for parser validation) and its
27
+ * runtime handler in one call, keyed by the variant `name`
28
+ * (`handler.definition.type`).
29
+ */
30
+ export declare function registerCustomComponent<TProps>(registration: CustomComponentRegistration<TProps>, targets: CustomRegistrationTargets): void;
31
+ export {};
32
+ //# sourceMappingURL=register-custom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-custom.d.ts","sourceRoot":"","sources":["../../src/attachable/register-custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3E,8FAA8F;AAC9F,KAAK,gBAAgB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,WAAW,2BAA2B,CAAC,MAAM,GAAG,OAAO;IAC3D,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,2CAA2C;IAC3C,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,uFAAuF;IACvF,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC/C;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAC5C,YAAY,EAAE,2BAA2B,CAAC,MAAM,CAAC,EACjD,OAAO,EAAE,yBAAyB,GACjC,IAAI,CAKN"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Register a custom component's props schema (for parser validation) and its
3
+ * runtime handler in one call, keyed by the variant `name`
4
+ * (`handler.definition.type`).
5
+ */
6
+ export function registerCustomComponent(registration, targets) {
7
+ const { handler } = registration;
8
+ const name = handler.definition.type;
9
+ targets.attachables?.register(handler);
10
+ targets.customSchemas?.set(name, handler.definition.schema);
11
+ }
12
+ //# sourceMappingURL=register-custom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-custom.js","sourceRoot":"","sources":["../../src/attachable/register-custom.ts"],"names":[],"mappings":"AA4BA;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,YAAiD,EACjD,OAAkC;IAElC,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;IACjC,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;IACrC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,OAA4B,CAAC,CAAC;IAC5D,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAC9D,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { redactPayload, type RedactionContext } from './redaction/redactor.js';
7
7
  export { hashValue } from './redaction/hash.js';
8
8
  export { PolicyEngine, PolicyViolationError, createDefaultPolicy, type PolicyEvaluationResult, } from './policy/policy-engine.js';
9
9
  export { AttachableRegistry, type AttachableHandler, type AttachableContext, type ComponentState, } from './attachable/registry.js';
10
+ export { registerCustomComponent, type CustomComponentRegistration, type CustomRegistrationTargets, } from './attachable/register-custom.js';
10
11
  export { ChainedEventLog, type ChainedEventLogEntry, type IntegrityVerificationResult, } from './core/event-log-integrity.js';
11
12
  export type { RedactionStrategy } from './redaction/strategies/types.js';
12
13
  export { hashStrategy } from './redaction/strategies/hash-strategy.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACpG,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,sBAAsB,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,EACtB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AAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,EACvB,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,GAC/B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,GACjC,MAAM,+BAA+B,CAAC;AACvC,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,OAAO,GACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,qCAAqC,CAAC"}
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export { redactPayload } from './redaction/redactor.js';
7
7
  export { hashValue } from './redaction/hash.js';
8
8
  export { PolicyEngine, PolicyViolationError, createDefaultPolicy, } from './policy/policy-engine.js';
9
9
  export { AttachableRegistry, } from './attachable/registry.js';
10
+ export { registerCustomComponent, } from './attachable/register-custom.js';
10
11
  // Enterprise features
11
12
  export { ChainedEventLog, } from './core/event-log-integrity.js';
12
13
  export { hashStrategy } from './redaction/strategies/hash-strategy.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,GAIpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAyC,MAAM,qBAAqB,CAAC;AAC5F,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AoB,EACpB,mBAAmB,GAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,kBAAkB,GAInB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,GAGxB,MAAM,iCAAiC,CAAC;AAEzC,sBAAsB;AACtB,OAAO,EACL,eAAe,GAGhB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EACL,SAAS,EACT,oBAAoB,GAGrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,wBAAwB,GAGzB,MAAM,qCAAqC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mobile-reality/mdma-runtime",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "keywords": [
5
5
  "mdma",
6
6
  "markdown",
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@mobile-reality/mdma-spec": "0.3.1"
27
+ "@mobile-reality/mdma-spec": "0.4.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "typescript": "^5.7.0",