sliftutils 0.69.0 → 0.71.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/.cursorrules +17 -0
- package/index.d.ts +5 -0
- package/misc/helpers.d.ts +1 -0
- package/misc/helpers.ts +10 -0
- package/package.json +1 -1
- package/storage/TransactionStorage.ts +3 -3
package/.cursorrules
CHANGED
|
@@ -114,6 +114,23 @@ Components
|
|
|
114
114
|
URLParam, Parameters which are stored in the URL. The second argument is the default, which can be a number, string, or an object. Set and get with .value
|
|
115
115
|
const todolistURL = new URLParam("todolist", "");
|
|
116
116
|
|
|
117
|
+
InputLabel and InputLabelURL should be used for inputs. For example:
|
|
118
|
+
<InputLabelURL
|
|
119
|
+
label="Show Previous Video"
|
|
120
|
+
checkbox
|
|
121
|
+
persisted={showPreviousVideoURL}
|
|
122
|
+
/>
|
|
123
|
+
<InputLabel
|
|
124
|
+
label="Notes"
|
|
125
|
+
fillWidth
|
|
126
|
+
value={node.notes || ""}
|
|
127
|
+
onChangeValue={async (value) => {
|
|
128
|
+
const updatedNode = deepCloneJSON(node);
|
|
129
|
+
updatedNode.notes = value;
|
|
130
|
+
await VideoNode.set(node.id, updatedNode);
|
|
131
|
+
}}
|
|
132
|
+
/>
|
|
133
|
+
|
|
117
134
|
API Calls
|
|
118
135
|
When in an event callback (which must be async)
|
|
119
136
|
APIController(getExtNodeId()).getModels.promise()
|
package/index.d.ts
CHANGED
|
@@ -49,6 +49,11 @@ declare module "sliftutils/misc/getSecret" {
|
|
|
49
49
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
declare module "sliftutils/misc/helpers" {
|
|
53
|
+
export declare function waitForDiskCollectionFlush(): Promise<void>;
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
52
57
|
declare module "sliftutils/misc/matchFilter" {
|
|
53
58
|
export declare function matchFilter(filter: {
|
|
54
59
|
value: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function waitForDiskCollectionFlush(): Promise<void>;
|
package/misc/helpers.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { delay } from "socket-function/src/batching";
|
|
2
|
+
import { hasPending } from "../storage/PendingManager";
|
|
3
|
+
|
|
4
|
+
export async function waitForDiskCollectionFlush() {
|
|
5
|
+
await delay(2000);
|
|
6
|
+
while (hasPending()) {
|
|
7
|
+
console.log("Waiting for pending operations to complete...");
|
|
8
|
+
await delay(2000);
|
|
9
|
+
}
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -112,7 +112,7 @@ export class TransactionStorage implements IStorage<Buffer> {
|
|
|
112
112
|
this.resyncCallbacks.push(callback);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
private init: Promise<unknown> | undefined = this.loadAllTransactions();
|
|
115
|
+
private init: Promise<unknown> | undefined = this.loadAllTransactions(true);
|
|
116
116
|
|
|
117
117
|
private getCurrentChunk(): string {
|
|
118
118
|
if (this.currentChunk && this.currentChunk.timeCreated < Date.now() - FILE_MAX_LIFETIME) {
|
|
@@ -285,10 +285,10 @@ export class TransactionStorage implements IStorage<Buffer> {
|
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
// NOTE: This is either called in init (which blocks all other calls), or inside of the global file lock, so it is safe to load.
|
|
288
|
-
private async loadAllTransactions(): Promise<string[]> {
|
|
288
|
+
private async loadAllTransactions(initialLoad?: boolean): Promise<string[]> {
|
|
289
289
|
if (isInBuild()) return [];
|
|
290
290
|
|
|
291
|
-
if (
|
|
291
|
+
if (initialLoad) {
|
|
292
292
|
runInfinitePoll(DISK_CHECK_INTERVAL, () => this.checkDisk());
|
|
293
293
|
}
|
|
294
294
|
|