@secrecy/lib 1.82.0 → 1.83.1
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.
|
@@ -158,6 +158,14 @@ export class SecrecyCloudClient {
|
|
|
158
158
|
return folder;
|
|
159
159
|
}
|
|
160
160
|
async node({ id, deleted, } = {}) {
|
|
161
|
+
const node = await this.#client.apiClient.cloud.nodeById.query({
|
|
162
|
+
id,
|
|
163
|
+
deleted,
|
|
164
|
+
fromIdentityPubKey: this.#client.currentIdentity.identityPubKey,
|
|
165
|
+
});
|
|
166
|
+
return await apiNodeToExternal(node, this.#client.keyPairs);
|
|
167
|
+
}
|
|
168
|
+
async nodeFull({ id, deleted, } = {}) {
|
|
161
169
|
const node = await this.#client.apiClient.cloud.nodeFullById.query({
|
|
162
170
|
id,
|
|
163
171
|
deleted,
|
|
@@ -166,12 +174,56 @@ export class SecrecyCloudClient {
|
|
|
166
174
|
return await apiNodeToExternalNodeFull(node, this.#client.keyPairs);
|
|
167
175
|
}
|
|
168
176
|
async nodes({ ids, deleted, }) {
|
|
169
|
-
const
|
|
177
|
+
const apiNodes = await this.#client.apiClient.cloud.nodeByIds.query({
|
|
178
|
+
ids,
|
|
179
|
+
deleted,
|
|
180
|
+
fromIdentityPubKey: this.#client.currentIdentity.identityPubKey,
|
|
181
|
+
});
|
|
182
|
+
const errors = apiNodes.missingIds.map((id) => ({
|
|
183
|
+
message: `Node ${id} not found`,
|
|
184
|
+
nodeId: id,
|
|
185
|
+
}));
|
|
186
|
+
const nodes = [];
|
|
187
|
+
const handleNode = async (node) => {
|
|
188
|
+
try {
|
|
189
|
+
const externalNode = await apiNodeToExternal(node, this.#client.keyPairs);
|
|
190
|
+
nodes.push(externalNode);
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
errors.push({
|
|
194
|
+
message: error instanceof Error ? error.message : String(error),
|
|
195
|
+
nodeId: node.id,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
await Promise.all(apiNodes.nodes.map(handleNode));
|
|
200
|
+
return { nodes, errors };
|
|
201
|
+
}
|
|
202
|
+
async nodesFull({ ids, deleted, }) {
|
|
203
|
+
const apiNodes = await this.#client.apiClient.cloud.nodeFullByIds.query({
|
|
170
204
|
ids,
|
|
171
205
|
deleted,
|
|
172
206
|
fromIdentityPubKey: this.#client.currentIdentity.identityPubKey,
|
|
173
207
|
});
|
|
174
|
-
|
|
208
|
+
const errors = apiNodes.missingIds.map((id) => ({
|
|
209
|
+
message: `Node ${id} not found`,
|
|
210
|
+
nodeId: id,
|
|
211
|
+
}));
|
|
212
|
+
const nodes = [];
|
|
213
|
+
const handleNode = async (node) => {
|
|
214
|
+
try {
|
|
215
|
+
const externalNode = await apiNodeToExternalNodeFull(node, this.#client.keyPairs);
|
|
216
|
+
nodes.push(externalNode);
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
errors.push({
|
|
220
|
+
message: error instanceof Error ? error.message : String(error),
|
|
221
|
+
nodeId: node.id,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
await Promise.all(apiNodes.nodes.map(handleNode));
|
|
226
|
+
return { nodes, errors };
|
|
175
227
|
}
|
|
176
228
|
async dataMetadata({ id }) {
|
|
177
229
|
const data = await this.#client.apiClient.cloud.dataById.query({
|
|
@@ -51,11 +51,31 @@ export declare class SecrecyCloudClient {
|
|
|
51
51
|
node({ id, deleted, }?: {
|
|
52
52
|
id?: string | null | undefined;
|
|
53
53
|
deleted?: boolean | null | undefined;
|
|
54
|
+
}): Promise<Node>;
|
|
55
|
+
nodeFull({ id, deleted, }?: {
|
|
56
|
+
id?: string | null | undefined;
|
|
57
|
+
deleted?: boolean | null | undefined;
|
|
54
58
|
}): Promise<NodeFull>;
|
|
55
59
|
nodes({ ids, deleted, }: {
|
|
56
60
|
ids: string[];
|
|
57
61
|
deleted?: boolean | null | undefined;
|
|
58
|
-
}): Promise<
|
|
62
|
+
}): Promise<{
|
|
63
|
+
nodes: Node[];
|
|
64
|
+
errors: {
|
|
65
|
+
message: string;
|
|
66
|
+
nodeId: string;
|
|
67
|
+
}[];
|
|
68
|
+
}>;
|
|
69
|
+
nodesFull({ ids, deleted, }: {
|
|
70
|
+
ids: string[];
|
|
71
|
+
deleted?: boolean | null | undefined;
|
|
72
|
+
}): Promise<{
|
|
73
|
+
nodes: NodeFull[];
|
|
74
|
+
errors: {
|
|
75
|
+
message: string;
|
|
76
|
+
nodeId: string;
|
|
77
|
+
}[];
|
|
78
|
+
}>;
|
|
59
79
|
dataMetadata({ id }: {
|
|
60
80
|
id: string;
|
|
61
81
|
}): Promise<DataMetadata>;
|
package/dist/types/client.d.ts
CHANGED
|
@@ -2257,6 +2257,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
|
|
|
2257
2257
|
sizeEncrypted: bigint;
|
|
2258
2258
|
};
|
|
2259
2259
|
})[];
|
|
2260
|
+
missingIds: string[];
|
|
2260
2261
|
};
|
|
2261
2262
|
meta: any;
|
|
2262
2263
|
}>;
|
|
@@ -2665,6 +2666,7 @@ export declare const createTRPCClient: (opts: CreateTrpcClientOptions) => import
|
|
|
2665
2666
|
nameKey: string | null;
|
|
2666
2667
|
}[];
|
|
2667
2668
|
})[];
|
|
2669
|
+
missingIds: string[];
|
|
2668
2670
|
};
|
|
2669
2671
|
meta: any;
|
|
2670
2672
|
}>;
|
|
@@ -8632,6 +8634,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
|
|
|
8632
8634
|
sizeEncrypted: bigint;
|
|
8633
8635
|
};
|
|
8634
8636
|
})[];
|
|
8637
|
+
missingIds: string[];
|
|
8635
8638
|
};
|
|
8636
8639
|
meta: any;
|
|
8637
8640
|
}>;
|
|
@@ -9040,6 +9043,7 @@ export declare const getTrpcGuestClient: ({ url }?: {
|
|
|
9040
9043
|
nameKey: string | null;
|
|
9041
9044
|
}[];
|
|
9042
9045
|
})[];
|
|
9046
|
+
missingIds: string[];
|
|
9043
9047
|
};
|
|
9044
9048
|
meta: any;
|
|
9045
9049
|
}>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@secrecy/lib",
|
|
3
3
|
"author": "Anonymize <anonymize@gmail.com>",
|
|
4
4
|
"description": "Anonymize Secrecy Library",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.83.1",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@js-temporal/polyfill": "^0.5.1",
|
|
79
|
-
"@secrecy/trpc-api-types": "1.
|
|
79
|
+
"@secrecy/trpc-api-types": "1.38.0",
|
|
80
80
|
"@trpc/client": "11.6.0",
|
|
81
81
|
"@trpc/server": "^11.6.0",
|
|
82
82
|
"@types/libsodium-wrappers-sumo": "^0.7.8",
|