@quenty/templateprovider 11.56.0 → 11.57.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,16 @@
|
|
|
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
|
+
# [11.57.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/templateprovider@11.56.1...@quenty/templateprovider@11.57.0) (2026-11-24)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Add HasTemplate API ([3fb60ec](https://github.com/Quenty/NevermoreEngine/commit/3fb60ec1116c7f6222a3480573d7358eff119200))
|
|
11
|
+
|
|
12
|
+
## [11.56.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/templateprovider@11.56.0...@quenty/templateprovider@11.56.1) (2026-11-18)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @quenty/templateprovider
|
|
15
|
+
|
|
6
16
|
# [11.56.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/templateprovider@11.55.1...@quenty/templateprovider@11.56.0) (2026-10-24)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @quenty/templateprovider
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/templateprovider",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.57.0",
|
|
4
4
|
"description": "Base of a template retrieval system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,31 +28,31 @@
|
|
|
28
28
|
"Quenty"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/baseobject": "10.16.
|
|
32
|
-
"@quenty/brio": "14.38.
|
|
33
|
-
"@quenty/collectionserviceutils": "8.39.
|
|
31
|
+
"@quenty/baseobject": "10.16.4",
|
|
32
|
+
"@quenty/brio": "14.38.2",
|
|
33
|
+
"@quenty/collectionserviceutils": "8.39.2",
|
|
34
34
|
"@quenty/ducktype": "5.11.3",
|
|
35
35
|
"@quenty/enums": "1.3.3",
|
|
36
|
-
"@quenty/insertserviceutils": "10.25.
|
|
37
|
-
"@quenty/instanceutils": "13.38.
|
|
38
|
-
"@quenty/jestutils": "1.1.
|
|
36
|
+
"@quenty/insertserviceutils": "10.25.2",
|
|
37
|
+
"@quenty/instanceutils": "13.38.2",
|
|
38
|
+
"@quenty/jestutils": "1.1.4",
|
|
39
39
|
"@quenty/loader": "10.11.3",
|
|
40
|
-
"@quenty/maid": "3.12.
|
|
41
|
-
"@quenty/nevermore-test-runner": "1.6.
|
|
42
|
-
"@quenty/observablecollection": "12.
|
|
43
|
-
"@quenty/playermock": "1.11.
|
|
44
|
-
"@quenty/promise": "10.25.
|
|
45
|
-
"@quenty/promisemaid": "5.25.
|
|
46
|
-
"@quenty/remoting": "12.46.
|
|
47
|
-
"@quenty/rx": "13.35.
|
|
48
|
-
"@quenty/servicebag": "11.21.
|
|
49
|
-
"@quenty/string": "3.5.
|
|
40
|
+
"@quenty/maid": "3.12.4",
|
|
41
|
+
"@quenty/nevermore-test-runner": "1.6.4",
|
|
42
|
+
"@quenty/observablecollection": "12.56.0",
|
|
43
|
+
"@quenty/playermock": "1.11.2",
|
|
44
|
+
"@quenty/promise": "10.25.2",
|
|
45
|
+
"@quenty/promisemaid": "5.25.2",
|
|
46
|
+
"@quenty/remoting": "12.46.2",
|
|
47
|
+
"@quenty/rx": "13.35.2",
|
|
48
|
+
"@quenty/servicebag": "11.21.4",
|
|
49
|
+
"@quenty/string": "3.5.4",
|
|
50
50
|
"@quenty/table": "3.9.2",
|
|
51
|
-
"@quenty/tie": "10.52.
|
|
52
|
-
"@quentystudios/jest-lua": "3.10.0-quenty.
|
|
51
|
+
"@quenty/tie": "10.52.2",
|
|
52
|
+
"@quentystudios/jest-lua": "3.10.0-quenty.3"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "191a328ce40545ac6fb0282d33dde5b0576494e6"
|
|
58
58
|
}
|
|
@@ -12,7 +12,6 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|
|
12
12
|
local Jest = require("Jest")
|
|
13
13
|
local JestUtils = require("JestUtils")
|
|
14
14
|
local Maid = require("Maid")
|
|
15
|
-
local PromiseTestUtils = require("PromiseTestUtils")
|
|
16
15
|
local ServiceBag = require("ServiceBag")
|
|
17
16
|
local TaggedTemplateProvider = require("TaggedTemplateProvider")
|
|
18
17
|
local TemplateProvider = require("TemplateProvider")
|
|
@@ -101,14 +100,10 @@ describe("TaggedTemplateProvider.new", function()
|
|
|
101
100
|
local provider = controller.newProvider()
|
|
102
101
|
|
|
103
102
|
local sword = controller.newTagged("Model", "Sword")
|
|
104
|
-
expect(
|
|
105
|
-
return provider:GetTemplate("Sword") == sword
|
|
106
|
-
end)).toBe(true)
|
|
103
|
+
expect(provider:GetTemplate("Sword") == sword).toBe(true)
|
|
107
104
|
|
|
108
105
|
CollectionService:RemoveTag(sword, controller.tagName)
|
|
109
|
-
expect(
|
|
110
|
-
return provider:GetTemplate("Sword") == nil
|
|
111
|
-
end)).toBe(true)
|
|
106
|
+
expect(provider:GetTemplate("Sword")).toBeNil()
|
|
112
107
|
|
|
113
108
|
controller:Destroy()
|
|
114
109
|
end)
|
|
@@ -870,6 +870,19 @@ function TemplateProvider.IsTemplateAvailable(self: TemplateProvider, templateNa
|
|
|
870
870
|
return self._templateMapList:GetItemForKeyAtIndex(templateName, -1) ~= nil
|
|
871
871
|
end
|
|
872
872
|
|
|
873
|
+
--[=[
|
|
874
|
+
Returns whether or not a template exists, including templates the server has not yet replicated
|
|
875
|
+
to the client. Use [TemplateProvider.PromiseTemplate] to retrieve it.
|
|
876
|
+
|
|
877
|
+
@param templateName string
|
|
878
|
+
@return boolean
|
|
879
|
+
]=]
|
|
880
|
+
function TemplateProvider.HasTemplate(self: TemplateProvider, templateName: string): boolean
|
|
881
|
+
assert(type(templateName) == "string", "Bad templateName")
|
|
882
|
+
|
|
883
|
+
return self:_findTemplateOrTombstone(templateName) ~= nil
|
|
884
|
+
end
|
|
885
|
+
|
|
873
886
|
--[=[
|
|
874
887
|
Returns all current registered items.
|
|
875
888
|
|
|
@@ -15,6 +15,7 @@ local Observable = require("Observable")
|
|
|
15
15
|
local PlayerMockService = require("PlayerMockService")
|
|
16
16
|
local PlayerMockServiceClient = require("PlayerMockServiceClient")
|
|
17
17
|
local PromiseTestUtils = require("PromiseTestUtils")
|
|
18
|
+
local RxTestUtils = require("RxTestUtils")
|
|
18
19
|
local ServiceBag = require("ServiceBag")
|
|
19
20
|
local TemplateProvider = require("TemplateProvider")
|
|
20
21
|
local TieRealmService = require("TieRealmService")
|
|
@@ -36,7 +37,7 @@ type Controller = {
|
|
|
36
37
|
newInstance: (className: string, name: string, parent: Instance?) -> Instance,
|
|
37
38
|
newMaid: () -> Maid.Maid,
|
|
38
39
|
newBrioObservable: (template: Instance) -> Observable.Observable<Brio.Brio<Instance>>,
|
|
39
|
-
|
|
40
|
+
maid: Maid.Maid,
|
|
40
41
|
Destroy: (self: Controller) -> (),
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -117,13 +118,7 @@ local function setup(): Controller
|
|
|
117
118
|
end) :: any
|
|
118
119
|
end,
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
local emissions = {}
|
|
122
|
-
maid:GiveTask(observable:Subscribe(function(value)
|
|
123
|
-
table.insert(emissions, value)
|
|
124
|
-
end))
|
|
125
|
-
return emissions
|
|
126
|
-
end,
|
|
121
|
+
maid = maid,
|
|
127
122
|
|
|
128
123
|
Destroy = function(_self)
|
|
129
124
|
maid:DoCleaning()
|
|
@@ -258,9 +253,7 @@ describe("TemplateProvider.GetTemplate", function()
|
|
|
258
253
|
|
|
259
254
|
local sword = controller.newInstance("Model", "Sword", root)
|
|
260
255
|
|
|
261
|
-
expect(
|
|
262
|
-
return provider:GetTemplate("Sword") == sword
|
|
263
|
-
end)).toBe(true)
|
|
256
|
+
expect(provider:GetTemplate("Sword") == sword).toBe(true)
|
|
264
257
|
|
|
265
258
|
controller:Destroy()
|
|
266
259
|
end)
|
|
@@ -273,9 +266,7 @@ describe("TemplateProvider.GetTemplate", function()
|
|
|
273
266
|
|
|
274
267
|
sword.Parent = nil
|
|
275
268
|
|
|
276
|
-
expect(
|
|
277
|
-
return provider:GetTemplate("Sword") == nil
|
|
278
|
-
end)).toBe(true)
|
|
269
|
+
expect(provider:GetTemplate("Sword")).toBeNil()
|
|
279
270
|
|
|
280
271
|
controller:Destroy()
|
|
281
272
|
end)
|
|
@@ -288,9 +279,7 @@ describe("TemplateProvider.GetTemplate", function()
|
|
|
288
279
|
|
|
289
280
|
sword.Name = "Blade"
|
|
290
281
|
|
|
291
|
-
expect(
|
|
292
|
-
return provider:GetTemplate("Blade") == sword and provider:GetTemplate("Sword") == nil
|
|
293
|
-
end)).toBe(true)
|
|
282
|
+
expect(provider:GetTemplate("Blade") == sword and provider:GetTemplate("Sword") == nil).toBe(true)
|
|
294
283
|
|
|
295
284
|
controller:Destroy()
|
|
296
285
|
end)
|
|
@@ -596,8 +585,8 @@ describe("TemplateProvider.GetTemplateList", function()
|
|
|
596
585
|
local list = provider:GetTemplateList()
|
|
597
586
|
|
|
598
587
|
expect(#list).toBe(2)
|
|
599
|
-
expect(
|
|
600
|
-
expect(
|
|
588
|
+
expect(list).toContain(weapons)
|
|
589
|
+
expect(list).toContain(sword)
|
|
601
590
|
|
|
602
591
|
controller:Destroy()
|
|
603
592
|
end)
|
|
@@ -623,8 +612,8 @@ describe("TemplateProvider.GetContainerList", function()
|
|
|
623
612
|
local list = provider:GetContainerList()
|
|
624
613
|
|
|
625
614
|
expect(#list).toBe(2)
|
|
626
|
-
expect(
|
|
627
|
-
expect(
|
|
615
|
+
expect(list).toContain(root)
|
|
616
|
+
expect(list).toContain(weapons)
|
|
628
617
|
|
|
629
618
|
controller:Destroy()
|
|
630
619
|
end)
|
|
@@ -695,7 +684,7 @@ describe("TemplateProvider.ObserveChildTemplateNameList", function()
|
|
|
695
684
|
local controller = setup()
|
|
696
685
|
local provider = controller.newProvider({})
|
|
697
686
|
|
|
698
|
-
local emissions = controller.
|
|
687
|
+
local emissions = RxTestUtils.collectList(controller.maid, provider:ObserveChildTemplateNameList("Weapons"))
|
|
699
688
|
|
|
700
689
|
expect(emissions).toEqual({ {} })
|
|
701
690
|
|
|
@@ -709,7 +698,7 @@ describe("TemplateProvider.ObserveChildTemplateNameList", function()
|
|
|
709
698
|
controller.newInstance("Model", "Sword", weapons)
|
|
710
699
|
local provider = controller.newProvider({})
|
|
711
700
|
|
|
712
|
-
local emissions = controller.
|
|
701
|
+
local emissions = RxTestUtils.collectList(controller.maid, provider:ObserveChildTemplateNameList("Weapons"))
|
|
713
702
|
controller.newMaid():GiveTask(provider:AddTemplates(root))
|
|
714
703
|
|
|
715
704
|
expect(emissions).toEqual({ {}, { "Sword" } })
|
|
@@ -724,18 +713,14 @@ describe("TemplateProvider.ObserveChildTemplateNameList", function()
|
|
|
724
713
|
local sword = controller.newInstance("Model", "Sword", weapons)
|
|
725
714
|
local provider = controller.newProvider(root)
|
|
726
715
|
|
|
727
|
-
local emissions = controller.
|
|
716
|
+
local emissions = RxTestUtils.collectList(controller.maid, provider:ObserveChildTemplateNameList("Weapons"))
|
|
728
717
|
|
|
729
718
|
controller.newInstance("Model", "Bow", weapons)
|
|
730
|
-
expect(
|
|
731
|
-
return #emissions == 2
|
|
732
|
-
end)).toBe(true)
|
|
719
|
+
expect(#emissions).toEqual(2)
|
|
733
720
|
expect(sorted(emissions[2])).toEqual({ "Bow", "Sword" })
|
|
734
721
|
|
|
735
722
|
sword.Parent = nil
|
|
736
|
-
expect(
|
|
737
|
-
return #emissions == 3
|
|
738
|
-
end)).toBe(true)
|
|
723
|
+
expect(#emissions).toEqual(3)
|
|
739
724
|
expect(emissions[3]).toEqual({ "Bow" })
|
|
740
725
|
|
|
741
726
|
controller:Destroy()
|
|
@@ -748,11 +733,9 @@ describe("TemplateProvider.ObserveChildTemplateNameList", function()
|
|
|
748
733
|
local sword = controller.newInstance("Model", "Sword", weapons)
|
|
749
734
|
local provider = controller.newProvider(root)
|
|
750
735
|
|
|
751
|
-
local emissions = controller.
|
|
736
|
+
local emissions = RxTestUtils.collectList(controller.maid, provider:ObserveChildTemplateNameList("Weapons"))
|
|
752
737
|
local handle = controller.newInstance("Part", "Handle", sword)
|
|
753
738
|
handle.Parent = nil
|
|
754
|
-
task.wait()
|
|
755
|
-
task.wait()
|
|
756
739
|
|
|
757
740
|
expect(emissions).toEqual({ { "Sword" } })
|
|
758
741
|
|
|
@@ -775,6 +758,19 @@ describe("TemplateProvider across a server and a client", function()
|
|
|
775
758
|
controller:Destroy()
|
|
776
759
|
end)
|
|
777
760
|
|
|
761
|
+
it("reports unreplicated templates as existing on the client", function()
|
|
762
|
+
local controller = setup()
|
|
763
|
+
local root = controller.newInstance("Folder", "Templates")
|
|
764
|
+
controller.newInstance("Model", "Sword", root)
|
|
765
|
+
local realms = controller.newRealms(root)
|
|
766
|
+
|
|
767
|
+
expect(realms.client:HasTemplate("Sword")).toBe(true)
|
|
768
|
+
expect(realms.client:HasTemplate("Missing")).toBe(false)
|
|
769
|
+
expect(realms.server:HasTemplate("Sword")).toBe(true)
|
|
770
|
+
|
|
771
|
+
controller:Destroy()
|
|
772
|
+
end)
|
|
773
|
+
|
|
778
774
|
it("hands the container its templates back when the server provider is destroyed", function()
|
|
779
775
|
local controller = setup()
|
|
780
776
|
local root = controller.newInstance("Folder", "Templates")
|
|
@@ -820,9 +816,7 @@ describe("TemplateProvider across a server and a client", function()
|
|
|
820
816
|
expect(template).never.toBe(sword)
|
|
821
817
|
expect(template.Name).toBe("Sword")
|
|
822
818
|
expect(template:FindFirstChild("Handle")).never.toBeNil()
|
|
823
|
-
expect(
|
|
824
|
-
return realms.client:GetTemplate("Sword") == template
|
|
825
|
-
end)).toBe(true)
|
|
819
|
+
expect(realms.client:GetTemplate("Sword") == template).toBe(true)
|
|
826
820
|
|
|
827
821
|
controller:Destroy()
|
|
828
822
|
end)
|
|
@@ -908,18 +902,15 @@ describe("TemplateProvider across a server and a client", function()
|
|
|
908
902
|
local sword = controller.newInstance("Model", "Sword", weapons)
|
|
909
903
|
local realms = controller.newRealms(root)
|
|
910
904
|
|
|
911
|
-
local emissions =
|
|
905
|
+
local emissions =
|
|
906
|
+
RxTestUtils.collectList(controller.maid, realms.client:ObserveChildTemplateNameList("Weapons"))
|
|
912
907
|
expect(emissions).toEqual({ { "Sword" } })
|
|
913
908
|
|
|
914
909
|
controller.newInstance("Model", "Bow", weapons)
|
|
915
|
-
expect(
|
|
916
|
-
return table.concat(sorted(emissions[#emissions]), ",") == "Bow,Sword"
|
|
917
|
-
end)).toBe(true)
|
|
910
|
+
expect(table.concat(sorted(emissions[#emissions]), ",")).toEqual("Bow,Sword")
|
|
918
911
|
|
|
919
912
|
sword:Destroy()
|
|
920
|
-
expect(
|
|
921
|
-
return table.concat(emissions[#emissions], ",") == "Bow"
|
|
922
|
-
end)).toBe(true)
|
|
913
|
+
expect(table.concat(emissions[#emissions], ",")).toEqual("Bow")
|
|
923
914
|
|
|
924
915
|
controller:Destroy()
|
|
925
916
|
end)
|