@psmarketplace/config 10.23.1
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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/auth/index.js +58 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/policy.js +120 -0
- package/dist/auth/policy.js.map +1 -0
- package/dist/environment/base.js +560 -0
- package/dist/environment/base.js.map +1 -0
- package/dist/environment/decorators.js +98 -0
- package/dist/environment/decorators.js.map +1 -0
- package/dist/environment/index.js +37 -0
- package/dist/environment/index.js.map +1 -0
- package/dist/environment/types.js +3 -0
- package/dist/environment/types.js.map +1 -0
- package/dist/events/index.js +12 -0
- package/dist/events/index.js.map +1 -0
- package/dist/helpers/index.js +68 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/uid.js +87 -0
- package/dist/helpers/uid.js.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics.js +6 -0
- package/dist/metrics.js.map +1 -0
- package/dist/path/index.js +47 -0
- package/dist/path/index.js.map +1 -0
- package/dist/plans/base.js +117 -0
- package/dist/plans/base.js.map +1 -0
- package/dist/plans/index.js +223 -0
- package/dist/plans/index.js.map +1 -0
- package/dist/plans/types.js +3 -0
- package/dist/plans/types.js.map +1 -0
- package/dist/types/auth/index.d.ts +22 -0
- package/dist/types/auth/index.d.ts.map +1 -0
- package/dist/types/auth/policy.d.ts +13 -0
- package/dist/types/auth/policy.d.ts.map +1 -0
- package/dist/types/environment/base.d.ts +4 -0
- package/dist/types/environment/base.d.ts.map +1 -0
- package/dist/types/environment/decorators.d.ts +7 -0
- package/dist/types/environment/decorators.d.ts.map +1 -0
- package/dist/types/environment/index.d.ts +16 -0
- package/dist/types/environment/index.d.ts.map +1 -0
- package/dist/types/environment/types.d.ts +162 -0
- package/dist/types/environment/types.d.ts.map +1 -0
- package/dist/types/events/index.d.ts +59 -0
- package/dist/types/events/index.d.ts.map +1 -0
- package/dist/types/helpers/index.d.ts +66 -0
- package/dist/types/helpers/index.d.ts.map +1 -0
- package/dist/types/helpers/uid.d.ts +6 -0
- package/dist/types/helpers/uid.d.ts.map +1 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/metrics.d.ts +3 -0
- package/dist/types/metrics.d.ts.map +1 -0
- package/dist/types/path/index.d.ts +8 -0
- package/dist/types/path/index.d.ts.map +1 -0
- package/dist/types/plans/base.d.ts +9 -0
- package/dist/types/plans/base.d.ts.map +1 -0
- package/dist/types/plans/index.d.ts +10 -0
- package/dist/types/plans/index.d.ts.map +1 -0
- package/dist/types/plans/types.d.ts +179 -0
- package/dist/types/plans/types.d.ts.map +1 -0
- package/dist/types/types.d.ts +3641 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/utils/flatten.d.ts +9 -0
- package/dist/types/utils/flatten.d.ts.map +1 -0
- package/dist/types/whatsapp/index.d.ts +4 -0
- package/dist/types/whatsapp/index.d.ts.map +1 -0
- package/dist/types/whatsapp/requests.d.ts +82 -0
- package/dist/types/whatsapp/requests.d.ts.map +1 -0
- package/dist/types/whatsapp/responses.d.ts +170 -0
- package/dist/types/whatsapp/responses.d.ts.map +1 -0
- package/dist/types.js +734 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/flatten.js +43 -0
- package/dist/utils/flatten.js.map +1 -0
- package/dist/whatsapp/index.js +7 -0
- package/dist/whatsapp/index.js.map +1 -0
- package/dist/whatsapp/requests.js +3 -0
- package/dist/whatsapp/requests.js.map +1 -0
- package/dist/whatsapp/responses.js +3 -0
- package/dist/whatsapp/responses.js.map +1 -0
- package/package.json +32 -0
- package/src/auth/index.ts +72 -0
- package/src/auth/policy.ts +277 -0
- package/src/environment/base.ts +602 -0
- package/src/environment/decorators.ts +97 -0
- package/src/environment/index.ts +35 -0
- package/src/environment/types.ts +174 -0
- package/src/events/index.ts +80 -0
- package/src/helpers/index.ts +121 -0
- package/src/helpers/uid.ts +108 -0
- package/src/index.ts +52 -0
- package/src/metrics.ts +3 -0
- package/src/path/index.ts +61 -0
- package/src/plans/base.ts +121 -0
- package/src/plans/index.ts +233 -0
- package/src/plans/types.ts +208 -0
- package/src/types.ts +4362 -0
- package/src/utils/flatten.ts +60 -0
- package/src/whatsapp/index.ts +4 -0
- package/src/whatsapp/requests.ts +113 -0
- package/src/whatsapp/responses.ts +197 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Placeshaker
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# TSDX Bootstrap
|
|
2
|
+
|
|
3
|
+
This project was bootstrapped with [TSDX](https://github.com/jaredpalmer/tsdx).
|
|
4
|
+
|
|
5
|
+
## Local Development
|
|
6
|
+
|
|
7
|
+
Below is a list of commands you will probably find useful.
|
|
8
|
+
|
|
9
|
+
### `npm start` or `yarn start`
|
|
10
|
+
|
|
11
|
+
Runs the project in development/watch mode. Your project will be rebuilt upon changes. TSDX has a special logger for you convenience. Error messages are pretty printed and formatted for compatibility VS Code's Problems tab.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
Your library will be rebuilt if you make edits.
|
|
16
|
+
|
|
17
|
+
### `npm run build` or `yarn build`
|
|
18
|
+
|
|
19
|
+
Bundles the package to the `dist` folder. The package is optimized and bundled with Rollup into multiple formats \(CommonJS, UMD, and ES Module\).
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
### `npm test` or `yarn test`
|
|
24
|
+
|
|
25
|
+
Runs the test watcher \(Jest\) in an interactive mode. By default, runs tests related to files changed since the last commit.
|
|
26
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROLE = void 0;
|
|
4
|
+
var ROLE;
|
|
5
|
+
(function (ROLE) {
|
|
6
|
+
ROLE["CLIENT"] = "client";
|
|
7
|
+
ROLE["SELLER"] = "seller";
|
|
8
|
+
ROLE["PRO"] = "pro";
|
|
9
|
+
ROLE["AGENT"] = "agent";
|
|
10
|
+
ROLE["ADMIN"] = "admin";
|
|
11
|
+
ROLE["OWNER"] = "owner";
|
|
12
|
+
ROLE["SUPERADMIN"] = "superadmin";
|
|
13
|
+
})(ROLE || (exports.ROLE = ROLE = {}));
|
|
14
|
+
/**
|
|
15
|
+
* security context
|
|
16
|
+
*/
|
|
17
|
+
exports.default = (env) => {
|
|
18
|
+
const orderedAccess = [
|
|
19
|
+
ROLE.CLIENT,
|
|
20
|
+
ROLE.PRO,
|
|
21
|
+
ROLE.AGENT,
|
|
22
|
+
ROLE.ADMIN,
|
|
23
|
+
ROLE.SUPERADMIN,
|
|
24
|
+
];
|
|
25
|
+
const hasRole = (claims) => !claims || !claims[env.security.claims.role] ? false : true;
|
|
26
|
+
const is = (claims, role) => {
|
|
27
|
+
if (!hasRole(claims))
|
|
28
|
+
return false;
|
|
29
|
+
return claims[env.security.claims.role] === role;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Determine if an user can act under another security role
|
|
33
|
+
*
|
|
34
|
+
* @param role
|
|
35
|
+
* @param claims
|
|
36
|
+
*/
|
|
37
|
+
const canActAs = (role, claims) => {
|
|
38
|
+
const userRole = getRole(claims);
|
|
39
|
+
return orderedAccess.indexOf(role) < orderedAccess.indexOf(userRole);
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Get user role
|
|
43
|
+
* @param claims
|
|
44
|
+
*/
|
|
45
|
+
const getRole = (claims) => hasRole(claims) ? claims[env.security.claims.role] : null;
|
|
46
|
+
/**
|
|
47
|
+
* Get all the roles on which an user can impersonate
|
|
48
|
+
* @param claims
|
|
49
|
+
*/
|
|
50
|
+
const getRoles = (claims) => orderedAccess.filter(role => canActAs(role, claims));
|
|
51
|
+
return {
|
|
52
|
+
is,
|
|
53
|
+
canActAs,
|
|
54
|
+
getRole,
|
|
55
|
+
getRoles,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":";;;AAEA,IAAY,IAQX;AARD,WAAY,IAAI;IACd,yBAAiB,CAAA;IACjB,yBAAiB,CAAA;IACjB,mBAAW,CAAA;IACX,uBAAe,CAAA;IACf,uBAAe,CAAA;IACf,uBAAe,CAAA;IACf,iCAAyB,CAAA;AAC3B,CAAC,EARW,IAAI,oBAAJ,IAAI,QAQf;AASD;;GAEG;AACH,kB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AC;IAEvD,OAAO;QACL,EAAE;QACF,QAAQ;QACR,OAAO;QACP,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.acls = void 0;
|
|
4
|
+
exports.acls = [
|
|
5
|
+
'project.view',
|
|
6
|
+
'project.edit',
|
|
7
|
+
'project.create',
|
|
8
|
+
'project.delete',
|
|
9
|
+
'project.progress.edit',
|
|
10
|
+
// assignations
|
|
11
|
+
'project.assign.pro',
|
|
12
|
+
'project.assign.agent',
|
|
13
|
+
'project.assign.client',
|
|
14
|
+
'project.assign.seller',
|
|
15
|
+
'project.unassign.pro',
|
|
16
|
+
'project.unassign.agent',
|
|
17
|
+
'project.unassign.client',
|
|
18
|
+
'project.unassign.seller',
|
|
19
|
+
// other actions
|
|
20
|
+
'project.validate',
|
|
21
|
+
'project.status.edit',
|
|
22
|
+
'project.pro.prices.view',
|
|
23
|
+
'project.enterprise.prices.view',
|
|
24
|
+
'project.sync.agenda',
|
|
25
|
+
'project.estimation',
|
|
26
|
+
// devis
|
|
27
|
+
'project.devis.create',
|
|
28
|
+
'project.devis.edit',
|
|
29
|
+
'project.devis.delete',
|
|
30
|
+
// notes
|
|
31
|
+
'project.note.view',
|
|
32
|
+
'project.note.create',
|
|
33
|
+
'project.note.edit',
|
|
34
|
+
'project.note.delete',
|
|
35
|
+
// documents
|
|
36
|
+
'project.document.view',
|
|
37
|
+
'project.document.create',
|
|
38
|
+
'project.document.edit',
|
|
39
|
+
'project.document.delete',
|
|
40
|
+
// medias
|
|
41
|
+
'project.media.view',
|
|
42
|
+
'project.media.create',
|
|
43
|
+
'project.media.edit',
|
|
44
|
+
'project.media.delete',
|
|
45
|
+
// events
|
|
46
|
+
'project.event.view',
|
|
47
|
+
'project.event.create',
|
|
48
|
+
'project.event.edit',
|
|
49
|
+
/**
|
|
50
|
+
* Devis policy
|
|
51
|
+
*/
|
|
52
|
+
'devis.create',
|
|
53
|
+
'devis.view',
|
|
54
|
+
'devis.edit',
|
|
55
|
+
'devis.delete',
|
|
56
|
+
'devis.status.edit',
|
|
57
|
+
'devis.email.send',
|
|
58
|
+
'devis.validate',
|
|
59
|
+
'devis.from.template.create',
|
|
60
|
+
/**
|
|
61
|
+
* Configuration
|
|
62
|
+
*/
|
|
63
|
+
'configuration.view',
|
|
64
|
+
// status
|
|
65
|
+
'configuration.status.view',
|
|
66
|
+
'configuration.status.create',
|
|
67
|
+
'configuration.status.edit',
|
|
68
|
+
'configuration.status.delete',
|
|
69
|
+
// providers
|
|
70
|
+
'configuration.provider.view',
|
|
71
|
+
'configuration.provider.edit',
|
|
72
|
+
'configuration.provider.delete',
|
|
73
|
+
'configuration.provider.create',
|
|
74
|
+
// material providers
|
|
75
|
+
'configuration.material.provider.view',
|
|
76
|
+
'configuration.material.provider.edit',
|
|
77
|
+
'configuration.material.provider.delete',
|
|
78
|
+
'configuration.material.provider.create',
|
|
79
|
+
// materials
|
|
80
|
+
'configuration.material.view',
|
|
81
|
+
'configuration.material.edit',
|
|
82
|
+
'configuration.material.delete',
|
|
83
|
+
'configuration.material.create',
|
|
84
|
+
// operations
|
|
85
|
+
'configuration.operation.view',
|
|
86
|
+
'configuration.operation.edit',
|
|
87
|
+
'configuration.operation.delete',
|
|
88
|
+
'configuration.operation.create',
|
|
89
|
+
// devis templates
|
|
90
|
+
'configuration.devis.template.view',
|
|
91
|
+
'configuration.devis.template.edit',
|
|
92
|
+
'configuration.devis.template.delete',
|
|
93
|
+
'configuration.devis.template.create',
|
|
94
|
+
// team
|
|
95
|
+
'configuration.team.view',
|
|
96
|
+
// users (pro)
|
|
97
|
+
'configuration.pro.edit',
|
|
98
|
+
'configuration.pro.delete',
|
|
99
|
+
'configuration.pro.create',
|
|
100
|
+
'configuration.pro.view',
|
|
101
|
+
// users (agent)
|
|
102
|
+
'configuration.agent.edit',
|
|
103
|
+
'configuration.agent.delete',
|
|
104
|
+
'configuration.agent.create',
|
|
105
|
+
'configuration.agent.view',
|
|
106
|
+
// users (admins)
|
|
107
|
+
'configuration.admin.edit',
|
|
108
|
+
'configuration.admin.delete',
|
|
109
|
+
'configuration.admin.create',
|
|
110
|
+
'configuration.admin.view',
|
|
111
|
+
// enterprise
|
|
112
|
+
'configuration.enterprise.edit',
|
|
113
|
+
'configuration.enterprise.delete',
|
|
114
|
+
'configuration.enterprise.create',
|
|
115
|
+
'configuration.enterprise.view',
|
|
116
|
+
'configuration.enterprise.payment.method.add',
|
|
117
|
+
'configuration.enterprise.payment.method.delete',
|
|
118
|
+
'configuration.enterprise.payment.history.view',
|
|
119
|
+
];
|
|
120
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/auth/policy.ts"],"names":[],"mappings":";;;AA4Ia,QAAA,IAAI,GAAa;IAC5B,cAAc;IACd,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,uBAAuB;IAEvB,eAAe;IACf,oBAAoB;IACpB,sBAAsB;IACtB,uBAAuB;IACvB,uBAAuB;IACvB,sBAAsB;IACtB,wBAAwB;IACxB,yBAAyB;IACzB,yBAAyB;IAEzB,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,yBAAyB;IACzB,gCAAgC;IAChC,qBAAqB;IACrB,oBAAoB;IAEpB,QAAQ;IACR,sBAAsB;IACtB,oBAAoB;IACpB,sBAAsB;IAEtB,QAAQ;IACR,mBAAmB;IACnB,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IAErB,YAAY;IACZ,uBAAuB;IACvB,yBAAyB;IACzB,uBAAuB;IACvB,yBAAyB;IAEzB,SAAS;IACT,oBAAoB;IACpB,sBAAsB;IACtB,oBAAoB;IACpB,sBAAsB;IAEtB,SAAS;IACT,oBAAoB;IACpB,sBAAsB;IACtB,oBAAoB;IAEpB;;OAEG;IAEH,cAA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