@powerhousedao/renown-package 1.3.7 → 1.3.8

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 +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;IAwGV,YAAY;CACnB"}
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
- // Try resultingState first, fall back to action input
30
- const stateStr = operation.resultingState ?? context.resultingState;
31
- const state = stateStr
32
- ? JSON.parse(stateStr)
33
- : operation.action.input;
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();
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.7",
4
+ "version": "1.3.8",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
7
7
  "type": "git",