@quenty/adorneedata 7.18.3 → 7.18.4-canary.559.339cfa7.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 +11 -0
- package/package.json +9 -9
- package/src/Shared/AdorneeDataEntry.lua +27 -14
- package/src/Shared/AdorneeDataValue.lua +6 -6
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
|
+
## [7.18.4-canary.559.339cfa7.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneedata@7.18.3...@quenty/adorneedata@7.18.4-canary.559.339cfa7.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
|
## [7.18.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneedata@7.18.2...@quenty/adorneedata@7.18.3) (2025-04-10)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/adorneedata
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/adorneedata",
|
|
3
|
-
"version": "7.18.
|
|
3
|
+
"version": "7.18.4-canary.559.339cfa7.0",
|
|
4
4
|
"description": "Bridges attributes and serialization",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/attributeutils": "
|
|
29
|
-
"@quenty/defaultvalueutils": "
|
|
30
|
-
"@quenty/ducktype": "
|
|
31
|
-
"@quenty/loader": "
|
|
32
|
-
"@quenty/rx": "
|
|
33
|
-
"@quenty/rxsignal": "
|
|
34
|
-
"@quenty/table": "
|
|
28
|
+
"@quenty/attributeutils": "14.17.4-canary.559.339cfa7.0",
|
|
29
|
+
"@quenty/defaultvalueutils": "1.2.2",
|
|
30
|
+
"@quenty/ducktype": "5.8.5-canary.559.339cfa7.0",
|
|
31
|
+
"@quenty/loader": "10.8.4-canary.559.339cfa7.0",
|
|
32
|
+
"@quenty/rx": "13.17.4-canary.559.339cfa7.0",
|
|
33
|
+
"@quenty/rxsignal": "7.17.4-canary.559.339cfa7.0",
|
|
34
|
+
"@quenty/table": "3.7.5-canary.559.339cfa7.0",
|
|
35
35
|
"@quentystudios/t": "^3.0.0"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "339cfa778736f08768ed7305041f6221faa35bfc"
|
|
41
41
|
}
|
|
@@ -6,15 +6,28 @@
|
|
|
6
6
|
|
|
7
7
|
local require = require(script.Parent.loader).load(script)
|
|
8
8
|
|
|
9
|
+
local AttributeValue = require("AttributeValue")
|
|
10
|
+
local DefaultValueUtils = require("DefaultValueUtils")
|
|
9
11
|
local DuckTypeUtils = require("DuckTypeUtils")
|
|
12
|
+
local Observable = require("Observable")
|
|
13
|
+
local ValueObject = require("ValueObject")
|
|
10
14
|
local t = require("t")
|
|
11
|
-
local DefaultValueUtils = require("DefaultValueUtils")
|
|
12
|
-
local AttributeValue = require("AttributeValue")
|
|
13
15
|
|
|
14
16
|
local AdorneeDataEntry = {}
|
|
15
17
|
AdorneeDataEntry.ClassName = "AdorneeDataEntry"
|
|
16
18
|
AdorneeDataEntry.__index = AdorneeDataEntry
|
|
17
19
|
|
|
20
|
+
type ValueInterface = (value: any) -> (boolean, string?)
|
|
21
|
+
|
|
22
|
+
export type AdorneeDataEntry<T> = typeof(setmetatable(
|
|
23
|
+
{} :: {
|
|
24
|
+
_interface: ValueInterface,
|
|
25
|
+
_createValueObject: (adornee: Instance) -> ValueObject.ValueObject<T>,
|
|
26
|
+
_defaultValue: T?,
|
|
27
|
+
},
|
|
28
|
+
{} :: typeof({ __index = AdorneeDataEntry })
|
|
29
|
+
))
|
|
30
|
+
|
|
18
31
|
--[=[
|
|
19
32
|
Creates a new adornee data entry
|
|
20
33
|
|
|
@@ -23,7 +36,7 @@ AdorneeDataEntry.__index = AdorneeDataEntry
|
|
|
23
36
|
@param defaultValue T?
|
|
24
37
|
@return AdorneeDataEntry<T>
|
|
25
38
|
]=]
|
|
26
|
-
function AdorneeDataEntry.new(interface, createValueObject, defaultValue)
|
|
39
|
+
function AdorneeDataEntry.new<T>(interface: string | ValueInterface, createValueObject, defaultValue): AdorneeDataEntry<T>
|
|
27
40
|
assert(type(interface) == "string" or type(interface) == "function", "Bad interface")
|
|
28
41
|
assert(type(createValueObject) == "function", "Bad createValueObject")
|
|
29
42
|
|
|
@@ -50,7 +63,7 @@ function AdorneeDataEntry.new(interface, createValueObject, defaultValue)
|
|
|
50
63
|
return self
|
|
51
64
|
end
|
|
52
65
|
|
|
53
|
-
function AdorneeDataEntry.optionalAttribute(interface, name)
|
|
66
|
+
function AdorneeDataEntry.optionalAttribute(interface, name: string)
|
|
54
67
|
assert(type(interface) == "string" or type(interface) == "function", "Bad interface")
|
|
55
68
|
|
|
56
69
|
return AdorneeDataEntry.new(t.optional(interface), function(instance)
|
|
@@ -74,7 +87,7 @@ end
|
|
|
74
87
|
@param adornee Instance
|
|
75
88
|
@return ValueObject<T>
|
|
76
89
|
]=]
|
|
77
|
-
function AdorneeDataEntry
|
|
90
|
+
function AdorneeDataEntry.Create<T>(self: AdorneeDataEntry<T>, adornee: Instance): ValueObject.ValueObject<T>
|
|
78
91
|
assert(typeof(adornee) == "Instance", "Bad adornee")
|
|
79
92
|
|
|
80
93
|
return self._createValueObject(adornee)
|
|
@@ -86,7 +99,7 @@ end
|
|
|
86
99
|
@param adornee Instance
|
|
87
100
|
@return Observable<T>
|
|
88
101
|
]=]
|
|
89
|
-
function AdorneeDataEntry
|
|
102
|
+
function AdorneeDataEntry.Observe<T>(self: AdorneeDataEntry<T>, adornee: Instance): Observable.Observable<T>
|
|
90
103
|
assert(typeof(adornee) == "Instance", "Bad adornee")
|
|
91
104
|
|
|
92
105
|
local valueObject = self:Create(adornee)
|
|
@@ -99,7 +112,7 @@ end
|
|
|
99
112
|
@param adornee Instance
|
|
100
113
|
@return T
|
|
101
114
|
]=]
|
|
102
|
-
function AdorneeDataEntry
|
|
115
|
+
function AdorneeDataEntry.Get<T>(self: AdorneeDataEntry<T>, adornee: Instance): T
|
|
103
116
|
assert(typeof(adornee) == "Instance", "Bad adornee")
|
|
104
117
|
|
|
105
118
|
local valueObject = self:Create(adornee)
|
|
@@ -113,7 +126,7 @@ end
|
|
|
113
126
|
@param adornee Instance
|
|
114
127
|
@param value T
|
|
115
128
|
]=]
|
|
116
|
-
function AdorneeDataEntry
|
|
129
|
+
function AdorneeDataEntry.Set<T>(self: AdorneeDataEntry<T>, adornee: Instance, value: T): ()
|
|
117
130
|
assert(typeof(adornee) == "Instance", "Bad adornee")
|
|
118
131
|
assert(self._interface(value))
|
|
119
132
|
|
|
@@ -126,16 +139,16 @@ end
|
|
|
126
139
|
|
|
127
140
|
@return T?
|
|
128
141
|
]=]
|
|
129
|
-
function AdorneeDataEntry
|
|
142
|
+
function AdorneeDataEntry.GetDefaultValue<T>(self: AdorneeDataEntry<T>): T?
|
|
130
143
|
return self._defaultValue
|
|
131
144
|
end
|
|
132
145
|
|
|
133
146
|
--[=[
|
|
134
147
|
Gets the estrict interface for the entry
|
|
135
148
|
|
|
136
|
-
@return (value: any) -> (boolean, string)
|
|
149
|
+
@return (value: any) -> (boolean, string?)
|
|
137
150
|
]=]
|
|
138
|
-
function AdorneeDataEntry
|
|
151
|
+
function AdorneeDataEntry.GetStrictInterface<T>(self: AdorneeDataEntry<T>): (any) -> (boolean, string?)
|
|
139
152
|
return self._interface
|
|
140
153
|
end
|
|
141
154
|
|
|
@@ -143,10 +156,10 @@ end
|
|
|
143
156
|
Returns true if the item is valid.
|
|
144
157
|
|
|
145
158
|
@param value any
|
|
146
|
-
@return (boolean, string)
|
|
159
|
+
@return (boolean, string?)
|
|
147
160
|
]=]
|
|
148
|
-
function AdorneeDataEntry
|
|
161
|
+
function AdorneeDataEntry.IsValid<T>(self: AdorneeDataEntry<T>, value: any): (boolean, string?)
|
|
149
162
|
return self._interface(value)
|
|
150
163
|
end
|
|
151
164
|
|
|
152
|
-
return AdorneeDataEntry
|
|
165
|
+
return AdorneeDataEntry
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
|
|
23
23
|
local require = require(script.Parent.loader).load(script)
|
|
24
24
|
|
|
25
|
+
local AdorneeDataEntry = require("AdorneeDataEntry")
|
|
25
26
|
local AttributeValue = require("AttributeValue")
|
|
26
|
-
local RxSignal = require("RxSignal")
|
|
27
27
|
local Rx = require("Rx")
|
|
28
|
-
local
|
|
28
|
+
local RxSignal = require("RxSignal")
|
|
29
29
|
|
|
30
30
|
local AdorneeDataValue = {}
|
|
31
31
|
AdorneeDataValue.ClassName = "AdorneeDataValue"
|
|
@@ -43,9 +43,9 @@ function AdorneeDataValue.new(adornee, prototype)
|
|
|
43
43
|
assert(type(prototype) == "table", "Bad prototype")
|
|
44
44
|
|
|
45
45
|
local self = {
|
|
46
|
-
_adornee = adornee
|
|
47
|
-
_defaultValues = prototype
|
|
48
|
-
_valueObjects = {}
|
|
46
|
+
_adornee = adornee,
|
|
47
|
+
_defaultValues = prototype,
|
|
48
|
+
_valueObjects = {},
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
for key, value in prototype do
|
|
@@ -149,4 +149,4 @@ function AdorneeDataValue:_getOrCreateAttributeValue(key)
|
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
-
return AdorneeDataValue
|
|
152
|
+
return AdorneeDataValue
|