Handle record attributes with null values #56

Merged
ashwin merged 2 commits from deep-stack/laconic-sdk:pm-handle-null into main 2024-02-08 05:39:32 +00:00
Member
Part of https://git.vdb.to/cerc-io/laconicd/issues/144
prathamesh added 2 commits 2024-02-08 05:16:20 +00:00
Update package version
All checks were successful
Tests / sdk_tests (pull_request) Successful in 19m50s
28823c64cb
Author
Member

Console output after publishing a malformed record (cerc-io/laconicd#144 (comment)):

Before these changes:
Screenshot from 2024-02-08 09-25-45

After these changes:
Screenshot from 2024-02-08 10-57-59

Similarly for laconic-registry-cli:

Before these changes:

➜  laconic-registry-cli git:(c3f8d53) ✗ laconic cns record list
laconic cns record list

List records.

Options:
      --version   Show version number                                  [boolean]
...

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Util.fromGQLValue (/home/prathamesh/.config/yarn/global/node_modules/@cerc-io/laconic-registry-cli/node_modules/@cerc-io/laconic-sdk/dist/util.js:116:32)
    at /home/prathamesh/.config/yarn/global/node_modules/@cerc-io/laconic-registry-cli/node_modules/@cerc-io/laconic-sdk/dist/util.js:110:34
...

After these changes:

➜  laconic-registry-cli git:(c3f8d53) ✗ ./bin/laconic cns record list
[
  {
    "id": "bafyreidst46ge7swsb3uh5k75qpfrqz7v2wryuvvozv26pijjlr4nyefdm",
    "names": null,
    "owners": [
      "35357FBEBF6BAC5BFB8F7C7224BED9E07FA51E0A"
    ],
    "bondId": "fc0b4d901c612995dafc824417dbf1c4dcbefd1d6ee2fa167b899fd409021cd5",
    "createTime": "2024-02-08T03:48:20Z",
    "expiryTime": "2025-02-07T03:48:20Z",
    "attributes": {
      "build_artifact_cid": "QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9",
      "repo_registration_record_cid": "QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D",
      "tls_cert_cid": "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR",
      "type": "WebsiteRegistrationRecord",
      "url": "https://cerc.io",
      "version": "1.0.35"
    }
  },
  {
    "id": "bafyreie6kxqoptpjf5535zzeu3fcknd7a4lizdjuezbtr44rxg3sgxlpxu",
    "names": null,
    "owners": [
      "35357FBEBF6BAC5BFB8F7C7224BED9E07FA51E0A"
    ],
    "bondId": "fc0b4d901c612995dafc824417dbf1c4dcbefd1d6ee2fa167b899fd409021cd5",
    "createTime": "2024-02-08T03:50:21Z",
    "expiryTime": "2025-02-07T03:50:21Z",
    "attributes": {
      "category": "birbit",
      "meta": null,
      "name": "image-registration-record",
      "tags": [
        "golden",
        "pheasant",
        "trespassing"
      ],
      "type": "GeneralRecord",
      "value": "cute-rare-animal",
      "version": "0.0.2"
    }
  }
]
Console output after publishing a malformed record (https://git.vdb.to/cerc-io/laconicd/issues/144#issuecomment-5189): Before these changes: ![Screenshot from 2024-02-08 09-25-45](/attachments/8c22b9c4-24f4-493f-b12d-0472edd30ffe) After these changes: ![Screenshot from 2024-02-08 10-57-59](/attachments/11d37f50-efa4-4786-af31-8931ef337c75) Similarly for `laconic-registry-cli`: Before these changes: ```bash ➜ laconic-registry-cli git:(c3f8d53) ✗ laconic cns record list laconic cns record list List records. Options: --version Show version number [boolean] ... TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at Util.fromGQLValue (/home/prathamesh/.config/yarn/global/node_modules/@cerc-io/laconic-registry-cli/node_modules/@cerc-io/laconic-sdk/dist/util.js:116:32) at /home/prathamesh/.config/yarn/global/node_modules/@cerc-io/laconic-registry-cli/node_modules/@cerc-io/laconic-sdk/dist/util.js:110:34 ... ``` After these changes: ```bash ➜ laconic-registry-cli git:(c3f8d53) ✗ ./bin/laconic cns record list [ { "id": "bafyreidst46ge7swsb3uh5k75qpfrqz7v2wryuvvozv26pijjlr4nyefdm", "names": null, "owners": [ "35357FBEBF6BAC5BFB8F7C7224BED9E07FA51E0A" ], "bondId": "fc0b4d901c612995dafc824417dbf1c4dcbefd1d6ee2fa167b899fd409021cd5", "createTime": "2024-02-08T03:48:20Z", "expiryTime": "2025-02-07T03:48:20Z", "attributes": { "build_artifact_cid": "QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9", "repo_registration_record_cid": "QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D", "tls_cert_cid": "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR", "type": "WebsiteRegistrationRecord", "url": "https://cerc.io", "version": "1.0.35" } }, { "id": "bafyreie6kxqoptpjf5535zzeu3fcknd7a4lizdjuezbtr44rxg3sgxlpxu", "names": null, "owners": [ "35357FBEBF6BAC5BFB8F7C7224BED9E07FA51E0A" ], "bondId": "fc0b4d901c612995dafc824417dbf1c4dcbefd1d6ee2fa167b899fd409021cd5", "createTime": "2024-02-08T03:50:21Z", "expiryTime": "2025-02-07T03:50:21Z", "attributes": { "category": "birbit", "meta": null, "name": "image-registration-record", "tags": [ "golden", "pheasant", "trespassing" ], "type": "GeneralRecord", "value": "cute-rare-animal", "version": "0.0.2" } } ] ```
prathamesh changed title from [WIP] Handle record attributes with null values to Handle record attributes with null values 2024-02-08 05:38:12 +00:00
ashwin merged commit 73bef00dd3 into main 2024-02-08 05:39:32 +00:00
ashwin deleted branch pm-handle-null 2024-02-08 05:39:33 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/laconic-sdk#56
No description provided.