@axelor/aos-mobile-core 6.4.2 → 6.5.1
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 +65 -10
- package/lib/api/attached-files-api.js +1 -1
- package/lib/api/attached-files-api.js.map +1 -1
- package/lib/api/login-api.js +2 -0
- package/lib/api/login-api.js.map +1 -1
- package/lib/api/mail-message-api.js +1 -1
- package/lib/api/mail-message-api.js.map +1 -1
- package/lib/api/menu-config-api.js +24 -29
- package/lib/api/menu-config-api.js.map +1 -1
- package/lib/api/metafile-api.d.ts +4 -6
- package/lib/api/metafile-api.js +24 -25
- package/lib/api/metafile-api.js.map +1 -1
- package/lib/api/mobile-config-api.js +1 -1
- package/lib/api/mobile-config-api.js.map +1 -1
- package/lib/api/net-info-utils.js +1 -1
- package/lib/api/net-info-utils.js.map +1 -1
- package/lib/apiProviders/Action/ActionApiProvider.d.ts +5 -0
- package/lib/apiProviders/Action/ActionApiProvider.js +19 -0
- package/lib/apiProviders/Action/ActionApiProvider.js.map +1 -0
- package/lib/apiProviders/Action/ActionProvider.d.ts +12 -0
- package/lib/apiProviders/Action/ActionProvider.js +43 -0
- package/lib/apiProviders/Action/ActionProvider.js.map +1 -0
- package/lib/apiProviders/Action/AosActionApi.d.ts +8 -0
- package/lib/apiProviders/Action/AosActionApi.js +34 -0
- package/lib/apiProviders/Action/AosActionApi.js.map +1 -0
- package/lib/apiProviders/Action/GatewayActionApi.d.ts +8 -0
- package/lib/apiProviders/Action/GatewayActionApi.js +43 -0
- package/lib/apiProviders/Action/GatewayActionApi.js.map +1 -0
- package/lib/apiProviders/Action/index.d.ts +5 -0
- package/lib/apiProviders/Action/index.js +21 -0
- package/lib/apiProviders/Action/index.js.map +1 -0
- package/lib/apiProviders/Action/utils.d.ts +8 -0
- package/lib/apiProviders/Action/utils.js +19 -0
- package/lib/apiProviders/Action/utils.js.map +1 -0
- package/lib/apiProviders/Model/AopModelApi.d.ts +20 -0
- package/lib/apiProviders/Model/AopModelApi.js +42 -0
- package/lib/apiProviders/Model/AopModelApi.js.map +1 -0
- package/lib/apiProviders/Model/GatewayModelApi.d.ts +20 -0
- package/lib/apiProviders/Model/GatewayModelApi.js +52 -0
- package/lib/apiProviders/Model/GatewayModelApi.js.map +1 -0
- package/lib/apiProviders/Model/ModelApiProvider.d.ts +22 -0
- package/lib/apiProviders/Model/ModelApiProvider.js +19 -0
- package/lib/apiProviders/Model/ModelApiProvider.js.map +1 -0
- package/lib/apiProviders/Model/Provider.d.ts +12 -0
- package/lib/apiProviders/Model/Provider.js +43 -0
- package/lib/apiProviders/Model/Provider.js.map +1 -0
- package/lib/apiProviders/Model/index.d.ts +5 -0
- package/lib/apiProviders/Model/index.js +22 -0
- package/lib/apiProviders/Model/index.js.map +1 -0
- package/lib/apiProviders/Model/utils.d.ts +28 -0
- package/lib/apiProviders/Model/utils.js +19 -0
- package/lib/apiProviders/Model/utils.js.map +1 -0
- package/lib/apiProviders/Standard/AxiosProvider.d.ts +29 -0
- package/lib/{axios/AxiosApi.js → apiProviders/Standard/AxiosProvider.js} +4 -1
- package/lib/apiProviders/Standard/AxiosProvider.js.map +1 -0
- package/lib/apiProviders/Standard/ObjectFieldsProvider.d.ts +20 -0
- package/lib/apiProviders/Standard/ObjectFieldsProvider.js +84 -0
- package/lib/apiProviders/Standard/ObjectFieldsProvider.js.map +1 -0
- package/lib/apiProviders/Standard/index.d.ts +3 -0
- package/lib/apiProviders/Standard/index.js +21 -0
- package/lib/apiProviders/Standard/index.js.map +1 -0
- package/lib/apiProviders/Standard/requests.helper.d.ts +28 -0
- package/lib/apiProviders/Standard/requests.helper.js +80 -0
- package/lib/apiProviders/Standard/requests.helper.js.map +1 -0
- package/lib/apiProviders/index.d.ts +4 -0
- package/lib/apiProviders/index.js +22 -0
- package/lib/apiProviders/index.js.map +1 -0
- package/lib/{api → apiProviders}/utils.js +2 -2
- package/lib/apiProviders/utils.js.map +1 -0
- package/lib/app/Application.d.ts +1 -0
- package/lib/app/Application.js +1 -1
- package/lib/app/Application.js.map +1 -1
- package/lib/app/ContextedApplication.js +2 -2
- package/lib/app/ContextedApplication.js.map +1 -1
- package/lib/app/ContextsProvider.d.ts +2 -1
- package/lib/app/ContextsProvider.js +23 -1
- package/lib/app/ContextsProvider.js.map +1 -1
- package/lib/app/Module.d.ts +37 -10
- package/lib/app/RootNavigator.js +8 -1
- package/lib/app/RootNavigator.js.map +1 -1
- package/lib/app/context.helper.d.ts +5 -0
- package/lib/app/context.helper.js +69 -0
- package/lib/app/context.helper.js.map +1 -0
- package/lib/app/index.d.ts +2 -1
- package/lib/app/index.js +1 -0
- package/lib/app/index.js.map +1 -1
- package/lib/app/module-generation.helper.d.ts +14 -0
- package/lib/app/module-generation.helper.js +56 -0
- package/lib/app/module-generation.helper.js.map +1 -0
- package/lib/auth/api/company-api.js +7 -10
- package/lib/auth/api/company-api.js.map +1 -1
- package/lib/auth/api/config-api.js +2 -1
- package/lib/auth/api/config-api.js.map +1 -1
- package/lib/auth/api/language-api.js +1 -1
- package/lib/auth/api/language-api.js.map +1 -1
- package/lib/auth/api/user-api.js +1 -1
- package/lib/auth/api/user-api.js.map +1 -1
- package/lib/auth/features/companySlice.js +1 -1
- package/lib/auth/features/companySlice.js.map +1 -1
- package/lib/auth/features/configSlice.js +2 -1
- package/lib/auth/features/configSlice.js.map +1 -1
- package/lib/auth/features/languageSlice.js +1 -1
- package/lib/auth/features/languageSlice.js.map +1 -1
- package/lib/auth/features/userSlice.js +1 -1
- package/lib/auth/features/userSlice.js.map +1 -1
- package/lib/auth/hooks/use-auth-headers.d.ts +1 -0
- package/lib/auth/hooks/use-auth-headers.js +48 -0
- package/lib/auth/hooks/use-auth-headers.js.map +1 -0
- package/lib/auth/index.js +7 -0
- package/lib/auth/index.js.map +1 -1
- package/lib/auth/models/index.d.ts +1 -0
- package/lib/auth/models/index.js +19 -0
- package/lib/auth/models/index.js.map +1 -0
- package/lib/auth/models/objectFields.d.ts +2 -0
- package/lib/{components/molecules/IconSettings/IconSettings.js → auth/models/objectFields.js} +7 -13
- package/lib/auth/models/objectFields.js.map +1 -0
- package/lib/auth/screens/SettingsScreen.js +13 -1
- package/lib/auth/screens/SettingsScreen.js.map +1 -1
- package/lib/auth/screens/UserScreen.js +0 -6
- package/lib/auth/screens/UserScreen.js.map +1 -1
- package/lib/components/molecules/ErrorText/ErrorText.js +2 -31
- package/lib/components/molecules/ErrorText/ErrorText.js.map +1 -1
- package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.d.ts +2 -1
- package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js +9 -9
- package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js.map +1 -1
- package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.d.ts +4 -0
- package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js +10 -6
- package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js.map +1 -1
- package/lib/components/molecules/index.d.ts +0 -1
- package/lib/components/molecules/index.js +0 -1
- package/lib/components/molecules/index.js.map +1 -1
- package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.d.ts +3 -1
- package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.js +5 -8
- package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.js.map +1 -1
- package/lib/components/organisms/DateInput/DateInput.js +1 -1
- package/lib/components/organisms/DateInput/DateInput.js.map +1 -1
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +2 -3
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js +31 -36
- package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +1 -1
- package/lib/components/organisms/MailMessageCard/MailMessageCard.d.ts +1 -2
- package/lib/components/organisms/MailMessageCard/MailMessageCard.js +2 -2
- package/lib/components/organisms/MailMessageCard/MailMessageCard.js.map +1 -1
- package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.d.ts +1 -1
- package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js +3 -1
- package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js.map +1 -1
- package/lib/components/templates/AttachedFilesView/AttachedFilesView.d.ts +1 -2
- package/lib/components/templates/AttachedFilesView/AttachedFilesView.js +4 -2
- package/lib/components/templates/AttachedFilesView/AttachedFilesView.js.map +1 -1
- package/lib/components/templates/MailMessageView/MailMessageView.d.ts +1 -2
- package/lib/components/templates/MailMessageView/MailMessageView.js +38 -24
- package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -1
- package/lib/features/attachedFilesSlice.js +1 -1
- package/lib/features/attachedFilesSlice.js.map +1 -1
- package/lib/features/index.d.ts +1 -0
- package/lib/features/index.js +1 -0
- package/lib/features/index.js.map +1 -1
- package/lib/features/mailMessageSlice.js +1 -1
- package/lib/features/mailMessageSlice.js.map +1 -1
- package/lib/features/menuConfigSlice.js +1 -1
- package/lib/features/menuConfigSlice.js.map +1 -1
- package/lib/features/metafileSlice.js +1 -1
- package/lib/features/metafileSlice.js.map +1 -1
- package/lib/features/mobileConfigSlice.js +1 -1
- package/lib/features/mobileConfigSlice.js.map +1 -1
- package/lib/features/onlineSlice.d.ts +11 -0
- package/lib/features/onlineSlice.js +49 -0
- package/lib/features/onlineSlice.js.map +1 -0
- package/lib/header/HeaderActionsProvider.d.ts +15 -0
- package/lib/header/HeaderActionsProvider.js +60 -0
- package/lib/header/HeaderActionsProvider.js.map +1 -0
- package/lib/header/hooks.d.ts +37 -0
- package/lib/header/hooks.js +105 -0
- package/lib/header/hooks.js.map +1 -0
- package/lib/header/index.d.ts +3 -0
- package/lib/header/index.js +20 -0
- package/lib/header/index.js.map +1 -0
- package/lib/header/types.d.ts +22 -0
- package/lib/header/types.js +19 -0
- package/lib/header/types.js.map +1 -0
- package/lib/header/utils.d.ts +3 -0
- package/lib/header/utils.js +51 -0
- package/lib/header/utils.js.map +1 -0
- package/lib/hooks/use-background-function.d.ts +1 -0
- package/lib/hooks/use-background-function.js +35 -0
- package/lib/hooks/use-background-function.js.map +1 -0
- package/lib/hooks/use-header-registers.d.ts +1 -0
- package/lib/hooks/use-header-registers.js +21 -0
- package/lib/hooks/use-header-registers.js.map +1 -0
- package/lib/hooks/use-navigation.d.ts +1 -0
- package/lib/hooks/use-navigation.js +22 -0
- package/lib/hooks/use-navigation.js.map +1 -0
- package/lib/i18n/translations/en.json +5 -0
- package/lib/i18n/translations/fr.json +5 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.js +4 -3
- package/lib/index.js.map +1 -1
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.js +19 -0
- package/lib/models/index.js.map +1 -0
- package/lib/models/objectFields.d.ts +2 -0
- package/lib/models/objectFields.js +30 -0
- package/lib/models/objectFields.js.map +1 -0
- package/lib/navigator/Navigator.js +17 -40
- package/lib/navigator/Navigator.js.map +1 -1
- package/lib/navigator/drawer/DrawerContent.js +24 -4
- package/lib/navigator/drawer/DrawerContent.js.map +1 -1
- package/lib/navigator/drawer/Header.d.ts +7 -0
- package/lib/navigator/drawer/Header.js +71 -0
- package/lib/navigator/drawer/Header.js.map +1 -0
- package/lib/navigator/module.helper.d.ts +14 -8
- package/lib/navigator/module.helper.js +47 -3
- package/lib/navigator/module.helper.js.map +1 -1
- package/lib/screens/AttachedFilesScreen.d.ts +1 -2
- package/lib/screens/AttachedFilesScreen.js +2 -2
- package/lib/screens/AttachedFilesScreen.js.map +1 -1
- package/lib/screens/MailMessageScreen.d.ts +1 -2
- package/lib/screens/MailMessageScreen.js +2 -2
- package/lib/screens/MailMessageScreen.js.map +1 -1
- package/package.json +5 -4
- package/lib/api/utils.js.map +0 -1
- package/lib/axios/AxiosApi.d.ts +0 -12
- package/lib/axios/AxiosApi.js.map +0 -1
- package/lib/components/molecules/IconSettings/IconSettings.d.ts +0 -4
- package/lib/components/molecules/IconSettings/IconSettings.js.map +0 -1
- /package/lib/{api → apiProviders}/utils.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,GACb,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ModelApi } from './ModelApiProvider';
|
|
2
|
+
import { Query } from './utils';
|
|
3
|
+
export declare class AopModelApi implements ModelApi {
|
|
4
|
+
constructor();
|
|
5
|
+
static isOnlineAvailable: boolean;
|
|
6
|
+
init(): void;
|
|
7
|
+
isAvailable(): Promise<boolean>;
|
|
8
|
+
getAll({ modelName, page }: {
|
|
9
|
+
modelName: string;
|
|
10
|
+
page: number;
|
|
11
|
+
}): Promise<any>;
|
|
12
|
+
get({ modelName, id }: {
|
|
13
|
+
modelName: string;
|
|
14
|
+
id: number;
|
|
15
|
+
}): Promise<any>;
|
|
16
|
+
search({ modelName, query }: {
|
|
17
|
+
modelName: string;
|
|
18
|
+
query: Query;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import axios from 'axios';
|
|
19
|
+
import { getNetInfo } from '../../api/net-info-utils';
|
|
20
|
+
import { REQUEST_LIMIT } from './utils';
|
|
21
|
+
export class AopModelApi {
|
|
22
|
+
constructor() { }
|
|
23
|
+
static isOnlineAvailable = true;
|
|
24
|
+
init() { }
|
|
25
|
+
async isAvailable() {
|
|
26
|
+
if (AopModelApi.isOnlineAvailable) {
|
|
27
|
+
const { isConnected } = await getNetInfo();
|
|
28
|
+
return isConnected;
|
|
29
|
+
}
|
|
30
|
+
return AopModelApi.isOnlineAvailable;
|
|
31
|
+
}
|
|
32
|
+
getAll({ modelName, page }) {
|
|
33
|
+
return axios.get(`ws/rest/${modelName}?offset=${page * REQUEST_LIMIT}&limit=${REQUEST_LIMIT}`);
|
|
34
|
+
}
|
|
35
|
+
get({ modelName, id }) {
|
|
36
|
+
return axios.get(`ws/rest/${modelName}/${id}`);
|
|
37
|
+
}
|
|
38
|
+
search({ modelName, query }) {
|
|
39
|
+
return axios.post(`ws/rest/${modelName}/search`, query);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=AopModelApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AopModelApi.js","sourceRoot":"","sources":["../../../src/apiProviders/Model/AopModelApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAQ,aAAa,EAAC,MAAM,SAAS,CAAC;AAE7C,MAAM,OAAO,WAAW;IACtB,gBAAe,CAAC;IAEhB,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAEhC,IAAI,KAAU,CAAC;IAEf,KAAK,CAAC,WAAW;QACf,IAAI,WAAW,CAAC,iBAAiB,EAAE;YACjC,MAAM,EAAC,WAAW,EAAC,GAAG,MAAM,UAAU,EAAE,CAAC;YACzC,OAAO,WAAW,CAAC;SACpB;QACD,OAAO,WAAW,CAAC,iBAAiB,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,EAAC,SAAS,EAAE,IAAI,EAAoC;QACzD,OAAO,KAAK,CAAC,GAAG,CACd,WAAW,SAAS,WAClB,IAAI,GAAG,aACT,UAAU,aAAa,EAAE,CAC1B,CAAC;IACJ,CAAC;IAED,GAAG,CAAC,EAAC,SAAS,EAAE,EAAE,EAAkC;QAClD,OAAO,KAAK,CAAC,GAAG,CAAC,WAAW,SAAS,IAAI,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,EAAC,SAAS,EAAE,KAAK,EAAoC;QAC1D,OAAO,KAAK,CAAC,IAAI,CAAC,WAAW,SAAS,SAAS,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ModelApi } from './ModelApiProvider';
|
|
2
|
+
import { Query } from './utils';
|
|
3
|
+
export declare class GatewayModelApi implements ModelApi {
|
|
4
|
+
private modelsApi;
|
|
5
|
+
constructor(...modelsApi: ModelApi[]);
|
|
6
|
+
init(): void;
|
|
7
|
+
isAvailable(): Promise<boolean>;
|
|
8
|
+
get({ modelName, id }: {
|
|
9
|
+
modelName: string;
|
|
10
|
+
id: number;
|
|
11
|
+
}): Promise<any[]>;
|
|
12
|
+
getAll({ modelName, page }: {
|
|
13
|
+
modelName: string;
|
|
14
|
+
page: number;
|
|
15
|
+
}): Promise<any[]>;
|
|
16
|
+
search({ modelName, query, }: {
|
|
17
|
+
modelName: string;
|
|
18
|
+
query: Query;
|
|
19
|
+
}): Promise<any[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
function getAvailableModelApi(modelsApi) {
|
|
19
|
+
const modelApi = modelsApi.find(item => {
|
|
20
|
+
return item.isAvailable();
|
|
21
|
+
});
|
|
22
|
+
if (modelApi == null) {
|
|
23
|
+
throw new Error('No provider available, please check your configuration.');
|
|
24
|
+
}
|
|
25
|
+
return modelApi;
|
|
26
|
+
}
|
|
27
|
+
export class GatewayModelApi {
|
|
28
|
+
modelsApi;
|
|
29
|
+
constructor(...modelsApi) {
|
|
30
|
+
this.modelsApi = modelsApi;
|
|
31
|
+
}
|
|
32
|
+
init() {
|
|
33
|
+
getAvailableModelApi(this.modelsApi)?.init();
|
|
34
|
+
}
|
|
35
|
+
isAvailable() {
|
|
36
|
+
const modelApi = getAvailableModelApi(this.modelsApi);
|
|
37
|
+
if (modelApi == null) {
|
|
38
|
+
throw new Error('No provider available, please check your configuration.');
|
|
39
|
+
}
|
|
40
|
+
return modelApi.isAvailable();
|
|
41
|
+
}
|
|
42
|
+
get({ modelName, id }) {
|
|
43
|
+
return getAvailableModelApi(this.modelsApi).get({ modelName, id });
|
|
44
|
+
}
|
|
45
|
+
getAll({ modelName, page }) {
|
|
46
|
+
return getAvailableModelApi(this.modelsApi).getAll({ modelName, page });
|
|
47
|
+
}
|
|
48
|
+
search({ modelName, query, }) {
|
|
49
|
+
return getAvailableModelApi(this.modelsApi).search({ modelName, query });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=GatewayModelApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GatewayModelApi.js","sourceRoot":"","sources":["../../../src/apiProviders/Model/GatewayModelApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,SAAS,oBAAoB,CAAC,SAAqB;IACjD,MAAM,QAAQ,GAAa,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAC/C,O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|
3
|
+
init(): void;
|
|
4
|
+
isAvailable(): Promise<boolean>;
|
|
5
|
+
getAll({ modelName, page }: {
|
|
6
|
+
modelName: string;
|
|
7
|
+
page: number;
|
|
8
|
+
}): Promise<any[]>;
|
|
9
|
+
get({ modelName, id }: {
|
|
10
|
+
modelName: string;
|
|
11
|
+
id: number;
|
|
12
|
+
}): Promise<any[]>;
|
|
13
|
+
fetch?({ modelName, id, query, }: {
|
|
14
|
+
modelName: string;
|
|
15
|
+
id: number;
|
|
16
|
+
query: ReadOptions;
|
|
17
|
+
}): Promise<any[]>;
|
|
18
|
+
search({ modelName, query }: {
|
|
19
|
+
modelName: string;
|
|
20
|
+
query: Query;
|
|
21
|
+
}): Promise<any[]>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=ModelApiProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelApiProvider.js","sourceRoot":"","sources":["../../../src/apiProviders/Model/ModelApiProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ModelApi } from './ModelApiProvider';
|
|
2
|
+
declare class Provider {
|
|
3
|
+
private modelApi;
|
|
4
|
+
constructor(modelApi: ModelApi);
|
|
5
|
+
setModelApi(newModelApi: ModelApi): void;
|
|
6
|
+
getModelApi(): ModelApi;
|
|
7
|
+
}
|
|
8
|
+
export declare function useModelApi(): ModelApi;
|
|
9
|
+
export declare function getModelApi(): ModelApi;
|
|
10
|
+
export declare function registerModelApi(modelApi: ModelApi): void;
|
|
11
|
+
export declare const provider: Provider;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { useMemo } from 'react';
|
|
19
|
+
import { AopModelApi } from './AopModelApi';
|
|
20
|
+
class Provider {
|
|
21
|
+
modelApi;
|
|
22
|
+
constructor(modelApi) {
|
|
23
|
+
this.modelApi = modelApi;
|
|
24
|
+
this.modelApi = modelApi;
|
|
25
|
+
}
|
|
26
|
+
setModelApi(newModelApi) {
|
|
27
|
+
this.modelApi = newModelApi;
|
|
28
|
+
}
|
|
29
|
+
getModelApi() {
|
|
30
|
+
return this.modelApi;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function useModelApi() {
|
|
34
|
+
return useMemo(() => provider.getModelApi(), []);
|
|
35
|
+
}
|
|
36
|
+
export function getModelApi() {
|
|
37
|
+
return provider.getModelApi();
|
|
38
|
+
}
|
|
39
|
+
export function registerModelApi(modelApi) {
|
|
40
|
+
provider.setModelApi(modelApi);
|
|
41
|
+
}
|
|
42
|
+
export const provider = new Provider(new AopModelApi());
|
|
43
|
+
//# sourceMappingURL=Provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"","sources":["../../../src/apiProviders/Model/Provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAG1C,MAAM,QAAQ;IACQ;IAApB,YAAoB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,WAAW,CAAC,WAAqB;QAC/B,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC;IAC9B,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAkB;IACjD,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { AopModelApi } from './AopModelApi';
|
|
19
|
+
export { GatewayModelApi } from './GatewayModelApi';
|
|
20
|
+
export { getModelApi, provider, registerModelApi, useModelApi } from './Provider';
|
|
21
|
+
export * from './utils';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/apiProviders/Model/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAChF,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const REQUEST_LIMIT = 10;
|
|
2
|
+
export type CriteriaField = {
|
|
3
|
+
operator: '=' | '!=' | '<' | '>' | '<=' | '>=' | 'like' | 'notLike' | 'between' | 'notBetween' | 'isNull' | 'notNull';
|
|
4
|
+
fieldName: string;
|
|
5
|
+
value?: any;
|
|
6
|
+
value2?: any;
|
|
7
|
+
};
|
|
8
|
+
export type CriteriaGroup = {
|
|
9
|
+
operator: 'and' | 'or' | 'not';
|
|
10
|
+
criteria: Criteria[];
|
|
11
|
+
};
|
|
12
|
+
export type Criteria = CriteriaField | CriteriaGroup;
|
|
13
|
+
export type CriteriaQuery = {
|
|
14
|
+
criteria: Criteria[];
|
|
15
|
+
};
|
|
16
|
+
export type Query = {
|
|
17
|
+
data: CriteriaQuery;
|
|
18
|
+
fields?: string[];
|
|
19
|
+
sortBy?: string[];
|
|
20
|
+
offset?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
};
|
|
23
|
+
export type ReadOptions = {
|
|
24
|
+
fields: string[];
|
|
25
|
+
related?: {
|
|
26
|
+
[fieldName: string]: string[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export const REQUEST_LIMIT = 10;
|
|
19
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/apiProviders/Model/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
interface ApiCallProps {
|
|
2
|
+
url: string;
|
|
3
|
+
data?: any;
|
|
4
|
+
}
|
|
5
|
+
export interface ApiProvider {
|
|
6
|
+
post({ url, data }: {
|
|
7
|
+
url: any;
|
|
8
|
+
data: any;
|
|
9
|
+
}): Promise<any>;
|
|
10
|
+
put({ url, data }: {
|
|
11
|
+
url: any;
|
|
12
|
+
data: any;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
get({ url }: {
|
|
15
|
+
url: any;
|
|
16
|
+
}): Promise<any>;
|
|
17
|
+
delete({ url }: {
|
|
18
|
+
url: any;
|
|
19
|
+
}): Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
declare class AxiosApiProvider implements ApiProvider {
|
|
22
|
+
constructor();
|
|
23
|
+
post({ url, data }: ApiCallProps): Promise<any>;
|
|
24
|
+
put({ url, data }: ApiCallProps): Promise<any>;
|
|
25
|
+
get({ url }: ApiCallProps): Promise<any>;
|
|
26
|
+
delete({ url }: ApiCallProps): Promise<any>;
|
|
27
|
+
}
|
|
28
|
+
export declare const axiosApiProvider: AxiosApiProvider;
|
|
29
|
+
export {};
|
|
@@ -27,6 +27,9 @@ class AxiosApiProvider {
|
|
|
27
27
|
get({ url }) {
|
|
28
28
|
return axios.get(url);
|
|
29
29
|
}
|
|
30
|
+
delete({ url }) {
|
|
31
|
+
return axios.delete(url);
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
export const axiosApiProvider = new AxiosApiProvider();
|
|
32
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=AxiosProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxiosProvider.js","sourceRoot":"","sources":["../../../src/apiProviders/Standard/AxiosProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,MAAM,gBAAgB;IACpB,gBAAe,CAAC;IAEhB,IAAI,CAAC,EAAC,GAAG,EAAE,IAAI,EAAe;QAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,GAAG,CAAC,EAAC,GAAG,EAAE,IAAI,EAAe;QAC3B,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,GAAG,CAAC,EAAC,GAAG,EAAe;QACrB,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,EAAC,GAAG,EAAe;QACxB,OAAO,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Schema } from 'yup';
|
|
2
|
+
import { Models } from '../../app/Module';
|
|
3
|
+
import { CriteriaGroup } from '../Model';
|
|
4
|
+
declare class ObjectFieldsProvider {
|
|
5
|
+
private objectFields;
|
|
6
|
+
private searchFields;
|
|
7
|
+
private sortFields;
|
|
8
|
+
constructor();
|
|
9
|
+
init(models: Models): void;
|
|
10
|
+
getObjectSchema(objectKey: string): Schema;
|
|
11
|
+
getObjectFields(objectKey: string): string[];
|
|
12
|
+
getSortFields(objectKey: string): string[];
|
|
13
|
+
getSearchFields(objectKey: string): string[];
|
|
14
|
+
getSearchCriterias(objectKey: string, searchValue: string): CriteriaGroup;
|
|
15
|
+
}
|
|
16
|
+
export declare const objectFieldsProvider: ObjectFieldsProvider;
|
|
17
|
+
export declare function getObjectFields(objectKey: string): string[];
|
|
18
|
+
export declare function getSortFields(objectKey: string): string[];
|
|
19
|
+
export declare function getSearchCriterias(objectKey: string, searchValue: string): CriteriaGroup;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
import { object } from 'yup';
|
|
19
|
+
class ObjectFieldsProvider {
|
|
20
|
+
objectFields;
|
|
21
|
+
searchFields;
|
|
22
|
+
sortFields;
|
|
23
|
+
constructor() {
|
|
24
|
+
this.objectFields = {};
|
|
25
|
+
this.searchFields = {};
|
|
26
|
+
this.sortFields = {};
|
|
27
|
+
}
|
|
28
|
+
init(models) {
|
|
29
|
+
this.objectFields = models.objectFields;
|
|
30
|
+
this.searchFields = models.searchFields;
|
|
31
|
+
this.sortFields = models.sortFields;
|
|
32
|
+
}
|
|
33
|
+
getObjectSchema(objectKey) {
|
|
34
|
+
const registeredObjects = Object.keys(this.objectFields);
|
|
35
|
+
if (registeredObjects.includes(objectKey)) {
|
|
36
|
+
return this.objectFields[objectKey];
|
|
37
|
+
}
|
|
38
|
+
return object({});
|
|
39
|
+
}
|
|
40
|
+
getObjectFields(objectKey) {
|
|
41
|
+
const objectSchema = this.getObjectSchema(objectKey);
|
|
42
|
+
if (Object.keys(objectSchema)?.length > 0) {
|
|
43
|
+
return objectSchema._nodes;
|
|
44
|
+
}
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
getSortFields(objectKey) {
|
|
48
|
+
const registeredObjects = Object.keys(this.sortFields);
|
|
49
|
+
if (registeredObjects.includes(objectKey)) {
|
|
50
|
+
return this.sortFields[objectKey];
|
|
51
|
+
}
|
|
52
|
+
return ['id'];
|
|
53
|
+
}
|
|
54
|
+
getSearchFields(objectKey) {
|
|
55
|
+
const registeredObjects = Object.keys(this.searchFields);
|
|
56
|
+
if (registeredObjects.includes(objectKey)) {
|
|
57
|
+
return this.searchFields[objectKey];
|
|
58
|
+
}
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
getSearchCriterias(objectKey, searchValue) {
|
|
62
|
+
const searchFields = this.getSearchFields(objectKey);
|
|
63
|
+
let criteria = [];
|
|
64
|
+
if (searchFields.length > 0 && searchValue != null) {
|
|
65
|
+
criteria = searchFields.map(_searchField => ({
|
|
66
|
+
fieldName: _searchField,
|
|
67
|
+
operator: 'like',
|
|
68
|
+
value: searchValue,
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
return { operator: 'or', criteria: criteria };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export const objectFieldsProvider = new ObjectFieldsProvider();
|
|
75
|
+
export function getObjectFields(objectKey) {
|
|
76
|
+
return objectFieldsProvider.getObjectFields(objectKey);
|
|
77
|
+
}
|
|
78
|
+
export function getSortFields(objectKey) {
|
|
79
|
+
return objectFieldsProvider.getSortFields(objectKey);
|
|
80
|
+
}
|
|
81
|
+
export function getSearchCriterias(objectKey, searchValue) {
|
|
82
|
+
return objectFieldsProvider.getSearchCriterias(objectKey, searchValue);
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=ObjectFieldsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectFieldsProvider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BAAoB,CAAC,kBAAkB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Axelor Business Solutions
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Axelor (<http://axelor.com>).
|
|
5
|
+
*
|
|
6
|
+
* This program is free software: you can redistribute it and/or modify
|
|
7
|
+
* it under the terms of the GNU Affero General Public License, version 3,
|
|
8
|
+
* as published by the Free Software Foundation.
|
|
9
|
+
*
|
|
10
|
+
* This program is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Affero General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
16
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
export { axiosApiProvider } from './AxiosProvider';
|
|
19
|
+
export { getObjectFields, getSearchCriterias, getSortFields, objectFieldsProvider, } from './ObjectFieldsProvider';
|
|
20
|
+
export { createStandardSearch, createStandardFetch } from './requests.helper';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/apiProviders/Standard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAc,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Criteria } from '../Model';
|
|
2
|
+
interface SearchProps {
|
|
3
|
+
model: string;
|
|
4
|
+
criteria?: Criteria[];
|
|
5
|
+
domain?: string;
|
|
6
|
+
domainContext?: any;
|
|
7
|
+
fieldKey: string;
|
|
8
|
+
sortKey?: string;
|
|
9
|
+
page: number;
|
|
10
|
+
numberElementsByPage?: number;
|
|
11
|
+
}
|
|
12
|
+
interface FetchProps {
|
|
13
|
+
model: string;
|
|
14
|
+
fieldKey: string;
|
|
15
|
+
id: number;
|
|
16
|
+
relatedFields?: any;
|
|
17
|
+
}
|
|
18
|
+
declare class RequestBuilder {
|
|
19
|
+
private requestLimit;
|
|
20
|
+
constructor();
|
|
21
|
+
init(defaultRequestLimit: number): void;
|
|
22
|
+
createStandardSearch: ({ model, criteria, domain, domainContext, fieldKey, sortKey, page, numberElementsByPage, }: SearchProps) => Promise<any>;
|
|
23
|
+
createStandardFetch: ({ model, fieldKey, id, relatedFields, }: FetchProps) => Promise<any>;
|
|
24
|
+
}
|
|
25
|
+
export declare const requestBuilder: RequestBuilder;
|
|
26
|
+
export declare const createStandardSearch: (searchOptions: SearchProps) => Promise<any>;
|
|
27
|
+
export declare const createStandardFetch: (fetchOptions: FetchProps) => Promise<any>;
|
|
28
|
+
export {};
|