@qrvey/assets-sharing 0.3.4 → 0.3.5-1236
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/common/constants.js +11 -1
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/util.js +5 -0
- package/dist/cjs/common/util.js.map +1 -1
- package/dist/cjs/context.js +6 -0
- package/dist/cjs/context.js.map +1 -1
- package/dist/cjs/index.js +23 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/quser/implementations/group.model.js +3 -0
- package/dist/cjs/quser/implementations/group.model.js.map +1 -1
- package/dist/cjs/quser/implementations/group.repository.js +22 -1
- package/dist/cjs/quser/implementations/group.repository.js.map +1 -1
- package/dist/cjs/quser/implementations/permission.repository.js +27 -0
- package/dist/cjs/quser/implementations/permission.repository.js.map +1 -0
- package/dist/cjs/quser/interfaces/permissionsRepository.interface.js +3 -0
- package/dist/cjs/quser/interfaces/permissionsRepository.interface.js.map +1 -0
- package/dist/cjs/quser/services/fromTokenToUser.js +5 -1
- package/dist/cjs/quser/services/fromTokenToUser.js.map +1 -1
- package/dist/cjs/quser/services/hasAdminRole.js +31 -12
- package/dist/cjs/quser/services/hasAdminRole.js.map +1 -1
- package/dist/cjs/quser/services/hasSharingPermission.js +47 -0
- package/dist/cjs/quser/services/hasSharingPermission.js.map +1 -0
- package/dist/cjs/sharing/entities/details.js +13 -2
- package/dist/cjs/sharing/entities/details.js.map +1 -1
- package/dist/cjs/sharing/entities/types/orgTreeResult.js +10 -0
- package/dist/cjs/sharing/entities/types/orgTreeResult.js.map +1 -0
- package/dist/cjs/sharing/entities/types/organization.type.js +3 -0
- package/dist/cjs/sharing/entities/types/organization.type.js.map +1 -0
- package/dist/cjs/sharing/implementations/admin.repository.js +30 -0
- package/dist/cjs/sharing/implementations/admin.repository.js.map +1 -0
- package/dist/cjs/sharing/implementations/details.repository.js +13 -4
- package/dist/cjs/sharing/implementations/details.repository.js.map +1 -1
- package/dist/cjs/sharing/implementations/organization.model.js +31 -0
- package/dist/cjs/sharing/implementations/organization.model.js.map +1 -0
- package/dist/cjs/sharing/implementations/organization.repository.js +73 -0
- package/dist/cjs/sharing/implementations/organization.repository.js.map +1 -0
- package/dist/cjs/sharing/implementations/sharing.model.js +4 -2
- package/dist/cjs/sharing/implementations/sharing.model.js.map +1 -1
- package/dist/cjs/sharing/interfaces/adminRepository.interface.js +3 -0
- package/dist/cjs/sharing/interfaces/adminRepository.interface.js.map +1 -0
- package/dist/cjs/sharing/interfaces/organizationRepository.interface.js +3 -0
- package/dist/cjs/sharing/interfaces/organizationRepository.interface.js.map +1 -0
- package/dist/cjs/sharing/services/checkAppAccess.js +47 -0
- package/dist/cjs/sharing/services/checkAppAccess.js.map +1 -0
- package/dist/cjs/sharing/services/checkOrgPermissions.js +36 -0
- package/dist/cjs/sharing/services/checkOrgPermissions.js.map +1 -0
- package/dist/cjs/sharing/services/checkUserAccessLevel.js +30 -7
- package/dist/cjs/sharing/services/checkUserAccessLevel.js.map +1 -1
- package/dist/cjs/sharing/services/delete.js +5 -1
- package/dist/cjs/sharing/services/delete.js.map +1 -1
- package/dist/cjs/sharing/services/getOrgTree.js +31 -0
- package/dist/cjs/sharing/services/getOrgTree.js.map +1 -0
- package/dist/cjs/sharing/services/list.js +5 -1
- package/dist/cjs/sharing/services/list.js.map +1 -1
- package/dist/cjs/sharing/services/upsert.js +11 -2
- package/dist/cjs/sharing/services/upsert.js.map +1 -1
- package/dist/cjs/sharing/services/upsertDefaultSharing.js +71 -0
- package/dist/cjs/sharing/services/upsertDefaultSharing.js.map +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/index.mjs +1089 -312
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +348 -54
- package/package.json +60 -51
- package/.eslintrc +0 -88
- package/__test__/hasAdminRole.test.ts +0 -299
- package/jest.config.ts +0 -15
- package/src/common/common.type.ts +0 -33
- package/src/common/constants.ts +0 -47
- package/src/common/persistence/base.ts +0 -13
- package/src/common/persistence/poolClient.ts +0 -7
- package/src/common/util.ts +0 -8
- package/src/context.ts +0 -35
- package/src/index.ts +0 -38
- package/src/quser/entities/types/user.type.ts +0 -14
- package/src/quser/entities/user.ts +0 -31
- package/src/quser/implementations/group.model.ts +0 -18
- package/src/quser/implementations/group.repository.ts +0 -20
- package/src/quser/implementations/user.model.ts +0 -23
- package/src/quser/implementations/user.repository.ts +0 -35
- package/src/quser/interfaces/rolesRepository.interface.ts +0 -3
- package/src/quser/interfaces/userRepository.interface.ts +0 -10
- package/src/quser/services/fromTokenToUser.ts +0 -49
- package/src/quser/services/hasAdminRole.ts +0 -52
- package/src/sharing/entities/details.ts +0 -144
- package/src/sharing/entities/sharing.ts +0 -84
- package/src/sharing/entities/types/details.type.ts +0 -58
- package/src/sharing/entities/types/sharing.type.ts +0 -24
- package/src/sharing/implementations/details.model.ts +0 -93
- package/src/sharing/implementations/details.repository.ts +0 -154
- package/src/sharing/implementations/dm.model.ts +0 -21
- package/src/sharing/implementations/dm.repository.ts +0 -23
- package/src/sharing/implementations/dx.model.ts +0 -30
- package/src/sharing/implementations/dx.repository.ts +0 -22
- package/src/sharing/implementations/sharing.model.ts +0 -33
- package/src/sharing/implementations/sharing.repository.ts +0 -36
- package/src/sharing/interfaces/dashboardRepository.interface.ts +0 -3
- package/src/sharing/interfaces/detailsRepository.interface.ts +0 -60
- package/src/sharing/interfaces/downloadManagerRepository.interface.ts +0 -3
- package/src/sharing/interfaces/sharingRepository.interface.ts +0 -32
- package/src/sharing/services/checkUserAccessLevel.ts +0 -63
- package/src/sharing/services/delete.ts +0 -24
- package/src/sharing/services/list.ts +0 -53
- package/src/sharing/services/upsert.ts +0 -197
- package/tsconfig.cjs.json +0 -7
- package/tsconfig.json +0 -19
- package/tsup.config.cjs.ts +0 -11
- package/tsup.config.esm.ts +0 -12
- package/tsup.config.types.ts +0 -9
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,83 @@
|
|
|
1
|
+
declare const ORGANIZATION_QRVEY = "org:0";
|
|
2
|
+
declare const USER_ANONYMOUS = "anonymous";
|
|
3
|
+
declare enum ASSET_TYPE {
|
|
4
|
+
DX = "DX",// DASHBOARD X (Next Gen)
|
|
5
|
+
DM = "DM"
|
|
6
|
+
}
|
|
7
|
+
declare enum SHARED_ORIGIN {
|
|
8
|
+
INTERNAL = "INTERNAL",// for org:0
|
|
9
|
+
EXTERNAL = "EXTERNAL",// for orgs different that 0
|
|
10
|
+
UNKNOWN = "UNKNOWN"
|
|
11
|
+
}
|
|
12
|
+
declare enum SHARE_TYPE {
|
|
13
|
+
USER = "USER",
|
|
14
|
+
ROLE = "ROLE",
|
|
15
|
+
ORGANIZATION = "ORGANIZATION",
|
|
16
|
+
TENANT = "TENANT"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Access levels for assets.
|
|
20
|
+
* Those are calculated with Base 2, so:
|
|
21
|
+
* - NONE = 0 (undefined)
|
|
22
|
+
* - CAN_USE = 1 (2^0)
|
|
23
|
+
* - CAN_EDIT = 2 (2^1)
|
|
24
|
+
* - ADMIN = 4 (2^2)
|
|
25
|
+
* - (Future) SUPER = 8 (2^3)
|
|
26
|
+
*/
|
|
27
|
+
declare enum ACCESS_LEVEL {
|
|
28
|
+
NONE = 0,
|
|
29
|
+
CAN_USE = 1,
|
|
30
|
+
CAN_EDIT = 2,
|
|
31
|
+
ADMIN = 4
|
|
32
|
+
}
|
|
33
|
+
declare enum APP_SHARING_STATUS {
|
|
34
|
+
PUBLIC = "public",
|
|
35
|
+
PRIVATE = "private",
|
|
36
|
+
SHARED = "shared"
|
|
37
|
+
}
|
|
38
|
+
interface AppAccessResponse {
|
|
39
|
+
hasAccess: boolean;
|
|
40
|
+
}
|
|
41
|
+
interface AppOwner {
|
|
42
|
+
userId: string;
|
|
43
|
+
appId: string;
|
|
44
|
+
userEmail?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface BaseSharing {
|
|
48
|
+
assetId: string;
|
|
49
|
+
assetType: ASSET_TYPE;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
updatedAt: string;
|
|
52
|
+
deletedAt?: string;
|
|
53
|
+
}
|
|
54
|
+
type CreateSharing = Omit<BaseSharing, 'createdAt' | 'updatedAt' | 'deletedAt'>;
|
|
55
|
+
type ResponseSharing = Omit<BaseSharing, 'deletedAt'>;
|
|
56
|
+
interface SharingTable {
|
|
57
|
+
asset_id: string;
|
|
58
|
+
asset_type: ASSET_TYPE | string;
|
|
59
|
+
created_at: string;
|
|
60
|
+
updated_at: string;
|
|
61
|
+
deleted_at?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
declare class Sharing {
|
|
65
|
+
private assetId;
|
|
66
|
+
private assetType;
|
|
67
|
+
private createdAt;
|
|
68
|
+
private updatedAt;
|
|
69
|
+
private deletedAt?;
|
|
70
|
+
constructor(params: BaseSharing);
|
|
71
|
+
static create(params: CreateSharing): Sharing;
|
|
72
|
+
static parse(params: SharingTable): Sharing;
|
|
73
|
+
update(): void;
|
|
74
|
+
toTable(): SharingTable;
|
|
75
|
+
toPlain(): BaseSharing;
|
|
76
|
+
toJSON(): ResponseSharing;
|
|
77
|
+
get getAssetId(): string;
|
|
78
|
+
get getAssetType(): string;
|
|
79
|
+
}
|
|
80
|
+
|
|
1
81
|
interface Pagination {
|
|
2
82
|
limit: number;
|
|
3
83
|
from?: number;
|
|
@@ -27,43 +107,42 @@ interface ListOutput<T> {
|
|
|
27
107
|
pagination: Pagination;
|
|
28
108
|
}
|
|
29
109
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
orgId?: string;
|
|
35
|
-
loginType?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
declare const ORGANIZATION_QRVEY = "org:0";
|
|
39
|
-
declare enum ASSET_TYPE {
|
|
40
|
-
DX = "DX",// DASHBOARD X (Next Gen)
|
|
41
|
-
DM = "DM"
|
|
110
|
+
declare enum HIERARCHY_SCOPE {
|
|
111
|
+
CHILDREN = "children",
|
|
112
|
+
PARENTS = "parents",
|
|
113
|
+
BOTH = "both"
|
|
42
114
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
UNKNOWN = "UNKNOWN"
|
|
115
|
+
interface OrgHierarchyResult {
|
|
116
|
+
childrenIds: string[];
|
|
117
|
+
parentIds: string[];
|
|
47
118
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
119
|
+
|
|
120
|
+
interface SharingRepositoryInterface {
|
|
121
|
+
/**
|
|
122
|
+
* Retrieves a sharing record by its asset ID.
|
|
123
|
+
* @param assetId - The ID of the asset to retrieve.
|
|
124
|
+
* @returns A promise that resolves to the sharing record or null if not found.
|
|
125
|
+
*/
|
|
126
|
+
getOne(assetId: string): Promise<SharingTable | null>;
|
|
127
|
+
/**
|
|
128
|
+
* Creates a new sharing record.
|
|
129
|
+
* @param sharing - The sharing record to create.
|
|
130
|
+
* @returns A promise that resolves to the created sharing record.
|
|
131
|
+
*/
|
|
132
|
+
create(sharing: SharingTable): Promise<SharingTable>;
|
|
133
|
+
/**
|
|
134
|
+
* Updates a sharing record by its ID.
|
|
135
|
+
* @param assetId - The ID of the sharing record to update.
|
|
136
|
+
* @param sharing - The updated sharing record.
|
|
137
|
+
* @returns A promise that resolves to a boolean indicating whether the update was successful.
|
|
138
|
+
*/
|
|
139
|
+
patch(assetId: string, sharing: SharingTable): Promise<boolean>;
|
|
140
|
+
/**
|
|
141
|
+
* Deletes a sharing record by its ID.
|
|
142
|
+
* @param assetId - The ID of the sharing record to delete.
|
|
143
|
+
* @returns A promise that resolves to a boolean indicating whether the deletion was successful.
|
|
144
|
+
*/
|
|
145
|
+
delete(assetId: string): Promise<boolean>;
|
|
67
146
|
}
|
|
68
147
|
|
|
69
148
|
interface Delete {
|
|
@@ -87,11 +166,104 @@ type ResponseSharingDetails = Omit<BaseSharingDetails, 'sharingDetailsId' | 'del
|
|
|
87
166
|
sharedId: string;
|
|
88
167
|
accessLevelAsText: string;
|
|
89
168
|
};
|
|
169
|
+
interface SharingDetailsTable {
|
|
170
|
+
sharing_details_id: string;
|
|
171
|
+
asset_id: string;
|
|
172
|
+
access_level: number;
|
|
173
|
+
org_id: string;
|
|
174
|
+
shared_with: string;
|
|
175
|
+
shared_type: string;
|
|
176
|
+
shared_email?: string;
|
|
177
|
+
share_origin: string;
|
|
178
|
+
created_at: string;
|
|
179
|
+
updated_at: string;
|
|
180
|
+
deleted_at?: string;
|
|
181
|
+
}
|
|
90
182
|
type GetSharingList = ListInput<{
|
|
91
183
|
assetId: string;
|
|
92
184
|
}>;
|
|
93
185
|
type ListSharingDetails = ListOutput<ResponseSharingDetails>;
|
|
94
186
|
|
|
187
|
+
interface RoleRepositoryInterface {
|
|
188
|
+
getOne(identifier: string): Promise<{
|
|
189
|
+
groupid: string;
|
|
190
|
+
} | null>;
|
|
191
|
+
getByName(name: string): Promise<{
|
|
192
|
+
groupid: string;
|
|
193
|
+
permissions: {
|
|
194
|
+
contentAdministration: boolean;
|
|
195
|
+
assetSharing: boolean;
|
|
196
|
+
};
|
|
197
|
+
} | null>;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface BaseUser {
|
|
201
|
+
userid: string;
|
|
202
|
+
email: string;
|
|
203
|
+
groups: string[];
|
|
204
|
+
organization: string;
|
|
205
|
+
}
|
|
206
|
+
interface UserToken {
|
|
207
|
+
userId: string;
|
|
208
|
+
clientId?: string;
|
|
209
|
+
roles?: string[];
|
|
210
|
+
orgId?: string;
|
|
211
|
+
loginType?: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
interface UserRepositoryInterface {
|
|
215
|
+
getOne(identifier: string): Promise<BaseUser | null>;
|
|
216
|
+
getList(options: ListInput<{
|
|
217
|
+
identifier: string;
|
|
218
|
+
role?: string;
|
|
219
|
+
}>): Promise<ListOutput<BaseUser>>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
interface SharingDetailsRepositoryInterface {
|
|
223
|
+
/**
|
|
224
|
+
* Retrieves a single sharing detail by its ID.
|
|
225
|
+
* @param sharingDetailId - The ID of the sharing detail to retrieve.
|
|
226
|
+
* @returns A promise that resolves to the sharing detail or null if not found.
|
|
227
|
+
*/
|
|
228
|
+
getOne(sharingDetailId: string): Promise<SharingDetailsTable | null>;
|
|
229
|
+
/**
|
|
230
|
+
* Retrieves a single sharing detail by its asset ID and the user it is shared with.
|
|
231
|
+
* @param assetId - The ID of the asset.
|
|
232
|
+
* @param sharedWith - The user with whom the asset is shared.
|
|
233
|
+
* @returns A promise that resolves to the sharing detail or null if not found.
|
|
234
|
+
*/
|
|
235
|
+
getBySharedWith(assetId: string, sharedWith: string): Promise<SharingDetailsTable | null>;
|
|
236
|
+
/**
|
|
237
|
+
* Retrieves a list of sharing details based on the provided options.
|
|
238
|
+
* @param options - An object containing the asset ID to filter the sharing details.
|
|
239
|
+
* @returns A promise that resolves to an array of sharing details.
|
|
240
|
+
*/
|
|
241
|
+
getList(options: ListInput<{
|
|
242
|
+
assetId: string;
|
|
243
|
+
user?: ParamsFromTokenToUser;
|
|
244
|
+
parentOrgIds?: string[];
|
|
245
|
+
}>): Promise<ListOutput<SharingDetailsTable>>;
|
|
246
|
+
/**
|
|
247
|
+
* Creates a new sharing detail in the repository.
|
|
248
|
+
* @param details - The sharing detail to create.
|
|
249
|
+
* @returns A promise that resolves to the created sharing detail.
|
|
250
|
+
*/
|
|
251
|
+
create(details: SharingDetailsTable): Promise<SharingDetailsTable>;
|
|
252
|
+
/**
|
|
253
|
+
* Updates an existing sharing detail in the repository.
|
|
254
|
+
* @param sharingDetailId - The ID of the sharing detail to update.
|
|
255
|
+
* @param details - The updated sharing detail.
|
|
256
|
+
* @returns A promise that resolves to a boolean indicating success or failure.
|
|
257
|
+
*/
|
|
258
|
+
patch(sharingDetailId: string, details: SharingDetailsTable): Promise<boolean>;
|
|
259
|
+
/**
|
|
260
|
+
* Deletes a sharing detail from the repository.
|
|
261
|
+
* @param sharingDetailId - The ID of the sharing detail to delete.
|
|
262
|
+
* @returns A promise that resolves to a boolean indicating success or failure.
|
|
263
|
+
*/
|
|
264
|
+
delete(sharingDetailId: string): Promise<boolean>;
|
|
265
|
+
}
|
|
266
|
+
|
|
95
267
|
interface SharingWith {
|
|
96
268
|
sharedId?: string;
|
|
97
269
|
sharedWith: string;
|
|
@@ -110,6 +282,136 @@ interface UpsertInterface {
|
|
|
110
282
|
}>;
|
|
111
283
|
}
|
|
112
284
|
|
|
285
|
+
declare class FromTokenToUser {
|
|
286
|
+
private readonly userRepository;
|
|
287
|
+
constructor(userRepository: UserRepositoryInterface);
|
|
288
|
+
execute({ body, }: {
|
|
289
|
+
body: UserToken;
|
|
290
|
+
}): Promise<ParamsFromTokenToUser>;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
interface PermissionRepositoryInterface {
|
|
294
|
+
getPermission(userIdentifier: string): Promise<{
|
|
295
|
+
contentAdministration: boolean;
|
|
296
|
+
assetSharing: boolean;
|
|
297
|
+
} | null>;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* This methods must be called HasContentAdministrationPermission,
|
|
302
|
+
* but for backward compatibility, we keep the name HasAdminRole
|
|
303
|
+
*/
|
|
304
|
+
declare class HasAdminRole {
|
|
305
|
+
private readonly userRepository;
|
|
306
|
+
private readonly permissionRepository;
|
|
307
|
+
private readonly roleRepository;
|
|
308
|
+
constructor(userRepository: UserRepositoryInterface, permissionRepository: PermissionRepositoryInterface, roleRepository: RoleRepositoryInterface);
|
|
309
|
+
execute({ apiKey, clientId, orgId, userId, loginType, roles, }?: {
|
|
310
|
+
apiKey?: string;
|
|
311
|
+
clientId?: string;
|
|
312
|
+
orgId?: string;
|
|
313
|
+
userId?: string;
|
|
314
|
+
loginType?: string;
|
|
315
|
+
roles?: string[];
|
|
316
|
+
}): Promise<boolean>;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
declare class HasSharingPermission {
|
|
320
|
+
private readonly permissionRepository;
|
|
321
|
+
private readonly roleRepository;
|
|
322
|
+
constructor(permissionRepository: PermissionRepositoryInterface, roleRepository: RoleRepositoryInterface);
|
|
323
|
+
execute({ clientId, userId, roles, }?: {
|
|
324
|
+
apiKey?: string;
|
|
325
|
+
clientId?: string;
|
|
326
|
+
orgId?: string;
|
|
327
|
+
userId?: string;
|
|
328
|
+
loginType?: string;
|
|
329
|
+
roles?: string[];
|
|
330
|
+
}): Promise<boolean>;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
interface AdminRepositoryInterface {
|
|
334
|
+
getApplicationInfo(params: {
|
|
335
|
+
appId: string;
|
|
336
|
+
userId: string;
|
|
337
|
+
}): Promise<{
|
|
338
|
+
status: number;
|
|
339
|
+
data: AppOwner;
|
|
340
|
+
}>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
declare class CheckAppAccess {
|
|
344
|
+
private readonly adminRepository;
|
|
345
|
+
constructor(adminRepository: AdminRepositoryInterface);
|
|
346
|
+
execute({ appId, userId, }: {
|
|
347
|
+
appId: string;
|
|
348
|
+
userId: string;
|
|
349
|
+
}): Promise<AppAccessResponse>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
interface OrganizationType {
|
|
353
|
+
orgId: string;
|
|
354
|
+
name: string;
|
|
355
|
+
parent_org_id: string | null;
|
|
356
|
+
org_path: string;
|
|
357
|
+
asset_sharing: boolean;
|
|
358
|
+
effective_asset_sharing: boolean;
|
|
359
|
+
created_at: string;
|
|
360
|
+
updated_at: string;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
interface OrganizationRepositoryInterface {
|
|
364
|
+
getOne(orgId: string): Promise<OrganizationType | null>;
|
|
365
|
+
getOrgTree(orgId: string, scope: HIERARCHY_SCOPE): Promise<OrgHierarchyResult>;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
declare class CheckOrgPermissions {
|
|
369
|
+
private readonly organizationRepository;
|
|
370
|
+
constructor(organizationRepository: OrganizationRepositoryInterface);
|
|
371
|
+
execute({ orgId, }: {
|
|
372
|
+
orgId: string;
|
|
373
|
+
}): Promise<{
|
|
374
|
+
privacy: APP_SHARING_STATUS;
|
|
375
|
+
}>;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
declare class CheckUserAccessLevel {
|
|
379
|
+
private readonly detailsRepository;
|
|
380
|
+
private readonly organizationRepository;
|
|
381
|
+
constructor(detailsRepository: SharingDetailsRepositoryInterface, organizationRepository: OrganizationRepositoryInterface);
|
|
382
|
+
execute({ userId, assetId, assetOrgId, clientId, loginType, roles, orgId, }: {
|
|
383
|
+
assetId: string;
|
|
384
|
+
assetOrgId: string;
|
|
385
|
+
userId: string;
|
|
386
|
+
clientId?: string;
|
|
387
|
+
loginType?: string;
|
|
388
|
+
roles?: string[];
|
|
389
|
+
orgId?: string;
|
|
390
|
+
}): Promise<{
|
|
391
|
+
level: ACCESS_LEVEL;
|
|
392
|
+
levelAsText: string;
|
|
393
|
+
}>;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
declare class GetOrgTree {
|
|
397
|
+
private readonly organizationRepository;
|
|
398
|
+
constructor(organizationRepository: OrganizationRepositoryInterface);
|
|
399
|
+
execute(orgId: string, scope?: HIERARCHY_SCOPE): Promise<OrgHierarchyResult>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
declare class SetDefaultSharing {
|
|
403
|
+
private readonly sharingRepository;
|
|
404
|
+
private readonly detailsRepository;
|
|
405
|
+
private readonly adminRepository;
|
|
406
|
+
constructor(sharingRepository: SharingRepositoryInterface, detailsRepository: SharingDetailsRepositoryInterface, adminRepository: AdminRepositoryInterface);
|
|
407
|
+
execute({ assetId, assetType, orgId, sharedOrigin, }: {
|
|
408
|
+
assetId: string;
|
|
409
|
+
assetType: ASSET_TYPE;
|
|
410
|
+
orgId: string;
|
|
411
|
+
sharedOrigin: SHARED_ORIGIN;
|
|
412
|
+
}): Promise<Sharing>;
|
|
413
|
+
}
|
|
414
|
+
|
|
113
415
|
declare const api: {
|
|
114
416
|
upsert: (args_0: {
|
|
115
417
|
body: UpsertInterface;
|
|
@@ -121,26 +423,18 @@ declare const api: {
|
|
|
121
423
|
body: Delete;
|
|
122
424
|
}) => Promise<boolean | null>;
|
|
123
425
|
};
|
|
124
|
-
declare const checkUserAccessLevel: (
|
|
125
|
-
assetId: string;
|
|
126
|
-
userId: string;
|
|
127
|
-
clientId?: string;
|
|
128
|
-
loginType?: string;
|
|
129
|
-
roles?: string[];
|
|
130
|
-
orgId?: string;
|
|
131
|
-
}) => Promise<{
|
|
426
|
+
declare const checkUserAccessLevel: (...args: Parameters<CheckUserAccessLevel["execute"]>) => Promise<{
|
|
132
427
|
level: ACCESS_LEVEL;
|
|
133
428
|
levelAsText: string;
|
|
134
429
|
}>;
|
|
135
|
-
declare const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
declare const hasAdminRole: (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
} | undefined) => Promise<boolean>;
|
|
430
|
+
declare const checkAppAccess: (...args: Parameters<CheckAppAccess["execute"]>) => Promise<AppAccessResponse>;
|
|
431
|
+
declare const getOrgTree: (...args: Parameters<GetOrgTree["execute"]>) => Promise<OrgHierarchyResult>;
|
|
432
|
+
declare const fromTokenToUser: (...args: Parameters<FromTokenToUser["execute"]>) => Promise<ParamsFromTokenToUser>;
|
|
433
|
+
declare const hasAdminRole: (...args: Parameters<HasAdminRole["execute"]>) => Promise<boolean>;
|
|
434
|
+
declare const hasSharingPermission: (...args: Parameters<HasSharingPermission["execute"]>) => Promise<boolean>;
|
|
435
|
+
declare const setDefaultSharing: (...args: Parameters<SetDefaultSharing["execute"]>) => Promise<Sharing>;
|
|
436
|
+
declare const checkOrgPermissions: (...args: Parameters<CheckOrgPermissions["execute"]>) => Promise<{
|
|
437
|
+
privacy: APP_SHARING_STATUS;
|
|
438
|
+
}>;
|
|
145
439
|
|
|
146
|
-
export { ACCESS_LEVEL, ASSET_TYPE, type GetSharingList, ORGANIZATION_QRVEY, SHARED_ORIGIN, SHARE_TYPE, api, checkUserAccessLevel, fromTokenToUser, hasAdminRole };
|
|
440
|
+
export { ACCESS_LEVEL, APP_SHARING_STATUS, ASSET_TYPE, type GetSharingList, HIERARCHY_SCOPE, ORGANIZATION_QRVEY, SHARED_ORIGIN, SHARE_TYPE, USER_ANONYMOUS, api, checkAppAccess, checkOrgPermissions, checkUserAccessLevel, fromTokenToUser, getOrgTree, hasAdminRole, hasSharingPermission, setDefaultSharing };
|
package/package.json
CHANGED
|
@@ -1,54 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"test": "jest",
|
|
15
|
-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
|
16
|
-
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
17
|
-
"build:clean": "rm -rf dist",
|
|
18
|
-
"build:compile:original": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json",
|
|
19
|
-
"build:compile:cjs:original": "tsup --config ./tsup.config.cjs.ts",
|
|
20
|
-
"build:compile:cjs": "tsc -b ./tsconfig.cjs.json",
|
|
21
|
-
"build:compile:esm": "tsup --config ./tsup.config.esm.ts",
|
|
22
|
-
"build:compile:types": "tsup --config ./tsup.config.types.ts",
|
|
23
|
-
"build:compile": "yarn build:compile:cjs && yarn build:compile:esm && yarn build:compile:types",
|
|
24
|
-
"build": "yarn build:clean && yarn build:compile",
|
|
25
|
-
"prepare-publish": "yarn install && yarn build",
|
|
26
|
-
"publish-package": "yarn prepare-publish && npm publish"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"@qrvey/data-persistence": "0.5.1-bundled.1",
|
|
30
|
-
"@qrvey/id-generator": "1.0.1",
|
|
31
|
-
"reflect-metadata": "0.2.2",
|
|
32
|
-
"tsyringe": "4.8.0"
|
|
33
|
-
},
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@types/jest": "29.5.14",
|
|
36
|
-
"eslint": "8.48.0",
|
|
37
|
-
"eslint-import-resolver-typescript": "3.8.0",
|
|
38
|
-
"eslint-plugin-import": "2.31.0",
|
|
39
|
-
"jest": "29.7.0",
|
|
40
|
-
"ts-jest": "29.3.4",
|
|
41
|
-
"tsup": "8.0.2",
|
|
42
|
-
"typescript": "5.7.3"
|
|
43
|
-
},
|
|
44
|
-
"keywords": [
|
|
45
|
-
"sharing",
|
|
46
|
-
"qrvey"
|
|
47
|
-
],
|
|
48
|
-
"author": "Qrvey",
|
|
49
|
-
"license": "ISC",
|
|
50
|
-
"publishConfig": {
|
|
51
|
-
"access": "public",
|
|
52
|
-
"registry": "https://registry.npmjs.org"
|
|
2
|
+
"name": "@qrvey/assets-sharing",
|
|
3
|
+
"version": "0.3.5-1236",
|
|
4
|
+
"types": "dist/types/index.d.ts",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./dist/esm/index.mjs",
|
|
9
|
+
"require": "./dist/cjs/index.js",
|
|
10
|
+
"default": "./dist/cjs/index.js"
|
|
53
11
|
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"package.json",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "jest",
|
|
20
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
|
|
21
|
+
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
22
|
+
"build:clean": "rm -rf dist",
|
|
23
|
+
"build:compile:original": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json",
|
|
24
|
+
"build:compile:cjs:original": "tsup --config ./tsup.config.cjs.ts",
|
|
25
|
+
"build:compile:cjs": "tsc -b ./tsconfig.cjs.json",
|
|
26
|
+
"build:compile:esm": "tsup --config ./tsup.config.esm.ts",
|
|
27
|
+
"build:compile:types": "tsup --config ./tsup.config.types.ts",
|
|
28
|
+
"build:compile": "yarn build:compile:cjs && yarn build:compile:esm && yarn build:compile:types",
|
|
29
|
+
"build": "yarn build:clean && yarn build:compile",
|
|
30
|
+
"prepare-publish": "yarn install && yarn build",
|
|
31
|
+
"publish-package": "yarn prepare-publish && npm publish"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@qrvey/data-persistence": "0.5.21-1012",
|
|
35
|
+
"@qrvey/id-generator": "1.0.1",
|
|
36
|
+
"@qrvey/utils": "1.15.0-30",
|
|
37
|
+
"reflect-metadata": "0.2.2",
|
|
38
|
+
"tsyringe": "4.8.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/jest": "29.5.14",
|
|
42
|
+
"eslint": "8.57.1",
|
|
43
|
+
"eslint-import-resolver-typescript": "3.8.7",
|
|
44
|
+
"eslint-plugin-import": "2.31.0",
|
|
45
|
+
"jest": "29.7.0",
|
|
46
|
+
"ts-jest": "29.3.4",
|
|
47
|
+
"tsup": "8.5.1",
|
|
48
|
+
"typescript": "5.9.3"
|
|
49
|
+
},
|
|
50
|
+
"overrides": {
|
|
51
|
+
"esbuild": "0.28.1"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"sharing",
|
|
55
|
+
"qrvey"
|
|
56
|
+
],
|
|
57
|
+
"author": "Qrvey",
|
|
58
|
+
"license": "ISC",
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public",
|
|
61
|
+
"registry": "https://registry.npmjs.org"
|
|
62
|
+
}
|
|
54
63
|
}
|
package/.eslintrc
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@typescript-eslint/parser",
|
|
3
|
-
"plugins": [
|
|
4
|
-
"import"
|
|
5
|
-
],
|
|
6
|
-
"extends": [
|
|
7
|
-
"../../.eslintrc",
|
|
8
|
-
"plugin:import/recommended",
|
|
9
|
-
"plugin:import/typescript"
|
|
10
|
-
],
|
|
11
|
-
"rules": {
|
|
12
|
-
"sort-imports": [
|
|
13
|
-
"error",
|
|
14
|
-
{
|
|
15
|
-
"ignoreCase": false,
|
|
16
|
-
"ignoreDeclarationSort": true,
|
|
17
|
-
"ignoreMemberSort": false,
|
|
18
|
-
"memberSyntaxSortOrder": [
|
|
19
|
-
"none",
|
|
20
|
-
"all",
|
|
21
|
-
"multiple",
|
|
22
|
-
"single"
|
|
23
|
-
],
|
|
24
|
-
"allowSeparatedGroups": true
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"import/no-unresolved": "warn",
|
|
28
|
-
"import/order": [
|
|
29
|
-
"error",
|
|
30
|
-
{
|
|
31
|
-
"groups": [
|
|
32
|
-
"builtin",
|
|
33
|
-
"external",
|
|
34
|
-
"internal",
|
|
35
|
-
[
|
|
36
|
-
"sibling",
|
|
37
|
-
"parent"
|
|
38
|
-
],
|
|
39
|
-
"index",
|
|
40
|
-
"unknown"
|
|
41
|
-
],
|
|
42
|
-
"newlines-between": "always",
|
|
43
|
-
"alphabetize": {
|
|
44
|
-
"order": "asc",
|
|
45
|
-
"caseInsensitive": true
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
"padding-line-between-statements": [
|
|
50
|
-
"error",
|
|
51
|
-
{
|
|
52
|
-
"blankLine": "always",
|
|
53
|
-
"prev": "function",
|
|
54
|
-
"next": "*"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"blankLine": "always",
|
|
58
|
-
"prev": "*",
|
|
59
|
-
"next": "function"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"blankLine": "always",
|
|
63
|
-
"prev": "class",
|
|
64
|
-
"next": "*"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"blankLine": "always",
|
|
68
|
-
"prev": "*",
|
|
69
|
-
"next": "class"
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"lines-between-class-members": [
|
|
73
|
-
"error",
|
|
74
|
-
"always",
|
|
75
|
-
{
|
|
76
|
-
"exceptAfterSingleLine": true
|
|
77
|
-
}
|
|
78
|
-
],
|
|
79
|
-
"no-console": "error"
|
|
80
|
-
},
|
|
81
|
-
"settings": {
|
|
82
|
-
"import/resolver": {
|
|
83
|
-
"typescript": {
|
|
84
|
-
"project": "./tsconfig.json"
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|