@moneypot/hub 1.14.2 → 1.14.3
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.
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { inhibitOnNull
|
|
3
|
-
import { gql,
|
|
4
|
-
|
|
5
|
-
export const HubPreimageHashFieldPlugin = makeExtendSchemaPlugin((build) => {
|
|
1
|
+
import { loadOneWithPgClient, } from "postgraphile/@dataplan/pg";
|
|
2
|
+
import { inhibitOnNull } from "postgraphile/grafast";
|
|
3
|
+
import { gql, extendSchema } from "postgraphile/utils";
|
|
4
|
+
export const HubPreimageHashFieldPlugin = extendSchema((build) => {
|
|
6
5
|
const hashTable = build.input.pgRegistry.pgResources.hub_hash;
|
|
7
6
|
return {
|
|
8
7
|
typeDefs: gql `
|
|
@@ -14,19 +13,20 @@ export const HubPreimageHashFieldPlugin = makeExtendSchemaPlugin((build) => {
|
|
|
14
13
|
HubHashChain: {
|
|
15
14
|
plans: {
|
|
16
15
|
preimageHash: ($record) => {
|
|
17
|
-
const $preimageHashId =
|
|
18
|
-
const
|
|
19
|
-
.query({
|
|
16
|
+
const $preimageHashId = loadOneWithPgClient(hashTable.executor, $record.get("id"), async (pgClient, hashChainIds) => {
|
|
17
|
+
const { rows } = await pgClient.query({
|
|
20
18
|
text: `
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
values: [
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
return
|
|
19
|
+
select id, hash_chain_id
|
|
20
|
+
from hub.hash
|
|
21
|
+
where hash_chain_id = ANY($1)
|
|
22
|
+
and kind = 'PREIMAGE'
|
|
23
|
+
`,
|
|
24
|
+
values: [hashChainIds],
|
|
25
|
+
});
|
|
26
|
+
const lookup = new Map(rows.map((row) => [row.hash_chain_id, row.id]));
|
|
27
|
+
return hashChainIds.map((hashChainId) => {
|
|
28
|
+
return lookup.get(hashChainId) ?? null;
|
|
29
|
+
});
|
|
30
30
|
});
|
|
31
31
|
return hashTable.get({ id: inhibitOnNull($preimageHashId) });
|
|
32
32
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneypot/hub",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.3",
|
|
4
4
|
"author": "moneypot.com",
|
|
5
5
|
"homepage": "https://moneypot.com/hub",
|
|
6
6
|
"keywords": [
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"pg": "^8.12.0",
|
|
60
60
|
"pg-connection-string": "^2.6.4",
|
|
61
61
|
"pino": "^9.7.0",
|
|
62
|
-
"postgraphile": "^5.0.0-beta.
|
|
62
|
+
"postgraphile": "^5.0.0-beta.48",
|
|
63
63
|
"tsafe": "^1.6.6",
|
|
64
64
|
"yup": "^1.6.1",
|
|
65
65
|
"zod": "^3.23.5"
|