@quenty/tie 4.29.0 → 4.29.1-canary.417.052e8ba.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,25 @@
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
+ ## [4.29.1-canary.417.052e8ba.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.29.0...@quenty/tie@4.29.1-canary.417.052e8ba.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
+
6
25
  # [4.29.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/tie@4.28.0...@quenty/tie@4.29.0) (2023-09-21)
7
26
 
8
27
  **Note:** Version bump only for package @quenty/tie
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/tie",
3
- "version": "4.29.0",
3
+ "version": "4.29.1-canary.417.052e8ba.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.22.0",
32
- "@quenty/baseobject": "^6.3.0",
33
- "@quenty/brio": "^8.19.0",
34
- "@quenty/instanceutils": "^7.21.0",
35
- "@quenty/loader": "^6.3.0",
36
- "@quenty/maid": "^2.6.0",
37
- "@quenty/rx": "^7.16.0",
38
- "@quenty/statestack": "^8.24.0",
39
- "@quenty/string": "^3.1.0",
40
- "@quenty/symbol": "^2.2.0",
41
- "@quenty/table": "^3.3.0",
42
- "@quenty/valuebaseutils": "^7.22.0",
43
- "@quenty/valueobject": "^7.24.0"
31
+ "@quenty/attributeutils": "8.22.1-canary.417.052e8ba.0",
32
+ "@quenty/baseobject": "6.3.1-canary.417.052e8ba.0",
33
+ "@quenty/brio": "8.19.1-canary.417.052e8ba.0",
34
+ "@quenty/collectionserviceutils": "2.21.1-canary.417.052e8ba.0",
35
+ "@quenty/instanceutils": "7.21.1-canary.417.052e8ba.0",
36
+ "@quenty/loader": "6.3.1-canary.417.052e8ba.0",
37
+ "@quenty/maid": "2.6.0",
38
+ "@quenty/rx": "7.16.1-canary.417.052e8ba.0",
39
+ "@quenty/statestack": "8.24.1-canary.417.052e8ba.0",
40
+ "@quenty/string": "3.1.0",
41
+ "@quenty/symbol": "2.2.0",
42
+ "@quenty/table": "3.3.0",
43
+ "@quenty/valuebaseutils": "7.22.1-canary.417.052e8ba.0",
44
+ "@quenty/valueobject": "7.24.1-canary.417.052e8ba.0"
44
45
  },
45
46
  "devDependencies": {
46
- "@quenty/promise": "^6.8.0",
47
- "@quenty/signal": "^2.4.0"
47
+ "@quenty/promise": "6.8.1-canary.417.052e8ba.0",
48
+ "@quenty/signal": "2.4.1-canary.417.052e8ba.0"
48
49
  },
49
50
  "publishConfig": {
50
51
  "access": "public"
51
52
  },
52
- "gitHead": "fd634d0ed1918fc14bae8501aff1cc099d0537e7"
53
+ "gitHead": "052e8ba33437f71398c4c08c8dbcbf076022d388"
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
@@ -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)
@@ -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