@quenty/aggregator 1.4.0 → 1.4.1
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 +11 -0
- package/package.json +9 -9
- package/src/Shared/Aggregator.lua +16 -16
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
|
+
## [1.4.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/aggregator@1.4.0...@quenty/aggregator@1.4.1) (2025-04-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [1.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/aggregator@1.3.2...@quenty/aggregator@1.4.0) (2025-04-02)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/aggregator
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/aggregator",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Aggregates async promise requests",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/baseobject": "^10.8.
|
|
29
|
-
"@quenty/loader": "^10.8.
|
|
30
|
-
"@quenty/lrucache": "^1.6.
|
|
31
|
-
"@quenty/promise": "^10.10.
|
|
32
|
-
"@quenty/queue": "^2.3.
|
|
33
|
-
"@quenty/rx": "^13.17.
|
|
34
|
-
"@quenty/tuple": "^1.5.
|
|
28
|
+
"@quenty/baseobject": "^10.8.1",
|
|
29
|
+
"@quenty/loader": "^10.8.1",
|
|
30
|
+
"@quenty/lrucache": "^1.6.1",
|
|
31
|
+
"@quenty/promise": "^10.10.2",
|
|
32
|
+
"@quenty/queue": "^2.3.1",
|
|
33
|
+
"@quenty/rx": "^13.17.1",
|
|
34
|
+
"@quenty/tuple": "^1.5.1"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "78c3ac0ab08dd18085b6e6e6e4f745e76ed99f68"
|
|
40
40
|
}
|
|
@@ -55,7 +55,7 @@ end
|
|
|
55
55
|
@param id number
|
|
56
56
|
@return Promise<T>
|
|
57
57
|
]=]
|
|
58
|
-
function Aggregator:Promise(id)
|
|
58
|
+
function Aggregator:Promise(id: number)
|
|
59
59
|
assert(type(id) == "number", "Bad id")
|
|
60
60
|
|
|
61
61
|
local found = self._promisesLruCache:get(id)
|
|
@@ -80,7 +80,7 @@ end
|
|
|
80
80
|
@param id number
|
|
81
81
|
@return Observable<T>
|
|
82
82
|
]=]
|
|
83
|
-
function Aggregator:Observe(id)
|
|
83
|
+
function Aggregator:Observe(id: number)
|
|
84
84
|
assert(type(id) == "number", "Bad id")
|
|
85
85
|
|
|
86
86
|
return Rx.fromPromise(self:Promise(id))
|
|
@@ -91,7 +91,7 @@ function Aggregator:_sendBatchedPromises(promiseMap)
|
|
|
91
91
|
|
|
92
92
|
local idList = {}
|
|
93
93
|
local unresolvedMap = {}
|
|
94
|
-
for id, promise in
|
|
94
|
+
for id, promise in promiseMap do
|
|
95
95
|
table.insert(idList, id)
|
|
96
96
|
unresolvedMap[id] = promise
|
|
97
97
|
end
|
|
@@ -104,25 +104,25 @@ function Aggregator:_sendBatchedPromises(promiseMap)
|
|
|
104
104
|
|
|
105
105
|
self._maid:GivePromise(self._promiseBatchQuery(idList))
|
|
106
106
|
:Then(function(result)
|
|
107
|
-
|
|
107
|
+
assert(type(result) == "table", "Bad result")
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
for _, data in result do
|
|
110
|
+
assert(type(data.Id) == "number", "Bad result[?].Id")
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
end
|
|
112
|
+
if unresolvedMap[data.Id] then
|
|
113
|
+
unresolvedMap[data.Id]:Resolve(data)
|
|
114
|
+
unresolvedMap[data.Id] = nil
|
|
116
115
|
end
|
|
116
|
+
end
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
118
|
+
-- Reject other ones
|
|
119
|
+
for id, promise in unresolvedMap do
|
|
120
|
+
promise:Reject(string.format("[Aggregator] %s failed to get result for id %d", self._debugName, id))
|
|
121
|
+
end
|
|
122
122
|
end, function(err, ...)
|
|
123
|
-
|
|
123
|
+
local text = string.format("[Aggregator] %s failed to get bulk result - %q", self._debugName, tostring(err))
|
|
124
124
|
|
|
125
|
-
for _, item in
|
|
125
|
+
for _, item in unresolvedMap do
|
|
126
126
|
item:Reject(text, ...)
|
|
127
127
|
end
|
|
128
128
|
end)
|