routstrd 0.2.9 → 0.2.10
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/index.js +8 -5
- package/package.json +1 -1
- package/src/utils/clients.ts +8 -9
package/dist/index.js
CHANGED
|
@@ -15240,9 +15240,13 @@ async function getClientsList() {
|
|
|
15240
15240
|
lastUsed: c.lastUsed
|
|
15241
15241
|
}));
|
|
15242
15242
|
}
|
|
15243
|
-
async function addDaemonClient(name
|
|
15243
|
+
async function addDaemonClient(name) {
|
|
15244
15244
|
const existingClients = await getClientsList();
|
|
15245
|
-
const
|
|
15245
|
+
const derivedId = name.replace(/\s+/g, "-").toLowerCase();
|
|
15246
|
+
const config = await loadConfig();
|
|
15247
|
+
const suffix = getNpubSuffix2(config);
|
|
15248
|
+
const clientId = suffix ? addSuffixToId(derivedId, suffix) : derivedId;
|
|
15249
|
+
const existing = existingClients.find((c) => c.clientId === clientId);
|
|
15246
15250
|
if (existing) {
|
|
15247
15251
|
const client = {
|
|
15248
15252
|
id: existing.clientId,
|
|
@@ -15253,7 +15257,6 @@ async function addDaemonClient(name, clientId) {
|
|
|
15253
15257
|
};
|
|
15254
15258
|
return { client, created: false };
|
|
15255
15259
|
}
|
|
15256
|
-
const derivedId = name.replace(/\s+/g, "-").toLowerCase();
|
|
15257
15260
|
const result = await callDaemon("/clients/add", {
|
|
15258
15261
|
method: "POST",
|
|
15259
15262
|
body: { name, id: derivedId }
|
|
@@ -15327,7 +15330,7 @@ async function addClientAction(options) {
|
|
|
15327
15330
|
if (!integrationFn || !integrationConfig)
|
|
15328
15331
|
continue;
|
|
15329
15332
|
try {
|
|
15330
|
-
const { client, created } = await addDaemonClient(integrationConfig.name
|
|
15333
|
+
const { client, created } = await addDaemonClient(integrationConfig.name);
|
|
15331
15334
|
if (created) {
|
|
15332
15335
|
logger.log(`Created new API key for ${integrationConfig.name}`);
|
|
15333
15336
|
} else {
|
|
@@ -15554,7 +15557,7 @@ async function isCocodInstalled(cocodPath) {
|
|
|
15554
15557
|
// package.json
|
|
15555
15558
|
var package_default = {
|
|
15556
15559
|
name: "routstrd",
|
|
15557
|
-
version: "0.2.
|
|
15560
|
+
version: "0.2.10",
|
|
15558
15561
|
module: "src/index.ts",
|
|
15559
15562
|
type: "module",
|
|
15560
15563
|
private: false,
|
package/package.json
CHANGED
package/src/utils/clients.ts
CHANGED
|
@@ -121,12 +121,15 @@ export async function getClientsList(): Promise<ClientEntry[]> {
|
|
|
121
121
|
|
|
122
122
|
export async function addDaemonClient(
|
|
123
123
|
name: string,
|
|
124
|
-
clientId?: string,
|
|
125
124
|
): Promise<{ message?: string; client: DaemonClient; created: boolean }> {
|
|
126
125
|
const existingClients = await getClientsList();
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
// Derive id from name by replacing spaces with hyphens
|
|
127
|
+
const derivedId = name.replace(/\s+/g, "-").toLowerCase();
|
|
128
|
+
const config = await loadConfig();
|
|
129
|
+
const suffix = getNpubSuffix(config);
|
|
130
|
+
const clientId = suffix ? addSuffixToId(derivedId, suffix) : derivedId;
|
|
131
|
+
|
|
132
|
+
const existing = existingClients.find((c) => c.clientId === clientId);
|
|
130
133
|
|
|
131
134
|
if (existing) {
|
|
132
135
|
const client: DaemonClient = {
|
|
@@ -139,9 +142,6 @@ export async function addDaemonClient(
|
|
|
139
142
|
return { client, created: false };
|
|
140
143
|
}
|
|
141
144
|
|
|
142
|
-
// Derive id from name by replacing spaces with hyphens
|
|
143
|
-
const derivedId = name.replace(/\s+/g, "-").toLowerCase();
|
|
144
|
-
|
|
145
145
|
const result = await callDaemon("/clients/add", {
|
|
146
146
|
method: "POST",
|
|
147
147
|
body: { name, id: derivedId },
|
|
@@ -246,8 +246,7 @@ export async function addClientAction(options: AddClientOptions): Promise<void>
|
|
|
246
246
|
|
|
247
247
|
try {
|
|
248
248
|
const { client, created } = await addDaemonClient(
|
|
249
|
-
integrationConfig.name
|
|
250
|
-
integrationConfig.clientId,
|
|
249
|
+
integrationConfig.name
|
|
251
250
|
);
|
|
252
251
|
if (created) {
|
|
253
252
|
logger.log(`Created new API key for ${integrationConfig.name}`);
|