@powerhousedao/renown-package 1.3.6 → 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;IAqGV,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,12 +26,16 @@ export class RenownCredentialProcessor extends RelationalDbProcessor {
26
26
  .executeTakeFirst();
27
27
  switch (operation.action.type) {
28
28
  case "INIT": {
29
- // resultingState contains the full document state after this operation
30
- const stateStr = operation.resultingState ?? context.resultingState;
31
- const state = stateStr
32
- ? JSON.parse(stateStr)
33
- : undefined;
34
- if (state && !existingCredential) {
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
+ })();
38
+ if (state) {
35
39
  await this.relationalDb
36
40
  .insertInto("renown_credential")
37
41
  .values({
@@ -73,6 +77,22 @@ export class RenownCredentialProcessor extends RelationalDbProcessor {
73
77
  created_at: new Date(),
74
78
  updated_at: new Date(),
75
79
  })
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 || "",
94
+ updated_at: new Date(),
95
+ }))
76
96
  .execute();
77
97
  }
78
98
  break;
@@ -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;AAEpE,wBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAsF9D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BhE"}
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;AAEpE,wBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAqF9D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BhE"}
@@ -1,5 +1,4 @@
1
1
  export async function up(db) {
2
- await down(db);
3
2
  // Create renown_credential table with EIP-712 signed credential schema
4
3
  await db.schema
5
4
  .createTable("renown_credential")
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/renown-user/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,qBAAa,mBAAoB,SAAQ,qBAAqB,CAAC,EAAE,CAAC;WAChD,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;IA8EV,YAAY;CACnB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../processors/renown-user/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,aAAa,CAAC;AAEtC,qBAAa,mBAAoB,SAAQ,qBAAqB,CAAC,EAAE,CAAC;WAChD,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;IA+EV,YAAY;CACnB"}
@@ -31,6 +31,7 @@ export class RenownUserProcessor extends RelationalDbProcessor {
31
31
  created_at: new Date(),
32
32
  updated_at: new Date(),
33
33
  })
34
+ .onConflict((oc) => oc.column("document_id").doNothing())
34
35
  .execute();
35
36
  }
36
37
  const updateData = {
@@ -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;AAEpE,wBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B9D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhE"}
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;AAEpE,wBAAsB,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B9D;AAED,wBAAsB,IAAI,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAOhE"}
@@ -1,5 +1,4 @@
1
1
  export async function up(db) {
2
- await down(db);
3
2
  // Create renown_user table
4
3
  await db.schema
5
4
  .createTable("renown_user")
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.6",
4
+ "version": "1.3.8",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
7
7
  "type": "git",