@sweepbright/api-client 0.29.8 → 0.29.9

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.
@@ -1,7 +0,0 @@
1
- import { ClientCtx } from '../types';
2
- export default function (ctx: ClientCtx): {
3
- get: (attributes: {
4
- companyId: string;
5
- includes?: string[];
6
- }) => Promise<import("axios").AxiosResponse<any>>;
7
- };
@@ -1,6 +0,0 @@
1
- import { ClientCtx } from '../types';
2
- export default function contact_preferences(ctx: ClientCtx): {
3
- getAll: (attributes: {
4
- contactId: string;
5
- }) => Promise<import("axios").AxiosResponse<any>>;
6
- };
@@ -1,14 +0,0 @@
1
- import { ClientCtx } from '../types';
2
- export default function (ctx: ClientCtx): {
3
- getOne: (attributes: {
4
- contactId: string;
5
- }) => Promise<import("axios").AxiosResponse<any>>;
6
- getOneWithNegotiators: (attributes: {
7
- contactId: string;
8
- }) => Promise<import("axios").AxiosResponse<any>>;
9
- getAll: (attributes: {
10
- companyId: string;
11
- page?: number;
12
- limit?: number;
13
- }) => Promise<import("axios").AxiosResponse<any>>;
14
- };
@@ -1,43 +0,0 @@
1
- import { Property } from '../entities/property';
2
- import { ClientCtx, EstateInclude, GetUnitsInput, PropertiesOutput, UnitsOutput } from '../types';
3
- export default function (ctx: ClientCtx): {
4
- getOne: (attributes: {
5
- estateId: string;
6
- companyId: string;
7
- includes?: EstateInclude[];
8
- }) => Promise<Property>;
9
- getAll: (attributes: {
10
- companyId: string;
11
- page?: number;
12
- limit?: number;
13
- archived?: boolean;
14
- }) => Promise<PropertiesOutput>;
15
- getUnits: (projectId: string, { page, limit, includes }?: GetUnitsInput) => Promise<UnitsOutput>;
16
- createPublication: (attributes: {
17
- estateId: string;
18
- channelAccountId: string;
19
- config: Record<string, any>;
20
- }) => Promise<import("axios").AxiosResponse<any>>;
21
- updatePublication: (attributes: {
22
- estateId: string;
23
- channelAccountId: string;
24
- config: Record<string, any>;
25
- }) => Promise<import("axios").AxiosResponse<any>>;
26
- unpublishPublication: (attributes: {
27
- estateId: string;
28
- channelAccountId: string;
29
- }) => Promise<import("axios").AxiosResponse<any>>;
30
- scheduleVisit: (estateId: string, attributes: {
31
- first_name: string;
32
- last_name: string;
33
- email: string;
34
- phone: string;
35
- preferences?: {
36
- locale: string;
37
- };
38
- }) => Promise<import("axios").AxiosResponse<any>>;
39
- unstable_setPublicationUrl: ({ estateId, url, }: {
40
- estateId: string;
41
- url: string;
42
- }) => Promise<import("axios").AxiosResponse<any>>;
43
- };
@@ -1,39 +0,0 @@
1
- import { ClientCtx } from '../types';
2
- export default function (ctx: ClientCtx): {
3
- createLead: (attributes: {
4
- firstName?: string;
5
- lastName: string;
6
- propertyId: string;
7
- email?: string;
8
- phone?: string;
9
- message: string;
10
- portal: string;
11
- location_preference?: {
12
- country: string;
13
- postal_codes: string[];
14
- };
15
- }) => Promise<import("axios").AxiosResponse<any>>;
16
- createUnassignedLead: (companyId: string, attributes: {
17
- first_name: string;
18
- last_name: string;
19
- phone: string;
20
- email: string;
21
- message: string;
22
- source_type: 'channel';
23
- external_source: string;
24
- preferences?: {
25
- types: string[];
26
- negotiation: 'sale' | 'let';
27
- condition: string;
28
- min_price?: number;
29
- max_price?: number;
30
- wishes: string[];
31
- min_rooms: number;
32
- locale: string;
33
- };
34
- location_preference?: {
35
- country: string;
36
- postal_codes: string[];
37
- };
38
- }) => Promise<import("axios").AxiosResponse<any>>;
39
- };
@@ -1,10 +0,0 @@
1
- import { ClientCtx } from '../types';
2
- import { NegotiatorInfo } from '../types';
3
- export default function (ctx: ClientCtx): {
4
- getNegotiatorsByIdCompanyId: (attributes: {
5
- ids: string;
6
- companyId: string;
7
- }) => Promise<{
8
- data: NegotiatorInfo[];
9
- }>;
10
- };
@@ -1,6 +0,0 @@
1
- import { ClientCtx } from '../types';
2
- export default function (ctx: ClientCtx): {
3
- getOffice: (attributes: {
4
- officeId: string;
5
- }) => Promise<import("axios").AxiosResponse<any>>;
6
- };
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const convict_1 = __importDefault(require("convict"));
7
- const convict_format_with_validator_1 = __importDefault(require("convict-format-with-validator"));
8
- convict_1.default.addFormats(convict_format_with_validator_1.default);
9
- const config = (0, convict_1.default)({
10
- env: {
11
- doc: "The application environment.",
12
- format: ["production", "dev", "staging"],
13
- default: "dev",
14
- env: "STAGE",
15
- },
16
- nodeEnv: {
17
- env: "NODE_ENV",
18
- doc: "Node env",
19
- format: String,
20
- default: ""
21
- },
22
- service: {
23
- name: {
24
- doc: "The name of the service.",
25
- format: String,
26
- default: "my-service",
27
- env: "SERVICE_NAME",
28
- },
29
- },
30
- });
31
- // Perform validation
32
- config.validate({ allowed: "strict" });
33
- exports.default = config;
34
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/common/config.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAC9B,kGAAmE;AAEnE,iBAAO,CAAC,UAAU,CAAC,uCAAsB,CAAC,CAAC;AAE3C,MAAM,MAAM,GAAG,IAAA,iBAAO,EAAC;IACnB,GAAG,EAAE;QACD,GAAG,EAAE,8BAA8B;QACnC,MAAM,EAAE,CAAC,YAAY,EAAE,KAAK,EAAE,SAAS,CAAC;QACxC,OAAO,EAAE,KAAK;QACd,GAAG,EAAE,OAAO;KACf;IACD,OAAO,EAAE;QACL,GAAG,EAAE,UAAU;QACf,GAAG,EAAE,UAAU;QACf,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE;KACd;IACD,OAAO,EAAE;QACL,IAAI,EAAE;YACF,GAAG,EAAE,0BAA0B;YAC/B,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,YAAY;YACrB,GAAG,EAAE,cAAc;SACtB;KACJ;CACJ,CAAC,CAAC;AAEH,qBAAqB;AACrB,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;AAEvC,kBAAe,MAAM,CAAC"}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.makeLogger = exports.getLogger = exports.WinstonLogger = void 0;
7
- const winston_1 = __importDefault(require("winston"));
8
- const config_1 = __importDefault(require("./config"));
9
- let logger;
10
- class WinstonLogger {
11
- constructor(logger) {
12
- this.logger = logger;
13
- }
14
- error(message, ...meta) {
15
- this.logger.log("error", message, ...meta);
16
- }
17
- warn(message, ...meta) {
18
- this.logger.log("warn", message, ...meta);
19
- }
20
- info(message, ...meta) {
21
- if (config_1.default.get('nodeEnv') !== 'test') {
22
- this.logger.log("info", message, ...meta);
23
- }
24
- }
25
- debug(message, ...meta) {
26
- this.logger.log("debug", message, ...meta);
27
- }
28
- }
29
- exports.WinstonLogger = WinstonLogger;
30
- function getLogger() {
31
- const logger = winston_1.default.createLogger({
32
- transports: [new winston_1.default.transports.Console()],
33
- format: winston_1.default.format.json(),
34
- defaultMeta: {
35
- service: config_1.default.get("service.name"),
36
- env: config_1.default.get("env"),
37
- },
38
- });
39
- return logger;
40
- }
41
- exports.getLogger = getLogger;
42
- function makeLogger() {
43
- if (logger) {
44
- return logger;
45
- }
46
- logger = new WinstonLogger(getLogger());
47
- return logger;
48
- }
49
- exports.makeLogger = makeLogger;
50
- //# sourceMappingURL=logger.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/common/logger.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,sDAA8B;AAe9B,IAAI,MAAc,CAAC;AAEnB,MAAa,aAAa;IACtB,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAG9C,KAAK,C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gCAMC"}
package/dist/types.d.ts DELETED
@@ -1,75 +0,0 @@
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
- }
27
- export declare type ClientConf = {
28
- clientId?: string;
29
- clientSecret?: string;
30
- env?: Env;
31
- version?: string;
32
- };
33
- export declare type InitConf = {
34
- scopes?: string[];
35
- };
36
- export declare enum TokenType {
37
- USER_TOKEN = 0,
38
- API_TOKEN = 1
39
- }
40
- export declare type Auth = {
41
- token: string;
42
- expiresIn?: string;
43
- type: TokenType;
44
- };
45
- export declare type Maybe<T> = T | null;
46
- export declare type ClientCtx = {
47
- checkAuth: (tokenType: TokenType) => void;
48
- httpClient: AxiosInstance;
49
- };
50
- export declare enum Env {
51
- PRODUCTION = "production",
52
- STAGING = "staging",
53
- DEV = "dev"
54
- }
55
- export interface NegotiatorInfo {
56
- id: number;
57
- first_name?: string;
58
- last_name?: string;
59
- picture_url?: string;
60
- full_name?: string;
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/dist/utils.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export declare function getData(response: any): any;
2
- export declare function handleRequestFailure(exception: {
3
- response?: {
4
- status: number;
5
- data: any;
6
- };
7
- }): Promise<never>;