@sweepbright/api-client 0.30.4 → 0.30.6
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/mockServer.js +27 -0
- package/dist/mockServer.js.map +1 -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/currencies.js +55 -0
- package/dist/src/common/currencies.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/package.json +7 -3
- package/.circleci/config.yml +0 -102
- package/.devcontainer/Dockerfile +0 -23
- package/.devcontainer/devcontainer.json +0 -59
- package/.editorconfig +0 -11
- package/.eslintrc.json +0 -6
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -40
- package/.nvmrc +0 -1
- package/.prettierignore +0 -1
- package/jest.config.js +0 -7
- package/mockServer.ts +0 -44
- package/setupTests.ts +0 -1
- package/src/__tests__/auth.test.ts +0 -14
- package/src/__tests__/channels.test.ts +0 -104
- package/src/__tests__/contacts.test.ts +0 -85
- package/src/__tests__/estates.test.ts +0 -50
- package/src/__tests__/leads.test.ts +0 -67
- package/src/common/currencies.ts +0 -50
- package/src/common/types.ts +0 -1
- package/src/entities/office.ts +0 -193
- package/src/entities/property.ts +0 -574
- package/src/index.ts +0 -128
- package/src/resources/channel_accounts.ts +0 -39
- package/src/resources/channels.ts +0 -52
- package/src/resources/companies.ts +0 -15
- package/src/resources/contact_preferences.ts +0 -14
- package/src/resources/contacts.ts +0 -38
- package/src/resources/estates.ts +0 -145
- package/src/resources/leads.ts +0 -65
- package/src/resources/negotiators.ts +0 -19
- package/src/resources/offices.ts +0 -12
- package/src/types.ts +0 -88
- package/src/utils.ts +0 -35
- package/tsconfig.json +0 -19
|
@@ -0,0 +1,94 @@
|
|
|
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.Env = exports.createClient = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
9
|
+
const channel_accounts_1 = __importDefault(require("./resources/channel_accounts"));
|
|
10
|
+
const channels_1 = __importDefault(require("./resources/channels"));
|
|
11
|
+
const companies_1 = __importDefault(require("./resources/companies"));
|
|
12
|
+
const contact_preferences_1 = __importDefault(require("./resources/contact_preferences"));
|
|
13
|
+
const contacts_1 = __importDefault(require("./resources/contacts"));
|
|
14
|
+
const estates_1 = __importDefault(require("./resources/estates"));
|
|
15
|
+
const leads_1 = __importDefault(require("./resources/leads"));
|
|
16
|
+
const negotiators_1 = __importDefault(require("./resources/negotiators"));
|
|
17
|
+
const offices_1 = __importDefault(require("./resources/offices"));
|
|
18
|
+
const types_1 = require("./types");
|
|
19
|
+
Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return types_1.Env; } });
|
|
20
|
+
const utils_1 = require("./utils");
|
|
21
|
+
const envHosts = {
|
|
22
|
+
[types_1.Env.PRODUCTION]: 'https://api.sweepbright.com',
|
|
23
|
+
[types_1.Env.STAGING]: 'https://api.staging.sweepbright.com',
|
|
24
|
+
[types_1.Env.DEV]: 'https://api.dev.sweepbright.com',
|
|
25
|
+
};
|
|
26
|
+
function createClient(conf) {
|
|
27
|
+
const { clientId, clientSecret, env = types_1.Env.PRODUCTION, version } = conf;
|
|
28
|
+
let _auth = null;
|
|
29
|
+
const httpClient = axios_1.default.create({
|
|
30
|
+
baseURL: envHosts[env],
|
|
31
|
+
});
|
|
32
|
+
//TODO: getData here is an antipattern. Interceptor should not change a type of response
|
|
33
|
+
httpClient.interceptors.response.use(utils_1.getData, utils_1.handleRequestFailure);
|
|
34
|
+
if (version) {
|
|
35
|
+
httpClient.defaults.headers.common['Accept'] = `application/vnd.sweepbright.${version}+json`;
|
|
36
|
+
}
|
|
37
|
+
const ctx = {
|
|
38
|
+
httpClient,
|
|
39
|
+
checkAuth(tokenType) {
|
|
40
|
+
if (!_auth) {
|
|
41
|
+
throw new Error('client is not authenticated');
|
|
42
|
+
}
|
|
43
|
+
if (_auth.type !== tokenType) {
|
|
44
|
+
throw new Error('authenticated with invalid token type');
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const client = {
|
|
49
|
+
authorize(config = {}) {
|
|
50
|
+
const { scopes = ['companies:read', 'properties:download', 'lead_info:write'], } = config;
|
|
51
|
+
(0, tiny_invariant_1.default)(clientId, 'missing client id');
|
|
52
|
+
(0, tiny_invariant_1.default)(clientSecret, 'missing client secret');
|
|
53
|
+
return httpClient
|
|
54
|
+
.post('/auth/access-token', {
|
|
55
|
+
client_id: clientId,
|
|
56
|
+
client_secret: clientSecret,
|
|
57
|
+
grant_type: 'client_credentials',
|
|
58
|
+
scope: scopes.join(','),
|
|
59
|
+
})
|
|
60
|
+
.then(({ access_token, expires_in }) => {
|
|
61
|
+
(0, tiny_invariant_1.default)(access_token, 'access token should be defined');
|
|
62
|
+
(0, tiny_invariant_1.default)(expires_in, 'expires_in should be defined');
|
|
63
|
+
_auth = {
|
|
64
|
+
token: access_token,
|
|
65
|
+
expiresIn: expires_in,
|
|
66
|
+
type: types_1.TokenType.API_TOKEN,
|
|
67
|
+
};
|
|
68
|
+
// https://github.com/axios/axios#custom-instance-defaults
|
|
69
|
+
httpClient.defaults.headers.common['Authorization'] = `Bearer ${_auth.token}`;
|
|
70
|
+
return client;
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
withUserToken: async (accessToken) => {
|
|
74
|
+
_auth = {
|
|
75
|
+
token: accessToken,
|
|
76
|
+
type: types_1.TokenType.USER_TOKEN,
|
|
77
|
+
};
|
|
78
|
+
httpClient.defaults.headers.common['Authorization'] = `Bearer ${_auth.token}`;
|
|
79
|
+
return client;
|
|
80
|
+
},
|
|
81
|
+
leads: (0, leads_1.default)(ctx),
|
|
82
|
+
channels: (0, channels_1.default)(ctx),
|
|
83
|
+
estates: (0, estates_1.default)(ctx),
|
|
84
|
+
channelAccounts: (0, channel_accounts_1.default)(ctx),
|
|
85
|
+
companies: (0, companies_1.default)(ctx),
|
|
86
|
+
contacts: (0, contacts_1.default)(ctx),
|
|
87
|
+
contactPreferences: (0, contact_preferences_1.default)(ctx),
|
|
88
|
+
negotiators: (0, negotiators_1.default)(ctx),
|
|
89
|
+
offices: (0, offices_1.default)(ctx),
|
|
90
|
+
};
|
|
91
|
+
return client;
|
|
92
|
+
}
|
|
93
|
+
exports.createClient = createClient;
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function default_1(ctx) {
|
|
5
|
+
async function getAll({ companyId }) {
|
|
6
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
7
|
+
const endpoint = `/services/companies/${companyId}/channel-accounts`;
|
|
8
|
+
return ctx.httpClient.get(endpoint, {
|
|
9
|
+
params: {
|
|
10
|
+
includes: 'channel',
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async function get({ channelAccountId }) {
|
|
15
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
16
|
+
const endpoint = `/services/channel-accounts/${channelAccountId}`;
|
|
17
|
+
return ctx.httpClient.get(endpoint, {
|
|
18
|
+
params: {
|
|
19
|
+
includes: 'channel',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async function getEstateHash({ estateId, channelAccountId, }) {
|
|
24
|
+
const endpoint = `services/estates/${estateId}/channel-accounts/${channelAccountId}/hash`;
|
|
25
|
+
const response = await ctx.httpClient.post(endpoint);
|
|
26
|
+
return response.data;
|
|
27
|
+
}
|
|
28
|
+
return { getAll, get, getEstateHash };
|
|
29
|
+
}
|
|
30
|
+
exports.default = default_1;
|
|
31
|
+
//# sourceMappingURL=channel_accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel_accounts.js","sourceRoot":"","sources":["../../../src/resources/channel_accounts.ts"],"names":[],"mappings":";;AAAA,oCAAgD;AAEhD,mBAAyB,GAAc;IACrC,KAAK,UAAU,MAAM,CAAC,EAAE,SAAS,EAAyB;QACxD,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,uBAAuB,SAAS,mBAAmB,CAAC;QAErE,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE;YAClC,MAAM,EAAE;gBACN,QAAQ,EAAE,SAAS;aACpB;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,UAAU,GAAG,CAAC,EAAE,gBAAgB,EAAgC;QACnE,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,8BAA8B,gBAAgB,EAAE,CAAC;QAElE,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE;YAClC,MAAM,EAAE;gBACN,QAAQ,EAAE,SAAS;aACpB;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,UAAU,aAAa,CAAC,EAC3B,QAAQ,EACR,gBAAgB,GAIjB;QACC,MAAM,QAAQ,GAAG,oBAAoB,QAAQ,qBAAqB,gBAAgB,OAAO,CAAC;QAC1F,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAW,CAAC;AACjD,CAAC;AApCD,4BAoCC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function default_1(ctx) {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use channels.resolveReferences()
|
|
7
|
+
*/
|
|
8
|
+
async function getPropertyIdFromReference(channel, referenceId) {
|
|
9
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
10
|
+
const endpoint = `/channels/${channel}/channel-references/${referenceId}`;
|
|
11
|
+
return ctx.httpClient.get(endpoint);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @param channel_id Channel ID, for example, `"immoweb"` or `"immovlan"` etc
|
|
15
|
+
* @param reference_code Reference
|
|
16
|
+
* @param company_id Company ID
|
|
17
|
+
*/
|
|
18
|
+
async function resolveReferences(channel_id, reference_code, company_id) {
|
|
19
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
20
|
+
const endpoint = `/services/channel-references`;
|
|
21
|
+
return ctx.httpClient.get(endpoint, {
|
|
22
|
+
params: {
|
|
23
|
+
channel_id,
|
|
24
|
+
reference_code,
|
|
25
|
+
company_id,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return { getPropertyIdFromReference, resolveReferences };
|
|
30
|
+
}
|
|
31
|
+
exports.default = default_1;
|
|
32
|
+
//# sourceMappingURL=channels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channels.js","sourceRoot":"","sources":["../../../src/resources/channels.ts"],"names":[],"mappings":";;AAAA,oCAAgD;AAchD,mBAAyB,GAAc;IACrC;;OAEG;IACH,KAAK,UAAU,0BAA0B,CACvC,OAAe,EACf,WAAmB;QAEnB,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,aAAa,OAAO,uBAAuB,WAAW,EAAE,CAAC;QAE1E,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED;;;;OAIG;IACH,KAAK,UAAU,iBAAiB,CAC9B,UAAkB,EAClB,cAAsB,EACtB,UAAmB;QAEnB,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,8BAA8B,CAAC;QAEhD,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE;YAClC,MAAM,EAAE;gBACN,UAAU;gBACV,cAAc;gBACd,UAAU;aACX;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,CAAC;AAC3D,CAAC;AArCD,4BAqCC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function default_1(ctx) {
|
|
5
|
+
function get(attributes) {
|
|
6
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
7
|
+
return ctx.httpClient.get(`/companies/${attributes.companyId}`, {
|
|
8
|
+
params: {
|
|
9
|
+
includes: attributes.includes?.join(','),
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return { get };
|
|
14
|
+
}
|
|
15
|
+
exports.default = default_1;
|
|
16
|
+
//# sourceMappingURL=companies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companies.js","sourceRoot":"","sources":["../../../src/resources/companies.ts"],"names":[],"mappings":";;AAAA,oCAAgD;AAEhD,mBAAyB,GAAc;IACrC,SAAS,GAAG,CAAC,UAAsD;QACjE,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QAEnC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,UAAU,CAAC,SAAS,EAAE,EAAE;YAC9D,MAAM,EAAE;gBACN,QAAQ,EAAE,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC;aACzC;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,CAAC;AACjB,CAAC;AAZD,4BAYC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function contact_preferences(ctx) {
|
|
5
|
+
function getAll(attributes) {
|
|
6
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
7
|
+
return ctx.httpClient.get(`/services/contacts/${attributes.contactId}/preferences`);
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
getAll,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.default = contact_preferences;
|
|
14
|
+
//# sourceMappingURL=contact_preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact_preferences.js","sourceRoot":"","sources":["../../../src/resources/contact_preferences.ts"],"names":[],"mappings":";;AAAA,oCAAgD;AAEhD,SAAwB,mBAAmB,CAAC,GAAc;IACxD,SAAS,MAAM,CAAC,UAAiC;QAC/C,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CACvB,sBAAsB,UAAU,CAAC,SAAS,cAAc,CACzD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAXD,sCAWC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function default_1(ctx) {
|
|
5
|
+
function getOne(attributes) {
|
|
6
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
7
|
+
return ctx.httpClient.get(`/services/contacts/${attributes.contactId}`);
|
|
8
|
+
}
|
|
9
|
+
function getOneWithNegotiators(attributes) {
|
|
10
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
11
|
+
return ctx.httpClient.get(`/services/contacts/${attributes.contactId}?includes=negotiators`);
|
|
12
|
+
}
|
|
13
|
+
function getAll(attributes) {
|
|
14
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
15
|
+
return ctx.httpClient.get(`/services/companies/${attributes.companyId}/contacts`, {
|
|
16
|
+
params: {
|
|
17
|
+
page: attributes.page ?? 1,
|
|
18
|
+
limit: attributes.limit ?? 10,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
getOne,
|
|
24
|
+
getOneWithNegotiators,
|
|
25
|
+
getAll,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.default = default_1;
|
|
29
|
+
//# sourceMappingURL=contacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../../../src/resources/contacts.ts"],"names":[],"mappings":";;AAAA,oCAAgD;AAEhD,mBAAyB,GAAc;IACrC,SAAS,MAAM,CAAC,UAAiC;QAC/C,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,sBAAsB,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,SAAS,qBAAqB,CAAC,UAAiC;QAC9D,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CACvB,sBAAsB,UAAU,CAAC,SAAS,uBAAuB,CAClE,CAAC;IACJ,CAAC;IAED,SAAS,MAAM,CAAC,UAIf;QACC,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CACvB,uBAAuB,UAAU,CAAC,SAAS,WAAW,EACtD;YACE,MAAM,EAAE;gBACN,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,CAAC;gBAC1B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE;aAC9B;SACF,CACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM;QACN,qBAAqB;QACrB,MAAM;KACP,CAAC;AACJ,CAAC;AAnCD,4BAmCC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function default_1(ctx) {
|
|
5
|
+
function getOne(attributes) {
|
|
6
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
7
|
+
return ctx.httpClient
|
|
8
|
+
.get(`/services/estates/${attributes.estateId}`, {
|
|
9
|
+
params: {
|
|
10
|
+
includes: attributes.includes ?? [],
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
.then((res) => res.data);
|
|
14
|
+
}
|
|
15
|
+
function getAll(attributes) {
|
|
16
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
17
|
+
return ctx.httpClient.get(`/services/companies/${attributes.companyId}/estates`, {
|
|
18
|
+
params: {
|
|
19
|
+
page: attributes.page ?? 1,
|
|
20
|
+
limit: attributes.limit ?? 10,
|
|
21
|
+
archived: attributes.archived,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function getUnits(projectId, { page, limit, includes } = {}) {
|
|
26
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
27
|
+
return ctx.httpClient.get(`/services/projects/${projectId}/units`, {
|
|
28
|
+
params: {
|
|
29
|
+
page,
|
|
30
|
+
limit,
|
|
31
|
+
includes,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function createPublication(attributes) {
|
|
36
|
+
ctx.checkAuth(types_1.TokenType.USER_TOKEN);
|
|
37
|
+
return ctx.httpClient.post(`/estates/${attributes.estateId}/channel-accounts/${attributes.channelAccountId}/ads`, {
|
|
38
|
+
config: attributes.config,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function updatePublication(attributes) {
|
|
42
|
+
ctx.checkAuth(types_1.TokenType.USER_TOKEN);
|
|
43
|
+
return ctx.httpClient.put(`/estates/${attributes.estateId}/channel-accounts/${attributes.channelAccountId}/ads`, {
|
|
44
|
+
config: attributes.config,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function unpublishPublication(attributes) {
|
|
48
|
+
ctx.checkAuth(types_1.TokenType.USER_TOKEN);
|
|
49
|
+
return ctx.httpClient.delete(`/estates/${attributes.estateId}/channel-accounts/${attributes.channelAccountId}/ads`);
|
|
50
|
+
}
|
|
51
|
+
function scheduleVisit(estateId, attributes) {
|
|
52
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
53
|
+
return ctx.httpClient.put(`/properties/${estateId}/schedule-visit`, attributes);
|
|
54
|
+
}
|
|
55
|
+
function unstable_setPublicationUrl({ estateId, url, }) {
|
|
56
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
57
|
+
return ctx.httpClient.put(`/estates/${estateId}/website-url`, {
|
|
58
|
+
published_url: url,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
getOne,
|
|
63
|
+
getAll,
|
|
64
|
+
getUnits,
|
|
65
|
+
createPublication,
|
|
66
|
+
updatePublication,
|
|
67
|
+
unpublishPublication,
|
|
68
|
+
scheduleVisit,
|
|
69
|
+
unstable_setPublicationUrl,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
exports.default = default_1;
|
|
73
|
+
//# sourceMappingURL=estates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estates.js","sourceRoot":"","sources":["../../../src/resources/estates.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function default_1(ctx) {
|
|
5
|
+
function createLead(attributes) {
|
|
6
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
7
|
+
const { firstName, lastName, propertyId, email, phone, message, portal } = attributes;
|
|
8
|
+
return ctx.httpClient.put(`estates/${propertyId}/leads`, {
|
|
9
|
+
first_name: firstName,
|
|
10
|
+
last_name: lastName,
|
|
11
|
+
message,
|
|
12
|
+
email,
|
|
13
|
+
phone,
|
|
14
|
+
source_type: 'channel',
|
|
15
|
+
external_source: portal,
|
|
16
|
+
location_preference: attributes.location_preference,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function createUnassignedLead(companyId, attributes) {
|
|
20
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
21
|
+
return ctx.httpClient.put(`companies/${companyId}/leads`, attributes);
|
|
22
|
+
}
|
|
23
|
+
return { createLead, createUnassignedLead };
|
|
24
|
+
}
|
|
25
|
+
exports.default = default_1;
|
|
26
|
+
//# sourceMappingURL=leads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leads.js","sourceRoot":"","sources":["../../../src/resources/leads.ts"],"names":[],"mappings":";;AAAA,oCAAgD;AAEhD,mBAAyB,GAAc;IACrC,SAAS,UAAU,CAAC,UAYnB;QACC,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QAEnC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GACtE,UAAU,CAAC;QAEb,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,WAAW,UAAU,QAAQ,EAAE;YACvD,UAAU,EAAE,SAAS;YACrB,SAAS,EAAE,QAAQ;YACnB,OAAO;YACP,KAAK;YACL,KAAK;YACL,WAAW,EAAE,SAAS;YACtB,eAAe,EAAE,MAAM;YACvB,mBAAmB,EAAE,UAAU,CAAC,mBAAmB;SACpD,CAAC,CAAC;IACL,CAAC;IAED,SAAS,oBAAoB,CAC3B,SAAiB,EACjB,UAsBC;QAED,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,SAAS,QAAQ,EAAE,UAAU,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;AAC9C,CAAC;AA9DD,4BA8DC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function default_1(ctx) {
|
|
5
|
+
function getNegotiatorsByIdCompanyId(attributes) {
|
|
6
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
7
|
+
return ctx.httpClient.get(`/services/companies/${attributes.companyId}/negotiators`, {
|
|
8
|
+
params: { ids: attributes.ids },
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
getNegotiatorsByIdCompanyId,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.default = default_1;
|
|
16
|
+
//# sourceMappingURL=negotiators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiators.js","sourceRoot":"","sources":["../../../src/resources/negotiators.ts"],"names":[],"mappings":";;AAAA,oCAAgE;AAEhE,mBAAyB,GAAc;IACrC,SAAS,2BAA2B,CAAC,UAGpC;QACC,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CACvB,uBAAuB,UAAU,CAAC,SAAS,cAAc,EACzD;YACE,MAAM,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE;SAChC,CACgD,CAAC;IACtD,CAAC;IACD,OAAO;QACL,2BAA2B;KAC5B,CAAC;AACJ,CAAC;AAhBD,4BAgBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const types_1 = require("../types");
|
|
4
|
+
function default_1(ctx) {
|
|
5
|
+
function getOffice(attributes) {
|
|
6
|
+
ctx.checkAuth(types_1.TokenType.API_TOKEN);
|
|
7
|
+
return ctx.httpClient.get(`/service/offices/${attributes.officeId}`);
|
|
8
|
+
}
|
|
9
|
+
return { getOffice };
|
|
10
|
+
}
|
|
11
|
+
exports.default = default_1;
|
|
12
|
+
//# sourceMappingURL=offices.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offices.js","sourceRoot":"","sources":["../../../src/resources/offices.ts"],"names":[],"mappings":";;AACA,oCAAgD;AAEhD,mBAAyB,GAAc;IACrC,SAAS,SAAS,CAAC,UAAgC;QACjD,GAAG,CAAC,SAAS,CAAC,iBAAS,CAAC,SAAS,CAAC,CAAC;QAEnC,OAAO,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,oBAAoB,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,CAAC;AACvB,CAAC;AARD,4BAQC"}
|
|
@@ -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/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.30.
|
|
2
|
+
"version": "0.30.6",
|
|
3
3
|
"license": "UNLICENCED",
|
|
4
|
-
"main": "/src/index.js",
|
|
5
|
-
"typings": "/src/types.js",
|
|
4
|
+
"main": "./dist/src/index.js",
|
|
5
|
+
"typings": "./dist/src/types.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"node_modules"
|
|
9
|
+
],
|
|
6
10
|
"scripts": {
|
|
7
11
|
"build": "yarn tsc",
|
|
8
12
|
"test": "yarn jest --forceExit --detectOpenHandles",
|
package/.circleci/config.yml
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
version: 2.1
|
|
2
|
-
|
|
3
|
-
executors:
|
|
4
|
-
node:
|
|
5
|
-
docker:
|
|
6
|
-
- image: cimg/node:16.15.0
|
|
7
|
-
|
|
8
|
-
x-definitions:
|
|
9
|
-
- &filters-only-tags
|
|
10
|
-
branches:
|
|
11
|
-
ignore: /.*/
|
|
12
|
-
tags:
|
|
13
|
-
only: /^v.*/
|
|
14
|
-
- &filters-any
|
|
15
|
-
branches:
|
|
16
|
-
only: /.*/
|
|
17
|
-
tags:
|
|
18
|
-
only: /^v.*/
|
|
19
|
-
|
|
20
|
-
jobs:
|
|
21
|
-
|
|
22
|
-
build:
|
|
23
|
-
executor: node
|
|
24
|
-
steps:
|
|
25
|
-
- checkout
|
|
26
|
-
- restore_cache:
|
|
27
|
-
keys:
|
|
28
|
-
- yarn-v1-{{ checksum "yarn.lock" }}
|
|
29
|
-
- yarn-v1-
|
|
30
|
-
- run:
|
|
31
|
-
name: Authenticate with registry
|
|
32
|
-
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
|
33
|
-
- run: yarn install
|
|
34
|
-
- save_cache:
|
|
35
|
-
key: yarn-v1-{{ checksum "yarn.lock" }}
|
|
36
|
-
paths:
|
|
37
|
-
- node_modules
|
|
38
|
-
- persist_to_workspace:
|
|
39
|
-
root: ~/project
|
|
40
|
-
paths:
|
|
41
|
-
- .
|
|
42
|
-
- run: yarn build
|
|
43
|
-
- run:
|
|
44
|
-
name: List build artifacts
|
|
45
|
-
command: ls -al ~/project/dist
|
|
46
|
-
|
|
47
|
-
lint:
|
|
48
|
-
executor: node
|
|
49
|
-
steps:
|
|
50
|
-
- attach_workspace:
|
|
51
|
-
at: ~/project
|
|
52
|
-
- run: yarn lint
|
|
53
|
-
|
|
54
|
-
test:
|
|
55
|
-
executor: node
|
|
56
|
-
steps:
|
|
57
|
-
- attach_workspace:
|
|
58
|
-
at: ~/project
|
|
59
|
-
- run: yarn test
|
|
60
|
-
|
|
61
|
-
deploy:
|
|
62
|
-
executor: node
|
|
63
|
-
steps:
|
|
64
|
-
- attach_workspace:
|
|
65
|
-
at: ~/project
|
|
66
|
-
- run:
|
|
67
|
-
name: Authenticate with registry
|
|
68
|
-
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
|
|
69
|
-
- run:
|
|
70
|
-
name: List build artifacts
|
|
71
|
-
command: ls -al ~/project
|
|
72
|
-
- run:
|
|
73
|
-
name: Publish package
|
|
74
|
-
command: yarn publish
|
|
75
|
-
|
|
76
|
-
workflows:
|
|
77
|
-
version: 2
|
|
78
|
-
test-deploy:
|
|
79
|
-
jobs:
|
|
80
|
-
- build:
|
|
81
|
-
context: npm-context
|
|
82
|
-
filters: *filters-any
|
|
83
|
-
- lint:
|
|
84
|
-
context: npm-context
|
|
85
|
-
filters: *filters-any
|
|
86
|
-
requires:
|
|
87
|
-
- build
|
|
88
|
-
- test:
|
|
89
|
-
context: npm-context
|
|
90
|
-
filters: *filters-any
|
|
91
|
-
requires:
|
|
92
|
-
- lint
|
|
93
|
-
- approve:
|
|
94
|
-
name: approve
|
|
95
|
-
type: approval
|
|
96
|
-
filters: *filters-any
|
|
97
|
-
- deploy:
|
|
98
|
-
context: npm-publish
|
|
99
|
-
requires:
|
|
100
|
-
- test
|
|
101
|
-
- approve
|
|
102
|
-
filters: *filters-any
|
package/.devcontainer/Dockerfile
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/typescript-node/.devcontainer/base.Dockerfile
|
|
2
|
-
|
|
3
|
-
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster
|
|
4
|
-
ARG VARIANT="14-bullseye"
|
|
5
|
-
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
|
|
6
|
-
|
|
7
|
-
# Add repository for GitHub CLI
|
|
8
|
-
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
|
|
9
|
-
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
|
10
|
-
|
|
11
|
-
# [Optional] Uncomment this section to install additional OS packages.
|
|
12
|
-
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|
13
|
-
&& apt-get -y install --no-install-recommends python2 htop mc gh
|
|
14
|
-
|
|
15
|
-
# Install Phrase client binary
|
|
16
|
-
RUN wget https://github.com/phrase/phrase-cli/releases/download/2.3.0/phrase_linux_amd64 -O /usr/bin/phrase && chmod a+x /usr/bin/phrase
|
|
17
|
-
|
|
18
|
-
# [Optional] Uncomment if you want to install an additional version of node using nvm
|
|
19
|
-
# ARG EXTRA_NODE_VERSION=10
|
|
20
|
-
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
|
21
|
-
|
|
22
|
-
# [Optional] Uncomment if you want to install more global node packages
|
|
23
|
-
# RUN su node -c "npm install -g <your-package-list -here>"
|