@powerhousedao/renown-package 1.3.7 → 1.3.9
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/processors/renown-credential/index.d.ts.map +1 -1
- package/dist/processors/renown-credential/index.js +22 -5
- package/dist/processors/renown-credential/migrations.d.ts.map +1 -1
- package/dist/processors/renown-credential/migrations.js +31 -12
- package/dist/processors/renown-user/migrations.d.ts.map +1 -1
- package/dist/processors/renown-user/migrations.js +15 -3
- package/dist/style.css +32 -0
- package/dist/subgraphs/renown-read-model/resolvers.d.ts.map +1 -1
- package/dist/subgraphs/renown-read-model/resolvers.js +18 -4
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/renown-credential/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAMtC,MAAM,WAAW,QAAQ;IACvB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD;AAED,qBAAa,yBAA0B,SAAQ,qBAAqB,CAAC,EAAE,CAAC;IACtE,OAAO,CAAC,OAAO,CAAC,CAAW;gBAGzB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,eAAe,EACvB,YAAY,EAAE,aAAa,CAAC,EAAE,CAAC,EAC/B,OAAO,CAAC,EAAE,QAAQ;WAMJ,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAItC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY,CACzB,UAAU,EAAE,oBAAoB,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/renown-credential/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAMtC,MAAM,WAAW,QAAQ;IACvB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD;AAED,qBAAa,yBAA0B,SAAQ,qBAAqB,CAAC,EAAE,CAAC;IACtE,OAAO,CAAC,OAAO,CAAC,CAAW;gBAGzB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,eAAe,EACvB,YAAY,EAAE,aAAa,CAAC,EAAE,CAAC,EAC/B,OAAO,CAAC,EAAE,QAAQ;WAMJ,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAItC,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,YAAY,CACzB,UAAU,EAAE,oBAAoB,EAAE,GACjC,OAAO,CAAC,IAAI,CAAC;IAyHV,YAAY;CACnB"}
|
|
@@ -26,11 +26,15 @@ export class RenownCredentialProcessor extends RelationalDbProcessor {
|
|
|
26
26
|
.executeTakeFirst();
|
|
27
27
|
switch (operation.action.type) {
|
|
28
28
|
case "INIT": {
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
// Prefer action.input (the actual INIT payload) over resultingState
|
|
30
|
+
// which may be the empty initial state from UPGRADE_DOCUMENT
|
|
31
|
+
const input = operation.action.input;
|
|
32
|
+
const state = (input?.id || input?.issuer)
|
|
33
|
+
? input
|
|
34
|
+
: (() => {
|
|
35
|
+
const stateStr = operation.resultingState ?? context.resultingState;
|
|
36
|
+
return stateStr ? JSON.parse(stateStr) : undefined;
|
|
37
|
+
})();
|
|
34
38
|
if (state) {
|
|
35
39
|
await this.relationalDb
|
|
36
40
|
.insertInto("renown_credential")
|
|
@@ -74,6 +78,19 @@ export class RenownCredentialProcessor extends RelationalDbProcessor {
|
|
|
74
78
|
updated_at: new Date(),
|
|
75
79
|
})
|
|
76
80
|
.onConflict((oc) => oc.column("document_id").doUpdateSet({
|
|
81
|
+
context: state.context ? JSON.stringify(state.context) : "[]",
|
|
82
|
+
credential_id: state.id || "",
|
|
83
|
+
type: state.type ? JSON.stringify(state.type) : "[]",
|
|
84
|
+
issuer_id: state.issuer?.id || "",
|
|
85
|
+
issuer_ethereum_address: state.issuer?.ethereumAddress || "",
|
|
86
|
+
credential_subject_id: state.credentialSubject?.id || null,
|
|
87
|
+
credential_subject_app: state.credentialSubject?.app || "",
|
|
88
|
+
proof_verification_method: state.proof?.verificationMethod || "",
|
|
89
|
+
proof_ethereum_address: state.proof?.ethereumAddress || "",
|
|
90
|
+
proof_type: state.proof?.type || "",
|
|
91
|
+
proof_value: state.proof?.proofValue || "",
|
|
92
|
+
proof_eip712_domain: state.proof?.eip712?.domain ? JSON.stringify(state.proof.eip712.domain) : "{}",
|
|
93
|
+
proof_eip712_primary_type: state.proof?.eip712?.primaryType || "",
|
|
77
94
|
updated_at: new Date(),
|
|
78
95
|
}))
|
|
79
96
|
.execute();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../processors/renown-credential/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../processors/renown-credential/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAGpE,wBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAgG9D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAqChE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sql } from "kysely";
|
|
1
2
|
export async function up(db) {
|
|
2
3
|
// Create renown_credential table with EIP-712 signed credential schema
|
|
3
4
|
await db.schema
|
|
@@ -49,37 +50,55 @@ export async function up(db) {
|
|
|
49
50
|
.column("issuer_id")
|
|
50
51
|
.ifNotExists()
|
|
51
52
|
.execute();
|
|
52
|
-
// Create index on
|
|
53
|
+
// Create index on credential_subject_app for faster lookups
|
|
53
54
|
await db.schema
|
|
54
|
-
.createIndex("
|
|
55
|
+
.createIndex("idx_renown_credential_subject_app")
|
|
55
56
|
.on("renown_credential")
|
|
56
|
-
.column("
|
|
57
|
+
.column("credential_subject_app")
|
|
57
58
|
.ifNotExists()
|
|
58
59
|
.execute();
|
|
59
|
-
// Create index on
|
|
60
|
+
// Create index on revoked for faster validity checks
|
|
60
61
|
await db.schema
|
|
61
|
-
.createIndex("
|
|
62
|
+
.createIndex("idx_renown_credential_revoked")
|
|
62
63
|
.on("renown_credential")
|
|
63
|
-
.column("
|
|
64
|
+
.column("revoked")
|
|
64
65
|
.ifNotExists()
|
|
65
66
|
.execute();
|
|
66
|
-
//
|
|
67
|
+
// Expression indexes matching the resolver's LOWER(address) filters; plain
|
|
68
|
+
// column indexes can't serve them, so without these the lookup seq-scans.
|
|
67
69
|
await db.schema
|
|
68
|
-
.createIndex("
|
|
70
|
+
.createIndex("idx_renown_credential_issuer_eth_lower")
|
|
69
71
|
.on("renown_credential")
|
|
70
|
-
.
|
|
72
|
+
.expression(sql `LOWER(issuer_ethereum_address)`)
|
|
71
73
|
.ifNotExists()
|
|
72
74
|
.execute();
|
|
73
|
-
// Create index on revoked for faster validity checks
|
|
74
75
|
await db.schema
|
|
75
|
-
.createIndex("
|
|
76
|
+
.createIndex("idx_renown_credential_proof_eth_lower")
|
|
76
77
|
.on("renown_credential")
|
|
77
|
-
.
|
|
78
|
+
.expression(sql `LOWER(proof_ethereum_address)`)
|
|
78
79
|
.ifNotExists()
|
|
79
80
|
.execute();
|
|
81
|
+
// Drop plain-column address indexes superseded by the LOWER() ones above;
|
|
82
|
+
// resolvers filter these columns only via LOWER, so the raw indexes are unused.
|
|
83
|
+
await db.schema
|
|
84
|
+
.dropIndex("idx_renown_credential_issuer_eth")
|
|
85
|
+
.ifExists()
|
|
86
|
+
.execute();
|
|
87
|
+
await db.schema
|
|
88
|
+
.dropIndex("idx_renown_credential_proof_eth")
|
|
89
|
+
.ifExists()
|
|
90
|
+
.execute();
|
|
80
91
|
}
|
|
81
92
|
export async function down(db) {
|
|
82
93
|
// Drop renown_credential indexes
|
|
94
|
+
await db.schema
|
|
95
|
+
.dropIndex("idx_renown_credential_proof_eth_lower")
|
|
96
|
+
.ifExists()
|
|
97
|
+
.execute();
|
|
98
|
+
await db.schema
|
|
99
|
+
.dropIndex("idx_renown_credential_issuer_eth_lower")
|
|
100
|
+
.ifExists()
|
|
101
|
+
.execute();
|
|
83
102
|
await db.schema
|
|
84
103
|
.dropIndex("idx_renown_credential_revoked")
|
|
85
104
|
.ifExists()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../processors/renown-user/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../processors/renown-user/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAGpE,wBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC9D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAWhE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sql } from "kysely";
|
|
1
2
|
export async function up(db) {
|
|
2
3
|
// Create renown_user table
|
|
3
4
|
await db.schema
|
|
@@ -18,16 +19,27 @@ export async function up(db) {
|
|
|
18
19
|
.column("username")
|
|
19
20
|
.ifNotExists()
|
|
20
21
|
.execute();
|
|
21
|
-
//
|
|
22
|
+
// Expression index matching the resolver's LOWER(eth_address) lookup so the
|
|
23
|
+
// case-insensitive match stays an index scan.
|
|
22
24
|
await db.schema
|
|
23
|
-
.createIndex("
|
|
25
|
+
.createIndex("idx_renown_user_eth_address_lower")
|
|
24
26
|
.on("renown_user")
|
|
25
|
-
.
|
|
27
|
+
.expression(sql `LOWER(eth_address)`)
|
|
26
28
|
.ifNotExists()
|
|
27
29
|
.execute();
|
|
30
|
+
// Drop the plain-column eth_address index superseded by the LOWER() one above;
|
|
31
|
+
// resolvers filter eth_address only via LOWER, so the raw index is unused.
|
|
32
|
+
await db.schema
|
|
33
|
+
.dropIndex("idx_renown_user_eth_address")
|
|
34
|
+
.ifExists()
|
|
35
|
+
.execute();
|
|
28
36
|
}
|
|
29
37
|
export async function down(db) {
|
|
30
38
|
// Drop renown_user indexes
|
|
39
|
+
await db.schema
|
|
40
|
+
.dropIndex("idx_renown_user_eth_address_lower")
|
|
41
|
+
.ifExists()
|
|
42
|
+
.execute();
|
|
31
43
|
await db.schema.dropIndex("idx_renown_user_eth_address").ifExists().execute();
|
|
32
44
|
await db.schema.dropIndex("idx_renown_user_username").ifExists().execute();
|
|
33
45
|
// Drop renown_user table with CASCADE to drop dependent objects
|
package/dist/style.css
CHANGED
|
@@ -559,12 +559,19 @@
|
|
|
559
559
|
.text-yellow-800 {
|
|
560
560
|
color: var(--color-yellow-800);
|
|
561
561
|
}
|
|
562
|
+
.lowercase {
|
|
563
|
+
text-transform: lowercase;
|
|
564
|
+
}
|
|
562
565
|
.uppercase {
|
|
563
566
|
text-transform: uppercase;
|
|
564
567
|
}
|
|
565
568
|
.italic {
|
|
566
569
|
font-style: italic;
|
|
567
570
|
}
|
|
571
|
+
.ordinal {
|
|
572
|
+
--tw-ordinal: ordinal;
|
|
573
|
+
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
|
|
574
|
+
}
|
|
568
575
|
.shadow-md {
|
|
569
576
|
--tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / 0.1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / 0.1));
|
|
570
577
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -640,6 +647,26 @@
|
|
|
640
647
|
syntax: "*";
|
|
641
648
|
inherits: false;
|
|
642
649
|
}
|
|
650
|
+
@property --tw-ordinal {
|
|
651
|
+
syntax: "*";
|
|
652
|
+
inherits: false;
|
|
653
|
+
}
|
|
654
|
+
@property --tw-slashed-zero {
|
|
655
|
+
syntax: "*";
|
|
656
|
+
inherits: false;
|
|
657
|
+
}
|
|
658
|
+
@property --tw-numeric-figure {
|
|
659
|
+
syntax: "*";
|
|
660
|
+
inherits: false;
|
|
661
|
+
}
|
|
662
|
+
@property --tw-numeric-spacing {
|
|
663
|
+
syntax: "*";
|
|
664
|
+
inherits: false;
|
|
665
|
+
}
|
|
666
|
+
@property --tw-numeric-fraction {
|
|
667
|
+
syntax: "*";
|
|
668
|
+
inherits: false;
|
|
669
|
+
}
|
|
643
670
|
@property --tw-shadow {
|
|
644
671
|
syntax: "*";
|
|
645
672
|
inherits: false;
|
|
@@ -766,6 +793,11 @@
|
|
|
766
793
|
--tw-border-style: solid;
|
|
767
794
|
--tw-font-weight: initial;
|
|
768
795
|
--tw-tracking: initial;
|
|
796
|
+
--tw-ordinal: initial;
|
|
797
|
+
--tw-slashed-zero: initial;
|
|
798
|
+
--tw-numeric-figure: initial;
|
|
799
|
+
--tw-numeric-spacing: initial;
|
|
800
|
+
--tw-numeric-fraction: initial;
|
|
769
801
|
--tw-shadow: 0 0 #0000;
|
|
770
802
|
--tw-shadow-color: initial;
|
|
771
803
|
--tw-shadow-alpha: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/renown-read-model/resolvers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAwJ5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../../../subgraphs/renown-read-model/resolvers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAwJ5D,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CA6KxE,CAAC"}
|
|
@@ -56,7 +56,10 @@ export const getResolvers = (subgraph) => {
|
|
|
56
56
|
query = query.where("renown_user.document_id", "=", phid);
|
|
57
57
|
}
|
|
58
58
|
else if (ethAddress) {
|
|
59
|
-
|
|
59
|
+
// Match case-insensitively so clients that send checksummed or
|
|
60
|
+
// lowercase addresses resolve to the same user.
|
|
61
|
+
const addr = ethAddress.toLowerCase();
|
|
62
|
+
query = query.where((eb) => eb(eb.fn("LOWER", ["renown_user.eth_address"]), "=", addr));
|
|
60
63
|
}
|
|
61
64
|
else if (username) {
|
|
62
65
|
query = query.where("renown_user.username", "=", username);
|
|
@@ -64,7 +67,13 @@ export const getResolvers = (subgraph) => {
|
|
|
64
67
|
else {
|
|
65
68
|
throw new Error("At least one of phid, ethAddress, or username must be provided");
|
|
66
69
|
}
|
|
67
|
-
|
|
70
|
+
// Deterministic order (newest first) so a stable, current row is
|
|
71
|
+
// returned even if duplicate documents exist for the same address.
|
|
72
|
+
const result = await query
|
|
73
|
+
.selectAll()
|
|
74
|
+
.orderBy("renown_user.created_at", "desc")
|
|
75
|
+
.orderBy("renown_user.document_id", "desc")
|
|
76
|
+
.executeTakeFirst();
|
|
68
77
|
return result ? mapToUser(result) : null;
|
|
69
78
|
},
|
|
70
79
|
renownUsers: async (parent, args) => {
|
|
@@ -82,14 +91,19 @@ export const getResolvers = (subgraph) => {
|
|
|
82
91
|
conditions.push(eb("renown_user.document_id", "in", phids));
|
|
83
92
|
}
|
|
84
93
|
if (hasEthAddresses) {
|
|
85
|
-
|
|
94
|
+
// Match case-insensitively (see renownUser above).
|
|
95
|
+
conditions.push(eb(eb.fn("LOWER", ["renown_user.eth_address"]), "in", ethAddresses.map((a) => a.toLowerCase())));
|
|
86
96
|
}
|
|
87
97
|
if (hasUsernames) {
|
|
88
98
|
conditions.push(eb("renown_user.username", "in", usernames));
|
|
89
99
|
}
|
|
90
100
|
return eb.or(conditions);
|
|
91
101
|
});
|
|
92
|
-
const results = await query
|
|
102
|
+
const results = await query
|
|
103
|
+
.selectAll()
|
|
104
|
+
.orderBy("renown_user.created_at", "desc")
|
|
105
|
+
.orderBy("renown_user.document_id", "desc")
|
|
106
|
+
.execute();
|
|
93
107
|
return results.map(mapToUser);
|
|
94
108
|
},
|
|
95
109
|
renownCredentials: async (parent, args) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/renown-package",
|
|
3
3
|
"description": "Renown document models, editors, and processors for the Powerhouse ecosystem",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.9",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"@powerhousedao/builder-tools": "6.0.1-staging.0",
|
|
101
101
|
"@powerhousedao/common": "6.0.1-staging.0",
|
|
102
102
|
"@powerhousedao/design-system": "6.0.1-staging.0",
|
|
103
|
-
"@powerhousedao/document-engineering": "^1.40.
|
|
103
|
+
"@powerhousedao/document-engineering": "^1.40.5",
|
|
104
104
|
"@powerhousedao/vetra": "6.0.1-staging.0",
|
|
105
105
|
"document-model": "6.0.1-staging.0",
|
|
106
106
|
"graphql": "^16.10.0",
|