Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename polywrap client to client #78

Open
wants to merge 6 commits into
base: origin-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci-javascript.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ jobs:
- name: Examples
run: |
cd examples
yarn
yarn run:logger
yarn run:fs
yarn run:http
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Create a new Polywrap client config builder instance, add the bundles you want t

```typescript
import {
PolywrapClient,
PolywrapClientConfigBuilder
Client,
ClientConfigBuilder
} from "@polywrap/client";

const builder = new PolywrapClientConfigBuilder();
const builder = new ClientConfigBuilder();
builder.addBundle("sys");
const client = new PolywrapClient(builder.build());
const client = new Client(builder.build());

const result = await client.invoke<boolean>({
uri: "wrapscan.io/polywrap/[email protected]",
Expand Down
7 changes: 7 additions & 0 deletions dependencies/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@polywrap/deps",
"private": true,
"dependencies": {
"polywrap": "0.11.4"
}
}
2,056 changes: 2,056 additions & 0 deletions dependencies/yarn.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"name": "polywrap-js-examples",
"private": true,
"version": "0.12.0",
"description": "Polywrap Client JS examples",
"license": "MIT",
"scripts": {
Expand All @@ -11,7 +13,7 @@
"run:ens": "ts-node src/ens.ts"
},
"devDependencies": {
"@polywrap/client-js": "../packages/client",
"@polywrap/client-js": "0.12.2",
"@polywrap/file-system-plugin-js": "0.12.0",
"@polywrap/http-plugin-js": "0.12.0",
"@polywrap/logger-plugin-js": "0.12.0",
Expand Down
8 changes: 4 additions & 4 deletions examples/src/ens.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
PolywrapClient,
PolywrapClientConfigBuilder,
Client,
ClientConfigBuilder,
} from "@polywrap/client-js";
import { Uri } from "@polywrap/core-js";
import {
Expand All @@ -13,7 +13,7 @@ const main = async () => {
const { uri: ethereumWalletUri } = Uri.from(
"wrapscan.io/polywrap/[email protected]"
);
const builder = new PolywrapClientConfigBuilder();
const builder = new ClientConfigBuilder();
builder.addBundle("sys");
const ethereumWalletPackage = ethereumWalletPlugin({
connections: new Connections({
Expand All @@ -26,7 +26,7 @@ const main = async () => {
}),
});
builder.setPackage(ethereumWalletUri, ethereumWalletPackage);
const client = new PolywrapClient(builder.build());
const client = new Client(builder.build());

const resolverAddress = await client.invoke<String>({
uri: "wrapscan.io/polywrap/[email protected]",
Expand Down
8 changes: 4 additions & 4 deletions examples/src/ethereum.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
PolywrapClient,
PolywrapClientConfigBuilder,
Client,
ClientConfigBuilder,
} from "@polywrap/client-js";
import { Uri } from "@polywrap/core-js";
import {
Expand All @@ -17,7 +17,7 @@ const main = async () => {
const { uri: ethereumWalletUri } = Uri.from(
"wrapscan.io/polywrap/[email protected]"
);
const builder = new PolywrapClientConfigBuilder();
const builder = new ClientConfigBuilder();
builder.addBundle("sys");
const ethereumWalletPackage = ethereumWalletPlugin({
connections: new Connections({
Expand All @@ -33,7 +33,7 @@ const main = async () => {
}),
});
builder.setPackage(ethereumWalletUri, ethereumWalletPackage);
const client = new PolywrapClient(builder.build());
const client = new Client(builder.build());

const balance = await client.invoke<String>({
uri: ETHEREUM_CORE_URI,
Expand Down
8 changes: 4 additions & 4 deletions examples/src/filesystem.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
PolywrapClient,
PolywrapClientConfigBuilder,
Client,
ClientConfigBuilder,
} from "@polywrap/client-js";
import { fileSystemPlugin } from "@polywrap/file-system-plugin-js";
import { Uri } from "@polywrap/core-js";

const { uri } = Uri.from("wrapscan.io/polywrap/[email protected]");

const main = async () => {
const builder = new PolywrapClientConfigBuilder();
const builder = new ClientConfigBuilder();
builder.setPackage(uri, fileSystemPlugin({}));
const client = new PolywrapClient(builder.build());
const client = new Client(builder.build());

const filePath = "./fs-example.txt";
const data = "Hello world!";
Expand Down
8 changes: 4 additions & 4 deletions examples/src/http.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
PolywrapClient,
PolywrapClientConfigBuilder,
Client,
ClientConfigBuilder,
} from "@polywrap/client-js";
import { httpPlugin } from "@polywrap/http-plugin-js";
import { Uri } from "@polywrap/core-js";
Expand All @@ -15,9 +15,9 @@ interface Response {
const { uri } = Uri.from("wrapscan.io/polywrap/[email protected]");

const main = async () => {
const builder = new PolywrapClientConfigBuilder();
const builder = new ClientConfigBuilder();
builder.setPackage(uri, httpPlugin({}));
const client = new PolywrapClient(builder.build());
const client = new Client(builder.build());

const getResult = await client.invoke<Response>({
uri,
Expand Down
8 changes: 4 additions & 4 deletions examples/src/ipfs.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
PolywrapClient,
PolywrapClientConfigBuilder,
Client,
ClientConfigBuilder,
} from "@polywrap/client-js";
import { Uri } from "@polywrap/core-js";

const { uri } = Uri.from("wrapscan.io/polywrap/[email protected]");
const ipfsProvider = "http://localhost:5001";

const main = async () => {
const builder = new PolywrapClientConfigBuilder();
const builder = new ClientConfigBuilder();
builder.addBundle("sys");
const client = new PolywrapClient(builder.build());
const client = new Client(builder.build());

const fileName = "hello-world.txt";
const fileData = "Hello world!!!";
Expand Down
8 changes: 4 additions & 4 deletions examples/src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
PolywrapClient,
PolywrapClientConfigBuilder,
Client,
ClientConfigBuilder,
} from "@polywrap/client-js";
import { loggerPlugin } from "@polywrap/logger-plugin-js";
import { Uri } from "@polywrap/core-js";

const main = async () => {
const { uri: pluginPackageUri } = Uri.from("wrapscan.io/polywrap/[email protected]");
const { uri: wrapUri } = Uri.from("wrapscan.io/polywrap/[email protected]");
const builder = new PolywrapClientConfigBuilder();
const builder = new ClientConfigBuilder();
builder.setPackage(pluginPackageUri, loggerPlugin({})).addBundle("sys");
const client = new PolywrapClient(builder.build());
const client = new Client(builder.build());

const result = await client.invoke<boolean>({
uri: wrapUri,
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/react-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { PolywrapClient } from "@polywrap/client-js";
import { Client } from "@polywrap/client-js";
import { bundle } from "@polywrap/sys-config-bundle-js";

function App() {
const client = new PolywrapClient();
const client = new Client();

// Make extra sure the sys bundle works in the browser
console.log(bundle);
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@
},
"workspaces": {
"packages": [
"./packages/**"
"./packages/**",
"./examples"
]
},
"scripts": {
"reset": "yarn clean && (yarn || yarn || yarn) && yarn build",
"clean": "npx rimraf ./**/node_modules ./**/yarn.lock ./**/build ./**/coverage ./**/.polywrap",
"install:test-wraps": "lerna run generate:wraps --scope @polywrap/test-cases",
"build": "yarn build:common && yarn build:bundles && yarn build:client && yarn install:test-wraps",
"build:common": "lerna run build --ignore @polywrap/*-config-bundle-js --ignore @polywrap/core-client-js --ignore @polywrap/client-js --ignore @polywrap/client-config-builder-js",
"build:deps": "cd dependencies && yarn && cd ..",
"build": "yarn build:deps && yarn build:common && yarn build:bundles && yarn build:client && yarn install:test-wraps",
"build:common": "lerna run build --ignore @polywrap/*-config-bundle-js --ignore @polywrap/basic-client-js --ignore @polywrap/client-js --ignore @polywrap/client-config-builder-js",
"build:bundles": "lerna run build --scope @polywrap/*-config-bundle-js",
"build:client": "lerna run build --scope @polywrap/core-client-js --scope @polywrap/client-js --scope @polywrap/client-config-builder-js",
"build:client": "lerna run build --scope @polywrap/basic-client-js --scope @polywrap/client-js --scope @polywrap/client-config-builder-js",
"build:docs": "lerna run build:docs",
"lint": "lerna run lint",
"lint:fix": "lerna run lint -- --fix",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# @polywrap/core-client-js
<a href="https://www.npmjs.com/package/@polywrap/core-client-js" target="_blank" rel="noopener noreferrer">
<img src="https://img.shields.io/npm/v/@polywrap/core-client-js.svg" alt="npm"/>
# @polywrap/basic-client-js
<a href="https://www.npmjs.com/package/@polywrap/basic-client-js" target="_blank" rel="noopener noreferrer">
<img src="https://img.shields.io/npm/v/@polywrap/basic-client-js.svg" alt="npm"/>
</a>

<br/>
<br/>
The Polywrap JavaScript core client invokes wrapper functions. It's designed to run in any environment that can execute JavaScript (think websites, node scripts, etc.). It has TypeScript support.
The Polywrap JavaScript basic client invokes wrapper functions. It's designed to run in any environment that can execute JavaScript (think websites, node scripts, etc.). It has TypeScript support.

## Installation

```bash
npm install --save @polywrap/core-client-js
npm install --save @polywrap/basic-client-js
```

## Usage

### Instantiate

Use the `@polywrap/client-config-builder-js` package to build a CoreClientConfig for your project, then use the PolywrapCoreClient [constructor](#constructor) to instantiate the client with your config.
Use the `@polywrap/client-config-builder-js` package to build a CoreClientConfig for your project, then use the BasicClient [constructor](#constructor) to instantiate the client with your config.

```ts
const config = new PolywrapClientConfigBuilder().addDefaults().build();
const config = new ClientConfigBuilder().addDefaults().build();

const client = new PolywrapCoreClient(config);
const client = new BasicClient(config);
```

### Invoke
Expand All @@ -45,12 +45,12 @@ Invoke a wrapper.

# Reference

## PolywrapCoreClient
## BasicClient

### Constructor
```ts
/**
* Instantiate a PolywrapClient
* Instantiate a Client
*
* @param config - a core client configuration
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { PolywrapCoreClient } from "../build";
import { BasicClient } from "../build";

import { PolywrapClientConfigBuilder } from "@polywrap/client-config-builder-js";
import { ClientConfigBuilder } from "@polywrap/client-config-builder-js";
import { Uri } from "@polywrap/core-js";

export function instantiate(): PolywrapCoreClient {
export function instantiate(): BasicClient {
// $start: quickstart-instantiate
const config = new PolywrapClientConfigBuilder().addDefaults().build();
const config = new ClientConfigBuilder().addDefaults().build();

const client = new PolywrapCoreClient(config);
const client = new BasicClient(config);
// $end

return client;
}

export async function invoke(): Promise<any> {
const config = new PolywrapClientConfigBuilder().addDefaults().build();
const config = new ClientConfigBuilder().addDefaults().build();

const client = new PolywrapCoreClient(config);
const client = new BasicClient(config);

// $start: quickstart-invoke
const result = await client.invoke({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polywrap/core-client-js",
"description": "Polywrap JavaScript Core Client",
"name": "@polywrap/basic-client-js",
"description": "Polywrap JavaScript Basic Client",
"version": "0.12.2",
"license": "MIT",
"repository": {
Expand Down
Loading
Loading