@ai-matrx/records 0.84.1 → 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.
- package/CHANGELOG.md +12 -0
- package/dist/app-table/index.cjs +49 -0
- package/dist/app-table/index.cjs.map +1 -1
- package/dist/app-table/index.js +49 -0
- package/dist/app-table/index.js.map +1 -1
- package/dist/core/index.cjs +55 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +10 -1
- package/dist/core/index.d.ts +10 -1
- package/dist/core/index.js +55 -0
- package/dist/core/index.js.map +1 -1
- package/dist/data/index.cjs +49 -0
- package/dist/data/index.cjs.map +1 -1
- package/dist/data/index.js +49 -0
- package/dist/data/index.js.map +1 -1
- package/dist/react/index.cjs +58 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +17 -1
- package/dist/react/index.d.ts +17 -1
- package/dist/react/index.js +58 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.d.cts
CHANGED
|
@@ -498,6 +498,15 @@ declare function primeRecordPageBundle(input: {
|
|
|
498
498
|
recordId: string;
|
|
499
499
|
answer: Promise<PrimedBundleAnswer> | PrimedBundleAnswer;
|
|
500
500
|
}): void;
|
|
501
|
+
/** How long a primed door answer stays servable, counted from when the server asked. */
|
|
502
|
+
declare const PRIMED_DOOR_TTL_MS = 10000;
|
|
503
|
+
/** Keep one door's answer (`key` = door name + canonical arguments, as `seedKey` builds it). */
|
|
504
|
+
declare function primeDoorAnswer(key: string, data: unknown, at: number): 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;
|
|
501
510
|
|
|
502
511
|
/**
|
|
503
512
|
* The structural shape of the supabase client this adapter needs. Deliberately
|
|
@@ -713,4 +722,4 @@ declare function seededDataSource(index: Map<string, unknown>): {
|
|
|
713
722
|
missed: () => boolean;
|
|
714
723
|
};
|
|
715
724
|
|
|
716
|
-
export { type BlockOutcome, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_VALUE_MAX_BYTES, DOORS, type DoorKey, type ExportRow, Field, LANDING_SOURCE_TYPE, LANDING_TARGET_TYPES, type Landing, type LandingBlock, type LandingOutcomes, type LandingState, type LandingStore, MAPPED_SQLSTATES, type MirrorLimits, OUTPUT_KEPT_KEY, PRODUCED_BY_LABEL, type ParsedImport, PgError, PredictedRefusal, type PrimedBundleAnswer, type ReadFileText, ReadValue, RecordDocument, RecordsDataSource, RecordsError, RecordsResult, type RecordsSeed, type RecordsSeedAnswer, StaleWriteDetail, type SupabaseLike, TableKindFacts, Uuid, WHOLE_VALUE_SOURCE_KIND, type WholeValuePointer, announceRecordChanged, announceTableStructureChanged, asRecordsDataSource, blockLandedInStore, cellText, doorAbsent, doorCensus, doorExists, doorReady, exportCellText, exportCsv, exportXlsx, forgetPrimedTablePageBundles, importCsv, importXlsx, landingOutcomesFor, mapPgError, onRecordChanged, onTableStructureChanged, outcomeForBlock, outputIsKept, parseCsv, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, primeRecordPageBundle, primeTablePageBundle, recordingDataSource, seedIndex, seedKey, seededDataSource, staleWriteDetail, supabaseDataSource, tableKindFacts, takePrimedTablePageBundle, toAoa, valuesAreUnconfirmed, wholeValueNotRead, wholeValueOf, wholeValueOfRead, wholeValueSize, withWholeValues };
|
|
725
|
+
export { type BlockOutcome, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_VALUE_MAX_BYTES, DOORS, type DoorKey, type ExportRow, Field, LANDING_SOURCE_TYPE, LANDING_TARGET_TYPES, type Landing, type LandingBlock, type LandingOutcomes, type LandingState, type LandingStore, MAPPED_SQLSTATES, type MirrorLimits, OUTPUT_KEPT_KEY, PRIMED_DOOR_TTL_MS, PRODUCED_BY_LABEL, type ParsedImport, PgError, PredictedRefusal, type PrimedBundleAnswer, type ReadFileText, ReadValue, RecordDocument, RecordsDataSource, RecordsError, RecordsResult, type RecordsSeed, type RecordsSeedAnswer, StaleWriteDetail, type SupabaseLike, TableKindFacts, Uuid, WHOLE_VALUE_SOURCE_KIND, type WholeValuePointer, announceRecordChanged, announceTableStructureChanged, asRecordsDataSource, blockLandedInStore, cellText, doorAbsent, doorCensus, doorExists, doorReady, dropPrimedDoorAnswers, exportCellText, exportCsv, exportXlsx, forgetPrimedTablePageBundles, importCsv, importXlsx, landingOutcomesFor, mapPgError, onRecordChanged, onTableStructureChanged, outcomeForBlock, outputIsKept, parseCsv, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, primeDoorAnswer, primeRecordPageBundle, primeTablePageBundle, recordingDataSource, seedIndex, seedKey, seededDataSource, staleWriteDetail, supabaseDataSource, tableKindFacts, takePrimedTablePageBundle, toAoa, valuesAreUnconfirmed, wholeValueNotRead, wholeValueOf, wholeValueOfRead, wholeValueSize, withWholeValues };
|
package/dist/core/index.d.ts
CHANGED
|
@@ -498,6 +498,15 @@ declare function primeRecordPageBundle(input: {
|
|
|
498
498
|
recordId: string;
|
|
499
499
|
answer: Promise<PrimedBundleAnswer> | PrimedBundleAnswer;
|
|
500
500
|
}): void;
|
|
501
|
+
/** How long a primed door answer stays servable, counted from when the server asked. */
|
|
502
|
+
declare const PRIMED_DOOR_TTL_MS = 10000;
|
|
503
|
+
/** Keep one door's answer (`key` = door name + canonical arguments, as `seedKey` builds it). */
|
|
504
|
+
declare function primeDoorAnswer(key: string, data: unknown, at: number): 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;
|
|
501
510
|
|
|
502
511
|
/**
|
|
503
512
|
* The structural shape of the supabase client this adapter needs. Deliberately
|
|
@@ -713,4 +722,4 @@ declare function seededDataSource(index: Map<string, unknown>): {
|
|
|
713
722
|
missed: () => boolean;
|
|
714
723
|
};
|
|
715
724
|
|
|
716
|
-
export { type BlockOutcome, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_VALUE_MAX_BYTES, DOORS, type DoorKey, type ExportRow, Field, LANDING_SOURCE_TYPE, LANDING_TARGET_TYPES, type Landing, type LandingBlock, type LandingOutcomes, type LandingState, type LandingStore, MAPPED_SQLSTATES, type MirrorLimits, OUTPUT_KEPT_KEY, PRODUCED_BY_LABEL, type ParsedImport, PgError, PredictedRefusal, type PrimedBundleAnswer, type ReadFileText, ReadValue, RecordDocument, RecordsDataSource, RecordsError, RecordsResult, type RecordsSeed, type RecordsSeedAnswer, StaleWriteDetail, type SupabaseLike, TableKindFacts, Uuid, WHOLE_VALUE_SOURCE_KIND, type WholeValuePointer, announceRecordChanged, announceTableStructureChanged, asRecordsDataSource, blockLandedInStore, cellText, doorAbsent, doorCensus, doorExists, doorReady, exportCellText, exportCsv, exportXlsx, forgetPrimedTablePageBundles, importCsv, importXlsx, landingOutcomesFor, mapPgError, onRecordChanged, onTableStructureChanged, outcomeForBlock, outputIsKept, parseCsv, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, primeRecordPageBundle, primeTablePageBundle, recordingDataSource, seedIndex, seedKey, seededDataSource, staleWriteDetail, supabaseDataSource, tableKindFacts, takePrimedTablePageBundle, toAoa, valuesAreUnconfirmed, wholeValueNotRead, wholeValueOf, wholeValueOfRead, wholeValueSize, withWholeValues };
|
|
725
|
+
export { type BlockOutcome, DEFAULT_DOCUMENT_MAX_BYTES, DEFAULT_VALUE_MAX_BYTES, DOORS, type DoorKey, type ExportRow, Field, LANDING_SOURCE_TYPE, LANDING_TARGET_TYPES, type Landing, type LandingBlock, type LandingOutcomes, type LandingState, type LandingStore, MAPPED_SQLSTATES, type MirrorLimits, OUTPUT_KEPT_KEY, PRIMED_DOOR_TTL_MS, PRODUCED_BY_LABEL, type ParsedImport, PgError, PredictedRefusal, type PrimedBundleAnswer, type ReadFileText, ReadValue, RecordDocument, RecordsDataSource, RecordsError, RecordsResult, type RecordsSeed, type RecordsSeedAnswer, StaleWriteDetail, type SupabaseLike, TableKindFacts, Uuid, WHOLE_VALUE_SOURCE_KIND, type WholeValuePointer, announceRecordChanged, announceTableStructureChanged, asRecordsDataSource, blockLandedInStore, cellText, doorAbsent, doorCensus, doorExists, doorReady, dropPrimedDoorAnswers, exportCellText, exportCsv, exportXlsx, forgetPrimedTablePageBundles, importCsv, importXlsx, landingOutcomesFor, mapPgError, onRecordChanged, onTableStructureChanged, outcomeForBlock, outputIsKept, parseCsv, predictEnvelopeRefusal, predictSizeRefusal, predictValueRefusals, predictWriteRefusals, primeDoorAnswer, primeRecordPageBundle, primeTablePageBundle, recordingDataSource, seedIndex, seedKey, seededDataSource, staleWriteDetail, supabaseDataSource, tableKindFacts, takePrimedTablePageBundle, toAoa, valuesAreUnconfirmed, wholeValueNotRead, wholeValueOf, wholeValueOfRead, wholeValueSize, withWholeValues };
|
package/dist/core/index.js
CHANGED
|
@@ -4876,6 +4876,40 @@ function forgetPrimedTablePageBundles() {
|
|
|
4876
4876
|
function primeRecordPageBundle(input) {
|
|
4877
4877
|
primeTablePageBundle({ organizationId: input.organizationId, tableId: `record:${input.recordId}`, answer: input.answer });
|
|
4878
4878
|
}
|
|
4879
|
+
var DOOR_REGISTRY = /* @__PURE__ */ Symbol.for("@ai-matrx/records/primed-door-answers");
|
|
4880
|
+
function doorRegistry() {
|
|
4881
|
+
const g = globalThis;
|
|
4882
|
+
return g[DOOR_REGISTRY] ??= /* @__PURE__ */ new Map();
|
|
4883
|
+
}
|
|
4884
|
+
var PRIMED_DOOR_TTL_MS = 1e4;
|
|
4885
|
+
function primeDoorAnswer(key, data, at) {
|
|
4886
|
+
doorRegistry().set(key, { data, at });
|
|
4887
|
+
}
|
|
4888
|
+
function takePrimedDoorAnswer(key) {
|
|
4889
|
+
const registry2 = doorRegistry();
|
|
4890
|
+
const held = registry2.get(key);
|
|
4891
|
+
if (!held) return null;
|
|
4892
|
+
if (Date.now() - held.at < PRIMED_DOOR_TTL_MS) return { data: held.data };
|
|
4893
|
+
registry2.delete(key);
|
|
4894
|
+
return null;
|
|
4895
|
+
}
|
|
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);
|
|
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
|
+
};
|
|
4910
|
+
function isWritingDoor(door) {
|
|
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);
|
|
4912
|
+
}
|
|
4879
4913
|
|
|
4880
4914
|
// src/core/recordChanges.ts
|
|
4881
4915
|
var listeners = /* @__PURE__ */ new Set();
|
|
@@ -5947,7 +5981,21 @@ function createRecordsClient(given) {
|
|
|
5947
5981
|
bundleAsked.delete(tableId);
|
|
5948
5982
|
for (const key of [...bundleParts.keys()]) if (key.includes(tableId)) bundleParts.delete(key);
|
|
5949
5983
|
}
|
|
5984
|
+
function primedFor(door, args) {
|
|
5985
|
+
const look = LOOK_WRITES[door];
|
|
5986
|
+
if (look) {
|
|
5987
|
+
dropPrimedDoorAnswers(look);
|
|
5988
|
+
return null;
|
|
5989
|
+
}
|
|
5990
|
+
if (isWritingDoor(door)) {
|
|
5991
|
+
dropPrimedDoorAnswers();
|
|
5992
|
+
return null;
|
|
5993
|
+
}
|
|
5994
|
+
return takePrimedDoorAnswer(`${door}|${canonicalArgs(args)}`);
|
|
5995
|
+
}
|
|
5950
5996
|
async function callDoor(door, args, where) {
|
|
5997
|
+
const primed = primedFor(door, args);
|
|
5998
|
+
if (primed) return ok(primed.data);
|
|
5951
5999
|
const bundled = await fromBundle(door, args);
|
|
5952
6000
|
if (bundled) return ok(bundled.data);
|
|
5953
6001
|
if (!doorReady(config, door)) {
|
|
@@ -5972,6 +6020,8 @@ function createRecordsClient(given) {
|
|
|
5972
6020
|
}
|
|
5973
6021
|
async function owedDoor(door, args, where) {
|
|
5974
6022
|
if (doorExists(door)) return callDoor(door, args, where);
|
|
6023
|
+
const primed = primedFor(door, args);
|
|
6024
|
+
if (primed) return ok(primed.data);
|
|
5975
6025
|
const response = await config.dataSource.rpc(door, args, { schema });
|
|
5976
6026
|
if (response.error) {
|
|
5977
6027
|
const code = response.error.code;
|
|
@@ -6037,6 +6087,8 @@ function createRecordsClient(given) {
|
|
|
6037
6087
|
return ok(response.data);
|
|
6038
6088
|
}
|
|
6039
6089
|
async function drillDoor(door, args, where) {
|
|
6090
|
+
const primed = primedFor(door, args);
|
|
6091
|
+
if (primed) return ok(primed.data);
|
|
6040
6092
|
const response = await config.dataSource.rpc(door, args, { schema: DRILL_SCHEMA });
|
|
6041
6093
|
if (response.error) {
|
|
6042
6094
|
const refusal = mapPgError(response.error, where);
|
|
@@ -10094,6 +10146,7 @@ export {
|
|
|
10094
10146
|
PIPELINE_RULE_KINDS,
|
|
10095
10147
|
PORTAL_ACCENTS,
|
|
10096
10148
|
PORTAL_ARCHIVE_FILTERS,
|
|
10149
|
+
PRIMED_DOOR_TTL_MS,
|
|
10097
10150
|
PRODUCED_BY_LABEL,
|
|
10098
10151
|
REFUSALS_WORTH_REPEATING,
|
|
10099
10152
|
RELATION_BINDINGS,
|
|
@@ -10159,6 +10212,7 @@ export {
|
|
|
10159
10212
|
doorReady,
|
|
10160
10213
|
drillAnswerOf,
|
|
10161
10214
|
drillFindingKnob,
|
|
10215
|
+
dropPrimedDoorAnswers,
|
|
10162
10216
|
durationText,
|
|
10163
10217
|
emptyArchiveLine,
|
|
10164
10218
|
emptyPortalArchiveLine,
|
|
@@ -10247,6 +10301,7 @@ export {
|
|
|
10247
10301
|
predictWriteRefusals,
|
|
10248
10302
|
previewRetype,
|
|
10249
10303
|
previewRuleChange,
|
|
10304
|
+
primeDoorAnswer,
|
|
10250
10305
|
primeRecordPageBundle,
|
|
10251
10306
|
primeTablePageBundle,
|
|
10252
10307
|
publicFormPath,
|