onecore 0.0.40 → 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1 @@
1
- # core
1
+ # onecore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onecore",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "description": "onecore",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/db.ts CHANGED
@@ -3,6 +3,9 @@ export interface Statement {
3
3
  query: string;
4
4
  params?: any[];
5
5
  }
6
+ export interface QueryBuilder {
7
+ build(cxt?: any): Promise<Statement>;
8
+ }
6
9
  export interface SimpleDB {
7
10
  driver: string;
8
11
  query<T>(sql: string): Promise<T[]>;
package/src/index.ts CHANGED
@@ -67,6 +67,31 @@ import { ViewService } from './service/ViewService';
67
67
  export type Search<T, F> = (s: F, limit?: number, offset?: number | string, fields?: string[]) => Promise<SearchResult<T>>;
68
68
  export type SearchFunc<T, F> = Search<T, F>;
69
69
 
70
+ export interface ExceptionHandler {
71
+ handleException(rs: string, err: any, i?: number, filename?: string): void;
72
+ }
73
+ export interface ImportResult {
74
+ total: number;
75
+ success: number;
76
+ }
77
+ export interface ImportService {
78
+ import(): Promise<ImportResult>;
79
+ }
80
+ export interface Importer {
81
+ import(): Promise<ImportResult>;
82
+ }
83
+ export interface Parser<T> {
84
+ parse: (data: string) => Promise<T>;
85
+ }
86
+ export interface Transformer<T> {
87
+ transform: (data: string) => Promise<T>;
88
+ }
89
+ export interface ExportService {
90
+ export(ctx?: any): Promise<number>;
91
+ }
92
+ export interface Exporter {
93
+ export(ctx?: any): Promise<number>;
94
+ }
70
95
  export class ViewManager<T, ID> implements ViewService<T, ID> {
71
96
  constructor(private r: ViewRepository<T, ID>) {
72
97
  this.metadata = this.metadata.bind(this);
package/src/metadata.ts CHANGED
@@ -50,6 +50,7 @@ export interface Attribute {
50
50
  typeof?: Attributes;
51
51
  true?: string|number;
52
52
  false?: string|number;
53
+ getString?: (v: any) => string;
53
54
  }
54
55
  export interface Attributes {
55
56
  [key: string]: Attribute;
package/src/model.ts CHANGED
@@ -115,6 +115,10 @@ export interface ErrorMessage {
115
115
  param?: string|number|Date;
116
116
  message?: string;
117
117
  }
118
+ export interface ErrorHandler<T> {
119
+ handleError(rs: T, errors: ErrorMessage[], i?: number, filename?: string): void;
120
+ }
121
+
118
122
  export interface ResultInfo<T> {
119
123
  status: number|string;
120
124
  errors?: ErrorMessage[];