@themoltnet/sdk 0.6.0 → 0.7.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/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/info.d.ts +6 -0
- package/dist/info.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { writeMcpConfig } from './config.js';
|
|
2
2
|
export { type CredentialsFile, getConfigDir, getCredentialsPath, readCredentials, writeCredentials, } from './credentials.js';
|
|
3
3
|
export { MoltNetError, NetworkError, problemToError, RegistrationError, } from './errors.js';
|
|
4
|
+
export { info, type InfoOptions } from './info.js';
|
|
4
5
|
export { buildMcpConfig, type McpConfig, register, type RegisterOptions, type RegisterResult, } from './register.js';
|
|
6
|
+
import { info } from './info.js';
|
|
5
7
|
import { register } from './register.js';
|
|
6
8
|
export declare const MoltNet: {
|
|
7
9
|
readonly register: typeof register;
|
|
10
|
+
readonly info: typeof info;
|
|
8
11
|
};
|
|
9
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,KAAK,eAAe,EACpB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,KAAK,SAAS,EACd,QAAQ,EACR,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,KAAK,eAAe,EACpB,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,cAAc,EACd,KAAK,SAAS,EACd,QAAQ,EACR,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,eAAO,MAAM,OAAO;;;CAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -915,6 +915,20 @@ const registerAgent = (options) => (options.client ?? client).post({
|
|
|
915
915
|
...options.headers
|
|
916
916
|
}
|
|
917
917
|
});
|
|
918
|
+
const getNetworkInfo = (options) => ((options == null ? void 0 : options.client) ?? client).get({ url: "/.well-known/moltnet.json", ...options });
|
|
919
|
+
const DEFAULT_API_URL$1 = "https://api.themolt.net";
|
|
920
|
+
async function info(options) {
|
|
921
|
+
const apiUrl = ((options == null ? void 0 : options.apiUrl) ?? DEFAULT_API_URL$1).replace(/\/$/, "");
|
|
922
|
+
const client2 = createClient({ baseUrl: apiUrl });
|
|
923
|
+
const { data, error } = await getNetworkInfo({ client: client2 });
|
|
924
|
+
if (error) {
|
|
925
|
+
throw new NetworkError("Failed to fetch network info");
|
|
926
|
+
}
|
|
927
|
+
if (!data) {
|
|
928
|
+
throw new NetworkError("Empty response from network info endpoint");
|
|
929
|
+
}
|
|
930
|
+
return data;
|
|
931
|
+
}
|
|
918
932
|
ed.etc.sha512Sync = (...m) => {
|
|
919
933
|
const hash = createHash("sha512");
|
|
920
934
|
m.forEach((msg) => hash.update(msg));
|
|
@@ -1107,7 +1121,7 @@ async function register(options) {
|
|
|
1107
1121
|
apiUrl
|
|
1108
1122
|
};
|
|
1109
1123
|
}
|
|
1110
|
-
const MoltNet = { register };
|
|
1124
|
+
const MoltNet = { register, info };
|
|
1111
1125
|
export {
|
|
1112
1126
|
MoltNet,
|
|
1113
1127
|
MoltNetError,
|
|
@@ -1116,6 +1130,7 @@ export {
|
|
|
1116
1130
|
buildMcpConfig,
|
|
1117
1131
|
getConfigDir,
|
|
1118
1132
|
getCredentialsPath,
|
|
1133
|
+
info,
|
|
1119
1134
|
problemToError,
|
|
1120
1135
|
readCredentials,
|
|
1121
1136
|
register,
|
package/dist/info.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../src/info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAOlE,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,IAAI,CACxB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,sBAAsB,CAAC,CAYjC"}
|