@quenty/adorneedata 7.18.0 → 7.18.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 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.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneedata@7.18.0...@quenty/adorneedata@7.18.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
  # [7.18.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/adorneedata@7.17.2...@quenty/adorneedata@7.18.0) (2025-04-02)
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.0",
3
+ "version": "7.18.1",
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": "^14.17.0",
29
- "@quenty/defaultvalueutils": "^1.2.0",
30
- "@quenty/ducktype": "^5.8.1",
31
- "@quenty/loader": "^10.8.0",
32
- "@quenty/rx": "^13.17.0",
33
- "@quenty/rxsignal": "^7.17.0",
34
- "@quenty/table": "^3.7.1",
28
+ "@quenty/attributeutils": "^14.17.1",
29
+ "@quenty/defaultvalueutils": "^1.2.1",
30
+ "@quenty/ducktype": "^5.8.2",
31
+ "@quenty/loader": "^10.8.1",
32
+ "@quenty/rx": "^13.17.1",
33
+ "@quenty/rxsignal": "^7.17.1",
34
+ "@quenty/table": "^3.7.2",
35
35
  "@quentystudios/t": "^3.0.0"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "e8ea56930e65322fcffc05a1556d5df988068f0b"
40
+ "gitHead": "78c3ac0ab08dd18085b6e6e6e4f745e76ed99f68"
41
41
  }
@@ -89,7 +89,7 @@ AdorneeData.__index = AdorneeData
89
89
  @param prototype any
90
90
  @return AdorneeData<T>
91
91
  ]=]
92
- function AdorneeData.new(prototype)
92
+ function AdorneeData.new(prototype: any)
93
93
  local self = setmetatable({}, AdorneeData)
94
94
 
95
95
  self._fullPrototype = assert(prototype, "Bad prototype")
@@ -97,7 +97,7 @@ function AdorneeData.new(prototype)
97
97
  self._defaultValuesPrototype = {}
98
98
  self._valueObjectPrototype = {}
99
99
 
100
- for key, item in pairs(self._fullPrototype) do
100
+ for key, item in self._fullPrototype do
101
101
  if AdorneeDataEntry.isAdorneeDataEntry(item) then
102
102
  local default = item:GetDefaultValue()
103
103
  self._defaultValuesPrototype[key] = default
@@ -128,6 +128,8 @@ function AdorneeData:__index(index)
128
128
  return AttributeValue.new(adornee, index, found)
129
129
  end, found)
130
130
  end
131
+ else
132
+ error("Bad index")
131
133
  end
132
134
  end
133
135
 
@@ -138,7 +140,7 @@ end
138
140
  @return boolean
139
141
  @return string -- Error message
140
142
  ]=]
141
- function AdorneeData:IsStrictData(data)
143
+ function AdorneeData:IsStrictData(data): (boolean, string?)
142
144
  return self:GetStrictTInterface()(data)
143
145
  end
144
146
 
@@ -166,7 +168,7 @@ function AdorneeData:CreateFullData(data)
166
168
 
167
169
  local result = table.clone(self._defaultValuesPrototype)
168
170
 
169
- for key, value in pairs(data) do
171
+ for key, value in data do
170
172
  result[key] = value
171
173
  end
172
174
 
@@ -224,7 +226,7 @@ function AdorneeData:Get(adornee: Instance)
224
226
  assert(typeof(adornee) == "Instance", "Bad adornee")
225
227
 
226
228
  local data = {}
227
- for key, defaultValue in pairs(self._attributePrototype) do
229
+ for key, defaultValue in self._attributePrototype do
228
230
  local result = adornee:GetAttribute(key)
229
231
  if result == nil then
230
232
  result = defaultValue
@@ -233,7 +235,7 @@ function AdorneeData:Get(adornee: Instance)
233
235
  end
234
236
 
235
237
  -- TODO: Avoid additional allocation
236
- for key, value in pairs(self._valueObjectPrototype) do
238
+ for key, value in self._valueObjectPrototype do
237
239
  data[key] = value:Create(adornee).Value
238
240
  end
239
241
 
@@ -251,7 +253,7 @@ function AdorneeData:Set(adornee: Instance, data)
251
253
  assert(self:IsData(data))
252
254
 
253
255
  local attributeTable = self:Create(adornee)
254
- for key, value in pairs(data) do
256
+ for key, value in data do
255
257
  attributeTable[key].Value = value
256
258
  end
257
259
  end
@@ -264,7 +266,7 @@ end
264
266
  function AdorneeData:Unset(adornee: Instance)
265
267
  assert(typeof(adornee) == "Instance", "Bad adornee")
266
268
 
267
- for key, _ in pairs(self._attributePrototype) do
269
+ for key, _ in self._attributePrototype do
268
270
  adornee:SetAttribute(key, nil)
269
271
  end
270
272
 
@@ -281,12 +283,12 @@ function AdorneeData:SetStrict(adornee: Instance, data)
281
283
  assert(typeof(adornee) == "Instance", "Bad adornee")
282
284
  assert(self:IsStrictData(data))
283
285
 
284
- for key, _ in pairs(self._attributePrototype) do
286
+ for key, _ in self._attributePrototype do
285
287
  adornee:SetAttribute(key, data[key])
286
288
  end
287
289
 
288
290
  -- TODO: Avoid additional allocation
289
- for key, value in pairs(self._valueObjectPrototype) do
291
+ for key, value in self._valueObjectPrototype do
290
292
  value:Create(adornee).Value = data[key]
291
293
  end
292
294
  end
@@ -295,14 +297,14 @@ end
295
297
  Initializes the attributes for the adornee
296
298
 
297
299
  @param adornee Instance
298
- @param data T | nil
300
+ @param data T?
299
301
  ]=]
300
302
  function AdorneeData:InitAttributes(adornee: Instance, data)
301
303
  data = data or {}
302
304
  assert(typeof(adornee) == "Instance", "Bad adornee")
303
305
  assert(self:IsData(data))
304
306
 
305
- for key, defaultValue in pairs(self._attributePrototype) do
307
+ for key, defaultValue in self._attributePrototype do
306
308
  if adornee:GetAttribute(key) == nil then
307
309
  if data[key] ~= nil then
308
310
  adornee:SetAttribute(key, data[key])
@@ -313,7 +315,7 @@ function AdorneeData:InitAttributes(adornee: Instance, data)
313
315
  end
314
316
 
315
317
  -- TODO: Avoid additional allocation
316
- for key, value in pairs(self._valueObjectPrototype) do
318
+ for key, value in self._valueObjectPrototype do
317
319
  local valueObject = value:Create(adornee)
318
320
  if valueObject == nil then
319
321
  if data[key] ~= nil then
@@ -385,7 +387,7 @@ function AdorneeData:_getOrCreateTypeInterfaceList()
385
387
 
386
388
  local interfaceList = {}
387
389
 
388
- for key, value in pairs(self._fullPrototype) do
390
+ for key, value in self._fullPrototype do
389
391
  if AdorneeDataEntry.isAdorneeDataEntry(value) then
390
392
  interfaceList[key] = value:GetStrictInterface()
391
393
  else
@@ -64,7 +64,7 @@ end
64
64
  @param data any
65
65
  @return boolean
66
66
  ]=]
67
- function AdorneeDataEntry.isAdorneeDataEntry(data)
67
+ function AdorneeDataEntry.isAdorneeDataEntry(data: any): boolean
68
68
  return DuckTypeUtils.isImplementation(AdorneeDataEntry, data)
69
69
  end
70
70
 
@@ -74,7 +74,7 @@ end
74
74
  @param adornee Instance
75
75
  @return ValueObject<T>
76
76
  ]=]
77
- function AdorneeDataEntry:Create(adornee)
77
+ function AdorneeDataEntry:Create(adornee: Instance)
78
78
  assert(typeof(adornee) == "Instance", "Bad adornee")
79
79
 
80
80
  return self._createValueObject(adornee)
@@ -86,7 +86,7 @@ end
86
86
  @param adornee Instance
87
87
  @return Observable<T>
88
88
  ]=]
89
- function AdorneeDataEntry:Observe(adornee)
89
+ function AdorneeDataEntry:Observe(adornee: Instance)
90
90
  assert(typeof(adornee) == "Instance", "Bad adornee")
91
91
 
92
92
  local valueObject = self:Create(adornee)
@@ -48,7 +48,7 @@ function AdorneeDataValue.new(adornee, prototype)
48
48
  _valueObjects = {};
49
49
  }
50
50
 
51
- for key, value in pairs(prototype) do
51
+ for key, value in prototype do
52
52
  if AdorneeDataEntry.isAdorneeDataEntry(value) then
53
53
  self._valueObjects[key] = value:Create(adornee)
54
54
  else
@@ -75,13 +75,13 @@ end
75
75
  function AdorneeDataValue:__index(index)
76
76
  if index == "Value" then
77
77
  local result = {}
78
- for key, valueObject in pairs(self._valueObjects) do
78
+ for key, valueObject in self._valueObjects do
79
79
  result[key] = valueObject.Value
80
80
  end
81
81
  return result
82
82
  elseif index == "Changed" then
83
83
  return RxSignal.new(self:Observe():Pipe({
84
- Rx.skip(1);
84
+ Rx.skip(1),
85
85
  }))
86
86
  elseif AdorneeDataValue[index] then
87
87
  return AdorneeDataValue[index]
@@ -110,7 +110,7 @@ function AdorneeDataValue:Observe()
110
110
  local attributeValues = rawget(self, "_valueObjects")
111
111
 
112
112
  local observables = {}
113
- for key, valueObject in pairs(attributeValues) do
113
+ for key, valueObject in attributeValues do
114
114
  observables[key] = valueObject:Observe()
115
115
  end
116
116
 
@@ -124,7 +124,7 @@ function AdorneeDataValue:__newindex(index, newValue)
124
124
  assert(type(newValue) == "table", "Bad newValue")
125
125
  local attributeValues = rawget(self, "_valueObjects")
126
126
 
127
- for key, value in pairs(newValue) do
127
+ for key, value in newValue do
128
128
  if attributeValues[key] then
129
129
  attributeValues[key].Value = value
130
130
  else