@ai-matrx/records 0.92.2 → 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 +37 -0
- 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 +13 -3
package/dist/data/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { C as Column, Q as Query, A as AliasBinding, H as HostDataPort } from '../types-
|
|
2
|
-
export { a as AnyAlias, b as CUSTOM_ROW_TOKEN, D as DataEvents, c as DataPort, d as DataPortEventName, e as DataSource, E as EntityAlias, f as EntityRef, L as Lane, P as Page, R as Row, g as RowsEvent, T as TableAlias, V as Values, W as WhereClause, h as WhereOp } from '../types-
|
|
3
|
-
import { R as RecordsClient } from '../client-
|
|
4
|
-
import { b as Field } from '../field-
|
|
5
|
-
import { U as Uuid, R as RecordsResult, r as RecordPageSort, q as ReadRow } from '../record-
|
|
6
|
-
import { R as RuleExpression } from '../rule-
|
|
7
|
-
import '../relation-
|
|
8
|
-
import '../ports-
|
|
9
|
-
import '../table-kind-
|
|
10
|
-
import '../subscription-
|
|
11
|
-
import '../portal-
|
|
1
|
+
import { C as Column, Q as Query, A as AliasBinding, H as HostDataPort } from '../types-Dek9owBe.cjs';
|
|
2
|
+
export { a as AnyAlias, b as CUSTOM_ROW_TOKEN, D as DataEvents, c as DataPort, d as DataPortEventName, e as DataSource, E as EntityAlias, f as EntityRef, L as Lane, P as Page, R as Row, g as RowsEvent, T as TableAlias, V as Values, W as WhereClause, h as WhereOp } from '../types-Dek9owBe.cjs';
|
|
3
|
+
import { R as RecordsClient } from '../client-EyD3rS0T.cjs';
|
|
4
|
+
import { b as Field } from '../field-6rwt4ejZ.cjs';
|
|
5
|
+
import { U as Uuid, R as RecordsResult, r as RecordPageSort, q as ReadRow } from '../record-DmmeuUrC.cjs';
|
|
6
|
+
import { R as RuleExpression } from '../rule-CeHg1sy1.cjs';
|
|
7
|
+
import '../relation-qrb2NbHf.cjs';
|
|
8
|
+
import '../ports-9BQ3zo2y.cjs';
|
|
9
|
+
import '../table-kind-C-hZxDN7.cjs';
|
|
10
|
+
import '../subscription-Drbxn-9Z.cjs';
|
|
11
|
+
import '../portal-9sRr6cpG.cjs';
|
|
12
12
|
|
|
13
13
|
interface TableShape {
|
|
14
14
|
columns: Column[];
|
package/dist/data/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { C as Column, Q as Query, A as AliasBinding, H as HostDataPort } from '../types-
|
|
2
|
-
export { a as AnyAlias, b as CUSTOM_ROW_TOKEN, D as DataEvents, c as DataPort, d as DataPortEventName, e as DataSource, E as EntityAlias, f as EntityRef, L as Lane, P as Page, R as Row, g as RowsEvent, T as TableAlias, V as Values, W as WhereClause, h as WhereOp } from '../types-
|
|
3
|
-
import { R as RecordsClient } from '../client-
|
|
4
|
-
import { b as Field } from '../field-
|
|
5
|
-
import { U as Uuid, R as RecordsResult, r as RecordPageSort, q as ReadRow } from '../record-
|
|
6
|
-
import { R as RuleExpression } from '../rule-
|
|
7
|
-
import '../relation-
|
|
8
|
-
import '../ports-
|
|
9
|
-
import '../table-kind-
|
|
10
|
-
import '../subscription-
|
|
11
|
-
import '../portal-
|
|
1
|
+
import { C as Column, Q as Query, A as AliasBinding, H as HostDataPort } from '../types-HVgWcZDY.js';
|
|
2
|
+
export { a as AnyAlias, b as CUSTOM_ROW_TOKEN, D as DataEvents, c as DataPort, d as DataPortEventName, e as DataSource, E as EntityAlias, f as EntityRef, L as Lane, P as Page, R as Row, g as RowsEvent, T as TableAlias, V as Values, W as WhereClause, h as WhereOp } from '../types-HVgWcZDY.js';
|
|
3
|
+
import { R as RecordsClient } from '../client-DsPuWFp0.js';
|
|
4
|
+
import { b as Field } from '../field-B-WaVZnS.js';
|
|
5
|
+
import { U as Uuid, R as RecordsResult, r as RecordPageSort, q as ReadRow } from '../record-DmmeuUrC.js';
|
|
6
|
+
import { R as RuleExpression } from '../rule-tN2lxvJ1.js';
|
|
7
|
+
import '../relation-Op1M67le.js';
|
|
8
|
+
import '../ports-DYWE1ENo.js';
|
|
9
|
+
import '../table-kind-BZkvzBgc.js';
|
|
10
|
+
import '../subscription-hdTaRrfK.js';
|
|
11
|
+
import '../portal-BDAqsGkg.js';
|
|
12
12
|
|
|
13
13
|
interface TableShape {
|
|
14
14
|
columns: Column[];
|
package/dist/data/index.js
CHANGED
|
@@ -582,25 +582,45 @@ function sourceArchivedOf(value) {
|
|
|
582
582
|
import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
|
|
583
583
|
var REMEMBER_MS = 3e4;
|
|
584
584
|
var REMEMBER_MAX = 500;
|
|
585
|
-
|
|
586
|
-
function trim(now) {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
585
|
+
function ledgerOver(ours) {
|
|
586
|
+
function trim(now) {
|
|
587
|
+
for (const [id, at] of ours) {
|
|
588
|
+
if (now - at <= REMEMBER_MS) break;
|
|
589
|
+
ours.delete(id);
|
|
590
|
+
}
|
|
591
|
+
while (ours.size > REMEMBER_MAX) {
|
|
592
|
+
const oldest = ours.keys().next();
|
|
593
|
+
if (oldest.done === true) break;
|
|
594
|
+
ours.delete(oldest.value);
|
|
595
|
+
}
|
|
595
596
|
}
|
|
597
|
+
return {
|
|
598
|
+
mint() {
|
|
599
|
+
const id = crypto.randomUUID();
|
|
600
|
+
const now = Date.now();
|
|
601
|
+
ours.set(id, now);
|
|
602
|
+
trim(now);
|
|
603
|
+
return id;
|
|
604
|
+
},
|
|
605
|
+
isOwn(opId) {
|
|
606
|
+
if (!opId) return false;
|
|
607
|
+
const at = ours.get(opId);
|
|
608
|
+
if (at === void 0) return false;
|
|
609
|
+
if (Date.now() - at > REMEMBER_MS) {
|
|
610
|
+
ours.delete(opId);
|
|
611
|
+
return false;
|
|
612
|
+
}
|
|
613
|
+
return true;
|
|
614
|
+
},
|
|
615
|
+
clear() {
|
|
616
|
+
ours.clear();
|
|
617
|
+
},
|
|
618
|
+
get size() {
|
|
619
|
+
return ours.size;
|
|
620
|
+
}
|
|
621
|
+
};
|
|
596
622
|
}
|
|
597
|
-
|
|
598
|
-
const id = crypto.randomUUID();
|
|
599
|
-
const now = Date.now();
|
|
600
|
-
ours.set(id, now);
|
|
601
|
-
trim(now);
|
|
602
|
-
return id;
|
|
603
|
-
}
|
|
623
|
+
var defaultOpLedger = ledgerOver(globalSlot2("ai-matrx.records.op-ledger", () => /* @__PURE__ */ new Map()));
|
|
604
624
|
|
|
605
625
|
// src/placement.ts
|
|
606
626
|
function countOf(value) {
|
|
@@ -2657,6 +2677,8 @@ function createRecordsClient(given) {
|
|
|
2657
2677
|
const config = { ...given, dataSource: asRecordsDataSource(given.dataSource) };
|
|
2658
2678
|
const schema = config.schema ?? DEFAULT_SCHEMA;
|
|
2659
2679
|
const org = config.organizationId;
|
|
2680
|
+
const ledger = config.opLedger ?? defaultOpLedger;
|
|
2681
|
+
const mintOp = () => ledger.mint();
|
|
2660
2682
|
const scream = sink(config);
|
|
2661
2683
|
const BUNDLE_TTL_MS = 1e4;
|
|
2662
2684
|
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"]);
|
|
@@ -3043,14 +3065,14 @@ function createRecordsClient(given) {
|
|
|
3043
3065
|
async recordWrite({ table_id, data }) {
|
|
3044
3066
|
const result = await callDoor(
|
|
3045
3067
|
DOORS.recordWrite,
|
|
3046
|
-
{ p_organization_id: org, p_table_id: table_id, p_data: { ...data, _op_id:
|
|
3068
|
+
{ p_organization_id: org, p_table_id: table_id, p_data: { ...data, _op_id: mintOp() } },
|
|
3047
3069
|
"recordWrite"
|
|
3048
3070
|
);
|
|
3049
3071
|
if (result.ok && typeof result.data === "string") announceRecordChanged(result.data);
|
|
3050
3072
|
return result;
|
|
3051
3073
|
},
|
|
3052
3074
|
async recordWriteMany({ table_id, rows, ids }) {
|
|
3053
|
-
const opId =
|
|
3075
|
+
const opId = mintOp();
|
|
3054
3076
|
return callDoor(
|
|
3055
3077
|
DOORS.recordWriteMany,
|
|
3056
3078
|
{
|
|
@@ -3063,7 +3085,7 @@ function createRecordsClient(given) {
|
|
|
3063
3085
|
);
|
|
3064
3086
|
},
|
|
3065
3087
|
async recordChangeMany({ table_id, changes }) {
|
|
3066
|
-
const opId =
|
|
3088
|
+
const opId = mintOp();
|
|
3067
3089
|
const result = await callDoor(
|
|
3068
3090
|
DOORS.recordChangeMany,
|
|
3069
3091
|
{
|
|
@@ -3086,7 +3108,7 @@ function createRecordsClient(given) {
|
|
|
3086
3108
|
return result;
|
|
3087
3109
|
},
|
|
3088
3110
|
async recordWriteGraph({ table_id, parent, children, edges }) {
|
|
3089
|
-
const opId =
|
|
3111
|
+
const opId = mintOp();
|
|
3090
3112
|
return callDoor(
|
|
3091
3113
|
DOORS.recordWriteGraph,
|
|
3092
3114
|
{
|
|
@@ -3110,7 +3132,7 @@ function createRecordsClient(given) {
|
|
|
3110
3132
|
{
|
|
3111
3133
|
p_organization_id: org,
|
|
3112
3134
|
p_record_id: record_id,
|
|
3113
|
-
p_patch: { ...patch, _op_id:
|
|
3135
|
+
p_patch: { ...patch, _op_id: mintOp() },
|
|
3114
3136
|
...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
|
|
3115
3137
|
},
|
|
3116
3138
|
"recordUpdate"
|
|
@@ -3124,7 +3146,7 @@ function createRecordsClient(given) {
|
|
|
3124
3146
|
{
|
|
3125
3147
|
p_organization_id: org,
|
|
3126
3148
|
p_record_id: record_id,
|
|
3127
|
-
p_patch: { ...patch, _op_id:
|
|
3149
|
+
p_patch: { ...patch, _op_id: mintOp() },
|
|
3128
3150
|
p_add: add,
|
|
3129
3151
|
...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
|
|
3130
3152
|
},
|
|
@@ -4149,7 +4171,7 @@ function createRecordsClient(given) {
|
|
|
4149
4171
|
p_table_id: table_id,
|
|
4150
4172
|
p_key: keys,
|
|
4151
4173
|
// The op id rides the envelope, as `recordWrite` / `recordUpdate` send it; each door takes it off.
|
|
4152
|
-
p_data: { ...data, _op_id:
|
|
4174
|
+
p_data: { ...data, _op_id: mintOp() },
|
|
4153
4175
|
...expectedVersion === void 0 ? {} : { p_expected_version: expectedVersion }
|
|
4154
4176
|
},
|
|
4155
4177
|
"recordUpsert"
|