@quenty/attributeutils 14.17.3 → 14.17.4-canary.11a5dcf.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
|
+
## [14.17.4-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/attributeutils@14.17.3...@quenty/attributeutils@14.17.4-canary.11a5dcf.0) (2025-05-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Additional type checking updates ([05ba29a](https://github.com/Quenty/NevermoreEngine/commit/05ba29a03efc9f3feed74b34f1d9dfb237496214))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [14.17.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/attributeutils@14.17.2...@quenty/attributeutils@14.17.3) (2025-04-10)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/attributeutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/attributeutils",
|
|
3
|
-
"version": "14.17.
|
|
3
|
+
"version": "14.17.4-canary.11a5dcf.0",
|
|
4
4
|
"description": "Provides utility functions to work with attributes in Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/brio": "
|
|
29
|
-
"@quenty/canceltoken": "
|
|
30
|
-
"@quenty/loader": "
|
|
31
|
-
"@quenty/maid": "
|
|
32
|
-
"@quenty/promise": "
|
|
33
|
-
"@quenty/rx": "
|
|
34
|
-
"@quenty/rxsignal": "
|
|
35
|
-
"@quenty/symbol": "
|
|
28
|
+
"@quenty/brio": "14.17.4-canary.11a5dcf.0",
|
|
29
|
+
"@quenty/canceltoken": "11.11.5-canary.11a5dcf.0",
|
|
30
|
+
"@quenty/loader": "10.8.4-canary.11a5dcf.0",
|
|
31
|
+
"@quenty/maid": "3.4.4-canary.11a5dcf.0",
|
|
32
|
+
"@quenty/promise": "10.10.5-canary.11a5dcf.0",
|
|
33
|
+
"@quenty/rx": "13.17.4-canary.11a5dcf.0",
|
|
34
|
+
"@quenty/rxsignal": "7.17.4-canary.11a5dcf.0",
|
|
35
|
+
"@quenty/symbol": "3.4.3-canary.11a5dcf.0"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
|
|
41
41
|
}
|
|
@@ -8,9 +8,9 @@ local require = require(script.Parent.loader).load(script)
|
|
|
8
8
|
|
|
9
9
|
local RunService = game:GetService("RunService")
|
|
10
10
|
|
|
11
|
+
local CancelToken = require("CancelToken")
|
|
11
12
|
local Maid = require("Maid")
|
|
12
13
|
local Promise = require("Promise")
|
|
13
|
-
local CancelToken = require("CancelToken")
|
|
14
14
|
|
|
15
15
|
local DEFAULT_PREDICATE = function(value)
|
|
16
16
|
return value ~= nil
|
|
@@ -62,9 +62,14 @@ end
|
|
|
62
62
|
@param attributeName string
|
|
63
63
|
@param predicate function | nil
|
|
64
64
|
@param cancelToken CancelToken
|
|
65
|
-
@return Promise<
|
|
65
|
+
@return Promise<unknown>
|
|
66
66
|
]=]
|
|
67
|
-
function AttributeUtils.promiseAttribute(
|
|
67
|
+
function AttributeUtils.promiseAttribute(
|
|
68
|
+
instance: Instance,
|
|
69
|
+
attributeName: string,
|
|
70
|
+
predicate,
|
|
71
|
+
cancelToken: CancelToken.CancelToken?
|
|
72
|
+
): Promise.Promise<unknown>
|
|
68
73
|
assert(typeof(instance) == "Instance", "Bad instance")
|
|
69
74
|
assert(type(attributeName) == "string", "Bad attributeName")
|
|
70
75
|
assert(CancelToken.isCancelToken(cancelToken) or cancelToken == nil, "Bad cancelToken")
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
|
|
20
20
|
local require = require(script.Parent.loader).load(script)
|
|
21
21
|
|
|
22
|
+
local Brio = require("Brio")
|
|
23
|
+
local Observable = require("Observable")
|
|
24
|
+
local Rx = require("Rx")
|
|
22
25
|
local RxAttributeUtils = require("RxAttributeUtils")
|
|
23
|
-
local _Observable = require("Observable")
|
|
24
|
-
local _Brio = require("Brio")
|
|
25
|
-
local _Rx = require("Rx")
|
|
26
26
|
|
|
27
27
|
local AttributeValue = {}
|
|
28
28
|
AttributeValue.ClassName = "AttributeValue"
|
|
@@ -76,8 +76,8 @@ end
|
|
|
76
76
|
]=]
|
|
77
77
|
function AttributeValue.ObserveBrio<T>(
|
|
78
78
|
self: AttributeValue<T>,
|
|
79
|
-
condition:
|
|
80
|
-
):
|
|
79
|
+
condition: Rx.Predicate<T>?
|
|
80
|
+
): Observable.Observable<Brio.Brio<any>>
|
|
81
81
|
return RxAttributeUtils.observeAttributeBrio(self._object, self._attributeName, condition)
|
|
82
82
|
end
|
|
83
83
|
|
|
@@ -85,7 +85,7 @@ end
|
|
|
85
85
|
Observes an attribute on an instance.
|
|
86
86
|
@return Observable<any>
|
|
87
87
|
]=]
|
|
88
|
-
function AttributeValue.Observe<T>(self: AttributeValue<T>):
|
|
88
|
+
function AttributeValue.Observe<T>(self: AttributeValue<T>): Observable.Observable<T>
|
|
89
89
|
return RxAttributeUtils.observeAttribute(self._object, self._attributeName, rawget(self :: any, "_defaultValue"))
|
|
90
90
|
end
|
|
91
91
|
|
|
@@ -132,4 +132,4 @@ function AttributeValue.__newindex<T>(self: AttributeValue<T>, index, value)
|
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
-
return AttributeValue
|
|
135
|
+
return AttributeValue
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
-
local RxAttributeUtils = require("RxAttributeUtils")
|
|
10
9
|
local Rx = require("Rx")
|
|
10
|
+
local RxAttributeUtils = require("RxAttributeUtils")
|
|
11
11
|
local RxBrioUtils = require("RxBrioUtils")
|
|
12
12
|
|
|
13
13
|
local EncodedAttributeValue = {}
|
|
@@ -25,17 +25,17 @@ EncodedAttributeValue.__index = EncodedAttributeValue
|
|
|
25
25
|
@param defaultValue T?
|
|
26
26
|
@return EncodedAttributeValue<T, TValue>
|
|
27
27
|
]=]
|
|
28
|
-
function EncodedAttributeValue.new(object, attributeName, encode, decode, defaultValue)
|
|
28
|
+
function EncodedAttributeValue.new(object: Instance, attributeName: string, encode, decode, defaultValue)
|
|
29
29
|
assert(typeof(object) == "Instance", "Bad object")
|
|
30
30
|
assert(type(attributeName) == "string", "Bad attributeName")
|
|
31
31
|
assert(type(decode) == "function", "Bad decode")
|
|
32
32
|
assert(type(encode) == "function", "Bad encode")
|
|
33
33
|
|
|
34
34
|
local self = {
|
|
35
|
-
_object = object
|
|
36
|
-
_attributeName = attributeName
|
|
37
|
-
_decode = decode
|
|
38
|
-
_encode = encode
|
|
35
|
+
_object = object,
|
|
36
|
+
_attributeName = attributeName,
|
|
37
|
+
_decode = decode,
|
|
38
|
+
_encode = encode,
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if defaultValue ~= nil and self._object:GetAttribute(self._attributeName) == nil then
|
|
@@ -52,7 +52,7 @@ end
|
|
|
52
52
|
]=]
|
|
53
53
|
function EncodedAttributeValue:ObserveBrio(condition)
|
|
54
54
|
return RxAttributeUtils.observeAttributeBrio(self._object, self._attributeName, condition):Pipe({
|
|
55
|
-
RxBrioUtils.map(rawget(self, "_decode"))
|
|
55
|
+
RxBrioUtils.map(rawget(self, "_decode")),
|
|
56
56
|
})
|
|
57
57
|
end
|
|
58
58
|
|
|
@@ -62,7 +62,7 @@ end
|
|
|
62
62
|
]=]
|
|
63
63
|
function EncodedAttributeValue:Observe()
|
|
64
64
|
return RxAttributeUtils.observeAttribute(self._object, self._attributeName, rawget(self, "_defaultValue")):Pipe({
|
|
65
|
-
Rx.map(rawget(self, "_decode"))
|
|
65
|
+
Rx.map(rawget(self, "_decode")),
|
|
66
66
|
})
|
|
67
67
|
end
|
|
68
68
|
|
|
@@ -109,4 +109,4 @@ function EncodedAttributeValue:__newindex(index, value)
|
|
|
109
109
|
end
|
|
110
110
|
end
|
|
111
111
|
|
|
112
|
-
return EncodedAttributeValue
|
|
112
|
+
return EncodedAttributeValue
|
|
@@ -12,7 +12,14 @@ local JSONAttributeValue = setmetatable({}, BaseObject)
|
|
|
12
12
|
JSONAttributeValue.ClassName = "JSONAttributeValue"
|
|
13
13
|
JSONAttributeValue.__index = JSONAttributeValue
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
--[=[
|
|
16
|
+
Constructs a new JSONAttributeValue
|
|
17
|
+
@param object Instance
|
|
18
|
+
@param attributeName string
|
|
19
|
+
@param defaultValue any
|
|
20
|
+
@return JSONAttributeValue
|
|
21
|
+
]=]
|
|
22
|
+
function JSONAttributeValue.new(object: Instance, attributeName: string, defaultValue: any)
|
|
16
23
|
return EncodedAttributeValue.new(object, attributeName, function(value)
|
|
17
24
|
if type(value) == "table" or type(value) == "string" then
|
|
18
25
|
return HttpService:JSONEncode(value)
|
|
@@ -28,4 +35,4 @@ function JSONAttributeValue.new(object, attributeName, defaultValue)
|
|
|
28
35
|
end, defaultValue)
|
|
29
36
|
end
|
|
30
37
|
|
|
31
|
-
return JSONAttributeValue
|
|
38
|
+
return JSONAttributeValue
|
|
@@ -9,8 +9,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
9
9
|
local Brio = require("Brio")
|
|
10
10
|
local Maid = require("Maid")
|
|
11
11
|
local Observable = require("Observable")
|
|
12
|
+
local Rx = require("Rx")
|
|
12
13
|
local Symbol = require("Symbol")
|
|
13
|
-
local _Rx = require("Rx")
|
|
14
14
|
|
|
15
15
|
local UNSET_VALUE = Symbol.named("unsetValue")
|
|
16
16
|
|
|
@@ -130,7 +130,11 @@ end
|
|
|
130
130
|
@param condition function | nil
|
|
131
131
|
@return Observable<Brio<any>>
|
|
132
132
|
]=]
|
|
133
|
-
function RxAttributeUtils.observeAttributeBrio<T>(
|
|
133
|
+
function RxAttributeUtils.observeAttributeBrio<T>(
|
|
134
|
+
instance: Instance,
|
|
135
|
+
attributeName: string,
|
|
136
|
+
condition: Rx.Predicate<T>?
|
|
137
|
+
): Observable.Observable<Brio.Brio<T>>
|
|
134
138
|
assert(typeof(instance) == "Instance", "Bad instance")
|
|
135
139
|
assert(type(attributeName) == "string", "Bad attributeName")
|
|
136
140
|
|
|
@@ -168,4 +172,4 @@ function RxAttributeUtils.observeAttributeBrio<T>(instance: Instance, attributeN
|
|
|
168
172
|
end) :: any
|
|
169
173
|
end
|
|
170
174
|
|
|
171
|
-
return RxAttributeUtils
|
|
175
|
+
return RxAttributeUtils
|