@sweepbright/api-client 0.29.4 → 0.29.8
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/api-client.cjs.development.js +44 -3
- package/dist/api-client.cjs.development.js.map +1 -1
- package/dist/api-client.cjs.production.min.js +1 -1
- package/dist/api-client.cjs.production.min.js.map +1 -1
- package/dist/api-client.esm.js +44 -3
- package/dist/api-client.esm.js.map +1 -1
- package/dist/common/config.d.ts +2 -0
- package/dist/common/currencies.d.ts +50 -0
- package/dist/common/logger.d.ts +27 -0
- package/dist/common/types.d.ts +1 -0
- package/dist/entities/property.d.ts +523 -0
- package/dist/index.d.ts +9 -7
- package/dist/mockServer.js +27 -0
- package/dist/mockServer.js.map +1 -0
- package/dist/resources/estates.d.ts +5 -9
- package/dist/resources/offices.d.ts +6 -0
- package/dist/src/__tests__/auth.test.js +15 -0
- package/dist/src/__tests__/auth.test.js.map +1 -0
- package/dist/src/__tests__/channels.test.js +77 -0
- package/dist/src/__tests__/channels.test.js.map +1 -0
- package/dist/src/__tests__/contacts.test.js +61 -0
- package/dist/src/__tests__/contacts.test.js.map +1 -0
- package/dist/src/__tests__/estates.test.js +43 -0
- package/dist/src/__tests__/estates.test.js.map +1 -0
- package/dist/src/__tests__/leads.test.js +55 -0
- package/dist/src/__tests__/leads.test.js.map +1 -0
- package/dist/src/common/config.js +34 -0
- package/dist/src/common/config.js.map +1 -0
- package/dist/src/common/currencies.js +55 -0
- package/dist/src/common/currencies.js.map +1 -0
- package/dist/src/common/logger.js +50 -0
- package/dist/src/common/logger.js.map +1 -0
- package/dist/src/common/types.js +3 -0
- package/dist/src/common/types.js.map +1 -0
- package/dist/src/entities/office.js +9 -0
- package/dist/src/entities/office.js.map +1 -0
- package/dist/src/entities/property.js +220 -0
- package/dist/src/entities/property.js.map +1 -0
- package/dist/src/index.js +94 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/resources/channel_accounts.js +31 -0
- package/dist/src/resources/channel_accounts.js.map +1 -0
- package/dist/src/resources/channels.js +32 -0
- package/dist/src/resources/channels.js.map +1 -0
- package/dist/src/resources/companies.js +16 -0
- package/dist/src/resources/companies.js.map +1 -0
- package/dist/src/resources/contact_preferences.js +14 -0
- package/dist/src/resources/contact_preferences.js.map +1 -0
- package/dist/src/resources/contacts.js +29 -0
- package/dist/src/resources/contacts.js.map +1 -0
- package/dist/src/resources/estates.js +73 -0
- package/dist/src/resources/estates.js.map +1 -0
- package/dist/src/resources/leads.js +26 -0
- package/dist/src/resources/leads.js.map +1 -0
- package/dist/src/resources/negotiators.js +16 -0
- package/dist/src/resources/negotiators.js.map +1 -0
- package/dist/src/resources/offices.js +12 -0
- package/dist/src/resources/offices.js.map +1 -0
- package/dist/src/types.js +40 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.js +28 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/types.d.ts +39 -0
- package/package.json +11 -10
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenType = exports.EstateInclude = exports.Env = void 0;
|
|
4
|
+
var Env;
|
|
5
|
+
(function (Env) {
|
|
6
|
+
Env["PRODUCTION"] = "production";
|
|
7
|
+
Env["STAGING"] = "staging";
|
|
8
|
+
Env["DEV"] = "dev";
|
|
9
|
+
})(Env || (exports.Env = Env = {}));
|
|
10
|
+
var EstateInclude;
|
|
11
|
+
(function (EstateInclude) {
|
|
12
|
+
EstateInclude["settings"] = "settings";
|
|
13
|
+
EstateInclude["channels"] = "channels";
|
|
14
|
+
EstateInclude["negotiator"] = "negotiator";
|
|
15
|
+
EstateInclude["office.settings"] = "office.settings";
|
|
16
|
+
EstateInclude["project.settings"] = "project.settings";
|
|
17
|
+
EstateInclude["project.office.settings"] = "project.office.settings";
|
|
18
|
+
EstateInclude["project.properties.office.settings"] = "project.properties.office.settings";
|
|
19
|
+
EstateInclude["project.properties.settings"] = "project.properties.settings";
|
|
20
|
+
EstateInclude["properties.settings"] = "properties.settings";
|
|
21
|
+
EstateInclude["properties.office.settings"] = "properties.office.settings";
|
|
22
|
+
EstateInclude["properties.negotiator"] = "properties.negotiator";
|
|
23
|
+
EstateInclude["item.settings"] = "item.settings";
|
|
24
|
+
EstateInclude["item.office.settings"] = "item.office.settings";
|
|
25
|
+
EstateInclude["item.channels"] = "item.channels";
|
|
26
|
+
EstateInclude["item.project.settings"] = "item.project.settings";
|
|
27
|
+
EstateInclude["item.project.office.settings"] = "item.project.office.settings";
|
|
28
|
+
EstateInclude["item.project.properties.office.settings"] = "item.project.properties.office.settings";
|
|
29
|
+
EstateInclude["item.project.properties.settings"] = "item.project.properties.settings";
|
|
30
|
+
EstateInclude["item.properties.settings"] = "item.properties.settings";
|
|
31
|
+
EstateInclude["item.properties.office.settings"] = "item.properties.office.settings";
|
|
32
|
+
EstateInclude["item.negotiator"] = "item.negotiator";
|
|
33
|
+
EstateInclude["item.properties.negotiator"] = "item.properties.negotiator";
|
|
34
|
+
})(EstateInclude || (exports.EstateInclude = EstateInclude = {}));
|
|
35
|
+
var TokenType;
|
|
36
|
+
(function (TokenType) {
|
|
37
|
+
TokenType[TokenType["USER_TOKEN"] = 0] = "USER_TOKEN";
|
|
38
|
+
TokenType[TokenType["API_TOKEN"] = 1] = "API_TOKEN";
|
|
39
|
+
})(TokenType || (exports.TokenType = TokenType = {}));
|
|
40
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,gCAAyB,CAAA;IACzB,0BAAmB,CAAA;IACnB,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,mBAAH,GAAG,QAId;AAED,IAAY,aAuBX;AAvBD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,oDAAqC,CAAA;IACrC,sDAAuC,CAAA;IACvC,oEAAqD,CAAA;IACrD,0FAA2E,CAAA;IAC3E,4EAA6D,CAAA;IAC7D,4DAA6C,CAAA;IAC7C,0EAA2D,CAAA;IAC3D,gEAAiD,CAAA;IACjD,gDAAiC,CAAA;IACjC,8DAA+C,CAAA;IAC/C,gDAAiC,CAAA;IACjC,gEAAiD,CAAA;IACjD,8EAA+D,CAAA;IAC/D,oGAAqF,CAAA;IACrF,sFAAuE,CAAA;IACvE,sEAAuD,CAAA;IACvD,oFAAqE,CAAA;IACrE,oDAAqC,CAAA;IACrC,0EAA2D,CAAA;AAC7D,CAAC,EAvBW,aAAa,6BAAb,aAAa,QAuBxB;AAaD,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,qDAAU,CAAA;IACV,mDAAS,CAAA;AACX,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleRequestFailure = exports.getData = void 0;
|
|
4
|
+
function getData(response) {
|
|
5
|
+
return response.data;
|
|
6
|
+
}
|
|
7
|
+
exports.getData = getData;
|
|
8
|
+
function handleRequestFailure(exception) {
|
|
9
|
+
if (exception.response) {
|
|
10
|
+
const { response: { status, data }, } = exception;
|
|
11
|
+
const error = new Error(`${status}: ${JSON.stringify(data)}`);
|
|
12
|
+
// remove parts of the stack trace so the error message (codeframe) shows up
|
|
13
|
+
// at the code where the actual problem is.
|
|
14
|
+
error.stack = (error.stack || '')
|
|
15
|
+
.split('\n')
|
|
16
|
+
.filter((line) => !line.includes('at handleRequestFailure') &&
|
|
17
|
+
!line.includes('at processTicksAndRejections'))
|
|
18
|
+
.join('\n');
|
|
19
|
+
error.status = status;
|
|
20
|
+
error.data = data;
|
|
21
|
+
return Promise.reject(error);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return Promise.reject(exception);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.handleRequestFailure = handleRequestFailure;
|
|
28
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,CAAC,QAAa;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAFD,0BAEC;AAED,SAAgB,oBAAoB,CAAC,SAKpC;IACC,IAAI,SAAS,CAAC,QAAQ,EAAE;QACtB,MAAM,EACJ,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAC3B,GAAG,SAAS,CAAC;QAEd,MAAM,KAAK,GAAQ,IAAI,KAAK,CAAC,GAAG,MAAM,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnE,4EAA4E;QAC5E,2CAA2C;QAC3C,KAAK,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;aAC9B,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CACL,CAAC,IAAY,EAAE,EAAE,CACf,CAAC,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC;YACzC,CAAC,IAAI,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CACjD;aACA,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAC9B;SAAM;QACL,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;KAClC;AACH,CAAC;AA9BD,oDA8BC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { Property } from './entities/property';
|
|
3
|
+
export declare enum EstateInclude {
|
|
4
|
+
settings = "settings",
|
|
5
|
+
channels = "channels",
|
|
6
|
+
negotiator = "negotiator",
|
|
7
|
+
'office.settings' = "office.settings",
|
|
8
|
+
'project.settings' = "project.settings",
|
|
9
|
+
'project.office.settings' = "project.office.settings",
|
|
10
|
+
'project.properties.office.settings' = "project.properties.office.settings",
|
|
11
|
+
'project.properties.settings' = "project.properties.settings",
|
|
12
|
+
'properties.settings' = "properties.settings",
|
|
13
|
+
'properties.office.settings' = "properties.office.settings",
|
|
14
|
+
'properties.negotiator' = "properties.negotiator",
|
|
15
|
+
'item.settings' = "item.settings",
|
|
16
|
+
'item.office.settings' = "item.office.settings",
|
|
17
|
+
'item.channels' = "item.channels",
|
|
18
|
+
'item.project.settings' = "item.project.settings",
|
|
19
|
+
'item.project.office.settings' = "item.project.office.settings",
|
|
20
|
+
'item.project.properties.office.settings' = "item.project.properties.office.settings",
|
|
21
|
+
'item.project.properties.settings' = "item.project.properties.settings",
|
|
22
|
+
'item.properties.settings' = "item.properties.settings",
|
|
23
|
+
'item.properties.office.settings' = "item.properties.office.settings",
|
|
24
|
+
'item.negotiator' = "item.negotiator",
|
|
25
|
+
'item.properties.negotiator' = "item.properties.negotiator"
|
|
26
|
+
}
|
|
2
27
|
export declare type ClientConf = {
|
|
3
28
|
clientId?: string;
|
|
4
29
|
clientSecret?: string;
|
|
@@ -34,3 +59,17 @@ export interface NegotiatorInfo {
|
|
|
34
59
|
picture_url?: string;
|
|
35
60
|
full_name?: string;
|
|
36
61
|
}
|
|
62
|
+
export interface GetUnitsInput {
|
|
63
|
+
page?: number;
|
|
64
|
+
limit?: number;
|
|
65
|
+
includes?: EstateInclude[];
|
|
66
|
+
}
|
|
67
|
+
export interface UnitsOutput {
|
|
68
|
+
data: Property[];
|
|
69
|
+
}
|
|
70
|
+
export interface PropertyOutput {
|
|
71
|
+
data: Property;
|
|
72
|
+
}
|
|
73
|
+
export interface PropertiesOutput {
|
|
74
|
+
data: Property[];
|
|
75
|
+
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.29.
|
|
3
|
-
"license": "
|
|
2
|
+
"version": "0.29.8",
|
|
3
|
+
"license": "UNLICENCED",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"lint": "tsdx lint",
|
|
14
|
-
"prepare": "tsdx build",
|
|
10
|
+
"build": "yarn tsc",
|
|
11
|
+
"test": "yarn jest --forceExit --detectOpenHandles",
|
|
12
|
+
"lint": "eslint --ext .ts ./src",
|
|
15
13
|
"format": "prettier --write \"**/*.{js,md,scss,css,ts,tsx}\""
|
|
16
14
|
},
|
|
17
15
|
"peerDependencies": {},
|
|
18
16
|
"husky": {
|
|
19
17
|
"hooks": {
|
|
20
|
-
"pre-commit": "
|
|
18
|
+
"pre-commit": "yarn lint"
|
|
21
19
|
}
|
|
22
20
|
},
|
|
23
21
|
"prettier": {
|
|
@@ -30,12 +28,15 @@
|
|
|
30
28
|
"author": "Miguel Carvajal",
|
|
31
29
|
"module": "dist/api-client-js.esm.js",
|
|
32
30
|
"devDependencies": {
|
|
31
|
+
"@sweepbright/eslint-config-shared": "^1.0.5",
|
|
32
|
+
"@sweepbright/shared-configs-tsconfig": "^1.0.1",
|
|
33
33
|
"@types/jest": "^25.1.3",
|
|
34
34
|
"husky": "^4.2.3",
|
|
35
|
+
"jest": "^29.5.0",
|
|
35
36
|
"msw": "^0.21.2",
|
|
36
|
-
"
|
|
37
|
+
"ts-jest": "^29.1.0",
|
|
37
38
|
"tslib": "^1.11.1",
|
|
38
|
-
"typescript": "^
|
|
39
|
+
"typescript": "^5.1.6"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"axios": "^0.21.2",
|