From 327caf26e2be5db4fecf9e7ba41d8859c74cd820 Mon Sep 17 00:00:00 2001 From: m0ar Date: Tue, 16 Jan 2024 18:33:32 +0100 Subject: [PATCH] Only take runtime defs as passed to client instantiation functions --- .github/workflows/publish.yml | 2 +- package-lock.json | 1 - packages/lib/package.json | 11 +++++------ packages/lib/src/clients.ts | 11 ++++++----- packages/lib/src/types.ts | 5 +++++ 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cb7ee4c..2056b32 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,6 +15,6 @@ jobs: check-latest: false registry-url: 'https://registry.npmjs.org' - run: npm ci - - run: npm publish + - run: npm --workspace packages/lib publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package-lock.json b/package-lock.json index 8d035bf..9be32af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25832,7 +25832,6 @@ "license": "MIT", "dependencies": { "@composedb/client": "^0.6.0", - "@desci-labs/desci-codex-composedb": "^1.0.0", "dids": "^4.0.4", "gql-query-builder": "^3.8.0", "graphql": "^16.8.0", diff --git a/packages/lib/package.json b/packages/lib/package.json index 56d9ebe..97da15f 100644 --- a/packages/lib/package.json +++ b/packages/lib/package.json @@ -1,6 +1,6 @@ { "name": "@desci-labs/desci-codex-lib", - "version": "1.0.0", + "version": "1.0.1", "description": "Codex interaction primitives", "license": "MIT", "author": "Edvard Hübinette", @@ -19,13 +19,12 @@ "vitest-github-actions-reporter": "^0.10.0" }, "dependencies": { - "@desci-labs/desci-codex-composedb": "^1.0.0", - "uint8arrays": "^4.0.6", + "@composedb/client": "^0.6.0", "dids": "^4.0.4", + "gql-query-builder": "^3.8.0", + "graphql": "^16.8.0", "key-did-provider-ed25519": "^3.0.2", "key-did-resolver": "^3.0.0", - "@composedb/client": "^0.6.0", - "gql-query-builder": "^3.8.0", - "graphql": "^16.8.0" + "uint8arrays": "^4.0.6" } } diff --git a/packages/lib/src/clients.ts b/packages/lib/src/clients.ts index d883614..1c40e84 100644 --- a/packages/lib/src/clients.ts +++ b/packages/lib/src/clients.ts @@ -7,7 +7,7 @@ import { CeramicClient, type CeramicClientConfig, } from "@ceramicnetwork/http-client"; -import { definition } from "@desci-labs/desci-codex-composedb/src/__generated__/definition.js"; +import type { Optional } from "./types.js"; const DEFAULT_LOCAL_CERAMIC = "http://localhost:7007"; @@ -35,8 +35,10 @@ export const newCeramicClient = ( return new CeramicClient(endpoint ?? DEFAULT_LOCAL_CERAMIC, config); }; -export const newComposeClient = (params?: Partial) => { - if (!params?.ceramic) { +export const newComposeClient = ( + params: Optional, +) => { + if (!params.ceramic) { console.log( "[codex] ceramic client not provided; defaulting to", DEFAULT_LOCAL_CERAMIC, @@ -45,8 +47,7 @@ export const newComposeClient = (params?: Partial) => { return new ComposeClient({ ceramic: DEFAULT_LOCAL_CERAMIC, - definition, - // Let passed config overwrite, if present + // Let passed config overwrite ceramic, if present ...params, }); }; diff --git a/packages/lib/src/types.ts b/packages/lib/src/types.ts index 4cd4e75..5e5ce12 100644 --- a/packages/lib/src/types.ts +++ b/packages/lib/src/types.ts @@ -342,3 +342,8 @@ export type UnionKeys = T extends unknown ? keyof T : never; export type DistributiveOmit> = T extends unknown ? Omit> : never; + +/** + * Make one key optional in a record type + */ +export type Optional = Pick, K> & Omit;