@ai-matrx/records 0.84.3 → 0.84.5
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 +14 -0
- package/dist/app-table/index.cjs +29 -3
- package/dist/app-table/index.cjs.map +1 -1
- package/dist/app-table/index.js +29 -3
- package/dist/app-table/index.js.map +1 -1
- package/dist/core/index.cjs +37 -5
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +7 -1
- package/dist/core/index.d.ts +7 -1
- package/dist/core/index.js +37 -5
- package/dist/core/index.js.map +1 -1
- package/dist/data/index.cjs +29 -3
- package/dist/data/index.cjs.map +1 -1
- package/dist/data/index.js +29 -3
- package/dist/data/index.js.map +1 -1
- package/dist/react/index.cjs +34 -5
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +34 -5
- package/dist/react/index.js.map +1 -1
- package/package.json +3 -3
package/dist/data/index.js
CHANGED
|
@@ -239,6 +239,13 @@ function announceRecordChanged(recordId) {
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
+
var removed = /* @__PURE__ */ new Set();
|
|
243
|
+
function markRecordRemoved(recordId) {
|
|
244
|
+
removed.add(recordId);
|
|
245
|
+
}
|
|
246
|
+
function markRecordRestored(recordId) {
|
|
247
|
+
removed.delete(recordId);
|
|
248
|
+
}
|
|
242
249
|
function onRecordChanged(listener) {
|
|
243
250
|
listeners.add(listener);
|
|
244
251
|
return () => listeners.delete(listener);
|
|
@@ -2735,6 +2742,7 @@ function createRecordsClient(given) {
|
|
|
2735
2742
|
}
|
|
2736
2743
|
return takePrimedDoorAnswer(`${door}|${canonicalArgs(args)}`);
|
|
2737
2744
|
}
|
|
2745
|
+
const readsInFlight = /* @__PURE__ */ new Map();
|
|
2738
2746
|
async function callDoor(door, args, where) {
|
|
2739
2747
|
const primed = primedFor(door, args);
|
|
2740
2748
|
if (primed) return ok(primed.data);
|
|
@@ -2745,7 +2753,19 @@ function createRecordsClient(given) {
|
|
|
2745
2753
|
scream({ code: refusal2.code, message: refusal2.message, ...refusal2.hint ? { hint: refusal2.hint } : {}, where });
|
|
2746
2754
|
return err(refusal2);
|
|
2747
2755
|
}
|
|
2748
|
-
const
|
|
2756
|
+
const flightKey = isWritingDoor(door) ? null : `${door}|${canonicalArgs(args)}`;
|
|
2757
|
+
const flying = flightKey ? readsInFlight.get(flightKey) : void 0;
|
|
2758
|
+
const response = await (flying ?? (() => {
|
|
2759
|
+
const call = Promise.resolve(config.dataSource.rpc(`${door}`, args, { schema }));
|
|
2760
|
+
if (flightKey) {
|
|
2761
|
+
readsInFlight.set(flightKey, call);
|
|
2762
|
+
const forget = () => {
|
|
2763
|
+
if (readsInFlight.get(flightKey) === call) readsInFlight.delete(flightKey);
|
|
2764
|
+
};
|
|
2765
|
+
call.then(forget, forget);
|
|
2766
|
+
}
|
|
2767
|
+
return call;
|
|
2768
|
+
})());
|
|
2749
2769
|
if (response.error) {
|
|
2750
2770
|
const refusal2 = mapPgError(response.error, where);
|
|
2751
2771
|
scream({ code: refusal2.code, message: refusal2.message, ...refusal2.hint ? { hint: refusal2.hint } : {}, where });
|
|
@@ -3055,7 +3075,10 @@ function createRecordsClient(given) {
|
|
|
3055
3075
|
{ p_organization_id: org, p_record_id: record_id },
|
|
3056
3076
|
"recordDelete"
|
|
3057
3077
|
);
|
|
3058
|
-
if (result.ok)
|
|
3078
|
+
if (result.ok) {
|
|
3079
|
+
markRecordRemoved(record_id);
|
|
3080
|
+
announceRecordChanged(record_id);
|
|
3081
|
+
}
|
|
3059
3082
|
return result;
|
|
3060
3083
|
},
|
|
3061
3084
|
async recordRestore({ record_id }) {
|
|
@@ -3064,7 +3087,10 @@ function createRecordsClient(given) {
|
|
|
3064
3087
|
{ p_organization_id: org, p_record_id: record_id },
|
|
3065
3088
|
"recordRestore"
|
|
3066
3089
|
);
|
|
3067
|
-
if (result.ok)
|
|
3090
|
+
if (result.ok) {
|
|
3091
|
+
markRecordRestored(record_id);
|
|
3092
|
+
announceRecordChanged(record_id);
|
|
3093
|
+
}
|
|
3068
3094
|
return result;
|
|
3069
3095
|
},
|
|
3070
3096
|
async tableArchive({ table_id, chunk, includeTable }) {
|