Compare commits
2 Commits
notify-pro
...
e57fed2e50
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e57fed2e50 | ||
| b270649f21 |
8
package-lock.json
generated
8
package-lock.json
generated
@@ -12,14 +12,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^25.5.2",
|
"@types/node": "^25.5.2",
|
||||||
"openclaw": "file:/usr/lib/node_modules/openclaw",
|
|
||||||
"typescript": "^5.6.3",
|
"typescript": "^5.6.3",
|
||||||
"vitest": "^4.1.3"
|
"vitest": "^4.1.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"../../../../../usr/lib/node_modules/openclaw": {
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@emnapi/core": {
|
"node_modules/@emnapi/core": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.1.tgz",
|
||||||
@@ -918,10 +914,6 @@
|
|||||||
],
|
],
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/openclaw": {
|
|
||||||
"resolved": "../../../../../usr/lib/node_modules/openclaw",
|
|
||||||
"link": true
|
|
||||||
},
|
|
||||||
"node_modules/pathe": {
|
"node_modules/pathe": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
export interface YonexusClientConfig {
|
export interface YonexusClientConfig {
|
||||||
mainHost: string;
|
mainHost: string;
|
||||||
identifier: string;
|
identifier: string;
|
||||||
/**
|
notifyBotToken: string;
|
||||||
* Optional. The client never sends pairing notifications (the server
|
adminUserId: string;
|
||||||
* does); accepted for back-compat but no longer required.
|
|
||||||
*/
|
|
||||||
notifyBotToken?: string;
|
|
||||||
adminUserId?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class YonexusClientConfigError extends Error {
|
export class YonexusClientConfigError extends Error {
|
||||||
@@ -48,9 +44,15 @@ export function validateYonexusClientConfig(raw: unknown): YonexusClientConfig {
|
|||||||
issues.push("identifier is required");
|
issues.push("identifier is required");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optional (back-compat): the client does not send notifications.
|
|
||||||
const rawNotifyBotToken = source.notifyBotToken;
|
const rawNotifyBotToken = source.notifyBotToken;
|
||||||
|
if (!isNonEmptyString(rawNotifyBotToken)) {
|
||||||
|
issues.push("notifyBotToken is required");
|
||||||
|
}
|
||||||
|
|
||||||
const rawAdminUserId = source.adminUserId;
|
const rawAdminUserId = source.adminUserId;
|
||||||
|
if (!isNonEmptyString(rawAdminUserId)) {
|
||||||
|
issues.push("adminUserId is required");
|
||||||
|
}
|
||||||
|
|
||||||
if (issues.length > 0) {
|
if (issues.length > 0) {
|
||||||
throw new YonexusClientConfigError(issues);
|
throw new YonexusClientConfigError(issues);
|
||||||
@@ -58,15 +60,13 @@ export function validateYonexusClientConfig(raw: unknown): YonexusClientConfig {
|
|||||||
|
|
||||||
const mainHost = (rawMainHost as string).trim();
|
const mainHost = (rawMainHost as string).trim();
|
||||||
const identifier = (rawIdentifier as string).trim();
|
const identifier = (rawIdentifier as string).trim();
|
||||||
|
const notifyBotToken = (rawNotifyBotToken as string).trim();
|
||||||
|
const adminUserId = (rawAdminUserId as string).trim();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
mainHost,
|
mainHost,
|
||||||
identifier,
|
identifier,
|
||||||
notifyBotToken: isNonEmptyString(rawNotifyBotToken)
|
notifyBotToken,
|
||||||
? rawNotifyBotToken.trim()
|
adminUserId
|
||||||
: undefined,
|
|
||||||
adminUserId: isNonEmptyString(rawAdminUserId)
|
|
||||||
? rawAdminUserId.trim()
|
|
||||||
: undefined
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,6 @@
|
|||||||
"notifyBotToken": { "type": "string" },
|
"notifyBotToken": { "type": "string" },
|
||||||
"adminUserId": { "type": "string" }
|
"adminUserId": { "type": "string" }
|
||||||
},
|
},
|
||||||
"required": ["mainHost", "identifier"]
|
"required": ["mainHost", "identifier", "notifyBotToken", "adminUserId"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user