Skip to content
This repository has been archived by the owner on Jan 3, 2022. It is now read-only.

Fix type declarations #138

Merged
merged 1 commit into from May 5, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -78,7 +78,7 @@ Once initialized, it exposes a special [AuthenticatedJsonRpcMiddleware](https://

It simply passes through methods that are listed in the optional `safeMethods` array, but otherwise requires the requesting domain to have a permissions entry.

This module is written in TypeScript, and so type definitions can be found in [our types file](./src/@types/index.d.ts).
This module is written in TypeScript, and so type definitions can be found in [our types file](./src/types/index.d.ts).

## API

Expand Down Expand Up @@ -154,7 +154,7 @@ Some caveat types we are looking forward to supporting eventually:
#### requestPermissions (IRequestedPermissions)

```typescript
// @types
// types

interface IRequestedPermissions { [methodName: string]: IMethodRequest }
type IMethodRequest = Partial<IOcapLdCapability>;
Expand Down Expand Up @@ -422,7 +422,7 @@ To test against an example dapp, serve the example using `yarn serve` and explor

## Object Definitions

Most object type definitions can be found in [our types file](./src/@types/index.d.ts).
Most object type definitions can be found in [our types file](./src/types/index.d.ts).

## Architecture

Expand Down
6 changes: 3 additions & 3 deletions index.ts
Expand Up @@ -13,7 +13,7 @@ import {

import uuid from 'uuid/v4';

import {
import type {
RpcCapInterface,
RestrictedMethodMap,
UserApprovalPrompt,
Expand All @@ -27,7 +27,7 @@ import {
RpcCapDomainRegistry,
OriginString,
PermittedJsonRpcMiddleware,
} from './src/@types';
} from './src/types';

import {
CaveatFunction,
Expand All @@ -41,7 +41,7 @@ import {
methodNotFound,
} from './src/errors';

import { OcapLdCapability, OcapLdCaveat } from './src/@types/ocap-ld';
import { OcapLdCapability, OcapLdCaveat } from './src/types/ocap-ld';

export { CaveatTypes } from './src/caveats';

Expand Down
5 changes: 2 additions & 3 deletions scripts/copyDistTypes.sh
Expand Up @@ -5,13 +5,12 @@ set -o pipefail

# constants

NO_DIST_MSG='Please run `yarn build:typescript` before continuing.'
NO_DIST_MSG="Please run \`yarn build:typescript\` before continuing."

DIST='dist'
DIST_SRC='dist/src'
DIST_TYPES='dist/src/@types'

SRC_TYPES='src/@types'
SRC_TYPES='src/types'

# error func
function abort {
Expand Down
2 changes: 1 addition & 1 deletion src/caveats.ts
@@ -1,7 +1,7 @@
import { JsonRpcMiddleware } from 'json-rpc-engine';
import isSubset from 'is-subset';
import equal from 'fast-deep-equal';
import { OcapLdCaveat } from './@types/ocap-ld';
import { OcapLdCaveat } from './types/ocap-ld';
import { unauthorized } from './errors';

export type CaveatFunction<T, U> = JsonRpcMiddleware<T, U>;
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -10,7 +10,7 @@
"skipLibCheck": false,
"strict": true,
"target": "ES2017",
"typeRoots": ["./node_modules/@types", "./typings"]
"typeRoots": ["./node_modules/@types", "./src/types"]
},
"include": ["./src", "index.ts"]
}