@quenty/datastore 13.6.0 → 13.7.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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [13.7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@13.6.0...@quenty/datastore@13.7.0) (2024-09-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Unedited all changes ([60e64e3](https://github.com/Quenty/NevermoreEngine/commit/60e64e3efce17c10c4b8965871187d231b338dd4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [13.6.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/datastore@13.5.0...@quenty/datastore@13.6.0) (2024-08-09)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/datastore
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/datastore",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.7.0",
|
|
4
4
|
"description": "Quenty's Datastore implementation for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/baseobject": "^10.
|
|
30
|
-
"@quenty/bindtocloseservice": "^8.
|
|
31
|
-
"@quenty/loader": "^10.
|
|
32
|
-
"@quenty/maid": "^3.
|
|
29
|
+
"@quenty/baseobject": "^10.4.0",
|
|
30
|
+
"@quenty/bindtocloseservice": "^8.5.0",
|
|
31
|
+
"@quenty/loader": "^10.4.0",
|
|
32
|
+
"@quenty/maid": "^3.3.0",
|
|
33
33
|
"@quenty/math": "^2.7.0",
|
|
34
|
-
"@quenty/promise": "^10.
|
|
35
|
-
"@quenty/rx": "^13.
|
|
36
|
-
"@quenty/servicebag": "^11.
|
|
37
|
-
"@quenty/signal": "^7.
|
|
34
|
+
"@quenty/promise": "^10.4.0",
|
|
35
|
+
"@quenty/rx": "^13.5.0",
|
|
36
|
+
"@quenty/servicebag": "^11.5.0",
|
|
37
|
+
"@quenty/signal": "^7.4.0",
|
|
38
38
|
"@quenty/symbol": "^3.1.0",
|
|
39
39
|
"@quenty/table": "^3.5.0",
|
|
40
|
-
"@quenty/valueobject": "^13.
|
|
40
|
+
"@quenty/valueobject": "^13.5.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "fb172906f3ee725269ec1e5f4daf9dca227e729d"
|
|
46
46
|
}
|
|
@@ -35,7 +35,7 @@ function GameDataStoreService:PromiseDataStore()
|
|
|
35
35
|
-- Live sync this stuff pretty frequently
|
|
36
36
|
local dataStore = DataStore.new(robloxDataStore, self:_getKey())
|
|
37
37
|
dataStore:SetSyncOnSave(true)
|
|
38
|
-
dataStore:SetAutoSaveTimeSeconds(
|
|
38
|
+
dataStore:SetAutoSaveTimeSeconds(5)
|
|
39
39
|
|
|
40
40
|
self._maid:GiveTask(self._bindToCloseService:RegisterPromiseOnCloseCallback(function()
|
|
41
41
|
return Promise.defer(function(resolve)
|
|
@@ -57,11 +57,8 @@ function DataStoreStage.new(loadName, loadParent)
|
|
|
57
57
|
self._loadName = loadName
|
|
58
58
|
self._loadParent = loadParent
|
|
59
59
|
|
|
60
|
-
self.Changed = GoodSignal.new() -- :Fire(viewSnapshot)
|
|
61
|
-
self._maid:
|
|
62
|
-
|
|
63
|
-
self.DataStored = GoodSignal.new()
|
|
64
|
-
self._maid:GiveTask(self.DataStored)
|
|
60
|
+
self.Changed = self._maid:Add(GoodSignal.new()) -- :Fire(viewSnapshot)
|
|
61
|
+
self.DataStored = self._maid:Add(GoodSignal.new())
|
|
65
62
|
|
|
66
63
|
-- Stores the actual data loaded and synced (but not pending written data)
|
|
67
64
|
self._saveDataSnapshot = nil
|
|
@@ -73,8 +70,7 @@ function DataStoreStage.new(loadName, loadParent)
|
|
|
73
70
|
|
|
74
71
|
self._savingCallbacks = {} -- [func, ...]
|
|
75
72
|
|
|
76
|
-
self._keySubscriptions = ObservableSubscriptionTable.new()
|
|
77
|
-
self._maid:GiveTask(self._keySubscriptions)
|
|
73
|
+
self._keySubscriptions = self._maid:Add(ObservableSubscriptionTable.new())
|
|
78
74
|
|
|
79
75
|
return self
|
|
80
76
|
end
|
|
@@ -279,6 +275,7 @@ function DataStoreStage:Observe(key, defaultValue)
|
|
|
279
275
|
local maid = Maid.new()
|
|
280
276
|
|
|
281
277
|
maid:GiveTask(self._keySubscriptions:Observe(key):Subscribe(function(value)
|
|
278
|
+
print()
|
|
282
279
|
if value == nil then
|
|
283
280
|
sub:Fire(defaultValue)
|
|
284
281
|
else
|
|
@@ -610,7 +607,7 @@ function DataStoreStage:HasWritableData()
|
|
|
610
607
|
|
|
611
608
|
for name, store in pairs(self._stores) do
|
|
612
609
|
if not store.Destroy then
|
|
613
|
-
warn(("[DataStoreStage] - Substore %q destroyed"
|
|
610
|
+
warn(string.format("[DataStoreStage] - Substore %q destroyed", name))
|
|
614
611
|
continue
|
|
615
612
|
end
|
|
616
613
|
|
|
@@ -799,7 +796,7 @@ function DataStoreStage:_updateViewSnapshot()
|
|
|
799
796
|
end
|
|
800
797
|
end
|
|
801
798
|
|
|
802
|
-
self.Changed:Fire(
|
|
799
|
+
self.Changed:Fire(newViewSnapshot)
|
|
803
800
|
end
|
|
804
801
|
|
|
805
802
|
self:_checkIntegrity()
|
|
@@ -844,11 +841,11 @@ function DataStoreStage:_updateViewSnapshotAtKey(key)
|
|
|
844
841
|
|
|
845
842
|
local newSnapshot = table.clone(self._viewSnapshot)
|
|
846
843
|
newSnapshot[key] = newValue
|
|
844
|
+
newSnapshot = table.freeze(newSnapshot)
|
|
847
845
|
|
|
848
|
-
|
|
849
|
-
self._viewSnapshot = table.freeze(newSnapshot)
|
|
846
|
+
self._viewSnapshot = newSnapshot
|
|
850
847
|
self._keySubscriptions:Fire(key, newValue)
|
|
851
|
-
self.Changed:Fire(
|
|
848
|
+
self.Changed:Fire(newSnapshot)
|
|
852
849
|
|
|
853
850
|
self:_checkIntegrity()
|
|
854
851
|
end
|
|
@@ -886,7 +883,7 @@ function DataStoreStage:_computeNewViewSnapshot()
|
|
|
886
883
|
end
|
|
887
884
|
|
|
888
885
|
if next(newView) == nil and not (type(self._baseDataSnapshot) == "table" or type(self._saveDataSnapshot) == "table") then
|
|
889
|
-
-- We
|
|
886
|
+
-- We have no reason to be a table, make sure we return nil
|
|
890
887
|
return nil
|
|
891
888
|
end
|
|
892
889
|
|
|
@@ -173,11 +173,7 @@ function DataStoreWriter:_computeTableDiff(original, incoming)
|
|
|
173
173
|
if not DataStoreSnapshotUtils.isEmptySnapshot(diffSnapshot) then
|
|
174
174
|
return table.freeze(diffSnapshot)
|
|
175
175
|
else
|
|
176
|
-
|
|
177
|
-
return nil -- No delta
|
|
178
|
-
else
|
|
179
|
-
return DataStoreDeleteToken
|
|
180
|
-
end
|
|
176
|
+
return nil
|
|
181
177
|
end
|
|
182
178
|
end
|
|
183
179
|
|
|
@@ -21,13 +21,12 @@ PlayerDataStoreService.ServiceName = "PlayerDataStoreService"
|
|
|
21
21
|
]=]
|
|
22
22
|
function PlayerDataStoreService:Init(serviceBag)
|
|
23
23
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
24
|
-
|
|
25
24
|
self._maid = Maid.new()
|
|
26
25
|
|
|
27
26
|
-- External
|
|
28
27
|
self._bindToCloseService = self._serviceBag:GetService(require("BindToCloseService"))
|
|
29
28
|
|
|
30
|
-
self.
|
|
29
|
+
self._promiseStarted = self._maid:Add(Promise.new())
|
|
31
30
|
|
|
32
31
|
self._dataStoreName = "PlayerData"
|
|
33
32
|
self._dataStoreScope = "SaveData"
|
|
@@ -38,7 +37,7 @@ end
|
|
|
38
37
|
]=]
|
|
39
38
|
function PlayerDataStoreService:Start()
|
|
40
39
|
-- Give time for configuration
|
|
41
|
-
self.
|
|
40
|
+
self._promiseStarted:Resolve()
|
|
42
41
|
end
|
|
43
42
|
|
|
44
43
|
--[=[
|
|
@@ -52,8 +51,8 @@ end
|
|
|
52
51
|
]=]
|
|
53
52
|
function PlayerDataStoreService:SetDataStoreName(dataStoreName)
|
|
54
53
|
assert(type(dataStoreName) == "string", "Bad dataStoreName")
|
|
55
|
-
assert(self.
|
|
56
|
-
assert(self.
|
|
54
|
+
assert(self._promiseStarted, "Not initialized")
|
|
55
|
+
assert(self._promiseStarted:IsPending(), "Already started, cannot configure")
|
|
57
56
|
|
|
58
57
|
self._dataStoreName = dataStoreName
|
|
59
58
|
end
|
|
@@ -69,8 +68,8 @@ end
|
|
|
69
68
|
]=]
|
|
70
69
|
function PlayerDataStoreService:SetDataStoreScope(dataStoreScope)
|
|
71
70
|
assert(type(dataStoreScope) == "string", "Bad dataStoreScope")
|
|
72
|
-
assert(self.
|
|
73
|
-
assert(self.
|
|
71
|
+
assert(self._promiseStarted, "Not initialized")
|
|
72
|
+
assert(self._promiseStarted:IsPending(), "Already started, cannot configure")
|
|
74
73
|
|
|
75
74
|
self._dataStoreScope = dataStoreScope
|
|
76
75
|
end
|
|
@@ -108,7 +107,7 @@ function PlayerDataStoreService:PromiseManager()
|
|
|
108
107
|
return self._dataStoreManagerPromise
|
|
109
108
|
end
|
|
110
109
|
|
|
111
|
-
self._dataStoreManagerPromise = self.
|
|
110
|
+
self._dataStoreManagerPromise = self._promiseStarted
|
|
112
111
|
:Then(function()
|
|
113
112
|
return DataStorePromises.promiseDataStore(self._dataStoreName, self._dataStoreScope)
|
|
114
113
|
end)
|