sks-maximo-utils 1.0.7 → 1.0.8

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/CLI.md CHANGED
@@ -144,7 +144,7 @@ sks-maximo call <scriptName> [--file <fileName>] [--params <params>] [--logname
144
144
  ### 4.1 GET 请求(无请求体)
145
145
 
146
146
  ```bash
147
- sks-maximo call SHARPTREE.AUTOSCRIPT.LIBRARY --params '{"name":"TEST"}'
147
+ sks-maximo call SKS.AUTOSCRIPT.LIBRARY --params '{"name":"TEST"}'
148
148
  ```
149
149
 
150
150
  ### 4.2 POST 请求(带请求体文件)
@@ -154,7 +154,7 @@ sks-maximo call SHARPTREE.AUTOSCRIPT.LIBRARY --params '{"name":"TEST"}'
154
154
  sks-maximo call SKS_DEPLOY_AUTOKEY --file data/autokey.json
155
155
 
156
156
  # XML 请求体
157
- sks-maximo call SHARPTREE.AUTOSCRIPT.SCREENS --file screens/test.xml
157
+ sks-maximo call SKS.AUTOSCRIPT.SCREENS --file screens/test.xml
158
158
 
159
159
  # 同时带参数和请求体
160
160
  sks-maximo call SKS_IMP_MAXAPPINFO --file appinfo.json --params '{"debug":true}' --logname "导入应用信息"
@@ -200,7 +200,7 @@ sks-maximo call SKS_IMP_MAXAPPINFO --file appinfo.json --params '{"debug":true}'
200
200
  ### 示例 1:查询脚本库
201
201
 
202
202
  ```bash
203
- sks-maximo call SHARPTREE.AUTOSCRIPT.LIBRARY --params '{"name":"MY_SCRIPT"}'
203
+ sks-maximo call SKS.AUTOSCRIPT.LIBRARY --params '{"name":"MY_SCRIPT"}'
204
204
  ```
205
205
 
206
206
  ### 示例 2:部署自动编码
package/README.md CHANGED
@@ -41,6 +41,8 @@ import {
41
41
  importMaxScript,
42
42
  importMaxAppInfo,
43
43
  callMaxScript,
44
+ batchImport,
45
+ printBatchStats,
44
46
  fileUtils,
45
47
  loadConfig,
46
48
  logger
@@ -70,11 +72,27 @@ importMaxScript({ fileName: "scripts/TEST.json" });
70
72
  importMaxAppInfo({ fileName: "MAXAPPINFO/appinfo.json", logname: "应用信息" });
71
73
 
72
74
  // 通用脚本接口调用(GET)
73
- callMaxScript({ apiScriptName: "SHARPTREE.AUTOSCRIPT.LIBRARY", params: { name: "test" }, logname: "查询脚本库" });
75
+ callMaxScript({ apiScriptName: "SKS.AUTOSCRIPT.LIBRARY", params: { name: "test" }, logname: "查询脚本库" });
74
76
 
75
77
  // 通用脚本接口调用(POST,读取文件内容作为请求体)
76
78
  callMaxScript({ apiScriptName: "SKS_DEPLOY_AUTOKEY", fileName: "data/autokey.json", logname: "部署自动编码" });
77
79
 
80
+ // 通用批量导入(支持对象、脚本、域、应用信息等所有导入功能)
81
+ const stats = await batchImport({
82
+ dirName: "C:/Temp/hd/maxobject_backup", // 目录名(与files二选一)
83
+ extFilter: ".json", // 扩展名过滤
84
+ importFn: importMaxObject, // 导入函数(可换成其他导入方法)
85
+ logname: "批量导入对象",
86
+ concurrency: 1 // 并发数,默认1串行
87
+ });
88
+ printBatchStats(stats); // 打印批量导入统计结果
89
+
90
+ // 直接指定文件列表批量导入
91
+ await batchImport({
92
+ files: ["a.json", "b.json", "c.json"],
93
+ importFn: importMaxDomain
94
+ });
95
+
78
96
  // 文件工具
79
97
  fileUtils.listFiles('scripts', '.json');
80
98
  fileUtils.readFileContent('test.txt');
@@ -139,11 +157,14 @@ fileUtils.readFileContent('test.txt');
139
157
  | 方法 | 说明 |
140
158
  |------|------|
141
159
  | callMaxScript | 通用脚本接口调用(GET/POST) |
160
+ | batchImport | 通用批量导入(支持对象、脚本、域、应用信息等所有导入功能) |
161
+ | printBatchStats | 打印批量导入统计结果 |
142
162
  | loadConfig(env) | 加载指定环境配置 |
143
163
  | saveScriptHistory(options) | 保存脚本历史记录 |
144
164
  | readFileContent(fileName) | 读取文件内容 |
145
165
  | readJsonFile(fileName) | 读取并解析 JSON 文件 |
146
166
  | fileExists(fileName) | 检查文件是否存在 |
167
+ | fileUtils.resolveFilePath(fileName) | 通用路径转换(相对/绝对路径转规范化绝对路径) |
147
168
  | fileUtils.listFiles(dirName, extFilter, recursive) | 列出目录文件 |
148
169
  | fileUtils.readFileContent(fileName) | 读取文件内容 |
149
170
  | fileUtils.readJsonFile(fileName) | 读取并解析 JSON 文件 |
@@ -34,7 +34,7 @@ export async function importMaxObject({fileName, logname}) {
34
34
  // 发送请求到Maximo API
35
35
  logger.info(`[${logname}]开始发送请求...`);
36
36
  const response = await request({
37
- url: '/api/script/SHARPTREE.AUTOSCRIPT.LIBRARY',
37
+ url: '/api/script/SKS.AUTOSCRIPT.LIBRARY',
38
38
  method: 'post',
39
39
  params: {
40
40
  develop: true,
@@ -101,7 +101,7 @@ export async function importMaxPresentation({fileName, logname}) {
101
101
 
102
102
  logger.info(`[${logname}]开始发送请求...`);
103
103
  const response = await request({
104
- url: '/api/script/SHARPTREE.AUTOSCRIPT.SCREENS',
104
+ url: '/api/script/SKS.AUTOSCRIPT.SCREENS',
105
105
  method: 'post',
106
106
  headers: {
107
107
  'Content-Type': 'application/xml'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sks-maximo-utils",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Maximo helper tools for updating table structures and data",
5
5
  "type": "module",
6
6
  "main": "index.js",