@themoltnet/node-red-contrib-core 0.12.1 → 0.12.2
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/nodes/src.js +164 -19
- package/package.json +2 -2
package/dist/nodes/src.js
CHANGED
|
@@ -620,6 +620,102 @@ var getNetworkInfo = (options) => (options?.client ?? client).get({
|
|
|
620
620
|
...options
|
|
621
621
|
});
|
|
622
622
|
/**
|
|
623
|
+
* List agent API keys bound to the active team. Team credential managers may list every agent.
|
|
624
|
+
*/
|
|
625
|
+
var listAgentKeys = (options) => (options.client ?? client).get({
|
|
626
|
+
security: [
|
|
627
|
+
{
|
|
628
|
+
scheme: "bearer",
|
|
629
|
+
type: "http"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: "X-Moltnet-Session-Token",
|
|
633
|
+
type: "apiKey"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
in: "cookie",
|
|
637
|
+
name: "ory_kratos_session",
|
|
638
|
+
type: "apiKey"
|
|
639
|
+
}
|
|
640
|
+
],
|
|
641
|
+
url: "/agent-keys",
|
|
642
|
+
...options
|
|
643
|
+
});
|
|
644
|
+
/**
|
|
645
|
+
* Issue a secret API key bound to one agent and the active team.
|
|
646
|
+
*/
|
|
647
|
+
var createAgentKey = (options) => (options.client ?? client).post({
|
|
648
|
+
security: [
|
|
649
|
+
{
|
|
650
|
+
scheme: "bearer",
|
|
651
|
+
type: "http"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
name: "X-Moltnet-Session-Token",
|
|
655
|
+
type: "apiKey"
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
in: "cookie",
|
|
659
|
+
name: "ory_kratos_session",
|
|
660
|
+
type: "apiKey"
|
|
661
|
+
}
|
|
662
|
+
],
|
|
663
|
+
url: "/agent-keys",
|
|
664
|
+
...options,
|
|
665
|
+
headers: {
|
|
666
|
+
"Content-Type": "application/json",
|
|
667
|
+
...options.headers
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
/**
|
|
671
|
+
* Permanently revoke an agent API key.
|
|
672
|
+
*/
|
|
673
|
+
var revokeAgentKey = (options) => (options.client ?? client).post({
|
|
674
|
+
security: [
|
|
675
|
+
{
|
|
676
|
+
scheme: "bearer",
|
|
677
|
+
type: "http"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: "X-Moltnet-Session-Token",
|
|
681
|
+
type: "apiKey"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
in: "cookie",
|
|
685
|
+
name: "ory_kratos_session",
|
|
686
|
+
type: "apiKey"
|
|
687
|
+
}
|
|
688
|
+
],
|
|
689
|
+
url: "/agent-keys/{keyId}/revoke",
|
|
690
|
+
...options,
|
|
691
|
+
headers: {
|
|
692
|
+
"Content-Type": "application/json",
|
|
693
|
+
...options.headers
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
/**
|
|
697
|
+
* Rotate an agent API key immediately. The previous secret is revoked and expiry is unchanged.
|
|
698
|
+
*/
|
|
699
|
+
var rotateAgentKey = (options) => (options.client ?? client).post({
|
|
700
|
+
security: [
|
|
701
|
+
{
|
|
702
|
+
scheme: "bearer",
|
|
703
|
+
type: "http"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
name: "X-Moltnet-Session-Token",
|
|
707
|
+
type: "apiKey"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
in: "cookie",
|
|
711
|
+
name: "ory_kratos_session",
|
|
712
|
+
type: "apiKey"
|
|
713
|
+
}
|
|
714
|
+
],
|
|
715
|
+
url: "/agent-keys/{keyId}/rotate",
|
|
716
|
+
...options
|
|
717
|
+
});
|
|
718
|
+
/**
|
|
623
719
|
* Get the authenticated agent identity (requires bearer token).
|
|
624
720
|
*/
|
|
625
721
|
var getWhoami = (options) => (options?.client ?? client).get({
|
|
@@ -2903,6 +2999,67 @@ function unwrapRequired(result, message, code) {
|
|
|
2903
2999
|
return result.data;
|
|
2904
3000
|
}
|
|
2905
3001
|
//#endregion
|
|
3002
|
+
//#region ../sdk/src/namespaces/team-headers.ts
|
|
3003
|
+
/**
|
|
3004
|
+
* Build the team header from an optional option, or `undefined` when no team
|
|
3005
|
+
* context was supplied. Used by diaries and runtime-profiles, whose endpoints
|
|
3006
|
+
* accept the header optionally.
|
|
3007
|
+
*/
|
|
3008
|
+
function teamHeaders(options) {
|
|
3009
|
+
return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* Build the team header from a required option. Used by tasks and
|
|
3013
|
+
* runtime-slots, whose endpoints mandate the header.
|
|
3014
|
+
*/
|
|
3015
|
+
function requiredTeamHeaders(options) {
|
|
3016
|
+
return { "x-moltnet-team-id": options.teamId };
|
|
3017
|
+
}
|
|
3018
|
+
//#endregion
|
|
3019
|
+
//#region ../sdk/src/namespaces/agent-keys.ts
|
|
3020
|
+
function createAgentKeysNamespace(context) {
|
|
3021
|
+
const { client, auth } = context;
|
|
3022
|
+
return {
|
|
3023
|
+
async list(query, options) {
|
|
3024
|
+
return unwrapResult(await listAgentKeys({
|
|
3025
|
+
client,
|
|
3026
|
+
auth,
|
|
3027
|
+
headers: requiredTeamHeaders(options),
|
|
3028
|
+
query
|
|
3029
|
+
}));
|
|
3030
|
+
},
|
|
3031
|
+
async create(body, options) {
|
|
3032
|
+
return unwrapResult(await createAgentKey({
|
|
3033
|
+
client,
|
|
3034
|
+
auth,
|
|
3035
|
+
headers: {
|
|
3036
|
+
...requiredTeamHeaders(options),
|
|
3037
|
+
"idempotency-key": options.idempotencyKey
|
|
3038
|
+
},
|
|
3039
|
+
body
|
|
3040
|
+
}));
|
|
3041
|
+
},
|
|
3042
|
+
async rotate(keyId, options) {
|
|
3043
|
+
return unwrapResult(await rotateAgentKey({
|
|
3044
|
+
client,
|
|
3045
|
+
auth,
|
|
3046
|
+
headers: requiredTeamHeaders(options),
|
|
3047
|
+
path: { keyId }
|
|
3048
|
+
}));
|
|
3049
|
+
},
|
|
3050
|
+
async revoke(keyId, body, options) {
|
|
3051
|
+
const result = await revokeAgentKey({
|
|
3052
|
+
client,
|
|
3053
|
+
auth,
|
|
3054
|
+
headers: requiredTeamHeaders(options),
|
|
3055
|
+
path: { keyId },
|
|
3056
|
+
body
|
|
3057
|
+
});
|
|
3058
|
+
if (result.error) unwrapResult(result);
|
|
3059
|
+
}
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3062
|
+
//#endregion
|
|
2906
3063
|
//#region ../sdk/src/namespaces/agents.ts
|
|
2907
3064
|
function createAgentsNamespace(context) {
|
|
2908
3065
|
const { client, auth } = context;
|
|
@@ -2960,23 +3117,6 @@ function createCryptoNamespace(context, signingRequests) {
|
|
|
2960
3117
|
};
|
|
2961
3118
|
}
|
|
2962
3119
|
//#endregion
|
|
2963
|
-
//#region ../sdk/src/namespaces/team-headers.ts
|
|
2964
|
-
/**
|
|
2965
|
-
* Build the team header from an optional option, or `undefined` when no team
|
|
2966
|
-
* context was supplied. Used by diaries and runtime-profiles, whose endpoints
|
|
2967
|
-
* accept the header optionally.
|
|
2968
|
-
*/
|
|
2969
|
-
function teamHeaders(options) {
|
|
2970
|
-
return options?.teamId ? { "x-moltnet-team-id": options.teamId } : void 0;
|
|
2971
|
-
}
|
|
2972
|
-
/**
|
|
2973
|
-
* Build the team header from a required option. Used by tasks and
|
|
2974
|
-
* runtime-slots, whose endpoints mandate the header.
|
|
2975
|
-
*/
|
|
2976
|
-
function requiredTeamHeaders(options) {
|
|
2977
|
-
return { "x-moltnet-team-id": options.teamId };
|
|
2978
|
-
}
|
|
2979
|
-
//#endregion
|
|
2980
3120
|
//#region ../sdk/src/namespaces/diaries.ts
|
|
2981
3121
|
function createDiariesNamespace(context) {
|
|
2982
3122
|
const { client, auth } = context;
|
|
@@ -4887,7 +5027,10 @@ function createEntriesNamespace(context) {
|
|
|
4887
5027
|
const signingRequest = unwrapResult(await createSigningRequest({
|
|
4888
5028
|
client,
|
|
4889
5029
|
auth,
|
|
4890
|
-
body: {
|
|
5030
|
+
body: {
|
|
5031
|
+
message: computeContentCid(body.entryType ?? "semantic", body.title ?? null, body.content, body.tags ?? null),
|
|
5032
|
+
verificationMethod: "agent-ed25519"
|
|
5033
|
+
}
|
|
4891
5034
|
}));
|
|
4892
5035
|
const privateKeyBytes = new Uint8Array(Buffer.from(privateKey, "base64"));
|
|
4893
5036
|
const signature = await signAsync(new Uint8Array(Buffer.from(signingRequest.signingInput, "base64")), privateKeyBytes);
|
|
@@ -15498,8 +15641,10 @@ function createAgent(options) {
|
|
|
15498
15641
|
client,
|
|
15499
15642
|
auth
|
|
15500
15643
|
};
|
|
15644
|
+
const diaries = createDiariesNamespace(context);
|
|
15501
15645
|
return {
|
|
15502
|
-
|
|
15646
|
+
agentKeys: createAgentKeysNamespace(context),
|
|
15647
|
+
diaries,
|
|
15503
15648
|
diaryGrants: createDiaryGrantsNamespace(context),
|
|
15504
15649
|
diaryTransfers: createDiaryTransfersNamespace(context),
|
|
15505
15650
|
packs: createPacksNamespace(context),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@themoltnet/node-red-contrib-core",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Node-RED nodes for the MoltNet API",
|
|
6
6
|
"keywords": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"main": "dist/nodes/agent.js",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@themoltnet/sdk": "0.
|
|
49
|
+
"@themoltnet/sdk": "0.122.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^22.19.0",
|