Skip to content

Commit

Permalink
Fix: Add build for npm packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ephoton committed Nov 7, 2017
1 parent e00cab5 commit 38b8fc4
Show file tree
Hide file tree
Showing 29 changed files with 704 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

build
node_modules

# logs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ yarn add one.io
```

## Usage
###router
### router
Initial your router in 'app.ts'

```typescript
Expand Down
28 changes: 28 additions & 0 deletions build/src/api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ResponseMethods } from './';
import { Permission } from './permission';
export interface ApiOptions<Permission> {
path?: string;
method?: ResponseMethods;
permission?: Permission;
tocken?: string;
test?: boolean;
cookies?: {
user: string;
tocken: string;
};
}
export declare const DefaultApiOptions: {
path: string;
method: string;
tocken: string;
test: boolean;
cookies: {
user: string;
tocken: string;
};
};
export declare function Api<T extends Permission>(options: ApiOptions<T>): MethodDecorator;
export declare function get<T extends Permission>(options: ApiOptions<T>): MethodDecorator;
export declare function post<T extends Permission>(options: ApiOptions<T>): MethodDecorator;
export declare function del<T extends Permission>(options: ApiOptions<T>): MethodDecorator;
export declare function put<T extends Permission>(options: ApiOptions<T>): MethodDecorator;
124 changes: 124 additions & 0 deletions build/src/api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/src/api.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions build/src/error.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export interface ErrorMessageInfo {
code: string;
value: string;
}
export declare const ErrorMessage: {
unknown: ErrorMessageInfo;
param: {
unknown: ErrorMessageInfo;
missing: ErrorMessageInfo;
formatError: ErrorMessageInfo;
};
permission: {
unknown: ErrorMessageInfo;
missing: ErrorMessageInfo;
invalid: ErrorMessageInfo;
};
tocken: {
unknown: ErrorMessageInfo;
missing: ErrorMessageInfo;
invalid: ErrorMessageInfo;
};
route: {
unknown: ErrorMessageInfo;
missing: ErrorMessageInfo;
invalid: ErrorMessageInfo;
};
};
27 changes: 27 additions & 0 deletions build/src/error.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/src/error.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions build/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './api';
export * from './router';
export * from './validator';
export * from './error';
export * from './permission';
export * from './parser';
12 changes: 12 additions & 0 deletions build/src/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/src/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions build/src/parser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference types="koa" />
import { Context } from 'koa';
export declare function getQuery(ctx: Context): Promise<{
[key: string]: string | number;
}>;
export declare function getBody(ctx: Context): Promise<any>;
52 changes: 52 additions & 0 deletions build/src/parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/src/parser.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions build/src/permission.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export declare abstract class Permission {
private groups;
constructor(groups: string[]);
abstract getUserPermissionByName(name: string): Promise<Permission>;
getGroups(): Set<string>;
getValues(): string[];
static verify(permission: Permission, required: Permission): boolean;
}
export interface TockenInfo {
name: string;
value: string;
}
export declare class Tocken {
private tocken;
constructor(name: string, tocken?: string);
getTocken(): TockenInfo;
static generateTocken<Permission>(name: string): string;
static verify(tocken: Tocken): Promise<boolean>;
save(): string;
static getTockenByName(name: string): Promise<string>;
}
Loading

0 comments on commit 38b8fc4

Please sign in to comment.