@bisondesk/commons-sdk 1.0.0 → 1.0.2
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/constants.d.ts +6 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +18 -0
- package/lib/constants.js.map +1 -0
- package/lib/ids.d.ts +8 -0
- package/lib/ids.d.ts.map +1 -0
- package/lib/ids.js +36 -0
- package/lib/ids.js.map +1 -0
- package/lib/types.d.ts +46 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +13 -0
- package/lib/types.js.map +1 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +2436 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ADMINS_ROLE = "admins";
|
|
2
|
+
export declare const INFRA_STACK_NAME = "infra";
|
|
3
|
+
export declare const RDS_MASTER_SECRET_ID_OUTPUT_NAME = "RDSMasterSecretId";
|
|
4
|
+
export declare const RDS_DEFAULT_SECRET_ID_OUTPUT_NAME = "RDSSecretId";
|
|
5
|
+
export declare const SUPPORTED_LANGUAGES: string[];
|
|
6
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,WAAW,CAAC;AAKpC,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,gCAAgC,sBAAsB,CAAC;AACpE,eAAO,MAAM,iCAAiC,gBAAgB,CAAC;AAK/D,eAAO,MAAM,mBAAmB,UAAqB,CAAC"}
|
package/lib/constants.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUPPORTED_LANGUAGES = exports.RDS_DEFAULT_SECRET_ID_OUTPUT_NAME = exports.RDS_MASTER_SECRET_ID_OUTPUT_NAME = exports.INFRA_STACK_NAME = exports.ADMINS_ROLE = void 0;
|
|
4
|
+
//
|
|
5
|
+
// STATIC ROLES
|
|
6
|
+
//
|
|
7
|
+
exports.ADMINS_ROLE = 'admins';
|
|
8
|
+
//
|
|
9
|
+
// CLOUDFORMATION
|
|
10
|
+
//
|
|
11
|
+
exports.INFRA_STACK_NAME = 'infra';
|
|
12
|
+
exports.RDS_MASTER_SECRET_ID_OUTPUT_NAME = 'RDSMasterSecretId';
|
|
13
|
+
exports.RDS_DEFAULT_SECRET_ID_OUTPUT_NAME = 'RDSSecretId';
|
|
14
|
+
//
|
|
15
|
+
// I18N
|
|
16
|
+
//
|
|
17
|
+
exports.SUPPORTED_LANGUAGES = ['en', 'fr', 'nl'];
|
|
18
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAA,EAAE;AACF,eAAe;AACf,EAAE;AACW,QAAA,WAAW,GAAG,QAAQ,CAAC;AAEpC,EAAE;AACF,iBAAiB;AACjB,EAAE;AACW,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAC3B,QAAA,gCAAgC,GAAG,mBAAmB,CAAC;AACvD,QAAA,iCAAiC,GAAG,aAAa,CAAC;AAE/D,EAAE;AACF,OAAO;AACP,EAAE;AACW,QAAA,mBAAmB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC"}
|
package/lib/ids.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum Alphabet {
|
|
2
|
+
Full = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_",
|
|
3
|
+
Alphanumeric = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
4
|
+
Lowercase = "abcdefghijklmnopqrstuvwxyz",
|
|
5
|
+
LowerAlphanumeric = "0123456789abcdefghijklmnopqrstuvwxyz"
|
|
6
|
+
}
|
|
7
|
+
export declare const generateId: (idLength?: number, alphabet?: Alphabet) => string;
|
|
8
|
+
//# sourceMappingURL=ids.d.ts.map
|
package/lib/ids.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":"AAEA,oBAAY,QAAQ;IAClB,IAAI,oEAAoE;IACxE,YAAY,mEAAmE;IAC/E,SAAS,+BAA+B;IACxC,iBAAiB,yCAAyC;CAC3D;AAID,eAAO,MAAM,UAAU,cAAc,MAAM,aAAiB,QAAQ,KAAmB,MAQtF,CAAC"}
|
package/lib/ids.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateId = exports.Alphabet = void 0;
|
|
4
|
+
const nanoid_1 = require("nanoid");
|
|
5
|
+
var Alphabet;
|
|
6
|
+
(function (Alphabet) {
|
|
7
|
+
Alphabet["Full"] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_";
|
|
8
|
+
Alphabet["Alphanumeric"] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
9
|
+
Alphabet["Lowercase"] = "abcdefghijklmnopqrstuvwxyz";
|
|
10
|
+
Alphabet["LowerAlphanumeric"] = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
11
|
+
})(Alphabet = exports.Alphabet || (exports.Alphabet = {}));
|
|
12
|
+
// The ID can contain only alphabets and numbers and underscore.
|
|
13
|
+
// The ID should start with an alphabet and should not have two consecutive underscores or end with an underscore.
|
|
14
|
+
const generateId = (idLength = 15, alphabet = Alphabet.Full) => {
|
|
15
|
+
const nanoid = nanoid_1.customAlphabet(alphabet, idLength);
|
|
16
|
+
while (true) {
|
|
17
|
+
const id = nanoid();
|
|
18
|
+
if (isValid(id)) {
|
|
19
|
+
return id;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.generateId = generateId;
|
|
24
|
+
const isValid = (id) => {
|
|
25
|
+
if (!Number.isNaN(Number.parseInt(id[0]))) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (id.endsWith('_') || id.startsWith('_')) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (id.includes('__')) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=ids.js.map
|
package/lib/ids.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../src/ids.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAExC,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,oFAAwE,CAAA;IACxE,2FAA+E,CAAA;IAC/E,oDAAwC,CAAA;IACxC,sEAA0D,CAAA;AAC5D,CAAC,EALW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAKnB;AAED,gEAAgE;AAChE,kHAAkH;AAC3G,MAAM,UAAU,GAAG,CAAC,WAAmB,EAAE,EAAE,WAAqB,QAAQ,CAAC,IAAI,EAAU,EAAE;IAC9F,MAAM,MAAM,GAAG,uBAAc,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;AARW,QAAA,UAAU,cAQrB;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"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare type PaginatedList<T, M = {}> = {
|
|
2
|
+
results: T[];
|
|
3
|
+
totalCount: number;
|
|
4
|
+
meta: M;
|
|
5
|
+
};
|
|
6
|
+
export declare type Requester = {
|
|
7
|
+
lang: string;
|
|
8
|
+
roles: string[];
|
|
9
|
+
tenantId: string;
|
|
10
|
+
tenantLang: string;
|
|
11
|
+
userAgent?: string;
|
|
12
|
+
sourceIp: string;
|
|
13
|
+
userId: string;
|
|
14
|
+
isApi: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare type Option = {
|
|
17
|
+
value: string | number;
|
|
18
|
+
label: string;
|
|
19
|
+
color?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare enum Region {
|
|
22
|
+
euWest1 = "eu-west-1"
|
|
23
|
+
}
|
|
24
|
+
export declare type ErrorResponse = {
|
|
25
|
+
message?: string;
|
|
26
|
+
data?: unknown;
|
|
27
|
+
};
|
|
28
|
+
export declare type MultiLangValue = {
|
|
29
|
+
key?: string;
|
|
30
|
+
} & {
|
|
31
|
+
[languageCode: string]: string;
|
|
32
|
+
};
|
|
33
|
+
export declare type CognitoInfo = {
|
|
34
|
+
userPoolId: string;
|
|
35
|
+
appClientId: string;
|
|
36
|
+
region: Region;
|
|
37
|
+
};
|
|
38
|
+
export declare enum SortOrder {
|
|
39
|
+
asc = "asc",
|
|
40
|
+
desc = "desc"
|
|
41
|
+
}
|
|
42
|
+
export declare type SortFilter = {
|
|
43
|
+
fieldId: string;
|
|
44
|
+
order: SortOrder;
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI;IACrC,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,oBAAY,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,oBAAY,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,MAAM;IAChB,OAAO,cAAc;CACtB;AAED,oBAAY,aAAa,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEnF,oBAAY,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,SAAS;IACnB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,oBAAY,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;CAClB,CAAC"}
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SortOrder = exports.Region = void 0;
|
|
4
|
+
var Region;
|
|
5
|
+
(function (Region) {
|
|
6
|
+
Region["euWest1"] = "eu-west-1";
|
|
7
|
+
})(Region = exports.Region || (exports.Region = {}));
|
|
8
|
+
var SortOrder;
|
|
9
|
+
(function (SortOrder) {
|
|
10
|
+
SortOrder["asc"] = "asc";
|
|
11
|
+
SortOrder["desc"] = "desc";
|
|
12
|
+
})(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAuBA,IAAY,MAEX;AAFD,WAAY,MAAM;IAChB,+BAAqB,CAAA;AACvB,CAAC,EAFW,MAAM,GAAN,cAAM,KAAN,cAAM,QAEjB;AAeD,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
|