@ai-matrx/records 0.84.2 → 0.84.3

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.
@@ -502,8 +502,11 @@ declare function primeRecordPageBundle(input: {
502
502
  declare const PRIMED_DOOR_TTL_MS = 10000;
503
503
  /** Keep one door's answer (`key` = door name + canonical arguments, as `seedKey` builds it). */
504
504
  declare function primeDoorAnswer(key: string, data: unknown, at: number): void;
505
- /** A write happened: nothing primed is trusted any more. */
506
- declare function dropPrimedDoorAnswers(): void;
505
+ /**
506
+ * A write happened: nothing primed is trusted any more — or, with `doors`, only what those doors answered
507
+ * (a saved view changes the views and the layout, never a record's value or a count of records).
508
+ */
509
+ declare function dropPrimedDoorAnswers(doors?: readonly string[]): void;
507
510
 
508
511
  /**
509
512
  * The structural shape of the supabase client this adapter needs. Deliberately
@@ -502,8 +502,11 @@ declare function primeRecordPageBundle(input: {
502
502
  declare const PRIMED_DOOR_TTL_MS = 10000;
503
503
  /** Keep one door's answer (`key` = door name + canonical arguments, as `seedKey` builds it). */
504
504
  declare function primeDoorAnswer(key: string, data: unknown, at: number): void;
505
- /** A write happened: nothing primed is trusted any more. */
506
- declare function dropPrimedDoorAnswers(): void;
505
+ /**
506
+ * A write happened: nothing primed is trusted any more — or, with `doors`, only what those doors answered
507
+ * (a saved view changes the views and the layout, never a record's value or a count of records).
508
+ */
509
+ declare function dropPrimedDoorAnswers(doors?: readonly string[]): void;
507
510
 
508
511
  /**
509
512
  * The structural shape of the supabase client this adapter needs. Deliberately
@@ -4893,9 +4893,20 @@ function takePrimedDoorAnswer(key) {
4893
4893
  registry2.delete(key);
4894
4894
  return null;
4895
4895
  }
4896
- function dropPrimedDoorAnswers() {
4897
- doorRegistry().clear();
4896
+ function dropPrimedDoorAnswers(doors) {
4897
+ const registry2 = doorRegistry();
4898
+ if (!doors) {
4899
+ registry2.clear();
4900
+ return;
4901
+ }
4902
+ for (const key of [...registry2.keys()]) if (doors.some((door) => key.startsWith(`${door}|`))) registry2.delete(key);
4898
4903
  }
4904
+ var LOOK_WRITES = {
4905
+ view_declare: ["views", "view_look_read", "grid_layout", "table_page_bundle"],
4906
+ view_designate: ["views", "view_look_read", "grid_layout", "table_page_bundle"],
4907
+ view_look_set: ["views", "view_look_read", "grid_layout", "table_page_bundle"],
4908
+ view_record_order_set: ["views", "view_look_read", "grid_layout", "table_page_bundle"]
4909
+ };
4899
4910
  function isWritingDoor(door) {
4900
4911
  return /(_declare|_set(_|$)|_update|_write|_delete|_restore|_archive|_upsert|_reparent|_change|_duplicate|_move|_decide|_run$|_submit|_publish|_import_|_start$|_complete|_sign$|_add$|_retire|_propose|_promote|_land$|_pin$|_mute|_snooze|_unsnooze|_clear|_unclear|_revoke|_issue|_bind|_unbind|_apply|_backfill|_sync$|_decorate|_designate|_ensure|^migrate_|^home_add|^capture_|^claim_|^record_stage|^anon_|^io_import_|^io_comment_resolve|^enrich_(declare|land|pin)|^field_(declare|duplicate|propose|restore|retire|update)|^table_(declare|ensure|from_example|move|sync)|^value_restore|^relation_own)/.test(door);
4901
4912
  }
@@ -5971,6 +5982,11 @@ function createRecordsClient(given) {
5971
5982
  for (const key of [...bundleParts.keys()]) if (key.includes(tableId)) bundleParts.delete(key);
5972
5983
  }
5973
5984
  function primedFor(door, args) {
5985
+ const look = LOOK_WRITES[door];
5986
+ if (look) {
5987
+ dropPrimedDoorAnswers(look);
5988
+ return null;
5989
+ }
5974
5990
  if (isWritingDoor(door)) {
5975
5991
  dropPrimedDoorAnswers();
5976
5992
  return null;