@ai-matrx/records 0.99.29 → 0.99.31
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 +26 -2
- package/dist/core/index.cjs +64 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +188 -1
- package/dist/core/index.d.ts +188 -1
- package/dist/core/index.js +64 -0
- package/dist/core/index.js.map +1 -1
- package/dist/entity/index.cjs +1 -1
- package/dist/entity/index.cjs.map +1 -1
- package/dist/entity/index.d.cts +3 -3
- package/dist/entity/index.d.ts +3 -3
- package/dist/entity/index.js +1 -1
- package/dist/entity/index.js.map +1 -1
- package/dist/entity/react.cjs +1 -1
- package/dist/entity/react.cjs.map +1 -1
- package/dist/entity/react.js +1 -1
- package/dist/entity/react.js.map +1 -1
- package/dist/{port-DWHLj_Sa.d.ts → port-Bk7TG0aE.d.ts} +3 -3
- package/dist/{port-BbWB9Pgq.d.cts → port-rqQEGhew.d.cts} +3 -3
- package/dist/react/index.cjs +4 -116
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -2
- package/dist/react/index.d.ts +1 -2
- package/dist/react/index.js +3 -115
- package/dist/react/index.js.map +1 -1
- package/dist/realtime/index.cjs +1 -1
- package/dist/realtime/index.cjs.map +1 -1
- package/dist/realtime/index.d.cts +4 -4
- package/dist/realtime/index.d.ts +4 -4
- package/dist/realtime/index.js +1 -1
- package/dist/realtime/index.js.map +1 -1
- package/dist/setup/index.cjs +3 -3
- package/dist/setup/index.cjs.map +1 -1
- package/dist/setup/index.d.cts +2 -2
- package/dist/setup/index.d.ts +2 -2
- package/dist/setup/index.js +3 -3
- package/dist/setup/index.js.map +1 -1
- package/dist/typed-table/index.cjs +4 -116
- package/dist/typed-table/index.cjs.map +1 -1
- package/dist/typed-table/index.d.cts +1 -2
- package/dist/typed-table/index.d.ts +1 -2
- package/dist/typed-table/index.js +3 -115
- package/dist/typed-table/index.js.map +1 -1
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,33 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records
|
|
2
2
|
|
|
3
|
+
## 0.99.31
|
|
4
|
+
### Unreleased
|
|
5
|
+
|
|
6
|
+
- `/core` now owns the table logic that lived in matrx-frontend `features/data-tables` (W1-G2b): `inferDataType`, `sanitizeFieldName`, `validateFieldName`, `isBulkOpError`, `describeBulkFailures`, `isServiceFailure`, and the types `DatasetField`, `DatasetRow`, `FieldDataType`, `Json`, `BulkOp` (+ `BulkInsertOp`/`BulkUpdateOp`/`BulkMergeOp`/`BulkCellOp`/`BulkDeleteOp`/`BulkOpError`/`BulkOpResult`/`BulkWriteResponse`) and `ServiceOk`/`ServiceErr`/`ServiceResult`. Additive: nothing existing changed. Consumer action: import these from `@ai-matrx/records/core` instead of `@/features/data-tables/{types,type-inference,field-name-key}`.
|
|
7
|
+
|
|
8
|
+
## 0.99.30
|
|
9
|
+
|
|
10
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
11
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
12
|
+
Diff: `git diff 9e0559b49b 3702c2122e -- apps/shared/records/src`
|
|
13
|
+
|
|
14
|
+
Changed shipped source files (5):
|
|
15
|
+
- `apps/shared/records/src/entity/core/realtime.ts`
|
|
16
|
+
- `apps/shared/records/src/realtime/index.ts`
|
|
17
|
+
- `apps/shared/records/src/setup/index.ts`
|
|
18
|
+
- `apps/shared/records/src/typed-table/define.ts`
|
|
19
|
+
- `apps/shared/records/src/typed-table/index.ts`
|
|
20
|
+
|
|
3
21
|
## 0.99.29
|
|
4
22
|
|
|
5
|
-
|
|
6
|
-
|
|
23
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
24
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
25
|
+
Diff: `git diff 409b5bc198 9e0559b49b -- apps/shared/records/src`
|
|
26
|
+
|
|
27
|
+
Changed shipped source files (3):
|
|
28
|
+
- `apps/shared/records/src/base.ts`
|
|
29
|
+
- `apps/shared/records/src/core/client.ts`
|
|
30
|
+
- `apps/shared/records/src/table.ts`
|
|
7
31
|
|
|
8
32
|
## 0.99.28
|
|
9
33
|
### Unreleased
|
package/dist/core/index.cjs
CHANGED
|
@@ -159,6 +159,7 @@ __export(core_exports, {
|
|
|
159
159
|
declareDrillDefinition: () => declareDrillDefinition,
|
|
160
160
|
declareTable: () => declareTable,
|
|
161
161
|
defaultOpLedger: () => defaultOpLedger,
|
|
162
|
+
describeBulkFailures: () => describeBulkFailures,
|
|
162
163
|
doorAbsent: () => doorAbsent,
|
|
163
164
|
doorCensus: () => doorCensus,
|
|
164
165
|
doorExists: () => doorExists,
|
|
@@ -196,11 +197,13 @@ __export(core_exports, {
|
|
|
196
197
|
importCsv: () => importCsv,
|
|
197
198
|
importXlsx: () => importXlsx,
|
|
198
199
|
indexedDbStore: () => indexedDbStore,
|
|
200
|
+
inferDataType: () => inferDataType,
|
|
199
201
|
intersectIds: () => intersectIds,
|
|
200
202
|
isAPersonsRefusal: () => isAPersonsRefusal,
|
|
201
203
|
isAddressValue: () => isAddressValue,
|
|
202
204
|
isArchiveLane: () => isArchiveLane,
|
|
203
205
|
isAutonumberField: () => isAutonumberField,
|
|
206
|
+
isBulkOpError: () => isBulkOpError,
|
|
204
207
|
isButtonField: () => isButtonField,
|
|
205
208
|
isDecided: () => isDecided,
|
|
206
209
|
isEntityReferenceConfig: () => isEntityReferenceConfig,
|
|
@@ -214,6 +217,7 @@ __export(core_exports, {
|
|
|
214
217
|
isRecordsErr: () => isRecordsErr,
|
|
215
218
|
isReverseField: () => isReverseField,
|
|
216
219
|
isRuleFilter: () => isRuleFilter,
|
|
220
|
+
isServiceFailure: () => isServiceFailure,
|
|
217
221
|
isShownTo: () => isShownTo,
|
|
218
222
|
isTableKind: () => isTableKind,
|
|
219
223
|
isTheChosen: () => isTheChosen,
|
|
@@ -298,6 +302,7 @@ __export(core_exports, {
|
|
|
298
302
|
rulesWithTopStar: () => rulesWithTopStar,
|
|
299
303
|
safeLinkHref: () => safeLinkHref,
|
|
300
304
|
sameDocument: () => sameDocument,
|
|
305
|
+
sanitizeFieldName: () => sanitizeFieldName,
|
|
301
306
|
scopeChip: () => scopeChip,
|
|
302
307
|
seedIndex: () => seedIndex,
|
|
303
308
|
seedKey: () => seedKey,
|
|
@@ -326,6 +331,7 @@ __export(core_exports, {
|
|
|
326
331
|
typedMatchScore: () => typedMatchScore,
|
|
327
332
|
typedTimeText: () => typedTimeText,
|
|
328
333
|
unwrapRecords: () => unwrapRecords,
|
|
334
|
+
validateFieldName: () => validateFieldName,
|
|
329
335
|
valueConverts: () => valueConverts,
|
|
330
336
|
valuesAreUnconfirmed: () => valuesAreUnconfirmed,
|
|
331
337
|
whereIdOpensPort: () => whereIdOpensPort,
|
|
@@ -12402,4 +12408,62 @@ function seededDataSource(index) {
|
|
|
12402
12408
|
};
|
|
12403
12409
|
return { source, missed: () => missed };
|
|
12404
12410
|
}
|
|
12411
|
+
|
|
12412
|
+
// src/core/table-logic.ts
|
|
12413
|
+
function isBulkOpError(r) {
|
|
12414
|
+
return typeof r === "object" && r !== null && "error" in r;
|
|
12415
|
+
}
|
|
12416
|
+
function describeBulkFailures(failed) {
|
|
12417
|
+
const inTrash = failed.filter((f) => f.error === "row_in_trash").length;
|
|
12418
|
+
const missing = failed.length - inTrash;
|
|
12419
|
+
const parts = [];
|
|
12420
|
+
if (inTrash > 0) {
|
|
12421
|
+
parts.push(
|
|
12422
|
+
`${inTrash} row${inTrash === 1 ? " is" : "s are"} in Trash \u2014 restore ${inTrash === 1 ? "it" : "them"} from Trash to edit`
|
|
12423
|
+
);
|
|
12424
|
+
}
|
|
12425
|
+
if (missing > 0) {
|
|
12426
|
+
parts.push(
|
|
12427
|
+
`${missing} row${missing === 1 ? "" : "s"} could not be found \u2014 ${missing === 1 ? "it" : "they"} may have been removed by someone else`
|
|
12428
|
+
);
|
|
12429
|
+
}
|
|
12430
|
+
return `${parts.join("; ")}.`;
|
|
12431
|
+
}
|
|
12432
|
+
function isServiceFailure(r) {
|
|
12433
|
+
return r.success === false;
|
|
12434
|
+
}
|
|
12435
|
+
var DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
12436
|
+
var DATETIME_PATTERN = /^\d{4}-\d{2}-\d{2}[T\s]\d{2}:\d{2}/;
|
|
12437
|
+
function inferDataType(value) {
|
|
12438
|
+
if (value === null || value === void 0 || value === "") return "string";
|
|
12439
|
+
if (typeof value === "boolean") return "boolean";
|
|
12440
|
+
if (typeof value === "number") {
|
|
12441
|
+
return Number.isInteger(value) ? "integer" : "number";
|
|
12442
|
+
}
|
|
12443
|
+
if (typeof value === "object") {
|
|
12444
|
+
return Array.isArray(value) ? "array" : "json";
|
|
12445
|
+
}
|
|
12446
|
+
const str2 = String(value);
|
|
12447
|
+
const num2 = Number(str2);
|
|
12448
|
+
if (!isNaN(num2) && str2.trim() !== "") {
|
|
12449
|
+
return Number.isInteger(num2) ? "integer" : "number";
|
|
12450
|
+
}
|
|
12451
|
+
const lower = str2.toLowerCase().trim();
|
|
12452
|
+
if (lower === "true" || lower === "false") return "boolean";
|
|
12453
|
+
if (DATE_PATTERN.test(str2)) return "date";
|
|
12454
|
+
if (DATETIME_PATTERN.test(str2)) return "datetime";
|
|
12455
|
+
return "string";
|
|
12456
|
+
}
|
|
12457
|
+
function sanitizeFieldName(displayName) {
|
|
12458
|
+
if (!displayName || typeof displayName !== "string") {
|
|
12459
|
+
return "";
|
|
12460
|
+
}
|
|
12461
|
+
return displayName.toLowerCase().trim().replace(/[^a-z0-9\s_]/g, "").replace(/\s+/g, "_").replace(/^_+|_+$/g, "").replace(/_+/g, "_").replace(/^(\d)/, "_$1");
|
|
12462
|
+
}
|
|
12463
|
+
function validateFieldName(fieldName) {
|
|
12464
|
+
if (!fieldName || typeof fieldName !== "string") {
|
|
12465
|
+
return false;
|
|
12466
|
+
}
|
|
12467
|
+
return /^[a-z][a-z0-9_]*$/.test(fieldName);
|
|
12468
|
+
}
|
|
12405
12469
|
//# sourceMappingURL=index.cjs.map
|