@ai-matrx/records 0.86.2 → 0.87.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.
@@ -139,9 +139,9 @@ declare const f: {
139
139
  member: <const O extends FieldOptions = {}>(opts?: O) => AppField<string, Req<O>, false, Uniq<O>>;
140
140
  /** A file. */
141
141
  attachment: <const O extends FieldOptions = {}>(opts?: O) => AppField<string, Req<O>, false, Uniq<O>>;
142
- /** A platform thing (`note`, `agent` …) of one of `kinds`. */
142
+ /** A platform thing (`note`, `agent` …) of one of `kinds`: `{ token, id }`, the store's own shape. */
143
143
  entityReference: <const O extends FieldOptions = {}>(kinds: readonly string[], opts?: O) => AppField<{
144
- type: string;
144
+ token: string;
145
145
  id: Uuid;
146
146
  }, Req<O>, false, Uniq<O>>;
147
147
  /** Computed by the store from `formulaText` (`{Visit fee} - {Deposit taken}`); read-only. */
@@ -139,9 +139,9 @@ declare const f: {
139
139
  member: <const O extends FieldOptions = {}>(opts?: O) => AppField<string, Req<O>, false, Uniq<O>>;
140
140
  /** A file. */
141
141
  attachment: <const O extends FieldOptions = {}>(opts?: O) => AppField<string, Req<O>, false, Uniq<O>>;
142
- /** A platform thing (`note`, `agent` …) of one of `kinds`. */
142
+ /** A platform thing (`note`, `agent` …) of one of `kinds`: `{ token, id }`, the store's own shape. */
143
143
  entityReference: <const O extends FieldOptions = {}>(kinds: readonly string[], opts?: O) => AppField<{
144
- type: string;
144
+ token: string;
145
145
  id: Uuid;
146
146
  }, Req<O>, false, Uniq<O>>;
147
147
  /** Computed by the store from `formulaText` (`{Visit fee} - {Deposit taken}`); read-only. */
@@ -149,7 +149,7 @@ var f = {
149
149
  member: (opts) => field("member", opts),
150
150
  /** A file. */
151
151
  attachment: (opts) => field("attachment", opts),
152
- /** A platform thing (`note`, `agent` …) of one of `kinds`. */
152
+ /** A platform thing (`note`, `agent` …) of one of `kinds`: `{ token, id }`, the store's own shape. */
153
153
  entityReference: (kinds, opts) => field("entity_reference", opts, { allowedTypes: [...kinds] }),
154
154
  /** Computed by the store from `formulaText` (`{Visit fee} - {Deposit taken}`); read-only. */
155
155
  formula: (formulaText, opts) => field("formula", opts, { declaration: { formula_text: formulaText, ...opts?.declaration ?? {} } }, true),
@@ -429,7 +429,8 @@ function isWritingDoor(door) {
429
429
  }
430
430
 
431
431
  // src/core/recordChanges.ts
432
- var listeners = /* @__PURE__ */ new Set();
432
+ import { globalSlot } from "@ai-matrx/kit/global-slot";
433
+ var listeners = globalSlot("ai-matrx.records.record-change-listeners", () => /* @__PURE__ */ new Set());
433
434
  function announceRecordChanged(recordId) {
434
435
  for (const listener of [...listeners]) {
435
436
  try {
@@ -439,7 +440,7 @@ function announceRecordChanged(recordId) {
439
440
  }
440
441
  }
441
442
  }
442
- var removed = /* @__PURE__ */ new Set();
443
+ var removed = globalSlot("ai-matrx.records.removed-records", () => /* @__PURE__ */ new Set());
443
444
  function markRecordRemoved(recordId) {
444
445
  removed.add(recordId);
445
446
  }
@@ -450,7 +451,7 @@ function onRecordChanged(listener) {
450
451
  listeners.add(listener);
451
452
  return () => listeners.delete(listener);
452
453
  }
453
- var tableListeners = /* @__PURE__ */ new Set();
454
+ var tableListeners = globalSlot("ai-matrx.records.table-structure-listeners", () => /* @__PURE__ */ new Set());
454
455
  function announceTableStructureChanged(tableId) {
455
456
  for (const listener of [...tableListeners]) {
456
457
  try {
@@ -740,9 +741,10 @@ function sourceArchivedOf(value) {
740
741
  }
741
742
 
742
743
  // src/ops.ts
744
+ import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
743
745
  var REMEMBER_MS = 3e4;
744
746
  var REMEMBER_MAX = 500;
745
- var ours = /* @__PURE__ */ new Map();
747
+ var ours = globalSlot2("ai-matrx.records.op-ledger", () => /* @__PURE__ */ new Map());
746
748
  function trim(now) {
747
749
  for (const [id, at] of ours) {
748
750
  if (now - at <= REMEMBER_MS) break;