@use-stall/core 0.0.6 → 0.0.8
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 +7 -9
- package/dist/index.mjs +2 -4
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -134,10 +134,9 @@ var getAdapter = async (sdk, force) => {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
// src/db/helpers.ts
|
|
137
|
-
var
|
|
138
|
-
var uuid = () => (0, import_crypto.randomUUID)();
|
|
137
|
+
var import_uuid = require("uuid");
|
|
139
138
|
var generate_offline_id = (table) => {
|
|
140
|
-
return `stall_${table}_${
|
|
139
|
+
return `stall_${table}_${(0, import_uuid.v4)()}_${Date.now()}`;
|
|
141
140
|
};
|
|
142
141
|
var save_bulk_data = async (props) => {
|
|
143
142
|
await local_db.transaction("rw", props.table, async () => {
|
|
@@ -149,7 +148,7 @@ var save_bulk_data = async (props) => {
|
|
|
149
148
|
};
|
|
150
149
|
var add_to_sync_queue = async (props) => {
|
|
151
150
|
const queue_item = {
|
|
152
|
-
id:
|
|
151
|
+
id: (0, import_uuid.v4)(),
|
|
153
152
|
action: props.action,
|
|
154
153
|
table: props.table,
|
|
155
154
|
document_id: props.document_id,
|
|
@@ -191,7 +190,7 @@ var remove_from_sync_queue = async (id) => {
|
|
|
191
190
|
};
|
|
192
191
|
var add_sync_log = async (props) => {
|
|
193
192
|
const log = {
|
|
194
|
-
id:
|
|
193
|
+
id: (0, import_uuid.v4)(),
|
|
195
194
|
sync_batch_id: props.sync_batch_id,
|
|
196
195
|
table: props.table,
|
|
197
196
|
action: props.action,
|
|
@@ -3753,7 +3752,7 @@ var fulfillments = {
|
|
|
3753
3752
|
};
|
|
3754
3753
|
|
|
3755
3754
|
// src/services/sync/sync.service.ts
|
|
3756
|
-
var
|
|
3755
|
+
var import_uuid2 = require("uuid");
|
|
3757
3756
|
|
|
3758
3757
|
// src/services/sync/sync-dependencies.ts
|
|
3759
3758
|
var SYNC_DEPENDENCY_LAYERS = {
|
|
@@ -3828,7 +3827,6 @@ var are_dependencies_satisfied = (table, synced_tables) => {
|
|
|
3828
3827
|
};
|
|
3829
3828
|
|
|
3830
3829
|
// src/services/sync/sync.service.ts
|
|
3831
|
-
var uuid2 = () => (0, import_crypto2.randomUUID)();
|
|
3832
3830
|
var MAX_RETRIES = 3;
|
|
3833
3831
|
var replace_temporary_ids = async (props) => {
|
|
3834
3832
|
const { table, stall_offline_id, connector_id, local_data } = props;
|
|
@@ -3986,7 +3984,7 @@ var sync_queue_item = async (props) => {
|
|
|
3986
3984
|
};
|
|
3987
3985
|
var process_sync_queue = async (props) => {
|
|
3988
3986
|
const { sdk } = props;
|
|
3989
|
-
const sync_batch_id =
|
|
3987
|
+
const sync_batch_id = (0, import_uuid2.v4)();
|
|
3990
3988
|
try {
|
|
3991
3989
|
const pending_items_by_table = await get_pending_sync_queue();
|
|
3992
3990
|
if (pending_items_by_table.size === 0) {
|
|
@@ -4143,7 +4141,7 @@ var trigger_sync = async (props) => {
|
|
|
4143
4141
|
} catch (error) {
|
|
4144
4142
|
console.error("Error triggering sync:", error);
|
|
4145
4143
|
return {
|
|
4146
|
-
sync_batch_id:
|
|
4144
|
+
sync_batch_id: (0, import_uuid2.v4)(),
|
|
4147
4145
|
total: 0,
|
|
4148
4146
|
synced: 0,
|
|
4149
4147
|
failed: 0,
|
package/dist/index.mjs
CHANGED
|
@@ -70,8 +70,7 @@ var getAdapter = async (sdk, force) => {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
// src/db/helpers.ts
|
|
73
|
-
import {
|
|
74
|
-
var uuid = () => randomUUID();
|
|
73
|
+
import { v4 as uuid } from "uuid";
|
|
75
74
|
var generate_offline_id = (table) => {
|
|
76
75
|
return `stall_${table}_${uuid()}_${Date.now()}`;
|
|
77
76
|
};
|
|
@@ -3689,7 +3688,7 @@ var fulfillments = {
|
|
|
3689
3688
|
};
|
|
3690
3689
|
|
|
3691
3690
|
// src/services/sync/sync.service.ts
|
|
3692
|
-
import {
|
|
3691
|
+
import { v4 as uuid2 } from "uuid";
|
|
3693
3692
|
|
|
3694
3693
|
// src/services/sync/sync-dependencies.ts
|
|
3695
3694
|
var SYNC_DEPENDENCY_LAYERS = {
|
|
@@ -3764,7 +3763,6 @@ var are_dependencies_satisfied = (table, synced_tables) => {
|
|
|
3764
3763
|
};
|
|
3765
3764
|
|
|
3766
3765
|
// src/services/sync/sync.service.ts
|
|
3767
|
-
var uuid2 = () => randomUUID2();
|
|
3768
3766
|
var MAX_RETRIES = 3;
|
|
3769
3767
|
var replace_temporary_ids = async (props) => {
|
|
3770
3768
|
const { table, stall_offline_id, connector_id, local_data } = props;
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@use-stall/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"author": "Stall",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
|
-
"type": "commonjs",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
7
|
"devDependencies": {
|
|
10
8
|
"@types/node": "^24.10.2",
|
|
11
|
-
"@use-stall/types": "^0.2.
|
|
9
|
+
"@use-stall/types": "^0.2.9",
|
|
12
10
|
"dexie": "^4.2.1",
|
|
13
11
|
"tsup": "^8.5.1",
|
|
14
|
-
"typescript": "^5.9.3"
|
|
12
|
+
"typescript": "^5.9.3",
|
|
13
|
+
"uuid": "^13.0.0"
|
|
15
14
|
},
|
|
16
15
|
"description": "Stall core package with all the utilities needed to access the Stall API",
|
|
17
16
|
"homepage": "https://github.com/use-stall/core",
|
|
@@ -25,5 +24,7 @@
|
|
|
25
24
|
"license": "MIT",
|
|
26
25
|
"scripts": {
|
|
27
26
|
"build": "tsup"
|
|
28
|
-
}
|
|
27
|
+
},
|
|
28
|
+
"type": "commonjs",
|
|
29
|
+
"types": "./dist/index.d.ts"
|
|
29
30
|
}
|