@shirokasoke/webapi-sdk 2.9.0-beta3-0.13-pre2 → 2.9.0-beta3-0.15-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.
Files changed (41) hide show
  1. package/dist/client.d.ts +14 -1
  2. package/dist/client.js +13 -0
  3. package/dist/types/ae2.d.ts +8 -0
  4. package/dist/types/gt5.d.ts +1 -0
  5. package/dist/validators/ae2.d.ts +3 -1
  6. package/dist/validators/ae2.js +7 -1
  7. package/package.json +9 -18
  8. package/dist/esm/client.js +0 -731
  9. package/dist/esm/index.js +0 -3
  10. package/dist/esm/package.json +0 -1
  11. package/dist/esm/test.js +0 -6
  12. package/dist/esm/types/ae2.js +0 -1
  13. package/dist/esm/types/block.js +0 -1
  14. package/dist/esm/types/chunk.js +0 -1
  15. package/dist/esm/types/common.js +0 -1
  16. package/dist/esm/types/entity.js +0 -1
  17. package/dist/esm/types/fluid.js +0 -1
  18. package/dist/esm/types/fmp.js +0 -1
  19. package/dist/esm/types/gt5.js +0 -1
  20. package/dist/esm/types/index.js +0 -13
  21. package/dist/esm/types/item.js +0 -1
  22. package/dist/esm/types/rawInfo.js +0 -1
  23. package/dist/esm/types/recipe.js +0 -1
  24. package/dist/esm/types/threeD.js +0 -1
  25. package/dist/esm/types/world.js +0 -1
  26. package/dist/esm/validators/ae2.js +0 -163
  27. package/dist/esm/validators/block.js +0 -95
  28. package/dist/esm/validators/chunk.js +0 -58
  29. package/dist/esm/validators/common.js +0 -28
  30. package/dist/esm/validators/entity.js +0 -127
  31. package/dist/esm/validators/fluid.js +0 -30
  32. package/dist/esm/validators/fmp.js +0 -34
  33. package/dist/esm/validators/gt5.js +0 -191
  34. package/dist/esm/validators/index.js +0 -13
  35. package/dist/esm/validators/item.js +0 -33
  36. package/dist/esm/validators/rawInfo.js +0 -25
  37. package/dist/esm/validators/recipe.js +0 -77
  38. package/dist/esm/validators/threeD.js +0 -34
  39. package/dist/esm/validators/world.js +0 -59
  40. package/dist/test.d.ts +0 -1
  41. package/dist/test.js +0 -8
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AE2Pattern, AECPU, AECPUCancelBody, AECPUCancelResult, AECraftingTaskBody, AECraftingTaskResult, AEHitResult, AEItemDefinitions, AEItemsResult, AEMEInterface, AENode, BatchSetBlockJobResult, BatchSetBlockSubmitResult, BatchSetBlockTask, Block, BlockDetail, ChunkForceList, ChunkLoadResult, ChunkMapCell, ChunksByDimension, ChunkWithDimension, Coordinates, EntitiesByDimension, Entity, Fluid, FluidContainer, FMPPart, GT5BatchJobResult, GT5BatchMachineCoord, GT5BatchRerunResult, GT5BatchSubmitResult, GT5MachineInfo, GT5ScanJobResult, GT5ScanSubmitResult, GT5StatusResult, Item, ItemDetail, LagAnalyzerData, ProfilerData, RootInfo, SetBlockBody, SetBlockResult, TPSInfo, WorldInfoData, CraftingRecipesResult, FurnaceRecipesResult, GTRecipesResult, GTRecipeMap, PlayerPrintResult, PrintSizeResult, WorldPrintJobResult, WorldPrintSubmitResult } from "./types";
1
+ import type { AE2Pattern, AECPU, AECPUCancelBody, AECPUCancelResult, AECPUSuspendBody, AECPUSuspendResult, AECraftingTaskBody, AECraftingTaskResult, AEHitResult, AEItemDefinitions, AEItemsResult, AEMEInterface, AENode, BatchSetBlockJobResult, BatchSetBlockSubmitResult, BatchSetBlockTask, Block, BlockDetail, ChunkForceList, ChunkLoadResult, ChunkMapCell, ChunksByDimension, ChunkWithDimension, Coordinates, EntitiesByDimension, Entity, Fluid, FluidContainer, FMPPart, GT5BatchJobResult, GT5BatchMachineCoord, GT5BatchRerunResult, GT5BatchSubmitResult, GT5MachineInfo, GT5ScanJobResult, GT5ScanSubmitResult, GT5StatusResult, Item, ItemDetail, LagAnalyzerData, ProfilerData, RootInfo, SetBlockBody, SetBlockResult, TPSInfo, WorldInfoData, CraftingRecipesResult, FurnaceRecipesResult, GTRecipesResult, GTRecipeMap, PlayerPrintResult, PrintSizeResult, WorldPrintJobResult, WorldPrintSubmitResult } from "./types";
2
2
  export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
3
3
  export interface WebApiClientOptions {
4
4
  baseUrl: string;
@@ -273,6 +273,7 @@ export declare class WebApiClient {
273
273
  y: number;
274
274
  z: number;
275
275
  dim?: number;
276
+ dimension?: number;
276
277
  action: "start" | "stop";
277
278
  }): Promise<GT5StatusResult>;
278
279
  /**
@@ -444,6 +445,18 @@ export declare class WebApiClient {
444
445
  z: number;
445
446
  dimension?: number;
446
447
  }, body: AECPUCancelBody): Promise<AECPUCancelResult>;
448
+ /**
449
+ * 暂停(suspend=true,POST)或恢复(suspend=false,DELETE)AE 合成 CPU 上正在执行的合成任务。
450
+ * @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/ae2/AECPUSuspendHandler.java)
451
+ * @param body 使用 {@link AECPUSuspendBodySchema} 验证
452
+ * @returns 使用 {@link AECPUSuspendResultSchema} 验证
453
+ */
454
+ aeSuspend(params: {
455
+ x: number;
456
+ y: number;
457
+ z: number;
458
+ dimension?: number;
459
+ }, body: AECPUSuspendBody, suspend: boolean): Promise<AECPUSuspendResult>;
447
460
  /**
448
461
  * 构建 AE 库存 SSE(Server-Sent Events)订阅地址。
449
462
  * 注意:仅当服务端启用虚拟线程(useVirtualThreads)时该路由才会注册。
package/dist/client.js CHANGED
@@ -579,6 +579,19 @@ class WebApiClient {
579
579
  body: JSON.stringify(body),
580
580
  });
581
581
  }
582
+ /**
583
+ * 暂停(suspend=true,POST)或恢复(suspend=false,DELETE)AE 合成 CPU 上正在执行的合成任务。
584
+ * @java [java](../../../src/main/java/love/shirokasoke/webapi/webserver/handlers/ae2/AECPUSuspendHandler.java)
585
+ * @param body 使用 {@link AECPUSuspendBodySchema} 验证
586
+ * @returns 使用 {@link AECPUSuspendResultSchema} 验证
587
+ */
588
+ aeSuspend(params, body, suspend) {
589
+ return this.request(`/ae/cpu/suspend${buildQuery(params)}`, {
590
+ method: suspend ? "POST" : "DELETE",
591
+ headers: { "Content-Type": "application/json" },
592
+ body: JSON.stringify(body),
593
+ });
594
+ }
582
595
  /**
583
596
  * 构建 AE 库存 SSE(Server-Sent Events)订阅地址。
584
597
  * 注意:仅当服务端启用虚拟线程(useVirtualThreads)时该路由才会注册。
@@ -127,6 +127,14 @@ export interface AECPUCancelResult {
127
127
  cpu: string;
128
128
  wasBusy: boolean;
129
129
  }
130
+ /** AE CPU 暂停/恢复请求体,与取消任务一致:按名称或序号定位 CPU */
131
+ export type AECPUSuspendBody = AECPUCancelBody;
132
+ export interface AECPUSuspendResult {
133
+ cpu: string;
134
+ wasBusy: boolean;
135
+ /** 本次操作后的挂起状态(POST 暂停为 true,DELETE 恢复为 false) */
136
+ Suspended: boolean;
137
+ }
130
138
  /** AE 网络库存堆:物品(type 为 "item")或流体(type 为 "fluid"),可通过 type 判别收窄 */
131
139
  export type AEItemStack = (ItemStack & {
132
140
  type: "item";
@@ -142,6 +142,7 @@ export interface GT5BatchMachineCoord {
142
142
  y: number;
143
143
  z: number;
144
144
  dim?: number;
145
+ dimension?: number;
145
146
  }
146
147
  /** POST /gt5/batch 提交结果 */
147
148
  export interface GT5BatchSubmitResult {
@@ -1,5 +1,5 @@
1
1
  import Joi from "joi";
2
- import type { AECPU, AECPUCancelBody, AECPUCancelResult, AECraftingTaskBody, AECraftingTaskResult, AEHitResult, AEItemsResult, AEMEInterface, AENode } from "../types/ae2";
2
+ import type { AECPU, AECPUCancelBody, AECPUCancelResult, AECraftingTaskBody, AECraftingTaskResult, AEHitResult, AEItemsResult, AEMEInterface, AENode, AECPUSuspendResult } from "../types/ae2";
3
3
  export declare const AEStackProvidersSchema: Joi.ArraySchema<any[]>;
4
4
  /** 对应服务端 Pattern.dumpAEStack 的输出:物品或流体堆,附加 stackSize 字段 */
5
5
  export declare const AEStackSchema: Joi.AlternativesSchema<{
@@ -49,6 +49,8 @@ export declare const AECraftingTaskBodySchema: Joi.ObjectSchema<AECraftingTaskBo
49
49
  export declare const AECraftingTaskResultSchema: Joi.ObjectSchema<AECraftingTaskResult>;
50
50
  export declare const AECPUCancelBodySchema: Joi.ObjectSchema<AECPUCancelBody>;
51
51
  export declare const AECPUCancelResultSchema: Joi.ObjectSchema<AECPUCancelResult>;
52
+ export declare const AECPUSuspendBodySchema: Joi.ObjectSchema<AECPUCancelBody>;
53
+ export declare const AECPUSuspendResultSchema: Joi.ObjectSchema<AECPUSuspendResult>;
52
54
  export declare const AEItemStackSchema: Joi.AlternativesSchema<{
53
55
  type: unknown;
54
56
  stackSize: unknown;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AEHitResultSchema = exports.AEItemsResultSchema = exports.AEItemCellStatusSchema = exports.AEItemStackSchema = exports.AECPUCancelResultSchema = exports.AECPUCancelBodySchema = exports.AECraftingTaskResultSchema = exports.AECraftingTaskBodySchema = exports.AEMEInterfaceSchema = exports.AECPUSchema = exports.AECPUTaskSchema = exports.AECPUScheduledReasonSchema = exports.AE_CPU_SCHEDULED_REASONS = exports.AE2PatternSchema = exports.AENodeSchema = exports.AEStackWithProvidersSchema = exports.AEStackSchema = exports.AEStackProvidersSchema = void 0;
6
+ exports.AEHitResultSchema = exports.AEItemsResultSchema = exports.AEItemCellStatusSchema = exports.AEItemStackSchema = exports.AECPUSuspendResultSchema = exports.AECPUSuspendBodySchema = exports.AECPUCancelResultSchema = exports.AECPUCancelBodySchema = exports.AECraftingTaskResultSchema = exports.AECraftingTaskBodySchema = exports.AEMEInterfaceSchema = exports.AECPUSchema = exports.AECPUTaskSchema = exports.AECPUScheduledReasonSchema = exports.AE_CPU_SCHEDULED_REASONS = exports.AE2PatternSchema = exports.AENodeSchema = exports.AEStackWithProvidersSchema = exports.AEStackSchema = exports.AEStackProvidersSchema = void 0;
7
7
  const joi_1 = __importDefault(require("joi"));
8
8
  const common_1 = require("./common");
9
9
  const fluid_1 = require("./fluid");
@@ -135,6 +135,12 @@ exports.AECPUCancelResultSchema = joi_1.default.object({
135
135
  cpu: joi_1.default.string().required(),
136
136
  wasBusy: joi_1.default.boolean().required(),
137
137
  });
138
+ exports.AECPUSuspendBodySchema = exports.AECPUCancelBodySchema;
139
+ exports.AECPUSuspendResultSchema = joi_1.default.object({
140
+ cpu: joi_1.default.string().required(),
141
+ wasBusy: joi_1.default.boolean().required(),
142
+ Suspended: joi_1.default.boolean().required(),
143
+ });
138
144
  exports.AEItemStackSchema = joi_1.default.alternatives(item_1.ItemStackSchema.append({
139
145
  type: joi_1.default.string().valid("item").required(),
140
146
  stackSize: joi_1.default.number().required(),
package/package.json CHANGED
@@ -1,21 +1,14 @@
1
1
  {
2
2
  "name": "@shirokasoke/webapi-sdk",
3
- "version": "2.9.0-beta3-0.13-pre2",
3
+ "version": "2.9.0-beta3-0.15-pre",
4
4
  "private": false,
5
5
  "description": "TypeScript SDK for the love.shirokasoke.WebAPI Minecraft Mod",
6
6
  "main": "./dist/index.js",
7
- "module": "./dist/index.mjs",
8
7
  "types": "./dist/index.d.ts",
9
8
  "exports": {
10
9
  ".": {
11
- "import": {
12
- "types": "./dist/index.d.ts",
13
- "default": "./dist/esm/index.js"
14
- },
15
- "require": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.js"
18
- }
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
19
12
  }
20
13
  },
21
14
  "files": [
@@ -23,11 +16,9 @@
23
16
  ],
24
17
  "sideEffects": false,
25
18
  "scripts": {
26
- "build": "npm run build:cjs && npm run build:esm",
27
- "build:cjs": "tsc -p tsconfig.json",
28
- "build:esm": "tsc -p tsconfig.esm.json && echo '{\"type\": \"module\"}' > dist/esm/package.json",
19
+ "build": "tsc -p tsconfig.json",
29
20
  "test": "tsx --test test/*.test.ts",
30
- "web": "npm run build && cp -r /workspace/sdk/ts/dist/* /workspace/web/node_modules/@shirokasoke/webapi-sdk/dist/"
21
+ "web": "npm run build && rm -rf /workspace/web/node_modules/@shirokasoke/webapi-sdk/dist && cp -r dist package.json /workspace/web/node_modules/@shirokasoke/webapi-sdk/"
31
22
  },
32
23
  "keywords": [
33
24
  "gtnh",
@@ -39,12 +30,12 @@
39
30
  "author": "Rcrwrate",
40
31
  "license": "MIT",
41
32
  "devDependencies": {
42
- "@types/node": "^25.9.0",
43
- "tsx": "^4.22.1",
44
- "typescript": "^5.4.0"
33
+ "@types/node": "^26.6.5",
34
+ "tsx": "^4.23.15",
35
+ "typescript": "^7.0.2"
45
36
  },
46
37
  "dependencies": {
47
38
  "@microsoft/fetch-event-source": "^2.0.1",
48
- "joi": "^18.2.1"
39
+ "joi": "^18.2.9"
49
40
  }
50
41
  }