nolo-cli 0.72.0-alpha.1 → 0.72.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/{_executeModel-TKD22VDA.js → _executeModel-T3FPYFVF.js} +11 -11
- package/{agentDeleteCommand-FSIMTL4K.js → agentDeleteCommand-UAMLWTPS.js} +6 -6
- package/{agentEmailCommands-G53VVKIL.js → agentEmailCommands-65FRADWQ.js} +15 -14
- package/{agentListCommands-2YWZYH52.js → agentListCommands-63DOSBY7.js} +7 -7
- package/{agentMachineCommands-A7D55KN2.js → agentMachineCommands-HMMAULDF.js} +6 -6
- package/{agentRecordCommands-UVU5UPJB.js → agentRecordCommands-HX5AEFP7.js} +15 -14
- package/{agentRunCommand-PDKUP3L4.js → agentRunCommand-KXPU5X7D.js} +15 -14
- package/{agentRuntimeLocal-O6DZDTK4.js → agentRuntimeLocal-XG3IDNOC.js} +4 -4
- package/{agentSlice-FZBFYKP3.js → agentSlice-EACXUOWW.js} +1 -1
- package/{appDeleteCommands-HIJNWSK7.js → appDeleteCommands-TJXDMOYT.js} +7 -7
- package/{appDeployCommands-XULV2ZN6.js → appDeployCommands-ECZJQAAL.js} +7 -7
- package/{appDeployStatusCommands-ETY4Z7K6.js → appDeployStatusCommands-DZKVFG3Y.js} +7 -7
- package/{appGetCommands-M253LKDA.js → appGetCommands-JIT4OPUD.js} +7 -7
- package/{appListCommands-XYFXJMNP.js → appListCommands-NR2HRMDY.js} +7 -7
- package/{chatQueueReduxAdapter-E2D4NR2W.js → chatQueueReduxAdapter-XEIJO5WR.js} +2 -2
- package/chromeCommands-VOIRNJBL.js +499 -0
- package/chromeOpsCommands-M7DPCX2T.js +258 -0
- package/{chunk-7GCIXOQA.js → chunk-226XC5JW.js} +2 -2
- package/{chunk-SV63E2UZ.js → chunk-4SUTS5DI.js} +91 -6
- package/{chunk-B62OSA77.js → chunk-AFIKMMGC.js} +1 -1
- package/{chunk-Q4OT2DC7.js → chunk-AFIWC5NH.js} +1 -1
- package/{chunk-4NI7LU7J.js → chunk-AI5QKFXK.js} +5580 -349
- package/{chunk-AOKRQAUQ.js → chunk-ALGK6TIE.js} +2 -2
- package/{chunk-JWXTOIGR.js → chunk-CDVGNZDA.js} +2 -2
- package/{chunk-2QDDKFG5.js → chunk-CQ3WA2NE.js} +77 -0
- package/{chunk-CJ23A7U4.js → chunk-CUQ6PG2C.js} +14 -5
- package/{chunk-3LBE76GR.js → chunk-D74EWXL4.js} +87 -47
- package/{chunk-JWO3RQSH.js → chunk-DWPNOYMB.js} +1 -1
- package/{chunk-EDKF7RX4.js → chunk-EOARMOVD.js} +2 -0
- package/{chunk-T7PQFKJU.js → chunk-FSFQ3A7S.js} +1 -1
- package/{chunk-S4IVP3JA.js → chunk-H5I6AJX4.js} +22 -6
- package/{chunk-ZDB5QFH4.js → chunk-H7UKKEIS.js} +1 -1
- package/{chunk-YCDWJX45.js → chunk-KC5FAHVS.js} +1 -1
- package/{chunk-3U3EA3BO.js → chunk-L2Y24GRM.js} +2 -2
- package/{chunk-R5NCDOHB.js → chunk-MEVSATIF.js} +22 -8
- package/{chunk-R4XZMDRV.js → chunk-P7FA2HMM.js} +66 -120
- package/{chunk-AUKZOZFG.js → chunk-QA6YKM3H.js} +1 -1
- package/{chunk-HXAINXPQ.js → chunk-QC5LGHYP.js} +1 -1
- package/chunk-QCZX4FTW.js +242 -0
- package/{chunk-I5O24WHB.js → chunk-QRBAZ5PW.js} +2 -2
- package/{chunk-RVCBKVIR.js → chunk-QUH3XHL5.js} +3 -3
- package/{chunk-U4N7NIN3.js → chunk-U6LKJRJB.js} +4 -4
- package/{chunk-IDZTNRP2.js → chunk-X7HHHIOZ.js} +10 -2
- package/{chunk-S2RB4LMB.js → chunk-X7Z7U4Z6.js} +5 -5
- package/{contentThunks-QLAU2LGJ.js → contentThunks-3SPROFG5.js} +3 -3
- package/{createAgentAutomationAction-JUSLLNYE.js → createAgentAutomationAction-EIP2EG3O.js} +3 -3
- package/{createDialogAction-B52IPGBY.js → createDialogAction-RLUSTN4D.js} +4 -4
- package/{createPageAction-ACAIWRDQ.js → createPageAction-4Y52G7WG.js} +3 -3
- package/{dialogCommands-PE5FEFJ5.js → dialogCommands-CJCAMML3.js} +7 -7
- package/{dialogSlice-RM3EW5AO.js → dialogSlice-THY45JWM.js} +2 -2
- package/{docCreateCommands-IPDFZVPG.js → docCreateCommands-H65RSKT4.js} +6 -6
- package/{docDeleteCommands-VQ4Y66CM.js → docDeleteCommands-PBYGJ6CZ.js} +7 -7
- package/{docReadCommands-PD33VV27.js → docReadCommands-4VRYN5R5.js} +6 -6
- package/{docStore-Q45M4B2I.js → docStore-ZQ3ECOPY.js} +1 -1
- package/{docUpdateCommands-CGUQ2JY3.js → docUpdateCommands-COZG3ZDB.js} +6 -6
- package/{handleSendMessageAction-I6KFXKDM.js → handleSendMessageAction-CE4M5XIE.js} +2 -2
- package/index.js +108 -48
- package/{machineCommands-QEYH5J5E.js → machineCommands-JE4G4JYB.js} +14 -13
- package/{machineWsRunDispatch-MFYQADTQ.js → machineWsRunDispatch-FUQOSWD4.js} +14 -13
- package/package.json +1 -1
- package/{readlineWorkspace-WQZX3WSK.js → readlineWorkspace-Z4V3EB52.js} +45 -26
- package/{runAgentClientLoop-SLKSZWCS.js → runAgentClientLoop-NE5EHXSS.js} +9 -9
- package/{spaceCommands-Y47DDAQD.js → spaceCommands-WGXHETMT.js} +6 -6
- package/{streamAgentChatTurn-FLA6GTFJ.js → streamAgentChatTurn-A6L6O22P.js} +11 -11
- package/{tools-NA2SK5QX.js → tools-JS475NYO.js} +6 -6
- package/{tuiSummaryLlmCaller-J5BEPLW5.js → tuiSummaryLlmCaller-3Z24VUWM.js} +2 -2
- package/{updateCommands-AJYSD73Y.js → updateCommands-Y363MC3L.js} +2 -2
- package/{updateDialogTitleAction-55Q3R6RJ.js → updateDialogTitleAction-GMZUT6RP.js} +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4SUTS5DI.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MEVSATIF.js";
|
|
8
8
|
import {
|
|
9
9
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CUQ6PG2C.js";
|
|
11
11
|
import {
|
|
12
12
|
applyToolSurfaceConstraints
|
|
13
13
|
} from "./chunk-V3ZKNK5D.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
readPipeText,
|
|
22
22
|
spawnProcess
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-X7HHHIOZ.js";
|
|
24
24
|
import {
|
|
25
25
|
parseUserIdFromAuthToken
|
|
26
26
|
} from "./chunk-A7GB5UGH.js";
|
|
@@ -133,6 +133,7 @@ function resolveConnectorRunCwd(args) {
|
|
|
133
133
|
}
|
|
134
134
|
return cwd;
|
|
135
135
|
}
|
|
136
|
+
var RUN_GIT_TIMEOUT_MS = 1e4;
|
|
136
137
|
async function runGit(args, cwd, options = {}) {
|
|
137
138
|
const proc = spawnProcess({
|
|
138
139
|
cmd: ["git", ...args],
|
|
@@ -141,9 +142,24 @@ async function runGit(args, cwd, options = {}) {
|
|
|
141
142
|
stderr: "pipe",
|
|
142
143
|
stdin: "ignore"
|
|
143
144
|
});
|
|
144
|
-
const [stdout, exitCode] = await Promise.all([
|
|
145
|
+
const [stdout, , exitCode] = await Promise.all([
|
|
145
146
|
readPipeText(proc.stdout),
|
|
146
|
-
|
|
147
|
+
// git 在非仓库目录对 diff 系子命令会向 stderr 打印整段 usage(数十 KB):
|
|
148
|
+
// 不消费 stderr 会让 git 阻塞在写满的 stderr 管道上永不退出(bun:child_process),
|
|
149
|
+
// proc.exited 随之永不 resolve——connector 收尾整体挂死(2026-09-16 实测)。
|
|
150
|
+
readPipeText(proc.stderr),
|
|
151
|
+
// 超时保险丝:该路径历史上出过「进程不退出」类挂死(见上);超时 kill 后流关闭、
|
|
152
|
+
// Promise.all 收敛,-1 与真实非零退出一样走「无数据」降级。
|
|
153
|
+
new Promise((resolve2) => {
|
|
154
|
+
const timer = setTimeout(() => {
|
|
155
|
+
proc.kill();
|
|
156
|
+
resolve2(-1);
|
|
157
|
+
}, RUN_GIT_TIMEOUT_MS);
|
|
158
|
+
void proc.exited.then((code) => {
|
|
159
|
+
clearTimeout(timer);
|
|
160
|
+
resolve2(code);
|
|
161
|
+
});
|
|
162
|
+
})
|
|
147
163
|
]);
|
|
148
164
|
if (exitCode !== 0) return null;
|
|
149
165
|
return options.trim === false ? stdout.replace(/\r?\n$/, "") : stdout.trim();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-AFIWC5NH.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QA6YKM3H.js";
|
|
8
8
|
import {
|
|
9
9
|
deriveCredentialGroup,
|
|
10
10
|
toSafeAgentSummary
|
|
@@ -81,14 +81,14 @@ import {
|
|
|
81
81
|
} from "./chunk-VF4K2QE6.js";
|
|
82
82
|
import {
|
|
83
83
|
createDocState
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-QRBAZ5PW.js";
|
|
85
85
|
import {
|
|
86
86
|
BUILTIN_OBJECT_SKILL_IDS,
|
|
87
87
|
buildBuiltinObjectSkillConfig,
|
|
88
88
|
buildBuiltinObjectSkillDbKey,
|
|
89
89
|
buildBuiltinObjectSkillPageContent,
|
|
90
90
|
createDialogAction
|
|
91
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-CDVGNZDA.js";
|
|
92
92
|
import {
|
|
93
93
|
DEFAULT_COLLAPSED_CATEGORIES,
|
|
94
94
|
addContentToSpace,
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
updateContentCategory,
|
|
107
107
|
updateContentTitle,
|
|
108
108
|
writeStoredCollapsedCategories
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-P7FA2HMM.js";
|
|
110
110
|
import {
|
|
111
111
|
getCurrentSpaceId,
|
|
112
112
|
getCurrentSpaceIdRaw,
|
|
@@ -128,14 +128,14 @@ import {
|
|
|
128
128
|
selectMsgById,
|
|
129
129
|
uiAskChoiceFunc,
|
|
130
130
|
uiAskChoiceFunctionSchema
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-D74EWXL4.js";
|
|
132
132
|
import {
|
|
133
133
|
createAgent,
|
|
134
134
|
deleteServerSyncedCredential,
|
|
135
135
|
runLlm,
|
|
136
136
|
streamAgentChatTurn,
|
|
137
137
|
updateAgent
|
|
138
|
-
} from "./chunk-
|
|
138
|
+
} from "./chunk-QUH3XHL5.js";
|
|
139
139
|
import {
|
|
140
140
|
getActiveDialogKey,
|
|
141
141
|
selectCurrentDialogKey,
|
|
@@ -4672,7 +4672,7 @@ async function deleteDialogsFunc(args, thunkApi) {
|
|
|
4672
4672
|
const deletedDialogIds = [];
|
|
4673
4673
|
const deletedDialogKeys = [];
|
|
4674
4674
|
const failures = [];
|
|
4675
|
-
const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-
|
|
4675
|
+
const { deleteDialog: deleteDialog2 } = await import("./dialogSlice-THY45JWM.js");
|
|
4676
4676
|
for (const target of targets) {
|
|
4677
4677
|
try {
|
|
4678
4678
|
await thunkApi.dispatch(deleteDialog2(target.dbKey)).unwrap();
|
|
@@ -9933,6 +9933,19 @@ ${preview}`
|
|
|
9933
9933
|
}
|
|
9934
9934
|
|
|
9935
9935
|
// packages/ai/tools/chromeConnectorTools.ts
|
|
9936
|
+
var CHROME_CONNECTOR_TOOL_NAMES = [
|
|
9937
|
+
"chrome_list_tabs",
|
|
9938
|
+
"chrome_open_tab",
|
|
9939
|
+
"chrome_close_tab",
|
|
9940
|
+
"chrome_read_page",
|
|
9941
|
+
"chrome_click",
|
|
9942
|
+
"chrome_type",
|
|
9943
|
+
"chrome_press",
|
|
9944
|
+
"chrome_scroll",
|
|
9945
|
+
"chrome_screenshot",
|
|
9946
|
+
"chrome_read_console",
|
|
9947
|
+
"chrome_read_network"
|
|
9948
|
+
];
|
|
9936
9949
|
var CHROME_CONNECTOR_READ_TOOL_NAMES = [
|
|
9937
9950
|
"chrome_list_tabs",
|
|
9938
9951
|
"chrome_read_page",
|
|
@@ -15533,7 +15546,7 @@ var executeToolRun = createAsyncThunk(
|
|
|
15533
15546
|
if (!executionInput) {
|
|
15534
15547
|
throw new Error(`ToolRun ${id} has no input to execute with.`);
|
|
15535
15548
|
}
|
|
15536
|
-
const { findToolExecutor: findToolExecutor2 } = await import("./tools-
|
|
15549
|
+
const { findToolExecutor: findToolExecutor2 } = await import("./tools-JS475NYO.js");
|
|
15537
15550
|
const { executor } = findToolExecutor2(run.toolName);
|
|
15538
15551
|
toolRunStarted({
|
|
15539
15552
|
id: run.id,
|
|
@@ -18040,7 +18053,7 @@ async function updateDocFunc(args, thunkApi) {
|
|
|
18040
18053
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
18041
18054
|
};
|
|
18042
18055
|
await dispatch(write({ data: updatedPageData, customKey: id })).unwrap();
|
|
18043
|
-
const { getDocState, applyExternalDocUpdate } = await import("./docStore-
|
|
18056
|
+
const { getDocState, applyExternalDocUpdate } = await import("./docStore-ZQ3ECOPY.js");
|
|
18044
18057
|
if (getDocState().pageKey === id) {
|
|
18045
18058
|
applyExternalDocUpdate({
|
|
18046
18059
|
slateData: finalSlateData,
|
|
@@ -20343,6 +20356,7 @@ export {
|
|
|
20343
20356
|
readXPostFunc,
|
|
20344
20357
|
readXhsProfileFunctionSchema,
|
|
20345
20358
|
readXhsProfileFunc,
|
|
20359
|
+
CHROME_CONNECTOR_TOOL_NAMES,
|
|
20346
20360
|
rememberMemoryFunctionSchema,
|
|
20347
20361
|
deleteMemoryFunctionSchema,
|
|
20348
20362
|
queryMemoryFunctionSchema,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
initReactI18next,
|
|
10
10
|
instance,
|
|
11
11
|
toast
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-D74EWXL4.js";
|
|
13
13
|
import {
|
|
14
14
|
require_date_fns
|
|
15
15
|
} from "./chunk-M76ECQRD.js";
|
|
@@ -72,7 +72,8 @@ import {
|
|
|
72
72
|
scheduleWriteReplication
|
|
73
73
|
} from "./chunk-3RAG2NAD.js";
|
|
74
74
|
import {
|
|
75
|
-
createClientLogger
|
|
75
|
+
createClientLogger,
|
|
76
|
+
isAbortError
|
|
76
77
|
} from "./chunk-QOKAKDPE.js";
|
|
77
78
|
import {
|
|
78
79
|
selectIdentityUserId
|
|
@@ -102,6 +103,7 @@ var import_date_fns2 = __toESM(require_date_fns(), 1);
|
|
|
102
103
|
import { ulid as ulid3 } from "ulid";
|
|
103
104
|
|
|
104
105
|
// packages/render/table/fetchAndCacheTableRows.ts
|
|
106
|
+
var TABLE_ROWS_FETCH_TIMEOUT_MS = 5e3;
|
|
105
107
|
var getRowTimestamp = (row) => {
|
|
106
108
|
if (!row || typeof row !== "object") return 0;
|
|
107
109
|
return asOptionalPositiveFiniteNumber(Date.parse(row.updatedAt ?? "")) ?? asOptionalPositiveFiniteNumber(Date.parse(row.createdAt ?? "")) ?? 0;
|
|
@@ -155,46 +157,63 @@ var loadLocalTableRows = async (db, tenantId, tableId) => {
|
|
|
155
157
|
}
|
|
156
158
|
return rows;
|
|
157
159
|
};
|
|
158
|
-
var fetchTableRowsFromServer = async (server, tenantId, tableId, headers) => {
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
160
|
+
var fetchTableRowsFromServer = async (server, tenantId, tableId, headers, fetchImpl = fetch) => {
|
|
161
|
+
const controller = new AbortController();
|
|
162
|
+
const timeoutId = setTimeout(
|
|
163
|
+
() => controller.abort(),
|
|
164
|
+
TABLE_ROWS_FETCH_TIMEOUT_MS
|
|
165
|
+
);
|
|
166
|
+
try {
|
|
167
|
+
const res = await fetchImpl(`${server}/rpc/listTableRows`, {
|
|
168
|
+
method: "POST",
|
|
169
|
+
headers,
|
|
170
|
+
body: JSON.stringify({
|
|
171
|
+
tenantId,
|
|
172
|
+
tableId,
|
|
173
|
+
includeDeleted: true,
|
|
174
|
+
envelope: TABLE_SYNC_ENVELOPE
|
|
175
|
+
}),
|
|
176
|
+
signal: controller.signal
|
|
177
|
+
});
|
|
178
|
+
if (!res.ok) {
|
|
179
|
+
let msg = `\u52A0\u8F7D\u8868 ${tableId} \u884C\u5931\u8D25\uFF08${res.status}\uFF09`;
|
|
180
|
+
try {
|
|
181
|
+
const err2 = await res.json();
|
|
182
|
+
if (err2 && typeof err2.message === "string") {
|
|
183
|
+
msg = err2.message;
|
|
184
|
+
}
|
|
185
|
+
} catch {
|
|
175
186
|
}
|
|
176
|
-
|
|
187
|
+
throw new Error(msg);
|
|
188
|
+
}
|
|
189
|
+
const data = await res.json();
|
|
190
|
+
if (Array.isArray(data)) {
|
|
191
|
+
return {
|
|
192
|
+
rows: data,
|
|
193
|
+
deletedRows: [],
|
|
194
|
+
tableMeta: null,
|
|
195
|
+
complete: false
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if (!data || typeof data !== "object" || !Array.isArray(data.rows)) {
|
|
199
|
+
throw new Error("\u670D\u52A1\u5668\u8FD4\u56DE\u683C\u5F0F\u9519\u8BEF\uFF1A\u9884\u671F\u4E3A\u6570\u7EC4");
|
|
177
200
|
}
|
|
178
|
-
throw new Error(msg);
|
|
179
|
-
}
|
|
180
|
-
const data = await res.json();
|
|
181
|
-
if (Array.isArray(data)) {
|
|
182
201
|
return {
|
|
183
|
-
rows: data,
|
|
184
|
-
deletedRows: [],
|
|
185
|
-
tableMeta: null,
|
|
186
|
-
complete:
|
|
202
|
+
rows: data.rows,
|
|
203
|
+
deletedRows: Array.isArray(data.deletedRows) ? data.deletedRows : [],
|
|
204
|
+
tableMeta: data.tableMeta ?? null,
|
|
205
|
+
complete: data.complete === true
|
|
187
206
|
};
|
|
207
|
+
} catch (err2) {
|
|
208
|
+
if (isAbortError(err2)) {
|
|
209
|
+
throw new Error(
|
|
210
|
+
`\u52A0\u8F7D\u8868 ${tableId} \u884C\u8D85\u65F6\uFF1A${server} \u5728 ${TABLE_ROWS_FETCH_TIMEOUT_MS / 1e3}s \u5185\u65E0\u54CD\u5E94`
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
throw err2;
|
|
214
|
+
} finally {
|
|
215
|
+
clearTimeout(timeoutId);
|
|
188
216
|
}
|
|
189
|
-
if (!data || typeof data !== "object" || !Array.isArray(data.rows)) {
|
|
190
|
-
throw new Error("\u670D\u52A1\u5668\u8FD4\u56DE\u683C\u5F0F\u9519\u8BEF\uFF1A\u9884\u671F\u4E3A\u6570\u7EC4");
|
|
191
|
-
}
|
|
192
|
-
return {
|
|
193
|
-
rows: data.rows,
|
|
194
|
-
deletedRows: Array.isArray(data.deletedRows) ? data.deletedRows : [],
|
|
195
|
-
tableMeta: data.tableMeta ?? null,
|
|
196
|
-
complete: data.complete === true
|
|
197
|
-
};
|
|
198
217
|
};
|
|
199
218
|
var cacheMergedTableRows = async (db, mergedRows) => {
|
|
200
219
|
if (!db) return;
|
|
@@ -252,7 +271,8 @@ var fetchAndCacheTableRows = async ({
|
|
|
252
271
|
tenantId,
|
|
253
272
|
tableId,
|
|
254
273
|
token,
|
|
255
|
-
remoteServers = []
|
|
274
|
+
remoteServers = [],
|
|
275
|
+
fetchImpl = fetch
|
|
256
276
|
}) => {
|
|
257
277
|
const headers = {
|
|
258
278
|
"Content-Type": "application/json"
|
|
@@ -263,7 +283,7 @@ var fetchAndCacheTableRows = async ({
|
|
|
263
283
|
const localRows = await loadLocalTableRows(db, tenantId, tableId);
|
|
264
284
|
const remoteResults = await Promise.allSettled(
|
|
265
285
|
remoteServers.map(
|
|
266
|
-
(server) => fetchTableRowsFromServer(server, tenantId, tableId, headers)
|
|
286
|
+
(server) => fetchTableRowsFromServer(server, tenantId, tableId, headers, fetchImpl)
|
|
267
287
|
)
|
|
268
288
|
);
|
|
269
289
|
const fulfilledRemoteSnapshots = remoteResults.filter(
|
|
@@ -367,43 +387,6 @@ function reorderColumnInMeta(meta, input, deps) {
|
|
|
367
387
|
buildMeta(meta, reorderList(meta.columns, fromIndex, toIndex), deps.nowIso)
|
|
368
388
|
);
|
|
369
389
|
}
|
|
370
|
-
function renameColumnInMeta(meta, rows, input, deps) {
|
|
371
|
-
const { oldName } = input;
|
|
372
|
-
const { nowIso } = deps;
|
|
373
|
-
const newName = input.newName.trim();
|
|
374
|
-
if (!newName) {
|
|
375
|
-
return err("\u65B0\u7684\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A");
|
|
376
|
-
}
|
|
377
|
-
if (!meta.columns.some((c) => c.name === oldName)) {
|
|
378
|
-
return err(`\u5B57\u6BB5 ${oldName} \u4E0D\u5B58\u5728`);
|
|
379
|
-
}
|
|
380
|
-
if (meta.columns.some((c) => c.name === newName)) {
|
|
381
|
-
return err(`\u5B57\u6BB5 ${newName} \u5DF2\u5B58\u5728`);
|
|
382
|
-
}
|
|
383
|
-
const newColumns = meta.columns.map(
|
|
384
|
-
(c) => c.name === oldName ? { ...c, name: newName } : c
|
|
385
|
-
);
|
|
386
|
-
const rowPatches = rows.filter((row) => hasOwn(row, oldName)).map((row) => ({
|
|
387
|
-
dbKey: row.dbKey,
|
|
388
|
-
changes: {
|
|
389
|
-
[newName]: row[oldName],
|
|
390
|
-
[oldName]: null,
|
|
391
|
-
updatedAt: nowIso
|
|
392
|
-
}
|
|
393
|
-
}));
|
|
394
|
-
const newRows = rows.map((row) => {
|
|
395
|
-
if (!hasOwn(row, oldName)) {
|
|
396
|
-
return row;
|
|
397
|
-
}
|
|
398
|
-
const { [oldName]: oldValue, ...rest } = row;
|
|
399
|
-
return { ...rest, [newName]: oldValue, updatedAt: nowIso };
|
|
400
|
-
});
|
|
401
|
-
return ok({
|
|
402
|
-
...buildMeta(meta, newColumns, nowIso),
|
|
403
|
-
rows: newRows,
|
|
404
|
-
rowPatches
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
390
|
function renameColumnLabelInMeta(meta, input, deps) {
|
|
408
391
|
const { columnId } = input;
|
|
409
392
|
const label = input.label.trim();
|
|
@@ -460,7 +443,13 @@ import { ulid as ulid2 } from "ulid";
|
|
|
460
443
|
instance.use(initReactI18next).init({
|
|
461
444
|
...i18nBaseConfig,
|
|
462
445
|
lng: "zh-CN" /* ZH_CN */,
|
|
463
|
-
fallbackLng:
|
|
446
|
+
fallbackLng: {
|
|
447
|
+
["en" /* EN */]: ["en" /* EN */],
|
|
448
|
+
["zh-CN" /* ZH_CN */]: ["zh-CN" /* ZH_CN */, "en" /* EN */],
|
|
449
|
+
["zh-Hant" /* ZH_HANT */]: ["zh-Hant" /* ZH_HANT */, "zh-CN" /* ZH_CN */, "en" /* EN */],
|
|
450
|
+
["ja" /* JA */]: ["ja" /* JA */, "en" /* EN */],
|
|
451
|
+
default: ["en" /* EN */]
|
|
452
|
+
},
|
|
464
453
|
compatibilityJSON: "v3"
|
|
465
454
|
});
|
|
466
455
|
var client_default = instance;
|
|
@@ -1189,49 +1178,6 @@ var reorderColumn = createTableCommand(
|
|
|
1189
1178
|
}
|
|
1190
1179
|
}
|
|
1191
1180
|
);
|
|
1192
|
-
var renameColumn = createTableCommand(
|
|
1193
|
-
"table/renameColumn",
|
|
1194
|
-
async (args, { dispatch } = {}) => {
|
|
1195
|
-
const { tenantId, tableId, oldName, newName } = args;
|
|
1196
|
-
const meta = state.currentTable;
|
|
1197
|
-
if (!meta || meta.tenantId !== tenantId || meta.tableId !== tableId) {
|
|
1198
|
-
throw new Error("\u5F53\u524D\u6CA1\u6709\u52A0\u8F7D\u5BF9\u5E94\u7684\u8868\u5B9A\u4E49");
|
|
1199
|
-
}
|
|
1200
|
-
const result = renameColumnInMeta(
|
|
1201
|
-
meta,
|
|
1202
|
-
state.rows,
|
|
1203
|
-
{ oldName, newName },
|
|
1204
|
-
{ nowIso: (0, import_date_fns2.formatISO)(/* @__PURE__ */ new Date()) }
|
|
1205
|
-
);
|
|
1206
|
-
if (!result.ok) {
|
|
1207
|
-
throw new Error(result.error);
|
|
1208
|
-
}
|
|
1209
|
-
const { meta: nextMeta, metaChanges, rows: newRows, rowPatches } = result.value;
|
|
1210
|
-
setState((s) => ({ ...s, error: null }));
|
|
1211
|
-
try {
|
|
1212
|
-
if (dispatch) {
|
|
1213
|
-
await Promise.all(
|
|
1214
|
-
rowPatches.map((p) => safeDispatch(dispatch, patch(p)))
|
|
1215
|
-
);
|
|
1216
|
-
await safeDispatch(
|
|
1217
|
-
dispatch,
|
|
1218
|
-
patch({ dbKey: meta.dbKey, changes: metaChanges })
|
|
1219
|
-
);
|
|
1220
|
-
}
|
|
1221
|
-
setState((s) => ({
|
|
1222
|
-
...s,
|
|
1223
|
-
currentTable: nextMeta,
|
|
1224
|
-
rows: newRows,
|
|
1225
|
-
isInitialized: true
|
|
1226
|
-
}));
|
|
1227
|
-
return { meta: nextMeta, rows: newRows };
|
|
1228
|
-
} catch (e) {
|
|
1229
|
-
const msg = e?.message || "\u91CD\u547D\u540D\u5B57\u6BB5\u5931\u8D25";
|
|
1230
|
-
setState((s) => ({ ...s, error: msg }));
|
|
1231
|
-
throw e;
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
);
|
|
1235
1181
|
var renameColumnLabel = createTableCommand(
|
|
1236
1182
|
"table/renameColumnLabel",
|
|
1237
1183
|
async (args, { dispatch } = {}) => {
|