@ai-matrx/associations 0.5.2 → 0.6.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.
@@ -658,7 +658,13 @@ interface AssociationsStore {
658
658
  * recoveries here (the originals' console.error sites) without a second
659
659
  * sink binding. Same function the host passed at construction.
660
660
  */
661
- errorSink: AssociationsConfig["errorSink"];
661
+ errorSink: ErrorSink;
662
+ /**
663
+ * The bound data seam (0.6.0, additive): the provider's demanded-schema
664
+ * boot probe reads it so hosts stop re-exporting their dataSource just to
665
+ * run a check the package owns.
666
+ */
667
+ dataSource: AssociationsDataSource;
662
668
  /**
663
669
  * The bound identity port (W3, additive): /react hooks that FILTER by the
664
670
  * current user (candidate owner scoping) read it leniently; write paths
@@ -668,9 +674,10 @@ interface AssociationsStore {
668
674
  identity: AssociationsConfig["identity"];
669
675
  }
670
676
  /**
671
- * Build the one store a host binds. REQUIRED ports (dataSource / identity /
672
- * errorSink) throw at construction when absent — never degraded. Every
673
- * optional port degrades per its documented contract.
677
+ * Build the one store a host binds. The REQUIRED ports (dataSource /
678
+ * identity — true app identity, C23) throw at construction when absent.
679
+ * Every other port has a SHIPPED DEFAULT (errorSink since 0.6.0) or a
680
+ * documented degradation; nothing is ever silently missing.
674
681
  */
675
682
  declare function createAssociationsStore(config: AssociationsConfig): AssociationsStore;
676
683
 
@@ -740,4 +747,10 @@ interface CategoryHierarchy {
740
747
  */
741
748
  declare function buildCategoryHierarchy(categories: PlatformCategory[]): CategoryHierarchy;
742
749
 
743
- export { type AddAssociationArgs, type AddCommentArgs, type AssertDemandedSchemaOptions, type AssociationGuards, type AssociationHelpersApi, type AssociationWriteResult, type AssociationsServiceApi, type AssociationsStore, type CandidateRecord, type CandidatesResult, type CandidatesServiceApi, type CategoriesServiceApi, type CategoryHierarchy, type CategoryHierarchyItem, type CategoryMutationResult, type CommentMutationResult, type CommentsServiceApi, type ContainerRef, type ContentRole, type ConversationFileLink, type CoreDeps, type CreateEntityRowArgs, DEFAULT_ORG_COLUMN, DEFAULT_OWNER_COLUMN, type DemandedSchemaReport, type EdgeAttrs, type EdgeSpec, type EntityInfo, type EntityRef, type EntityRegistry, type EntityRowResult, type EntityRowsServiceApi, type FavoritesServiceApi, type ListCandidatesArgs, NON_CONTENT_SOURCE_TYPES, type PgErrorMapper, type RpcResultHelpers, SELF_TEST_MISSING_RPC, type SearchAcrossTokensArgs, type TitlesServiceApi, type UniversalCandidate, assertDemandedSchema, associationsKey, buildCategoryHierarchy, createAssociationGuards, createAssociationHelpers, createAssociationsService, createAssociationsStore, createCandidatesService, createCategoriesService, createCommentsService, createEntityRegistry, createEntityRowsService, createFavoritesService, createRpcResultHelpers, createTitlesService, entityTitleCacheKey, err, firstError, isContentRole, isContentSourceEdge, isMembershipMetadata, isTransportFailure, isUuid, ok, resolveEntityToken };
750
+ /**
751
+ * Build the default sink. `announce` is called once, on the first event, so
752
+ * the absence of a bound sink is itself loud (never a silent substitution).
753
+ */
754
+ declare function createDefaultErrorSink(): ErrorSink;
755
+
756
+ export { type AddAssociationArgs, type AddCommentArgs, type AssertDemandedSchemaOptions, type AssociationGuards, type AssociationHelpersApi, type AssociationWriteResult, type AssociationsServiceApi, type AssociationsStore, type CandidateRecord, type CandidatesResult, type CandidatesServiceApi, type CategoriesServiceApi, type CategoryHierarchy, type CategoryHierarchyItem, type CategoryMutationResult, type CommentMutationResult, type CommentsServiceApi, type ContainerRef, type ContentRole, type ConversationFileLink, type CoreDeps, type CreateEntityRowArgs, DEFAULT_ORG_COLUMN, DEFAULT_OWNER_COLUMN, type DemandedSchemaReport, type EdgeAttrs, type EdgeSpec, type EntityInfo, type EntityRef, type EntityRegistry, type EntityRowResult, type EntityRowsServiceApi, type FavoritesServiceApi, type ListCandidatesArgs, NON_CONTENT_SOURCE_TYPES, type PgErrorMapper, type RpcResultHelpers, SELF_TEST_MISSING_RPC, type SearchAcrossTokensArgs, type TitlesServiceApi, type UniversalCandidate, assertDemandedSchema, associationsKey, buildCategoryHierarchy, createAssociationGuards, createAssociationHelpers, createAssociationsService, createAssociationsStore, createCandidatesService, createCategoriesService, createCommentsService, createDefaultErrorSink, createEntityRegistry, createEntityRowsService, createFavoritesService, createRpcResultHelpers, createTitlesService, entityTitleCacheKey, err, firstError, isContentRole, isContentSourceEdge, isMembershipMetadata, isTransportFailure, isUuid, ok, resolveEntityToken };
@@ -658,7 +658,13 @@ interface AssociationsStore {
658
658
  * recoveries here (the originals' console.error sites) without a second
659
659
  * sink binding. Same function the host passed at construction.
660
660
  */
661
- errorSink: AssociationsConfig["errorSink"];
661
+ errorSink: ErrorSink;
662
+ /**
663
+ * The bound data seam (0.6.0, additive): the provider's demanded-schema
664
+ * boot probe reads it so hosts stop re-exporting their dataSource just to
665
+ * run a check the package owns.
666
+ */
667
+ dataSource: AssociationsDataSource;
662
668
  /**
663
669
  * The bound identity port (W3, additive): /react hooks that FILTER by the
664
670
  * current user (candidate owner scoping) read it leniently; write paths
@@ -668,9 +674,10 @@ interface AssociationsStore {
668
674
  identity: AssociationsConfig["identity"];
669
675
  }
670
676
  /**
671
- * Build the one store a host binds. REQUIRED ports (dataSource / identity /
672
- * errorSink) throw at construction when absent — never degraded. Every
673
- * optional port degrades per its documented contract.
677
+ * Build the one store a host binds. The REQUIRED ports (dataSource /
678
+ * identity — true app identity, C23) throw at construction when absent.
679
+ * Every other port has a SHIPPED DEFAULT (errorSink since 0.6.0) or a
680
+ * documented degradation; nothing is ever silently missing.
674
681
  */
675
682
  declare function createAssociationsStore(config: AssociationsConfig): AssociationsStore;
676
683
 
@@ -740,4 +747,10 @@ interface CategoryHierarchy {
740
747
  */
741
748
  declare function buildCategoryHierarchy(categories: PlatformCategory[]): CategoryHierarchy;
742
749
 
743
- export { type AddAssociationArgs, type AddCommentArgs, type AssertDemandedSchemaOptions, type AssociationGuards, type AssociationHelpersApi, type AssociationWriteResult, type AssociationsServiceApi, type AssociationsStore, type CandidateRecord, type CandidatesResult, type CandidatesServiceApi, type CategoriesServiceApi, type CategoryHierarchy, type CategoryHierarchyItem, type CategoryMutationResult, type CommentMutationResult, type CommentsServiceApi, type ContainerRef, type ContentRole, type ConversationFileLink, type CoreDeps, type CreateEntityRowArgs, DEFAULT_ORG_COLUMN, DEFAULT_OWNER_COLUMN, type DemandedSchemaReport, type EdgeAttrs, type EdgeSpec, type EntityInfo, type EntityRef, type EntityRegistry, type EntityRowResult, type EntityRowsServiceApi, type FavoritesServiceApi, type ListCandidatesArgs, NON_CONTENT_SOURCE_TYPES, type PgErrorMapper, type RpcResultHelpers, SELF_TEST_MISSING_RPC, type SearchAcrossTokensArgs, type TitlesServiceApi, type UniversalCandidate, assertDemandedSchema, associationsKey, buildCategoryHierarchy, createAssociationGuards, createAssociationHelpers, createAssociationsService, createAssociationsStore, createCandidatesService, createCategoriesService, createCommentsService, createEntityRegistry, createEntityRowsService, createFavoritesService, createRpcResultHelpers, createTitlesService, entityTitleCacheKey, err, firstError, isContentRole, isContentSourceEdge, isMembershipMetadata, isTransportFailure, isUuid, ok, resolveEntityToken };
750
+ /**
751
+ * Build the default sink. `announce` is called once, on the first event, so
752
+ * the absence of a bound sink is itself loud (never a silent substitution).
753
+ */
754
+ declare function createDefaultErrorSink(): ErrorSink;
755
+
756
+ export { type AddAssociationArgs, type AddCommentArgs, type AssertDemandedSchemaOptions, type AssociationGuards, type AssociationHelpersApi, type AssociationWriteResult, type AssociationsServiceApi, type AssociationsStore, type CandidateRecord, type CandidatesResult, type CandidatesServiceApi, type CategoriesServiceApi, type CategoryHierarchy, type CategoryHierarchyItem, type CategoryMutationResult, type CommentMutationResult, type CommentsServiceApi, type ContainerRef, type ContentRole, type ConversationFileLink, type CoreDeps, type CreateEntityRowArgs, DEFAULT_ORG_COLUMN, DEFAULT_OWNER_COLUMN, type DemandedSchemaReport, type EdgeAttrs, type EdgeSpec, type EntityInfo, type EntityRef, type EntityRegistry, type EntityRowResult, type EntityRowsServiceApi, type FavoritesServiceApi, type ListCandidatesArgs, NON_CONTENT_SOURCE_TYPES, type PgErrorMapper, type RpcResultHelpers, SELF_TEST_MISSING_RPC, type SearchAcrossTokensArgs, type TitlesServiceApi, type UniversalCandidate, assertDemandedSchema, associationsKey, buildCategoryHierarchy, createAssociationGuards, createAssociationHelpers, createAssociationsService, createAssociationsStore, createCandidatesService, createCategoriesService, createCommentsService, createDefaultErrorSink, createEntityRegistry, createEntityRowsService, createFavoritesService, createRpcResultHelpers, createTitlesService, entityTitleCacheKey, err, firstError, isContentRole, isContentSourceEdge, isMembershipMetadata, isTransportFailure, isUuid, ok, resolveEntityToken };
@@ -3,6 +3,24 @@ function isAssociationsRpcErr(r) {
3
3
  return r.ok === false;
4
4
  }
5
5
 
6
+ // src/core/defaultErrorSink.ts
7
+ var REMEDY = "Bind the `errorSink` port on createAssociationsStore({ errorSink }) to route these into your diagnostics surface; until then they only reach the console.";
8
+ function createDefaultErrorSink() {
9
+ let announced = false;
10
+ return (event) => {
11
+ if (!announced) {
12
+ announced = true;
13
+ console.error(
14
+ "[associations] no errorSink port bound \u2014 using the package default. " + REMEDY
15
+ );
16
+ }
17
+ console.error(
18
+ `[associations] ${event.code}: ${event.message}`,
19
+ event.context ?? {}
20
+ );
21
+ };
22
+ }
23
+
6
24
  // src/entity-types.generated.ts
7
25
  var ENTITY_TYPE_METADATA = {
8
26
  "access_request": { token: "access_request", schema: "iam", table: "access_requests", label: "Access Request", baseTier: 1, isComponent: false, isModule: false, isListed: false, scopeable: true, category: "System", referencePickable: false, titleColumn: null, contentRole: "utility", referenceCategory: null },
@@ -2812,12 +2830,7 @@ function createAssociationsStore(config) {
2812
2830
  "@ai-matrx/associations: the REQUIRED identity port is missing (need requireUserId(): string that THROWS when unauthenticated). Identity never comes from a store import."
2813
2831
  );
2814
2832
  }
2815
- if (typeof config.errorSink !== "function") {
2816
- throw new Error(
2817
- "@ai-matrx/associations: the REQUIRED errorSink port is missing. Recovery layers must scream somewhere \u2014 bind a sink."
2818
- );
2819
- }
2820
- const errorSink = config.errorSink;
2833
+ const errorSink = typeof config.errorSink === "function" ? config.errorSink : createDefaultErrorSink();
2821
2834
  const registry = createEntityRegistry(errorSink, config.entityOverlay);
2822
2835
  const deps = {
2823
2836
  dataSource: config.dataSource,
@@ -3203,6 +3216,7 @@ function createAssociationsStore(config) {
3203
3216
  services: { associations, categories, comments },
3204
3217
  registerEntityOverlay: registry.registerEntityOverlay,
3205
3218
  errorSink,
3219
+ dataSource: config.dataSource,
3206
3220
  identity: config.identity
3207
3221
  };
3208
3222
  }
@@ -3465,6 +3479,7 @@ export {
3465
3479
  createCandidatesService,
3466
3480
  createCategoriesService,
3467
3481
  createCommentsService,
3482
+ createDefaultErrorSink,
3468
3483
  createEntityRegistry,
3469
3484
  createEntityRowsService,
3470
3485
  createFavoritesService,