@shirokasoke/webapi-sdk 2.9.0-beta2-0.11-pre
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/dist/client.d.ts +576 -0
- package/dist/client.js +668 -0
- package/dist/esm/client.js +663 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/test.js +6 -0
- package/dist/esm/types/ae2.js +1 -0
- package/dist/esm/types/block.js +1 -0
- package/dist/esm/types/chunk.js +1 -0
- package/dist/esm/types/common.js +1 -0
- package/dist/esm/types/entity.js +1 -0
- package/dist/esm/types/fluid.js +1 -0
- package/dist/esm/types/fmp.js +1 -0
- package/dist/esm/types/gt5.js +1 -0
- package/dist/esm/types/index.js +13 -0
- package/dist/esm/types/item.js +1 -0
- package/dist/esm/types/rawInfo.js +1 -0
- package/dist/esm/types/recipe.js +1 -0
- package/dist/esm/types/threeD.js +1 -0
- package/dist/esm/types/world.js +1 -0
- package/dist/esm/validators/ae2.js +163 -0
- package/dist/esm/validators/block.js +85 -0
- package/dist/esm/validators/chunk.js +58 -0
- package/dist/esm/validators/common.js +28 -0
- package/dist/esm/validators/entity.js +117 -0
- package/dist/esm/validators/fluid.js +24 -0
- package/dist/esm/validators/fmp.js +34 -0
- package/dist/esm/validators/gt5.js +186 -0
- package/dist/esm/validators/index.js +13 -0
- package/dist/esm/validators/item.js +31 -0
- package/dist/esm/validators/rawInfo.js +25 -0
- package/dist/esm/validators/recipe.js +77 -0
- package/dist/esm/validators/threeD.js +34 -0
- package/dist/esm/validators/world.js +59 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +22 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.js +8 -0
- package/dist/types/ae2.d.ts +162 -0
- package/dist/types/ae2.js +2 -0
- package/dist/types/block.d.ts +87 -0
- package/dist/types/block.js +2 -0
- package/dist/types/chunk.d.ts +57 -0
- package/dist/types/chunk.js +2 -0
- package/dist/types/common.d.ts +27 -0
- package/dist/types/common.js +2 -0
- package/dist/types/entity.d.ts +114 -0
- package/dist/types/entity.js +2 -0
- package/dist/types/fluid.d.ts +23 -0
- package/dist/types/fluid.js +2 -0
- package/dist/types/fmp.d.ts +33 -0
- package/dist/types/fmp.js +2 -0
- package/dist/types/gt5.d.ts +210 -0
- package/dist/types/gt5.js +2 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +29 -0
- package/dist/types/item.d.ts +38 -0
- package/dist/types/item.js +2 -0
- package/dist/types/rawInfo.d.ts +25 -0
- package/dist/types/rawInfo.js +2 -0
- package/dist/types/recipe.d.ts +114 -0
- package/dist/types/recipe.js +2 -0
- package/dist/types/threeD.d.ts +43 -0
- package/dist/types/threeD.js +2 -0
- package/dist/types/world.d.ts +58 -0
- package/dist/types/world.js +2 -0
- package/dist/validators/ae2.d.ts +63 -0
- package/dist/validators/ae2.js +169 -0
- package/dist/validators/block.d.ts +12 -0
- package/dist/validators/block.js +91 -0
- package/dist/validators/chunk.d.ts +9 -0
- package/dist/validators/chunk.js +64 -0
- package/dist/validators/common.d.ts +8 -0
- package/dist/validators/common.js +36 -0
- package/dist/validators/entity.d.ts +9 -0
- package/dist/validators/entity.js +123 -0
- package/dist/validators/fluid.d.ts +4 -0
- package/dist/validators/fluid.js +30 -0
- package/dist/validators/fmp.d.ts +4 -0
- package/dist/validators/fmp.js +40 -0
- package/dist/validators/gt5.d.ts +24 -0
- package/dist/validators/gt5.js +192 -0
- package/dist/validators/index.d.ts +13 -0
- package/dist/validators/index.js +29 -0
- package/dist/validators/item.d.ts +13 -0
- package/dist/validators/item.js +37 -0
- package/dist/validators/rawInfo.d.ts +6 -0
- package/dist/validators/rawInfo.js +31 -0
- package/dist/validators/recipe.d.ts +30 -0
- package/dist/validators/recipe.js +83 -0
- package/dist/validators/threeD.d.ts +8 -0
- package/dist/validators/threeD.js +40 -0
- package/dist/validators/world.d.ts +5 -0
- package/dist/validators/world.js +65 -0
- package/package.json +49 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
import { ClassInfoSchema } from "./common";
|
|
3
|
+
import { FluidSchema } from "./fluid";
|
|
4
|
+
// ========== GT5 Machine Base ==========
|
|
5
|
+
export const GT5MachineTypeSchema = Joi.string().valid("MULTIBLOCK", "SINGLE", "GENERATOR", "HATCH", "UNKNOWN");
|
|
6
|
+
export const GT5ShutDownReasonSchema = Joi.object({
|
|
7
|
+
id: Joi.string().required(),
|
|
8
|
+
displayString: Joi.string().allow("").required(),
|
|
9
|
+
wasCritical: Joi.boolean().required(),
|
|
10
|
+
});
|
|
11
|
+
export const GT5MachineIOSchema = Joi.object({
|
|
12
|
+
storedEU: Joi.number().required(),
|
|
13
|
+
euCapacity: Joi.number().required(),
|
|
14
|
+
Info: Joi.array()
|
|
15
|
+
.items(Joi.string())
|
|
16
|
+
.required(),
|
|
17
|
+
rawInfo: Joi.object()
|
|
18
|
+
.pattern(Joi.string(), Joi.string())
|
|
19
|
+
.required(),
|
|
20
|
+
inputVoltage: Joi.number().optional(),
|
|
21
|
+
inputAmperage: Joi.number().optional(),
|
|
22
|
+
outputVoltage: Joi.number().optional(),
|
|
23
|
+
outputAmperage: Joi.number().optional(),
|
|
24
|
+
});
|
|
25
|
+
export const GT5MachineStateSchema = Joi.object({
|
|
26
|
+
isActive: Joi.boolean().required(),
|
|
27
|
+
isAllowedToWork: Joi.boolean().required(),
|
|
28
|
+
wasShutdown: Joi.boolean().optional(),
|
|
29
|
+
lastShutDownReason: GT5ShutDownReasonSchema.optional(),
|
|
30
|
+
}).concat(GT5MachineIOSchema);
|
|
31
|
+
export const GT5HatchCoordSchema = Joi.object({
|
|
32
|
+
x: Joi.number().required(),
|
|
33
|
+
y: Joi.number().required(),
|
|
34
|
+
z: Joi.number().required(),
|
|
35
|
+
});
|
|
36
|
+
export const GT5MaintenanceStateSchema = Joi.object({
|
|
37
|
+
wrench: Joi.boolean().required(),
|
|
38
|
+
screwdriver: Joi.boolean().required(),
|
|
39
|
+
softMallet: Joi.boolean().required(),
|
|
40
|
+
hardHammer: Joi.boolean().required(),
|
|
41
|
+
solderingTool: Joi.boolean().required(),
|
|
42
|
+
crowbar: Joi.boolean().required(),
|
|
43
|
+
});
|
|
44
|
+
export const GT5HatchesSchema = Joi.object({
|
|
45
|
+
inputBus: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
46
|
+
outputBus: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
47
|
+
inputHatch: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
48
|
+
outputHatch: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
49
|
+
energyHatch: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
50
|
+
dynamoHatch: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
51
|
+
maintenanceHatch: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
52
|
+
mufflerHatch: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
53
|
+
dualInputHatch: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
54
|
+
smartInputHatch: Joi.array().items(GT5HatchCoordSchema).required(),
|
|
55
|
+
});
|
|
56
|
+
export const GT5MultiBlockInfoSchema = Joi.object({
|
|
57
|
+
structureValid: Joi.boolean().required(),
|
|
58
|
+
progressTime: Joi.number().required(),
|
|
59
|
+
maxProgressTime: Joi.number().required(),
|
|
60
|
+
euT: Joi.number().required(),
|
|
61
|
+
efficiency: Joi.number().required(),
|
|
62
|
+
pollution: Joi.number().required(),
|
|
63
|
+
inputVoltageTier: Joi.number().required(),
|
|
64
|
+
maxInputEu: Joi.number().required(),
|
|
65
|
+
maxInputAmps: Joi.number().required(),
|
|
66
|
+
storedEnergy: Joi.number().required(),
|
|
67
|
+
maxEnergy: Joi.number().required(),
|
|
68
|
+
maxParallelRecipes: Joi.number().required(),
|
|
69
|
+
trueParallel: Joi.number().required(),
|
|
70
|
+
maintenance: GT5MaintenanceStateSchema.required(),
|
|
71
|
+
hatches: GT5HatchesSchema.required(),
|
|
72
|
+
});
|
|
73
|
+
export const GT5HatchInfoSchema = Joi.object({
|
|
74
|
+
tier: Joi.number().required(),
|
|
75
|
+
});
|
|
76
|
+
export const GT5SingleBlockInfoSchema = Joi.object({
|
|
77
|
+
tier: Joi.number().required(),
|
|
78
|
+
progressTime: Joi.number().required(),
|
|
79
|
+
maxProgressTime: Joi.number().required(),
|
|
80
|
+
euT: Joi.number().required(),
|
|
81
|
+
inputSlotCount: Joi.number().required(),
|
|
82
|
+
amperage: Joi.number().required(),
|
|
83
|
+
mainFacing: Joi.string().required(),
|
|
84
|
+
});
|
|
85
|
+
export const GT5GeneratorInfoSchema = Joi.object({
|
|
86
|
+
tier: Joi.number().required(),
|
|
87
|
+
storedEU: Joi.number().required(),
|
|
88
|
+
maxEUStore: Joi.number().required(),
|
|
89
|
+
pollution: Joi.number().required(),
|
|
90
|
+
efficiency: Joi.number().required(),
|
|
91
|
+
recipeMap: Joi.string().optional(),
|
|
92
|
+
maxEUOutput: Joi.number().required(),
|
|
93
|
+
capacity: Joi.number().required(),
|
|
94
|
+
fluid: FluidSchema.optional(),
|
|
95
|
+
});
|
|
96
|
+
const GT5MachineFieldsSchema = Joi.object({
|
|
97
|
+
machineType: GT5MachineTypeSchema.required(),
|
|
98
|
+
multi: GT5MultiBlockInfoSchema.when("machineType", { is: "MULTIBLOCK", then: Joi.required() }),
|
|
99
|
+
single: GT5SingleBlockInfoSchema.when("machineType", { is: "SINGLE", then: Joi.required() }),
|
|
100
|
+
generator: GT5GeneratorInfoSchema.when("machineType", { is: "GENERATOR", then: Joi.required() }),
|
|
101
|
+
hatch: GT5HatchInfoSchema.when("machineType", { is: "HATCH", then: Joi.required() }),
|
|
102
|
+
});
|
|
103
|
+
export const GT5MachineInfoSchema = Joi.object({
|
|
104
|
+
x: Joi.number().required(),
|
|
105
|
+
y: Joi.number().required(),
|
|
106
|
+
z: Joi.number().required(),
|
|
107
|
+
dimension: Joi.number().required(),
|
|
108
|
+
localName: Joi.string().required(),
|
|
109
|
+
internalName: Joi.string().required(),
|
|
110
|
+
metaTileID: Joi.number().required(),
|
|
111
|
+
owner: Joi.string().required(),
|
|
112
|
+
state: GT5MachineStateSchema.required(),
|
|
113
|
+
class: ClassInfoSchema.optional(),
|
|
114
|
+
nbt: Joi.object().unknown().required(),
|
|
115
|
+
}).concat(GT5MachineFieldsSchema);
|
|
116
|
+
export const GT5BatchMachineCoordSchema = Joi.object({
|
|
117
|
+
x: Joi.number().required(),
|
|
118
|
+
y: Joi.number().required(),
|
|
119
|
+
z: Joi.number().required(),
|
|
120
|
+
dim: Joi.number().optional(),
|
|
121
|
+
});
|
|
122
|
+
export const GT5BatchSubmitResultSchema = Joi.object({
|
|
123
|
+
id: Joi.string().required(),
|
|
124
|
+
total: Joi.number().required(),
|
|
125
|
+
});
|
|
126
|
+
export const GT5BatchRerunResultSchema = Joi.object({
|
|
127
|
+
id: Joi.string().required(),
|
|
128
|
+
total: Joi.number().required(),
|
|
129
|
+
runCount: Joi.number().required(),
|
|
130
|
+
});
|
|
131
|
+
export const GT5BatchJobStatusSchema = Joi.string().valid("pending", "running", "completed");
|
|
132
|
+
export const GT5BatchJobResultSchema = Joi.object({
|
|
133
|
+
id: Joi.string().required(),
|
|
134
|
+
total: Joi.number().required(),
|
|
135
|
+
completed: Joi.number().required(),
|
|
136
|
+
success: Joi.number().required(),
|
|
137
|
+
failed: Joi.number().required(),
|
|
138
|
+
status: GT5BatchJobStatusSchema.required(),
|
|
139
|
+
runCount: Joi.number().required(),
|
|
140
|
+
createTime: Joi.number().required(),
|
|
141
|
+
finishTime: Joi.number().optional(),
|
|
142
|
+
durationMs: Joi.number().optional(),
|
|
143
|
+
errors: Joi.array().items(Joi.string()).optional(),
|
|
144
|
+
errorsTruncated: Joi.number().optional(),
|
|
145
|
+
machines: Joi.array().items(GT5MachineInfoSchema).optional(),
|
|
146
|
+
});
|
|
147
|
+
// ========== GT5 Chunk Scan ==========
|
|
148
|
+
export const GT5ScanSubmitResultSchema = Joi.object({
|
|
149
|
+
id: Joi.string().required(),
|
|
150
|
+
total: Joi.number().required(),
|
|
151
|
+
});
|
|
152
|
+
export const GT5ScanMachineSchema = Joi.object({
|
|
153
|
+
x: Joi.number().required(),
|
|
154
|
+
y: Joi.number().required(),
|
|
155
|
+
z: Joi.number().required(),
|
|
156
|
+
machineType: GT5MachineTypeSchema.required(),
|
|
157
|
+
localName: Joi.string().required(),
|
|
158
|
+
internalName: Joi.string().required(),
|
|
159
|
+
metaTileID: Joi.number().required(),
|
|
160
|
+
owner: Joi.string().required(),
|
|
161
|
+
});
|
|
162
|
+
export const GT5ScanResultSchema = Joi.object({
|
|
163
|
+
chunkX: Joi.number().required(),
|
|
164
|
+
chunkZ: Joi.number().required(),
|
|
165
|
+
dimension: Joi.number().required(),
|
|
166
|
+
totalMachines: Joi.number().required(),
|
|
167
|
+
machines: Joi.array().items(GT5ScanMachineSchema).required(),
|
|
168
|
+
});
|
|
169
|
+
export const GT5ScanJobStatusSchema = Joi.string().valid("pending", "running", "completed");
|
|
170
|
+
export const GT5ScanJobResultSchema = Joi.object({
|
|
171
|
+
id: Joi.string().required(),
|
|
172
|
+
total: Joi.number().required(),
|
|
173
|
+
completed: Joi.number().required(),
|
|
174
|
+
success: Joi.number().required(),
|
|
175
|
+
failed: Joi.number().required(),
|
|
176
|
+
status: GT5ScanJobStatusSchema.required(),
|
|
177
|
+
createTime: Joi.number().required(),
|
|
178
|
+
chunkX: Joi.number().required(),
|
|
179
|
+
chunkZ: Joi.number().required(),
|
|
180
|
+
dimension: Joi.number().required(),
|
|
181
|
+
finishTime: Joi.number().optional(),
|
|
182
|
+
durationMs: Joi.number().optional(),
|
|
183
|
+
errors: Joi.array().items(Joi.string()).optional(),
|
|
184
|
+
errorsTruncated: Joi.number().optional(),
|
|
185
|
+
result: GT5ScanResultSchema.optional(),
|
|
186
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./ae2";
|
|
2
|
+
export * from "./block";
|
|
3
|
+
export * from "./chunk";
|
|
4
|
+
export * from "./common";
|
|
5
|
+
export * from "./entity";
|
|
6
|
+
export * from "./fmp";
|
|
7
|
+
export * from "./fluid";
|
|
8
|
+
export * from "./item";
|
|
9
|
+
export * from "./world";
|
|
10
|
+
export * from "./gt5";
|
|
11
|
+
export * from "./rawInfo";
|
|
12
|
+
export * from "./recipe";
|
|
13
|
+
export * from "./threeD";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
import { ClassInfoSchema } from "./common";
|
|
3
|
+
export const NBTDataSchema = Joi.object({
|
|
4
|
+
nbtstr: Joi.string().optional(),
|
|
5
|
+
nbtWrite: Joi.string().optional(),
|
|
6
|
+
nbt: Joi.object().unknown().optional(),
|
|
7
|
+
});
|
|
8
|
+
export const ItemSchema = Joi.object({
|
|
9
|
+
class: ClassInfoSchema.optional(),
|
|
10
|
+
id: Joi.number().required(),
|
|
11
|
+
registryName: Joi.string().required(),
|
|
12
|
+
UnlocalizedName: Joi.string().required(),
|
|
13
|
+
localizedName: Joi.string().required(),
|
|
14
|
+
HasSubtypes: Joi.boolean().required(),
|
|
15
|
+
});
|
|
16
|
+
export const ItemStackSchema = ItemSchema.append({
|
|
17
|
+
MaxStackSize: Joi.number().required(),
|
|
18
|
+
damageable: Joi.boolean().required(),
|
|
19
|
+
damage: Joi.number().required(),
|
|
20
|
+
AttributeModifiers: Joi.object().unknown().optional(),
|
|
21
|
+
stackSize: Joi.number().optional(),
|
|
22
|
+
}).concat(NBTDataSchema);
|
|
23
|
+
export const ItemDetailSchema = ItemStackSchema.append({
|
|
24
|
+
subs: Joi.array().items(ItemStackSchema).optional(),
|
|
25
|
+
});
|
|
26
|
+
export const AEItemDefinitionsSchema = Joi.object({
|
|
27
|
+
items: Joi.array().items(ItemStackSchema.append({ name: Joi.string().required() })).required(),
|
|
28
|
+
parts: Joi.array().items(ItemStackSchema.append({ name: Joi.string().required() })).required(),
|
|
29
|
+
materials: Joi.array().items(ItemStackSchema.append({ name: Joi.string().required() })).required(),
|
|
30
|
+
blocks: Joi.array().items(ItemStackSchema.append({ name: Joi.string().required() })).required(),
|
|
31
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
/**
|
|
3
|
+
* 校验并转换 LSC rawInfo 为强类型视图({@link LSCRawInfoMap})。
|
|
4
|
+
*/
|
|
5
|
+
export const LSCInfoSchema = Joi.object({
|
|
6
|
+
stored: Joi.number().unsafe().required(),
|
|
7
|
+
capacity: Joi.number().unsafe().required(),
|
|
8
|
+
inputLastTick: Joi.number().required(),
|
|
9
|
+
outputLastTick: Joi.number().required(),
|
|
10
|
+
passiveDischargeAmount: Joi.number().required(),
|
|
11
|
+
avgInput100t: Joi.number().required(),
|
|
12
|
+
avgOutput100t: Joi.number().required(),
|
|
13
|
+
avgInput5m: Joi.number().required(),
|
|
14
|
+
avgOutput5m: Joi.number().required(),
|
|
15
|
+
avgInput1h: Joi.number().required(),
|
|
16
|
+
avgOutput1h: Joi.number().required(),
|
|
17
|
+
maxEUInput: Joi.number().required(),
|
|
18
|
+
maxEUOutput: Joi.number().required(),
|
|
19
|
+
wirelessMode: Joi.boolean().required(),
|
|
20
|
+
wirelessEU: Joi.number().unsafe().optional(),
|
|
21
|
+
capacitorUHV: Joi.number().required(),
|
|
22
|
+
capacitorUEV: Joi.number().required(),
|
|
23
|
+
capacitorUIV: Joi.number().required(),
|
|
24
|
+
capacitorUMV: Joi.number().required(),
|
|
25
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
import { FluidSchema } from "./fluid";
|
|
3
|
+
import { ItemStackSchema } from "./item";
|
|
4
|
+
/** 带 stackSize 的物品堆(配方中始终输出 stackSize) */
|
|
5
|
+
export const RecipeItemStackSchema = ItemStackSchema.append({ stackSize: Joi.number().required() });
|
|
6
|
+
/** 带 stackSize 的物品堆,但也允许缺失(用于 query 回显等场景) */
|
|
7
|
+
export const RecipeItemStackLooseSchema = ItemStackSchema.append({ stackSize: Joi.number().optional() });
|
|
8
|
+
export const RecipeIngredientSchema = Joi.object({
|
|
9
|
+
ores: Joi.array().items(Joi.string()).optional(),
|
|
10
|
+
items: Joi.array().items(RecipeItemStackSchema).required(),
|
|
11
|
+
});
|
|
12
|
+
export const CraftingRecipeSchema = Joi.object({
|
|
13
|
+
recipeClass: Joi.string().required(),
|
|
14
|
+
type: Joi.valid("shaped", "shapeless", "unknown").required(),
|
|
15
|
+
shapeless: Joi.boolean().required(),
|
|
16
|
+
width: Joi.number().optional(),
|
|
17
|
+
height: Joi.number().optional(),
|
|
18
|
+
grid: Joi.array().items(Joi.array().items(Joi.alternatives(RecipeIngredientSchema, Joi.valid(null)))).optional(),
|
|
19
|
+
ingredients: Joi.array().items(RecipeIngredientSchema).optional(),
|
|
20
|
+
output: Joi.alternatives(RecipeItemStackSchema, Joi.valid(null)).required(),
|
|
21
|
+
});
|
|
22
|
+
export const CraftingRecipesResultSchema = Joi.object({
|
|
23
|
+
type: Joi.valid("crafting").required(),
|
|
24
|
+
queryType: Joi.valid("output", "input").required(),
|
|
25
|
+
count: Joi.number().required(),
|
|
26
|
+
offset: Joi.number().required(),
|
|
27
|
+
total: Joi.number().optional(),
|
|
28
|
+
query: RecipeItemStackLooseSchema.optional(),
|
|
29
|
+
recipes: Joi.array().items(CraftingRecipeSchema).required(),
|
|
30
|
+
});
|
|
31
|
+
export const FurnaceRecipeSchema = Joi.object({
|
|
32
|
+
input: RecipeItemStackSchema.required(),
|
|
33
|
+
output: RecipeItemStackSchema.required(),
|
|
34
|
+
});
|
|
35
|
+
export const FurnaceRecipesResultSchema = Joi.object({
|
|
36
|
+
type: Joi.valid("furnace").required(),
|
|
37
|
+
queryType: Joi.valid("output", "input").required(),
|
|
38
|
+
count: Joi.number().required(),
|
|
39
|
+
offset: Joi.number().required(),
|
|
40
|
+
query: RecipeItemStackLooseSchema.optional(),
|
|
41
|
+
recipes: Joi.array().items(FurnaceRecipeSchema).required(),
|
|
42
|
+
});
|
|
43
|
+
export const GTRecipeMapSchema = Joi.object({
|
|
44
|
+
unlocalizedName: Joi.string().required(),
|
|
45
|
+
name: Joi.string().required(),
|
|
46
|
+
});
|
|
47
|
+
/** 配方中的流体堆,附加 amount */
|
|
48
|
+
export const RecipeFluidStackSchema = FluidSchema.append({ amount: Joi.number().required() });
|
|
49
|
+
const GTRecipeIOItemsSchema = Joi.array().items(Joi.alternatives(RecipeItemStackSchema, Joi.valid(null))).required();
|
|
50
|
+
const GTRecipeIOFluidsSchema = Joi.array().items(Joi.alternatives(RecipeFluidStackSchema, Joi.valid(null))).required();
|
|
51
|
+
export const GTRecipeSchema = Joi.object({
|
|
52
|
+
recipeMap: Joi.string().required(),
|
|
53
|
+
recipeMapName: Joi.string().required(),
|
|
54
|
+
duration: Joi.number().required(),
|
|
55
|
+
eut: Joi.number().required(),
|
|
56
|
+
amperage: Joi.number().required(),
|
|
57
|
+
specialValue: Joi.number().required(),
|
|
58
|
+
enabled: Joi.boolean().required(),
|
|
59
|
+
hidden: Joi.boolean().required(),
|
|
60
|
+
fake: Joi.boolean().required(),
|
|
61
|
+
inputs: Joi.object({ items: GTRecipeIOItemsSchema, fluids: GTRecipeIOFluidsSchema }).required(),
|
|
62
|
+
outputs: Joi.object({ items: GTRecipeIOItemsSchema, fluids: GTRecipeIOFluidsSchema }).required(),
|
|
63
|
+
inputChances: Joi.array().items(Joi.number()).required(),
|
|
64
|
+
outputChances: Joi.array().items(Joi.number()).required(),
|
|
65
|
+
fluidInputChances: Joi.array().items(Joi.number()).required(),
|
|
66
|
+
fluidOutputChances: Joi.array().items(Joi.number()).required(),
|
|
67
|
+
});
|
|
68
|
+
export const GTRecipesResultSchema = Joi.object({
|
|
69
|
+
type: Joi.valid("gt").required(),
|
|
70
|
+
queryType: Joi.valid("output", "input").required(),
|
|
71
|
+
count: Joi.number().required(),
|
|
72
|
+
offset: Joi.number().required(),
|
|
73
|
+
map: Joi.string().optional(),
|
|
74
|
+
query: RecipeItemStackLooseSchema.optional(),
|
|
75
|
+
fluid: FluidSchema.optional(),
|
|
76
|
+
recipes: Joi.array().items(GTRecipeSchema).required(),
|
|
77
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
export const PlayerPrintResultSchema = Joi.object({
|
|
3
|
+
total: Joi.number().required(),
|
|
4
|
+
added: Joi.number().required(),
|
|
5
|
+
dropped: Joi.number().required(),
|
|
6
|
+
});
|
|
7
|
+
export const WorldPrintSubmitResultSchema = Joi.object({
|
|
8
|
+
id: Joi.string().required(),
|
|
9
|
+
total: Joi.number().required(),
|
|
10
|
+
skipped: Joi.number().required(),
|
|
11
|
+
});
|
|
12
|
+
export const PrintJobStatusSchema = Joi.valid("pending", "running", "completed");
|
|
13
|
+
export const WorldPrintFailureSchema = Joi.object({
|
|
14
|
+
x: Joi.number().required(),
|
|
15
|
+
y: Joi.number().required(),
|
|
16
|
+
z: Joi.number().required(),
|
|
17
|
+
reason: Joi.string().required(),
|
|
18
|
+
});
|
|
19
|
+
export const WorldPrintJobResultSchema = Joi.object({
|
|
20
|
+
id: Joi.string().required(),
|
|
21
|
+
total: Joi.number().required(),
|
|
22
|
+
completed: Joi.number().required(),
|
|
23
|
+
success: Joi.number().required(),
|
|
24
|
+
failed: Joi.number().required(),
|
|
25
|
+
status: PrintJobStatusSchema.required(),
|
|
26
|
+
createTime: Joi.number().required(),
|
|
27
|
+
finishTime: Joi.number().optional(),
|
|
28
|
+
durationMs: Joi.number().optional(),
|
|
29
|
+
failures: Joi.array().items(WorldPrintFailureSchema).optional(),
|
|
30
|
+
failuresTruncated: Joi.number().optional(),
|
|
31
|
+
});
|
|
32
|
+
export const PrintSizeResultSchema = Joi.object({
|
|
33
|
+
size: Joi.number().required(),
|
|
34
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import Joi from "joi";
|
|
2
|
+
import { ClassInfoSchema } from "./common";
|
|
3
|
+
export const TPSInfoSchema = Joi.object({
|
|
4
|
+
WorldName: Joi.string().optional(),
|
|
5
|
+
TickTime: Joi.number().required(),
|
|
6
|
+
TPS: Joi.number().required(),
|
|
7
|
+
});
|
|
8
|
+
export const WorldInfoDataSchema = Joi.object({
|
|
9
|
+
WorldServerClass: ClassInfoSchema.optional(),
|
|
10
|
+
WorldInfoClass: ClassInfoSchema.optional(),
|
|
11
|
+
WorldInfo: Joi.object().unknown().required(),
|
|
12
|
+
});
|
|
13
|
+
export const ProfilerDataSchema = Joi.object({
|
|
14
|
+
server: Joi.object({
|
|
15
|
+
totalMemoryMB: Joi.number().required(),
|
|
16
|
+
freeMemoryMB: Joi.number().required(),
|
|
17
|
+
maxMemoryMB: Joi.number().required(),
|
|
18
|
+
}).required(),
|
|
19
|
+
dimensions: Joi.object().pattern(Joi.string(), Joi.object({
|
|
20
|
+
name: Joi.string().required(),
|
|
21
|
+
loadedChunks: Joi.number().required(),
|
|
22
|
+
totalEntities: Joi.number().required(),
|
|
23
|
+
totalTileEntities: Joi.number().required(),
|
|
24
|
+
laggyChunks: Joi.array().items(Joi.object({
|
|
25
|
+
chunkX: Joi.number().required(),
|
|
26
|
+
chunkZ: Joi.number().required(),
|
|
27
|
+
entityCount: Joi.number().required(),
|
|
28
|
+
})).required(),
|
|
29
|
+
})).required(),
|
|
30
|
+
profiler: Joi.object({
|
|
31
|
+
enabled: Joi.boolean().required(),
|
|
32
|
+
}).required(),
|
|
33
|
+
});
|
|
34
|
+
export const LagAnalyzerDataSchema = Joi.object({
|
|
35
|
+
entities: Joi.object({
|
|
36
|
+
byType: Joi.array().items(Joi.object({
|
|
37
|
+
name: Joi.string().required(),
|
|
38
|
+
count: Joi.number().required(),
|
|
39
|
+
items: Joi.number().required(),
|
|
40
|
+
xpOrbs: Joi.number().required(),
|
|
41
|
+
})).required(),
|
|
42
|
+
byDimension: Joi.object().pattern(Joi.string(), Joi.number()).required(),
|
|
43
|
+
}).required(),
|
|
44
|
+
tileEntities: Joi.object({
|
|
45
|
+
byType: Joi.array().items(Joi.object({
|
|
46
|
+
name: Joi.string().required(),
|
|
47
|
+
count: Joi.number().required(),
|
|
48
|
+
samplePositions: Joi.array().items(Joi.string()).required(),
|
|
49
|
+
})).required(),
|
|
50
|
+
byDimension: Joi.object().pattern(Joi.string(), Joi.number()).required(),
|
|
51
|
+
}).required(),
|
|
52
|
+
memory: Joi.object({
|
|
53
|
+
totalMB: Joi.number().required(),
|
|
54
|
+
freeMB: Joi.number().required(),
|
|
55
|
+
usedMB: Joi.number().required(),
|
|
56
|
+
maxMB: Joi.number().required(),
|
|
57
|
+
availableProcessors: Joi.number().required(),
|
|
58
|
+
}).required(),
|
|
59
|
+
});
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.WebApiError = exports.WebApiClient = void 0;
|
|
18
|
+
var client_1 = require("./client");
|
|
19
|
+
Object.defineProperty(exports, "WebApiClient", { enumerable: true, get: function () { return client_1.WebApiClient; } });
|
|
20
|
+
Object.defineProperty(exports, "WebApiError", { enumerable: true, get: function () { return client_1.WebApiError; } });
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
__exportStar(require("./validators"), exports);
|
package/dist/test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/test.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_1 = require("./client");
|
|
4
|
+
const api = new client_1.WebApiClient({ baseUrl: "http://localhost:40002" });
|
|
5
|
+
(async () => {
|
|
6
|
+
const r = await api.loadChunk({ x: 10000, z: 66666, dim: -1 });
|
|
7
|
+
console.log(r);
|
|
8
|
+
})();
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { ClassInfo } from "./common";
|
|
2
|
+
import type { Fluid } from "./fluid";
|
|
3
|
+
import type { ItemStack } from "./item";
|
|
4
|
+
export type AEStack = (ItemStack | Fluid) & {
|
|
5
|
+
stackSize: number;
|
|
6
|
+
};
|
|
7
|
+
export interface AEStackProviders {
|
|
8
|
+
providers: Array<{
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
z: number;
|
|
12
|
+
dimension: number;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface AENode {
|
|
16
|
+
active: boolean;
|
|
17
|
+
meetsChannel: boolean;
|
|
18
|
+
playerID: number;
|
|
19
|
+
machineClass?: ClassInfo;
|
|
20
|
+
isPart: boolean;
|
|
21
|
+
isIActionHost: boolean;
|
|
22
|
+
location?: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
z: number;
|
|
26
|
+
dimension: number;
|
|
27
|
+
};
|
|
28
|
+
idlePowerUsage: number;
|
|
29
|
+
flags: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface AE2Pattern extends ItemStack {
|
|
32
|
+
crafting: boolean;
|
|
33
|
+
substitute: boolean;
|
|
34
|
+
beSubstitute: boolean;
|
|
35
|
+
author?: string;
|
|
36
|
+
inputs?: (ItemStack | null)[];
|
|
37
|
+
outputs?: (ItemStack | null)[];
|
|
38
|
+
isCraftable?: boolean;
|
|
39
|
+
priority?: number;
|
|
40
|
+
canSubstitute?: boolean;
|
|
41
|
+
canBeSubstitute?: boolean;
|
|
42
|
+
condensedInputs?: AEStack[];
|
|
43
|
+
condensedOutputs?: AEStack[];
|
|
44
|
+
patternParseError?: string;
|
|
45
|
+
}
|
|
46
|
+
/** `appeng.api.networking.crafting.CraftingAllowMode` 枚举名 */
|
|
47
|
+
export type AECraftingAllowMode = "YES" | "NO" | "ONLY_PLAYERS" | string;
|
|
48
|
+
/**
|
|
49
|
+
* `appeng.util.ScheduledReason` 枚举名,表示任务的调度原因。
|
|
50
|
+
* 类型侧保留开放联合
|
|
51
|
+
*/
|
|
52
|
+
export type AECPUScheduledReason = "UNDEFINED" | "SOMETHING_STUCK" | "BLOCKING_MODE" | "LOCK_MODE" | "NO_TARGET" | "NOT_ENOUGH_INGREDIENTS" | "SAME_NETWORK" | "UNSUPPORTED_STACK" | (string & {});
|
|
53
|
+
/** 合成 CPU 中正在进行的单个并行合成任务 */
|
|
54
|
+
export interface AECPUTask {
|
|
55
|
+
/** 剩余执行次数 */
|
|
56
|
+
remaining: number;
|
|
57
|
+
/** 任务调度原因(ScheduledReason 枚举名) */
|
|
58
|
+
scheduledReason: AECPUScheduledReason;
|
|
59
|
+
inputs: AEStack[];
|
|
60
|
+
pattern: AE2Pattern;
|
|
61
|
+
outputs: Array<AEStack & AEStackProviders>;
|
|
62
|
+
}
|
|
63
|
+
export interface AECPU {
|
|
64
|
+
name: string;
|
|
65
|
+
busy: boolean;
|
|
66
|
+
availableStorage: number;
|
|
67
|
+
usedStorage: number;
|
|
68
|
+
coProcessors: number;
|
|
69
|
+
remainingItemCount: number;
|
|
70
|
+
startItemCount: number;
|
|
71
|
+
elapsedTime: number;
|
|
72
|
+
/** `CraftingAllowMode` 枚举名 */
|
|
73
|
+
craftingAllowMode: AECraftingAllowMode;
|
|
74
|
+
/** 是否有任务处于等待中 */
|
|
75
|
+
waiting: boolean;
|
|
76
|
+
/** 是否已挂起 */
|
|
77
|
+
suspended: boolean;
|
|
78
|
+
/** 是否处于缺少原料模式 */
|
|
79
|
+
missingMode: boolean;
|
|
80
|
+
finalOutput?: AEStack;
|
|
81
|
+
/** 等待缺失的原料(服务端仅在非空时输出) */
|
|
82
|
+
waitingForMissing?: AEStack[];
|
|
83
|
+
tasks?: AECPUTask[];
|
|
84
|
+
tasking?: Array<AEStack & AEStackProviders>;
|
|
85
|
+
tasksError?: string;
|
|
86
|
+
}
|
|
87
|
+
export interface AEMEInterface {
|
|
88
|
+
display: boolean;
|
|
89
|
+
name: string;
|
|
90
|
+
rawName: string | null;
|
|
91
|
+
active: boolean;
|
|
92
|
+
allowsPatternOptimization: boolean;
|
|
93
|
+
playerID: number;
|
|
94
|
+
location: {
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
z: number;
|
|
98
|
+
dimension: number;
|
|
99
|
+
};
|
|
100
|
+
patterns: Array<AE2Pattern & {
|
|
101
|
+
slot: number;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
export interface AECraftingTaskBody {
|
|
105
|
+
/** 物品 ID;当 Type 为 "fluid" 时表示流体 ID */
|
|
106
|
+
id: number;
|
|
107
|
+
/** 合成数量(流体时为 mB) */
|
|
108
|
+
Count: number;
|
|
109
|
+
/** 堆类型,缺省或非 "fluid" 时按物品处理 */
|
|
110
|
+
Type?: "item" | "fluid";
|
|
111
|
+
Damage?: number;
|
|
112
|
+
tag?: string;
|
|
113
|
+
cpu?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface AECraftingTaskResult {
|
|
116
|
+
bytes: number;
|
|
117
|
+
cpu: string;
|
|
118
|
+
output: ItemStack & {
|
|
119
|
+
stackSize: number;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface AECPUCancelBody {
|
|
123
|
+
name?: string;
|
|
124
|
+
id?: number;
|
|
125
|
+
}
|
|
126
|
+
export interface AECPUCancelResult {
|
|
127
|
+
cpu: string;
|
|
128
|
+
wasBusy: boolean;
|
|
129
|
+
}
|
|
130
|
+
/** AE 网络库存堆:物品(type 为 "item")或流体(type 为 "fluid"),可通过 type 判别收窄 */
|
|
131
|
+
export type AEItemStack = (ItemStack & {
|
|
132
|
+
type: "item";
|
|
133
|
+
stackSize: number;
|
|
134
|
+
Craftable: boolean;
|
|
135
|
+
}) | (Fluid & {
|
|
136
|
+
type: "fluid";
|
|
137
|
+
stackSize: number;
|
|
138
|
+
Craftable: boolean;
|
|
139
|
+
});
|
|
140
|
+
export interface AEItemCellStatus {
|
|
141
|
+
all: number;
|
|
142
|
+
green: number;
|
|
143
|
+
blue: number;
|
|
144
|
+
orange: number;
|
|
145
|
+
red: number;
|
|
146
|
+
}
|
|
147
|
+
export interface AEItemsResult {
|
|
148
|
+
items: AEItemStack[];
|
|
149
|
+
totalBytes: number;
|
|
150
|
+
usedBytes: number;
|
|
151
|
+
totalTypes: number;
|
|
152
|
+
usedTypes: number;
|
|
153
|
+
cellStatus: AEItemCellStatus;
|
|
154
|
+
fluidTotalBytes: number;
|
|
155
|
+
fluidUsedBytes: number;
|
|
156
|
+
fluidTotalTypes: number;
|
|
157
|
+
fluidUsedTypes: number;
|
|
158
|
+
fluidCellStatus: AEItemCellStatus;
|
|
159
|
+
}
|
|
160
|
+
export interface AEHitResult {
|
|
161
|
+
message: string;
|
|
162
|
+
}
|