@ai-matrx/records 0.92.1 → 0.93.0
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 +43 -0
- package/README.md +4 -4
- package/dist/{client-Dzd8gtAo.d.ts → client-DsPuWFp0.d.ts} +8 -8
- package/dist/{client-Cn3odIIB.d.cts → client-EyD3rS0T.d.cts} +8 -8
- package/dist/core/index.cjs +101 -32
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +16 -15
- package/dist/core/index.d.ts +16 -15
- package/dist/core/index.js +101 -32
- package/dist/core/index.js.map +1 -1
- package/dist/data/index.cjs +46 -24
- package/dist/data/index.cjs.map +1 -1
- package/dist/data/index.d.cts +11 -11
- package/dist/data/index.d.ts +11 -11
- package/dist/data/index.js +46 -24
- package/dist/data/index.js.map +1 -1
- package/dist/{declareTable-CrL6AZKB.d.cts → declareTable-Bkk_Ewib.d.cts} +4 -4
- package/dist/{declareTable-ZRW5EsTQ.d.ts → declareTable-kL5qZoTe.d.ts} +4 -4
- package/dist/entity/index.cjs +43 -29
- package/dist/entity/index.cjs.map +1 -1
- package/dist/entity/index.d.cts +7 -6
- package/dist/entity/index.d.ts +7 -6
- package/dist/entity/index.js +43 -29
- package/dist/entity/index.js.map +1 -1
- package/dist/entity/react.cjs +43 -29
- package/dist/entity/react.cjs.map +1 -1
- package/dist/entity/react.js +43 -29
- package/dist/entity/react.js.map +1 -1
- package/dist/{field-CCY1rG9l.d.cts → field-6rwt4ejZ.d.cts} +1 -1
- package/dist/{field-enufS5ry.d.ts → field-B-WaVZnS.d.ts} +1 -1
- package/dist/forms/index.d.cts +3 -3
- package/dist/forms/index.d.ts +3 -3
- package/dist/index.cjs +92 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -33
- package/dist/index.d.ts +13 -33
- package/dist/index.js +92 -25
- package/dist/index.js.map +1 -1
- package/dist/memory/index.d.cts +7 -7
- package/dist/memory/index.d.ts +7 -7
- package/dist/objectOrganization-BII_K3Gm.d.ts +45 -0
- package/dist/objectOrganization-DfjDQtDb.d.cts +45 -0
- package/dist/{port-C54ykAOv.d.ts → port--acgmxh5.d.ts} +5 -2
- package/dist/{port-Drioh9al.d.cts → port-Cx76dq-X.d.cts} +5 -2
- package/dist/{portal-DRdmZ-xv.d.cts → portal-9sRr6cpG.d.cts} +1 -1
- package/dist/{portal-or_f7BkT.d.ts → portal-BDAqsGkg.d.ts} +1 -1
- package/dist/{ports-s0D2jvqn.d.cts → ports-9BQ3zo2y.d.cts} +108 -2
- package/dist/{ports-BeOgjwYl.d.ts → ports-DYWE1ENo.d.ts} +108 -2
- package/dist/react/index.cjs +101 -32
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1463 -1363
- package/dist/react/index.d.ts +1463 -1363
- package/dist/react/index.js +101 -32
- package/dist/react/index.js.map +1 -1
- package/dist/realtime/index.cjs +43 -13
- package/dist/realtime/index.cjs.map +1 -1
- package/dist/realtime/index.d.cts +9 -3
- package/dist/realtime/index.d.ts +9 -3
- package/dist/realtime/index.js +43 -13
- package/dist/realtime/index.js.map +1 -1
- package/dist/{record-BwCf9wKW.d.cts → record-DmmeuUrC.d.cts} +1 -1
- package/dist/{record-BwCf9wKW.d.ts → record-DmmeuUrC.d.ts} +1 -1
- package/dist/{relation-eLMgv_dV.d.ts → relation-Op1M67le.d.ts} +2 -2
- package/dist/{relation-8vAWCa67.d.cts → relation-qrb2NbHf.d.cts} +2 -2
- package/dist/{rule-wHI5B0Ka.d.cts → rule-CeHg1sy1.d.cts} +1 -1
- package/dist/{rule-D9yNiorf.d.ts → rule-tN2lxvJ1.d.ts} +1 -1
- package/dist/search/index.d.cts +1 -1
- package/dist/search/index.d.ts +1 -1
- package/dist/setup/index.cjs +117 -42
- package/dist/setup/index.cjs.map +1 -1
- package/dist/setup/index.d.cts +25 -11
- package/dist/setup/index.d.ts +25 -11
- package/dist/setup/index.js +117 -42
- package/dist/setup/index.js.map +1 -1
- package/dist/{subscription-CdoI-UaB.d.cts → subscription-Drbxn-9Z.d.cts} +3 -3
- package/dist/{subscription-BynsG1K6.d.ts → subscription-hdTaRrfK.d.ts} +3 -3
- package/dist/{table-kind-i3lZJa3f.d.ts → table-kind-BZkvzBgc.d.ts} +4 -29
- package/dist/{table-kind-DzctQ7dO.d.cts → table-kind-C-hZxDN7.d.cts} +4 -29
- package/dist/templates/index.d.cts +10 -10
- package/dist/templates/index.d.ts +10 -10
- package/dist/typed-table/index.cjs +46 -24
- package/dist/typed-table/index.cjs.map +1 -1
- package/dist/typed-table/index.d.cts +10 -10
- package/dist/typed-table/index.d.ts +10 -10
- package/dist/typed-table/index.js +46 -24
- package/dist/typed-table/index.js.map +1 -1
- package/dist/{types-BvL_oKFl.d.ts → types-BauAeFW8.d.ts} +2 -2
- package/dist/{types-DAFP6XFe.d.cts → types-CBmUdBT0.d.cts} +2 -2
- package/dist/{types-BKYEeFt4.d.cts → types-Dek9owBe.d.cts} +2 -2
- package/dist/{types-D8qdG3Lg.d.cts → types-DsgXrESm.d.cts} +2 -2
- package/dist/{types-cpKY7Pjb.d.ts → types-HVgWcZDY.d.ts} +2 -2
- package/dist/{types-DYzXhD7j.d.ts → types-hrw-Eff1.d.ts} +2 -2
- package/dist/use-cases/index.d.cts +5 -5
- package/dist/use-cases/index.d.ts +5 -5
- package/dist/{validate-DfNMxjmU.d.cts → validate-B_iUeyh2.d.cts} +1 -1
- package/dist/{validate-DbvAParj.d.ts → validate-w-HGGTf-.d.ts} +1 -1
- package/dist/views/index.cjs +438 -0
- package/dist/views/index.cjs.map +1 -0
- package/dist/views/index.d.cts +401 -0
- package/dist/views/index.d.ts +401 -0
- package/dist/views/index.js +415 -0
- package/dist/views/index.js.map +1 -0
- package/package.json +12 -2
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { N as NewFieldSpec } from '../declareTable-
|
|
2
|
-
import { U as Uuid, R as RecordsResult, r as RecordPageSort } from '../record-
|
|
3
|
-
import { R as RecordsClient } from '../client-
|
|
4
|
-
import { F as FieldDrift, T as TableArchiveProgress } from '../table-kind-
|
|
5
|
-
import '../field-
|
|
6
|
-
import '../subscription-
|
|
7
|
-
import '../rule-
|
|
8
|
-
import '../relation-
|
|
9
|
-
import '../ports-
|
|
10
|
-
import '../portal-
|
|
1
|
+
import { N as NewFieldSpec } from '../declareTable-Bkk_Ewib.cjs';
|
|
2
|
+
import { U as Uuid, R as RecordsResult, r as RecordPageSort } from '../record-DmmeuUrC.cjs';
|
|
3
|
+
import { R as RecordsClient } from '../client-EyD3rS0T.cjs';
|
|
4
|
+
import { F as FieldDrift, T as TableArchiveProgress } from '../table-kind-C-hZxDN7.cjs';
|
|
5
|
+
import '../field-6rwt4ejZ.cjs';
|
|
6
|
+
import '../subscription-Drbxn-9Z.cjs';
|
|
7
|
+
import '../rule-CeHg1sy1.cjs';
|
|
8
|
+
import '../relation-qrb2NbHf.cjs';
|
|
9
|
+
import '../ports-9BQ3zo2y.cjs';
|
|
10
|
+
import '../portal-9sRr6cpG.cjs';
|
|
11
11
|
|
|
12
12
|
/** Where a declared field's value goes in the graduated table. */
|
|
13
13
|
declare const TO_CUSTOM_FIELDS: "custom_fields";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { N as NewFieldSpec } from '../declareTable-
|
|
2
|
-
import { U as Uuid, R as RecordsResult, r as RecordPageSort } from '../record-
|
|
3
|
-
import { R as RecordsClient } from '../client-
|
|
4
|
-
import { F as FieldDrift, T as TableArchiveProgress } from '../table-kind-
|
|
5
|
-
import '../field-
|
|
6
|
-
import '../subscription-
|
|
7
|
-
import '../rule-
|
|
8
|
-
import '../relation-
|
|
9
|
-
import '../ports-
|
|
10
|
-
import '../portal-
|
|
1
|
+
import { N as NewFieldSpec } from '../declareTable-kL5qZoTe.js';
|
|
2
|
+
import { U as Uuid, R as RecordsResult, r as RecordPageSort } from '../record-DmmeuUrC.js';
|
|
3
|
+
import { R as RecordsClient } from '../client-DsPuWFp0.js';
|
|
4
|
+
import { F as FieldDrift, T as TableArchiveProgress } from '../table-kind-BZkvzBgc.js';
|
|
5
|
+
import '../field-B-WaVZnS.js';
|
|
6
|
+
import '../subscription-hdTaRrfK.js';
|
|
7
|
+
import '../rule-tN2lxvJ1.js';
|
|
8
|
+
import '../relation-Op1M67le.js';
|
|
9
|
+
import '../ports-DYWE1ENo.js';
|
|
10
|
+
import '../portal-BDAqsGkg.js';
|
|
11
11
|
|
|
12
12
|
/** Where a declared field's value goes in the graduated table. */
|
|
13
13
|
declare const TO_CUSTOM_FIELDS: "custom_fields";
|
|
@@ -761,25 +761,45 @@ function sourceArchivedOf(value) {
|
|
|
761
761
|
import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
|
|
762
762
|
var REMEMBER_MS = 3e4;
|
|
763
763
|
var REMEMBER_MAX = 500;
|
|
764
|
-
|
|
765
|
-
function trim(now) {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
764
|
+
function ledgerOver(ours) {
|
|
765
|
+
function trim(now) {
|
|
766
|
+
for (const [id, at] of ours) {
|
|
767
|
+
if (now - at <= REMEMBER_MS) break;
|
|
768
|
+
ours.delete(id);
|
|
769
|
+
}
|
|
770
|
+
while (ours.size > REMEMBER_MAX) {
|
|
771
|
+
const oldest = ours.keys().next();
|
|
772
|
+
if (oldest.done === true) break;
|
|
773
|
+
ours.delete(oldest.value);
|
|
774
|
+
}
|
|
774
775
|
}
|
|
776
|
+
return {
|
|
777
|
+
mint() {
|
|
778
|
+
const id = crypto.randomUUID();
|
|
779
|
+
const now = Date.now();
|
|
780
|
+
ours.set(id, now);
|
|
781
|
+
trim(now);
|
|
782
|
+
return id;
|
|
783
|
+
},
|
|
784
|
+
isOwn(opId) {
|
|
785
|
+
if (!opId) return false;
|
|
786
|
+
const at = ours.get(opId);
|
|
787
|
+
if (at === void 0) return false;
|
|
788
|
+
if (Date.now() - at > REMEMBER_MS) {
|
|
789
|
+
ours.delete(opId);
|
|
790
|
+
return false;
|
|
791
|
+
}
|
|
792
|
+
return true;
|
|
793
|
+
},
|
|
794
|
+
clear() {
|
|
795
|
+
ours.clear();
|
|
796
|
+
},
|
|
797
|
+
get size() {
|
|
798
|
+
return ours.size;
|
|
799
|
+
}
|
|
800
|
+
};
|
|
775
801
|
}
|
|
776
|
-
|
|
777
|
-
const id = crypto.randomUUID();
|
|
778
|
-
const now = Date.now();
|
|
779
|
-
ours.set(id, now);
|
|
780
|
-
trim(now);
|
|
781
|
-
return id;
|
|
782
|
-
}
|
|
802
|
+
var defaultOpLedger = ledgerOver(globalSlot2("ai-matrx.records.op-ledger", () => /* @__PURE__ */ new Map()));
|
|
783
803
|
|
|
784
804
|
// src/choice.ts
|
|
785
805
|
import { isUuidShape as isUuidShape3 } from "@ai-matrx/kit/uuid";
|
|
@@ -2838,6 +2858,8 @@ function createRecordsClient(given) {
|
|
|
2838
2858
|
const config = { ...given, dataSource: asRecordsDataSource(given.dataSource) };
|
|
2839
2859
|
const schema = config.schema ?? DEFAULT_SCHEMA;
|
|
2840
2860
|
const org = config.organizationId;
|
|
2861
|
+
const ledger = config.opLedger ?? defaultOpLedger;
|
|
2862
|
+
const mintOp = () => ledger.mint();
|
|
2841
2863
|
const scream = sink(config);
|
|
2842
2864
|
const BUNDLE_TTL_MS = 1e4;
|
|
2843
2865
|
const BUNDLE_OPENERS = /* @__PURE__ */ new Set(["applicable_fields", "views", "view_look_read", "table_decorations", "row_actions", "reverse_columns", "record_change_actions", "grid_layout", "io_imports"]);
|
|
@@ -3224,14 +3246,14 @@ function createRecordsClient(given) {
|
|
|
3224
3246
|
async recordWrite({ table_id, data }) {
|
|
3225
3247
|
const result = await callDoor(
|
|
3226
3248
|
DOORS.recordWrite,
|
|
3227
|
-
{ p_organization_id: org, p_table_id: table_id, p_data: { ...data, _op_id:
|
|
3249
|
+
{ p_organization_id: org, p_table_id: table_id, p_data: { ...data, _op_id: mintOp() } },
|
|
3228
3250
|
"recordWrite"
|
|
3229
3251
|
);
|
|
3230
3252
|
if (result.ok && typeof result.data === "string") announceRecordChanged(result.data);
|
|
3231
3253
|
return result;
|
|
3232
3254
|
},
|
|
3233
3255
|
async recordWriteMany({ table_id, rows, ids }) {
|
|
3234
|
-
const opId =
|
|
3256
|
+
const opId = mintOp();
|
|
3235
3257
|
return callDoor(
|
|
3236
3258
|
DOORS.recordWriteMany,
|
|
3237
3259
|
{
|
|
@@ -3244,7 +3266,7 @@ function createRecordsClient(given) {
|
|
|
3244
3266
|
);
|
|
3245
3267
|
},
|
|
3246
3268
|
async recordChangeMany({ table_id, changes }) {
|
|
3247
|
-
const opId =
|
|
3269
|
+
const opId = mintOp();
|
|
3248
3270
|
const result = await callDoor(
|
|
3249
3271
|
DOORS.recordChangeMany,
|
|
3250
3272
|
{
|
|
@@ -3267,7 +3289,7 @@ function createRecordsClient(given) {
|
|
|
3267
3289
|
return result;
|
|
3268
3290
|
},
|
|
3269
3291
|
async recordWriteGraph({ table_id, parent, children, edges }) {
|
|
3270
|
-
const opId =
|
|
3292
|
+
const opId = mintOp();
|
|
3271
3293
|
return callDoor(
|
|
3272
3294
|
DOORS.recordWriteGraph,
|
|
3273
3295
|
{
|
|
@@ -3291,7 +3313,7 @@ function createRecordsClient(given) {
|
|
|
3291
3313
|
{
|
|
3292
3314
|
p_organization_id: org,
|
|
3293
3315
|
p_record_id: record_id,
|
|
3294
|
-
p_patch: { ...patch, _op_id:
|
|
3316
|
+
p_patch: { ...patch, _op_id: mintOp() },
|
|
3295
3317
|
...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
|
|
3296
3318
|
},
|
|
3297
3319
|
"recordUpdate"
|
|
@@ -3305,7 +3327,7 @@ function createRecordsClient(given) {
|
|
|
3305
3327
|
{
|
|
3306
3328
|
p_organization_id: org,
|
|
3307
3329
|
p_record_id: record_id,
|
|
3308
|
-
p_patch: { ...patch, _op_id:
|
|
3330
|
+
p_patch: { ...patch, _op_id: mintOp() },
|
|
3309
3331
|
p_add: add,
|
|
3310
3332
|
...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
|
|
3311
3333
|
},
|
|
@@ -4330,7 +4352,7 @@ function createRecordsClient(given) {
|
|
|
4330
4352
|
p_table_id: table_id,
|
|
4331
4353
|
p_key: keys,
|
|
4332
4354
|
// The op id rides the envelope, as `recordWrite` / `recordUpdate` send it; each door takes it off.
|
|
4333
|
-
p_data: { ...data, _op_id:
|
|
4355
|
+
p_data: { ...data, _op_id: mintOp() },
|
|
4334
4356
|
...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
|
|
4335
4357
|
},
|
|
4336
4358
|
"recordUpsert"
|