@ai-matrx/associations 0.5.2 → 0.6.1

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 },
@@ -119,6 +137,7 @@ var ENTITY_TYPE_METADATA = {
119
137
  "commerce_marketplace_site": { token: "commerce_marketplace_site", schema: "commerce", table: "marketplace_site", label: "Marketplace Site", baseTier: 1, isComponent: true, isModule: false, isListed: false, scopeable: true, category: null, referencePickable: false, titleColumn: null, contentRole: null, referenceCategory: null },
120
138
  "commerce_marketplace_sync_run": { token: "commerce_marketplace_sync_run", schema: "commerce", table: "marketplace_sync_run", label: "Marketplace Sync Run", baseTier: 1, isComponent: true, isModule: false, isListed: false, scopeable: true, category: null, referencePickable: false, titleColumn: null, contentRole: null, referenceCategory: null },
121
139
  "commerce_prediction_outcome": { token: "commerce_prediction_outcome", schema: "commerce", table: "prediction_outcome", label: "Prediction Outcome", baseTier: 1, isComponent: true, isModule: false, isListed: false, scopeable: true, category: null, referencePickable: false, titleColumn: null, contentRole: null, referenceCategory: null },
140
+ "commerce_print_order": { token: "commerce_print_order", schema: "commerce", table: "print_order", label: "Print Order", baseTier: 1, isComponent: false, isModule: false, isListed: true, scopeable: true, category: null, referencePickable: false, titleColumn: null, contentRole: null, referenceCategory: null },
122
141
  "commerce_product": { token: "commerce_product", schema: "commerce", table: "product", label: "Product", baseTier: 1, isComponent: false, isModule: false, isListed: true, scopeable: true, category: null, referencePickable: false, titleColumn: null, contentRole: null, referenceCategory: null },
123
142
  "commerce_product_channel_ref": { token: "commerce_product_channel_ref", schema: "commerce", table: "product_channel_ref", label: "Product Channel Reference", baseTier: 1, isComponent: true, isModule: false, isListed: false, scopeable: true, category: null, referencePickable: false, titleColumn: null, contentRole: null, referenceCategory: null },
124
143
  "commerce_product_media": { token: "commerce_product_media", schema: "commerce", table: "product_media", label: "Product Media", baseTier: 1, isComponent: true, isModule: false, isListed: false, scopeable: true, category: null, referencePickable: false, titleColumn: null, contentRole: null, referenceCategory: null },
@@ -776,6 +795,7 @@ var ENTITY_TYPE_TOKENS = [
776
795
  "commerce_marketplace_site",
777
796
  "commerce_marketplace_sync_run",
778
797
  "commerce_prediction_outcome",
798
+ "commerce_print_order",
779
799
  "commerce_product",
780
800
  "commerce_product_channel_ref",
781
801
  "commerce_product_media",
@@ -2812,12 +2832,7 @@ function createAssociationsStore(config) {
2812
2832
  "@ai-matrx/associations: the REQUIRED identity port is missing (need requireUserId(): string that THROWS when unauthenticated). Identity never comes from a store import."
2813
2833
  );
2814
2834
  }
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;
2835
+ const errorSink = typeof config.errorSink === "function" ? config.errorSink : createDefaultErrorSink();
2821
2836
  const registry = createEntityRegistry(errorSink, config.entityOverlay);
2822
2837
  const deps = {
2823
2838
  dataSource: config.dataSource,
@@ -3203,6 +3218,7 @@ function createAssociationsStore(config) {
3203
3218
  services: { associations, categories, comments },
3204
3219
  registerEntityOverlay: registry.registerEntityOverlay,
3205
3220
  errorSink,
3221
+ dataSource: config.dataSource,
3206
3222
  identity: config.identity
3207
3223
  };
3208
3224
  }
@@ -3465,6 +3481,7 @@ export {
3465
3481
  createCandidatesService,
3466
3482
  createCategoriesService,
3467
3483
  createCommentsService,
3484
+ createDefaultErrorSink,
3468
3485
  createEntityRegistry,
3469
3486
  createEntityRowsService,
3470
3487
  createFavoritesService,