@rljson/rljson 0.0.67 → 0.0.69
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/dist/rljson.js +20 -4
- package/dist/tools/time-id.d.ts +12 -0
- package/dist/typedefs.d.ts +1 -1
- package/package.json +12 -12
package/dist/rljson.js
CHANGED
|
@@ -1636,13 +1636,23 @@ const removeDuplicates = (rljson) => {
|
|
|
1636
1636
|
return hip(result, { throwOnWrongHashes: false, updateExistingHashes: true });
|
|
1637
1637
|
};
|
|
1638
1638
|
const timeId = () => {
|
|
1639
|
-
return
|
|
1639
|
+
return Date.now() + ":" + nanoid(4);
|
|
1640
1640
|
};
|
|
1641
1641
|
const isTimeId = (id) => {
|
|
1642
1642
|
const parts = id.split(":");
|
|
1643
1643
|
if (parts.length !== 2) return false;
|
|
1644
|
-
if (isNaN(Number(parts[
|
|
1645
|
-
return parts[
|
|
1644
|
+
if (isNaN(Number(parts[0]))) return false;
|
|
1645
|
+
return parts[1].length === 4;
|
|
1646
|
+
};
|
|
1647
|
+
const getTimeIdTimestamp = (id) => {
|
|
1648
|
+
if (!isTimeId(id)) return null;
|
|
1649
|
+
const parts = id.split(":");
|
|
1650
|
+
return Number(parts[0]);
|
|
1651
|
+
};
|
|
1652
|
+
const getTimeIdUniquePart = (id) => {
|
|
1653
|
+
if (!isTimeId(id)) return null;
|
|
1654
|
+
const parts = id.split(":");
|
|
1655
|
+
return parts[1];
|
|
1646
1656
|
};
|
|
1647
1657
|
const contentTypes = [
|
|
1648
1658
|
"buffets",
|
|
@@ -1652,7 +1662,11 @@ const contentTypes = [
|
|
|
1652
1662
|
"components",
|
|
1653
1663
|
"revisions",
|
|
1654
1664
|
"tableCfgs",
|
|
1655
|
-
"insertHistory"
|
|
1665
|
+
"insertHistory",
|
|
1666
|
+
// Additional types for edits, implemented in DB
|
|
1667
|
+
"edits",
|
|
1668
|
+
"multiEdits",
|
|
1669
|
+
"editsHistory"
|
|
1656
1670
|
];
|
|
1657
1671
|
const exampleTypedefs = () => {
|
|
1658
1672
|
return {
|
|
@@ -2518,6 +2532,8 @@ export {
|
|
|
2518
2532
|
exampleTableCfg,
|
|
2519
2533
|
exampleTableCfgTable,
|
|
2520
2534
|
exampleTypedefs,
|
|
2535
|
+
getTimeIdTimestamp,
|
|
2536
|
+
getTimeIdUniquePart,
|
|
2521
2537
|
isTimeId,
|
|
2522
2538
|
isValidFieldName,
|
|
2523
2539
|
iterateTables,
|
package/dist/tools/time-id.d.ts
CHANGED
|
@@ -15,3 +15,15 @@ export declare const timeId: () => string;
|
|
|
15
15
|
* @returns True if the id is a valid TimeId, false otherwise
|
|
16
16
|
*/
|
|
17
17
|
export declare const isTimeId: (id: string) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts the timestamp from a TimeId.
|
|
20
|
+
* @param id - The TimeId string
|
|
21
|
+
* @returns The timestamp in milliseconds since epoch, or null if the id is not a valid TimeId
|
|
22
|
+
*/
|
|
23
|
+
export declare const getTimeIdTimestamp: (id: string) => number | null;
|
|
24
|
+
/**
|
|
25
|
+
* Extracts the unique part from a TimeId.
|
|
26
|
+
* @param id - The TimeId string
|
|
27
|
+
* @returns The unique identifier part, or null if the id is not a valid TimeId
|
|
28
|
+
*/
|
|
29
|
+
export declare const getTimeIdUniquePart: (id: string) => string | null;
|
package/dist/typedefs.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type ColumnKey = JsonKey;
|
|
|
26
26
|
* - `ids` Tables containing slice ids
|
|
27
27
|
* - `components` Tables containing slice components
|
|
28
28
|
*/
|
|
29
|
-
export declare const contentTypes: readonly ["buffets", "cakes", "layers", "sliceIds", "components", "revisions", "tableCfgs", "insertHistory"];
|
|
29
|
+
export declare const contentTypes: readonly ["buffets", "cakes", "layers", "sliceIds", "components", "revisions", "tableCfgs", "insertHistory", "edits", "multiEdits", "editsHistory"];
|
|
30
30
|
export type ContentType = (typeof contentTypes)[number];
|
|
31
31
|
/**
|
|
32
32
|
* An example object using the typedefs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rljson/rljson",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.69",
|
|
4
4
|
"description": "The RLJSON data format specification",
|
|
5
5
|
"homepage": "https://github.com/rljson/rljson",
|
|
6
6
|
"bugs": "https://github.com/rljson/rljson/issues",
|
|
@@ -20,29 +20,29 @@
|
|
|
20
20
|
],
|
|
21
21
|
"type": "module",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@types/node": "^24.10.
|
|
24
|
-
"@typescript-eslint/eslint-plugin": "^8.46.
|
|
25
|
-
"@typescript-eslint/parser": "^8.46.
|
|
26
|
-
"@vitest/coverage-v8": "^4.0.
|
|
23
|
+
"@types/node": "^24.10.1",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.46.4",
|
|
25
|
+
"@typescript-eslint/parser": "^8.46.4",
|
|
26
|
+
"@vitest/coverage-v8": "^4.0.8",
|
|
27
27
|
"cross-env": "^10.1.0",
|
|
28
28
|
"eslint": "^9.39.1",
|
|
29
29
|
"eslint-plugin-jsdoc": "^61.1.12",
|
|
30
|
-
"eslint-plugin-tsdoc": "^0.
|
|
30
|
+
"eslint-plugin-tsdoc": "^0.5.0",
|
|
31
31
|
"globals": "^16.5.0",
|
|
32
32
|
"jsdoc": "^4.0.5",
|
|
33
|
-
"read-pkg": "^
|
|
33
|
+
"read-pkg": "^10.0.0",
|
|
34
34
|
"typescript": "~5.9.3",
|
|
35
|
-
"typescript-eslint": "^8.46.
|
|
36
|
-
"vite": "^7.2.
|
|
37
|
-
"vite-node": "^
|
|
35
|
+
"typescript-eslint": "^8.46.4",
|
|
36
|
+
"vite": "^7.2.2",
|
|
37
|
+
"vite-node": "^5.0.0",
|
|
38
38
|
"vite-plugin-dts": "^4.5.4",
|
|
39
39
|
"vite-tsconfig-paths": "^5.1.4",
|
|
40
|
-
"vitest": "^4.0.
|
|
40
|
+
"vitest": "^4.0.8",
|
|
41
41
|
"vitest-dom": "^0.1.1"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@rljson/hash": "^0.0.17",
|
|
45
|
-
"@rljson/json": "^0.0.
|
|
45
|
+
"@rljson/json": "^0.0.23",
|
|
46
46
|
"nanoid": "^5.1.6"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|