@carlonicora/nextjs-jsonapi 1.6.0 → 1.7.0
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/{ApiResponseInterface-CfcC7pPC.d.mts → ApiResponseInterface-DMwITHYP.d.mts} +1 -1
- package/dist/{ApiResponseInterface-DTBJaV5R.d.ts → ApiResponseInterface-DWgIAXI-.d.ts} +1 -1
- package/dist/{BlockNoteEditor-7FM7B737.js → BlockNoteEditor-IJASTIUZ.js} +14 -18
- package/dist/BlockNoteEditor-IJASTIUZ.js.map +1 -0
- package/dist/{BlockNoteEditor-RVL76ZAS.mjs → BlockNoteEditor-M6TUP3NT.mjs} +5 -9
- package/dist/{BlockNoteEditor-RVL76ZAS.mjs.map → BlockNoteEditor-M6TUP3NT.mjs.map} +1 -1
- package/dist/JsonApiRequest-2OM5NDAW.js +24 -0
- package/dist/JsonApiRequest-2OM5NDAW.js.map +1 -0
- package/dist/{JsonApiRequest-VCCRO732.mjs → JsonApiRequest-SYZ6FGCA.mjs} +2 -3
- package/dist/{chunk-SVX7E6RR.js → chunk-4L7OWJ2P.js} +360 -364
- package/dist/chunk-4L7OWJ2P.js.map +1 -0
- package/dist/{chunk-KFL5ZFM4.mjs → chunk-4U5CJA44.mjs} +732 -20
- package/dist/chunk-4U5CJA44.mjs.map +1 -0
- package/dist/{chunk-ZUEEIQHW.js → chunk-CKS6SVUK.js} +158 -22
- package/dist/chunk-CKS6SVUK.js.map +1 -0
- package/dist/{chunk-F4Y3GZG4.mjs → chunk-SAL7XW2G.mjs} +141 -5
- package/dist/chunk-SAL7XW2G.mjs.map +1 -0
- package/dist/{chunk-ZQTFZKLJ.mjs → chunk-TW4QRJ7D.mjs} +10 -14
- package/dist/{chunk-ZQTFZKLJ.mjs.map → chunk-TW4QRJ7D.mjs.map} +1 -1
- package/dist/{chunk-2Z56AS2S.js → chunk-U4NADAHN.js} +744 -32
- package/dist/chunk-U4NADAHN.js.map +1 -0
- package/dist/client/index.d.mts +5 -5
- package/dist/client/index.d.ts +5 -5
- package/dist/client/index.js +4 -7
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +3 -6
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +4 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +3 -6
- package/dist/{config-B43zxEvn.d.mts → config-BdCV25CE.d.mts} +1 -1
- package/dist/{config-D2OUrI_G.d.ts → config-C9dt1QiR.d.ts} +1 -1
- package/dist/{content.interface-Bs8a7uW6.d.mts → content.interface-B6qP_ABq.d.mts} +1 -1
- package/dist/{content.interface-UtsJ-mzs.d.ts → content.interface-DHAFLasV.d.ts} +1 -1
- package/dist/contexts/index.d.mts +2 -2
- package/dist/contexts/index.d.ts +2 -2
- package/dist/contexts/index.js +4 -7
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +3 -6
- package/dist/core/index.d.mts +43 -7
- package/dist/core/index.d.ts +43 -7
- package/dist/core/index.js +29 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +28 -2
- package/dist/index.d.mts +7 -44
- package/dist/index.d.ts +7 -44
- package/dist/index.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -8
- package/dist/{notification.interface-BdcwkuQE.d.mts → notification.interface-agcMYCkg.d.mts} +1 -1
- package/dist/{notification.interface-BdcwkuQE.d.ts → notification.interface-agcMYCkg.d.ts} +1 -1
- package/dist/s3.service-DYnmymEd.d.mts +350 -0
- package/dist/s3.service-DyXjKTqr.d.ts +350 -0
- package/dist/server/index.d.mts +5 -235
- package/dist/server/index.d.ts +5 -235
- package/dist/server/index.js +12 -16
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +3 -7
- package/dist/server/index.mjs.map +1 -1
- package/dist/{useSocket-BWJUXuOl.d.mts → useSocket-91s8M4Xd.d.mts} +1 -1
- package/dist/{useSocket-8vwK_R_c.d.ts → useSocket-DSR7vaXj.d.ts} +1 -1
- package/package.json +1 -1
- package/src/core/index.ts +3 -0
- package/src/features/auth/data/index.ts +1 -0
- package/src/features/company/data/index.ts +1 -0
- package/src/features/content/data/index.ts +1 -0
- package/src/features/feature/data/index.ts +1 -0
- package/src/features/notification/data/index.ts +1 -0
- package/src/features/push/data/index.ts +1 -0
- package/src/features/role/data/index.ts +1 -0
- package/src/features/s3/data/index.ts +1 -0
- package/src/features/user/data/index.ts +1 -0
- package/dist/BlockNoteEditor-7FM7B737.js.map +0 -1
- package/dist/JsonApiRequest-KOKGVPBI.js +0 -25
- package/dist/JsonApiRequest-KOKGVPBI.js.map +0 -1
- package/dist/chunk-2Z56AS2S.js.map +0 -1
- package/dist/chunk-37NJZ2VD.mjs +0 -637
- package/dist/chunk-37NJZ2VD.mjs.map +0 -1
- package/dist/chunk-AGAJMJ4T.js +0 -147
- package/dist/chunk-AGAJMJ4T.js.map +0 -1
- package/dist/chunk-CSM6AIAP.js +0 -98
- package/dist/chunk-CSM6AIAP.js.map +0 -1
- package/dist/chunk-F4Y3GZG4.mjs.map +0 -1
- package/dist/chunk-K4W5QXL5.mjs +0 -98
- package/dist/chunk-K4W5QXL5.mjs.map +0 -1
- package/dist/chunk-KFL5ZFM4.mjs.map +0 -1
- package/dist/chunk-LOSPCUCF.js +0 -637
- package/dist/chunk-LOSPCUCF.js.map +0 -1
- package/dist/chunk-RBIVEH2K.mjs +0 -147
- package/dist/chunk-RBIVEH2K.mjs.map +0 -1
- package/dist/chunk-SVX7E6RR.js.map +0 -1
- package/dist/chunk-ZUEEIQHW.js.map +0 -1
- package/dist/s3.interface-D7ttGatc.d.ts +0 -119
- package/dist/s3.interface-DlaMDRTn.d.mts +0 -119
- /package/dist/{JsonApiRequest-VCCRO732.mjs.map → JsonApiRequest-SYZ6FGCA.mjs.map} +0 -0
|
@@ -5,7 +5,10 @@ var _chunkIBS6NI7Djs = require('./chunk-IBS6NI7D.js');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkCKS6SVUKjs = require('./chunk-CKS6SVUK.js');
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
var _chunkLXKSUWAVjs = require('./chunk-LXKSUWAV.js');
|
|
@@ -19,12 +22,12 @@ var RehydrationFactory = class {
|
|
|
19
22
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "RehydrationFactory");
|
|
20
23
|
}
|
|
21
24
|
static rehydrate(classKey, data) {
|
|
22
|
-
const factoryClass =
|
|
25
|
+
const factoryClass = _chunkCKS6SVUKjs.DataClassRegistry.get(classKey);
|
|
23
26
|
const instance = new factoryClass();
|
|
24
27
|
return instance.rehydrate(data);
|
|
25
28
|
}
|
|
26
29
|
static rehydrateList(classKey, data) {
|
|
27
|
-
const factoryClass =
|
|
30
|
+
const factoryClass = _chunkCKS6SVUKjs.DataClassRegistry.get(classKey);
|
|
28
31
|
const response = data.map((item) => {
|
|
29
32
|
const instance = new factoryClass();
|
|
30
33
|
return instance.rehydrate(item);
|
|
@@ -201,7 +204,7 @@ var AbstractService = class {
|
|
|
201
204
|
* Make an API call with automatic environment detection and error handling.
|
|
202
205
|
*/
|
|
203
206
|
static async callApi(params) {
|
|
204
|
-
const { JsonApiGet, JsonApiPost, JsonApiPut, JsonApiPatch, JsonApiDelete } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-
|
|
207
|
+
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-2OM5NDAW.js")));
|
|
205
208
|
let apiResponse;
|
|
206
209
|
let language = "en";
|
|
207
210
|
if (typeof window === "undefined") {
|
|
@@ -212,7 +215,7 @@ var AbstractService = class {
|
|
|
212
215
|
}
|
|
213
216
|
switch (params.method) {
|
|
214
217
|
case "GET" /* GET */:
|
|
215
|
-
apiResponse = await
|
|
218
|
+
apiResponse = await JsonApiGet2({
|
|
216
219
|
classKey: params.type,
|
|
217
220
|
endpoint: params.endpoint,
|
|
218
221
|
companyId: params.companyId,
|
|
@@ -220,7 +223,7 @@ var AbstractService = class {
|
|
|
220
223
|
});
|
|
221
224
|
break;
|
|
222
225
|
case "POST" /* POST */:
|
|
223
|
-
apiResponse = await
|
|
226
|
+
apiResponse = await JsonApiPost2({
|
|
224
227
|
classKey: params.type,
|
|
225
228
|
endpoint: params.endpoint,
|
|
226
229
|
companyId: params.companyId,
|
|
@@ -255,7 +258,7 @@ var AbstractService = class {
|
|
|
255
258
|
});
|
|
256
259
|
break;
|
|
257
260
|
case "DELETE" /* DELETE */:
|
|
258
|
-
apiResponse = await
|
|
261
|
+
apiResponse = await JsonApiDelete2({
|
|
259
262
|
classKey: params.type,
|
|
260
263
|
endpoint: params.endpoint,
|
|
261
264
|
companyId: params.companyId,
|
|
@@ -286,7 +289,7 @@ var AbstractService = class {
|
|
|
286
289
|
* Get raw JSON:API response data without deserialization.
|
|
287
290
|
*/
|
|
288
291
|
static async getRawData(params) {
|
|
289
|
-
const { JsonApiGet } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-
|
|
292
|
+
const { JsonApiGet: JsonApiGet2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-2OM5NDAW.js")));
|
|
290
293
|
let language = "en";
|
|
291
294
|
if (typeof window === "undefined") {
|
|
292
295
|
const { getLocale } = await Promise.resolve().then(() => _interopRequireWildcard(require("next-intl/server")));
|
|
@@ -294,7 +297,7 @@ var AbstractService = class {
|
|
|
294
297
|
} else {
|
|
295
298
|
language = this.getClientLocale();
|
|
296
299
|
}
|
|
297
|
-
const apiResponse = await
|
|
300
|
+
const apiResponse = await JsonApiGet2({
|
|
298
301
|
classKey: params.type,
|
|
299
302
|
endpoint: params.endpoint,
|
|
300
303
|
companyId: params.companyId,
|
|
@@ -372,7 +375,7 @@ async function ClientJsonApiGet(params) {
|
|
|
372
375
|
language: params.language,
|
|
373
376
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _15 => _15.additionalHeaders])
|
|
374
377
|
});
|
|
375
|
-
return
|
|
378
|
+
return _chunkCKS6SVUKjs.translateResponse.call(void 0, {
|
|
376
379
|
classKey: params.classKey,
|
|
377
380
|
apiResponse,
|
|
378
381
|
companyId: params.companyId,
|
|
@@ -393,7 +396,7 @@ async function ClientJsonApiPost(params) {
|
|
|
393
396
|
if (!body) {
|
|
394
397
|
body = {};
|
|
395
398
|
} else if (params.overridesJsonApiCreation !== true) {
|
|
396
|
-
body =
|
|
399
|
+
body = _chunkCKS6SVUKjs.JsonApiDataFactory.create(params.classKey, body);
|
|
397
400
|
}
|
|
398
401
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
399
402
|
method: "POST",
|
|
@@ -405,7 +408,7 @@ async function ClientJsonApiPost(params) {
|
|
|
405
408
|
language: params.language,
|
|
406
409
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _16 => _16.additionalHeaders])
|
|
407
410
|
});
|
|
408
|
-
return
|
|
411
|
+
return _chunkCKS6SVUKjs.translateResponse.call(void 0, {
|
|
409
412
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
410
413
|
apiResponse,
|
|
411
414
|
companyId: params.companyId,
|
|
@@ -420,7 +423,7 @@ async function ClientJsonApiPut(params) {
|
|
|
420
423
|
if (!body) {
|
|
421
424
|
body = {};
|
|
422
425
|
} else {
|
|
423
|
-
body =
|
|
426
|
+
body = _chunkCKS6SVUKjs.JsonApiDataFactory.create(params.classKey, body);
|
|
424
427
|
}
|
|
425
428
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
426
429
|
method: "PUT",
|
|
@@ -432,7 +435,7 @@ async function ClientJsonApiPut(params) {
|
|
|
432
435
|
language: params.language,
|
|
433
436
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _17 => _17.additionalHeaders])
|
|
434
437
|
});
|
|
435
|
-
return
|
|
438
|
+
return _chunkCKS6SVUKjs.translateResponse.call(void 0, {
|
|
436
439
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
437
440
|
apiResponse,
|
|
438
441
|
companyId: params.companyId,
|
|
@@ -447,7 +450,7 @@ async function ClientJsonApiPatch(params) {
|
|
|
447
450
|
if (!body) {
|
|
448
451
|
body = {};
|
|
449
452
|
} else if (params.overridesJsonApiCreation !== true) {
|
|
450
|
-
body =
|
|
453
|
+
body = _chunkCKS6SVUKjs.JsonApiDataFactory.create(params.classKey, body);
|
|
451
454
|
}
|
|
452
455
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
453
456
|
method: "PATCH",
|
|
@@ -459,7 +462,7 @@ async function ClientJsonApiPatch(params) {
|
|
|
459
462
|
language: params.language,
|
|
460
463
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _18 => _18.additionalHeaders])
|
|
461
464
|
});
|
|
462
|
-
return
|
|
465
|
+
return _chunkCKS6SVUKjs.translateResponse.call(void 0, {
|
|
463
466
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
464
467
|
apiResponse,
|
|
465
468
|
companyId: params.companyId,
|
|
@@ -478,7 +481,7 @@ async function ClientJsonApiDelete(params) {
|
|
|
478
481
|
language: params.language,
|
|
479
482
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _19 => _19.additionalHeaders])
|
|
480
483
|
});
|
|
481
|
-
return
|
|
484
|
+
return _chunkCKS6SVUKjs.translateResponse.call(void 0, {
|
|
482
485
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
483
486
|
apiResponse,
|
|
484
487
|
companyId: params.companyId,
|
|
@@ -680,7 +683,7 @@ var ModuleRegistrar = (_class = class {
|
|
|
680
683
|
}).map((key) => modulesClass[key]);
|
|
681
684
|
data.forEach((item) => {
|
|
682
685
|
if (item && item.model) {
|
|
683
|
-
|
|
686
|
+
_chunkCKS6SVUKjs.DataClassRegistry.registerObjectClass(item, item.model);
|
|
684
687
|
}
|
|
685
688
|
});
|
|
686
689
|
this._isBootstrapped = true;
|
|
@@ -690,7 +693,7 @@ var ModuleRegistrar = (_class = class {
|
|
|
690
693
|
*/
|
|
691
694
|
static reset() {
|
|
692
695
|
this._isBootstrapped = false;
|
|
693
|
-
|
|
696
|
+
_chunkCKS6SVUKjs.DataClassRegistry.clear();
|
|
694
697
|
}
|
|
695
698
|
}, _class.__initStatic(), _class);
|
|
696
699
|
|
|
@@ -1926,6 +1929,93 @@ var getLucideIconByModuleName = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(voi
|
|
|
1926
1929
|
return getLucideIconByModule({ module: Modules.findByModelName(params.name) });
|
|
1927
1930
|
}, "getLucideIconByModuleName");
|
|
1928
1931
|
|
|
1932
|
+
// src/permissions/types.ts
|
|
1933
|
+
var Action = /* @__PURE__ */ ((Action2) => {
|
|
1934
|
+
Action2["Read"] = "read";
|
|
1935
|
+
Action2["Create"] = "create";
|
|
1936
|
+
Action2["Update"] = "update";
|
|
1937
|
+
Action2["Delete"] = "delete";
|
|
1938
|
+
return Action2;
|
|
1939
|
+
})(Action || {});
|
|
1940
|
+
|
|
1941
|
+
// src/permissions/check.ts
|
|
1942
|
+
function checkPermissions(params) {
|
|
1943
|
+
const selectedModule = params.user.modules.find((module) => module.id === params.module.moduleId);
|
|
1944
|
+
if (!selectedModule) return false;
|
|
1945
|
+
const permissionConfig = selectedModule.permissions[params.action];
|
|
1946
|
+
if (!permissionConfig) return false;
|
|
1947
|
+
if (typeof permissionConfig === "boolean") return permissionConfig;
|
|
1948
|
+
if (!params.data) return true;
|
|
1949
|
+
try {
|
|
1950
|
+
const singlePermissionConfig = permissionConfig.split("|").map((p) => p.trim());
|
|
1951
|
+
for (const path of singlePermissionConfig) {
|
|
1952
|
+
if (getValueFromPath(params.data, path, params.user.id)) return true;
|
|
1953
|
+
}
|
|
1954
|
+
return false;
|
|
1955
|
+
} catch (e) {
|
|
1956
|
+
if (typeof permissionConfig === "string") {
|
|
1957
|
+
return getValueFromPath(params.data, permissionConfig, params.user.id);
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
return false;
|
|
1961
|
+
}
|
|
1962
|
+
_chunk7QVYU63Ejs.__name.call(void 0, checkPermissions, "checkPermissions");
|
|
1963
|
+
function checkPermissionsFromServer(params) {
|
|
1964
|
+
if (!params.selectedModule) return false;
|
|
1965
|
+
const permissionConfig = params.selectedModule.permissions[params.action];
|
|
1966
|
+
if (!permissionConfig) return false;
|
|
1967
|
+
if (typeof permissionConfig === "boolean") return permissionConfig;
|
|
1968
|
+
if (!params.data) return true;
|
|
1969
|
+
try {
|
|
1970
|
+
const singlePermissionConfig = permissionConfig.split("|").map((p) => p.trim());
|
|
1971
|
+
for (const path of singlePermissionConfig) {
|
|
1972
|
+
if (getValueFromPath(params.data, path, params.userId)) return true;
|
|
1973
|
+
}
|
|
1974
|
+
return false;
|
|
1975
|
+
} catch (e2) {
|
|
1976
|
+
if (typeof permissionConfig === "string") {
|
|
1977
|
+
return getValueFromPath(params.data, permissionConfig, params.userId);
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
return false;
|
|
1981
|
+
}
|
|
1982
|
+
_chunk7QVYU63Ejs.__name.call(void 0, checkPermissionsFromServer, "checkPermissionsFromServer");
|
|
1983
|
+
function getValueFromPath(obj, path, userId) {
|
|
1984
|
+
const parts = path.split(".");
|
|
1985
|
+
let current = obj;
|
|
1986
|
+
for (const part of parts) {
|
|
1987
|
+
if (!current) return false;
|
|
1988
|
+
if (Array.isArray(current)) {
|
|
1989
|
+
let found = false;
|
|
1990
|
+
for (const item of current) {
|
|
1991
|
+
const result = getValueFromPath(item, parts.slice(parts.indexOf(part)).join("."), userId);
|
|
1992
|
+
if (result === userId || result === true) {
|
|
1993
|
+
found = true;
|
|
1994
|
+
break;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
return found;
|
|
1998
|
+
} else if (current[part] !== void 0) {
|
|
1999
|
+
current = current[part];
|
|
2000
|
+
} else {
|
|
2001
|
+
return false;
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
if (Array.isArray(current)) {
|
|
2005
|
+
return current.some((item) => {
|
|
2006
|
+
if (typeof item === "object" && item.id !== void 0) {
|
|
2007
|
+
return item.id.toString() === userId;
|
|
2008
|
+
}
|
|
2009
|
+
return item.toString() === userId;
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
if (typeof current === "object" && current.id !== void 0) {
|
|
2013
|
+
return current.id.toString() === userId;
|
|
2014
|
+
}
|
|
2015
|
+
return current.toString() === userId;
|
|
2016
|
+
}
|
|
2017
|
+
_chunk7QVYU63Ejs.__name.call(void 0, getValueFromPath, "getValueFromPath");
|
|
2018
|
+
|
|
1929
2019
|
// src/features/auth/data/auth.ts
|
|
1930
2020
|
var Auth = class extends AbstractApiData {
|
|
1931
2021
|
static {
|
|
@@ -1971,6 +2061,138 @@ var Auth = class extends AbstractApiData {
|
|
|
1971
2061
|
}
|
|
1972
2062
|
};
|
|
1973
2063
|
|
|
2064
|
+
// src/features/auth/config.ts
|
|
2065
|
+
var _tokenHandler = null;
|
|
2066
|
+
function configureAuth(handler) {
|
|
2067
|
+
_tokenHandler = handler;
|
|
2068
|
+
}
|
|
2069
|
+
_chunk7QVYU63Ejs.__name.call(void 0, configureAuth, "configureAuth");
|
|
2070
|
+
function getTokenHandler() {
|
|
2071
|
+
return _tokenHandler;
|
|
2072
|
+
}
|
|
2073
|
+
_chunk7QVYU63Ejs.__name.call(void 0, getTokenHandler, "getTokenHandler");
|
|
2074
|
+
|
|
2075
|
+
// src/features/auth/data/auth.service.ts
|
|
2076
|
+
var AuthService = class extends AbstractService {
|
|
2077
|
+
static {
|
|
2078
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "AuthService");
|
|
2079
|
+
}
|
|
2080
|
+
static async login(params) {
|
|
2081
|
+
const language = params.language || "en-US";
|
|
2082
|
+
const apiResponse = await _chunkCKS6SVUKjs.JsonApiPost.call(void 0, {
|
|
2083
|
+
classKey: Modules.Auth,
|
|
2084
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "login" }).generate(),
|
|
2085
|
+
body: { email: params.email, password: params.password },
|
|
2086
|
+
language
|
|
2087
|
+
});
|
|
2088
|
+
if (!apiResponse.ok) throw new Error(apiResponse.error);
|
|
2089
|
+
const auth = apiResponse.data;
|
|
2090
|
+
const handler = getTokenHandler();
|
|
2091
|
+
if (handler) {
|
|
2092
|
+
await handler.updateToken({
|
|
2093
|
+
token: auth.token,
|
|
2094
|
+
refreshToken: auth.refreshToken,
|
|
2095
|
+
userId: auth.user.id,
|
|
2096
|
+
companyId: _optionalChain([auth, 'access', _40 => _40.user, 'access', _41 => _41.company, 'optionalAccess', _42 => _42.id]),
|
|
2097
|
+
licenseExpirationDate: _optionalChain([auth, 'access', _43 => _43.user, 'access', _44 => _44.company, 'optionalAccess', _45 => _45.licenseExpirationDate]),
|
|
2098
|
+
roles: auth.user.roles.map((role) => role.id),
|
|
2099
|
+
features: _nullishCoalesce(_optionalChain([auth, 'access', _46 => _46.user, 'access', _47 => _47.company, 'optionalAccess', _48 => _48.features, 'optionalAccess', _49 => _49.map, 'call', _50 => _50((feature) => feature.id)]), () => ( [])),
|
|
2100
|
+
modules: auth.user.modules.map((module) => ({
|
|
2101
|
+
id: module.id,
|
|
2102
|
+
permissions: module.permissions
|
|
2103
|
+
}))
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
return auth.user;
|
|
2107
|
+
}
|
|
2108
|
+
static async logout(params) {
|
|
2109
|
+
const language = _optionalChain([params, 'optionalAccess', _51 => _51.language]) || "en-US";
|
|
2110
|
+
await _chunkCKS6SVUKjs.JsonApiDelete.call(void 0, {
|
|
2111
|
+
classKey: Modules.Auth,
|
|
2112
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Auth }).generate(),
|
|
2113
|
+
language
|
|
2114
|
+
});
|
|
2115
|
+
const handler = getTokenHandler();
|
|
2116
|
+
if (handler) {
|
|
2117
|
+
await handler.removeToken();
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
static async initialiseForgotPassword(params) {
|
|
2121
|
+
const language = params.language || "en-US";
|
|
2122
|
+
const response = await _chunkCKS6SVUKjs.JsonApiPost.call(void 0, {
|
|
2123
|
+
classKey: Modules.Auth,
|
|
2124
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "forgot" }).generate(),
|
|
2125
|
+
body: { email: params.email },
|
|
2126
|
+
language
|
|
2127
|
+
});
|
|
2128
|
+
if (!response.ok) {
|
|
2129
|
+
throw new Error(response.error);
|
|
2130
|
+
}
|
|
2131
|
+
}
|
|
2132
|
+
static async register(params) {
|
|
2133
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "register" });
|
|
2134
|
+
await this.callApi({
|
|
2135
|
+
type: Modules.Auth,
|
|
2136
|
+
method: "POST" /* POST */,
|
|
2137
|
+
endpoint: endpoint.generate(),
|
|
2138
|
+
input: params
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
static async activate(params) {
|
|
2142
|
+
const endpoint = new EndpointCreator({
|
|
2143
|
+
endpoint: Modules.Auth,
|
|
2144
|
+
id: "activate",
|
|
2145
|
+
childEndpoint: params.activationCode
|
|
2146
|
+
});
|
|
2147
|
+
await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate() });
|
|
2148
|
+
}
|
|
2149
|
+
static async validateCode(params) {
|
|
2150
|
+
const language = params.language || "en-US";
|
|
2151
|
+
const apiResponse = await _chunkCKS6SVUKjs.JsonApiGet.call(void 0, {
|
|
2152
|
+
classKey: Modules.Auth,
|
|
2153
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "validate", childEndpoint: params.code }).generate(),
|
|
2154
|
+
language
|
|
2155
|
+
});
|
|
2156
|
+
if (!apiResponse.ok) throw new Error(apiResponse.error);
|
|
2157
|
+
}
|
|
2158
|
+
static async resetPassword(params) {
|
|
2159
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "reset", childEndpoint: params.code });
|
|
2160
|
+
const input = { password: params.password };
|
|
2161
|
+
await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
|
|
2162
|
+
}
|
|
2163
|
+
static async acceptInvitation(params) {
|
|
2164
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "invitation", childEndpoint: params.code });
|
|
2165
|
+
const input = { password: params.password };
|
|
2166
|
+
await this.callApi({ type: Modules.Auth, method: "POST" /* POST */, endpoint: endpoint.generate(), input });
|
|
2167
|
+
}
|
|
2168
|
+
static async findToken(params) {
|
|
2169
|
+
return await this.callApi({
|
|
2170
|
+
type: Modules.Auth,
|
|
2171
|
+
method: "POST" /* POST */,
|
|
2172
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Auth }).addAdditionalParam("code", params.tokenCode).generate()
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
static async saveToken(params) {
|
|
2176
|
+
const auth = rehydrate(Modules.Auth, params.dehydratedAuth);
|
|
2177
|
+
const handler = getTokenHandler();
|
|
2178
|
+
if (handler) {
|
|
2179
|
+
await handler.updateToken({
|
|
2180
|
+
token: auth.token,
|
|
2181
|
+
refreshToken: auth.refreshToken,
|
|
2182
|
+
userId: auth.user.id,
|
|
2183
|
+
companyId: _optionalChain([auth, 'access', _52 => _52.user, 'access', _53 => _53.company, 'optionalAccess', _54 => _54.id]),
|
|
2184
|
+
licenseExpirationDate: _optionalChain([auth, 'access', _55 => _55.user, 'access', _56 => _56.company, 'optionalAccess', _57 => _57.licenseExpirationDate]),
|
|
2185
|
+
roles: auth.user.roles.map((role) => role.id),
|
|
2186
|
+
features: _nullishCoalesce(_optionalChain([auth, 'access', _58 => _58.user, 'access', _59 => _59.company, 'optionalAccess', _60 => _60.features, 'optionalAccess', _61 => _61.map, 'call', _62 => _62((feature) => feature.id)]), () => ( [])),
|
|
2187
|
+
modules: auth.user.modules.map((module) => ({
|
|
2188
|
+
id: module.id,
|
|
2189
|
+
permissions: module.permissions
|
|
2190
|
+
}))
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
};
|
|
2195
|
+
|
|
1974
2196
|
// src/features/auth/enums/AuthComponent.ts
|
|
1975
2197
|
var AuthComponent = /* @__PURE__ */ ((AuthComponent2) => {
|
|
1976
2198
|
AuthComponent2[AuthComponent2["Login"] = 0] = "Login";
|
|
@@ -1983,17 +2205,6 @@ var AuthComponent = /* @__PURE__ */ ((AuthComponent2) => {
|
|
|
1983
2205
|
return AuthComponent2;
|
|
1984
2206
|
})(AuthComponent || {});
|
|
1985
2207
|
|
|
1986
|
-
// src/features/auth/config.ts
|
|
1987
|
-
var _tokenHandler = null;
|
|
1988
|
-
function configureAuth(handler) {
|
|
1989
|
-
_tokenHandler = handler;
|
|
1990
|
-
}
|
|
1991
|
-
_chunk7QVYU63Ejs.__name.call(void 0, configureAuth, "configureAuth");
|
|
1992
|
-
function getTokenHandler() {
|
|
1993
|
-
return _tokenHandler;
|
|
1994
|
-
}
|
|
1995
|
-
_chunk7QVYU63Ejs.__name.call(void 0, getTokenHandler, "getTokenHandler");
|
|
1996
|
-
|
|
1997
2208
|
// src/features/auth/auth.module.ts
|
|
1998
2209
|
var AuthModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
1999
2210
|
pageUrl: "/auth",
|
|
@@ -2091,6 +2302,73 @@ var CompanyFields = /* @__PURE__ */ ((CompanyFields2) => {
|
|
|
2091
2302
|
return CompanyFields2;
|
|
2092
2303
|
})(CompanyFields || {});
|
|
2093
2304
|
|
|
2305
|
+
// src/features/company/data/company.service.ts
|
|
2306
|
+
var CompanyService = class extends AbstractService {
|
|
2307
|
+
static {
|
|
2308
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "CompanyService");
|
|
2309
|
+
}
|
|
2310
|
+
static async findOne(params) {
|
|
2311
|
+
return this.callApi({
|
|
2312
|
+
type: Modules.Company,
|
|
2313
|
+
method: "GET" /* GET */,
|
|
2314
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
static async findMany(params) {
|
|
2318
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Company });
|
|
2319
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2320
|
+
return this.callApi({
|
|
2321
|
+
type: Modules.Company,
|
|
2322
|
+
method: "GET" /* GET */,
|
|
2323
|
+
endpoint: endpoint.generate(),
|
|
2324
|
+
next: params.next
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
static async delete(params) {
|
|
2328
|
+
await this.callApi({
|
|
2329
|
+
type: Modules.Company,
|
|
2330
|
+
method: "DELETE" /* DELETE */,
|
|
2331
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.companyId }).generate()
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
static async create(params) {
|
|
2335
|
+
return this.callApi({
|
|
2336
|
+
type: Modules.Company,
|
|
2337
|
+
method: "POST" /* POST */,
|
|
2338
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Company }).generate(),
|
|
2339
|
+
input: params
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
static async update(params) {
|
|
2343
|
+
return this.callApi({
|
|
2344
|
+
type: Modules.Company,
|
|
2345
|
+
method: "PUT" /* PUT */,
|
|
2346
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id }).generate(),
|
|
2347
|
+
input: params
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
static async updateConfigurations(params) {
|
|
2351
|
+
return this.callApi({
|
|
2352
|
+
type: Modules.Company,
|
|
2353
|
+
method: "PUT" /* PUT */,
|
|
2354
|
+
endpoint: new EndpointCreator({
|
|
2355
|
+
endpoint: Modules.Company,
|
|
2356
|
+
id: params.id,
|
|
2357
|
+
childEndpoint: "configurations"
|
|
2358
|
+
}).generate(),
|
|
2359
|
+
input: params
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
static async activateLicense(params) {
|
|
2363
|
+
return this.callApi({
|
|
2364
|
+
type: Modules.Company,
|
|
2365
|
+
method: "PUT" /* PUT */,
|
|
2366
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Company, id: params.id, childEndpoint: "license" }).generate(),
|
|
2367
|
+
input: params
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
};
|
|
2371
|
+
|
|
2094
2372
|
// src/features/company/company.module.ts
|
|
2095
2373
|
var CompanyModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
2096
2374
|
pageUrl: "/companies",
|
|
@@ -2177,6 +2455,63 @@ var ContentFields = /* @__PURE__ */ ((ContentFields2) => {
|
|
|
2177
2455
|
return ContentFields2;
|
|
2178
2456
|
})(ContentFields || {});
|
|
2179
2457
|
|
|
2458
|
+
// src/features/content/data/content.service.ts
|
|
2459
|
+
var ContentService = class extends AbstractService {
|
|
2460
|
+
static {
|
|
2461
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "ContentService");
|
|
2462
|
+
}
|
|
2463
|
+
static async findMany(params) {
|
|
2464
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Content });
|
|
2465
|
+
if (params.contentIds) {
|
|
2466
|
+
endpoint.addAdditionalParam("contentIds", params.contentIds.join(","));
|
|
2467
|
+
endpoint.addAdditionalParam("fetchAll", "true");
|
|
2468
|
+
} else {
|
|
2469
|
+
if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
|
|
2470
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2471
|
+
}
|
|
2472
|
+
if (_optionalChain([Modules, 'access', _63 => _63.Content, 'access', _64 => _64.inclusions, 'optionalAccess', _65 => _65.lists, 'optionalAccess', _66 => _66.fields])) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
|
|
2473
|
+
if (_optionalChain([Modules, 'access', _67 => _67.Content, 'access', _68 => _68.inclusions, 'optionalAccess', _69 => _69.lists, 'optionalAccess', _70 => _70.types])) endpoint.limitToType(Modules.Content.inclusions.lists.types);
|
|
2474
|
+
return this.callApi({
|
|
2475
|
+
type: Modules.Content,
|
|
2476
|
+
method: "GET" /* GET */,
|
|
2477
|
+
endpoint: endpoint.generate(),
|
|
2478
|
+
next: params.next
|
|
2479
|
+
});
|
|
2480
|
+
}
|
|
2481
|
+
static async findRelevant(params) {
|
|
2482
|
+
const endpoint = new EndpointCreator({
|
|
2483
|
+
endpoint: Modules.Content,
|
|
2484
|
+
id: params.id,
|
|
2485
|
+
childEndpoint: "relevance"
|
|
2486
|
+
});
|
|
2487
|
+
if (_optionalChain([Modules, 'access', _71 => _71.Content, 'access', _72 => _72.inclusions, 'optionalAccess', _73 => _73.lists, 'optionalAccess', _74 => _74.fields])) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
|
|
2488
|
+
if (_optionalChain([Modules, 'access', _75 => _75.Content, 'access', _76 => _76.inclusions, 'optionalAccess', _77 => _77.lists, 'optionalAccess', _78 => _78.types])) endpoint.limitToType(Modules.Content.inclusions.lists.types);
|
|
2489
|
+
return this.callApi({
|
|
2490
|
+
type: Modules.Content,
|
|
2491
|
+
method: "GET" /* GET */,
|
|
2492
|
+
endpoint: endpoint.generate(),
|
|
2493
|
+
next: params.next
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
static async findManyByAuthor(params) {
|
|
2497
|
+
const endpoint = new EndpointCreator({
|
|
2498
|
+
endpoint: Modules.Author,
|
|
2499
|
+
id: params.userId,
|
|
2500
|
+
childEndpoint: Modules.Content
|
|
2501
|
+
});
|
|
2502
|
+
if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
|
|
2503
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2504
|
+
if (_optionalChain([Modules, 'access', _79 => _79.Content, 'access', _80 => _80.inclusions, 'optionalAccess', _81 => _81.lists, 'optionalAccess', _82 => _82.fields])) endpoint.limitToFields(Modules.Content.inclusions.lists.fields);
|
|
2505
|
+
if (_optionalChain([Modules, 'access', _83 => _83.Content, 'access', _84 => _84.inclusions, 'optionalAccess', _85 => _85.lists, 'optionalAccess', _86 => _86.types])) endpoint.limitToType(Modules.Content.inclusions.lists.types);
|
|
2506
|
+
return this.callApi({
|
|
2507
|
+
type: Modules.Content,
|
|
2508
|
+
method: "GET" /* GET */,
|
|
2509
|
+
endpoint: endpoint.generate(),
|
|
2510
|
+
next: params.next
|
|
2511
|
+
});
|
|
2512
|
+
}
|
|
2513
|
+
};
|
|
2514
|
+
|
|
2180
2515
|
// src/features/content/content.module.ts
|
|
2181
2516
|
var ContentModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
2182
2517
|
pageUrl: "/contents",
|
|
@@ -2220,6 +2555,24 @@ var Feature = (_class4 = class extends AbstractApiData {constructor(...args) { s
|
|
|
2220
2555
|
}
|
|
2221
2556
|
}, _class4);
|
|
2222
2557
|
|
|
2558
|
+
// src/features/feature/data/feature.service.ts
|
|
2559
|
+
var FeatureService = class extends AbstractService {
|
|
2560
|
+
static {
|
|
2561
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "FeatureService");
|
|
2562
|
+
}
|
|
2563
|
+
static async findMany(params) {
|
|
2564
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Feature });
|
|
2565
|
+
if (params.companyId) endpoint.endpoint(Modules.Company).id(params.companyId).childEndpoint(Modules.Feature);
|
|
2566
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2567
|
+
return this.callApi({
|
|
2568
|
+
type: Modules.Feature,
|
|
2569
|
+
method: "GET" /* GET */,
|
|
2570
|
+
endpoint: endpoint.generate(),
|
|
2571
|
+
next: params.next
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
};
|
|
2575
|
+
|
|
2223
2576
|
// src/features/feature/feature.module.ts
|
|
2224
2577
|
var FeatureModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
2225
2578
|
pageUrl: "/features",
|
|
@@ -2315,6 +2668,37 @@ var NotificationFields = /* @__PURE__ */ ((NotificationFields2) => {
|
|
|
2315
2668
|
return NotificationFields2;
|
|
2316
2669
|
})(NotificationFields || {});
|
|
2317
2670
|
|
|
2671
|
+
// src/features/notification/data/notification.service.ts
|
|
2672
|
+
var NotificationService = class extends AbstractService {
|
|
2673
|
+
static {
|
|
2674
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "NotificationService");
|
|
2675
|
+
}
|
|
2676
|
+
static async findMany(params) {
|
|
2677
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Notification });
|
|
2678
|
+
if (params.isArchived) endpoint.addAdditionalParam("isArchived", "true");
|
|
2679
|
+
return this.callApi({
|
|
2680
|
+
type: Modules.Notification,
|
|
2681
|
+
method: "GET" /* GET */,
|
|
2682
|
+
endpoint: endpoint.generate(),
|
|
2683
|
+
next: params.next
|
|
2684
|
+
});
|
|
2685
|
+
}
|
|
2686
|
+
static async markAsRead(params) {
|
|
2687
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Notification });
|
|
2688
|
+
await this.callApi({
|
|
2689
|
+
type: Modules.Notification,
|
|
2690
|
+
method: "PATCH" /* PATCH */,
|
|
2691
|
+
endpoint: endpoint.generate(),
|
|
2692
|
+
input: params.data,
|
|
2693
|
+
overridesJsonApiCreation: true
|
|
2694
|
+
});
|
|
2695
|
+
}
|
|
2696
|
+
static async archive(params) {
|
|
2697
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Notification, id: params.id, childEndpoint: "archive" });
|
|
2698
|
+
await this.callApi({ type: Modules.Notification, method: "POST" /* POST */, endpoint: endpoint.generate() });
|
|
2699
|
+
}
|
|
2700
|
+
};
|
|
2701
|
+
|
|
2318
2702
|
// src/features/notification/notification.module.ts
|
|
2319
2703
|
var NotificationModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
2320
2704
|
pageUrl: "/notifications",
|
|
@@ -2342,6 +2726,23 @@ var Push = class extends AbstractApiData {
|
|
|
2342
2726
|
}
|
|
2343
2727
|
};
|
|
2344
2728
|
|
|
2729
|
+
// src/features/push/data/push.service.ts
|
|
2730
|
+
var PushService = class extends AbstractService {
|
|
2731
|
+
static {
|
|
2732
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "PushService");
|
|
2733
|
+
}
|
|
2734
|
+
static async register(params) {
|
|
2735
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Push });
|
|
2736
|
+
await this.callApi({
|
|
2737
|
+
type: Modules.Push,
|
|
2738
|
+
method: "POST" /* POST */,
|
|
2739
|
+
endpoint: endpoint.generate(),
|
|
2740
|
+
input: params.data,
|
|
2741
|
+
overridesJsonApiCreation: true
|
|
2742
|
+
});
|
|
2743
|
+
}
|
|
2744
|
+
};
|
|
2745
|
+
|
|
2345
2746
|
// src/features/push/push.module.ts
|
|
2346
2747
|
var PushModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
2347
2748
|
pageUrl: "/push",
|
|
@@ -2411,6 +2812,101 @@ var RoleFields = /* @__PURE__ */ ((RoleFields2) => {
|
|
|
2411
2812
|
return RoleFields2;
|
|
2412
2813
|
})(RoleFields || {});
|
|
2413
2814
|
|
|
2815
|
+
// src/features/role/data/role.service.ts
|
|
2816
|
+
var RoleService = class extends AbstractService {
|
|
2817
|
+
static {
|
|
2818
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "RoleService");
|
|
2819
|
+
}
|
|
2820
|
+
static async findById(params) {
|
|
2821
|
+
return this.callApi({
|
|
2822
|
+
type: Modules.Role,
|
|
2823
|
+
method: "GET" /* GET */,
|
|
2824
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate()
|
|
2825
|
+
});
|
|
2826
|
+
}
|
|
2827
|
+
static async findAllRoles(params) {
|
|
2828
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Role });
|
|
2829
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2830
|
+
return this.callApi({
|
|
2831
|
+
type: Modules.Role,
|
|
2832
|
+
method: "GET" /* GET */,
|
|
2833
|
+
endpoint: endpoint.generate(),
|
|
2834
|
+
next: params.next
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
static async findAllRolesByUser(params) {
|
|
2838
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.User, id: params.userId, childEndpoint: Modules.Role });
|
|
2839
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2840
|
+
return this.callApi({
|
|
2841
|
+
type: Modules.Role,
|
|
2842
|
+
method: "GET" /* GET */,
|
|
2843
|
+
endpoint: endpoint.generate(),
|
|
2844
|
+
next: params.next
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
static async findAllRolesUserNotIn(params) {
|
|
2848
|
+
const endpoint = new EndpointCreator({
|
|
2849
|
+
endpoint: Modules.User,
|
|
2850
|
+
id: params.userId,
|
|
2851
|
+
childEndpoint: Modules.Role
|
|
2852
|
+
}).addAdditionalParam("userNotIn", "true");
|
|
2853
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
2854
|
+
return this.callApi({
|
|
2855
|
+
type: Modules.Role,
|
|
2856
|
+
method: "GET" /* GET */,
|
|
2857
|
+
endpoint: endpoint.generate(),
|
|
2858
|
+
next: params.next
|
|
2859
|
+
});
|
|
2860
|
+
}
|
|
2861
|
+
static async addUserToRole(params) {
|
|
2862
|
+
this.callApi({
|
|
2863
|
+
type: Modules.Role,
|
|
2864
|
+
method: "POST" /* POST */,
|
|
2865
|
+
endpoint: new EndpointCreator({
|
|
2866
|
+
endpoint: Modules.Role,
|
|
2867
|
+
id: params.roleId,
|
|
2868
|
+
childEndpoint: Modules.User,
|
|
2869
|
+
childId: params.userId
|
|
2870
|
+
}).generate()
|
|
2871
|
+
});
|
|
2872
|
+
}
|
|
2873
|
+
static async removeUserFromRole(params) {
|
|
2874
|
+
this.callApi({
|
|
2875
|
+
type: Modules.Role,
|
|
2876
|
+
method: "DELETE" /* DELETE */,
|
|
2877
|
+
endpoint: new EndpointCreator({
|
|
2878
|
+
endpoint: Modules.Role,
|
|
2879
|
+
id: params.roleId,
|
|
2880
|
+
childEndpoint: Modules.User,
|
|
2881
|
+
childId: params.userId
|
|
2882
|
+
}).generate()
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
static async create(params) {
|
|
2886
|
+
return this.callApi({
|
|
2887
|
+
type: Modules.Role,
|
|
2888
|
+
method: "POST" /* POST */,
|
|
2889
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Role }).generate(),
|
|
2890
|
+
input: { id: params.roleId, name: params.name, description: params.description }
|
|
2891
|
+
});
|
|
2892
|
+
}
|
|
2893
|
+
static async update(params) {
|
|
2894
|
+
return this.callApi({
|
|
2895
|
+
type: Modules.Role,
|
|
2896
|
+
method: "PUT" /* PUT */,
|
|
2897
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate(),
|
|
2898
|
+
input: { id: params.roleId, name: params.name, description: params.description }
|
|
2899
|
+
});
|
|
2900
|
+
}
|
|
2901
|
+
static async delete(params) {
|
|
2902
|
+
return this.callApi({
|
|
2903
|
+
type: Modules.Role,
|
|
2904
|
+
method: "DELETE" /* DELETE */,
|
|
2905
|
+
endpoint: new EndpointCreator({ endpoint: Modules.Role, id: params.roleId }).generate()
|
|
2906
|
+
});
|
|
2907
|
+
}
|
|
2908
|
+
};
|
|
2909
|
+
|
|
2414
2910
|
// src/features/role/role.module.ts
|
|
2415
2911
|
var RoleModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
2416
2912
|
pageUrl: "/roles",
|
|
@@ -2478,6 +2974,30 @@ var S3Module = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) =>
|
|
|
2478
2974
|
moduleId: "db41ba46-e171-4324-8845-99353eba8568"
|
|
2479
2975
|
}), "S3Module");
|
|
2480
2976
|
|
|
2977
|
+
// src/features/s3/data/s3.service.ts
|
|
2978
|
+
var S3Service = class extends AbstractService {
|
|
2979
|
+
static {
|
|
2980
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "S3Service");
|
|
2981
|
+
}
|
|
2982
|
+
static async getPreSignedUrl(params) {
|
|
2983
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam("key", params.key).addAdditionalParam("contentType", params.contentType);
|
|
2984
|
+
if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
|
|
2985
|
+
return this.callApi({ type: Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
|
|
2986
|
+
}
|
|
2987
|
+
static async getSignedUrl(params) {
|
|
2988
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.S3, id: "sign" }).addAdditionalParam("key", params.key);
|
|
2989
|
+
if (params.isPublic) endpoint.addAdditionalParam("isPublic", "true");
|
|
2990
|
+
return this.callApi({ type: Modules.S3, method: "GET" /* GET */, endpoint: endpoint.generate() });
|
|
2991
|
+
}
|
|
2992
|
+
static async deleteFile(params) {
|
|
2993
|
+
this.callApi({
|
|
2994
|
+
type: Modules.S3,
|
|
2995
|
+
method: "DELETE" /* DELETE */,
|
|
2996
|
+
endpoint: new EndpointCreator({ endpoint: Modules.S3 }).addAdditionalParam("key", params.key).generate()
|
|
2997
|
+
});
|
|
2998
|
+
}
|
|
2999
|
+
};
|
|
3000
|
+
|
|
2481
3001
|
// src/features/user/data/user.ts
|
|
2482
3002
|
var User = (_class5 = class extends AbstractApiData {constructor(...args2) { super(...args2); _class5.prototype.__init3.call(this);_class5.prototype.__init4.call(this); }
|
|
2483
3003
|
static {
|
|
@@ -2618,6 +3138,185 @@ var UserFields = /* @__PURE__ */ ((UserFields2) => {
|
|
|
2618
3138
|
return UserFields2;
|
|
2619
3139
|
})(UserFields || {});
|
|
2620
3140
|
|
|
3141
|
+
// src/features/user/data/user.service.ts
|
|
3142
|
+
var UserService = class extends AbstractService {
|
|
3143
|
+
static {
|
|
3144
|
+
_chunk7QVYU63Ejs.__name.call(void 0, this, "UserService");
|
|
3145
|
+
}
|
|
3146
|
+
static async findFullUser() {
|
|
3147
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.User, id: "me", childEndpoint: "full" });
|
|
3148
|
+
return this.callApi({
|
|
3149
|
+
type: Modules.User,
|
|
3150
|
+
method: "GET" /* GET */,
|
|
3151
|
+
endpoint: endpoint.generate()
|
|
3152
|
+
});
|
|
3153
|
+
}
|
|
3154
|
+
static async findById(params) {
|
|
3155
|
+
return this.callApi({
|
|
3156
|
+
type: Modules.User,
|
|
3157
|
+
method: "GET" /* GET */,
|
|
3158
|
+
endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate()
|
|
3159
|
+
});
|
|
3160
|
+
}
|
|
3161
|
+
static async findByEmail(params) {
|
|
3162
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.User, id: "email", childEndpoint: params.email });
|
|
3163
|
+
return this.callApi({ type: Modules.User, method: "GET" /* GET */, endpoint: endpoint.generate() });
|
|
3164
|
+
}
|
|
3165
|
+
static async findMany(params) {
|
|
3166
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.User });
|
|
3167
|
+
if (params.roleId) endpoint.addAdditionalParam("roleId", params.roleId);
|
|
3168
|
+
if (params.includeDeleted) endpoint.addAdditionalParam("includeDeleted", "true");
|
|
3169
|
+
if (params.fetchAll) endpoint.addAdditionalParam("fetchAll", "true");
|
|
3170
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
3171
|
+
return this.callApi({
|
|
3172
|
+
type: Modules.User,
|
|
3173
|
+
method: "GET" /* GET */,
|
|
3174
|
+
endpoint: endpoint.generate(),
|
|
3175
|
+
next: params.next
|
|
3176
|
+
});
|
|
3177
|
+
}
|
|
3178
|
+
static async findManyByContentIds(params) {
|
|
3179
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.User });
|
|
3180
|
+
endpoint.addAdditionalParam("contentIds", params.contentIds.map((id) => id).join(","));
|
|
3181
|
+
endpoint.addAdditionalParam("includeDeleted", "true");
|
|
3182
|
+
endpoint.addAdditionalParam("fetchAll", "true");
|
|
3183
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
3184
|
+
return this.callApi({
|
|
3185
|
+
type: Modules.User,
|
|
3186
|
+
method: "GET" /* GET */,
|
|
3187
|
+
endpoint: endpoint.generate(),
|
|
3188
|
+
next: params.next
|
|
3189
|
+
});
|
|
3190
|
+
}
|
|
3191
|
+
static async findRelevant(params) {
|
|
3192
|
+
const endpoint = new EndpointCreator({
|
|
3193
|
+
endpoint: Modules.Content,
|
|
3194
|
+
id: params.id,
|
|
3195
|
+
childEndpoint: "user-relevance"
|
|
3196
|
+
});
|
|
3197
|
+
if (_optionalChain([Modules, 'access', _87 => _87.User, 'access', _88 => _88.inclusions, 'optionalAccess', _89 => _89.lists, 'optionalAccess', _90 => _90.fields])) endpoint.limitToFields(Modules.User.inclusions.lists.fields);
|
|
3198
|
+
if (_optionalChain([Modules, 'access', _91 => _91.User, 'access', _92 => _92.inclusions, 'optionalAccess', _93 => _93.lists, 'optionalAccess', _94 => _94.types])) endpoint.limitToType(Modules.User.inclusions.lists.types);
|
|
3199
|
+
return this.callApi({
|
|
3200
|
+
type: Modules.User,
|
|
3201
|
+
method: "GET" /* GET */,
|
|
3202
|
+
endpoint: endpoint.generate(),
|
|
3203
|
+
next: params.next
|
|
3204
|
+
});
|
|
3205
|
+
}
|
|
3206
|
+
static async findManyForAmin(params) {
|
|
3207
|
+
if (!params.companyId) return [];
|
|
3208
|
+
const endpoint = new EndpointCreator({
|
|
3209
|
+
endpoint: Modules.Company,
|
|
3210
|
+
id: params.companyId,
|
|
3211
|
+
childEndpoint: Modules.User
|
|
3212
|
+
});
|
|
3213
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
3214
|
+
return this.callApi({
|
|
3215
|
+
type: Modules.User,
|
|
3216
|
+
method: "GET" /* GET */,
|
|
3217
|
+
endpoint: endpoint.generate(),
|
|
3218
|
+
next: params.next,
|
|
3219
|
+
previous: params.prev
|
|
3220
|
+
});
|
|
3221
|
+
}
|
|
3222
|
+
static async findAllUsers(params) {
|
|
3223
|
+
const endpoint = new EndpointCreator({
|
|
3224
|
+
endpoint: Modules.Company,
|
|
3225
|
+
id: params.companyId,
|
|
3226
|
+
childEndpoint: Modules.User
|
|
3227
|
+
});
|
|
3228
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
3229
|
+
if (params.isDeleted) endpoint.addAdditionalParam("isDeleted", "true");
|
|
3230
|
+
if (params.limitToRoles && params.limitToRoles.length > 0)
|
|
3231
|
+
endpoint.addAdditionalParam("limitToRoles", params.limitToRoles.join(","));
|
|
3232
|
+
return this.callApi({
|
|
3233
|
+
type: Modules.User,
|
|
3234
|
+
method: "GET" /* GET */,
|
|
3235
|
+
endpoint: endpoint.generate(),
|
|
3236
|
+
next: params.next
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
static async findAllUsersByRole(params) {
|
|
3240
|
+
const endpoint = new EndpointCreator({ endpoint: Modules.Role, id: params.roleId, childEndpoint: Modules.User });
|
|
3241
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
3242
|
+
return this.callApi({
|
|
3243
|
+
type: Modules.User,
|
|
3244
|
+
method: "GET" /* GET */,
|
|
3245
|
+
endpoint: endpoint.generate(),
|
|
3246
|
+
next: params.next
|
|
3247
|
+
});
|
|
3248
|
+
}
|
|
3249
|
+
static async findAllUsersNotInRole(params) {
|
|
3250
|
+
const endpoint = new EndpointCreator({
|
|
3251
|
+
endpoint: Modules.Role,
|
|
3252
|
+
id: params.roleId,
|
|
3253
|
+
childEndpoint: Modules.User
|
|
3254
|
+
}).addAdditionalParam("notInRole", "true");
|
|
3255
|
+
if (params.search) endpoint.addAdditionalParam("search", params.search);
|
|
3256
|
+
return this.callApi({
|
|
3257
|
+
type: Modules.User,
|
|
3258
|
+
method: "GET" /* GET */,
|
|
3259
|
+
endpoint: endpoint.generate(),
|
|
3260
|
+
next: params.next
|
|
3261
|
+
});
|
|
3262
|
+
}
|
|
3263
|
+
static async create(params) {
|
|
3264
|
+
return this.callApi({
|
|
3265
|
+
type: Modules.User,
|
|
3266
|
+
method: "POST" /* POST */,
|
|
3267
|
+
endpoint: new EndpointCreator({ endpoint: Modules.User }).generate(),
|
|
3268
|
+
companyId: params.companyId,
|
|
3269
|
+
input: params
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
static async reactivate(params) {
|
|
3273
|
+
return this.callApi({
|
|
3274
|
+
type: Modules.User,
|
|
3275
|
+
method: "PATCH" /* PATCH */,
|
|
3276
|
+
endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate()
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3279
|
+
static async sendInvitation(params) {
|
|
3280
|
+
const endpoint = new EndpointCreator({
|
|
3281
|
+
endpoint: Modules.User,
|
|
3282
|
+
id: params.userId,
|
|
3283
|
+
childEndpoint: "send-invitation-email"
|
|
3284
|
+
});
|
|
3285
|
+
if (params.companyId) endpoint.addAdditionalParam("companyId", params.companyId);
|
|
3286
|
+
this.callApi({
|
|
3287
|
+
type: Modules.User,
|
|
3288
|
+
method: "POST" /* POST */,
|
|
3289
|
+
endpoint: endpoint.generate()
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
static async update(params) {
|
|
3293
|
+
return this.callApi({
|
|
3294
|
+
type: Modules.User,
|
|
3295
|
+
method: "PUT" /* PUT */,
|
|
3296
|
+
endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id }).generate(),
|
|
3297
|
+
companyId: params.companyId,
|
|
3298
|
+
input: params
|
|
3299
|
+
});
|
|
3300
|
+
}
|
|
3301
|
+
static async patchRate(params) {
|
|
3302
|
+
return this.callApi({
|
|
3303
|
+
type: Modules.User,
|
|
3304
|
+
method: "PATCH" /* PATCH */,
|
|
3305
|
+
endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.id, childEndpoint: "rates" }).generate(),
|
|
3306
|
+
companyId: params.companyId,
|
|
3307
|
+
input: params
|
|
3308
|
+
});
|
|
3309
|
+
}
|
|
3310
|
+
static async delete(params) {
|
|
3311
|
+
await this.callApi({
|
|
3312
|
+
type: Modules.User,
|
|
3313
|
+
method: "DELETE" /* DELETE */,
|
|
3314
|
+
endpoint: new EndpointCreator({ endpoint: Modules.User, id: params.userId }).generate(),
|
|
3315
|
+
companyId: params.companyId
|
|
3316
|
+
});
|
|
3317
|
+
}
|
|
3318
|
+
};
|
|
3319
|
+
|
|
2621
3320
|
// src/features/user/user.module.ts
|
|
2622
3321
|
var UserModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory) => factory({
|
|
2623
3322
|
pageUrl: "/users",
|
|
@@ -2719,5 +3418,18 @@ var AuthorModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (factory
|
|
|
2719
3418
|
|
|
2720
3419
|
|
|
2721
3420
|
|
|
2722
|
-
|
|
2723
|
-
|
|
3421
|
+
|
|
3422
|
+
|
|
3423
|
+
|
|
3424
|
+
|
|
3425
|
+
|
|
3426
|
+
|
|
3427
|
+
|
|
3428
|
+
|
|
3429
|
+
|
|
3430
|
+
|
|
3431
|
+
|
|
3432
|
+
|
|
3433
|
+
|
|
3434
|
+
exports.RehydrationFactory = RehydrationFactory; exports.AbstractApiData = AbstractApiData; exports.HttpMethod = HttpMethod; exports.setGlobalErrorHandler = setGlobalErrorHandler; exports.getGlobalErrorHandler = getGlobalErrorHandler; exports.AbstractService = AbstractService; exports.configureClientJsonApi = configureClientJsonApi; exports.getClientApiUrl = getClientApiUrl; exports.getClientAppUrl = getClientAppUrl; exports.getClientTrackablePages = getClientTrackablePages; exports.ClientJsonApiGet = ClientJsonApiGet; exports.ClientJsonApiPost = ClientJsonApiPost; exports.ClientJsonApiPut = ClientJsonApiPut; exports.ClientJsonApiPatch = ClientJsonApiPatch; exports.ClientJsonApiDelete = ClientJsonApiDelete; exports.ClientHttpMethod = ClientHttpMethod; exports.setClientGlobalErrorHandler = setClientGlobalErrorHandler; exports.getClientGlobalErrorHandler = getClientGlobalErrorHandler; exports.ClientAbstractService = ClientAbstractService; exports.ModuleRegistrar = ModuleRegistrar; exports.ModuleRegistry = ModuleRegistry; exports.Modules = Modules; exports.EndpointCreator = EndpointCreator; exports.createJsonApiInclusion = createJsonApiInclusion; exports.rehydrate = rehydrate; exports.rehydrateList = rehydrateList; exports.cn = cn; exports.composeRefs = composeRefs; exports.useComposedRefs = useComposedRefs; exports.useIsMobile = useIsMobile; exports.formatDate = formatDate; exports.exists = exists; exports.TableOptions = TableOptions; exports.getTableOptions = getTableOptions; exports.getTableComponents = getTableComponents; exports.userObjectSchema = userObjectSchema; exports.entityObjectSchema = entityObjectSchema; exports.BlockNoteDiffUtil = BlockNoteDiffUtil; exports.BlockNoteWordDiffRendererUtil = BlockNoteWordDiffRendererUtil; exports.getIconByModule = getIconByModule; exports.getIcon = getIcon; exports.getIconByModuleName = getIconByModuleName; exports.getLucideIcon = getLucideIcon; exports.getLucideIconByModule = getLucideIconByModule; exports.getLucideIconByModuleName = getLucideIconByModuleName; exports.Action = Action; exports.checkPermissions = checkPermissions; exports.checkPermissionsFromServer = checkPermissionsFromServer; exports.getValueFromPath = getValueFromPath; exports.Auth = Auth; exports.configureAuth = configureAuth; exports.getTokenHandler = getTokenHandler; exports.AuthService = AuthService; exports.AuthComponent = AuthComponent; exports.AuthModule = AuthModule; exports.Company = Company; exports.CompanyFields = CompanyFields; exports.CompanyService = CompanyService; exports.CompanyModule = CompanyModule; exports.Content = Content; exports.ContentFields = ContentFields; exports.ContentService = ContentService; exports.ContentModule = ContentModule; exports.Feature = Feature; exports.FeatureService = FeatureService; exports.FeatureModule = FeatureModule; exports.Module = Module; exports.ModuleModule = ModuleModule; exports.Notification = Notification; exports.NotificationFields = NotificationFields; exports.NotificationService = NotificationService; exports.NotificationModule = NotificationModule; exports.Push = Push; exports.PushService = PushService; exports.PushModule = PushModule; exports.Role = Role; exports.RoleFields = RoleFields; exports.RoleService = RoleService; exports.RoleModule = RoleModule; exports.S3 = S3; exports.S3Module = S3Module; exports.S3Service = S3Service; exports.User = User; exports.UserFields = UserFields; exports.UserService = UserService; exports.UserModule = UserModule; exports.AuthorModule = AuthorModule;
|
|
3435
|
+
//# sourceMappingURL=chunk-U4NADAHN.js.map
|