Skip to content
Merged
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
912 changes: 456 additions & 456 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bitgo/api-ts",
"name": "@api-ts/base",
"version": "0.1.0",
"description": "Tools for using io-ts to describe and consume APIs",
"license": "Apache-2.0",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# io-ts-express
# @api-ts/express-wrapper

> Implement an io-ts-http spec with an [express] server

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bitgo/io-ts-express",
"name": "@api-ts/express-wrapper",
"version": "0.1.0",
"description": "Implement an HTTP specification with Express",
"author": "Eric Crosson <ericcrosson@bitgo.com>",
Expand All @@ -15,14 +15,14 @@
"test": "ava"
},
"dependencies": {
"@bitgo/io-ts-http": "0.1.0",
"@api-ts/io-ts-http": "0.1.0",
"express": "4.17.2",
"fp-ts": "2.11.8",
"io-ts": "2.2.16"
},
"devDependencies": {
"@api-ts/superagent-wrapper": "0.1.0",
"@ava/typescript": "3.0.1",
"@bitgo/superagent-codec-adapter": "0.1.0",
"@types/express": "4.17.13",
"@types/node": "16.11.7",
"ava": "4.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* io-ts-express
* express-wrapper
* A simple, type-safe web server
*/

Expand All @@ -12,7 +12,7 @@ import {
HttpRoute,
RequestType,
ResponseType,
} from '@bitgo/io-ts-http';
} from '@api-ts/io-ts-http';

export type Function<R extends HttpRoute> = (
input: RequestType<R>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import * as t from 'io-ts';
import express from 'express';
import supertest from 'supertest';

import { ApiSpec, apiSpec, httpRequest, httpRoute, optional } from '@bitgo/io-ts-http';
import { Response } from '@bitgo/io-ts-response';
import {
buildApiClient,
supertestRequestFactory,
} from '@bitgo/superagent-codec-adapter';
import { ApiSpec, apiSpec, httpRequest, httpRoute, optional } from '@api-ts/io-ts-http';
import { Response } from '@api-ts/response';
import { buildApiClient, supertestRequestFactory } from '@api-ts/superagent-wrapper';

import { createServer } from '../src';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"path": "../io-ts-http"
},
{
"path": "../superagent-codec-adapter"
"path": "../superagent-wrapper"
Copy link
Contributor

Choose a reason for hiding this comment

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

I presume you made these edits manually? I was writing documentation in https://github.com/typescript-tools/spec this week and pondering the changes required to support npm 7 workspaces without lerna in the link command

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I did it by hand. I wonder if turborepo has a command to dump the dependency graph?

Copy link
Contributor

Choose a reason for hiding this comment

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

It does, into dot, at least

}
]
}
4 changes: 2 additions & 2 deletions packages/io-ts-http/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# io-ts-http
# @api-ts/io-ts-http

Runtime types for (de)serializing HTTP requests from both the client and server side

Expand Down Expand Up @@ -27,7 +27,7 @@ urlDecoding the values). The `httpRequest` function can be combined with codecs
generic HTTP requests into a more refined object. For example:

```typescript
import { httpRequest, optional } from '@bitgo/io-ts-types';
import { httpRequest, optional } from '@api-ts/io-ts-http';
import { DateFromString, NumberFromString } from 'io-ts-types';

const ExampleHttpRequest = httpRequest({
Expand Down
2 changes: 1 addition & 1 deletion packages/io-ts-http/docs/apiSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ service's API as a collection of operations linked to routes. This function itse
not do anything aside from enforce the correct type of the parameter passed to it.

```typescript
import { apiSpec } from '@bitgo/io-ts-http';
import { apiSpec } from '@api-ts/io-ts-http';

import { GetMessage, CreateMessage } from './routes/message';
import { GetUser, CreateUser, UpdateUser, DeleteUser } from './routes/user';
Expand Down
2 changes: 1 addition & 1 deletion packages/io-ts-http/docs/httpRoute.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type RequestProps = {
id: number;
};

// Now imagine I have some api client using the above route definition. `superagent-codec-adapter`
// Now imagine I have some api client using the above route definition. `superagent-wrapper`
// can be used to create a client like this for a whole group of routes in one line.
const routeApiClient: (props: RequestProps) => Promise<string>;

Expand Down
4 changes: 2 additions & 2 deletions packages/io-ts-http/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bitgo/io-ts-http",
"name": "@api-ts/io-ts-http",
"version": "0.1.0",
"description": "Types for (de)serializing HTTP requests from both the client and server side",
"author": "Patrick McLaughlin <patrickmclaughlin@bitgo.com>",
Expand All @@ -17,7 +17,7 @@
"test": "nyc --reporter=lcov --reporter=text --reporter=json-summary mocha test/**/*.test.ts --require ts-node/register --exit"
},
"dependencies": {
"@bitgo/io-ts-response": "0.1.0",
"@api-ts/response": "0.1.0",
"fp-ts": "2.11.8",
"io-ts": "2.2.16",
"io-ts-types": "0.5.16",
Expand Down
2 changes: 1 addition & 1 deletion packages/io-ts-http/src/httpResponse.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as t from 'io-ts';

import { Status } from '@bitgo/io-ts-response';
import { Status } from '@api-ts/response';

export type HttpResponse = t.Props;

Expand Down
2 changes: 1 addition & 1 deletion packages/io-ts-http/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"references": [
{
"path": "../io-ts-response"
"path": "../response"
}
]
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# io-ts-openapi
# @api-ts/openapi-generator

Command-line utility for converting a collection of io-ts-http routes into an OpenAPI
specification.
Expand All @@ -12,7 +12,7 @@ by using the `--input` option.

# Parameters

io-ts-openapi accepts several command-line arguments, all of which are optional.
openapi-generator accepts several command-line arguments, all of which are optional.

```
OPTIONS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as t from 'io-ts';
import { NonEmptyString, NumberFromString } from 'io-ts-types';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const FirstRoute = h.httpRoute({
path: '/test/{id}/first',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const FirstRoute = h.httpRoute({
path: '/test/{id}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const MyCodec = NumberFromString;

import * as t from 'io-ts';
import { NonEmptyString } from 'io-ts-types';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

import { MyCodec } from './other';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test/{id}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// file: index.ts

import * as t from 'io-ts';
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';

const MyRoute = h.httpRoute({
path: '/test',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bitgo/io-ts-openapi",
"name": "@api-ts/openapi-generator",
"version": "0.1.0",
"description": "Generate an OpenAPI specification from an io-ts-http contract",
"author": "Patrick McLaughlin <patrickmclaughlin@bitgo.com>",
Expand All @@ -18,7 +18,7 @@
"test": "ava test/test-corpus.ts"
},
"dependencies": {
"@bitgo/io-ts-http": "0.1.0",
"@api-ts/io-ts-http": "0.1.0",
"cmd-ts": "0.10.0",
"comment-parser": "1.3.1",
"fp-ts": "2.11.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ const app = command({
const pkgFile = p.join(process.cwd(), 'package.json');
try {
const pkgJson = fs.readFileSync(pkgFile, 'utf-8');
return JSON.parse(pkgJson)['name'] ?? 'api-ts';
return JSON.parse(pkgJson)['name'] ?? 'openapi-generator';
} catch (err) {
return 'io-ts-openapi';
return 'openapi-generator';
}
},
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HttpResponseCodes } from '@bitgo/io-ts-http';
import { HttpResponseCodes } from '@api-ts/io-ts-http';
import { parse as parseComment } from 'comment-parser';
import { flow, pipe } from 'fp-ts/function';
import * as E from 'fp-ts/Either';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bitgo/io-ts-response",
"name": "@api-ts/response",
"version": "0.1.0",
"description": "Types for representing responses",
"author": "Patrick McLaughlin <patrickmclaughlin@bitgo.com>",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Superagent Codec Adapter
# @api-ts/superagent-wrapper

Combines an api spec with `superagent`/`supertest` to create a type-checked api client.

Expand All @@ -8,7 +8,7 @@ First, either define or import an `io-ts-http` api spec. The following one will
for this guide:

```typescript
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';
import * as t from 'io-ts';
import { NumberFromString } from 'io-ts-types';

Expand Down Expand Up @@ -52,10 +52,7 @@ then binding it to the api spec.
For `superagent`:

```typescript
import {
superagentRequestFactory,
buildApiClient,
} from '@bitgo/superagent-codec-adapter';
import { superagentRequestFactory, buildApiClient } from '@api-ts/superagent-wrapper';
import superagent from 'superagent';

import { ExampleAPI } from './see-the-above-example';
Expand All @@ -75,10 +72,7 @@ For `supertest` the process is almost identical except that `supertest` itself h
knowing the root api url:

```typescript
import {
supertestRequestFactory,
buildApiClient,
} from '@bitgo/superagent-codec-adapter';
import { supertestRequestFactory, buildApiClient } from '@api-ts/superagent-wrapper';
import supertest from 'superagent';

import { ExampleAPI } from './see-the-above-example';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@bitgo/superagent-codec-adapter",
"name": "@api-ts/superagent-wrapper",
"version": "0.1.0",
"description": "Make type-safe HTTP requests with superagent",
"author": "Patrick McLaughlin <patrickmclaughlin@bitgo.com>",
Expand All @@ -15,7 +15,7 @@
"test": "nyc --reporter=lcov --reporter=text --reporter=json-summary mocha test/**/*.test.ts --require ts-node/register --exit"
},
"dependencies": {
"@bitgo/io-ts-http": "0.1.0",
"@api-ts/io-ts-http": "0.1.0",
"fp-ts": "2.11.8",
"io-ts": "2.2.16",
"superagent": "3.8.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';
import * as E from 'fp-ts/Either';
import * as t from 'io-ts';
import type { Response, SuperAgent, SuperAgentRequest } from 'superagent';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';
import type { SuperAgentRequest } from 'superagent';

import { requestForRoute, BoundRequestFactory, RequestFactory } from './request';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as h from '@bitgo/io-ts-http';
import * as h from '@api-ts/io-ts-http';
import bodyParser from 'body-parser';
import { assert } from 'chai';
import express from 'express';
Expand Down
Loading