Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Simpler core library plus path to deprecation #464

Merged
merged 8 commits into from
Aug 5, 2020

Conversation

carsonfarmer
Copy link
Member

Description

This is a relatively large PR that does a few important things as a precursor to #414, while also simplifying our threads-core library for external consumption. In general, this is mostly just a plumbing PR. In particular it:

  • Pulls the Block API out of core and moves it into encoding
  • Updates CID library throughout (but keeps us below the 1.0 release)
  • Stops publishing database, network-client, network, store, but leaves the rest, including encoding
  • Other cleanup and fixes

First step towards #415, #427

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

All existing tests pass locally, and in some cases, imports have been updated.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

This PR template comes from https://github.com/embeddedartistry/templates

@carsonfarmer carsonfarmer added bug Something isn't working enhancement New feature or request dependencies Pull requests that update a dependency file chore Things that need doing labels Aug 5, 2020
@carsonfarmer carsonfarmer added this to the Sprint 42 milestone Aug 5, 2020
@carsonfarmer carsonfarmer self-assigned this Aug 5, 2020
"rimraf": "^3.0.0",
"typescript": "^3.7.2"
},
"dependencies": {
"@ipld/block": "^6.0.1",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plus this out of core, should be much easier to consume core externally now.

@@ -1,8 +1,6 @@
import { keys, PrivateKey, PublicKey } from "@textile/threads-crypto"

export * from "./identity"
export { Block } from "./ipld"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't export this anymore, so if used elsewhere, they'll have to be updated.

@@ -1,48 +0,0 @@
import CID from "cids"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the following interfaces have been moved to encoding. They are no longer needed here, and relied to some degree on the Block API being in core, which it no longer is.

@@ -1,4 +1,4 @@
import { Multiaddr } from "@textile/multiaddr"
import type { Multiaddr } from "@textile/multiaddr"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just safer to do this when we can.

"publishConfig": {
"access": "public"
},
"private": true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

database will no longer be published when we do a lerna publish. It shoud already be deprecated on npm, so this is just saving us the hassle of deprecating new versions.

@@ -56,18 +50,23 @@ export async function createRecord(
config: CreateRecordConfig
): Promise<LogRecord> {
logger.debug("creating record")
const block = await data.value.cid()
let payload = block.buffer
const block = (await data.value.cid()) as any
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some hacky stuff to work around potential future issue with some CID updates coming down the line.

"publishConfig": {
"access": "public"
},
"private": true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't publish this one either.

@@ -389,7 +391,7 @@ export class Client implements Network {
if (info.key === undefined) throw new Error("Missing thread keys")
const req = new pb.GetRecordRequest()
req.setThreadid(id.toBytes())
req.setRecordid(rec.buffer)
req.setRecordid(rec.buffer ?? (rec as any).bytes)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another hack

"publishConfig": {
"access": "public"
},
"private": true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one too.

"publishConfig": {
"access": "public"
},
"private": true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And finally, we don't need store externally anymore either.

@carsonfarmer carsonfarmer merged commit ff8eece into master Aug 5, 2020
@carsonfarmer carsonfarmer deleted the carson/simpler-core branch August 5, 2020 23:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working chore Things that need doing dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants