@codelia/storage 0.1.47 → 0.1.49
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/index.cjs +16 -5
- package/dist/index.js +16 -5
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -784,7 +784,9 @@ var compactTaskId = (taskId) => {
|
|
|
784
784
|
};
|
|
785
785
|
var assignMissingShellKeys = (tasks) => {
|
|
786
786
|
const usedKeys = new Set(
|
|
787
|
-
tasks.map((task) => task.key).filter(
|
|
787
|
+
tasks.map((task) => task.key).filter(
|
|
788
|
+
(key) => typeof key === "string" && key.length > 0
|
|
789
|
+
)
|
|
788
790
|
);
|
|
789
791
|
const updates = [];
|
|
790
792
|
for (const task of tasks) {
|
|
@@ -795,7 +797,10 @@ var assignMissingShellKeys = (tasks) => {
|
|
|
795
797
|
const compactIdValue = compactTaskId(task.task_id);
|
|
796
798
|
let nextKey = "";
|
|
797
799
|
for (const length of [8, 12, compactIdValue.length]) {
|
|
798
|
-
const suffix = compactIdValue.slice(
|
|
800
|
+
const suffix = compactIdValue.slice(
|
|
801
|
+
0,
|
|
802
|
+
Math.min(length, compactIdValue.length)
|
|
803
|
+
);
|
|
799
804
|
if (!suffix) continue;
|
|
800
805
|
const candidate = `${base}-${suffix}`;
|
|
801
806
|
if (!usedKeys.has(candidate)) {
|
|
@@ -942,8 +947,12 @@ var TaskRegistryStore = class {
|
|
|
942
947
|
const keyBackfills = assignMissingShellKeys(tasks);
|
|
943
948
|
if (keyBackfills.length > 0) {
|
|
944
949
|
await Promise.all(keyBackfills.map(({ next }) => this.upsert(next)));
|
|
945
|
-
const byId = new Map(
|
|
946
|
-
|
|
950
|
+
const byId = new Map(
|
|
951
|
+
keyBackfills.map(({ next }) => [next.task_id, next])
|
|
952
|
+
);
|
|
953
|
+
return sortByUpdatedDesc(
|
|
954
|
+
tasks.map((task) => byId.get(task.task_id) ?? task)
|
|
955
|
+
);
|
|
947
956
|
}
|
|
948
957
|
return sortByUpdatedDesc(tasks);
|
|
949
958
|
}
|
|
@@ -1052,7 +1061,9 @@ ${truncatedLinesSummary}`;
|
|
|
1052
1061
|
var renderPhysicalSnippet = (physicalLines, start, end) => {
|
|
1053
1062
|
const output = [];
|
|
1054
1063
|
for (let index = start; index < end; index += 1) {
|
|
1055
|
-
output.push(
|
|
1064
|
+
output.push(
|
|
1065
|
+
`${formatLineNumber(index + 1)} ${physicalLines[index] ?? ""}`
|
|
1066
|
+
);
|
|
1056
1067
|
}
|
|
1057
1068
|
return output.join("\n");
|
|
1058
1069
|
};
|
package/dist/index.js
CHANGED
|
@@ -739,7 +739,9 @@ var compactTaskId = (taskId) => {
|
|
|
739
739
|
};
|
|
740
740
|
var assignMissingShellKeys = (tasks) => {
|
|
741
741
|
const usedKeys = new Set(
|
|
742
|
-
tasks.map((task) => task.key).filter(
|
|
742
|
+
tasks.map((task) => task.key).filter(
|
|
743
|
+
(key) => typeof key === "string" && key.length > 0
|
|
744
|
+
)
|
|
743
745
|
);
|
|
744
746
|
const updates = [];
|
|
745
747
|
for (const task of tasks) {
|
|
@@ -750,7 +752,10 @@ var assignMissingShellKeys = (tasks) => {
|
|
|
750
752
|
const compactIdValue = compactTaskId(task.task_id);
|
|
751
753
|
let nextKey = "";
|
|
752
754
|
for (const length of [8, 12, compactIdValue.length]) {
|
|
753
|
-
const suffix = compactIdValue.slice(
|
|
755
|
+
const suffix = compactIdValue.slice(
|
|
756
|
+
0,
|
|
757
|
+
Math.min(length, compactIdValue.length)
|
|
758
|
+
);
|
|
754
759
|
if (!suffix) continue;
|
|
755
760
|
const candidate = `${base}-${suffix}`;
|
|
756
761
|
if (!usedKeys.has(candidate)) {
|
|
@@ -897,8 +902,12 @@ var TaskRegistryStore = class {
|
|
|
897
902
|
const keyBackfills = assignMissingShellKeys(tasks);
|
|
898
903
|
if (keyBackfills.length > 0) {
|
|
899
904
|
await Promise.all(keyBackfills.map(({ next }) => this.upsert(next)));
|
|
900
|
-
const byId = new Map(
|
|
901
|
-
|
|
905
|
+
const byId = new Map(
|
|
906
|
+
keyBackfills.map(({ next }) => [next.task_id, next])
|
|
907
|
+
);
|
|
908
|
+
return sortByUpdatedDesc(
|
|
909
|
+
tasks.map((task) => byId.get(task.task_id) ?? task)
|
|
910
|
+
);
|
|
902
911
|
}
|
|
903
912
|
return sortByUpdatedDesc(tasks);
|
|
904
913
|
}
|
|
@@ -1007,7 +1016,9 @@ ${truncatedLinesSummary}`;
|
|
|
1007
1016
|
var renderPhysicalSnippet = (physicalLines, start, end) => {
|
|
1008
1017
|
const output = [];
|
|
1009
1018
|
for (let index = start; index < end; index += 1) {
|
|
1010
|
-
output.push(
|
|
1019
|
+
output.push(
|
|
1020
|
+
`${formatLineNumber(index + 1)} ${physicalLines[index] ?? ""}`
|
|
1021
|
+
);
|
|
1011
1022
|
}
|
|
1012
1023
|
return output.join("\n");
|
|
1013
1024
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/storage",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.49",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20 <25"
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"typecheck": "tsc --noEmit"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@codelia/core": "0.1.
|
|
27
|
-
"@codelia/shared-types": "0.1.
|
|
26
|
+
"@codelia/core": "0.1.49",
|
|
27
|
+
"@codelia/shared-types": "0.1.49",
|
|
28
28
|
"better-sqlite3": "^12.6.2"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|