@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.
@@ -34,6 +34,7 @@ __export(core_exports, {
34
34
  createCandidatesService: () => createCandidatesService,
35
35
  createCategoriesService: () => createCategoriesService,
36
36
  createCommentsService: () => createCommentsService,
37
+ createDefaultErrorSink: () => createDefaultErrorSink,
37
38
  createEntityRegistry: () => createEntityRegistry,
38
39
  createEntityRowsService: () => createEntityRowsService,
39
40
  createFavoritesService: () => createFavoritesService,
@@ -57,6 +58,24 @@ function isAssociationsRpcErr(r) {
57
58
  return r.ok === false;
58
59
  }
59
60
 
61
+ // src/core/defaultErrorSink.ts
62
+ var REMEDY = "Bind the `errorSink` port on createAssociationsStore({ errorSink }) to route these into your diagnostics surface; until then they only reach the console.";
63
+ function createDefaultErrorSink() {
64
+ let announced = false;
65
+ return (event) => {
66
+ if (!announced) {
67
+ announced = true;
68
+ console.error(
69
+ "[associations] no errorSink port bound \u2014 using the package default. " + REMEDY
70
+ );
71
+ }
72
+ console.error(
73
+ `[associations] ${event.code}: ${event.message}`,
74
+ event.context ?? {}
75
+ );
76
+ };
77
+ }
78
+
60
79
  // src/entity-types.generated.ts
61
80
  var ENTITY_TYPE_METADATA = {
62
81
  "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 },
@@ -2866,12 +2885,7 @@ function createAssociationsStore(config) {
2866
2885
  "@ai-matrx/associations: the REQUIRED identity port is missing (need requireUserId(): string that THROWS when unauthenticated). Identity never comes from a store import."
2867
2886
  );
2868
2887
  }
2869
- if (typeof config.errorSink !== "function") {
2870
- throw new Error(
2871
- "@ai-matrx/associations: the REQUIRED errorSink port is missing. Recovery layers must scream somewhere \u2014 bind a sink."
2872
- );
2873
- }
2874
- const errorSink = config.errorSink;
2888
+ const errorSink = typeof config.errorSink === "function" ? config.errorSink : createDefaultErrorSink();
2875
2889
  const registry = createEntityRegistry(errorSink, config.entityOverlay);
2876
2890
  const deps = {
2877
2891
  dataSource: config.dataSource,
@@ -3257,6 +3271,7 @@ function createAssociationsStore(config) {
3257
3271
  services: { associations, categories, comments },
3258
3272
  registerEntityOverlay: registry.registerEntityOverlay,
3259
3273
  errorSink,
3274
+ dataSource: config.dataSource,
3260
3275
  identity: config.identity
3261
3276
  };
3262
3277
  }