@spooky-sync/core 0.0.1-canary.138 → 0.0.1-canary.140
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.js
CHANGED
|
@@ -3004,6 +3004,7 @@ var DataModule = class {
|
|
|
3004
3004
|
const record = {
|
|
3005
3005
|
path,
|
|
3006
3006
|
payload: JSON.stringify(payload),
|
|
3007
|
+
status: "pending",
|
|
3007
3008
|
max_retries: options?.max_retries ?? 3,
|
|
3008
3009
|
retry_strategy: options?.retry_strategy ?? "linear"
|
|
3009
3010
|
};
|
|
@@ -5106,8 +5107,8 @@ function parseBackendInfo(raw) {
|
|
|
5106
5107
|
|
|
5107
5108
|
//#endregion
|
|
5108
5109
|
//#region src/modules/devtools/index.ts
|
|
5109
|
-
const CORE_VERSION = "0.0.1-canary.
|
|
5110
|
-
const WASM_VERSION = "0.0.1-canary.
|
|
5110
|
+
const CORE_VERSION = "0.0.1-canary.140";
|
|
5111
|
+
const WASM_VERSION = "0.0.1-canary.140";
|
|
5111
5112
|
const SURREAL_VERSION = "3.0.3";
|
|
5112
5113
|
var DevToolsService = class {
|
|
5113
5114
|
eventsHistory = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spooky-sync/core",
|
|
3
|
-
"version": "0.0.1-canary.
|
|
3
|
+
"version": "0.0.1-canary.140",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@spooky-sync/query-builder": "0.0.1-canary.
|
|
64
|
-
"@spooky-sync/ssp-wasm": "0.0.1-canary.
|
|
63
|
+
"@spooky-sync/query-builder": "0.0.1-canary.140",
|
|
64
|
+
"@spooky-sync/ssp-wasm": "0.0.1-canary.140",
|
|
65
65
|
"@sqlite.org/sqlite-wasm": "3.53.0-build1",
|
|
66
66
|
"@surrealdb/wasm": "^3.0.3",
|
|
67
67
|
"fast-json-patch": "^3.1.1",
|
|
@@ -57,6 +57,7 @@ describe('DataModule.runRecurring', () => {
|
|
|
57
57
|
expect(record.next_run_at).toBeInstanceOf(Date);
|
|
58
58
|
expect(record.assigned_to).toBe(CONN);
|
|
59
59
|
expect(record.path).toBe('/syncGames');
|
|
60
|
+
expect(record.status).toBe('pending');
|
|
60
61
|
expect(JSON.parse(record.payload)).toEqual({ connection: CONN });
|
|
61
62
|
});
|
|
62
63
|
|
|
@@ -103,6 +104,21 @@ describe('DataModule.runRecurring', () => {
|
|
|
103
104
|
});
|
|
104
105
|
});
|
|
105
106
|
|
|
107
|
+
describe('DataModule.run', () => {
|
|
108
|
+
it('creates the one-shot job with status pending so the optimistic row reads in-flight', async () => {
|
|
109
|
+
const { dm, create } = makeDm([]);
|
|
110
|
+
await dm.run('gamesync' as any, '/syncGames' as any, { connection: CONN } as any, { assignedTo: CONN });
|
|
111
|
+
|
|
112
|
+
expect(create).toHaveBeenCalledTimes(1);
|
|
113
|
+
const [id, record] = create.mock.calls[0] as [string, any];
|
|
114
|
+
expect(id.startsWith('job:')).toBe(true);
|
|
115
|
+
// The schema's DEFAULT ALWAYS "pending" only runs server-side; without the
|
|
116
|
+
// explicit field the local optimistic row has status undefined and
|
|
117
|
+
// in-flight indicators miss it until the first server echo.
|
|
118
|
+
expect(record.status).toBe('pending');
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
106
122
|
describe('DataModule.pokeRecurring', () => {
|
|
107
123
|
it('bumps next_run_at on the existing schedule row', async () => {
|
|
108
124
|
const { dm, update } = makeDm([{ id: 'job:x' }]);
|
|
@@ -1205,6 +1205,11 @@ export class DataModule<S extends SchemaStructure> {
|
|
|
1205
1205
|
const record: Record<string, unknown> = {
|
|
1206
1206
|
path,
|
|
1207
1207
|
payload: JSON.stringify(payload),
|
|
1208
|
+
// Set explicitly: the schema's DEFAULT ALWAYS "pending" is server-side
|
|
1209
|
+
// only. An optimistic local create without it surfaces with status
|
|
1210
|
+
// undefined, so in-flight indicators keyed on pending/processing stay
|
|
1211
|
+
// off until the first server echo (seconds on a delayed job).
|
|
1212
|
+
status: 'pending',
|
|
1208
1213
|
max_retries: options?.max_retries ?? 3,
|
|
1209
1214
|
retry_strategy: options?.retry_strategy ?? 'linear',
|
|
1210
1215
|
};
|