@bisondesk/commons-sdk 1.0.274 → 1.0.276
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/lib/becris.js +3 -0
- package/lib/becris.js.map +1 -0
- package/lib/cjs/becris.js +3 -0
- package/lib/cjs/becris.js.map +1 -0
- package/lib/cjs/constants.js +103 -0
- package/lib/cjs/constants.js.map +1 -0
- package/lib/cjs/dayjs-utils.js +26 -0
- package/lib/cjs/dayjs-utils.js.map +1 -0
- package/lib/cjs/discussions.js +5 -0
- package/lib/cjs/discussions.js.map +1 -0
- package/lib/cjs/errors.js +67 -0
- package/lib/cjs/errors.js.map +1 -0
- package/lib/cjs/exact.js +3 -0
- package/lib/cjs/exact.js.map +1 -0
- package/lib/cjs/fetch.js +21 -0
- package/lib/cjs/fetch.js.map +1 -0
- package/lib/cjs/ids.js +35 -0
- package/lib/cjs/ids.js.map +1 -0
- package/lib/cjs/insurance.js +3 -0
- package/lib/cjs/insurance.js.map +1 -0
- package/lib/cjs/location-utils.js +11 -0
- package/lib/cjs/location-utils.js.map +1 -0
- package/lib/cjs/locations.js +95 -0
- package/lib/cjs/locations.js.map +1 -0
- package/lib/cjs/messages.js +3 -0
- package/lib/cjs/messages.js.map +1 -0
- package/lib/cjs/notifications.js +13 -0
- package/lib/cjs/notifications.js.map +1 -0
- package/lib/cjs/pdf-gen.js +3 -0
- package/lib/cjs/pdf-gen.js.map +1 -0
- package/lib/cjs/storage.js +14 -0
- package/lib/cjs/storage.js.map +1 -0
- package/lib/cjs/types.js +8 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/constants.js +103 -0
- package/lib/constants.js.map +1 -0
- package/lib/dayjs-utils.js +25 -0
- package/lib/dayjs-utils.js.map +1 -0
- package/lib/discussions.js +5 -0
- package/lib/discussions.js.map +1 -0
- package/lib/errors.js +67 -0
- package/lib/errors.js.map +1 -0
- package/lib/esm/becris.js +2 -0
- package/lib/esm/becris.js.map +1 -0
- package/lib/esm/constants.js +100 -0
- package/lib/esm/constants.js.map +1 -0
- package/lib/esm/dayjs-utils.js +18 -0
- package/lib/esm/dayjs-utils.js.map +1 -0
- package/lib/esm/discussions.js +2 -0
- package/lib/esm/discussions.js.map +1 -0
- package/lib/esm/errors.js +57 -0
- package/lib/esm/errors.js.map +1 -0
- package/lib/esm/exact.js +2 -0
- package/lib/esm/exact.js.map +1 -0
- package/lib/esm/fetch.js +16 -0
- package/lib/esm/fetch.js.map +1 -0
- package/lib/esm/ids.js +31 -0
- package/lib/esm/ids.js.map +1 -0
- package/lib/esm/insurance.js +2 -0
- package/lib/esm/insurance.js.map +1 -0
- package/lib/esm/location-utils.js +7 -0
- package/lib/esm/location-utils.js.map +1 -0
- package/lib/esm/locations.js +90 -0
- package/lib/esm/locations.js.map +1 -0
- package/lib/esm/messages.js +2 -0
- package/lib/esm/messages.js.map +1 -0
- package/lib/esm/notifications.js +10 -0
- package/lib/esm/notifications.js.map +1 -0
- package/lib/esm/pdf-gen.js +2 -0
- package/lib/esm/pdf-gen.js.map +1 -0
- package/lib/esm/storage.js +11 -0
- package/lib/esm/storage.js.map +1 -0
- package/lib/esm/types.js +5 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/exact.js +3 -0
- package/lib/exact.js.map +1 -0
- package/lib/fetch.js +20 -0
- package/lib/fetch.js.map +1 -0
- package/lib/ids.js +35 -0
- package/lib/ids.js.map +1 -0
- package/lib/insurance.js +3 -0
- package/lib/insurance.js.map +1 -0
- package/lib/location-utils.js +11 -0
- package/lib/location-utils.js.map +1 -0
- package/lib/locations.js +95 -0
- package/lib/locations.js.map +1 -0
- package/lib/messages.js +3 -0
- package/lib/messages.js.map +1 -0
- package/lib/notifications.js +13 -0
- package/lib/notifications.js.map +1 -0
- package/lib/pdf-gen.js +3 -0
- package/lib/pdf-gen.js.map +1 -0
- package/lib/storage.js +14 -0
- package/lib/storage.js.map +1 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -0
- package/lib/types/becris.d.ts +40 -0
- package/lib/types/becris.d.ts.map +1 -0
- package/lib/types/constants.d.ts +55 -0
- package/lib/types/constants.d.ts.map +1 -0
- package/lib/types/dayjs-utils.d.ts +8 -0
- package/lib/types/dayjs-utils.d.ts.map +1 -0
- package/lib/types/discussions.d.ts +43 -0
- package/lib/types/discussions.d.ts.map +1 -0
- package/lib/types/errors.d.ts +36 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/exact.d.ts +10 -0
- package/lib/types/exact.d.ts.map +1 -0
- package/lib/types/fetch.d.ts +3 -0
- package/lib/types/fetch.d.ts.map +1 -0
- package/lib/types/ids.d.ts +9 -0
- package/lib/types/ids.d.ts.map +1 -0
- package/lib/types/insurance.d.ts +20 -0
- package/lib/types/insurance.d.ts.map +1 -0
- package/lib/types/location-utils.d.ts +3 -0
- package/lib/types/location-utils.d.ts.map +1 -0
- package/lib/types/locations.d.ts +34 -0
- package/lib/types/locations.d.ts.map +1 -0
- package/lib/types/messages.d.ts +57 -0
- package/lib/types/messages.d.ts.map +1 -0
- package/lib/types/notifications.d.ts +51 -0
- package/lib/types/notifications.d.ts.map +1 -0
- package/lib/types/pdf-gen.d.ts +40 -0
- package/lib/types/pdf-gen.d.ts.map +1 -0
- package/lib/types/storage.d.ts +63 -0
- package/lib/types/storage.d.ts.map +1 -0
- package/lib/types/types.d.ts +124 -0
- package/lib/types/types.d.ts.map +1 -0
- package/lib/types.js +8 -0
- package/lib/types.js.map +1 -0
- package/package.json +1 -1
- package/src/constants.ts +2 -1
- package/tsconfig.tsbuildinfo +1 -0
package/lib/constants.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_SLB_PARTNER = exports.HEXON_LANG_CODES = exports.EU_VAT_COUNTRY_CODES = exports.SALES_QUOTE_AGREEMENT_TEMPLATE_GROUP_ID = exports.SALES_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = exports.LEASING_CONTRACT_TC_TEMPLATE_GROUP_ID = exports.LEASING_CONTRACT_AMORTIZATION_TEMPLATE_GROUP_ID = exports.LEASING_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = exports.LEASING_QUOTE_TEMPLATE_GROUP_ID = exports.BusinessEntityIds = exports.SYSTEM_USER_ID = exports.NO_TENANT_ID_VALUE = exports.SERVICE_ID_ADMIN_HEADER = exports.TENANT_ID_ADMIN_HEADER = exports.SUPPORTED_LANGUAGES = exports.TopLevelActions = exports.AppRoles = void 0;
|
|
4
|
+
var AppRoles;
|
|
5
|
+
(function (AppRoles) {
|
|
6
|
+
AppRoles["Accountant"] = "accountant";
|
|
7
|
+
AppRoles["Admin"] = "admins";
|
|
8
|
+
AppRoles["Administrative"] = "administrative";
|
|
9
|
+
AppRoles["Commercial"] = "commercial";
|
|
10
|
+
AppRoles["Manager"] = "manager";
|
|
11
|
+
AppRoles["ParkLogistics"] = "park_logistics";
|
|
12
|
+
AppRoles["AppManager"] = "app_manager";
|
|
13
|
+
})(AppRoles = exports.AppRoles || (exports.AppRoles = {}));
|
|
14
|
+
var TopLevelActions;
|
|
15
|
+
(function (TopLevelActions) {
|
|
16
|
+
TopLevelActions["AdministrationAll"] = "admin:*";
|
|
17
|
+
TopLevelActions["DocumentsBrowse"] = "docs:finance:browse";
|
|
18
|
+
TopLevelActions["LeasingDebtorsView"] = "leasing:debtors:view";
|
|
19
|
+
TopLevelActions["LeasingOverduesView"] = "leasing:overdues:view";
|
|
20
|
+
TopLevelActions["LeasingContractsExport"] = "leasing:contracts:export";
|
|
21
|
+
TopLevelActions["LeasingDebtorsExport"] = "leasing:debtors:export";
|
|
22
|
+
TopLevelActions["MarketBrowse"] = "market:browse";
|
|
23
|
+
TopLevelActions["MarketInsights"] = "insights:market";
|
|
24
|
+
TopLevelActions["VehicleInsights"] = "insights:vehicle";
|
|
25
|
+
TopLevelActions["SettingsAll"] = "settings:*";
|
|
26
|
+
TopLevelActions["VehicleCreate"] = "vehicle:create";
|
|
27
|
+
TopLevelActions["TrackAndTraceDevices"] = "tt:devices:*";
|
|
28
|
+
})(TopLevelActions = exports.TopLevelActions || (exports.TopLevelActions = {}));
|
|
29
|
+
exports.SUPPORTED_LANGUAGES = ['en', 'fr', 'nl', 'es'];
|
|
30
|
+
exports.TENANT_ID_ADMIN_HEADER = 'tenant-id';
|
|
31
|
+
exports.SERVICE_ID_ADMIN_HEADER = 'service-id';
|
|
32
|
+
exports.NO_TENANT_ID_VALUE = 'notenant';
|
|
33
|
+
exports.SYSTEM_USER_ID = 'system';
|
|
34
|
+
var BusinessEntityIds;
|
|
35
|
+
(function (BusinessEntityIds) {
|
|
36
|
+
BusinessEntityIds["BecrisDeclarations"] = "becris_declarations";
|
|
37
|
+
BusinessEntityIds["Contacts"] = "contacts";
|
|
38
|
+
BusinessEntityIds["Emails"] = "emails";
|
|
39
|
+
BusinessEntityIds["FinanceDocuments"] = "finance_documents";
|
|
40
|
+
BusinessEntityIds["InternetVehicles"] = "internet-vehicles";
|
|
41
|
+
BusinessEntityIds["Leads"] = "leads";
|
|
42
|
+
BusinessEntityIds["LeasingContracts"] = "leasing_contracts";
|
|
43
|
+
BusinessEntityIds["LeasingUploadAutomation"] = "leasing_upload_automation";
|
|
44
|
+
BusinessEntityIds["Opportunities"] = "opportunities";
|
|
45
|
+
BusinessEntityIds["Organizations"] = "organizations";
|
|
46
|
+
BusinessEntityIds["PdfTemplates"] = "pdf_templates";
|
|
47
|
+
BusinessEntityIds["Users"] = "users";
|
|
48
|
+
BusinessEntityIds["Vehicles"] = "vehicles";
|
|
49
|
+
BusinessEntityIds["VehiclesPriceLists"] = "vehicles_price_lists";
|
|
50
|
+
BusinessEntityIds["Debtors"] = "debtors";
|
|
51
|
+
})(BusinessEntityIds = exports.BusinessEntityIds || (exports.BusinessEntityIds = {}));
|
|
52
|
+
exports.LEASING_QUOTE_TEMPLATE_GROUP_ID = 'leasing_quote_template';
|
|
53
|
+
exports.LEASING_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = 'leasing_quote_proforma_template';
|
|
54
|
+
exports.LEASING_CONTRACT_AMORTIZATION_TEMPLATE_GROUP_ID = 'leasing_contract_amortization_template';
|
|
55
|
+
exports.LEASING_CONTRACT_TC_TEMPLATE_GROUP_ID = 'leasing_contract_tc_template';
|
|
56
|
+
exports.SALES_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = 'sales_quote_proforma_template';
|
|
57
|
+
exports.SALES_QUOTE_AGREEMENT_TEMPLATE_GROUP_ID = 'sales_quote_agreement_template';
|
|
58
|
+
exports.EU_VAT_COUNTRY_CODES = [
|
|
59
|
+
'at',
|
|
60
|
+
'be',
|
|
61
|
+
'bg',
|
|
62
|
+
'hr',
|
|
63
|
+
'cy',
|
|
64
|
+
'cz',
|
|
65
|
+
'dk',
|
|
66
|
+
'ee',
|
|
67
|
+
'fi',
|
|
68
|
+
'fr',
|
|
69
|
+
'de',
|
|
70
|
+
'el',
|
|
71
|
+
'hu',
|
|
72
|
+
'ie',
|
|
73
|
+
'it',
|
|
74
|
+
'lv',
|
|
75
|
+
'lt',
|
|
76
|
+
'lu',
|
|
77
|
+
'mt',
|
|
78
|
+
'nl',
|
|
79
|
+
'pl',
|
|
80
|
+
'pt',
|
|
81
|
+
'ro',
|
|
82
|
+
'sk',
|
|
83
|
+
'si',
|
|
84
|
+
'es',
|
|
85
|
+
'se',
|
|
86
|
+
'xi',
|
|
87
|
+
];
|
|
88
|
+
exports.HEXON_LANG_CODES = [
|
|
89
|
+
'en',
|
|
90
|
+
'nl',
|
|
91
|
+
'de',
|
|
92
|
+
'fr',
|
|
93
|
+
'es',
|
|
94
|
+
'pt',
|
|
95
|
+
'it',
|
|
96
|
+
'pl',
|
|
97
|
+
'ru',
|
|
98
|
+
'ro',
|
|
99
|
+
'el',
|
|
100
|
+
'bg',
|
|
101
|
+
];
|
|
102
|
+
exports.DEFAULT_SLB_PARTNER = 'To be announced';
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B,oCAAe,CAAA;IACf,0CAAqB,CAAA;IACrB,gEAA2C,CAAA;IAC3C,wCAAmB,CAAA;AACrB,CAAC,EAhBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAgB5B;AAKY,QAAA,+BAA+B,GAAG,wBAAwB,CAAC;AAC3D,QAAA,wCAAwC,GAAG,iCAAiC,CAAC;AAC7E,QAAA,+CAA+C,GAC1D,wCAAwC,CAAC;AAC9B,QAAA,qCAAqC,GAAG,8BAA8B,CAAC;AACvE,QAAA,sCAAsC,GAAG,+BAA+B,CAAC;AACzE,QAAA,uCAAuC,GAAG,gCAAgC,CAAC;AAK3E,QAAA,oBAAoB,GAAG;IAClC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACL,CAAC;AAEW,QAAA,gBAAgB,GAA0B;IACrD,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACL,CAAC;AAEW,QAAA,mBAAmB,GAAG,iBAAiB,CAAC","sourcesContent":["//\n// STATIC ROLES\n//\nexport enum AppRoles {\n Accountant = 'accountant',\n Admin = 'admins',\n Administrative = 'administrative',\n Commercial = 'commercial',\n Manager = 'manager',\n ParkLogistics = 'park_logistics',\n AppManager = 'app_manager',\n}\n\nexport enum TopLevelActions {\n AdministrationAll = 'admin:*',\n DocumentsBrowse = 'docs:finance:browse',\n LeasingDebtorsView = 'leasing:debtors:view',\n LeasingOverduesView = 'leasing:overdues:view',\n LeasingContractsExport = 'leasing:contracts:export',\n LeasingDebtorsExport = 'leasing:debtors:export',\n MarketBrowse = 'market:browse',\n MarketInsights = 'insights:market',\n VehicleInsights = 'insights:vehicle',\n SettingsAll = 'settings:*',\n VehicleCreate = 'vehicle:create',\n TrackAndTraceDevices = 'tt:devices:*',\n}\n\n//\n// I18N\n//\nexport const SUPPORTED_LANGUAGES = ['en', 'fr', 'nl', 'es'];\n\n//\n// Headers\n//\nexport const TENANT_ID_ADMIN_HEADER = 'tenant-id';\nexport const SERVICE_ID_ADMIN_HEADER = 'service-id';\n\n//\n// AUTH\n//\nexport const NO_TENANT_ID_VALUE = 'notenant';\nexport const SYSTEM_USER_ID = 'system';\n\n//\n// Business Entity IDs\n//\nexport enum BusinessEntityIds {\n BecrisDeclarations = 'becris_declarations',\n Contacts = 'contacts',\n Emails = 'emails',\n FinanceDocuments = 'finance_documents',\n InternetVehicles = 'internet-vehicles',\n Leads = 'leads',\n LeasingContracts = 'leasing_contracts',\n LeasingUploadAutomation = 'leasing_upload_automation',\n Opportunities = 'opportunities',\n Organizations = 'organizations',\n PdfTemplates = 'pdf_templates',\n Users = 'users',\n Vehicles = 'vehicles',\n VehiclesPriceLists = 'vehicles_price_lists',\n Debtors = 'debtors',\n}\n\n//\n// PDF Templates IDs\n//\nexport const LEASING_QUOTE_TEMPLATE_GROUP_ID = 'leasing_quote_template';\nexport const LEASING_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = 'leasing_quote_proforma_template';\nexport const LEASING_CONTRACT_AMORTIZATION_TEMPLATE_GROUP_ID =\n 'leasing_contract_amortization_template';\nexport const LEASING_CONTRACT_TC_TEMPLATE_GROUP_ID = 'leasing_contract_tc_template';\nexport const SALES_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = 'sales_quote_proforma_template';\nexport const SALES_QUOTE_AGREEMENT_TEMPLATE_GROUP_ID = 'sales_quote_agreement_template';\n\n//\n// VAT Prefixes for EU Countries and Great Britain & Northern Ireland\n//\nexport const EU_VAT_COUNTRY_CODES = [\n 'at',\n 'be',\n 'bg',\n 'hr',\n 'cy',\n 'cz',\n 'dk',\n 'ee',\n 'fi',\n 'fr',\n 'de',\n 'el',\n 'hu',\n 'ie',\n 'it',\n 'lv',\n 'lt',\n 'lu',\n 'mt',\n 'nl',\n 'pl',\n 'pt',\n 'ro',\n 'sk',\n 'si',\n 'es',\n 'se',\n 'xi', // Northern Ireland\n];\n\nexport const HEXON_LANG_CODES: [string, ...string[]] = [\n 'en',\n 'nl',\n 'de',\n 'fr',\n 'es',\n 'pt',\n 'it',\n 'pl',\n 'ru',\n 'ro',\n 'el',\n 'bg',\n];\n\nexport const DEFAULT_SLB_PARTNER = 'To be announced';\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.businessDaysAdd = exports.isBetween = exports.isSameOrBefore = exports.isSameOrAfter = exports.utc = exports.tz = void 0;
|
|
4
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
5
|
+
const dayjs_business_days_1 = __importDefault(require("dayjs-business-days"));
|
|
6
|
+
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
7
|
+
const isoWeek_1 = __importDefault(require("dayjs/plugin/isoWeek"));
|
|
8
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
9
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
10
|
+
dayjs_1.default.extend(dayjs_business_days_1.default);
|
|
11
|
+
dayjs_1.default.extend(isoWeek_1.default);
|
|
12
|
+
dayjs_1.default.extend(customParseFormat_1.default);
|
|
13
|
+
dayjs_1.default.extend(utc_1.default);
|
|
14
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
15
|
+
exports.tz = dayjs_1.default.tz;
|
|
16
|
+
exports.utc = dayjs_1.default.utc;
|
|
17
|
+
const isSameOrAfter = (value, reference) => value.isAfter(reference) || value.isSame(reference);
|
|
18
|
+
exports.isSameOrAfter = isSameOrAfter;
|
|
19
|
+
const isSameOrBefore = (value, reference) => value.isBefore(reference) || value.isSame(reference);
|
|
20
|
+
exports.isSameOrBefore = isSameOrBefore;
|
|
21
|
+
const isBetween = (value, startInclusive, endExclusive) => (0, exports.isSameOrAfter)(value, startInclusive) && value.isBefore(endExclusive);
|
|
22
|
+
exports.isBetween = isBetween;
|
|
23
|
+
const businessDaysAdd = (value, days) => value.businessDaysAdd(days);
|
|
24
|
+
exports.businessDaysAdd = businessDaysAdd;
|
|
25
|
+
//# sourceMappingURL=dayjs-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dayjs-utils.js","sourceRoot":"/","sources":["dayjs-utils.ts"],"names":[],"mappings":";;;AAAA,kDAAqC;AACrC,8EAAoD;AACpD,uFAA+D;AAC/D,mEAA2C;AAC3C,qEAA6C;AAC7C,2DAAwC;AAExC,eAAK,CAAC,MAAM,CAAC,6BAAiB,CAAC,CAAC;AAChC,eAAK,CAAC,MAAM,CAAC,iBAAO,CAAC,CAAC;AACtB,eAAK,CAAC,MAAM,CAAC,2BAAiB,CAAC,CAAC;AAChC,eAAK,CAAC,MAAM,CAAC,aAAQ,CAAC,CAAC;AACvB,eAAK,CAAC,MAAM,CAAC,kBAAQ,CAAC,CAAC;AAIV,QAAA,EAAE,GAAG,eAAK,CAAC,EAAE,CAAC;AAEd,QAAA,GAAG,GAAG,eAAK,CAAC,GAAG,CAAC;AAEtB,MAAM,aAAa,GAAG,CAAC,KAAY,EAAE,SAAgB,EAAW,EAAE,CACvE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AADzC,QAAA,aAAa,iBAC4B;AAE/C,MAAM,cAAc,GAAG,CAAC,KAAY,EAAE,SAAgB,EAAW,EAAE,CACxE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAD1C,QAAA,cAAc,kBAC4B;AAEhD,MAAM,SAAS,GAAG,CAAC,KAAY,EAAE,cAAqB,EAAE,YAAmB,EAAW,EAAE,CAC7F,IAAA,qBAAa,EAAC,KAAK,EAAE,cAAc,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAD1D,QAAA,SAAS,aACiD;AAEhE,MAAM,eAAe,GAAG,CAAC,KAAY,EAAE,IAAY,EAAS,EAAE,CAClE,KAAa,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAD1B,QAAA,eAAe,mBACW","sourcesContent":["import dayjs, { Dayjs } from 'dayjs';\nimport dayjsBusinessDays from 'dayjs-business-days';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport IsoWeek from 'dayjs/plugin/isoWeek';\nimport timezone from 'dayjs/plugin/timezone';\nimport dayjsUtc from 'dayjs/plugin/utc';\n\ndayjs.extend(dayjsBusinessDays);\ndayjs.extend(IsoWeek);\ndayjs.extend(customParseFormat);\ndayjs.extend(dayjsUtc);\ndayjs.extend(timezone);\n\n// Exists only to make Typescript happy, otherwise the build would fail with\n// \"Property 'tz' does not exist on type 'Dayjs'\"\nexport const tz = dayjs.tz;\n\nexport const utc = dayjs.utc;\n\nexport const isSameOrAfter = (value: Dayjs, reference: Dayjs): boolean =>\n value.isAfter(reference) || value.isSame(reference);\n\nexport const isSameOrBefore = (value: Dayjs, reference: Dayjs): boolean =>\n value.isBefore(reference) || value.isSame(reference);\n\nexport const isBetween = (value: Dayjs, startInclusive: Dayjs, endExclusive: Dayjs): boolean =>\n isSameOrAfter(value, startInclusive) && value.isBefore(endExclusive);\n\nexport const businessDaysAdd = (value: Dayjs, days: number): Dayjs =>\n (value as any).businessDaysAdd(days);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discussions.js","sourceRoot":"/","sources":["discussions.ts"],"names":[],"mappings":";;;AAqCa,QAAA,2BAA2B,GAAG,SAAS,CAAC","sourcesContent":["import { BusinessEntityIds } from './constants';\n\nexport type Discussion = {\n businessEntityId: BusinessEntityIds;\n createdAt: string;\n followers: string[];\n id: string;\n recordId: string;\n title?: string;\n};\n\nexport type DiscussionData = {\n discussion: Discussion;\n messages: Message[];\n};\n\nexport type NewDiscussion = {\n businessEntityId: BusinessEntityIds;\n content: MessageContent;\n recordId: string;\n title?: string;\n followers: string[];\n};\n\nexport type Message = {\n author: string;\n content?: MessageContent; // optional if the content is deleted\n createdAt: string;\n deletedAt?: string;\n id: string;\n};\n\nexport type MessageContent = {\n value: string;\n mentions: string[];\n};\n\nexport const MESSAGE_NOTIFICATION_ORIGIN = 'message';\n\nexport type MessageNotificationData = {\n snippet: string;\n id: string;\n mention?: boolean;\n};\n\nexport type NewDiscussionEvent = {\n discussion: NewDiscussion;\n tenantId: string;\n author: string;\n};\n"]}
|
package/lib/errors.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnauthorizedError = exports.InvalidArgumentsError = exports.EntryAlreadyExistsError = exports.ForbiddenError = exports.AsyncStopError = exports.WrappedError = exports.XError = void 0;
|
|
4
|
+
class XError extends Error {
|
|
5
|
+
constructor(message, errorCtx) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'XError';
|
|
8
|
+
this.errorCtx = errorCtx;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.XError = XError;
|
|
12
|
+
class WrappedError extends Error {
|
|
13
|
+
constructor(err, errorCtx) {
|
|
14
|
+
super(err.message);
|
|
15
|
+
this.name = err.name;
|
|
16
|
+
this.stack = err.stack;
|
|
17
|
+
this.errorCtx = errorCtx;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.WrappedError = WrappedError;
|
|
21
|
+
class AsyncStopError extends Error {
|
|
22
|
+
constructor(message) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = 'AsyncStopError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AsyncStopError = AsyncStopError;
|
|
28
|
+
class ForbiddenError extends Error {
|
|
29
|
+
constructor(message) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = 'ForbiddenError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ForbiddenError = ForbiddenError;
|
|
35
|
+
class EntryAlreadyExistsError extends Error {
|
|
36
|
+
constructor(message) {
|
|
37
|
+
super(message);
|
|
38
|
+
this.name = 'EntryAlreadyExistsError';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.EntryAlreadyExistsError = EntryAlreadyExistsError;
|
|
42
|
+
class InvalidArgumentsError extends Error {
|
|
43
|
+
constructor(message, errors, errorCtx) {
|
|
44
|
+
super(message);
|
|
45
|
+
this.isValidation = true;
|
|
46
|
+
this.name = 'InvalidArgumentsError';
|
|
47
|
+
this.errorCtx = errorCtx;
|
|
48
|
+
if (errors != null) {
|
|
49
|
+
this.validationErrors = {
|
|
50
|
+
errors: errors.details.map(({ path, type, message }) => ({
|
|
51
|
+
message,
|
|
52
|
+
path,
|
|
53
|
+
type: type === 'custom' ? message : type,
|
|
54
|
+
})),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.InvalidArgumentsError = InvalidArgumentsError;
|
|
60
|
+
class UnauthorizedError extends Error {
|
|
61
|
+
constructor(message) {
|
|
62
|
+
super(message);
|
|
63
|
+
this.name = 'UnauthorizedError';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
67
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"/","sources":["errors.ts"],"names":[],"mappings":";;;AAEA,MA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,MAAM,IAAI,IAAI,EAAE;YAClB,IAAI,CAAC,gBAAgB,GAAG;gBACtB,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CACxB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAuB,EAAwB,EAAE,CAAC,CAAC;oBACvE,OAAO;oBACP,IAAI;oBACJ,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;iBACzC,CAAC,CACH;aACF,CAAC;SACH;IACH,CAAC;CACF;AAtBD,sDAsBC;AAED,MAAa,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC","sourcesContent":["import { ValidationError, ValidationErrorItem } from 'joi';\n\nexport class XError extends Error {\n errorCtx: any;\n\n constructor(message?: string, errorCtx?: any) {\n super(message);\n this.name = 'XError';\n this.errorCtx = errorCtx;\n }\n}\n\nexport class WrappedError extends Error {\n errorCtx: any;\n\n constructor(err: Error, errorCtx?: any) {\n super(err.message);\n this.name = err.name;\n this.stack = err.stack;\n this.errorCtx = errorCtx;\n }\n}\n\nexport class AsyncStopError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = 'AsyncStopError';\n }\n}\n\nexport class ForbiddenError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = 'ForbiddenError';\n }\n}\n\nexport class EntryAlreadyExistsError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = 'EntryAlreadyExistsError';\n }\n}\n\ntype FieldValidationError = {\n message: string;\n path: Array<string | number>;\n type: string;\n};\nexport class InvalidArgumentsError extends Error {\n validationErrors?: { errors: FieldValidationError[] };\n isValidation = true;\n errorCtx: any;\n\n constructor(message?: string, errors?: ValidationError, errorCtx?: any) {\n super(message);\n this.name = 'InvalidArgumentsError';\n this.errorCtx = errorCtx;\n\n if (errors != null) {\n this.validationErrors = {\n errors: errors.details.map(\n ({ path, type, message }: ValidationErrorItem): FieldValidationError => ({\n message,\n path,\n type: type === 'custom' ? message : type,\n })\n ),\n };\n }\n }\n}\n\nexport class UnauthorizedError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = 'UnauthorizedError';\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"becris.js","sourceRoot":"/","sources":["becris.ts"],"names":[],"mappings":"","sourcesContent":["import { AttachmentValue } from './types';\n\nexport type LeasingCreditorBranch = {\n bciNumber: string;\n vatNumber: string;\n licenceDate: string;\n becrisFirstReportDate: string;\n becrisStartDate: string;\n};\n\nexport type LeasingCreditorSettings = {\n [branchId: string]: LeasingCreditorBranch;\n};\n\nexport type BecrisDeclaration = {\n createdAt: string;\n endDate: string;\n endingInstruments: number;\n existingInstruments: number;\n file: AttachmentValue;\n id: string;\n newInstruments: number;\n startDate: string;\n};\n\nexport type BecrisInstrument = {\n clientId: string;\n clientExternalId: string;\n contractId: string;\n contractNumber: string;\n endDate?: string;\n id: string; // Hyperportal's LCT process id if it exists, otherwise the contract id\n inceptionDate: string;\n instrumentNumber: string;\n legalFinalMaturityDate: string;\n outstandingNominalAmount: string; // updated when creating a new declaration\n settlementDate: string;\n totalCommitmentAmountAtInception: string;\n vatNumber: string;\n\n /**\n * Becris state\n */\n active: boolean; // false if undeclaredAt is not null, useful for filtering in dynamodb\n declaredAt?: string;\n undeclaredAt?: string;\n};\n"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export var AppRoles;
|
|
2
|
+
(function (AppRoles) {
|
|
3
|
+
AppRoles["Accountant"] = "accountant";
|
|
4
|
+
AppRoles["Admin"] = "admins";
|
|
5
|
+
AppRoles["Administrative"] = "administrative";
|
|
6
|
+
AppRoles["Commercial"] = "commercial";
|
|
7
|
+
AppRoles["Manager"] = "manager";
|
|
8
|
+
AppRoles["ParkLogistics"] = "park_logistics";
|
|
9
|
+
AppRoles["AppManager"] = "app_manager";
|
|
10
|
+
})(AppRoles || (AppRoles = {}));
|
|
11
|
+
export var TopLevelActions;
|
|
12
|
+
(function (TopLevelActions) {
|
|
13
|
+
TopLevelActions["AdministrationAll"] = "admin:*";
|
|
14
|
+
TopLevelActions["DocumentsBrowse"] = "docs:finance:browse";
|
|
15
|
+
TopLevelActions["LeasingDebtorsView"] = "leasing:debtors:view";
|
|
16
|
+
TopLevelActions["LeasingOverduesView"] = "leasing:overdues:view";
|
|
17
|
+
TopLevelActions["LeasingContractsExport"] = "leasing:contracts:export";
|
|
18
|
+
TopLevelActions["LeasingDebtorsExport"] = "leasing:debtors:export";
|
|
19
|
+
TopLevelActions["MarketBrowse"] = "market:browse";
|
|
20
|
+
TopLevelActions["MarketInsights"] = "insights:market";
|
|
21
|
+
TopLevelActions["VehicleInsights"] = "insights:vehicle";
|
|
22
|
+
TopLevelActions["SettingsAll"] = "settings:*";
|
|
23
|
+
TopLevelActions["VehicleCreate"] = "vehicle:create";
|
|
24
|
+
TopLevelActions["TrackAndTraceDevices"] = "tt:devices:*";
|
|
25
|
+
})(TopLevelActions || (TopLevelActions = {}));
|
|
26
|
+
export const SUPPORTED_LANGUAGES = ['en', 'fr', 'nl', 'es'];
|
|
27
|
+
export const TENANT_ID_ADMIN_HEADER = 'tenant-id';
|
|
28
|
+
export const SERVICE_ID_ADMIN_HEADER = 'service-id';
|
|
29
|
+
export const NO_TENANT_ID_VALUE = 'notenant';
|
|
30
|
+
export const SYSTEM_USER_ID = 'system';
|
|
31
|
+
export var BusinessEntityIds;
|
|
32
|
+
(function (BusinessEntityIds) {
|
|
33
|
+
BusinessEntityIds["BecrisDeclarations"] = "becris_declarations";
|
|
34
|
+
BusinessEntityIds["Contacts"] = "contacts";
|
|
35
|
+
BusinessEntityIds["Emails"] = "emails";
|
|
36
|
+
BusinessEntityIds["FinanceDocuments"] = "finance_documents";
|
|
37
|
+
BusinessEntityIds["InternetVehicles"] = "internet-vehicles";
|
|
38
|
+
BusinessEntityIds["Leads"] = "leads";
|
|
39
|
+
BusinessEntityIds["LeasingContracts"] = "leasing_contracts";
|
|
40
|
+
BusinessEntityIds["LeasingUploadAutomation"] = "leasing_upload_automation";
|
|
41
|
+
BusinessEntityIds["Opportunities"] = "opportunities";
|
|
42
|
+
BusinessEntityIds["Organizations"] = "organizations";
|
|
43
|
+
BusinessEntityIds["PdfTemplates"] = "pdf_templates";
|
|
44
|
+
BusinessEntityIds["Users"] = "users";
|
|
45
|
+
BusinessEntityIds["Vehicles"] = "vehicles";
|
|
46
|
+
BusinessEntityIds["VehiclesPriceLists"] = "vehicles_price_lists";
|
|
47
|
+
BusinessEntityIds["Debtors"] = "debtors";
|
|
48
|
+
})(BusinessEntityIds || (BusinessEntityIds = {}));
|
|
49
|
+
export const LEASING_QUOTE_TEMPLATE_GROUP_ID = 'leasing_quote_template';
|
|
50
|
+
export const LEASING_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = 'leasing_quote_proforma_template';
|
|
51
|
+
export const LEASING_CONTRACT_AMORTIZATION_TEMPLATE_GROUP_ID = 'leasing_contract_amortization_template';
|
|
52
|
+
export const LEASING_CONTRACT_TC_TEMPLATE_GROUP_ID = 'leasing_contract_tc_template';
|
|
53
|
+
export const SALES_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = 'sales_quote_proforma_template';
|
|
54
|
+
export const SALES_QUOTE_AGREEMENT_TEMPLATE_GROUP_ID = 'sales_quote_agreement_template';
|
|
55
|
+
export const EU_VAT_COUNTRY_CODES = [
|
|
56
|
+
'at',
|
|
57
|
+
'be',
|
|
58
|
+
'bg',
|
|
59
|
+
'hr',
|
|
60
|
+
'cy',
|
|
61
|
+
'cz',
|
|
62
|
+
'dk',
|
|
63
|
+
'ee',
|
|
64
|
+
'fi',
|
|
65
|
+
'fr',
|
|
66
|
+
'de',
|
|
67
|
+
'el',
|
|
68
|
+
'hu',
|
|
69
|
+
'ie',
|
|
70
|
+
'it',
|
|
71
|
+
'lv',
|
|
72
|
+
'lt',
|
|
73
|
+
'lu',
|
|
74
|
+
'mt',
|
|
75
|
+
'nl',
|
|
76
|
+
'pl',
|
|
77
|
+
'pt',
|
|
78
|
+
'ro',
|
|
79
|
+
'sk',
|
|
80
|
+
'si',
|
|
81
|
+
'es',
|
|
82
|
+
'se',
|
|
83
|
+
'xi',
|
|
84
|
+
];
|
|
85
|
+
export const HEXON_LANG_CODES = [
|
|
86
|
+
'en',
|
|
87
|
+
'nl',
|
|
88
|
+
'de',
|
|
89
|
+
'fr',
|
|
90
|
+
'es',
|
|
91
|
+
'pt',
|
|
92
|
+
'it',
|
|
93
|
+
'pl',
|
|
94
|
+
'ru',
|
|
95
|
+
'ro',
|
|
96
|
+
'el',
|
|
97
|
+
'bg',
|
|
98
|
+
];
|
|
99
|
+
export const DEFAULT_SLB_PARTNER = 'To be announced';
|
|
100
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"/","sources":["constants.ts"],"names":[],"mappings":"AAGA,MAAM,CAAN,IAAY,QAQX;AARD,WAAY,QAAQ;IAClB,qCAAyB,CAAA;IACzB,4BAAgB,CAAA;IAChB,6CAAiC,CAAA;IACjC,qCAAyB,CAAA;IACzB,+BAAmB,CAAA;IACnB,4CAAgC,CAAA;IAChC,sCAA0B,CAAA;AAC5B,CAAC,EARW,QAAQ,KAAR,QAAQ,QAQnB;AAED,MAAM,CAAN,IAAY,eAaX;AAbD,WAAY,eAAe;IACzB,gDAA6B,CAAA;IAC7B,0DAAuC,CAAA;IACvC,8DAA2C,CAAA;IAC3C,gEAA6C,CAAA;IAC7C,sEAAmD,CAAA;IACnD,kEAA+C,CAAA;IAC/C,iDAA8B,CAAA;IAC9B,qDAAkC,CAAA;IAClC,uDAAoC,CAAA;IACpC,6CAA0B,CAAA;IAC1B,mDAAgC,CAAA;IAChC,wDAAqC,CAAA;AACvC,CAAC,EAbW,eAAe,KAAf,eAAe,QAa1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,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACL,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAA0B;IACrD,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACL,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC","sourcesContent":["//\n// STATIC ROLES\n//\nexport enum AppRoles {\n Accountant = 'accountant',\n Admin = 'admins',\n Administrative = 'administrative',\n Commercial = 'commercial',\n Manager = 'manager',\n ParkLogistics = 'park_logistics',\n AppManager = 'app_manager',\n}\n\nexport enum TopLevelActions {\n AdministrationAll = 'admin:*',\n DocumentsBrowse = 'docs:finance:browse',\n LeasingDebtorsView = 'leasing:debtors:view',\n LeasingOverduesView = 'leasing:overdues:view',\n LeasingContractsExport = 'leasing:contracts:export',\n LeasingDebtorsExport = 'leasing:debtors:export',\n MarketBrowse = 'market:browse',\n MarketInsights = 'insights:market',\n VehicleInsights = 'insights:vehicle',\n SettingsAll = 'settings:*',\n VehicleCreate = 'vehicle:create',\n TrackAndTraceDevices = 'tt:devices:*',\n}\n\n//\n// I18N\n//\nexport const SUPPORTED_LANGUAGES = ['en', 'fr', 'nl', 'es'];\n\n//\n// Headers\n//\nexport const TENANT_ID_ADMIN_HEADER = 'tenant-id';\nexport const SERVICE_ID_ADMIN_HEADER = 'service-id';\n\n//\n// AUTH\n//\nexport const NO_TENANT_ID_VALUE = 'notenant';\nexport const SYSTEM_USER_ID = 'system';\n\n//\n// Business Entity IDs\n//\nexport enum BusinessEntityIds {\n BecrisDeclarations = 'becris_declarations',\n Contacts = 'contacts',\n Emails = 'emails',\n FinanceDocuments = 'finance_documents',\n InternetVehicles = 'internet-vehicles',\n Leads = 'leads',\n LeasingContracts = 'leasing_contracts',\n LeasingUploadAutomation = 'leasing_upload_automation',\n Opportunities = 'opportunities',\n Organizations = 'organizations',\n PdfTemplates = 'pdf_templates',\n Users = 'users',\n Vehicles = 'vehicles',\n VehiclesPriceLists = 'vehicles_price_lists',\n Debtors = 'debtors',\n}\n\n//\n// PDF Templates IDs\n//\nexport const LEASING_QUOTE_TEMPLATE_GROUP_ID = 'leasing_quote_template';\nexport const LEASING_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = 'leasing_quote_proforma_template';\nexport const LEASING_CONTRACT_AMORTIZATION_TEMPLATE_GROUP_ID =\n 'leasing_contract_amortization_template';\nexport const LEASING_CONTRACT_TC_TEMPLATE_GROUP_ID = 'leasing_contract_tc_template';\nexport const SALES_QUOTE_PROFORMA_TEMPLATE_GROUP_ID = 'sales_quote_proforma_template';\nexport const SALES_QUOTE_AGREEMENT_TEMPLATE_GROUP_ID = 'sales_quote_agreement_template';\n\n//\n// VAT Prefixes for EU Countries and Great Britain & Northern Ireland\n//\nexport const EU_VAT_COUNTRY_CODES = [\n 'at',\n 'be',\n 'bg',\n 'hr',\n 'cy',\n 'cz',\n 'dk',\n 'ee',\n 'fi',\n 'fr',\n 'de',\n 'el',\n 'hu',\n 'ie',\n 'it',\n 'lv',\n 'lt',\n 'lu',\n 'mt',\n 'nl',\n 'pl',\n 'pt',\n 'ro',\n 'sk',\n 'si',\n 'es',\n 'se',\n 'xi', // Northern Ireland\n];\n\nexport const HEXON_LANG_CODES: [string, ...string[]] = [\n 'en',\n 'nl',\n 'de',\n 'fr',\n 'es',\n 'pt',\n 'it',\n 'pl',\n 'ru',\n 'ro',\n 'el',\n 'bg',\n];\n\nexport const DEFAULT_SLB_PARTNER = 'To be announced';\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import dayjsBusinessDays from 'dayjs-business-days';
|
|
3
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
4
|
+
import IsoWeek from 'dayjs/plugin/isoWeek';
|
|
5
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
6
|
+
import dayjsUtc from 'dayjs/plugin/utc';
|
|
7
|
+
dayjs.extend(dayjsBusinessDays);
|
|
8
|
+
dayjs.extend(IsoWeek);
|
|
9
|
+
dayjs.extend(customParseFormat);
|
|
10
|
+
dayjs.extend(dayjsUtc);
|
|
11
|
+
dayjs.extend(timezone);
|
|
12
|
+
export const tz = dayjs.tz;
|
|
13
|
+
export const utc = dayjs.utc;
|
|
14
|
+
export const isSameOrAfter = (value, reference) => value.isAfter(reference) || value.isSame(reference);
|
|
15
|
+
export const isSameOrBefore = (value, reference) => value.isBefore(reference) || value.isSame(reference);
|
|
16
|
+
export const isBetween = (value, startInclusive, endExclusive) => isSameOrAfter(value, startInclusive) && value.isBefore(endExclusive);
|
|
17
|
+
export const businessDaysAdd = (value, days) => value.businessDaysAdd(days);
|
|
18
|
+
//# sourceMappingURL=dayjs-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dayjs-utils.js","sourceRoot":"/","sources":["dayjs-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAC;AACrC,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAC3C,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AAExC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAChC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACtB,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAChC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACvB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAIvB,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AAE3B,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;AAE7B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAY,EAAE,SAAgB,EAAW,EAAE,CACvE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAY,EAAE,SAAgB,EAAW,EAAE,CACxE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAY,EAAE,cAAqB,EAAE,YAAmB,EAAW,EAAE,CAC7F,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAY,EAAE,IAAY,EAAS,EAAE,CAClE,KAAa,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import dayjs, { Dayjs } from 'dayjs';\nimport dayjsBusinessDays from 'dayjs-business-days';\nimport customParseFormat from 'dayjs/plugin/customParseFormat';\nimport IsoWeek from 'dayjs/plugin/isoWeek';\nimport timezone from 'dayjs/plugin/timezone';\nimport dayjsUtc from 'dayjs/plugin/utc';\n\ndayjs.extend(dayjsBusinessDays);\ndayjs.extend(IsoWeek);\ndayjs.extend(customParseFormat);\ndayjs.extend(dayjsUtc);\ndayjs.extend(timezone);\n\n// Exists only to make Typescript happy, otherwise the build would fail with\n// \"Property 'tz' does not exist on type 'Dayjs'\"\nexport const tz = dayjs.tz;\n\nexport const utc = dayjs.utc;\n\nexport const isSameOrAfter = (value: Dayjs, reference: Dayjs): boolean =>\n value.isAfter(reference) || value.isSame(reference);\n\nexport const isSameOrBefore = (value: Dayjs, reference: Dayjs): boolean =>\n value.isBefore(reference) || value.isSame(reference);\n\nexport const isBetween = (value: Dayjs, startInclusive: Dayjs, endExclusive: Dayjs): boolean =>\n isSameOrAfter(value, startInclusive) && value.isBefore(endExclusive);\n\nexport const businessDaysAdd = (value: Dayjs, days: number): Dayjs =>\n (value as any).businessDaysAdd(days);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discussions.js","sourceRoot":"/","sources":["discussions.ts"],"names":[],"mappings":"AAqCA,MAAM,CAAC,MAAM,2BAA2B,GAAG,SAAS,CAAC","sourcesContent":["import { BusinessEntityIds } from './constants';\n\nexport type Discussion = {\n businessEntityId: BusinessEntityIds;\n createdAt: string;\n followers: string[];\n id: string;\n recordId: string;\n title?: string;\n};\n\nexport type DiscussionData = {\n discussion: Discussion;\n messages: Message[];\n};\n\nexport type NewDiscussion = {\n businessEntityId: BusinessEntityIds;\n content: MessageContent;\n recordId: string;\n title?: string;\n followers: string[];\n};\n\nexport type Message = {\n author: string;\n content?: MessageContent; // optional if the content is deleted\n createdAt: string;\n deletedAt?: string;\n id: string;\n};\n\nexport type MessageContent = {\n value: string;\n mentions: string[];\n};\n\nexport const MESSAGE_NOTIFICATION_ORIGIN = 'message';\n\nexport type MessageNotificationData = {\n snippet: string;\n id: string;\n mention?: boolean;\n};\n\nexport type NewDiscussionEvent = {\n discussion: NewDiscussion;\n tenantId: string;\n author: string;\n};\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export class XError extends Error {
|
|
2
|
+
constructor(message, errorCtx) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'XError';
|
|
5
|
+
this.errorCtx = errorCtx;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export class WrappedError extends Error {
|
|
9
|
+
constructor(err, errorCtx) {
|
|
10
|
+
super(err.message);
|
|
11
|
+
this.name = err.name;
|
|
12
|
+
this.stack = err.stack;
|
|
13
|
+
this.errorCtx = errorCtx;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export class AsyncStopError extends Error {
|
|
17
|
+
constructor(message) {
|
|
18
|
+
super(message);
|
|
19
|
+
this.name = 'AsyncStopError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export class ForbiddenError extends Error {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = 'ForbiddenError';
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export class EntryAlreadyExistsError extends Error {
|
|
29
|
+
constructor(message) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.name = 'EntryAlreadyExistsError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export class InvalidArgumentsError extends Error {
|
|
35
|
+
constructor(message, errors, errorCtx) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.isValidation = true;
|
|
38
|
+
this.name = 'InvalidArgumentsError';
|
|
39
|
+
this.errorCtx = errorCtx;
|
|
40
|
+
if (errors != null) {
|
|
41
|
+
this.validationErrors = {
|
|
42
|
+
errors: errors.details.map(({ path, type, message }) => ({
|
|
43
|
+
message,
|
|
44
|
+
path,
|
|
45
|
+
type: type === 'custom' ? message : type,
|
|
46
|
+
})),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export class UnauthorizedError extends Error {
|
|
52
|
+
constructor(message) {
|
|
53
|
+
super(message);
|
|
54
|
+
this.name = 'UnauthorizedError';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"/","sources":["errors.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,MAAO,SAAQ,KAAK;IAG/B,YAAY,OAAg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,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CACxB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAuB,EAAwB,EAAE,CAAC,CAAC;oBACvE,OAAO;oBACP,IAAI;oBACJ,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;iBACzC,CAAC,CACH;aACF,CAAC;SACH;IACH,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF","sourcesContent":["import { ValidationError, ValidationErrorItem } from 'joi';\n\nexport class XError extends Error {\n errorCtx: any;\n\n constructor(message?: string, errorCtx?: any) {\n super(message);\n this.name = 'XError';\n this.errorCtx = errorCtx;\n }\n}\n\nexport class WrappedError extends Error {\n errorCtx: any;\n\n constructor(err: Error, errorCtx?: any) {\n super(err.message);\n this.name = err.name;\n this.stack = err.stack;\n this.errorCtx = errorCtx;\n }\n}\n\nexport class AsyncStopError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = 'AsyncStopError';\n }\n}\n\nexport class ForbiddenError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = 'ForbiddenError';\n }\n}\n\nexport class EntryAlreadyExistsError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = 'EntryAlreadyExistsError';\n }\n}\n\ntype FieldValidationError = {\n message: string;\n path: Array<string | number>;\n type: string;\n};\nexport class InvalidArgumentsError extends Error {\n validationErrors?: { errors: FieldValidationError[] };\n isValidation = true;\n errorCtx: any;\n\n constructor(message?: string, errors?: ValidationError, errorCtx?: any) {\n super(message);\n this.name = 'InvalidArgumentsError';\n this.errorCtx = errorCtx;\n\n if (errors != null) {\n this.validationErrors = {\n errors: errors.details.map(\n ({ path, type, message }: ValidationErrorItem): FieldValidationError => ({\n message,\n path,\n type: type === 'custom' ? message : type,\n })\n ),\n };\n }\n }\n}\n\nexport class UnauthorizedError extends Error {\n constructor(message?: string) {\n super(message);\n this.name = 'UnauthorizedError';\n }\n}\n"]}
|
package/lib/esm/exact.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exact.js","sourceRoot":"/","sources":["exact.ts"],"names":[],"mappings":"","sourcesContent":["export type ExactClientAccount = {\n branchId: string;\n division: number;\n clientId: string;\n lastAuthenticatedAt?: string;\n expiresAt?: string;\n exactTld: string;\n authenticated: boolean;\n};\n"]}
|
package/lib/esm/fetch.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fetch from 'node-fetch';
|
|
2
|
+
import { XError } from './errors';
|
|
3
|
+
export const fetchJson = async (url, init) => {
|
|
4
|
+
const response = await fetch(url, init);
|
|
5
|
+
if (!response.ok) {
|
|
6
|
+
const body = await response.text();
|
|
7
|
+
throw new XError(response.statusText, {
|
|
8
|
+
url,
|
|
9
|
+
body: init?.body,
|
|
10
|
+
response: body,
|
|
11
|
+
status: response.status,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return response.status === 200 ? response.json() : undefined;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"/","sources":["fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAC5B,GAAgB,EAChB,IAAkB,EACM,EAAE;IAC1B,MAAM,QAAQ,GAAa,MAAM,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAElD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;QAChB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE;YACpC,GAAG;YACH,IAAI,EAAE,IAAI,EAAE,IAAI;YAChB,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC,CAAC;KACJ;IAED,OAAO,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAE,QAAQ,CAAC,IAAI,EAAiB,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/E,CAAC,CAAC","sourcesContent":["import fetch, { RequestInfo, RequestInit, Response } from 'node-fetch';\nimport { XError } from './errors';\n\nexport const fetchJson = async <T>(\n url: RequestInfo,\n init?: RequestInit\n): Promise<T | undefined> => {\n const response: Response = await fetch(url, init);\n\n if (!response.ok) {\n const body = await response.text();\n throw new XError(response.statusText, {\n url,\n body: init?.body,\n response: body,\n status: response.status,\n });\n }\n\n return response.status === 200 ? (response.json() as Promise<T>) : undefined;\n};\n"]}
|
package/lib/esm/ids.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { customAlphabet } from 'nanoid';
|
|
2
|
+
export var Alphabet;
|
|
3
|
+
(function (Alphabet) {
|
|
4
|
+
Alphabet["Full"] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_";
|
|
5
|
+
Alphabet["Alphanumeric"] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
6
|
+
Alphabet["Lowercase"] = "abcdefghijklmnopqrstuvwxyz";
|
|
7
|
+
Alphabet["LowerAlphanumeric"] = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
8
|
+
Alphabet["ReferenceCode"] = "123456789ABCDEFGHJKMNPQRSTUVWXYZ";
|
|
9
|
+
})(Alphabet || (Alphabet = {}));
|
|
10
|
+
export const generateId = (idLength = 15, alphabet = Alphabet.Full) => {
|
|
11
|
+
const nanoid = customAlphabet(alphabet, idLength);
|
|
12
|
+
while (true) {
|
|
13
|
+
const id = nanoid();
|
|
14
|
+
if (isValid(id)) {
|
|
15
|
+
return id;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const isValid = (id) => {
|
|
20
|
+
if (!Number.isNaN(Number.parseInt(id[0]))) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (id.endsWith('_') || id.startsWith('_')) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (id.includes('__')) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"/","sources":["ids.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,oFAAwE,CAAA;IACxE,2FAA+E,CAAA;IAC/E,oDAAwC,CAAA;IACxC,sEAA0D,CAAA;IAC1D,8DAAkD,CAAA;AACpD,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AAID,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,WAAmB,EAAE,EAAE,WAAqB,QAAQ,CAAC,IAAI,EAAU,EAAE;IAC9F,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAClD,OAAO,IAAI,EAAE;QACX,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QACpB,IAAI,OAAO,CAAC,EAAE,CAAC,EAAE;YACf,OAAO,EAAE,CAAC;SACX;KACF;AACH,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,EAAU,EAAW,EAAE;IACtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;QACzC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC1C,OAAO,KAAK,CAAC;KACd;IAED,IAAI,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { customAlphabet } from 'nanoid';\n\nexport enum Alphabet {\n Full = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_',\n Alphanumeric = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n Lowercase = 'abcdefghijklmnopqrstuvwxyz',\n LowerAlphanumeric = '0123456789abcdefghijklmnopqrstuvwxyz',\n ReferenceCode = '123456789ABCDEFGHJKMNPQRSTUVWXYZ',\n}\n\n// The ID can contain only alphabets and numbers and underscore.\n// The ID should start with an alphabet and should not have two consecutive underscores or end with an underscore.\nexport const generateId = (idLength: number = 15, alphabet: Alphabet = Alphabet.Full): string => {\n const nanoid = customAlphabet(alphabet, idLength);\n while (true) {\n const id = nanoid();\n if (isValid(id)) {\n return id;\n }\n }\n};\n\nconst isValid = (id: string): boolean => {\n if (!Number.isNaN(Number.parseInt(id[0]))) {\n return false;\n }\n\n if (id.endsWith('_') || id.startsWith('_')) {\n return false;\n }\n\n if (id.includes('__')) {\n return false;\n }\n\n return true;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insurance.js","sourceRoot":"/","sources":["insurance.ts"],"names":[],"mappings":"","sourcesContent":["export type InsuranceEntry = {\n checkedAt: string;\n insured: boolean;\n};\n\nexport type InsuranceCheckEvent = {\n contractId: string;\n tenantId: string;\n vin: string;\n licensePlate?: string;\n};\n\nexport type InsuranceCheckResponseEvent = InsuranceCheckEvent & {\n insurance: InsuranceEntry;\n};\n\nexport type InsuranceHistoryRequest = {\n contractId: string;\n tenantId: string;\n limit?: number;\n nextToken?: string;\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const getAddressText = (address, joinBy = '<br>') => {
|
|
2
|
+
const regionLines = [address.postalCode, address.city, address.country.toUpperCase()]
|
|
3
|
+
.filter((n) => !!n)
|
|
4
|
+
.join(', ');
|
|
5
|
+
return [address.addressLine1, address.addressLine2, regionLines].filter((n) => !!n).join(joinBy);
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=location-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location-utils.js","sourceRoot":"/","sources":["location-utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAsB,EAAE,SAAiB,MAAM,EAAU,EAAE;IACxF,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;SAClF,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;SAClB,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACnG,CAAC,CAAC","sourcesContent":["import { LocationValue } from './types';\n\nexport const getAddressText = (address: LocationValue, joinBy: string = '<br>'): string => {\n const regionLines = [address.postalCode, address.city, address.country.toUpperCase()]\n .filter((n) => !!n)\n .join(', ');\n\n return [address.addressLine1, address.addressLine2, regionLines].filter((n) => !!n).join(joinBy);\n};\n"]}
|