piper-utils 1.1.65 → 1.1.66
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/bin/main.js +162 -2
- package/bin/main.js.map +1 -1
- package/package.json +1 -1
- package/src/database/dbUtils/partnerAccess/accessContext.js +70 -0
- package/src/database/dbUtils/partnerAccess/accessGates.js +34 -0
- package/src/database/dbUtils/partnerAccess/accessScope.js +99 -0
- package/src/database/dbUtils/partnerAccess/accessWrites.js +128 -0
- package/src/database/dbUtils/partnerAccess/createAccessHelpers.js +38 -0
- package/src/index.js +82 -64
- package/src/requestResponse/errorCodes.js +5 -0
package/package.json
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { isSuperUser, isPartnerUser, getAccessRightsInfo } from '../queryStringUtils/accessRightsUtils.js';
|
|
2
|
+
import { errorList } from '../../../requestResponse/errorCodes.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the caller's access level from the Lambda event.
|
|
6
|
+
* Synchronous — reads JWT claims only, no Dynamo lookups.
|
|
7
|
+
*
|
|
8
|
+
* Returns an access object:
|
|
9
|
+
* { level: 'global' } — super user or local/test env
|
|
10
|
+
* { level: 'partner', partnerId, partnerBusinessId: null, businessIds: null }
|
|
11
|
+
* { level: 'standard', businessIds: string[] }
|
|
12
|
+
*
|
|
13
|
+
* Partner fields (partnerBusinessId, businessIds) start null and are
|
|
14
|
+
* lazy-loaded by ensurePartnerScope on first use.
|
|
15
|
+
*
|
|
16
|
+
* @param {object} event - Lambda event with Cognito authorizer claims.
|
|
17
|
+
* @returns {object} Access object.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveAccess(event) {
|
|
20
|
+
if (isSuperUser(event)) {
|
|
21
|
+
return { level: 'global' };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const env = process.env.BUILD_ENV;
|
|
25
|
+
if (env === 'local' || env === 'test') {
|
|
26
|
+
return { level: 'global' };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const partnerId = isPartnerUser(event);
|
|
30
|
+
if (partnerId) {
|
|
31
|
+
return { level: 'partner', partnerId, partnerBusinessId: null, businessIds: null };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const arBusinessIds = getAccessRightsInfo(event);
|
|
35
|
+
const businessIds = Object.keys(arBusinessIds);
|
|
36
|
+
if (businessIds.length > 0) {
|
|
37
|
+
return { level: 'standard', businessIds };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
throw errorList.unauthorized;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Lazy-load partner scope from Dynamo. Populates partnerBusinessId and
|
|
45
|
+
* businessIds on the access object, then caches for the request lifetime.
|
|
46
|
+
*
|
|
47
|
+
* No-op for non-partner access objects or if already loaded.
|
|
48
|
+
*
|
|
49
|
+
* @param {object} access - Access object from resolveAccess.
|
|
50
|
+
* @param {{ getPartnerById: Function }} deps - Injected so piper-utils stays DB-agnostic.
|
|
51
|
+
* @returns {object} The same access object, now populated.
|
|
52
|
+
*/
|
|
53
|
+
export async function ensurePartnerScope(access, { getPartnerById }) {
|
|
54
|
+
if (!access || access.level !== 'partner') {
|
|
55
|
+
return access;
|
|
56
|
+
}
|
|
57
|
+
if (access.businessIds !== null && access.businessIds !== undefined) {
|
|
58
|
+
return access;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const partner = await getPartnerById(access.partnerId);
|
|
62
|
+
access.businessIds = partner?.businessIds || [];
|
|
63
|
+
access.partnerBusinessId = partner?.partnerBusinessId || null;
|
|
64
|
+
} catch (err) {
|
|
65
|
+
console.error('partnerAccess: failed to load partner for scoping:', err);
|
|
66
|
+
access.businessIds = [];
|
|
67
|
+
access.partnerBusinessId = null;
|
|
68
|
+
}
|
|
69
|
+
return access;
|
|
70
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { errorList } from '../../../requestResponse/errorCodes.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Gate: CRM routes — rejects standard users. Super and partner pass.
|
|
5
|
+
* @param {object} access - Access object from resolveAccess.
|
|
6
|
+
*/
|
|
7
|
+
export function requireCrmAccess(access) {
|
|
8
|
+
if (!access) {
|
|
9
|
+
throw errorList.unauthorized;
|
|
10
|
+
}
|
|
11
|
+
if (access.level === 'standard') {
|
|
12
|
+
throw errorList.unauthorized;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Gate: Ticket routes — all three user types pass. Only rejects null access.
|
|
18
|
+
* @param {object} access - Access object from resolveAccess.
|
|
19
|
+
*/
|
|
20
|
+
export function requireTicketAccess(access) {
|
|
21
|
+
if (!access) {
|
|
22
|
+
throw errorList.unauthorized;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Gate: Super-only routes — throws unless global.
|
|
28
|
+
* @param {object} access - Access object from resolveAccess.
|
|
29
|
+
*/
|
|
30
|
+
export function requireSuper(access) {
|
|
31
|
+
if (!access || access.level !== 'global') {
|
|
32
|
+
throw errorList.unauthorized;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { ensurePartnerScope } from './accessContext.js';
|
|
3
|
+
import { errorList } from '../../../requestResponse/errorCodes.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Scope a WHERE clause to the partner's own business (partnerBusinessId).
|
|
7
|
+
* Use for "mine" resources: deal, activity, application, template.
|
|
8
|
+
*
|
|
9
|
+
* global → deletes where.businessId (super sees everything)
|
|
10
|
+
* partner → sets where.businessId = partnerBusinessId
|
|
11
|
+
* throws partnerNotConfigured if partnerBusinessId is missing
|
|
12
|
+
* standard → no-op (createFilters already handled)
|
|
13
|
+
*
|
|
14
|
+
* @param {object} where - Sequelize WHERE clause to mutate.
|
|
15
|
+
* @param {object} access - Access object from resolveAccess.
|
|
16
|
+
* @param {{ getPartnerById: Function }} deps
|
|
17
|
+
*/
|
|
18
|
+
export async function scopeToOwnBusiness(where, access, { getPartnerById } = {}) {
|
|
19
|
+
if (!access) {
|
|
20
|
+
throw errorList.unauthorized;
|
|
21
|
+
}
|
|
22
|
+
if (access.level === 'global') {
|
|
23
|
+
delete where.businessId;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (access.level === 'partner') {
|
|
27
|
+
await ensurePartnerScope(access, { getPartnerById });
|
|
28
|
+
if (!access.partnerBusinessId) {
|
|
29
|
+
throw errorList.partnerNotConfigured;
|
|
30
|
+
}
|
|
31
|
+
where.businessId = access.partnerBusinessId;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// standard → no-op (createFilters already injected from JWT)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Scope a WHERE clause to the partner's portfolio (businessIds array).
|
|
39
|
+
* Use for "book" resources (future transaction lists, merchant inbox views).
|
|
40
|
+
*
|
|
41
|
+
* global → deletes where.businessId
|
|
42
|
+
* partner → sets where.businessId = businessIds[]
|
|
43
|
+
* standard → no-op
|
|
44
|
+
*
|
|
45
|
+
* @param {object} where - Sequelize WHERE clause to mutate.
|
|
46
|
+
* @param {object} access - Access object from resolveAccess.
|
|
47
|
+
* @param {{ getPartnerById: Function }} deps
|
|
48
|
+
*/
|
|
49
|
+
export async function scopeToPartnerBook(where, access, { getPartnerById } = {}) {
|
|
50
|
+
if (!access) {
|
|
51
|
+
throw errorList.unauthorized;
|
|
52
|
+
}
|
|
53
|
+
if (access.level === 'global') {
|
|
54
|
+
delete where.businessId;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (access.level === 'partner') {
|
|
58
|
+
await ensurePartnerScope(access, { getPartnerById });
|
|
59
|
+
where.businessId = access.businessIds || [];
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// standard → no-op
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Scope to the union of partnerBusinessId + businessIds.
|
|
67
|
+
* Use for tickets — partner sees own tickets + portfolio merchants' tickets.
|
|
68
|
+
*
|
|
69
|
+
* global → deletes where.businessId
|
|
70
|
+
* partner → sets where.businessId = [partnerBusinessId, ...businessIds]
|
|
71
|
+
* standard → sets where.businessId = access.businessIds
|
|
72
|
+
* (explicitly handled here because ticket routes may not call
|
|
73
|
+
* createFilters before scoping, e.g. delete/resolve handlers)
|
|
74
|
+
*
|
|
75
|
+
* @param {object} where - Sequelize WHERE clause to mutate.
|
|
76
|
+
* @param {object} access - Access object from resolveAccess.
|
|
77
|
+
* @param {{ getPartnerById: Function }} deps
|
|
78
|
+
*/
|
|
79
|
+
export async function scopeToBookUnionOwn(where, access, { getPartnerById } = {}) {
|
|
80
|
+
if (!access) {
|
|
81
|
+
throw errorList.unauthorized;
|
|
82
|
+
}
|
|
83
|
+
if (access.level === 'global') {
|
|
84
|
+
delete where.businessId;
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (access.level === 'partner') {
|
|
88
|
+
await ensurePartnerScope(access, { getPartnerById });
|
|
89
|
+
const ids = _.uniq(
|
|
90
|
+
[access.partnerBusinessId, ...(access.businessIds || [])].filter(Boolean)
|
|
91
|
+
);
|
|
92
|
+
where.businessId = ids;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (access.level === 'standard') {
|
|
96
|
+
where.businessId = access.businessIds;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import { ensurePartnerScope } from './accessContext.js';
|
|
3
|
+
import { errorList } from '../../../requestResponse/errorCodes.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Assert the caller can write to their own business.
|
|
7
|
+
* For partner: businessId must equal partnerBusinessId.
|
|
8
|
+
*
|
|
9
|
+
* global → allow
|
|
10
|
+
* partner → businessId must equal partnerBusinessId; throws if not
|
|
11
|
+
* standard → throws (CRM routes gate standard users before reaching this)
|
|
12
|
+
*
|
|
13
|
+
* @param {object} access - Access object from resolveAccess.
|
|
14
|
+
* @param {string} businessId - The businessId being written to.
|
|
15
|
+
* @param {{ getPartnerById: Function }} deps
|
|
16
|
+
*/
|
|
17
|
+
export async function assertCanWriteOwnBusiness(access, businessId, { getPartnerById } = {}) {
|
|
18
|
+
if (!access) {
|
|
19
|
+
throw errorList.unauthorized;
|
|
20
|
+
}
|
|
21
|
+
if (access.level === 'global') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (access.level === 'partner') {
|
|
25
|
+
await ensurePartnerScope(access, { getPartnerById });
|
|
26
|
+
if (!access.partnerBusinessId) {
|
|
27
|
+
throw { ...errorList.partnerNotConfigured };
|
|
28
|
+
}
|
|
29
|
+
if (businessId !== access.partnerBusinessId) {
|
|
30
|
+
throw errorList.unauthorized;
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
throw errorList.unauthorized;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Assert the caller can write to a business in their portfolio.
|
|
39
|
+
* For partner: businessId must be in the businessIds array.
|
|
40
|
+
*
|
|
41
|
+
* global → allow
|
|
42
|
+
* standard → allow (handled elsewhere via checkWriteAccess)
|
|
43
|
+
* partner → businessId must be in portfolio; throws if not
|
|
44
|
+
*
|
|
45
|
+
* @param {object} access - Access object from resolveAccess.
|
|
46
|
+
* @param {string} businessId - The businessId being written to.
|
|
47
|
+
* @param {{ getPartnerById: Function }} deps
|
|
48
|
+
*/
|
|
49
|
+
export async function assertCanWriteBookBusiness(access, businessId, { getPartnerById } = {}) {
|
|
50
|
+
if (!access) {
|
|
51
|
+
throw errorList.unauthorized;
|
|
52
|
+
}
|
|
53
|
+
if (access.level === 'global') {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (access.level === 'standard') {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (access.level === 'partner') {
|
|
60
|
+
if (!businessId) {
|
|
61
|
+
throw { ...errorList.invalidRequest, message: 'businessId is required' };
|
|
62
|
+
}
|
|
63
|
+
await ensurePartnerScope(access, { getPartnerById });
|
|
64
|
+
if (!(access.businessIds || []).includes(businessId)) {
|
|
65
|
+
throw errorList.unauthorized;
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
throw errorList.unauthorized;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Assert the caller can write to a business in the union of own + portfolio.
|
|
74
|
+
* For partner: businessId must be partnerBusinessId OR in businessIds[].
|
|
75
|
+
* Used by ticket write paths.
|
|
76
|
+
*
|
|
77
|
+
* global → allow
|
|
78
|
+
* standard → allow (handled elsewhere via checkWriteAccess)
|
|
79
|
+
* partner → businessId must be in [partnerBusinessId, ...businessIds]
|
|
80
|
+
*
|
|
81
|
+
* @param {object} access - Access object from resolveAccess.
|
|
82
|
+
* @param {string} businessId - The businessId being written to.
|
|
83
|
+
* @param {{ getPartnerById: Function }} deps
|
|
84
|
+
*/
|
|
85
|
+
export async function assertCanWriteBookUnionOwn(access, businessId, { getPartnerById } = {}) {
|
|
86
|
+
if (!access) {
|
|
87
|
+
throw errorList.unauthorized;
|
|
88
|
+
}
|
|
89
|
+
if (access.level === 'global') {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (access.level === 'standard') {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (access.level === 'partner') {
|
|
96
|
+
if (!businessId) {
|
|
97
|
+
throw { ...errorList.invalidRequest, message: 'businessId is required' };
|
|
98
|
+
}
|
|
99
|
+
await ensurePartnerScope(access, { getPartnerById });
|
|
100
|
+
const allowed = _.uniq(
|
|
101
|
+
[access.partnerBusinessId, ...(access.businessIds || [])].filter(Boolean)
|
|
102
|
+
);
|
|
103
|
+
if (!allowed.includes(businessId)) {
|
|
104
|
+
throw errorList.unauthorized;
|
|
105
|
+
}
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
throw errorList.unauthorized;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Auto-stamp body.businessId from the partner's own business if missing.
|
|
113
|
+
* No-op for non-partner users or if body.businessId is already set.
|
|
114
|
+
*
|
|
115
|
+
* @param {object} access - Access object from resolveAccess.
|
|
116
|
+
* @param {object} body - Request body to mutate.
|
|
117
|
+
* @param {{ getPartnerById: Function }} deps
|
|
118
|
+
*/
|
|
119
|
+
export async function stampOwnBusinessId(access, body, { getPartnerById } = {}) {
|
|
120
|
+
if (!access || access.level !== 'partner') {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (body.businessId) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
await ensurePartnerScope(access, { getPartnerById });
|
|
127
|
+
body.businessId = access.partnerBusinessId;
|
|
128
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ensurePartnerScope } from './accessContext.js';
|
|
2
|
+
import { scopeToOwnBusiness, scopeToPartnerBook, scopeToBookUnionOwn } from './accessScope.js';
|
|
3
|
+
import {
|
|
4
|
+
assertCanWriteOwnBusiness,
|
|
5
|
+
assertCanWriteBookBusiness,
|
|
6
|
+
assertCanWriteBookUnionOwn,
|
|
7
|
+
stampOwnBusinessId
|
|
8
|
+
} from './accessWrites.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Factory that pre-binds getPartnerById into all scope/assert/stamp helpers.
|
|
12
|
+
* Bind once at module level, then call without repeating the injection:
|
|
13
|
+
*
|
|
14
|
+
* import { createAccessHelpers } from 'piper-utils';
|
|
15
|
+
* import { getPartnerById } from '../partner/partner.js';
|
|
16
|
+
*
|
|
17
|
+
* const {
|
|
18
|
+
* scopeToOwnBusiness,
|
|
19
|
+
* stampOwnBusinessId,
|
|
20
|
+
* assertCanWriteOwnBusiness
|
|
21
|
+
* } = createAccessHelpers({ getPartnerById });
|
|
22
|
+
*
|
|
23
|
+
* @param {{ getPartnerById: Function }} deps
|
|
24
|
+
* @returns {object} Pre-bound helpers.
|
|
25
|
+
*/
|
|
26
|
+
export function createAccessHelpers({ getPartnerById }) {
|
|
27
|
+
const deps = { getPartnerById };
|
|
28
|
+
return {
|
|
29
|
+
ensurePartnerScope: (access) => ensurePartnerScope(access, deps),
|
|
30
|
+
scopeToOwnBusiness: (where, access) => scopeToOwnBusiness(where, access, deps),
|
|
31
|
+
scopeToPartnerBook: (where, access) => scopeToPartnerBook(where, access, deps),
|
|
32
|
+
scopeToBookUnionOwn: (where, access) => scopeToBookUnionOwn(where, access, deps),
|
|
33
|
+
assertCanWriteOwnBusiness: (access, businessId) => assertCanWriteOwnBusiness(access, businessId, deps),
|
|
34
|
+
assertCanWriteBookBusiness: (access, businessId) => assertCanWriteBookBusiness(access, businessId, deps),
|
|
35
|
+
assertCanWriteBookUnionOwn: (access, businessId) => assertCanWriteBookUnionOwn(access, businessId, deps),
|
|
36
|
+
stampOwnBusinessId: (access, body) => stampOwnBusinessId(access, body, deps)
|
|
37
|
+
};
|
|
38
|
+
}
|
package/src/index.js
CHANGED
|
@@ -1,64 +1,82 @@
|
|
|
1
|
-
import { handleFile as handleFileImport } from './eventManager/handleFile.js';
|
|
2
|
-
import { watchBucket as watchBucketImport } from './eventManager/watchBucket.js';
|
|
3
|
-
import { publishEvents as publishEventsImport } from './eventManager/publishEvents.js';
|
|
4
|
-
import { createIncludes as createIncludesImport } from './database/dbUtils/queryStringUtils/createIncludes.js';
|
|
5
|
-
import { createFilters as createFiltersImport } from './database/dbUtils/queryStringUtils/createFilters.js';
|
|
6
|
-
import { createSort as createSortImport } from './database/dbUtils/queryStringUtils/createSort.js';
|
|
7
|
-
import { findAll as findAllImport } from './database/dbUtils/queryStringUtils/findAll.js';
|
|
8
|
-
import { checkModule as checkModuleImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
9
|
-
import { checkIsSuper as checkIsSuperImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
10
|
-
import { getModuleInfo as getModuleInfoImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
11
|
-
import { getAccessRightsInfo as getAccessRightsInfoImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
12
|
-
import { getDefaultBusinessIDInfo as getDefaultBusinessIDInfoImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
13
|
-
import { failure as failureImport, success as successImport } from './requestResponse/requestResponse.js';
|
|
14
|
-
import { runMigrations as runMigrationsImport } from './database/dbSetup/migrations.js';
|
|
15
|
-
import { getCurrentUser as getCurrentUserImport } from './requestResponse/requestResponse.js';
|
|
16
|
-
import { successHtml as successHtmlImport } from './requestResponse/requestResponse.js';
|
|
17
|
-
import { getCurrentUserNameFromCognitoEvent as getCurrentUserNameFromCognitoEventImport } from './requestResponse/requestResponse.js';
|
|
18
|
-
import { defaultFilters as defaultFiltersImport } from './database/dbUtils/queryStringUtils/defaultFilters.js';
|
|
19
|
-
import { accessRightsUtils as accessRightsUtilsImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
20
|
-
import { parseBody as parseBodyImport } from './requestResponse/requestResponse.js';
|
|
21
|
-
import { parseEvent as parseEventImport } from './requestResponse/requestResponse.js';
|
|
22
|
-
import { getBusinessesInfo as getBusinessesInfoImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
23
|
-
import { userDefaultBid as userDefaultBidImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
24
|
-
import { checkWriteAccess as checkWriteAccessImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
25
|
-
import { isSystemUser as isSystemUserImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
26
|
-
import { isSuperUser as isSuperUserImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
27
|
-
import { isPartnerUser as isPartnerUserImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
28
|
-
import { getBelongsToPartnerId as getBelongsToPartnerIdImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
29
|
-
import { getEffectivePartnerId as getEffectivePartnerIdImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
30
|
-
import { enrichEventWithPartnerAccess as enrichEventWithPartnerAccessImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
31
|
-
import { getCompanySettings as getCompanySettingsImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export const
|
|
39
|
-
export const
|
|
40
|
-
export const
|
|
41
|
-
export const
|
|
42
|
-
export const
|
|
43
|
-
export const
|
|
44
|
-
export const
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
47
|
-
export const
|
|
48
|
-
export const
|
|
49
|
-
export const
|
|
50
|
-
export const
|
|
51
|
-
export const
|
|
52
|
-
export const
|
|
53
|
-
export const
|
|
54
|
-
export const
|
|
55
|
-
export const
|
|
56
|
-
export const
|
|
57
|
-
export const
|
|
58
|
-
export const
|
|
59
|
-
export const
|
|
60
|
-
export const
|
|
61
|
-
export const
|
|
62
|
-
export const
|
|
63
|
-
export const
|
|
64
|
-
export const
|
|
1
|
+
import { handleFile as handleFileImport } from './eventManager/handleFile.js';
|
|
2
|
+
import { watchBucket as watchBucketImport } from './eventManager/watchBucket.js';
|
|
3
|
+
import { publishEvents as publishEventsImport } from './eventManager/publishEvents.js';
|
|
4
|
+
import { createIncludes as createIncludesImport } from './database/dbUtils/queryStringUtils/createIncludes.js';
|
|
5
|
+
import { createFilters as createFiltersImport } from './database/dbUtils/queryStringUtils/createFilters.js';
|
|
6
|
+
import { createSort as createSortImport } from './database/dbUtils/queryStringUtils/createSort.js';
|
|
7
|
+
import { findAll as findAllImport } from './database/dbUtils/queryStringUtils/findAll.js';
|
|
8
|
+
import { checkModule as checkModuleImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
9
|
+
import { checkIsSuper as checkIsSuperImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
10
|
+
import { getModuleInfo as getModuleInfoImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
11
|
+
import { getAccessRightsInfo as getAccessRightsInfoImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
12
|
+
import { getDefaultBusinessIDInfo as getDefaultBusinessIDInfoImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
13
|
+
import { failure as failureImport, success as successImport } from './requestResponse/requestResponse.js';
|
|
14
|
+
import { runMigrations as runMigrationsImport } from './database/dbSetup/migrations.js';
|
|
15
|
+
import { getCurrentUser as getCurrentUserImport } from './requestResponse/requestResponse.js';
|
|
16
|
+
import { successHtml as successHtmlImport } from './requestResponse/requestResponse.js';
|
|
17
|
+
import { getCurrentUserNameFromCognitoEvent as getCurrentUserNameFromCognitoEventImport } from './requestResponse/requestResponse.js';
|
|
18
|
+
import { defaultFilters as defaultFiltersImport } from './database/dbUtils/queryStringUtils/defaultFilters.js';
|
|
19
|
+
import { accessRightsUtils as accessRightsUtilsImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
20
|
+
import { parseBody as parseBodyImport } from './requestResponse/requestResponse.js';
|
|
21
|
+
import { parseEvent as parseEventImport } from './requestResponse/requestResponse.js';
|
|
22
|
+
import { getBusinessesInfo as getBusinessesInfoImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
23
|
+
import { userDefaultBid as userDefaultBidImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
24
|
+
import { checkWriteAccess as checkWriteAccessImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
25
|
+
import { isSystemUser as isSystemUserImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
26
|
+
import { isSuperUser as isSuperUserImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
27
|
+
import { isPartnerUser as isPartnerUserImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
28
|
+
import { getBelongsToPartnerId as getBelongsToPartnerIdImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
29
|
+
import { getEffectivePartnerId as getEffectivePartnerIdImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
30
|
+
import { enrichEventWithPartnerAccess as enrichEventWithPartnerAccessImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
31
|
+
import { getCompanySettings as getCompanySettingsImport } from './database/dbUtils/queryStringUtils/accessRightsUtils.js';
|
|
32
|
+
import { resolveAccess as resolveAccessImport, ensurePartnerScope as ensurePartnerScopeImport } from './database/dbUtils/partnerAccess/accessContext.js';
|
|
33
|
+
import { requireCrmAccess as requireCrmAccessImport, requireTicketAccess as requireTicketAccessImport, requireSuper as requireSuperImport } from './database/dbUtils/partnerAccess/accessGates.js';
|
|
34
|
+
import { scopeToOwnBusiness as scopeToOwnBusinessImport, scopeToPartnerBook as scopeToPartnerBookImport, scopeToBookUnionOwn as scopeToBookUnionOwnImport } from './database/dbUtils/partnerAccess/accessScope.js';
|
|
35
|
+
import { assertCanWriteOwnBusiness as assertCanWriteOwnBusinessImport, assertCanWriteBookBusiness as assertCanWriteBookBusinessImport, assertCanWriteBookUnionOwn as assertCanWriteBookUnionOwnImport, stampOwnBusinessId as stampOwnBusinessIdImport } from './database/dbUtils/partnerAccess/accessWrites.js';
|
|
36
|
+
import { createAccessHelpers as createAccessHelpersImport } from './database/dbUtils/partnerAccess/createAccessHelpers.js';
|
|
37
|
+
|
|
38
|
+
export const handleFile = handleFileImport;
|
|
39
|
+
export const watchBucket = watchBucketImport;
|
|
40
|
+
export const publishEvents = publishEventsImport;
|
|
41
|
+
export const createFilters = createFiltersImport;
|
|
42
|
+
export const createIncludes = createIncludesImport;
|
|
43
|
+
export const createSort = createSortImport;
|
|
44
|
+
export const findAll = findAllImport;
|
|
45
|
+
export const checkModule = checkModuleImport;
|
|
46
|
+
export const checkIsSuper = checkIsSuperImport;
|
|
47
|
+
export const getAccessRightsInfo = getAccessRightsInfoImport;
|
|
48
|
+
export const getDefaultBusinessIDInfo = getDefaultBusinessIDInfoImport;
|
|
49
|
+
export const getModuleInfo = getModuleInfoImport;
|
|
50
|
+
export const failure = failureImport;
|
|
51
|
+
export const success = successImport;
|
|
52
|
+
export const runMigrations = runMigrationsImport;
|
|
53
|
+
export const getCurrentUser = getCurrentUserImport;
|
|
54
|
+
export const successHtml = successHtmlImport;
|
|
55
|
+
export const getCurrentUserNameFromCognitoEvent = getCurrentUserNameFromCognitoEventImport;
|
|
56
|
+
export const defaultFilters = defaultFiltersImport;
|
|
57
|
+
export const accessRightsUtils = accessRightsUtilsImport;
|
|
58
|
+
export const parseBody = parseBodyImport;
|
|
59
|
+
export const parseEvent = parseEventImport;
|
|
60
|
+
export const getBusinessesInfo = getBusinessesInfoImport;
|
|
61
|
+
export const userDefaultBid = userDefaultBidImport;
|
|
62
|
+
export const checkWriteAccess = checkWriteAccessImport;
|
|
63
|
+
export const isSystemUser = isSystemUserImport;
|
|
64
|
+
export const isSuperUser = isSuperUserImport;
|
|
65
|
+
export const isPartnerUser = isPartnerUserImport;
|
|
66
|
+
export const getBelongsToPartnerId = getBelongsToPartnerIdImport;
|
|
67
|
+
export const getEffectivePartnerId = getEffectivePartnerIdImport;
|
|
68
|
+
export const enrichEventWithPartnerAccess = enrichEventWithPartnerAccessImport;
|
|
69
|
+
export const getCompanySettings = getCompanySettingsImport;
|
|
70
|
+
export const resolveAccess = resolveAccessImport;
|
|
71
|
+
export const ensurePartnerScope = ensurePartnerScopeImport;
|
|
72
|
+
export const requireCrmAccess = requireCrmAccessImport;
|
|
73
|
+
export const requireTicketAccess = requireTicketAccessImport;
|
|
74
|
+
export const requireSuper = requireSuperImport;
|
|
75
|
+
export const scopeToOwnBusiness = scopeToOwnBusinessImport;
|
|
76
|
+
export const scopeToPartnerBook = scopeToPartnerBookImport;
|
|
77
|
+
export const scopeToBookUnionOwn = scopeToBookUnionOwnImport;
|
|
78
|
+
export const assertCanWriteOwnBusiness = assertCanWriteOwnBusinessImport;
|
|
79
|
+
export const assertCanWriteBookBusiness = assertCanWriteBookBusinessImport;
|
|
80
|
+
export const assertCanWriteBookUnionOwn = assertCanWriteBookUnionOwnImport;
|
|
81
|
+
export const stampOwnBusinessId = stampOwnBusinessIdImport;
|
|
82
|
+
export const createAccessHelpers = createAccessHelpersImport;
|