@quenty/textfilterservice 13.18.3-canary.550.afa1b3b.0 → 13.18.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,7 +3,18 @@
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
- ## [13.18.3-canary.550.afa1b3b.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/textfilterservice@13.18.2...@quenty/textfilterservice@13.18.3-canary.550.afa1b3b.0) (2025-04-10)
6
+ ## [13.18.4-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/textfilterservice@13.18.3...@quenty/textfilterservice@13.18.4-canary.11a5dcf.0) (2025-05-10)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add even more types ([b31717d](https://github.com/Quenty/NevermoreEngine/commit/b31717d8c9f7620c457f5018a2affa760a65334a))
12
+
13
+
14
+
15
+
16
+
17
+ ## [13.18.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/textfilterservice@13.18.2...@quenty/textfilterservice@13.18.3) (2025-04-10)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/textfilterservice
9
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/textfilterservice",
3
- "version": "13.18.3-canary.550.afa1b3b.0",
3
+ "version": "13.18.4-canary.11a5dcf.0",
4
4
  "description": "Utility service that provides text filtering to the client",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,15 +27,15 @@
27
27
  "Quenty"
28
28
  ],
29
29
  "dependencies": {
30
- "@quenty/loader": "10.8.3-canary.550.afa1b3b.0",
31
- "@quenty/promise": "10.10.4-canary.550.afa1b3b.0",
32
- "@quenty/remoting": "12.18.3-canary.550.afa1b3b.0",
33
- "@quenty/rx": "13.17.3-canary.550.afa1b3b.0",
34
- "@quenty/table": "3.7.4-canary.550.afa1b3b.0",
35
- "@quenty/textfilterutils": "10.10.4-canary.550.afa1b3b.0"
30
+ "@quenty/loader": "10.8.4-canary.11a5dcf.0",
31
+ "@quenty/promise": "10.10.5-canary.11a5dcf.0",
32
+ "@quenty/remoting": "12.18.4-canary.11a5dcf.0",
33
+ "@quenty/rx": "13.17.4-canary.11a5dcf.0",
34
+ "@quenty/table": "3.7.5-canary.11a5dcf.0",
35
+ "@quenty/textfilterutils": "10.10.5-canary.11a5dcf.0"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "afa1b3b99b862698c3ab46009497bd507150867c"
40
+ "gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
41
41
  }
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  @class TextFilterServiceClient
3
4
  ]=]
@@ -6,10 +7,11 @@ local require = require(script.Parent.loader).load(script)
6
7
 
7
8
  local RunService = game:GetService("RunService")
8
9
 
10
+ local Observable = require("Observable")
9
11
  local Promise = require("Promise")
10
12
  local PromiseGetRemoteFunction = require("PromiseGetRemoteFunction")
11
- local TextFilterServiceConstants = require("TextFilterServiceConstants")
12
13
  local Rx = require("Rx")
14
+ local TextFilterServiceConstants = require("TextFilterServiceConstants")
13
15
  local TextFilterUtils = require("TextFilterUtils")
14
16
 
15
17
  local TextFilterServiceClient = {}
@@ -22,14 +24,15 @@ TextFilterServiceClient.ServiceName = "TextFilterServiceClient"
22
24
  @param fromUserId number
23
25
  @return Promise<string>
24
26
  ]=]
25
- function TextFilterServiceClient:PromiseNonChatStringForUser(text, fromUserId)
27
+ function TextFilterServiceClient:PromiseNonChatStringForUser(text: string, fromUserId: number): Promise.Promise<string>
26
28
  assert(type(text) == "string", "Bad text")
27
29
  assert(type(fromUserId) == "number", "Bad fromUserId")
28
30
 
29
31
  return self:_promiseInvokeRemoteFunction(
30
32
  TextFilterServiceConstants.REQUEST_NON_CHAT_STRING_FOR_USER,
31
33
  text,
32
- fromUserId)
34
+ fromUserId
35
+ )
33
36
  end
34
37
 
35
38
  --[=[
@@ -39,14 +42,18 @@ end
39
42
  @param fromUserId number
40
43
  @return Promise<string>
41
44
  ]=]
42
- function TextFilterServiceClient:PromiseNonChatStringForBroadcast(text, fromUserId)
45
+ function TextFilterServiceClient:PromiseNonChatStringForBroadcast(
46
+ text: string,
47
+ fromUserId: number
48
+ ): Promise.Promise<string>
43
49
  assert(type(text) == "string", "Bad text")
44
50
  assert(type(fromUserId) == "number", "Bad fromUserId")
45
51
 
46
52
  return self:_promiseInvokeRemoteFunction(
47
53
  TextFilterServiceConstants.REQUEST_NON_CHAT_STRING_FOR_BROADCAST,
48
54
  text,
49
- fromUserId)
55
+ fromUserId
56
+ )
50
57
  end
51
58
 
52
59
  --[=[
@@ -55,12 +62,13 @@ end
55
62
  @param text string
56
63
  @return Promise<string>
57
64
  ]=]
58
- function TextFilterServiceClient:PromisePreviewNonChatStringForBroadcast(text: string)
65
+ function TextFilterServiceClient:PromisePreviewNonChatStringForBroadcast(text: string): Promise.Promise<string>
59
66
  assert(type(text) == "string", "Bad text")
60
67
 
61
68
  return self:_promiseInvokeRemoteFunction(
62
69
  TextFilterServiceConstants.REQUEST_PREVIEW_NON_CHAT_STRING_FOR_BROADCAST,
63
- text)
70
+ text
71
+ )
64
72
  end
65
73
 
66
74
  --[=[
@@ -69,8 +77,8 @@ end
69
77
  @param text string
70
78
  @return Promise<string>
71
79
  ]=]
72
- function TextFilterServiceClient:ObservePreviewNonChatStringForBroadcast(text)
73
- return Rx.fromPromise(self:PromisePreviewNonChatStringForBroadcast(text))
80
+ function TextFilterServiceClient:ObservePreviewNonChatStringForBroadcast(text: string): Observable.Observable<string>
81
+ return Rx.fromPromise(self:PromisePreviewNonChatStringForBroadcast(text)) :: any
74
82
  end
75
83
 
76
84
  function TextFilterServiceClient:_promiseInvokeRemoteFunction(request, text, ...)
@@ -83,32 +91,31 @@ function TextFilterServiceClient:_promiseInvokeRemoteFunction(request, text, ...
83
91
  return self:_fakeTestFilter(text)
84
92
  end
85
93
 
86
- return self:_promiseRemoteFunction()
87
- :Then(function(remoteFunction)
88
- return Promise.spawn(function(resolve, reject)
89
- local resultOk, result
90
- local ok, err = pcall(function()
91
- resultOk, result = remoteFunction:InvokeServer(request, text, table.unpack(args, 1, args.n))
92
- end)
94
+ return self:_promiseRemoteFunction():Then(function(remoteFunction)
95
+ return Promise.spawn(function(resolve, reject)
96
+ local resultOk, result
97
+ local ok, err = pcall(function()
98
+ resultOk, result = remoteFunction:InvokeServer(request, text, table.unpack(args, 1, args.n))
99
+ end)
93
100
 
94
- if not ok then
95
- return reject(err)
96
- end
101
+ if not ok then
102
+ return reject(err)
103
+ end
97
104
 
98
- if not resultOk then
99
- return reject(result or "Failed to get a valid result from server")
100
- end
105
+ if not resultOk then
106
+ return reject(result or "Failed to get a valid result from server")
107
+ end
101
108
 
102
- if type(result) ~= "string" then
103
- return reject(err or result or "Failed to get string result from server")
104
- end
109
+ if type(result) ~= "string" then
110
+ return reject(err or result or "Failed to get string result from server")
111
+ end
105
112
 
106
- return resolve(TextFilterUtils.addBackInNewLinesAndWhitespace(text, result))
107
- end)
113
+ return resolve(TextFilterUtils.addBackInNewLinesAndWhitespace(text, result))
108
114
  end)
115
+ end)
109
116
  end
110
117
 
111
- function TextFilterServiceClient:_promiseRemoteFunction()
118
+ function TextFilterServiceClient:_promiseRemoteFunction(): Promise.Promise<RemoteFunction>
112
119
  if self._remoteFunctionPromise then
113
120
  return self._remoteFunctionPromise
114
121
  end
@@ -117,7 +124,7 @@ function TextFilterServiceClient:_promiseRemoteFunction()
117
124
  return self._remoteFunctionPromise
118
125
  end
119
126
 
120
- function TextFilterServiceClient:_fakeTestFilter(text)
127
+ function TextFilterServiceClient:_fakeTestFilter(text: string): Promise.Promise<string>
121
128
  local filteredText = text
122
129
  filteredText = string.gsub(filteredText, "[fF][uU][cC][kK]", "####")
123
130
  filteredText = string.gsub(filteredText, "\n", "")
@@ -130,4 +137,4 @@ function TextFilterServiceClient:_fakeTestFilter(text)
130
137
  end)
131
138
  end
132
139
 
133
- return TextFilterServiceClient
140
+ return TextFilterServiceClient
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  @class TextFilterService
3
4
  ]=]
@@ -5,6 +6,7 @@
5
6
  local require = require(script.Parent.loader).load(script)
6
7
 
7
8
  local GetRemoteFunction = require("GetRemoteFunction")
9
+ local Promise = require("Promise")
8
10
  local TextFilterServiceConstants = require("TextFilterServiceConstants")
9
11
  local TextFilterUtils = require("TextFilterUtils")
10
12
 
@@ -28,7 +30,7 @@ function TextFilterService:_handleServerInvoke(...)
28
30
  return true, filteredName
29
31
  end
30
32
 
31
- function TextFilterService:_turnRequestToPromise(player, request, ...)
33
+ function TextFilterService:_turnRequestToPromise(player: Player, request: string, ...)
32
34
  assert(player, "Bad player")
33
35
  assert(type(request) == "string", "Bad request")
34
36
 
@@ -43,16 +45,21 @@ function TextFilterService:_turnRequestToPromise(player, request, ...)
43
45
  end
44
46
  end
45
47
 
46
- function TextFilterService:_promiseNonChatStringForUser(player, text, fromUserId)
48
+ function TextFilterService:_promiseNonChatStringForUser(
49
+ player: Player,
50
+ text: string,
51
+ fromUserId: number
52
+ ): Promise.Promise<string>
47
53
  assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
48
54
  assert(type(text) == "string", "Bad text")
49
55
  assert(type(fromUserId) == "number", "Bad fromUserId")
50
56
 
51
57
  return TextFilterUtils.promiseNonChatStringForUserAsync(
52
- text,
53
- fromUserId,
54
- player.UserId,
55
- Enum.TextFilterContext.PublicChat)
58
+ text,
59
+ fromUserId,
60
+ player.UserId,
61
+ Enum.TextFilterContext.PublicChat
62
+ )
56
63
  :Catch(function(_)
57
64
  -- Error occurs due to player having left the game, but we still need to display their text, so let's fallback
58
65
  -- to this text
@@ -60,15 +67,16 @@ function TextFilterService:_promiseNonChatStringForUser(player, text, fromUserId
60
67
  end)
61
68
  end
62
69
 
63
- function TextFilterService:_promiseNonChatStringForBroadcast(player, text, fromUserId)
70
+ function TextFilterService:_promiseNonChatStringForBroadcast(
71
+ player: Player,
72
+ text: string,
73
+ fromUserId: number
74
+ ): Promise.Promise<string>
64
75
  assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
65
76
  assert(type(text) == "string", "Bad text")
66
77
  assert(type(fromUserId) == "number", "Bad fromUserId")
67
78
 
68
- return TextFilterUtils.promiseNonChatStringForBroadcast(
69
- text,
70
- fromUserId,
71
- Enum.TextFilterContext.PublicChat)
79
+ return TextFilterUtils.promiseNonChatStringForBroadcast(text, fromUserId, Enum.TextFilterContext.PublicChat)
72
80
  :Catch(function(_)
73
81
  -- Error occurs due to player having left the game, but we still need to display their text, so let's fallback
74
82
  -- to this text
@@ -76,7 +84,10 @@ function TextFilterService:_promiseNonChatStringForBroadcast(player, text, fromU
76
84
  end)
77
85
  end
78
86
 
79
- function TextFilterService:_promisePreviewNonChatStringForBroadcast(player, text)
87
+ function TextFilterService:_promisePreviewNonChatStringForBroadcast(
88
+ player: Player,
89
+ text: string
90
+ ): Promise.Promise<string>
80
91
  assert(typeof(player) == "Instance" and player:IsA("Player"), "Bad player")
81
92
  assert(type(text) == "string", "Bad text")
82
93
 
@@ -84,4 +95,4 @@ function TextFilterService:_promisePreviewNonChatStringForBroadcast(player, text
84
95
  return TextFilterUtils.promiseLegacyChatFilter(player, text)
85
96
  end
86
97
 
87
- return TextFilterService
98
+ return TextFilterService
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  @class TextFilterServiceConstants
3
4
  ]=]
@@ -7,9 +8,9 @@ local require = require(script.Parent.loader).load(script)
7
8
  local Table = require("Table")
8
9
 
9
10
  return Table.readonly({
10
- REMOTE_FUNCTION_NAME = "TextFilterServiceRemoteFunction";
11
+ REMOTE_FUNCTION_NAME = "TextFilterServiceRemoteFunction",
11
12
 
12
- REQUEST_NON_CHAT_STRING_FOR_USER = "NonChatStringForUser";
13
- REQUEST_NON_CHAT_STRING_FOR_BROADCAST = "NonChatStringForBroadcast";
14
- REQUEST_PREVIEW_NON_CHAT_STRING_FOR_BROADCAST = "PreviewNonChatStringForBroadcast";
15
- })
13
+ REQUEST_NON_CHAT_STRING_FOR_USER = "NonChatStringForUser",
14
+ REQUEST_NON_CHAT_STRING_FOR_BROADCAST = "NonChatStringForBroadcast",
15
+ REQUEST_PREVIEW_NON_CHAT_STRING_FOR_BROADCAST = "PreviewNonChatStringForBroadcast",
16
+ })