laconic-sdk/package.json
Thomas E Lackey b5fce86d48 Add new record types ApplicationRecord, WebAppDeploymentRecord, GeneralRecord (#44)
See also: cerc-io/laconicd#113

![image](/attachments/db05bbb6-86ca-4fbb-a8a4-fcd06501b1b1)

```
message ApplicationRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string homepage       = 5 [(gogoproto.moretags) = "json:\"homepage\" yaml:\"homepage\""];
  string license        = 6 [(gogoproto.moretags) = "json:\"license\" yaml:\"license\""];
  string author         = 7 [(gogoproto.moretags) = "json:\"author\" yaml:\"author\""];
  string repository     = 8 [(gogoproto.moretags) = "json:\"repository\" yaml:\"repository\""];
  string repository_tag = 9 [(gogoproto.moretags) = "json:\"repositoryTag\" yaml:\"repositoryTag\""];
  string app_version    = 10 [(gogoproto.moretags) = "json:\"appVersion\" yaml:\"appVersion\""];
  string app_type       = 11 [(gogoproto.moretags) = "json:\"appType\" yaml:\"appType\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

message WebAppDeploymentRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string application    = 5 [(gogoproto.moretags) = "json:\"application\" yaml:\"application\""];
  string url            = 6 [(gogoproto.moretags) = "json:\"\" yaml:\"name\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
}

message GeneralRecord {
  string type           = 1 [(gogoproto.moretags) = "json:\"type\" yaml:\"type\""];
  string name           = 2 [(gogoproto.moretags) = "json:\"name\" yaml:\"name\""];
  string description    = 3 [(gogoproto.moretags) = "json:\"description\" yaml:\"description\""];
  string version        = 4 [(gogoproto.moretags) = "json:\"version\" yaml:\"version\""];
  string category       = 5 [(gogoproto.moretags) = "json:\"category\" yaml:\"category\""];
  string value          = 6 [(gogoproto.moretags) = "json:\"value\" yaml:\"value\""];
  string meta           = 20 [(gogoproto.moretags) = "json:\"meta\" yaml:\"meta\""];
  repeated string tags  = 21 [(gogoproto.moretags) = "json:\"tags\" yaml:\"tags\""];
```

```
❯ cat general.yml
record:
  type: GeneralRecord
  name: my-generic-record
  version: 0.0.1
  value: "anything-goes-here"
  category: filter-by-this
  tags:
    - a
    - b
    - c
  meta:
    foo: bar
    bar:
      baz: boz

❯ bin/laconic cns record publish --filename general.yml --bond-id ba774084e25af5b29be126dda0bb910d93dea3634713a438ac257da5bbdc631c
{
  "id": "bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q"
}

❯ bin/laconic cns record get --id bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q
[
  {
    "id": "bafyreigt3he52eia5g4i5pnst4dfcuwwgjdoul6xmcke2obz5os4xwoo3q",
    "names": null,
    "owners": [
      "9A66500A9AA574CAAB4EDB26F7333590BF452CE0"
    ],
    "bondId": "ba774084e25af5b29be126dda0bb910d93dea3634713a438ac257da5bbdc631c",
    "createTime": "2023-11-17T23:11:27Z",
    "expiryTime": "2024-11-16T23:11:27Z",
    "attributes": {
      "meta": "{\"foo\":\"bar\",\"bar\":{\"baz\":\"boz\"}}",
      "tags": [
        "a",
        "b",
        "c"
      ],
      "type": "GeneralRecord",
      "name": "my-generic-record",
      "version": "0.0.1",
      "category": "filter-by-this",
      "value": "anything-goes-here"
    }
  }
]
```

> Note: The repeated items are preserved as lists, but the object/map ends up encoded as a string.  It would be nice to avoid this.

Reviewed-on: cerc-io/laconic-sdk#44
Reviewed-by: David Boreham <dboreham@noreply.git.vdb.to>
Co-authored-by: Thomas E Lackey <telackey@bozemanpass.com>
Co-committed-by: Thomas E Lackey <telackey@bozemanpass.com>
2023-11-20 22:01:19 +00:00

57 lines
1.6 KiB
JSON

{
"name": "@cerc-io/laconic-sdk",
"version": "0.1.6",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "git@github.com:cerc-io/laconic-sdk.git",
"author": "",
"license": "UNLICENSED",
"devDependencies": {
"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.181",
"@types/semver": "^7.3.9",
"@types/tiny-secp256k1": "1.0.0",
"dotenv": "^16.0.0",
"google-protobuf": "^3.21.0",
"jest": "29.0.0",
"protoc-gen-ts": "^0.8.7",
"ts-jest": "^29.0.2",
"typescript": "^4.6.2"
},
"dependencies": {
"@cosmjs/amino": "^0.28.1",
"@cosmjs/crypto": "^0.28.1",
"@cosmjs/encoding": "^0.28.1",
"@ipld/dag-cbor": "^7.0.1",
"@ipld/dag-json": "^8.0.9",
"@metamask/eth-sig-util": "^4.0.0",
"@tharsis/address-converter": "^0.1.7",
"@tharsis/eip712": "^0.2.1",
"@tharsis/proto": "^0.1.16",
"@tharsis/provider": "^0.2.4",
"@tharsis/transactions": "^0.2.2",
"axios": "^0.26.1",
"bip32": "3.0.1",
"bip39": "^3.0.4",
"canonical-json": "^0.0.4",
"ethers": "^5.6.2",
"evmosjs": "^0.2.5",
"graphql.js": "^0.6.8",
"js-sha256": "^0.9.0",
"js-yaml": "^3.14.1",
"jsonschema": "^1.4.0",
"lodash": "^4.17.21",
"multiformats": "^9.5.4",
"node-yaml": "^4.0.1",
"secp256k1": "^4.0.1",
"semver": "^7.3.5",
"tiny-secp256k1": "^1.1.6"
},
"scripts": {
"test": "jest --runInBand --verbose",
"test:auctions": "TEST_AUCTIONS_ENABLED=1 jest --runInBand --verbose src/auction.test.ts",
"test:nameservice-expiry": "TEST_NAMESERVICE_EXPIRY=1 jest --runInBand --verbose src/nameservice-expiry.test.ts",
"build": "tsc"
}
}