@quenty/tie 5.0.0-canary.367.e9fdcbc.0 → 5.0.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,7 +3,106 @@
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
- # [5.0.0-canary.367.e9fdcbc.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.19.0...@quenty/tie@5.0.0-canary.367.e9fdcbc.0) (2023-06-05)
6
+ # [5.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.29.0...@quenty/tie@5.0.0) (2023-10-11)
7
+
8
+
9
+ * fix!: Make RxSignal not automatically skip first input ([6fe7586](https://github.com/Quenty/NevermoreEngine/commit/6fe7586029ea4753b1de7a8633c7d5af15bab420))
10
+
11
+
12
+ ### Features
13
+
14
+ * Tie has better errors ([9e66f62](https://github.com/Quenty/NevermoreEngine/commit/9e66f621ff5b8e7c24800eca819612e9033c35c5))
15
+
16
+
17
+ ### BREAKING CHANGES
18
+
19
+ * RxSignal used to export a different value
20
+
21
+
22
+
23
+
24
+
25
+ # [4.29.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.28.0...@quenty/tie@4.29.0) (2023-09-21)
26
+
27
+ **Note:** Version bump only for package @quenty/tie
28
+
29
+
30
+
31
+
32
+
33
+ # [4.28.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.27.0...@quenty/tie@4.28.0) (2023-09-04)
34
+
35
+ **Note:** Version bump only for package @quenty/tie
36
+
37
+
38
+
39
+
40
+
41
+ # [4.27.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.26.0...@quenty/tie@4.27.0) (2023-08-23)
42
+
43
+ **Note:** Version bump only for package @quenty/tie
44
+
45
+
46
+
47
+
48
+
49
+ # [4.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.25.0...@quenty/tie@4.26.0) (2023-08-01)
50
+
51
+ **Note:** Version bump only for package @quenty/tie
52
+
53
+
54
+
55
+
56
+
57
+ # [4.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.24.0...@quenty/tie@4.25.0) (2023-07-28)
58
+
59
+ **Note:** Version bump only for package @quenty/tie
60
+
61
+
62
+
63
+
64
+
65
+ # [4.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.23.0...@quenty/tie@4.24.0) (2023-07-23)
66
+
67
+ **Note:** Version bump only for package @quenty/tie
68
+
69
+
70
+
71
+
72
+
73
+ # [4.23.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.22.0...@quenty/tie@4.23.0) (2023-07-15)
74
+
75
+
76
+ ### Bug Fixes
77
+
78
+ * Fix valueBase assignment and retrieval ([50453dd](https://github.com/Quenty/NevermoreEngine/commit/50453dd1562e00e1a619eb09870097f3deebed46))
79
+
80
+
81
+ ### Features
82
+
83
+ * Add :Observe() API calls to a variety of systems and allow Blend to :Observe() stuff ([ca29c68](https://github.com/Quenty/NevermoreEngine/commit/ca29c68164dfdaf136e9168faf48f487bed26088))
84
+
85
+
86
+
87
+
88
+
89
+ # [4.22.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.21.0...@quenty/tie@4.22.0) (2023-07-10)
90
+
91
+ **Note:** Version bump only for package @quenty/tie
92
+
93
+
94
+
95
+
96
+
97
+ # [4.21.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.20.0...@quenty/tie@4.21.0) (2023-06-17)
98
+
99
+ **Note:** Version bump only for package @quenty/tie
100
+
101
+
102
+
103
+
104
+
105
+ # [4.20.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.19.0...@quenty/tie@4.20.0) (2023-06-05)
7
106
 
8
107
 
9
108
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/tie",
3
- "version": "5.0.0-canary.367.e9fdcbc.0",
3
+ "version": "5.0.0",
4
4
  "description": "Tie allows interfaces to be defined between Lua OOP and Roblox objects.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,26 +28,27 @@
28
28
  "Quenty"
29
29
  ],
30
30
  "dependencies": {
31
- "@quenty/attributeutils": "8.15.0",
32
- "@quenty/baseobject": "6.2.1",
33
- "@quenty/brio": "8.13.0",
34
- "@quenty/instanceutils": "7.14.0",
35
- "@quenty/loader": "6.2.1",
36
- "@quenty/maid": "2.5.0",
37
- "@quenty/rx": "7.11.0",
38
- "@quenty/statestack": "9.0.0-canary.367.e9fdcbc.0",
39
- "@quenty/string": "3.1.0",
40
- "@quenty/symbol": "2.2.0",
41
- "@quenty/table": "3.2.0",
42
- "@quenty/valuebaseutils": "7.14.0",
43
- "@quenty/valueobject": "8.0.0-canary.367.e9fdcbc.0"
31
+ "@quenty/attributeutils": "^9.0.0",
32
+ "@quenty/baseobject": "^7.0.0",
33
+ "@quenty/brio": "^9.0.0",
34
+ "@quenty/collectionserviceutils": "^3.0.0",
35
+ "@quenty/instanceutils": "^8.0.0",
36
+ "@quenty/loader": "^7.0.0",
37
+ "@quenty/maid": "^2.6.0",
38
+ "@quenty/rx": "^8.0.0",
39
+ "@quenty/statestack": "^9.0.0",
40
+ "@quenty/string": "^3.1.0",
41
+ "@quenty/symbol": "^2.2.0",
42
+ "@quenty/table": "^3.3.0",
43
+ "@quenty/valuebaseutils": "^8.0.0",
44
+ "@quenty/valueobject": "^8.0.0"
44
45
  },
45
46
  "devDependencies": {
46
- "@quenty/promise": "6.5.0",
47
- "@quenty/signal": "2.4.0"
47
+ "@quenty/promise": "^7.0.0",
48
+ "@quenty/signal": "^3.0.0"
48
49
  },
49
50
  "publishConfig": {
50
51
  "access": "public"
51
52
  },
52
- "gitHead": "e9fdcbc6ea1d46e068bf42a08b833099e9005259"
53
+ "gitHead": "fdeae46099587019ec5fc15317dc673aed379400"
53
54
  }
@@ -11,6 +11,7 @@ local Maid = require("Maid")
11
11
  local Observable = require("Observable")
12
12
  local Rx = require("Rx")
13
13
  local RxBrioUtils = require("RxBrioUtils")
14
+ local RxCollectionServiceUtils = require("RxCollectionServiceUtils")
14
15
  local RxInstanceUtils = require("RxInstanceUtils")
15
16
  local RxStateStackUtils = require("RxStateStackUtils")
16
17
  local String = require("String")
@@ -82,6 +83,85 @@ function TieDefinition:GetImplementations(adornee: Instance)
82
83
  return implementations
83
84
  end
84
85
 
86
+ --[=[
87
+ Observes all the children implementations for this adornee
88
+
89
+ @param adornee Instance
90
+ @return Observable<Brio<TieInterface>>
91
+ ]=]
92
+ function TieDefinition:ObserveChildrenBrio(adornee: Instance)
93
+ return RxInstanceUtils.observeChildrenBrio(adornee):Pipe({
94
+ RxBrioUtils.flatMapBrio(function(child)
95
+ return self:ObserveBrio(child)
96
+ end)
97
+ })
98
+ end
99
+
100
+ --[=[
101
+ Promises the implementation
102
+
103
+ @param adornee Adornee
104
+ @return Promise<TieInterface>
105
+ ]=]
106
+ function TieDefinition:Promise(adornee)
107
+ assert(typeof(adornee) == "Instance", "Bad adornee")
108
+
109
+ -- TODO: Support cancellation cleanup here.
110
+
111
+ return Rx.toPromise(self:Observe(adornee):Pipe({
112
+ Rx.where(function(value)
113
+ return value ~= nil
114
+ end)
115
+ }))
116
+ end
117
+
118
+ --[=[
119
+ Gets all valid interfaces for this adornee's children
120
+
121
+ @param adornee Instance
122
+ @return { TieInterface }
123
+ ]=]
124
+ function TieDefinition:GetChildren(adornee: Instance)
125
+ assert(typeof(adornee) == "Instance", "Bad adornee")
126
+
127
+ local implementations = {}
128
+
129
+ -- TODO: Make this faster
130
+ for _, item in pairs(adornee:GetChildren()) do
131
+ for _, option in pairs(self:GetImplementations(item)) do
132
+ table.insert(implementations, option)
133
+ end
134
+ end
135
+
136
+ return implementations
137
+ end
138
+
139
+ --[=[
140
+ Finds the implementation on the adornee. Alais for [FindFirstImplementation]
141
+
142
+ @param adornee Adornee
143
+ @return TieInterface | nil
144
+ ]=]
145
+ function TieDefinition:Find(adornee: Instance)
146
+ return self:FindFirstImplementation(adornee)
147
+ end
148
+
149
+ --[=[
150
+ Observes all implementations that are tagged with the given tag name
151
+
152
+ @param tagName string
153
+ @return TieInterface | nil
154
+ ]=]
155
+ function TieDefinition:ObserveAllTaggedBrio(tagName)
156
+ assert(type(tagName) == "string", "Bad tagName")
157
+
158
+ return RxCollectionServiceUtils.observeTaggedBrio(tagName):Pipe({
159
+ RxBrioUtils.flatMapBrio(function(instance)
160
+ return self:ObserveBrio(instance)
161
+ end)
162
+ })
163
+ end
164
+
85
165
  --[=[
86
166
  Finds the first valid interfaces for this adornee
87
167
  @param adornee Instance
@@ -196,6 +276,10 @@ function TieDefinition:ObserveLastImplementationBrio(adornee: Instance)
196
276
  })
197
277
  end
198
278
 
279
+ function TieDefinition:ObserveBrio(adornee: Instance)
280
+ return self:ObserveLastImplementationBrio(adornee)
281
+ end
282
+
199
283
  --[=[
200
284
  Observes a valid implementation if it exists, or nil
201
285
 
@@ -210,6 +294,9 @@ function TieDefinition:ObserveLastImplementation(adornee: Instance)
210
294
  })
211
295
  end
212
296
 
297
+ function TieDefinition:Observe(adornee: Instance)
298
+ return self:ObserveLastImplementation(adornee)
299
+ end
213
300
 
214
301
  --[=[
215
302
  Observes valid implementations wrapped in a brio if it exists.
@@ -59,7 +59,7 @@ function TieImplementation:__index(index)
59
59
  if memberMap[index] then
60
60
  return memberMap[index]:GetInterface(self._folder, self)
61
61
  else
62
- error(("Bad index %q for TieImplementation"):format(tostring(index)))
62
+ error(string.format("Bad index %q for TieImplementation", tostring(index)))
63
63
  end
64
64
  end
65
65
 
@@ -100,7 +100,7 @@ function TiePropertyImplementation:_updateImplementation(maid, implementation)
100
100
 
101
101
  local className = ValueBaseUtils.getClassNameFromType(typeof(implementation))
102
102
  if not className then
103
- error(("[TiePropertyImplementation] - Bad implementation value type %q, cannot set"):format(typeof(implementation)))
103
+ error(string.format("[TiePropertyImplementation] - Bad implementation value type %q, cannot set %s", typeof(implementation), self._memberDefinition:GetMemberName()))
104
104
  end
105
105
 
106
106
  local copy = self:_changeToClassIfNeeded(className, implementation)
@@ -75,7 +75,7 @@ function TiePropertyInterface:_getFolder()
75
75
  return TieInterfaceUtils.getFolder(self._tieDefinition, self._folder, self._adornee)
76
76
  end
77
77
 
78
- function TiePropertyInterface:_getValueBase()
78
+ function TiePropertyInterface:_findValueBase()
79
79
  local folder = self:_getFolder()
80
80
  if not folder then
81
81
  return nil
@@ -97,7 +97,7 @@ function TiePropertyInterface:_getValueBase()
97
97
  end
98
98
 
99
99
  function TiePropertyInterface:_getValueBaseOrError()
100
- local valueBase = self:_getValueBase()
100
+ local valueBase = self:_findValueBase()
101
101
  if not valueBase then
102
102
  error(("%s.%s is not implemented for %s"):format(
103
103
  self._tieDefinition:GetContainerName(),
@@ -151,6 +151,10 @@ function TiePropertyInterface:_observeFromFolder(folder)
151
151
  local lastImplementationType = UNSET_VALUE
152
152
 
153
153
  local function update()
154
+ if not sub:IsPending() then
155
+ return
156
+ end
157
+
154
158
  -- Prioritize attributes first
155
159
  local currentAttribute = folder:GetAttribute(memberName)
156
160
  if currentAttribute ~= nil then
@@ -263,7 +267,15 @@ function TiePropertyInterface:__newindex(index, value)
263
267
  if index == "_adornee" or index == "_folder" or index == "_memberDefinition" or index == "_tieDefinition" then
264
268
  rawset(self, index, value)
265
269
  elseif index == "Value" then
266
- if AttributeUtils.isValidAttributeType(typeof(value)) and value ~= nil then
270
+ local className = ValueBaseUtils.getClassNameFromType(typeof(value))
271
+ if not className then
272
+ error(("[TiePropertyImplementation] - Bad implementation value type %q, cannot set"):format(typeof(value)))
273
+ end
274
+
275
+ local valueBase = self:_findValueBase()
276
+ if type(valueBase) == "table" or (typeof(valueBase) == "Instance" and valueBase.ClassName == className) then
277
+ valueBase.Value = value
278
+ elseif AttributeUtils.isValidAttributeType(typeof(value)) and value ~= nil then
267
279
  local folder = self:_getFolder()
268
280
  if folder then
269
281
  folder:SetAttribute(self._memberDefinition:GetMemberName(), value)
@@ -275,16 +287,6 @@ function TiePropertyInterface:__newindex(index, value)
275
287
  end
276
288
  return
277
289
  end
278
- end
279
-
280
- local className = ValueBaseUtils.getClassNameFromType(typeof(value))
281
- if not className then
282
- error(("[TiePropertyImplementation] - Bad implementation value type %q, cannot set"):format(typeof(value)))
283
- end
284
-
285
- local valueBase = self:_getValueBase()
286
- if valueBase and valueBase.ClassName == className then
287
- valueBase.Value = value
288
290
  else
289
291
  local folder = self:_getFolder()
290
292
  if folder then