@tripup-company/element-ui-extended 0.0.41 → 0.0.45
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/dist/element-ui-extended.common.js +514 -167
- package/dist/element-ui-extended.common.js.map +1 -1
- package/dist/element-ui-extended.umd.js +514 -167
- package/dist/element-ui-extended.umd.js.map +1 -1
- package/dist/element-ui-extended.umd.min.js +2 -2
- package/dist/element-ui-extended.umd.min.js.map +1 -1
- package/dist/examples/models/contact-model.d.ts +20 -0
- package/dist/examples/models/contact-model.d.ts.map +1 -0
- package/dist/examples/repositories/contacts-repository.d.ts +9 -0
- package/dist/examples/repositories/contacts-repository.d.ts.map +1 -0
- package/dist/examples/repositories/data/contact.d.ts +43 -0
- package/dist/examples/repositories/data/contact.d.ts.map +1 -0
- package/dist/examples/types/icontact.d.ts +17 -0
- package/dist/examples/types/icontact.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filter-convertor.d.ts +7 -0
- package/dist/src/components/GenericFilters/filter-convertor.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filter-factory.d.ts +36 -0
- package/dist/src/components/GenericFilters/filter-factory.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/base-filter.d.ts +8 -0
- package/dist/src/components/GenericFilters/filters/base-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/between-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/between-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/contains-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/contains-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/contains-multiple-filelds-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/contains-multiple-filelds-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/end-with-filter.d.ts +6 -0
- package/dist/src/components/GenericFilters/filters/end-with-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/equal-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/equal-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/group-by-filter.d.ts +8 -0
- package/dist/src/components/GenericFilters/filters/group-by-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/in-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/in-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/interfaces/condition.d.ts +5 -0
- package/dist/src/components/GenericFilters/filters/interfaces/condition.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/interfaces/filter-response.d.ts +5 -0
- package/dist/src/components/GenericFilters/filters/interfaces/filter-response.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/is-not-null-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/is-not-null-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/is-null-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/is-null-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/not-contains-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/not-contains-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/not-equal-filter.d.ts +7 -0
- package/dist/src/components/GenericFilters/filters/not-equal-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/start-with-filter.d.ts +6 -0
- package/dist/src/components/GenericFilters/filters/start-with-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/week-day-filter.d.ts +8 -0
- package/dist/src/components/GenericFilters/filters/week-day-filter.d.ts.map +1 -0
- package/dist/src/components/GenericFilters/filters/younger-week-filter.d.ts +8 -0
- package/dist/src/components/GenericFilters/filters/younger-week-filter.d.ts.map +1 -0
- package/dist/src/index.d.ts +20 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lang/en.d.ts +186 -0
- package/dist/src/lang/en.d.ts.map +1 -0
- package/dist/src/lang/index.d.ts +4 -0
- package/dist/src/lang/index.d.ts.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/models/base-model.d.ts +4 -0
- package/dist/src/models/base-model.d.ts.map +1 -0
- package/dist/src/models/meta-model.d.ts +10 -0
- package/dist/src/models/meta-model.d.ts.map +1 -0
- package/dist/src/repositories/base-repository.d.ts +17 -0
- package/dist/src/repositories/base-repository.d.ts.map +1 -0
- package/dist/src/repositories/contracts/read.d.ts +6 -0
- package/dist/src/repositories/contracts/read.d.ts.map +1 -0
- package/dist/src/repositories/contracts/write.d.ts +6 -0
- package/dist/src/repositories/contracts/write.d.ts.map +1 -0
- package/dist/src/services/list-query-service.d.ts +15 -0
- package/dist/src/services/list-query-service.d.ts.map +1 -0
- package/dist/src/services/local-storage-service.d.ts +7 -0
- package/dist/src/services/local-storage-service.d.ts.map +1 -0
- package/dist/src/services/resolutions.d.ts +2 -0
- package/dist/src/services/resolutions.d.ts.map +1 -0
- package/dist/src/types/axiosInterface.d.ts +21 -0
- package/dist/src/types/axiosInterface.d.ts.map +1 -0
- package/dist/src/types/collection.d.ts +6 -0
- package/dist/src/types/collection.d.ts.map +1 -0
- package/dist/src/types/error.d.ts +4 -0
- package/dist/src/types/error.d.ts.map +1 -0
- package/dist/src/types/meta.d.ts +7 -0
- package/dist/src/types/meta.d.ts.map +1 -0
- package/dist/src/types/pagination.d.ts +9 -0
- package/dist/src/types/pagination.d.ts.map +1 -0
- package/package.json +6 -3
- package/src/repositories/base-repository.ts +104 -0
- package/src/repositories/contracts/read.ts +6 -0
- package/src/repositories/contracts/write.ts +5 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta } from "../types/meta";
|
|
2
|
+
import BaseModel from "./base-model";
|
|
3
|
+
import { Pagination } from "../types/pagination";
|
|
4
|
+
export default class MetaModel extends BaseModel implements Meta {
|
|
5
|
+
include: [];
|
|
6
|
+
custom: [];
|
|
7
|
+
pagination: Pagination;
|
|
8
|
+
constructor(data?: any[]);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=meta-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta-model.d.ts","sourceRoot":"","sources":["../../../src/models/meta-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,SAAU,YAAW,IAAI;IAC9D,OAAO,EAAE,EAAE,CAAC;IACZ,MAAM,EAAE,EAAE,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;gBAEX,IAAI,QAAK;CAGtB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Write } from "./contracts/write";
|
|
2
|
+
import { Read } from "./contracts/read";
|
|
3
|
+
import { Collection } from "../types/collection";
|
|
4
|
+
import { AxiosInstance } from "../types/axiosInterface";
|
|
5
|
+
export default abstract class BaseRepository<T> implements Write<T>, Read<T> {
|
|
6
|
+
protected baseUrl: string;
|
|
7
|
+
protected request: AxiosInstance;
|
|
8
|
+
constructor(location: string, baseUrl: string, request: AxiosInstance);
|
|
9
|
+
convert(data: any): T;
|
|
10
|
+
collectionConvert(data: any): Collection<T>;
|
|
11
|
+
create(item: T): Promise<T>;
|
|
12
|
+
update(id: string, item: T, include?: string): Promise<T>;
|
|
13
|
+
delete(id: string): Promise<boolean>;
|
|
14
|
+
findOne(id: string, include?: string): Promise<T>;
|
|
15
|
+
all(query: string, include?: string, filter?: string): Promise<Collection<T>>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=base-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-repository.d.ts","sourceRoot":"","sources":["../../../src/repositories/base-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CA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,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../../src/repositories/contracts/write.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK,CAAC,CAAC;IACpB,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default class ListQueryService {
|
|
2
|
+
key: string;
|
|
3
|
+
storageService: any;
|
|
4
|
+
constructor(key: any, storageService: any);
|
|
5
|
+
updateSort(column: any): void;
|
|
6
|
+
getListQuery(): {
|
|
7
|
+
meta: {
|
|
8
|
+
page: number;
|
|
9
|
+
limit: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
updateListQuery(listQuery: any): void;
|
|
13
|
+
setListQuery(listQuery: any): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=list-query-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-query-service.d.ts","sourceRoot":"","sources":["../../../src/services/list-query-service.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,EAAE,GAAG,CAAC;gBAER,GAAG,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG;IAIzC,UAAU,CAAC,MAAM,KAAA;IAcjB,YAAY;;;;;;IAUZ,eAAe,CAAC,SAAS,EAAE,GAAG;IAG9B,YAAY,CAAC,SAAS,EAAE,GAAG;CAG5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-storage-service.d.ts","sourceRoot":"","sources":["../../../src/services/local-storage-service.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,mBAAmB;IACtC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;gBACZ,GAAG,SAAK;IAGpB,GAAG,CAAC,GAAG,KAAA,EAAE,YAAY,KAAK;IAW1B,GAAG,CAAC,GAAG,KAAA,EAAE,GAAG,KAAA;CAUb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolutions.d.ts","sourceRoot":"","sources":["../../../src/services/resolutions.js"],"names":[],"mappings":"AAkBA,sDAEC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosStatic } from "axios";
|
|
2
|
+
export interface AxiosInstance extends AxiosStatic {
|
|
3
|
+
$request<T = any>(config: AxiosRequestConfig): Promise<T>;
|
|
4
|
+
$get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
5
|
+
$delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
6
|
+
$head<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
7
|
+
$options<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
8
|
+
$post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
9
|
+
$put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
10
|
+
$patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
11
|
+
setBaseURL(baseURL: string): void;
|
|
12
|
+
setHeader(name: string, value?: string | false, scopes?: string | string[]): void;
|
|
13
|
+
setToken(token: string | false, type?: string, scopes?: string | string[]): void;
|
|
14
|
+
onRequest(callback: (config: AxiosRequestConfig) => void | AxiosRequestConfig | Promise<AxiosRequestConfig>): void;
|
|
15
|
+
onResponse<T = any>(callback: (response: AxiosResponse<T>) => void | AxiosResponse<T> | Promise<AxiosResponse<T>>): void;
|
|
16
|
+
onError(callback: (error: AxiosError) => any): void;
|
|
17
|
+
onRequestError(callback: (error: AxiosError) => any): void;
|
|
18
|
+
onResponseError(callback: (error: AxiosError) => any): void;
|
|
19
|
+
create(options?: AxiosRequestConfig): AxiosInstance;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=axiosInterface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axiosInterface.d.ts","sourceRoot":"","sources":["../../../src/types/axiosInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,WAAW,EACZ,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACvE,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACxE,KA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AAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,GAAG,IAAI,CAAC;IAC3D,eAAe,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,GAAG,GAAG,IAAI,CAAC;IAC5D,MAAM,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,aAAa,CAAC;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../src/types/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,WAAW,UAAU,CAAC,CAAC;IACzB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,IAAI,EAAE,IAAI,CAAA;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/types/error.ts"],"names":[],"mappings":"AAAA,UAAU,MAAM;IACZ,OAAO,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/types/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,EAAE,CAAC;IACZ,MAAM,EAAE,EAAE,CAAC;IACX,UAAU,EAAE,UAAU,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/types/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,EAAE,CAAA;CACZ"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tripup-company/element-ui-extended",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"main": "./dist/element-ui-extended.umd.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
7
|
-
"build": "vue-cli-service build",
|
|
7
|
+
"build": "vue-cli-service build && tsc --emitDeclarationOnly",
|
|
8
8
|
"lint": "vue-cli-service lint",
|
|
9
|
-
"build-lib": "vue-cli-service build --target lib src/index.ts",
|
|
9
|
+
"build-lib": "vue-cli-service build --target lib src/index.ts && tsc --emitDeclarationOnly",
|
|
10
10
|
"test": "mochapack --webpack-config webpack.test.config.js --require mock-local-storage --require ./tests/setup.js ./tests/unit/**/*.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"prettier": "^2.2.1",
|
|
45
45
|
"sass": "^1.26.5",
|
|
46
46
|
"sass-loader": "^8.0.2",
|
|
47
|
+
"ts-loader": "^9.2.6",
|
|
47
48
|
"typescript": "~4.1.5",
|
|
48
49
|
"vue-loader": "^15.9.5",
|
|
49
50
|
"vue-template-compiler": "^2.6.11"
|
|
@@ -53,11 +54,13 @@
|
|
|
53
54
|
"src/**/*.vue",
|
|
54
55
|
"src/services/*",
|
|
55
56
|
"src/models/*",
|
|
57
|
+
"src/repositories/*",
|
|
56
58
|
"src/lang/*",
|
|
57
59
|
"src/types/*",
|
|
58
60
|
"src/filters.js",
|
|
59
61
|
"src/filters-top.js"
|
|
60
62
|
],
|
|
63
|
+
"typings": "./dist/src/index.d.ts",
|
|
61
64
|
"description": "## Project setup ``` npm install ```",
|
|
62
65
|
"repository": {
|
|
63
66
|
"type": "git",
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Write } from "./contracts/write";
|
|
2
|
+
import { Read } from "./contracts/read";
|
|
3
|
+
import { Collection } from "../types/collection";
|
|
4
|
+
|
|
5
|
+
import { AxiosInstance } from "../types/axiosInterface";
|
|
6
|
+
|
|
7
|
+
export default abstract class BaseRepository<T> implements Write<T>, Read<T> {
|
|
8
|
+
protected baseUrl: string;
|
|
9
|
+
protected request: AxiosInstance;
|
|
10
|
+
|
|
11
|
+
constructor(location: string, baseUrl: string, request: AxiosInstance) {
|
|
12
|
+
this.baseUrl = location + baseUrl;
|
|
13
|
+
this.request = request;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
convert(data: any): T {
|
|
17
|
+
return data.data;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
collectionConvert(data: any): Collection<T> {
|
|
21
|
+
for (const item in data.meta) {
|
|
22
|
+
if (typeof data.meta[item] === "string") {
|
|
23
|
+
data.meta[item] = parseInt(data.meta[item]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
create(item: T): Promise<T> {
|
|
30
|
+
return new Promise<T>((resolve, reject) => {
|
|
31
|
+
this.request.$request({
|
|
32
|
+
url: this.baseUrl,
|
|
33
|
+
method: 'post',
|
|
34
|
+
data: item,
|
|
35
|
+
}).then((response: any) => {
|
|
36
|
+
resolve(this.convert(response));
|
|
37
|
+
}).catch((err: any) => {
|
|
38
|
+
reject(err);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
update(id: string, item: T, include = "--"): Promise<T> {
|
|
44
|
+
return new Promise<T>((resolve, reject) => {
|
|
45
|
+
this.request.$request({
|
|
46
|
+
url: this.baseUrl + "/" + id + "?include=" + include,
|
|
47
|
+
method: "patch",
|
|
48
|
+
data: item,
|
|
49
|
+
})
|
|
50
|
+
.then((response) => {
|
|
51
|
+
resolve(this.convert(response));
|
|
52
|
+
})
|
|
53
|
+
.catch((err) => {
|
|
54
|
+
reject(err);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
delete(id: string): Promise<boolean> {
|
|
60
|
+
return new Promise<boolean>((resolve, reject) => {
|
|
61
|
+
this.request.$request({
|
|
62
|
+
url: this.baseUrl + "/" + id,
|
|
63
|
+
method: "delete",
|
|
64
|
+
})
|
|
65
|
+
.then(() => {
|
|
66
|
+
resolve(true);
|
|
67
|
+
})
|
|
68
|
+
.catch((err) => {
|
|
69
|
+
reject(err);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
findOne(id: string, include = "--"): Promise<T> {
|
|
75
|
+
return new Promise<T>((resolve, reject) => {
|
|
76
|
+
this.request.$request({
|
|
77
|
+
url: this.baseUrl + "/" + id + "?include=" + include,
|
|
78
|
+
method: "get",
|
|
79
|
+
})
|
|
80
|
+
.then((response) => {
|
|
81
|
+
resolve(this.convert(response));
|
|
82
|
+
})
|
|
83
|
+
.catch((err) => {
|
|
84
|
+
reject(err);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
all(query: string, include = "--", filter = ""): Promise<Collection<T>> {
|
|
90
|
+
return new Promise<Collection<T>>((resolve, reject) => {
|
|
91
|
+
this.request.$request({
|
|
92
|
+
url: this.baseUrl + "?include=" + include + (filter === "" ? '' : ('&selectFilter=' + filter)),
|
|
93
|
+
method: "get",
|
|
94
|
+
params: query,
|
|
95
|
+
})
|
|
96
|
+
.then((response) => {
|
|
97
|
+
resolve(this.collectionConvert(response));
|
|
98
|
+
})
|
|
99
|
+
.catch((err) => {
|
|
100
|
+
reject(err);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|