@rbxts/planck 0.2.5 → 0.3.0-alpha.2
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/package.json +40 -51
- package/{out → src}/DependencyGraph.luau +220 -180
- package/src/Phase.d.ts +23 -0
- package/{out → src}/Phase.luau +41 -41
- package/src/Pipeline.d.ts +26 -0
- package/{out → src}/Pipeline.luau +86 -86
- package/src/Scheduler.d.ts +385 -0
- package/{out → src}/Scheduler.luau +207 -44
- package/src/__tests__/InitializerSystems.test.luau +660 -0
- package/src/__tests__/Scheduler.test.luau +313 -0
- package/src/__tests__/conditions.test.luau +147 -0
- package/src/__tests__/hooks.test.luau +54 -0
- package/src/__tests__/systems.test.luau +192 -0
- package/src/conditions.d.ts +69 -0
- package/{out → src}/conditions.luau +189 -151
- package/{out → src}/hooks.luau +163 -145
- package/src/index.d.ts +12 -0
- package/src/init.luau +207 -0
- package/src/utils.d.ts +10 -0
- package/{out → src}/utils.luau +197 -161
- package/out/Phase.d.ts +0 -8
- package/out/Pipeline.d.ts +0 -11
- package/out/Scheduler.d.ts +0 -31
- package/out/conditions.d.ts +0 -14
- package/out/hooks.d.ts +0 -4
- package/out/index.d.ts +0 -18
- package/out/init.luau +0 -143
- package/out/types.d.ts +0 -113
- package/out/utils.d.ts +0 -4
package/package.json
CHANGED
|
@@ -1,51 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"eslint-plugin-prettier": "^5.2.1",
|
|
42
|
-
"eslint-plugin-roblox-ts": "^0.0.36",
|
|
43
|
-
"prettier": "^3.4.2",
|
|
44
|
-
"roblox-ts": "^3.0.0",
|
|
45
|
-
"typescript": "^5.7.2"
|
|
46
|
-
},
|
|
47
|
-
"scripts": {
|
|
48
|
-
"build": "rbxtsc",
|
|
49
|
-
"watch": "rbxtsc -w"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@rbxts/planck",
|
|
3
|
+
"version": "0.3.0-alpha.2",
|
|
4
|
+
"description": "An Agnostic Scheduler for ECS",
|
|
5
|
+
"main": "src",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/YetAnotherClown/planck.git"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "YetAnotherClown",
|
|
12
|
+
"contributors": [
|
|
13
|
+
"YetAnotherClown",
|
|
14
|
+
"MajestikButter"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/YetAnotherClown/planck",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"types": "src/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"src",
|
|
21
|
+
"LICENSE.md",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@rbxts/compiler-types": "^2.3.0-types.1",
|
|
29
|
+
"@rbxts/types": "^1.0.781",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
|
31
|
+
"@typescript-eslint/parser": "^5.8.0",
|
|
32
|
+
"eslint": "^8.5.0",
|
|
33
|
+
"eslint-config-prettier": "^8.3.0",
|
|
34
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
35
|
+
"eslint-plugin-roblox-ts": "^0.0.32",
|
|
36
|
+
"prettier": "^2.5.1",
|
|
37
|
+
"roblox-ts": "^3.0.0",
|
|
38
|
+
"typescript": "^5.4.2"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,180 +1,220 @@
|
|
|
1
|
-
local AdjacencyMatrix = {}
|
|
2
|
-
AdjacencyMatrix.__index = AdjacencyMatrix
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for i = 1, self.length do
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
1
|
+
local AdjacencyMatrix = {}
|
|
2
|
+
AdjacencyMatrix.__index = AdjacencyMatrix
|
|
3
|
+
|
|
4
|
+
export type AdjacencyMatrix = {
|
|
5
|
+
matrix: { { number } },
|
|
6
|
+
length: number,
|
|
7
|
+
width: number,
|
|
8
|
+
|
|
9
|
+
extend: (self: AdjacencyMatrix) -> (),
|
|
10
|
+
setEdge: (self: AdjacencyMatrix, i: number, j: number, v: number) -> (),
|
|
11
|
+
toAdjacencyList: (self: AdjacencyMatrix) -> { { number } },
|
|
12
|
+
topologicalSort: (self: AdjacencyMatrix) -> { number }?,
|
|
13
|
+
new: () -> AdjacencyMatrix,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function AdjacencyMatrix:__tostring()
|
|
17
|
+
local s = "\n"
|
|
18
|
+
|
|
19
|
+
for i = 1, self.length do
|
|
20
|
+
if i == 1 then
|
|
21
|
+
s ..= "\n"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
local sub = ""
|
|
25
|
+
for j = 1, self.width do
|
|
26
|
+
if j == self.width then
|
|
27
|
+
sub ..= `{self.matrix[i][j]}`
|
|
28
|
+
continue
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
sub ..= `{self.matrix[i][j]}, `
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
sub ..= "\n"
|
|
35
|
+
s ..= sub
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
return s
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
function AdjacencyMatrix:extend()
|
|
42
|
+
self.length = (self.length :: number) + 1
|
|
43
|
+
self.width = (self.length :: number) + 1
|
|
44
|
+
|
|
45
|
+
self.matrix[self.length] = {}
|
|
46
|
+
for j = 1, self.width do
|
|
47
|
+
self.matrix[self.length][j] = 0
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
for i = 1, self.length do
|
|
51
|
+
self.matrix[i][self.width] = 0
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
function AdjacencyMatrix:setEdge(i, j, val)
|
|
56
|
+
self.matrix[i][j] = val
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
function AdjacencyMatrix:toAdjacencyList()
|
|
60
|
+
local list = {}
|
|
61
|
+
|
|
62
|
+
for i = 1, self.length do
|
|
63
|
+
list[i] = {}
|
|
64
|
+
for j = 1, self.width do
|
|
65
|
+
if self.matrix[i][j] ~= 0 then
|
|
66
|
+
table.insert(list[i], j)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
return list
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
function AdjacencyMatrix:topologicalSort(): { number }?
|
|
75
|
+
local adjacencyList = self:toAdjacencyList()
|
|
76
|
+
|
|
77
|
+
local result = {}
|
|
78
|
+
local inDegrees = table.create(self.length, 0)
|
|
79
|
+
|
|
80
|
+
for i = 1, self.length do
|
|
81
|
+
for _, j in adjacencyList[i] do
|
|
82
|
+
inDegrees[j] += 1
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
local queue = {}
|
|
87
|
+
for i = 1, self.length do
|
|
88
|
+
if inDegrees[i] == 0 then
|
|
89
|
+
table.insert(queue, i)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
while #queue ~= 0 do
|
|
94
|
+
local i = table.remove(queue, 1) :: number
|
|
95
|
+
table.insert(result, i)
|
|
96
|
+
|
|
97
|
+
for _, j in adjacencyList[i] do
|
|
98
|
+
inDegrees[j] -= 1
|
|
99
|
+
if inDegrees[j] == 0 then
|
|
100
|
+
table.insert(queue, j)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
if #result ~= self.length then
|
|
106
|
+
return nil
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
return result
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
function AdjacencyMatrix.new(): AdjacencyMatrix
|
|
113
|
+
return setmetatable({
|
|
114
|
+
matrix = {},
|
|
115
|
+
length = 0,
|
|
116
|
+
width = 0,
|
|
117
|
+
}, AdjacencyMatrix) :: any
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
export type DependencyGraph<T> = {
|
|
121
|
+
nodes: { T },
|
|
122
|
+
matrix: AdjacencyMatrix,
|
|
123
|
+
length: number,
|
|
124
|
+
width: number,
|
|
125
|
+
|
|
126
|
+
getOrderedList: (self: DependencyGraph<T>) -> { T }?,
|
|
127
|
+
insert: (self: DependencyGraph<T>, node: T) -> DependencyGraph<T>,
|
|
128
|
+
insertAfter: (
|
|
129
|
+
self: DependencyGraph<T>,
|
|
130
|
+
node: T,
|
|
131
|
+
afterNode: T
|
|
132
|
+
) -> DependencyGraph<T>,
|
|
133
|
+
insertBefore: (
|
|
134
|
+
self: DependencyGraph<T>,
|
|
135
|
+
node: T,
|
|
136
|
+
beforeNode: T
|
|
137
|
+
) -> DependencyGraph<T>,
|
|
138
|
+
new: () -> DependencyGraph<T>,
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
local DependencyGraph = {}
|
|
142
|
+
DependencyGraph.__index = DependencyGraph
|
|
143
|
+
|
|
144
|
+
function DependencyGraph:getOrderedList(): { any }?
|
|
145
|
+
local orderedList = {}
|
|
146
|
+
|
|
147
|
+
local topologicalSort = self.matrix:topologicalSort()
|
|
148
|
+
if not topologicalSort then
|
|
149
|
+
return nil
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
for _, i in topologicalSort do
|
|
153
|
+
table.insert(orderedList, self.nodes[i])
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
return orderedList
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
function DependencyGraph:insertBefore(node, beforeNode)
|
|
160
|
+
if not table.find(self.nodes, beforeNode) then
|
|
161
|
+
error("Node not found in DependencyGraph:insertBefore(_, unknown)")
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
local j = table.find(self.nodes, node)
|
|
165
|
+
if not j then
|
|
166
|
+
table.insert(self.nodes, node)
|
|
167
|
+
j = #self.nodes
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
local i = table.find(self.nodes, beforeNode)
|
|
171
|
+
|
|
172
|
+
self.matrix:extend()
|
|
173
|
+
self.matrix:setEdge(j, i, 1)
|
|
174
|
+
|
|
175
|
+
return self
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
function DependencyGraph:insertAfter(node, afterNode)
|
|
179
|
+
if not table.find(self.nodes, afterNode) then
|
|
180
|
+
error("Node not found in DependencyGraph:insertAfter(_, unknown)")
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
local j = table.find(self.nodes, node)
|
|
184
|
+
if not j then
|
|
185
|
+
table.insert(self.nodes, node)
|
|
186
|
+
j = #self.nodes
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
local i = table.find(self.nodes, afterNode)
|
|
190
|
+
|
|
191
|
+
self.matrix:extend()
|
|
192
|
+
self.matrix:setEdge(i, j, 1)
|
|
193
|
+
|
|
194
|
+
return self
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
function DependencyGraph:insert(node)
|
|
198
|
+
local i = #self.nodes
|
|
199
|
+
table.insert(self.nodes, node)
|
|
200
|
+
local j = #self.nodes
|
|
201
|
+
|
|
202
|
+
self.matrix:extend()
|
|
203
|
+
|
|
204
|
+
if i ~= 0 then
|
|
205
|
+
self.matrix:setEdge(i, j, 1)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
return self
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
function DependencyGraph.new<T>(): DependencyGraph<T>
|
|
212
|
+
return setmetatable({
|
|
213
|
+
nodes = {},
|
|
214
|
+
matrix = AdjacencyMatrix.new(),
|
|
215
|
+
length = 0,
|
|
216
|
+
width = 0,
|
|
217
|
+
}, DependencyGraph) :: any
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
return DependencyGraph
|
package/src/Phase.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phases represent tags that tell the scheduler when to
|
|
3
|
+
* schedule a set of systems.
|
|
4
|
+
*/
|
|
5
|
+
export class Phase {
|
|
6
|
+
/** Runs before the `Startup` Phase. */
|
|
7
|
+
static PreStartup: Phase;
|
|
8
|
+
/**
|
|
9
|
+
* This Phase will run once, the first time the Scheduler is ran,
|
|
10
|
+
* before any other Phases are ran.
|
|
11
|
+
*/
|
|
12
|
+
static Startup: Phase;
|
|
13
|
+
/** Runs after the `Startup` phase. */
|
|
14
|
+
static PostStartup: Phase;
|
|
15
|
+
|
|
16
|
+
private _type: "phase";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new Phase, with an optional name to use for debugging.
|
|
20
|
+
* When no name is provided, the script and line number will be used.
|
|
21
|
+
*/
|
|
22
|
+
constructor(name?: string);
|
|
23
|
+
}
|
package/{out → src}/Phase.luau
RENAMED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
--- @class Phase
|
|
2
|
-
---
|
|
3
|
-
--- Phases represent tags that tell the scheduler when to
|
|
4
|
-
--- schedule a set of systems.
|
|
5
|
-
local Phase = {}
|
|
6
|
-
Phase.__index = Phase
|
|
7
|
-
|
|
8
|
-
function Phase:__tostring()
|
|
9
|
-
return self._name
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
--- @within Phase
|
|
13
|
-
---
|
|
14
|
-
--- Creates a new Phase, with an optional name to use for debugging.
|
|
15
|
-
--- When no name is provided, the script and line number will be used.
|
|
16
|
-
function Phase.new(name: string?)
|
|
17
|
-
name = name or debug.info(2, "sl")
|
|
18
|
-
return setmetatable({
|
|
19
|
-
_name = name,
|
|
20
|
-
_type = "phase",
|
|
21
|
-
}, Phase)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
--- @prop PreStartup Phase
|
|
25
|
-
--- @within Phase
|
|
26
|
-
--- Runs before the `Startup` Phase.
|
|
27
|
-
|
|
28
|
-
--- @prop Startup Phase
|
|
29
|
-
--- @within Phase
|
|
30
|
-
--- This Phase will run once, the first time the Scheduler is ran,
|
|
31
|
-
--- before any other Phases are ran.
|
|
32
|
-
|
|
33
|
-
--- @prop PostStartup Phase
|
|
34
|
-
--- @within Phase
|
|
35
|
-
--- Runs after the `Startup` phase.
|
|
36
|
-
|
|
37
|
-
Phase.PreStartup = Phase.new("PreStartup")
|
|
38
|
-
Phase.Startup = Phase.new("Startup")
|
|
39
|
-
Phase.PostStartup = Phase.new("PostStartup")
|
|
40
|
-
|
|
41
|
-
return Phase
|
|
1
|
+
--- @class Phase
|
|
2
|
+
---
|
|
3
|
+
--- Phases represent tags that tell the scheduler when to
|
|
4
|
+
--- schedule a set of systems.
|
|
5
|
+
local Phase = {}
|
|
6
|
+
Phase.__index = Phase
|
|
7
|
+
|
|
8
|
+
function Phase:__tostring()
|
|
9
|
+
return self._name
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
--- @within Phase
|
|
13
|
+
---
|
|
14
|
+
--- Creates a new Phase, with an optional name to use for debugging.
|
|
15
|
+
--- When no name is provided, the script and line number will be used.
|
|
16
|
+
function Phase.new(name: string?)
|
|
17
|
+
name = name or debug.info(2, "sl")
|
|
18
|
+
return setmetatable({
|
|
19
|
+
_name = name,
|
|
20
|
+
_type = "phase",
|
|
21
|
+
}, Phase)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
--- @prop PreStartup Phase
|
|
25
|
+
--- @within Phase
|
|
26
|
+
--- Runs before the `Startup` Phase.
|
|
27
|
+
|
|
28
|
+
--- @prop Startup Phase
|
|
29
|
+
--- @within Phase
|
|
30
|
+
--- This Phase will run once, the first time the Scheduler is ran,
|
|
31
|
+
--- before any other Phases are ran.
|
|
32
|
+
|
|
33
|
+
--- @prop PostStartup Phase
|
|
34
|
+
--- @within Phase
|
|
35
|
+
--- Runs after the `Startup` phase.
|
|
36
|
+
|
|
37
|
+
Phase.PreStartup = Phase.new("PreStartup")
|
|
38
|
+
Phase.Startup = Phase.new("Startup")
|
|
39
|
+
Phase.PostStartup = Phase.new("PostStartup")
|
|
40
|
+
|
|
41
|
+
return Phase
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Phase } from "./Phase";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pipelines represent a set of ordered Phases. Systems cannot be
|
|
5
|
+
* assigned to Pipelines themselves, but rather to Phases within
|
|
6
|
+
* those Pipelines.
|
|
7
|
+
*/
|
|
8
|
+
export class Pipeline {
|
|
9
|
+
/** A Pipeline containing the `PreStartup`, `Startup`, and `PostStartup` phases. */
|
|
10
|
+
static Startup: Pipeline;
|
|
11
|
+
|
|
12
|
+
private _type: "pipeline";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new Pipeline, with an optional name to use for debugging.
|
|
16
|
+
* When no name is provided, the script and line number will be used.
|
|
17
|
+
*/
|
|
18
|
+
constructor(name?: string);
|
|
19
|
+
|
|
20
|
+
/** Adds a Phase to the Pipeline, ordering it implicitly. */
|
|
21
|
+
insert(phase: Phase): this;
|
|
22
|
+
/** Adds a Phase to the Pipeline after another Phase, ordering it explicitly. */
|
|
23
|
+
insertAfter(phase: Phase, after: Phase): this;
|
|
24
|
+
/** Adds a Phase to the Pipeline before another Phase, ordering it explicitly. */
|
|
25
|
+
insertBefore(phase: Phase, before: Phase): this;
|
|
26
|
+
}
|