@ai-matrx/records 0.84.2 → 0.84.4
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.
- package/CHANGELOG.md +12 -0
- package/dist/app-table/index.cjs +32 -3
- package/dist/app-table/index.cjs.map +1 -1
- package/dist/app-table/index.js +32 -3
- package/dist/app-table/index.js.map +1 -1
- package/dist/core/index.cjs +32 -3
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +5 -2
- package/dist/core/index.d.ts +5 -2
- package/dist/core/index.js +32 -3
- package/dist/core/index.js.map +1 -1
- package/dist/data/index.cjs +32 -3
- package/dist/data/index.cjs.map +1 -1
- package/dist/data/index.js +32 -3
- package/dist/data/index.js.map +1 -1
- package/dist/react/index.cjs +32 -3
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +32 -3
- package/dist/react/index.js.map +1 -1
- package/package.json +3 -3
package/dist/core/index.d.cts
CHANGED
|
@@ -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
|
-
/**
|
|
506
|
-
|
|
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
|
package/dist/core/index.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
506
|
-
|
|
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
|
package/dist/core/index.js
CHANGED
|
@@ -4893,9 +4893,20 @@ function takePrimedDoorAnswer(key) {
|
|
|
4893
4893
|
registry2.delete(key);
|
|
4894
4894
|
return null;
|
|
4895
4895
|
}
|
|
4896
|
-
function dropPrimedDoorAnswers() {
|
|
4897
|
-
doorRegistry()
|
|
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,12 +5982,18 @@ 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;
|
|
5977
5993
|
}
|
|
5978
5994
|
return takePrimedDoorAnswer(`${door}|${canonicalArgs(args)}`);
|
|
5979
5995
|
}
|
|
5996
|
+
const readsInFlight = /* @__PURE__ */ new Map();
|
|
5980
5997
|
async function callDoor(door, args, where) {
|
|
5981
5998
|
const primed = primedFor(door, args);
|
|
5982
5999
|
if (primed) return ok(primed.data);
|
|
@@ -5987,7 +6004,19 @@ function createRecordsClient(given) {
|
|
|
5987
6004
|
scream({ code: refusal.code, message: refusal.message, ...refusal.hint ? { hint: refusal.hint } : {}, where });
|
|
5988
6005
|
return err(refusal);
|
|
5989
6006
|
}
|
|
5990
|
-
const
|
|
6007
|
+
const flightKey = isWritingDoor(door) ? null : `${door}|${canonicalArgs(args)}`;
|
|
6008
|
+
const flying = flightKey ? readsInFlight.get(flightKey) : void 0;
|
|
6009
|
+
const response = await (flying ?? (() => {
|
|
6010
|
+
const call = Promise.resolve(config.dataSource.rpc(`${door}`, args, { schema }));
|
|
6011
|
+
if (flightKey) {
|
|
6012
|
+
readsInFlight.set(flightKey, call);
|
|
6013
|
+
const forget = () => {
|
|
6014
|
+
if (readsInFlight.get(flightKey) === call) readsInFlight.delete(flightKey);
|
|
6015
|
+
};
|
|
6016
|
+
call.then(forget, forget);
|
|
6017
|
+
}
|
|
6018
|
+
return call;
|
|
6019
|
+
})());
|
|
5991
6020
|
if (response.error) {
|
|
5992
6021
|
const refusal = mapPgError(response.error, where);
|
|
5993
6022
|
scream({ code: refusal.code, message: refusal.message, ...refusal.hint ? { hint: refusal.hint } : {}, where });
|