@beinformed/ui 2.0.0-beta.0 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/{Constants-BIbEko1E.d.cts → Constants-Cw7d8vue.d.cts} +7 -2
  3. package/dist/{Constants-BIbEko1E.d.ts → Constants-Cw7d8vue.d.ts} +7 -2
  4. package/dist/{FormModel-40md7nLX.d.ts → FormModel-DnizzHJs.d.cts} +8 -14
  5. package/dist/{FormModel-CemlQ_MU.d.cts → FormModel-VQaB1SCS.d.ts} +8 -14
  6. package/dist/chunk-333J3Q2L.js +2 -0
  7. package/dist/chunk-333J3Q2L.js.map +1 -0
  8. package/dist/chunk-5BR5HMNQ.js +2 -0
  9. package/dist/chunk-5BR5HMNQ.js.map +1 -0
  10. package/dist/chunk-6GV6KLAV.js +2 -0
  11. package/dist/chunk-6GV6KLAV.js.map +1 -0
  12. package/dist/{chunk-CKI2GSM7.js → chunk-BTDN4ZDB.js} +2 -2
  13. package/dist/{chunk-CKI2GSM7.js.map → chunk-BTDN4ZDB.js.map} +1 -1
  14. package/dist/chunk-KCZQQTX6.js +2 -0
  15. package/dist/chunk-KCZQQTX6.js.map +1 -0
  16. package/dist/chunk-LCMAAW7B.js +2 -0
  17. package/dist/chunk-LCMAAW7B.js.map +1 -0
  18. package/dist/{chunk-LYBG43T6.js → chunk-OBB3YOFC.js} +2 -2
  19. package/dist/{chunk-LYBG43T6.js.map → chunk-OBB3YOFC.js.map} +1 -1
  20. package/dist/chunk-QIGFPQFN.js +1 -0
  21. package/dist/chunk-UE323PGR.js +2 -0
  22. package/dist/{chunk-LHZG2ET5.js.map → chunk-UE323PGR.js.map} +1 -1
  23. package/dist/chunk-VIKUDFQV.js +33 -0
  24. package/dist/chunk-VIKUDFQV.js.map +1 -0
  25. package/dist/{chunk-MQBYZKME.js → chunk-YOBCFXEM.js} +2 -2
  26. package/dist/chunk-ZDZHA43Q.js +2 -0
  27. package/dist/chunk-ZDZHA43Q.js.map +1 -0
  28. package/dist/constants/index.cjs +1 -1
  29. package/dist/constants/index.cjs.map +1 -1
  30. package/dist/constants/index.d.cts +1 -1
  31. package/dist/constants/index.d.ts +1 -1
  32. package/dist/constants/index.js +1 -1
  33. package/dist/exceptions/index.cjs +1 -1
  34. package/dist/exceptions/index.cjs.map +1 -1
  35. package/dist/exceptions/index.d.cts +3 -3
  36. package/dist/exceptions/index.d.ts +3 -3
  37. package/dist/exceptions/index.js +1 -1
  38. package/dist/{index-CgXDAyxM.d.ts → index-BFD-cKUB.d.cts} +202 -115
  39. package/dist/{index-Ku2WDvSe.d.cts → index-CEg8Nt57.d.ts} +202 -115
  40. package/dist/index.cjs +8 -8
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +6 -6
  43. package/dist/index.d.ts +6 -6
  44. package/dist/index.js +1 -1
  45. package/dist/layouthints/index.cjs +5 -5
  46. package/dist/layouthints/index.cjs.map +1 -1
  47. package/dist/layouthints/index.d.cts +2 -2
  48. package/dist/layouthints/index.d.ts +2 -2
  49. package/dist/layouthints/index.js +1 -1
  50. package/dist/models/index.cjs +10 -10
  51. package/dist/models/index.cjs.map +1 -1
  52. package/dist/models/index.d.cts +53 -76
  53. package/dist/models/index.d.ts +53 -76
  54. package/dist/models/index.js +1 -1
  55. package/dist/modularui/index.cjs +10 -10
  56. package/dist/modularui/index.cjs.map +1 -1
  57. package/dist/modularui/index.d.cts +47 -8
  58. package/dist/modularui/index.d.ts +47 -8
  59. package/dist/modularui/index.js +1 -1
  60. package/dist/settings/index.cjs +1 -1
  61. package/dist/settings/index.cjs.map +1 -1
  62. package/dist/settings/index.d.cts +1 -3
  63. package/dist/settings/index.d.ts +1 -3
  64. package/dist/settings/index.js +1 -1
  65. package/dist/types/index.d.cts +2 -2
  66. package/dist/types/index.d.ts +2 -2
  67. package/dist/utils/index.cjs +12 -12
  68. package/dist/utils/index.cjs.map +1 -1
  69. package/dist/utils/index.d.cts +7 -5
  70. package/dist/utils/index.d.ts +7 -5
  71. package/dist/utils/index.js +1 -1
  72. package/package.json +7 -7
  73. package/dist/chunk-52QS5IDA.js +0 -1
  74. package/dist/chunk-77CGPEAQ.js +0 -2
  75. package/dist/chunk-77CGPEAQ.js.map +0 -1
  76. package/dist/chunk-BE2T4IDL.js +0 -2
  77. package/dist/chunk-BE2T4IDL.js.map +0 -1
  78. package/dist/chunk-BODVDNNA.js +0 -2
  79. package/dist/chunk-BODVDNNA.js.map +0 -1
  80. package/dist/chunk-EP2OYSVS.js +0 -2
  81. package/dist/chunk-EP2OYSVS.js.map +0 -1
  82. package/dist/chunk-FGEQKEJQ.js +0 -2
  83. package/dist/chunk-FGEQKEJQ.js.map +0 -1
  84. package/dist/chunk-LHZG2ET5.js +0 -2
  85. package/dist/chunk-SGXACUOV.js +0 -2
  86. package/dist/chunk-SGXACUOV.js.map +0 -1
  87. package/dist/chunk-YUOGIFZH.js +0 -33
  88. package/dist/chunk-YUOGIFZH.js.map +0 -1
  89. /package/dist/{chunk-52QS5IDA.js.map → chunk-QIGFPQFN.js.map} +0 -0
  90. /package/dist/{chunk-MQBYZKME.js.map → chunk-YOBCFXEM.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @beinformed/ui
2
2
 
3
+ ## 2.0.0-beta.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 84de89d: - # fix sonar, lint and tsc issues
8
+ - Sync with UI library 1.0 changes
9
+
3
10
  ## 2.0.0-beta.0
4
11
 
5
12
  ### Major Changes
@@ -4,6 +4,10 @@ declare enum HTTP_METHODS {
4
4
  GET = "GET",
5
5
  POST = "POST"
6
6
  }
7
+ declare enum PARAMETER_TYPES {
8
+ BODY = "bodyParameter",
9
+ QUERY = "queryParameter"
10
+ }
7
11
  /**
8
12
  * Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment
9
13
  */
@@ -41,7 +45,8 @@ declare enum ATTRIBUTE_WIDTH {
41
45
  declare enum INTERNAL_LOGIN_TYPE {
42
46
  JAAS = "JAAS",
43
47
  PAC4J_FORM = "PAC4J_FORM",
44
- PAC4J_BASIC = "PAC4J_BASIC"
48
+ PAC4J_BASIC = "PAC4J_BASIC",
49
+ PAC4J_INDIRECT = "PAC4J_INDIRECT"
45
50
  }
46
51
  declare const LOGIN_TYPE = "security.clients";
47
52
  declare const LOGIN_PATH_SETTING = "FormClient.login_url";
@@ -54,4 +59,4 @@ declare const DEFAULT_AUTHENTICATION_TYPE: {
54
59
  isPrimary: boolean;
55
60
  };
56
61
 
57
- export { ATTRIBUTE_WIDTH as A, DATETIME_OFFSET_FORMAT as D, HTTP_METHODS as H, IS_GRAALJS as I, LOGIN_TYPE as L, PARAMETER_SEPARATOR as P, TIMEVERSION_FILTER_NAME as T, IS_SERVER as a, ISO_DATE_FORMAT as b, ISO_DATETIME_FORMAT as c, ISO_TIME_FORMAT as d, ISO_TIMESTAMP_FORMAT as e, DEFAULT_WEEK_STARTS_ON as f, DEFAULT_FIRST_WEEK_CONTAINS_DATE as g, INTERNAL_LOGIN_TYPE as h, LOGIN_PATH_SETTING as i, LOGIN_USERNAME_SETTING as j, LOGIN_PASSWORD_SETTING as k, LOGOUT_PATH_SETTING as l, DEFAULT_AUTHENTICATION_TYPE as m };
62
+ export { ATTRIBUTE_WIDTH as A, DATETIME_OFFSET_FORMAT as D, HTTP_METHODS as H, IS_GRAALJS as I, LOGIN_TYPE as L, PARAMETER_TYPES as P, TIMEVERSION_FILTER_NAME as T, IS_SERVER as a, PARAMETER_SEPARATOR as b, ISO_DATE_FORMAT as c, ISO_DATETIME_FORMAT as d, ISO_TIME_FORMAT as e, ISO_TIMESTAMP_FORMAT as f, DEFAULT_WEEK_STARTS_ON as g, DEFAULT_FIRST_WEEK_CONTAINS_DATE as h, INTERNAL_LOGIN_TYPE as i, LOGIN_PATH_SETTING as j, LOGIN_USERNAME_SETTING as k, LOGIN_PASSWORD_SETTING as l, LOGOUT_PATH_SETTING as m, DEFAULT_AUTHENTICATION_TYPE as n };
@@ -4,6 +4,10 @@ declare enum HTTP_METHODS {
4
4
  GET = "GET",
5
5
  POST = "POST"
6
6
  }
7
+ declare enum PARAMETER_TYPES {
8
+ BODY = "bodyParameter",
9
+ QUERY = "queryParameter"
10
+ }
7
11
  /**
8
12
  * Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment
9
13
  */
@@ -41,7 +45,8 @@ declare enum ATTRIBUTE_WIDTH {
41
45
  declare enum INTERNAL_LOGIN_TYPE {
42
46
  JAAS = "JAAS",
43
47
  PAC4J_FORM = "PAC4J_FORM",
44
- PAC4J_BASIC = "PAC4J_BASIC"
48
+ PAC4J_BASIC = "PAC4J_BASIC",
49
+ PAC4J_INDIRECT = "PAC4J_INDIRECT"
45
50
  }
46
51
  declare const LOGIN_TYPE = "security.clients";
47
52
  declare const LOGIN_PATH_SETTING = "FormClient.login_url";
@@ -54,4 +59,4 @@ declare const DEFAULT_AUTHENTICATION_TYPE: {
54
59
  isPrimary: boolean;
55
60
  };
56
61
 
57
- export { ATTRIBUTE_WIDTH as A, DATETIME_OFFSET_FORMAT as D, HTTP_METHODS as H, IS_GRAALJS as I, LOGIN_TYPE as L, PARAMETER_SEPARATOR as P, TIMEVERSION_FILTER_NAME as T, IS_SERVER as a, ISO_DATE_FORMAT as b, ISO_DATETIME_FORMAT as c, ISO_TIME_FORMAT as d, ISO_TIMESTAMP_FORMAT as e, DEFAULT_WEEK_STARTS_ON as f, DEFAULT_FIRST_WEEK_CONTAINS_DATE as g, INTERNAL_LOGIN_TYPE as h, LOGIN_PATH_SETTING as i, LOGIN_USERNAME_SETTING as j, LOGIN_PASSWORD_SETTING as k, LOGOUT_PATH_SETTING as l, DEFAULT_AUTHENTICATION_TYPE as m };
62
+ export { ATTRIBUTE_WIDTH as A, DATETIME_OFFSET_FORMAT as D, HTTP_METHODS as H, IS_GRAALJS as I, LOGIN_TYPE as L, PARAMETER_TYPES as P, TIMEVERSION_FILTER_NAME as T, IS_SERVER as a, PARAMETER_SEPARATOR as b, ISO_DATE_FORMAT as c, ISO_DATETIME_FORMAT as d, ISO_TIME_FORMAT as e, ISO_TIMESTAMP_FORMAT as f, DEFAULT_WEEK_STARTS_ON as g, DEFAULT_FIRST_WEEK_CONTAINS_DATE as h, INTERNAL_LOGIN_TYPE as i, LOGIN_PATH_SETTING as j, LOGIN_USERNAME_SETTING as k, LOGIN_PASSWORD_SETTING as l, LOGOUT_PATH_SETTING as m, DEFAULT_AUTHENTICATION_TYPE as n };
@@ -1,9 +1,7 @@
1
- import { aw as ResourceModel, b9 as ContentTypeData, ba as ContentTypeContributions, cR as ModularUIResponse, b5 as ContentDetailData, b6 as ContentDetailContributions, cb as LinkModel, cO as ModelWithChildModels, by as ErrorResponse, aY as SectionModel, bF as FilterCollection, aX as ContentLinkModel, aZ as SubSectionModel, c8 as Href, au as BaseModel, b$ as FormObjectData, c7 as FormObjectContributions, cP as ModelOptions, ac as AttributeModel, a6 as AttributeContributions, bd as ContentConfiguration, e as AttributeCollection, a9 as MaybeAttributeValue, h as BooleanAttributeModel, C as CaptchaAttributeModel, j as ChoiceAttributeModel, a0 as ChoiceAttributeContributions, o as CompositeAttributeModel, a2 as CompositeAttributeContributions, D as DatetimeAttributeModel, _ as DatetimeAttributeContributions, H as HelptextAttributeModel, L as LabelAttributeModel, G as MemoAttributeModel, N as NumberAttributeModel, Y as NumberAttributeContributions, P as PasswordAttributeModel, I as RangeAttributeModel, a3 as RangeAttributeContributions, S as StringAttributeModel, T as StringAttributeContributions, U as UploadAttributeModel, X as XMLAttributeModel, bw as ErrorCollection, c2 as ErrorObjectData, c3 as MissingObjectData, c5 as AnchorElementData, c0 as FormData, c6 as FormContributions, g as AttributeSetModel, cE as Parameter, cF as ParameterCollection, c1 as SuccessData } from './index-CgXDAyxM.js';
1
+ import { aw as ResourceModel, b9 as ContentTypeData, ba as ContentTypeContributions, b5 as ContentDetailData, b6 as ContentDetailContributions, cR as ModularUIResponse, cb as LinkModel, cO as ModelWithChildModels, by as ErrorResponse, aY as SectionModel, bE as FilterCollection, aX as ContentLinkModel, aZ as SubSectionModel, c8 as Href, c_ as HrefState, au as BaseModel, b$ as FormObjectData, c7 as FormObjectContributions, cP as ModelOptions, ac as AttributeModel, a6 as AttributeContributions, bd as ContentConfiguration, e as AttributeCollection, a9 as MaybeAttributeValue, h as BooleanAttributeModel, C as CaptchaAttributeModel, j as ChoiceAttributeModel, a0 as ChoiceAttributeContributions, o as CompositeAttributeModel, a2 as CompositeAttributeContributions, D as DatetimeAttributeModel, _ as DatetimeAttributeContributions, H as HelptextAttributeModel, L as LabelAttributeModel, G as MemoAttributeModel, N as NumberAttributeModel, Y as NumberAttributeContributions, P as PasswordAttributeModel, I as RangeAttributeModel, a3 as RangeAttributeContributions, S as StringAttributeModel, T as StringAttributeContributions, U as UploadAttributeModel, X as XMLAttributeModel, bw as ErrorCollection, c2 as ErrorObjectData, c3 as MissingObjectData, c5 as AnchorElementData, c0 as FormData, c6 as FormContributions, g as AttributeSetModel, cE as Parameter, cF as ParameterCollection, c1 as SuccessData } from './index-BFD-cKUB.cjs';
2
2
 
3
3
  declare class ContentTypeModel extends ResourceModel<ContentTypeData, ContentTypeContributions> {
4
4
  get type(): string;
5
- static get modelName(): string;
6
- static isApplicableModel(data: ModularUIResponse): boolean;
7
5
  get label(): string;
8
6
  get icon(): string | undefined;
9
7
  get iconSmall(): string | undefined;
@@ -21,8 +19,6 @@ declare class ContentModel extends ResourceModel<ContentDetailData, ContentDetai
21
19
  private _filterCollection;
22
20
  constructor(response: ModularUIResponse);
23
21
  get type(): string;
24
- static get modelName(): string;
25
- static isApplicableModel(data: ModularUIResponse): boolean;
26
22
  getInitialChildModelLinks(): LinkModel[];
27
23
  setChildModels(models: ModelWithChildModels[], _errors: ErrorResponse[]): void;
28
24
  get section(): SectionModel;
@@ -72,11 +68,11 @@ declare class ContentModel extends ResourceModel<ContentDetailData, ContentDetai
72
68
  * Get sub sections
73
69
  */
74
70
  get subSections(): SubSectionModel[];
75
- get relatedConceptsHrefs(): Href<unknown>[];
71
+ get relatedConceptsHrefs(): Href<HrefState>[];
76
72
  /**
77
73
  * Get related concepts link
78
74
  */
79
- get relatedConceptsHref(): Href<unknown> | null;
75
+ get relatedConceptsHref(): Href<HrefState> | null;
80
76
  get referenceHash(): number;
81
77
  }
82
78
 
@@ -229,8 +225,6 @@ declare class FormModel extends ResourceModel<FormData, FormContributions> {
229
225
  constructor(modularuiResponse?: ModularUIResponse);
230
226
  get type(): string;
231
227
  get actiontype(): string;
232
- static get modelName(): string;
233
- static isApplicableModel(data: ModularUIResponse): boolean;
234
228
  getInitialChildModelLinks(): LinkModel[];
235
229
  setChildModels(models: ModelWithChildModels[], errors: ErrorResponse[]): void;
236
230
  get label(): string;
@@ -334,8 +328,8 @@ declare class FormModel extends ResourceModel<FormData, FormContributions> {
334
328
  /**
335
329
  * Handle success redirects
336
330
  */
337
- get successRedirect(): Href<unknown> | undefined;
338
- get redirectLocation(): Href<unknown> | undefined;
331
+ get successRedirect(): Href<HrefState> | undefined;
332
+ get redirectLocation(): Href<HrefState> | undefined;
339
333
  /**
340
334
  * Get the result data as plain json object
341
335
  */
@@ -348,12 +342,12 @@ declare class FormModel extends ResourceModel<FormData, FormContributions> {
348
342
  setParameters(parameters: Parameter[] | undefined): ParameterCollection;
349
343
  get parameters(): ParameterCollection;
350
344
  set parameters(parameters: ParameterCollection);
351
- selfhrefNoCommitParam(): Href<unknown>;
352
- selfhrefWithCommitParam(): Href<unknown>;
345
+ selfhrefNoCommitParam(): Href<HrefState>;
346
+ selfhrefWithCommitParam(): Href<HrefState>;
353
347
  /**
354
348
  * Create a selfhref including the parameters that are used to start this form
355
349
  */
356
- get selfhref(): Href<unknown>;
350
+ get selfhref(): Href<HrefState>;
357
351
  /**
358
352
  * Handle form tokens to indicate concurrent form use
359
353
  */
@@ -1,9 +1,7 @@
1
- import { aw as ResourceModel, b9 as ContentTypeData, ba as ContentTypeContributions, cR as ModularUIResponse, b5 as ContentDetailData, b6 as ContentDetailContributions, cb as LinkModel, cO as ModelWithChildModels, by as ErrorResponse, aY as SectionModel, bF as FilterCollection, aX as ContentLinkModel, aZ as SubSectionModel, c8 as Href, au as BaseModel, b$ as FormObjectData, c7 as FormObjectContributions, cP as ModelOptions, ac as AttributeModel, a6 as AttributeContributions, bd as ContentConfiguration, e as AttributeCollection, a9 as MaybeAttributeValue, h as BooleanAttributeModel, C as CaptchaAttributeModel, j as ChoiceAttributeModel, a0 as ChoiceAttributeContributions, o as CompositeAttributeModel, a2 as CompositeAttributeContributions, D as DatetimeAttributeModel, _ as DatetimeAttributeContributions, H as HelptextAttributeModel, L as LabelAttributeModel, G as MemoAttributeModel, N as NumberAttributeModel, Y as NumberAttributeContributions, P as PasswordAttributeModel, I as RangeAttributeModel, a3 as RangeAttributeContributions, S as StringAttributeModel, T as StringAttributeContributions, U as UploadAttributeModel, X as XMLAttributeModel, bw as ErrorCollection, c2 as ErrorObjectData, c3 as MissingObjectData, c5 as AnchorElementData, c0 as FormData, c6 as FormContributions, g as AttributeSetModel, cE as Parameter, cF as ParameterCollection, c1 as SuccessData } from './index-Ku2WDvSe.cjs';
1
+ import { aw as ResourceModel, b9 as ContentTypeData, ba as ContentTypeContributions, b5 as ContentDetailData, b6 as ContentDetailContributions, cR as ModularUIResponse, cb as LinkModel, cO as ModelWithChildModels, by as ErrorResponse, aY as SectionModel, bE as FilterCollection, aX as ContentLinkModel, aZ as SubSectionModel, c8 as Href, c_ as HrefState, au as BaseModel, b$ as FormObjectData, c7 as FormObjectContributions, cP as ModelOptions, ac as AttributeModel, a6 as AttributeContributions, bd as ContentConfiguration, e as AttributeCollection, a9 as MaybeAttributeValue, h as BooleanAttributeModel, C as CaptchaAttributeModel, j as ChoiceAttributeModel, a0 as ChoiceAttributeContributions, o as CompositeAttributeModel, a2 as CompositeAttributeContributions, D as DatetimeAttributeModel, _ as DatetimeAttributeContributions, H as HelptextAttributeModel, L as LabelAttributeModel, G as MemoAttributeModel, N as NumberAttributeModel, Y as NumberAttributeContributions, P as PasswordAttributeModel, I as RangeAttributeModel, a3 as RangeAttributeContributions, S as StringAttributeModel, T as StringAttributeContributions, U as UploadAttributeModel, X as XMLAttributeModel, bw as ErrorCollection, c2 as ErrorObjectData, c3 as MissingObjectData, c5 as AnchorElementData, c0 as FormData, c6 as FormContributions, g as AttributeSetModel, cE as Parameter, cF as ParameterCollection, c1 as SuccessData } from './index-CEg8Nt57.js';
2
2
 
3
3
  declare class ContentTypeModel extends ResourceModel<ContentTypeData, ContentTypeContributions> {
4
4
  get type(): string;
5
- static get modelName(): string;
6
- static isApplicableModel(data: ModularUIResponse): boolean;
7
5
  get label(): string;
8
6
  get icon(): string | undefined;
9
7
  get iconSmall(): string | undefined;
@@ -21,8 +19,6 @@ declare class ContentModel extends ResourceModel<ContentDetailData, ContentDetai
21
19
  private _filterCollection;
22
20
  constructor(response: ModularUIResponse);
23
21
  get type(): string;
24
- static get modelName(): string;
25
- static isApplicableModel(data: ModularUIResponse): boolean;
26
22
  getInitialChildModelLinks(): LinkModel[];
27
23
  setChildModels(models: ModelWithChildModels[], _errors: ErrorResponse[]): void;
28
24
  get section(): SectionModel;
@@ -72,11 +68,11 @@ declare class ContentModel extends ResourceModel<ContentDetailData, ContentDetai
72
68
  * Get sub sections
73
69
  */
74
70
  get subSections(): SubSectionModel[];
75
- get relatedConceptsHrefs(): Href<unknown>[];
71
+ get relatedConceptsHrefs(): Href<HrefState>[];
76
72
  /**
77
73
  * Get related concepts link
78
74
  */
79
- get relatedConceptsHref(): Href<unknown> | null;
75
+ get relatedConceptsHref(): Href<HrefState> | null;
80
76
  get referenceHash(): number;
81
77
  }
82
78
 
@@ -229,8 +225,6 @@ declare class FormModel extends ResourceModel<FormData, FormContributions> {
229
225
  constructor(modularuiResponse?: ModularUIResponse);
230
226
  get type(): string;
231
227
  get actiontype(): string;
232
- static get modelName(): string;
233
- static isApplicableModel(data: ModularUIResponse): boolean;
234
228
  getInitialChildModelLinks(): LinkModel[];
235
229
  setChildModels(models: ModelWithChildModels[], errors: ErrorResponse[]): void;
236
230
  get label(): string;
@@ -334,8 +328,8 @@ declare class FormModel extends ResourceModel<FormData, FormContributions> {
334
328
  /**
335
329
  * Handle success redirects
336
330
  */
337
- get successRedirect(): Href<unknown> | undefined;
338
- get redirectLocation(): Href<unknown> | undefined;
331
+ get successRedirect(): Href<HrefState> | undefined;
332
+ get redirectLocation(): Href<HrefState> | undefined;
339
333
  /**
340
334
  * Get the result data as plain json object
341
335
  */
@@ -348,12 +342,12 @@ declare class FormModel extends ResourceModel<FormData, FormContributions> {
348
342
  setParameters(parameters: Parameter[] | undefined): ParameterCollection;
349
343
  get parameters(): ParameterCollection;
350
344
  set parameters(parameters: ParameterCollection);
351
- selfhrefNoCommitParam(): Href<unknown>;
352
- selfhrefWithCommitParam(): Href<unknown>;
345
+ selfhrefNoCommitParam(): Href<HrefState>;
346
+ selfhrefWithCommitParam(): Href<HrefState>;
353
347
  /**
354
348
  * Create a selfhref including the parameters that are used to start this form
355
349
  */
356
- get selfhref(): Href<unknown>;
350
+ get selfhref(): Href<HrefState>;
357
351
  /**
358
352
  * Handle form tokens to indicate concurrent form use
359
353
  */
@@ -0,0 +1,2 @@
1
+ import{f as m}from"./chunk-UE323PGR.js";import{b as h}from"./chunk-6GV6KLAV.js";var n=h(m(),1);var f=400,i=class e extends Error{id;request;requestOptions;status;response;properties;parameters;constructor(t,r,s){let o=E(t,s);super(o.id),Object.setPrototypeOf(this,e.prototype),this.name=o.id,this.id=o.id,this.request=r,this.requestOptions=s,this.status=r&&r.status?r.status:f,this.response=t,this.properties=o.properties??{},this.parameters=o.param,"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,this.constructor)}},E=(e,t)=>{let r={id:"Error.CannotRequestResource",defaultMessage:`Cannot request resource ${t?.url??""} with method ${t?.method??"GET"}`,properties:{},param:void 0};if(!e)return r;if((0,n.default)(e,"error"))return{...r,...e.error};let[s]=Object.keys(e);return(0,n.default)(e[s],"errors")?{...r,...e[s].errors}:r};var u=class extends Error{constructor(t){super(t instanceof SyntaxError?t.message:t),this.name="JsonParseException"}};var a=class extends Error{id;status;constructor(t,r){super(`An unexpected network error occurred, cannot request resource ${t} with method ${r}`),this.name="NetworkException",this.id="NetworkException",this.status=0}};var d=class extends Error{id;status;isReload;constructor(t,r,s=!1){super(`Resource ${t} with method ${r} not found`),this.name="NotFoundException",this.id="NotFoundException",this.status=404,this.isReload=s}};var c=class extends Error{constructor(t,r){super(`Timeout occurred in connection to ${t} with method ${r}.`),this.name="TimeoutException"}};var p=class extends Error{id;status;response;constructor(t,r,s){super(`Cannot request resource ${t} with method ${r}`),this.name="UnauthorizedException",this.id="UnauthorizedException",this.status=401,this.response=s}};export{i as a,u as b,a as c,d,c as e,p as f};
2
+ //# sourceMappingURL=chunk-333J3Q2L.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/exceptions/FetchException.ts","../src/exceptions/JsonParseException.ts","../src/exceptions/NetworkException.ts","../src/exceptions/NotFoundException.ts","../src/exceptions/TimeoutException.ts","../src/exceptions/UnauthorizedException.ts"],"sourcesContent":["import has from \"lodash/has\";\n\nimport { HTTP_METHODS } from \"../constants/Constants\";\n\nimport type { MessageParameters } from \"../types/types\";\nimport type { RequestOptions } from \"../utils/fetch/types\";\nimport type { ModularUIErrorJSON } from \"./types\";\n\nconst CLIENT_ERROR_CODE = 400;\n\nexport class FetchException extends Error {\n id: string;\n request: XMLHttpRequest | undefined;\n requestOptions: RequestOptions | undefined;\n status: number;\n response: ModularUIErrorJSON | undefined;\n properties: MessageParameters;\n parameters: MessageParameters | undefined;\n\n constructor(\n errorResponse: ModularUIErrorJSON | undefined,\n failedRequest?: XMLHttpRequest,\n requestOptions?: RequestOptions,\n ) {\n const errorInfo = getErrorInfo(errorResponse, requestOptions);\n super(errorInfo.id);\n\n Object.setPrototypeOf(this, FetchException.prototype);\n\n this.name = errorInfo.id;\n this.id = errorInfo.id;\n this.request = failedRequest;\n this.requestOptions = requestOptions;\n\n this.status =\n failedRequest && failedRequest.status\n ? failedRequest.status\n : CLIENT_ERROR_CODE;\n\n this.response = errorResponse;\n this.properties = errorInfo.properties ?? {};\n this.parameters = errorInfo.param;\n\n if (\n \"captureStackTrace\" in Error &&\n typeof Error.captureStackTrace === \"function\"\n ) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\nconst getErrorInfo = (\n errorResponse: ModularUIErrorJSON | undefined,\n requestOptions: RequestOptions | undefined,\n) => {\n const defaultErrorInfo = {\n id: \"Error.CannotRequestResource\",\n defaultMessage: `Cannot request resource ${\n requestOptions?.url ?? \"\"\n } with method ${requestOptions?.method ?? HTTP_METHODS.GET}`,\n properties: {},\n param: undefined,\n };\n\n if (!errorResponse) {\n return defaultErrorInfo;\n }\n\n if (has(errorResponse, \"error\")) {\n return {\n ...defaultErrorInfo,\n ...errorResponse.error,\n };\n }\n\n const [key] = Object.keys(errorResponse);\n if (has(errorResponse[key], \"errors\")) {\n return {\n ...defaultErrorInfo,\n ...errorResponse[key].errors,\n };\n }\n\n return defaultErrorInfo;\n};\n","export class JsonParseException extends Error {\n constructor(error: SyntaxError | string) {\n super(error instanceof SyntaxError ? error.message : error);\n\n this.name = \"JsonParseException\";\n }\n}\n","export class NetworkException extends Error {\n id: string;\n status: number;\n\n constructor(url: string, method: string) {\n super(\n `An unexpected network error occurred, cannot request resource ${url} with method ${method}`,\n );\n\n this.name = \"NetworkException\";\n this.id = \"NetworkException\";\n this.status = 0;\n }\n}\n","export class NotFoundException extends Error {\n id: string;\n status: number;\n isReload: boolean;\n\n constructor(url: string, method: string, isReload = false) {\n super(`Resource ${url} with method ${method} not found`);\n\n this.name = \"NotFoundException\";\n this.id = \"NotFoundException\";\n this.status = 404;\n this.isReload = isReload;\n }\n}\n","export class TimeoutException extends Error {\n constructor(url: string, method: string) {\n super(`Timeout occurred in connection to ${url} with method ${method}.`);\n\n this.name = \"TimeoutException\";\n }\n}\n","import type { ModularUIErrorJSON } from \"./types\";\n\nexport class UnauthorizedException extends Error {\n id: string;\n status: number;\n response: ModularUIErrorJSON | undefined;\n\n constructor(\n url: string,\n method: string,\n errorResponse: ModularUIErrorJSON | undefined,\n ) {\n super(`Cannot request resource ${url} with method ${method}`);\n\n this.name = \"UnauthorizedException\";\n this.id = \"UnauthorizedException\";\n this.status = 401;\n this.response = errorResponse;\n }\n}\n"],"mappings":"gFAAA,IAAAA,EAAgB,SAQhB,IAAMC,EAAoB,IAEbC,EAAN,MAAMC,UAAuB,KAAM,CACxC,GACA,QACA,eACA,OACA,SACA,WACA,WAEA,YACEC,EACAC,EACAC,EACA,CACA,IAAMC,EAAYC,EAAaJ,EAAeE,CAAc,EAC5D,MAAMC,EAAU,EAAE,EAElB,OAAO,eAAe,KAAMJ,EAAe,SAAS,EAEpD,KAAK,KAAOI,EAAU,GACtB,KAAK,GAAKA,EAAU,GACpB,KAAK,QAAUF,EACf,KAAK,eAAiBC,EAEtB,KAAK,OACHD,GAAiBA,EAAc,OAC3BA,EAAc,OACdJ,EAEN,KAAK,SAAWG,EAChB,KAAK,WAAaG,EAAU,YAAc,CAAC,EAC3C,KAAK,WAAaA,EAAU,MAG1B,sBAAuB,OACvB,OAAO,MAAM,mBAAsB,YAEnC,MAAM,kBAAkB,KAAM,KAAK,WAAW,CAElD,CACF,EAEMC,EAAe,CACnBJ,EACAE,IACG,CACH,IAAMG,EAAmB,CACvB,GAAI,8BACJ,eAAgB,2BACdH,GAAgB,KAAO,EACzB,gBAAgBA,GAAgB,QAAU,KAAgB,GAC1D,WAAY,CAAC,EACb,MAAO,MACT,EAEA,GAAI,CAACF,EACH,OAAOK,EAGT,MAAI,EAAAC,SAAIN,EAAe,OAAO,EAC5B,MAAO,CACL,GAAGK,EACH,GAAGL,EAAc,KACnB,EAGF,GAAM,CAACO,CAAG,EAAI,OAAO,KAAKP,CAAa,EACvC,SAAI,EAAAM,SAAIN,EAAcO,CAAG,EAAG,QAAQ,EAC3B,CACL,GAAGF,EACH,GAAGL,EAAcO,CAAG,EAAE,MACxB,EAGKF,CACT,ECrFO,IAAMG,EAAN,cAAiC,KAAM,CAC5C,YAAYC,EAA6B,CACvC,MAAMA,aAAiB,YAAcA,EAAM,QAAUA,CAAK,EAE1D,KAAK,KAAO,oBACd,CACF,ECNO,IAAMC,EAAN,cAA+B,KAAM,CAC1C,GACA,OAEA,YAAYC,EAAaC,EAAgB,CACvC,MACE,iEAAiED,CAAG,gBAAgBC,CAAM,EAC5F,EAEA,KAAK,KAAO,mBACZ,KAAK,GAAK,mBACV,KAAK,OAAS,CAChB,CACF,ECbO,IAAMC,EAAN,cAAgC,KAAM,CAC3C,GACA,OACA,SAEA,YAAYC,EAAaC,EAAgBC,EAAW,GAAO,CACzD,MAAM,YAAYF,CAAG,gBAAgBC,CAAM,YAAY,EAEvD,KAAK,KAAO,oBACZ,KAAK,GAAK,oBACV,KAAK,OAAS,IACd,KAAK,SAAWC,CAClB,CACF,ECbO,IAAMC,EAAN,cAA+B,KAAM,CAC1C,YAAYC,EAAaC,EAAgB,CACvC,MAAM,qCAAqCD,CAAG,gBAAgBC,CAAM,GAAG,EAEvE,KAAK,KAAO,kBACd,CACF,ECJO,IAAMC,EAAN,cAAoC,KAAM,CAC/C,GACA,OACA,SAEA,YACEC,EACAC,EACAC,EACA,CACA,MAAM,2BAA2BF,CAAG,gBAAgBC,CAAM,EAAE,EAE5D,KAAK,KAAO,wBACZ,KAAK,GAAK,wBACV,KAAK,OAAS,IACd,KAAK,SAAWC,CAClB,CACF","names":["import_has","CLIENT_ERROR_CODE","FetchException","_FetchException","errorResponse","failedRequest","requestOptions","errorInfo","getErrorInfo","defaultErrorInfo","has","key","JsonParseException","error","NetworkException","url","method","NotFoundException","url","method","isReload","TimeoutException","url","method","UnauthorizedException","url","method","errorResponse"]}
@@ -0,0 +1,2 @@
1
+ import{a as L}from"./chunk-YOBCFXEM.js";import{b as g,c as h}from"./chunk-BTDN4ZDB.js";import{f as H}from"./chunk-333J3Q2L.js";import{Ea as j,Fa as B,Ga as z,Ia as V,Ka as G,La as W,Ua as Y,Wa as Q,Xa as M,Ya as K,bb as v,db as u,e as w,eb as X,j as I,k as N,o as $,pb as Z,rb as tt,s as J,ub as et,vb as ot,wb as it,x as q,xb as rt,yb as nt}from"./chunk-LCMAAW7B.js";import{l as U}from"./chunk-KCZQQTX6.js";import{a as D,b as p}from"./chunk-VIKUDFQV.js";import{a}from"./chunk-VGAPPKHA.js";import{A as S,h as y,o as P,p as T,q as F,r as O,s as k,v as l,w as d}from"./chunk-OBB3YOFC.js";import{g as m}from"./chunk-UE323PGR.js";import{b as E,h as A,q as R}from"./chunk-6GV6KLAV.js";var st=class{_isBasicAuthentication;_authenticationType;constructor(){this._isBasicAuthentication=!1,this._authenticationType=this.getAuthenticationType()}getAuthenticationType(){let t=P(),e=R[t];return!e||e==="JAAS"?"JAAS":e==="PAC4J_FORM"||t.includes("FormClient")?"PAC4J_FORM":e==="PAC4J_BASIC"||t.includes("IndirectBasicClient")?"PAC4J_BASIC":"PAC4J_INDIRECT"}get authenticationType(){return this._authenticationType}set authenticationType(t){this._authenticationType=t}get isBasicAuthentication(){return this._isBasicAuthentication||this.authenticationType==="PAC4J_BASIC"}set isBasicAuthentication(t){this._isBasicAuthentication=t}requestLogin(){return h({url:`${l()}/login`,method:"GET",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"}})}initLogin(t){return this.isBasicAuthentication||!t?Promise.resolve(!0):this.requestLogin().catch(e=>(e instanceof H&&(this.isBasicAuthentication=!0),Promise.resolve({})))}login(t,e){switch(this.authenticationType){case"PAC4J_FORM":return this.doFormLogin(t,e);case"PAC4J_BASIC":return this.doBasicAuthentication(t,e);case"PAC4J_INDIRECT":return Promise.resolve();default:return this.doJaasAuthentication(t,e)}}getFormLoginUrl(){switch(this.authenticationType){case"PAC4J_BASIC":return`${l()}${T("DirectBasicAuthClient")}`;case"PAC4J_FORM":return`${l()}${T("FormClient")}`;case"PAC4J_INDIRECT":return"";default:return`${l()}/j_security_check`}}getFormLoginData(t,e){let i=encodeURIComponent(t),r=encodeURIComponent(e);switch(this.authenticationType){case"PAC4J_BASIC":case"PAC4J_FORM":return`${F()}=${i}&${O()}=${r}`;case"JAAS":return`j_username=${i}&j_password=${r}`;default:return""}}doFormLogin(t,e){return h({url:this.getFormLoginUrl(),method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},data:this.getFormLoginData(t,e)})}doBasicAuthentication(t,e){return p.addItem("basic",btoa(`${t}:${e}`)),this.requestLogin()}doJaasAuthentication(t,e){return this.initLogin(!0).then(()=>this.isBasicAuthentication?(p.removeItem("basic-ok"),this.doBasicAuthentication(t,e).then(()=>{p.addItem("basic-ok",!0)})):this.doFormLogin(t,e))}getLogoutUrl(){let t=P();return!t||t==="JAAS"?`${l()}/Logoff`:`${l()}${k()}`}redirectToLogout(t){p.clear();let e=window.location.origin,i=t?.startsWith("http")?t:`${e}${l()}`;window.location.assign(this.getLogoutUrl()+"?url="+i)}logout(){return h({url:this.getLogoutUrl()}).then(t=>(p.clear(),t))}};var at=class{_tokenId;_image;_origin="";_contextPath=d();CaptchaRequest(t){this._origin=t?.origin||"",this._contextPath=t?.contextPath||d()}captchaResponse(t){return this._tokenId="tokenId"in t?t.tokenId:this._tokenId,this._image="image"in t?t.image:this._image,{tokenId:this._tokenId,image:this._image,valid:"valid"in t?t.valid:!1,error:"error"in t?t.error:null}}init(){return g({url:S(this._contextPath,this._origin)}).then(t=>this.captchaResponse(t))}send(t){return g({url:S(this._contextPath,this._origin),method:"POST",data:{tokenId:this._tokenId??"",answer:t??""}}).then(e=>this.captchaResponse(e)).catch(e=>this.captchaResponse(e.response))}refresh(){return this.init()}};var f=class o extends Error{response;href;constructor(t,e,i){super(t),Object.setPrototypeOf(this,o.prototype),this.response=e,this.href=i,"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(t).stack}get resource(){return this.href}};var lt=E(D(),1);var b=[{name:"Application",isMatch:({resourcetype:o})=>o==="Application",Model:z},{name:"Tab",isMatch:({resourcetype:o})=>o.endsWith("Tab")||o.endsWith("KnowledgeBank"),Model:rt},{name:"ListDetail",isMatch:({resourcetype:o})=>{let t=o.toLowerCase();return t.endsWith("listdetail")||t.endsWith("listpaneldetail")||t.endsWith("datastorepaneldetail")},Model:X},{name:"List",isMatch:({resourcetype:o})=>o.endsWith("List")||o.endsWith("ListPanel")||o.endsWith("RelatedDataStorePanel")||o.endsWith("RelatedDatastorePanel")||["list-related-cases","RecordPanel","EventHistoryPanel","NotePanel","AppointmentPanel","DocumentPanel","AssignmentPanel"].includes(o),Model:Z},{name:"GroupingPanel",isMatch:({resourcetype:o})=>["GroupingPanel","CaseTabGroupingPanel","TabGroupingPanel"].includes(o),Model:ot},{name:"CaseSearch",isMatch:({resourcetype:o})=>o==="CaseSearch",Model:it},{name:"CaseView",isMatch:({resourcetype:o})=>o==="CaseView",Model:W},{name:"Detail",isMatch:({resourcetype:o})=>o.endsWith("DetailPanel")||["Detail","CasePropertiesPanel","CasePropertiesPanelDetail"].includes(o),Model:V},{name:"TaskGroup",isMatch:({resourcetype:o})=>o==="TaskGroup",Model:G},{name:"Form",isMatch:({resourcetype:o})=>o==="Form",Model:u},{name:"User",isMatch:({resourcetype:o})=>o==="userdata",Model:j},{name:"UserProfile",isMatch:({resourcetype:o})=>o==="userdata",Model:nt},{name:"UserServices",isMatch:({resourcetype:o})=>o==="user_services",Model:B},{name:"ModelCatalog",isMatch:({resourcetype:o})=>o==="ModelCatalog",Model:et},{name:"ConceptIndex",isMatch:({resourcetype:o})=>o==="ConceptSearch"||o.toLowerCase()==="relatedconcepts",Model:Y},{name:"ConceptDetail",isMatch:({resourcetype:o})=>o==="ConceptDetail",Model:J},{name:"ConceptTypeDetail",isMatch:({resourcetype:o})=>o==="ConceptTypeDetail",Model:N},{name:"ContentIndex",isMatch:({resourcetype:o})=>o==="ContentSearch",Model:Q},{name:"ContentTOC",isMatch:({resourcetype:o})=>o==="ContentTOC",Model:K},{name:"Content",isMatch:({resourcetype:o})=>o==="ContentDetail",Model:M},{name:"ContentType",isMatch:({resourcetype:o})=>o==="ContentTypeDetail",Model:$},{name:"LookupOptions",isMatch:({resourcetype:o})=>o==="lookupOptions",Model:tt}];var C=class{static resolve(t,e,i=!1){if(!t)throw new a("No data or contribution available, cannot resolve model");if(!(0,lt.has)(t.contributions,"resourcetype"))throw new a(`Contributions has wrong format, missing resourcetype property in contributions of ${t.requestHref?.toString()}`);if(e){let n=Array.isArray(e)?e:[e];return n.length===1||i?n[0]:b.find(s=>s.isMatch(t)&&n.includes(s.Model))?.Model}return b.find(n=>n.isMatch(t))?.Model}};var ct=E(D(),1);import dt from"deepmerge";import{klona as pt}from"klona/full";var ht=class o{_response=new w;_href;_options;_targetModel;_forceTargetModel=!1;_contributionsHref;_locale="en";_method="GET";_progressEvent;_origin="";_contextPath=d();_layoutHintProcessor;constructor(t,e={}){if(!t)throw new a("You must pass a href to the resource that is requested");this._href=typeof t=="string"?new U(t):t,this._options=e,this._layoutHintProcessor=new L(this._origin,this._contextPath,this.options),this._response=new w,this._response.requestHref=this.href,this.locale=this.getRequestLocale(e.locale),this._response.parameters=this.href.parameters.all,this.contextPath=e.contextPath||this.href.contextPath,this.origin=e.origin||this.href.origin,this._targetModel=e.targetModel,this.method=e.method||this.href.method}getRequestLocale(t){return t||typeof navigator<"u"&&navigator?.language&&navigator.language.split("-")[0]||"en"}get origin(){return this._origin}set origin(t){this._origin=t??"",this._response.origin=t??"",this._layoutHintProcessor.setOrigin(this._origin)}get contextPath(){return this._contextPath}set contextPath(t){let e=t??d();this._contextPath=e,this._response.contextPath=e,this._layoutHintProcessor.setContextPath(e)}get contributionsHref(){return this._contributionsHref}set contributionsHref(t){this._contributionsHref=t}set locale(t){this._locale=t,this._response.locale=t,this._layoutHintProcessor.setRequestOptions(this.options)}get locale(){return this._locale}get response(){return this._response}set href(t){this._href=t}get href(){return this._href}set method(t){this._method=t}get method(){return this._method}get options(){return{...this._options,locale:this.locale,method:this.method}}set options(t){this._options=t,this._layoutHintProcessor.setRequestOptions(t)}get requestOptions(){let{targetModel:t,forceTargetModel:e,updateHandler:i,childmodels:r,isValidationRequest:n,removeOnUnmount:c,...s}=this.options;return s}get withChildModels(){return!("childmodels"in this.options)||this.options.childmodels===!0}set targetModel(t){this._targetModel=t}get targetModel(){return this._targetModel}set forceTargetModel(t){this._forceTargetModel=t??!1}get forceTargetModel(){return this._forceTargetModel}resolveModel(){let t=C.resolve(this.response,this.targetModel,this.forceTargetModel);if(t)return t;let e=this.href.toString(),i=this.response?.resourcetype||"unknown";if(this.targetModel){let r=Array.isArray(this.targetModel)?this.targetModel.map(n=>n.type||n.name).join(", "):this.targetModel.type||this.targetModel.name;throw new m(`Cannot find a matching model for URL: '${e}', resourcetype: '${i}'. Available overrides: [${r}]`)}throw new m(`No JavaScript model is applicable for the request to ${e}. Response resourcetype: '${i}'.`)}createModel(){let t=this.resolveModel();return new t(this.response)}processContributionsService(t){if(!(0,ct.isPlainObject)(t))throw new a("Missing contributions data or contributions is not JSON");if(typeof t=="object"&&t!=null){let e=t,[i]=Object.keys(e),r=e[i];i==="error"&&this.handleContributionsError(r),typeof r=="object"&&r!=null&&(this.response.key in r||(this.response.key=i),this.response.contributions=r)}}handleContributionsError(t){let e=t.properties?.message??"Error in contribution";throw new f(e,t,this.contributionsHref)}handleDataError(t){if(typeof t=="object"&&t.properties){let e=t.properties?.message??"Error in data";throw new f(e,t,this.href.absolutepath.toString())}throw new a(JSON.stringify(t))}handleData(t,e){this.response.key=t,this.response.data=e;let i=e?._links;if(!i)throw new a(`No _links object found in the data of ${this.href.toString()}`);if(i?.contributions)this.contributionsHref=i.contributions.href;else if(Array.isArray(i)&&i[0].contributions)this.contributionsHref=i[0].contributions.href;else throw new a(`Contributions link not found for data with key ${t}`)}processDataService(t){if(typeof t!="object"||t===null)throw new a("Missing data or data is not JSON");let e=t,[i]=Object.keys(e),r=e[i];if(i==="error")this.handleDataError(r);else{let[n]=Object.keys(t);this.handleData(n,r)}}fetchContributionsService(){if(!this.contributionsHref)throw new m("Missing a contributions href");return h({url:`${this.origin}${this.contextPath}${this.contributionsHref}`,cache:!0,locale:this.options.locale})}fetchDataService(){return h({...this.requestOptions,url:`${this.origin}${this.contextPath}${this.href.path}`,params:this.href.getQuerystringForModularUI(),locale:this.options.locale,onProgress:this.onProgress})}set onProgress(t){this._progressEvent=t}get onProgress(){return this._progressEvent}getDynamicValidationData(t){let e=typeof this.options.data=="string"?JSON.parse(this.options.data):this.options.data;if(t instanceof u){let i=JSON.parse(t.validationData);return JSON.stringify(dt(e||{},i))}return JSON.stringify(e)??"{}"}async loadDynamicValidations(t){if(!this.options.isValidationRequest&&y("USE_INSTANT_SERVER_VALIDATION")&&t instanceof u&&t.currentFormObject?.hasDynamicValidations){let e=this.href.setParameter("commit","false"),i=await h({...this.requestOptions,url:`${this.origin}${this.contextPath}${this.href.path}`,params:e.getQuerystringForModularUI(),data:this.getDynamicValidationData(t)});if(i==null||typeof i!="object")return t;let r=i,[n]=Object.keys(r);return t.updateValidations(r[n])}return t}fetchFromCache(){return this.options={...this.options,cache:!0},this.fetch()}fetchChildModels(t){let i=t.getInitialChildModelLinks().map(r=>{let n=new o(r.href,{locale:this.locale});return r.targetModel&&(n.targetModel=r.targetModel),r.isCacheable?n.fetchFromCache():n.fetch()});return Promise.allSettled(i).then(r=>{let n=[],c=[];return r.forEach(s=>{if(s.status==="rejected"){let{reason:_}=s;_.name!=="Error.ChangePasswordRequired"&&console.debug("Unexpected error when retrieving child model:",_),c.push(new v(_,"",{origin:this.origin,contextPath:this.contextPath}))}else n.push(s.value)}),t instanceof I&&t.addChildModels(n,c),t})}async fetchContent(t){let e=await this.fetchFromCache();return t&&e instanceof M&&e.childSectionLinks.length>0?this.fetchContentChildSections(e):e}async fetchContentChildSections(t){let e=pt(t),i=await Promise.all(t.childSectionLinks.map(r=>{let n=r.selfhref.addParameter(A,t.entryDate);return new o(n,{locale:this.locale}).fetchContent(!0)}));return e.childSections=i.filter(r=>r instanceof q),e}async fetch(){let t=await this.fetchDataService();if(t==null)throw new Error(`No data received for ${this.href.toString()}`);this.processDataService(t);let e=await this.fetchContributionsService();if(e==null)throw new Error(`No contributions data received for ${this.contributionsHref}`);this.processContributionsService(e),await this._layoutHintProcessor.processAsyncLayoutHints(this.response);let i=this.createModel(),r=await this.loadDynamicValidations(i);return this.withChildModels?await this.fetchChildModels(r):r}post(t){return this.method="POST",this.options={...this.options,data:t},this.fetch()}postForm(t){return this.method="POST",this.options={...this.options,data:t.formdata},this.fetch().then(e=>e instanceof u?t.update(e):t)}fetchSync(){let t={headers:{"Accept-Language":this.locale}},e=dataFetcher.fetch(this.href.toString(),t);if(e==null)throw new Error(`No data received for ${this.href.toString()}`);if(this.processDataService(JSON.parse(e)),this.contributionsHref==null)throw new Error(`No constributions received for ${this.href.toString()}`);let i=dataFetcher.fetch(this.contributionsHref.toString(),t);if(i==null)throw new Error(`No constributions received for ${this.contributionsHref.toString()}`);this.processContributionsService(JSON.parse(i));let r=this.createModel(),c=r.getInitialChildModelLinks().map(s=>new o(s.href,{locale:this.locale}).fetchSync());return r instanceof I&&r.addChildModels(c,[]),r}};export{st as a,at as b,f as c,C as d,ht as e};
2
+ //# sourceMappingURL=chunk-5BR5HMNQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/modularui/Authenticate.ts","../src/modularui/CaptchaRequest.ts","../src/modularui/ModularUIError.ts","../src/modularui/ModelResolver.ts","../src/modularui/ModelRegistry.ts","../src/modularui/ModularUIRequest.ts"],"sourcesContent":["import { HTTP_METHODS, INTERNAL_LOGIN_TYPE } from \"../constants/Constants\";\nimport { UnauthorizedException } from \"../exceptions/UnauthorizedException\";\nimport { getContextPath } from \"../settings/Paths\";\nimport {\n loginPasswordField,\n loginPath,\n loginType,\n loginUsernameField,\n logoutPath,\n} from \"../settings/Settings\";\nimport { universalFetch } from \"../utils/fetch/universalFetch\";\nimport { Cache } from \"../utils/storage/Cache\";\n\nexport class Authenticate {\n private _isBasicAuthentication: boolean;\n private _authenticationType: INTERNAL_LOGIN_TYPE;\n\n constructor() {\n this._isBasicAuthentication = false;\n this._authenticationType = this.getAuthenticationType();\n }\n\n getAuthenticationType() {\n const type = loginType();\n\n const enumType =\n INTERNAL_LOGIN_TYPE[type as keyof typeof INTERNAL_LOGIN_TYPE];\n\n if (!enumType || enumType === INTERNAL_LOGIN_TYPE.JAAS) {\n return INTERNAL_LOGIN_TYPE.JAAS;\n }\n\n if (\n enumType === INTERNAL_LOGIN_TYPE.PAC4J_FORM ||\n type.includes(\"FormClient\")\n ) {\n return INTERNAL_LOGIN_TYPE.PAC4J_FORM;\n } else if (\n enumType === INTERNAL_LOGIN_TYPE.PAC4J_BASIC ||\n type.includes(\"IndirectBasicClient\")\n ) {\n return INTERNAL_LOGIN_TYPE.PAC4J_BASIC;\n }\n\n return INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT;\n }\n\n get authenticationType() {\n return this._authenticationType;\n }\n\n set authenticationType(authenticationType: INTERNAL_LOGIN_TYPE) {\n this._authenticationType = authenticationType;\n }\n\n get isBasicAuthentication() {\n return (\n this._isBasicAuthentication ||\n this.authenticationType === INTERNAL_LOGIN_TYPE.PAC4J_BASIC\n );\n }\n\n set isBasicAuthentication(isBasicAuthentication: boolean) {\n this._isBasicAuthentication = isBasicAuthentication;\n }\n\n requestLogin() {\n return universalFetch({\n url: `${getContextPath()}/login`,\n method: HTTP_METHODS.GET,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n });\n }\n\n initLogin(initLogin: boolean) {\n if (this.isBasicAuthentication || !initLogin) {\n return Promise.resolve(true);\n }\n\n return this.requestLogin().catch((error) => {\n // when an unauthorizedexception is received on a request to the login service,\n // this indicates a basic authorization scenario\n // in case of form based authentication other exceptions are thrown\n if (error instanceof UnauthorizedException) {\n this.isBasicAuthentication = true;\n }\n\n return Promise.resolve({});\n });\n }\n\n login(username: string, password: string) {\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return this.doFormLogin(username, password);\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n return this.doBasicAuthentication(username, password);\n case INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT:\n // pac4j should handle this\n return Promise.resolve();\n default:\n return this.doJaasAuthentication(username, password);\n }\n }\n\n getFormLoginUrl() {\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n return `${getContextPath()}${loginPath(\"DirectBasicAuthClient\")}`;\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return `${getContextPath()}${loginPath(\"FormClient\")}`;\n case INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT:\n //pac4j should handle this\n return \"\";\n default:\n return `${getContextPath()}/j_security_check`;\n }\n }\n\n getFormLoginData(username: string, password: string) {\n const encodedUsername = encodeURIComponent(username);\n const encodedPassword = encodeURIComponent(password);\n\n switch (this.authenticationType) {\n case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:\n case INTERNAL_LOGIN_TYPE.PAC4J_FORM:\n return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;\n case INTERNAL_LOGIN_TYPE.JAAS:\n return `j_username=${encodedUsername}&j_password=${encodedPassword}`;\n default:\n return \"\";\n }\n }\n\n doFormLogin(username: string, password: string) {\n return universalFetch({\n url: this.getFormLoginUrl(),\n method: HTTP_METHODS.POST,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n data: this.getFormLoginData(username, password),\n });\n }\n\n doBasicAuthentication(username: string, password: string) {\n Cache.addItem(\"basic\", btoa(`${username}:${password}`));\n return this.requestLogin();\n }\n\n doJaasAuthentication(username: string, password: string) {\n return this.initLogin(true).then(() => {\n if (this.isBasicAuthentication) {\n Cache.removeItem(\"basic-ok\");\n return this.doBasicAuthentication(username, password).then(() => {\n Cache.addItem(\"basic-ok\", true);\n });\n }\n return this.doFormLogin(username, password);\n });\n }\n\n getLogoutUrl() {\n const type = loginType();\n\n if (!type || type === INTERNAL_LOGIN_TYPE.JAAS) {\n return `${getContextPath()}/Logoff`;\n }\n\n return `${getContextPath()}${logoutPath()}`;\n }\n\n /**\n * Browser redirect to the logout url. (no xmlhttp)\n */\n redirectToLogout(postRedirectUrl?: string) {\n Cache.clear();\n\n const origin = window.location.origin;\n const redirectUrl = postRedirectUrl?.startsWith(\"http\")\n ? postRedirectUrl\n : `${origin}${getContextPath()}`;\n\n window.location.assign(this.getLogoutUrl() + \"?url=\" + redirectUrl);\n }\n\n /**\n * Logout the user with xmlhttp\n */\n logout() {\n return universalFetch({\n url: this.getLogoutUrl(),\n }).then((response) => {\n // clear cache because of cached contributions\n Cache.clear();\n return response;\n });\n }\n}\n","import { HTTP_METHODS } from \"../constants/Constants\";\nimport { getCaptchaPath, getContextPathModularUI } from \"../settings/Paths\";\nimport { xhr } from \"../utils/fetch/xhr\";\n\ninterface CaptchaInitialResponse {\n tokenId: string;\n image: string;\n}\n\ninterface CaptchaValidResponse {\n valid: boolean;\n}\n\ninterface CaptchaInvalidResponse {\n tokenId: string;\n image: string;\n valid: boolean;\n error: { id: string };\n}\n\ntype PossibleCaptchaResponse =\n | CaptchaInitialResponse\n | CaptchaValidResponse\n | CaptchaInvalidResponse;\n\ninterface CaptchaRequestOptions {\n origin?: string;\n contextPath?: string;\n}\n\nexport class CaptchaRequest {\n private _tokenId: string | undefined;\n private _image: string | undefined;\n private _origin = \"\";\n private _contextPath: string = getContextPathModularUI();\n\n CaptchaRequest(options?: CaptchaRequestOptions) {\n this._origin = options?.origin || \"\";\n this._contextPath = options?.contextPath || getContextPathModularUI();\n }\n\n captchaResponse(response: PossibleCaptchaResponse) {\n this._tokenId = \"tokenId\" in response ? response.tokenId : this._tokenId;\n this._image = \"image\" in response ? response.image : this._image;\n\n return {\n tokenId: this._tokenId,\n image: this._image,\n valid: \"valid\" in response ? response.valid : false,\n error: \"error\" in response ? response.error : null,\n };\n }\n\n /**\n * Initiate the captcha request\n */\n init() {\n return xhr<CaptchaInitialResponse>({\n url: getCaptchaPath(this._contextPath, this._origin),\n }).then((response) => this.captchaResponse(response));\n }\n\n /**\n * Answer the captcha\n */\n send(answer?: string) {\n return xhr<CaptchaValidResponse | CaptchaInvalidResponse>({\n url: getCaptchaPath(this._contextPath, this._origin),\n method: HTTP_METHODS.POST,\n data: {\n tokenId: this._tokenId ?? \"\",\n answer: answer ?? \"\",\n },\n })\n .then((response) => this.captchaResponse(response))\n .catch((error) => this.captchaResponse(error.response));\n }\n\n /**\n * Reset the captcha and receive a new token and image\n */\n refresh() {\n return this.init();\n }\n}\n\nexport default CaptchaRequest;\n","import type { Href } from \"../models/href/Href\";\n\nexport class ModularUIError extends Error {\n response: object;\n href: Href | string | undefined;\n\n constructor(message: string, response: object, href?: string | Href) {\n super(message);\n\n Object.setPrototypeOf(this, ModularUIError.prototype);\n\n this.response = response;\n this.href = href;\n\n if (\n \"captureStackTrace\" in Error &&\n typeof Error.captureStackTrace === \"function\"\n ) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = new Error(message).stack;\n }\n }\n\n get resource() {\n return this.href;\n }\n}\n","import { has } from \"lodash\";\n\nimport { IllegalArgumentException } from \"../exceptions/IllegalArgumentException\";\n\nimport { MODEL_REGISTRY } from \"./ModelRegistry\";\n\nimport type { ModularUIResponse } from \"./ModularUIResponse\";\nimport type { TargetModel } from \"./types\";\n\n/**\n * Utility to determine which JavaScript Model class should be instantiated\n * based on a Modular UI response.\n */\nexport class ModelResolver {\n /**\n * Resolves a response to a specific Model constructor.\n * The resolution order is:\n * 1. If a single override is provided, it is returned immediately (forced).\n * 2. If multiple overrides are provided, it returns the first one that matches the response.\n * 3. If no overrides match or are provided, it searches the global `MODEL_REGISTRY`.\n *\n * @param response - The Modular UI response object containing data and contributions.\n * @param overrides - Optional class or array of classes to prefer over the global registry.\n * @param forceTargetModel - Force the first model from the overrides array to be returned.\n *\n * @throws {IllegalArgumentException} If the response is missing or the contributions\n * lack a `resourcetype` property.\n *\n * @returns The matching Model constructor, or `undefined` if no match is found.\n *\n * @example\n * const resolver = new ModelResolver();\n * const Model = resolver.resolve(response, [FormModel, TaskModel]);\n */\n static resolve(\n response: ModularUIResponse,\n overrides?: TargetModel | TargetModel[],\n forceTargetModel = false,\n ) {\n if (!response) {\n throw new IllegalArgumentException(\n `No data or contribution available, cannot resolve model`,\n );\n }\n\n if (!has(response.contributions, \"resourcetype\")) {\n throw new IllegalArgumentException(\n `Contributions has wrong format, missing resourcetype property in contributions of ${response.requestHref?.toString()}`,\n );\n }\n\n if (overrides) {\n const overrideList = Array.isArray(overrides) ? overrides : [overrides];\n\n if (overrideList.length === 1 || forceTargetModel) {\n return overrideList[0];\n }\n\n const overrideMatch = MODEL_REGISTRY.find(\n (config) =>\n config.isMatch(response) && overrideList.includes(config.Model),\n );\n\n return overrideMatch?.Model;\n }\n\n const match = MODEL_REGISTRY.find((config) => config.isMatch(response));\n\n return match?.Model;\n }\n}\n","import { ApplicationModel } from \"../models/application/ApplicationModel\";\nimport { CaseViewModel } from \"../models/caseview/CaseViewModel\";\nimport { ConceptDetailModel } from \"../models/concepts/ConceptDetailModel\";\nimport { ConceptIndexModel } from \"../models/concepts/ConceptIndexModel\";\nimport { ConceptTypeDetailModel } from \"../models/concepts/ConceptTypeDetailModel\";\nimport { ContentIndexModel } from \"../models/content/ContentIndexModel\";\nimport { ContentModel } from \"../models/content/ContentModel\";\nimport { ContentTOCModel } from \"../models/content/ContentTOCModel\";\nimport { ContentTypeModel } from \"../models/content/ContentTypeModel\";\nimport { DetailModel } from \"../models/detail/DetailModel\";\nimport { FormModel } from \"../models/form/FormModel\";\nimport { ListDetailModel } from \"../models/list/detail/ListDetailModel\";\nimport { ListModel } from \"../models/list/ListModel\";\nimport { LookupOptionsModel } from \"../models/lookup/LookupOptionsModel\";\nimport { ModelCatalogModel } from \"../models/modelcatalog/ModelCatalogModel\";\nimport { GroupingPanelModel } from \"../models/panels/GroupingPanelModel\";\nimport { CaseSearchModel } from \"../models/search/CaseSearchModel\";\nimport { TabModel } from \"../models/tab/TabModel\";\nimport { TaskGroupModel } from \"../models/taskgroup/TaskGroupModel\";\nimport { UserModel } from \"../models/user/UserModel\";\nimport { UserProfileModel } from \"../models/user/UserProfileModel\";\nimport { UserServicesModel } from \"../models/user/UserServicesModel\";\n\nimport type { ModelConfig } from \"./types\";\n\nexport const MODEL_REGISTRY: ModelConfig[] = [\n {\n name: \"Application\",\n isMatch: ({ resourcetype }) => resourcetype === \"Application\",\n Model: ApplicationModel,\n },\n {\n name: \"Tab\",\n isMatch: ({ resourcetype }) =>\n resourcetype.endsWith(\"Tab\") || resourcetype.endsWith(\"KnowledgeBank\"),\n Model: TabModel,\n },\n {\n name: \"ListDetail\",\n isMatch: ({ resourcetype }) => {\n const normalized = resourcetype.toLowerCase();\n return (\n normalized.endsWith(\"listdetail\") ||\n normalized.endsWith(\"listpaneldetail\") ||\n normalized.endsWith(\"datastorepaneldetail\")\n );\n },\n Model: ListDetailModel,\n },\n {\n name: \"List\",\n isMatch: ({ resourcetype }) =>\n resourcetype.endsWith(\"List\") ||\n resourcetype.endsWith(\"ListPanel\") ||\n resourcetype.endsWith(\"RelatedDataStorePanel\") ||\n resourcetype.endsWith(\"RelatedDatastorePanel\") ||\n [\n \"list-related-cases\",\n \"RecordPanel\",\n \"EventHistoryPanel\",\n \"NotePanel\",\n \"AppointmentPanel\",\n \"DocumentPanel\",\n \"AssignmentPanel\",\n ].includes(resourcetype),\n Model: ListModel,\n },\n {\n name: \"GroupingPanel\",\n isMatch: ({ resourcetype }) =>\n [\"GroupingPanel\", \"CaseTabGroupingPanel\", \"TabGroupingPanel\"].includes(\n resourcetype,\n ),\n Model: GroupingPanelModel,\n },\n {\n name: \"CaseSearch\",\n isMatch: ({ resourcetype }) => resourcetype === \"CaseSearch\",\n Model: CaseSearchModel,\n },\n {\n name: \"CaseView\",\n isMatch: ({ resourcetype }) => resourcetype === \"CaseView\",\n Model: CaseViewModel,\n },\n {\n name: \"Detail\",\n isMatch: ({ resourcetype }) =>\n resourcetype.endsWith(\"DetailPanel\") ||\n [\"Detail\", \"CasePropertiesPanel\", \"CasePropertiesPanelDetail\"].includes(\n resourcetype,\n ),\n Model: DetailModel,\n },\n {\n name: \"TaskGroup\",\n isMatch: ({ resourcetype }) => resourcetype === \"TaskGroup\",\n Model: TaskGroupModel,\n },\n {\n name: \"Form\",\n isMatch: ({ resourcetype }) => resourcetype === \"Form\",\n Model: FormModel,\n },\n {\n name: \"User\",\n isMatch: ({ resourcetype }) => resourcetype === \"userdata\",\n Model: UserModel,\n },\n {\n name: \"UserProfile\",\n isMatch: ({ resourcetype }) => resourcetype === \"userdata\",\n Model: UserProfileModel,\n },\n {\n name: \"UserServices\",\n isMatch: ({ resourcetype }) => resourcetype === \"user_services\",\n Model: UserServicesModel,\n },\n {\n name: \"ModelCatalog\",\n isMatch: ({ resourcetype }) => resourcetype === \"ModelCatalog\",\n Model: ModelCatalogModel,\n },\n {\n name: \"ConceptIndex\",\n isMatch: ({ resourcetype }) =>\n resourcetype === \"ConceptSearch\" ||\n resourcetype.toLowerCase() === \"relatedconcepts\",\n Model: ConceptIndexModel,\n },\n {\n name: \"ConceptDetail\",\n isMatch: ({ resourcetype }) => resourcetype === \"ConceptDetail\",\n Model: ConceptDetailModel,\n },\n {\n name: \"ConceptTypeDetail\",\n isMatch: ({ resourcetype }) => resourcetype === \"ConceptTypeDetail\",\n Model: ConceptTypeDetailModel,\n },\n {\n name: \"ContentIndex\",\n isMatch: ({ resourcetype }) => resourcetype === \"ContentSearch\",\n Model: ContentIndexModel,\n },\n {\n name: \"ContentTOC\",\n isMatch: ({ resourcetype }) => resourcetype === \"ContentTOC\",\n Model: ContentTOCModel,\n },\n {\n name: \"Content\",\n isMatch: ({ resourcetype }) => resourcetype === \"ContentDetail\",\n Model: ContentModel,\n },\n {\n name: \"ContentType\",\n isMatch: ({ resourcetype }) => resourcetype === \"ContentTypeDetail\",\n Model: ContentTypeModel,\n },\n {\n name: \"LookupOptions\",\n isMatch: ({ resourcetype }) => resourcetype === \"lookupOptions\",\n Model: LookupOptionsModel,\n },\n];\n","import deepmerge from \"deepmerge\";\nimport { klona } from \"klona/full\";\nimport { isPlainObject } from \"lodash\";\n\nimport { HTTP_METHODS, TIMEVERSION_FILTER_NAME } from \"../constants/Constants\";\nimport { IllegalArgumentException } from \"../exceptions/IllegalArgumentException\";\nimport { IllegalStateException } from \"../exceptions/IllegalStateException\";\nimport { LayoutHintProcessor } from \"../layouthints/LayoutHintProcessor\";\nimport { ResourceModel } from \"../models/base/ResourceModel\";\nimport { ContentModel } from \"../models/content/ContentModel\";\nimport { SectionModel } from \"../models/content/SectionModel\";\nimport { ErrorResponse } from \"../models/error/ErrorResponse\";\nimport { FormModel } from \"../models/form/FormModel\";\nimport { Href } from \"../models/href/Href\";\nimport { getContextPathModularUI } from \"../settings/Paths\";\nimport { getBooleanSetting } from \"../settings/Settings\";\nimport { universalFetch } from \"../utils/fetch/universalFetch\";\n\nimport { ModelResolver } from \"./ModelResolver\";\nimport { ModularUIError } from \"./ModularUIError\";\nimport { ModularUIResponse } from \"./ModularUIResponse\";\n\nimport type { FormData } from \"../models/form/types\";\nimport type {\n ModularUIModel,\n ModularUIModelWithChildModels,\n} from \"../models/types\";\nimport type { Contributions, Data, DefaultLinksData } from \"../types/types\";\nimport type {\n ModularUIRequestOptions,\n ProgressHandler,\n} from \"../utils/fetch/types\";\nimport type { ModularUISpecificErrorResponse, TargetModel } from \"./types\";\n\n/**\n * Helper for fetching data and contributions from the Be Informed modular ui\n * and merge it into a target or resolvable model.\n *\n * @example\n * const model = new ModularUIRequest(\"url-to-request\").fetch();\n * const post = new ModularUIRequest(\"url-to-request\", { method: \"POST\"}).fetch();\n */\nexport class ModularUIRequest {\n private _response: ModularUIResponse = new ModularUIResponse();\n\n private _href: Href;\n private _options: ModularUIRequestOptions;\n private _targetModel: TargetModel | TargetModel[] | undefined;\n private _forceTargetModel = false;\n private _contributionsHref: Href | string | undefined;\n private _locale = \"en\";\n private _method: HTTP_METHODS = HTTP_METHODS.GET;\n\n private _progressEvent: ProgressHandler | undefined;\n\n private _origin = \"\";\n private _contextPath: string = getContextPathModularUI();\n\n private _layoutHintProcessor: LayoutHintProcessor;\n\n constructor(href: Href | string, options: ModularUIRequestOptions = {}) {\n if (!href) {\n throw new IllegalArgumentException(\n \"You must pass a href to the resource that is requested\",\n );\n }\n\n this._href = typeof href === \"string\" ? new Href(href) : href;\n this._options = options;\n\n this._layoutHintProcessor = new LayoutHintProcessor(\n this._origin,\n this._contextPath,\n this.options,\n );\n\n this._response = new ModularUIResponse();\n this._response.requestHref = this.href;\n\n this.locale = this.getRequestLocale(options.locale);\n\n // copy request parameters to response, to be able to use them in the models\n // self links are missing the request parameters\n this._response.parameters = this.href.parameters.all;\n\n this.contextPath = options.contextPath || this.href.contextPath;\n this.origin = options.origin || this.href.origin;\n\n this._targetModel = options.targetModel;\n this.method = options.method || this.href.method;\n }\n\n /**\n * Retrieve the preferred language for this request, falls back to the browser language or english\n */\n getRequestLocale(optionLocale: string | undefined) {\n if (optionLocale) {\n return optionLocale;\n }\n\n if (typeof navigator !== \"undefined\" && navigator?.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n }\n\n get origin() {\n return this._origin;\n }\n\n set origin(origin: string | undefined) {\n this._origin = origin ?? \"\";\n this._response.origin = origin ?? \"\";\n this._layoutHintProcessor.setOrigin(this._origin);\n }\n\n get contextPath() {\n return this._contextPath;\n }\n\n set contextPath(contextPath: string | undefined) {\n const path = contextPath ?? getContextPathModularUI();\n this._contextPath = path;\n this._response.contextPath = path;\n this._layoutHintProcessor.setContextPath(path);\n }\n\n get contributionsHref() {\n return this._contributionsHref;\n }\n\n set contributionsHref(contributionsHref: string | Href | undefined) {\n this._contributionsHref = contributionsHref;\n }\n\n set locale(locale: string) {\n this._locale = locale;\n this._response.locale = locale;\n this._layoutHintProcessor.setRequestOptions(this.options);\n }\n\n get locale() {\n return this._locale;\n }\n\n get response() {\n return this._response;\n }\n\n set href(href: Href) {\n this._href = href;\n }\n\n get href() {\n return this._href;\n }\n\n set method(method: HTTP_METHODS) {\n this._method = method;\n }\n\n get method() {\n return this._method;\n }\n\n get options() {\n return {\n ...this._options,\n locale: this.locale,\n method: this.method,\n };\n }\n\n set options(options: ModularUIRequestOptions) {\n this._options = options;\n this._layoutHintProcessor.setRequestOptions(options);\n }\n\n get requestOptions() {\n const {\n targetModel,\n forceTargetModel,\n updateHandler,\n childmodels,\n isValidationRequest,\n removeOnUnmount,\n ...requestOptions\n } = this.options;\n\n return requestOptions;\n }\n\n get withChildModels() {\n return (\n !(\"childmodels\" in this.options) || this.options.childmodels === true\n );\n }\n\n set targetModel(targetModel: TargetModel | TargetModel[] | undefined) {\n this._targetModel = targetModel;\n }\n\n get targetModel() {\n return this._targetModel;\n }\n\n set forceTargetModel(forceTargetModel: boolean) {\n this._forceTargetModel = forceTargetModel ?? false;\n }\n\n get forceTargetModel() {\n return this._forceTargetModel;\n }\n\n /**\n * Resolves the appropriate Model class for the current response.\n * Uses the ModelResolver to check against targetModel overrides or the global registry.\n */\n private resolveModel(): TargetModel {\n const Model = ModelResolver.resolve(\n this.response,\n this.targetModel,\n this.forceTargetModel,\n );\n\n if (Model) {\n return Model;\n }\n\n const url = this.href.toString();\n const resourceType = this.response?.resourcetype || \"unknown\";\n\n if (this.targetModel) {\n const availableTypes = Array.isArray(this.targetModel)\n ? this.targetModel\n .map((m) => (m as unknown as ResourceModel).type || m.name)\n .join(\", \")\n : (this.targetModel as unknown as ResourceModel).type ||\n this.targetModel.name;\n\n throw new IllegalStateException(\n `Cannot find a matching model for URL: '${url}', resourcetype: '${resourceType}'. Available overrides: [${availableTypes}]`,\n );\n }\n\n throw new IllegalStateException(\n `No JavaScript model is applicable for the request to ${url}. Response resourcetype: '${resourceType}'.`,\n );\n }\n\n private createModel() {\n const Model = this.resolveModel();\n return new Model(this.response);\n }\n\n private processContributionsService(contributions: unknown) {\n if (!isPlainObject(contributions)) {\n throw new IllegalArgumentException(\n \"Missing contributions data or contributions is not JSON\",\n );\n }\n\n if (typeof contributions === \"object\" && contributions != null) {\n const record = contributions as Record<string, Contributions>;\n const [key] = Object.keys(record);\n const contributionsBody = record[key];\n if (key === \"error\") {\n this.handleContributionsError(contributionsBody);\n }\n if (typeof contributionsBody === \"object\" && contributionsBody != null) {\n // The key of the data service is different from the contributions service for forms\n if (!(this.response.key in contributionsBody)) {\n this.response.key = key;\n }\n\n this.response.contributions = contributionsBody;\n }\n }\n }\n\n private handleContributionsError(error: ModularUISpecificErrorResponse) {\n const errorMessage = error.properties?.message ?? \"Error in contribution\";\n throw new ModularUIError(errorMessage, error, this.contributionsHref);\n }\n\n private handleDataError(error: ModularUISpecificErrorResponse | string) {\n if (typeof error === \"object\" && error.properties) {\n const errorMessage = error.properties?.message ?? \"Error in data\";\n throw new ModularUIError(\n errorMessage,\n error,\n this.href.absolutepath.toString(),\n );\n }\n\n throw new IllegalArgumentException(JSON.stringify(error));\n }\n\n private handleData(key: string, data: Data | undefined) {\n this.response.key = key;\n this.response.data = data;\n\n const links = data?._links as DefaultLinksData | undefined;\n\n if (!links) {\n throw new IllegalArgumentException(\n `No _links object found in the data of ${this.href.toString()}`,\n );\n }\n\n if (links?.contributions) {\n this.contributionsHref = links.contributions.href;\n } else if (Array.isArray(links) && links[0].contributions) {\n this.contributionsHref = links[0].contributions.href;\n } else {\n throw new IllegalArgumentException(\n `Contributions link not found for data with key ${key}`,\n );\n }\n }\n\n private processDataService(data: unknown) {\n if (typeof data !== \"object\" || data === null) {\n throw new IllegalArgumentException(\"Missing data or data is not JSON\");\n }\n\n const record = data as Record<string, Data>;\n const [key] = Object.keys(record);\n const dataBody = record[key];\n\n if (key === \"error\") {\n this.handleDataError(dataBody);\n } else {\n const [key] = Object.keys(data);\n this.handleData(key, dataBody);\n }\n }\n\n private fetchContributionsService() {\n if (!this.contributionsHref) {\n throw new IllegalStateException(\"Missing a contributions href\");\n }\n\n return universalFetch({\n url: `${this.origin}${this.contextPath}${this.contributionsHref}`,\n cache: true,\n locale: this.options.locale,\n });\n }\n\n private fetchDataService() {\n return universalFetch({\n ...this.requestOptions,\n url: `${this.origin}${this.contextPath}${this.href.path}`,\n params: this.href.getQuerystringForModularUI(),\n locale: this.options.locale,\n onProgress: this.onProgress,\n });\n }\n\n set onProgress(progressEvent: ProgressHandler | undefined) {\n this._progressEvent = progressEvent;\n }\n\n get onProgress() {\n return this._progressEvent;\n }\n\n /**\n * Combine previous send request data with new validation data to create a complete request object\n * The received model is new FormModel containing ONLY the current question, not the previously entered questions\n * to create a complete request we append the originally send form objects\n */\n private getDynamicValidationData(model: ModularUIModel) {\n const prevData =\n typeof this.options.data === \"string\"\n ? JSON.parse(this.options.data)\n : this.options.data;\n\n if (model instanceof FormModel) {\n const newData = JSON.parse(model.validationData);\n return JSON.stringify(deepmerge(prevData || {}, newData));\n }\n\n return JSON.stringify(prevData) ?? \"{}\";\n }\n\n /**\n * First load of dynamic values when a form is loaded\n */\n private async loadDynamicValidations(model: ModularUIModel) {\n if (\n !this.options.isValidationRequest &&\n getBooleanSetting(\"USE_INSTANT_SERVER_VALIDATION\") &&\n model instanceof FormModel &&\n model.currentFormObject?.hasDynamicValidations\n ) {\n const validationHref = this.href.setParameter(\"commit\", \"false\");\n const data = await universalFetch({\n ...this.requestOptions,\n url: `${this.origin}${this.contextPath}${this.href.path}`,\n params: validationHref.getQuerystringForModularUI(),\n data: this.getDynamicValidationData(model),\n });\n\n if (data == null || typeof data !== \"object\") {\n return model;\n }\n\n const formResponse = data as Record<string, FormData>;\n const [key] = Object.keys(formResponse);\n return model.updateValidations(formResponse[key]);\n }\n\n return model;\n }\n\n private fetchFromCache() {\n this.options = {\n ...this.options,\n cache: true,\n };\n\n return this.fetch();\n }\n\n private fetchChildModels(model: ModularUIModel) {\n const childModelLinks = (\n model as ModularUIModelWithChildModels\n ).getInitialChildModelLinks();\n\n const childModelRequests: Promise<ModularUIModel>[] = childModelLinks.map(\n (childModelLink) => {\n const request = new ModularUIRequest(childModelLink.href, {\n locale: this.locale,\n });\n\n if (childModelLink.targetModel) {\n request.targetModel = childModelLink.targetModel;\n }\n\n if (childModelLink.isCacheable) {\n return request.fetchFromCache();\n }\n\n return request.fetch();\n },\n );\n\n return Promise.allSettled(childModelRequests).then((childModels) => {\n const resolvedChildModels: ModularUIModelWithChildModels[] = [];\n const errorChildModels: ErrorResponse[] = [];\n\n childModels.forEach((childModel) => {\n if (childModel.status === \"rejected\") {\n const { reason } = childModel;\n if (reason.name !== \"Error.ChangePasswordRequired\") {\n console.debug(\n \"Unexpected error when retrieving child model:\",\n reason,\n );\n }\n errorChildModels.push(\n new ErrorResponse(reason, \"\", {\n origin: this.origin,\n contextPath: this.contextPath,\n }),\n );\n } else {\n resolvedChildModels.push(\n childModel.value as ModularUIModelWithChildModels,\n );\n }\n });\n\n if (model instanceof ResourceModel) {\n model.addChildModels(resolvedChildModels, errorChildModels);\n }\n\n return model;\n });\n }\n\n async fetchContent(withChildSections: boolean) {\n const model = await this.fetchFromCache();\n if (\n withChildSections &&\n model instanceof ContentModel &&\n model.childSectionLinks.length > 0\n ) {\n return this.fetchContentChildSections(model);\n }\n return model;\n }\n\n /**\n * Recursively return child sections defined on the content model\n */\n async fetchContentChildSections(\n contentModel: ContentModel,\n ): Promise<ContentModel> {\n const newContentModel = klona(contentModel);\n\n const sectionModels = await Promise.all(\n contentModel.childSectionLinks.map((childSectionLink) => {\n const contentHrefWithEntryDate = childSectionLink.selfhref.addParameter(\n TIMEVERSION_FILTER_NAME,\n contentModel.entryDate,\n );\n\n const request = new ModularUIRequest(contentHrefWithEntryDate, {\n locale: this.locale,\n });\n\n return request.fetchContent(true);\n }),\n );\n newContentModel.childSections = sectionModels.filter(\n (sectionModel) => sectionModel instanceof SectionModel,\n );\n return newContentModel;\n }\n\n async fetch() {\n const data = await this.fetchDataService();\n if (data == null) {\n throw new Error(`No data received for ${this.href.toString()}`);\n }\n\n this.processDataService(data);\n\n const contributions = await this.fetchContributionsService();\n if (contributions == null) {\n throw new Error(\n `No contributions data received for ${this.contributionsHref}`,\n );\n }\n\n this.processContributionsService(contributions);\n\n await this._layoutHintProcessor.processAsyncLayoutHints(this.response);\n\n const model = this.createModel();\n\n const validatedModel = await this.loadDynamicValidations(model);\n if (this.withChildModels) {\n return await this.fetchChildModels(validatedModel);\n }\n return validatedModel;\n }\n\n /**\n * Make a post request with optionally data to send\n * @param data\n */\n post(data: string) {\n this.method = HTTP_METHODS.POST;\n this.options = {\n ...this.options,\n data,\n };\n\n return this.fetch();\n }\n\n /**\n * Make a POST request using the form, an updated form is returned (merge of old and new form)\n * @param form\n * @returns {Promise<FormModel>}\n */\n postForm(form: FormModel) {\n this.method = HTTP_METHODS.POST;\n this.options = {\n ...this.options,\n data: form.formdata,\n };\n\n return this.fetch().then((response) => {\n if (response instanceof FormModel) {\n return form.update(response);\n }\n return form;\n });\n }\n\n /**\n * Simplified synchronous version of fetch (returns the model, not a Promise)\n * This can be used on the server to retrieve a model. It only loads the request url and it's child models\n */\n fetchSync() {\n const options = { headers: { \"Accept-Language\": this.locale } };\n\n const dataString = dataFetcher.fetch(this.href.toString(), options);\n if (dataString == null) {\n throw new Error(`No data received for ${this.href.toString()}`);\n }\n\n this.processDataService(JSON.parse(dataString));\n\n if (this.contributionsHref == null) {\n throw new Error(`No constributions received for ${this.href.toString()}`);\n }\n\n const contributionsString = dataFetcher.fetch(\n this.contributionsHref.toString(),\n options,\n );\n if (contributionsString == null) {\n throw new Error(\n `No constributions received for ${this.contributionsHref.toString()}`,\n );\n }\n this.processContributionsService(JSON.parse(contributionsString));\n\n const model: ResourceModel = this.createModel();\n\n const childModelLinks = model.getInitialChildModelLinks();\n\n const childModels = childModelLinks.map((childModelLink) => {\n return new ModularUIRequest(childModelLink.href, {\n locale: this.locale,\n }).fetch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ACF,EAEO,KAAK,MAAM,CACpB,CAOA,SAASmC,EAAiB,CACxB,YAAK,OAAS,OACd,KAAK,QAAU,CACb,GAAG,KAAK,QACR,KAAMA,EAAK,QACb,EAEO,KAAK,MAAM,EAAE,KAAMC,GACpBA,aAAoB7B,EACf4B,EAAK,OAAOC,CAAQ,EAEtBD,CACR,CACH,CAMA,WAAY,CACV,IAAMnE,EAAU,CAAE,QAAS,CAAE,kBAAmB,KAAK,MAAO,CAAE,EAExDqE,EAAa,YAAY,MAAM,KAAK,KAAK,SAAS,EAAGrE,CAAO,EAClE,GAAIqE,GAAc,KAChB,MAAM,IAAI,MAAM,wBAAwB,KAAK,KAAK,SAAS,CAAC,EAAE,EAKhE,GAFA,KAAK,mBAAmB,KAAK,MAAMA,CAAU,CAAC,EAE1C,KAAK,mBAAqB,KAC5B,MAAM,IAAI,MAAM,kCAAkC,KAAK,KAAK,SAAS,CAAC,EAAE,EAG1E,IAAMC,EAAsB,YAAY,MACtC,KAAK,kBAAkB,SAAS,EAChCtE,CACF,EACA,GAAIsE,GAAuB,KACzB,MAAM,IAAI,MACR,kCAAkC,KAAK,kBAAkB,SAAS,CAAC,EACrE,EAEF,KAAK,4BAA4B,KAAK,MAAMA,CAAmB,CAAC,EAEhE,IAAMjC,EAAuB,KAAK,YAAY,EAIxCW,EAFkBX,EAAM,0BAA0B,EAEpB,IAAKS,GAChC,IAAIlD,EAAiBkD,EAAe,KAAM,CAC/C,OAAQ,KAAK,MACf,CAAC,EAAE,UAAU,CACd,EACD,OAAIT,aAAiBiB,GACnBjB,EAAM,eAAeW,EAAa,CAAC,CAAC,EAG/BX,CACT,CACF","names":["Authenticate","type","loginType","enumType","INTERNAL_LOGIN_TYPE","authenticationType","isBasicAuthentication","universalFetch","getContextPath","initLogin","error","UnauthorizedException","username","password","loginPath","encodedUsername","encodedPassword","loginUsernameField","loginPasswordField","cacheInstance","logoutPath","postRedirectUrl","origin","redirectUrl","response","CaptchaRequest","getContextPathModularUI","options","response","xhr","getCaptchaPath","answer","error","ModularUIError","_ModularUIError","message","response","href","import_lodash","MODEL_REGISTRY","resourcetype","ApplicationModel","TabModel","normalized","ListDetailModel","ListModel","GroupingPanelModel","CaseSearchModel","CaseViewModel","DetailModel","TaskGroupModel","FormModel","UserModel","UserProfileModel","UserServicesModel","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","ConceptTypeDetailModel","ContentIndexModel","ContentTOCModel","ContentModel","ContentTypeModel","LookupOptionsModel","ModelResolver","response","overrides","forceTargetModel","IllegalArgumentException","overrideList","MODEL_REGISTRY","config","import_lodash","deepmerge","klona","ModularUIRequest","_ModularUIRequest","ModularUIResponse","getContextPathModularUI","href","options","IllegalArgumentException","Href","LayoutHintProcessor","optionLocale","origin","contextPath","path","contributionsHref","locale","method","targetModel","forceTargetModel","updateHandler","childmodels","isValidationRequest","removeOnUnmount","requestOptions","Model","ModelResolver","url","resourceType","availableTypes","m","IllegalStateException","contributions","record","key","contributionsBody","error","errorMessage","ModularUIError","data","links","dataBody","universalFetch","progressEvent","model","prevData","FormModel","newData","deepmerge","getBooleanSetting","validationHref","formResponse","childModelRequests","childModelLink","request","childModels","resolvedChildModels","errorChildModels","childModel","reason","ErrorResponse","ResourceModel","withChildSections","ContentModel","contentModel","newContentModel","klona","sectionModels","childSectionLink","contentHrefWithEntryDate","TIMEVERSION_FILTER_NAME","sectionModel","SectionModel","validatedModel","form","response","dataString","contributionsString"]}
@@ -0,0 +1,2 @@
1
+ var _=Object.create;var S=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var y=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var m=(e,t,o,A)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of E(t))!x.call(e,r)&&r!==o&&S(e,r,{get:()=>t[r],enumerable:!(A=s(t,r))||A.enumerable});return e};var R=(e,t,o)=>(o=e!=null?_(M(e)):{},m(t||!e||!e.__esModule?S(o,"default",{value:e,enumerable:!0}):o,e));var p=typeof Graal<"u",C=p,c=(o=>(o.GET="GET",o.POST="POST",o))(c||{}),O=(o=>(o.BODY="bodyParameter",o.QUERY="queryParameter",o))(O||{}),T="~",u="entryDate",I="yyyy-MM-dd",l="yyyy-MM-dd'T'HH:mm:ss",L="HH:mm:ss",d="yyyy-MM-dd'T'HH:mm:ss.SSS",G="xxx",J=1,P=1,F=(n=>(n.EXTRA_SMALL="EXTRA_SMALL",n.SMALL="SMALL",n.MEDIUM="MEDIUM",n.LARGE="LARGE",n.EXTRA_LARGE="EXTRA_LARGE",n))(F||{}),a=(r=>(r.JAAS="JAAS",r.PAC4J_FORM="PAC4J_FORM",r.PAC4J_BASIC="PAC4J_BASIC",r.PAC4J_INDIRECT="PAC4J_INDIRECT",r))(a||{}),D="security.clients",N="FormClient.login_url",f="FormClient.username_field_name",U="FormClient.password_field_name",X="FormClient.logout_url",b={name:"Form based authentication",authentication:"DefaultFormClient",isPrimary:!0};export{y as a,R as b,p as c,C as d,c as e,O as f,T as g,u as h,I as i,l as j,L as k,d as l,G as m,J as n,P as o,F as p,a as q,D as r,N as s,f as t,U as u,X as v,b as w};
2
+ //# sourceMappingURL=chunk-6GV6KLAV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants/Constants.ts"],"sourcesContent":["export const IS_GRAALJS = typeof Graal !== \"undefined\";\nexport const IS_SERVER = IS_GRAALJS;\n\nexport enum HTTP_METHODS {\n GET = \"GET\",\n POST = \"POST\",\n}\n\nexport enum PARAMETER_TYPES {\n BODY = \"bodyParameter\",\n QUERY = \"queryParameter\",\n}\n\n/**\n * Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment\n */\nexport const PARAMETER_SEPARATOR = \"~\";\n\n/**\n * Timeversion filter name\n */\nexport const TIMEVERSION_FILTER_NAME = \"entryDate\";\n\nexport const ISO_DATE_FORMAT = \"yyyy-MM-dd\";\nexport const ISO_DATETIME_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss\";\nexport const ISO_TIME_FORMAT = \"HH:mm:ss\";\nexport const ISO_TIMESTAMP_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss.SSS\";\n\n/**\n * Offset format is appended to iso datetime and timestamp when isIncludeTimeOffsetInDateTimes = true\n */\nexport const DATETIME_OFFSET_FORMAT = \"xxx\";\n\n/**\n * week starts on monday by default\n */\nexport const DEFAULT_WEEK_STARTS_ON = 1;\n\n/**\n * first week indicated by the 1st of january\n */\nexport const DEFAULT_FIRST_WEEK_CONTAINS_DATE = 1;\n\n/**\n * ATTRIBUTE WIDTH\n */\nexport enum ATTRIBUTE_WIDTH {\n EXTRA_SMALL = \"EXTRA_SMALL\",\n SMALL = \"SMALL\",\n MEDIUM = \"MEDIUM\",\n LARGE = \"LARGE\",\n EXTRA_LARGE = \"EXTRA_LARGE\",\n}\n\nexport enum INTERNAL_LOGIN_TYPE {\n JAAS = \"JAAS\",\n PAC4J_FORM = \"PAC4J_FORM\",\n PAC4J_BASIC = \"PAC4J_BASIC\",\n PAC4J_INDIRECT = \"PAC4J_INDIRECT\",\n}\n\nexport const LOGIN_TYPE = \"security.clients\";\nexport const LOGIN_PATH_SETTING = \"FormClient.login_url\";\nexport const LOGIN_USERNAME_SETTING = \"FormClient.username_field_name\";\nexport const LOGIN_PASSWORD_SETTING = \"FormClient.password_field_name\";\nexport const LOGOUT_PATH_SETTING = \"FormClient.logout_url\";\n\nexport const DEFAULT_AUTHENTICATION_TYPE = {\n name: \"Form based authentication\",\n authentication: \"DefaultFormClient\",\n isPrimary: true,\n};\n"],"mappings":"ygBAAO,IAAMA,EAAa,OAAO,MAAU,IAC9BC,EAAYD,EAEbE,OACVA,EAAA,IAAM,MACNA,EAAA,KAAO,OAFGA,OAAA,IAKAC,OACVA,EAAA,KAAO,gBACPA,EAAA,MAAQ,iBAFEA,OAAA,IAQCC,EAAsB,IAKtBC,EAA0B,YAE1BC,EAAkB,aAClBC,EAAsB,wBACtBC,EAAkB,WAClBC,EAAuB,4BAKvBC,EAAyB,MAKzBC,EAAyB,EAKzBC,EAAmC,EAKpCC,OACVA,EAAA,YAAc,cACdA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,YAAc,cALJA,OAAA,IAQAC,OACVA,EAAA,KAAO,OACPA,EAAA,WAAa,aACbA,EAAA,YAAc,cACdA,EAAA,eAAiB,iBAJPA,OAAA,IAOCC,EAAa,mBACbC,EAAqB,uBACrBC,EAAyB,iCACzBC,EAAyB,iCACzBC,EAAsB,wBAEtBC,EAA8B,CACzC,KAAM,4BACN,eAAgB,oBAChB,UAAW,EACb","names":["IS_GRAALJS","IS_SERVER","HTTP_METHODS","PARAMETER_TYPES","PARAMETER_SEPARATOR","TIMEVERSION_FILTER_NAME","ISO_DATE_FORMAT","ISO_DATETIME_FORMAT","ISO_TIME_FORMAT","ISO_TIMESTAMP_FORMAT","DATETIME_OFFSET_FORMAT","DEFAULT_WEEK_STARTS_ON","DEFAULT_FIRST_WEEK_CONTAINS_DATE","ATTRIBUTE_WIDTH","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","DEFAULT_AUTHENTICATION_TYPE"]}
@@ -1,2 +1,2 @@
1
- import{a as h,b as x,c as u,d as O,e as g,f as y}from"./chunk-FGEQKEJQ.js";import{a as T,b as o}from"./chunk-YUOGIFZH.js";import{a}from"./chunk-VGAPPKHA.js";import{e as w,g as H,k as c,v}from"./chunk-LYBG43T6.js";import{b as R,c as E}from"./chunk-77CGPEAQ.js";var C=e=>{let t=e.url.includes("http")?e.url:e.url.replace(v(),""),s=e.params?e.params.replace("includeContext=true",""):"",n=s===""?t:`${t}?${s}`,r=dataFetcher.fetch(n,e);try{let i=JSON.parse(r);return i.error?Promise.reject(new h(i,void 0,e)):Promise.resolve(i)}catch(i){return Promise.reject(i)}};var p=R(T(),1);var L=0,q=200,S=400,P=401,b=300,F=404,m="application/json",l=class{_options;_attempts=0;_xmlhttp=new XMLHttpRequest;constructor(t){this._options=t}get xmlhttp(){return this._xmlhttp}set xmlhttp(t){this._xmlhttp=t}get options(){return this._options}set options(t){this._options=t}get attempts(){return this._attempts}set attempts(t){this._attempts=t}get url(){let{url:t}=this.options;if(this.params!==""){if(t.includes("?")){let s=t.split("?");return`${s[0]}?${s[1]}&${this.params}`}return`${t}?${this.params}`}return t}get params(){return this.options.params||""}get data(){return this.options.data||null}get method(){return this.options.method||"GET"}get timeout(){return this.options.timeout||H("XHR_TIMEOUT_MS",3e5)}get responseType(){return this.options.responseType||"json"}get events(){return this.options.events||{}}getBaseLocale(){return typeof navigator<"u"&&navigator.language&&navigator.language.split("-")[0]||"en"}get headers(){let t={Accept:m,"Content-Type":m,"X-Requested-With":"XMLHttpRequest","Accept-Language":this.getBaseLocale()};return this.options.headers?{...t,...this.options.headers}:t}timeoutHandler(t){return t(new g(this.url,this.method))}errorHandler(t,s){let{status:n}=this.xmlhttp,{isReload:r}=this.options;return t(n===L?new u(this.url,this.method):n===F?new O(this.url,this.method,r):n===P?new y(this.url,this.method,s):new h(s,this.xmlhttp,this.options))}getResponse(){let{responseType:t,response:s}=this.xmlhttp;if((t===""||t==="text")&&this.getResponseHeader("Content-Type")===m){if((0,p.isPlainObject)(s))return s;try{return JSON.parse(s)}catch(n){throw new x(n)}}return s}responseHandler(t,s){let{status:n}=this.xmlhttp,r=null;try{r=this.getResponse()}catch(i){return s(i)}return n>=q&&n<b||n===S&&(0,p.has)(r,"formresponse")?t(r):this.errorHandler(s,r)}setEventListeners(t,s){let n=this.options.onProgress;n&&["load","loadend","loadstart","progress"].forEach(r=>{this.xmlhttp.addEventListener(r,i=>n(i))}),["abort","error"].forEach(r=>{this.xmlhttp.addEventListener(r,()=>this.errorHandler(s))}),this.xmlhttp.addEventListener("timeout",()=>this.timeoutHandler(s)),this.xmlhttp.addEventListener("load",()=>this.responseHandler(t,s)),Object.keys(this.events).forEach(r=>{this.xmlhttp.addEventListener(r,this.events[r])})}openConnection(){this.xmlhttp.open(this.method,this.url,!0)}setBasicAuthentication(){if(o.hasItem("basic")){let t=o.getItem("basic");typeof t=="string"&&this.xmlhttp.setRequestHeader("Authorization",`Basic ${t}`)}}getResponseHeader(t){return this.xmlhttp.getResponseHeader(t)}setCustomHeaders(){let t=this.headers;Object.keys(t).forEach(s=>{this.xmlhttp.setRequestHeader(s,t[s])})}setOtherOptions(){(this.options.withCredentials||w("XHR_ALWAYS_WITH_CREDENTIALS",o.hasItem("basic")))&&(this.xmlhttp.withCredentials=!0),this.xmlhttp.responseType=this.responseType,this.xmlhttp.timeout=this.timeout}sendData(){if(this.data==null)this.xmlhttp.send();else{let t=typeof this.data=="object"?JSON.stringify(this.data):this.data;this.xmlhttp.send(t)}}handleXMLHttpRequest(){return new Promise((t,s)=>{this.setEventListeners(t,s),this.openConnection(),this.setBasicAuthentication(),this.setCustomHeaders(),this.setOtherOptions(),this.sendData()})}async fetch(){try{return await this.handleXMLHttpRequest()}catch(t){if(t instanceof u&&this.attempts<2)return this.attempts+=1,this.fetch();throw t}}},M=e=>{if(e==null)throw new a("Missing request options, expecting an object as argument for xhr");if(!(0,p.isPlainObject)(e))throw new a(`Expecting an object as argument for xhr, but received: ${e.toString()}`);if(!(0,p.has)(e,"url"))throw new a(`No url property found in arguments of xhr, received: ${JSON.stringify(e)}`);return!0},_=e=>(M(e),new l(e).fetch());var I=R(T(),1);var d="is-fetching",N=e=>{let t=3e3,s=100;return new Promise((n,r)=>{let i=()=>{if(o.getItem(e)!==d){let f=o.getItem(e);f!=null?n(f):r(new Error("Empty cached item"))}else t<=0?r(new Error("Empty cached item")):(t=t-s,setTimeout(i,s))};setTimeout(i,s)})},D=e=>{if(c()&&e.cache){let t=o.createResourceKey(e);if(o.hasItem(t)){let s=o.getItem(t);if(s!=null){if(s===d)return N(t);if((0,I.isPlainObject)(s))return Promise.resolve(s)}}o.addItem(t,d)}return _(e).then(t=>{if(c()&&e.cache&&(typeof t=="string"||typeof t=="object")){let s=o.createResourceKey(e);o.addItem(s,t)}return t})},nt=e=>(e.locale&&(e.headers={...e.headers,"Accept-Language":e.locale}),e.includeContext&&(e.url=`${e.url}?includeContext=true`),E?C(e):D(e));export{C as a,_ as b,nt as c};
2
- //# sourceMappingURL=chunk-CKI2GSM7.js.map
1
+ import{a as h,b as x,c as u,d as O,e as g,f as y}from"./chunk-333J3Q2L.js";import{a as T,b as o}from"./chunk-VIKUDFQV.js";import{a}from"./chunk-VGAPPKHA.js";import{e as w,g as H,k as c,v}from"./chunk-OBB3YOFC.js";import{b as R,c as E}from"./chunk-6GV6KLAV.js";var C=e=>{let t=e.url.includes("http")?e.url:e.url.replace(v(),""),s=e.params?e.params.replace("includeContext=true",""):"",n=s===""?t:`${t}?${s}`,r=dataFetcher.fetch(n,e);try{let i=JSON.parse(r);return i.error?Promise.reject(new h(i,void 0,e)):Promise.resolve(i)}catch(i){return Promise.reject(i)}};var p=R(T(),1);var L=0,q=200,S=400,P=401,b=300,F=404,m="application/json",l=class{_options;_attempts=0;_xmlhttp=new XMLHttpRequest;constructor(t){this._options=t}get xmlhttp(){return this._xmlhttp}set xmlhttp(t){this._xmlhttp=t}get options(){return this._options}set options(t){this._options=t}get attempts(){return this._attempts}set attempts(t){this._attempts=t}get url(){let{url:t}=this.options;if(this.params!==""){if(t.includes("?")){let s=t.split("?");return`${s[0]}?${s[1]}&${this.params}`}return`${t}?${this.params}`}return t}get params(){return this.options.params||""}get data(){return this.options.data||null}get method(){return this.options.method||"GET"}get timeout(){return this.options.timeout||H("XHR_TIMEOUT_MS",3e5)}get responseType(){return this.options.responseType||"json"}get events(){return this.options.events||{}}getBaseLocale(){return typeof navigator<"u"&&navigator.language&&navigator.language.split("-")[0]||"en"}get headers(){let t={Accept:m,"Content-Type":m,"X-Requested-With":"XMLHttpRequest","Accept-Language":this.getBaseLocale()};return this.options.headers?{...t,...this.options.headers}:t}timeoutHandler(t){return t(new g(this.url,this.method))}errorHandler(t,s){let{status:n}=this.xmlhttp,{isReload:r}=this.options;return t(n===L?new u(this.url,this.method):n===F?new O(this.url,this.method,r):n===P?new y(this.url,this.method,s):new h(s,this.xmlhttp,this.options))}getResponse(){let{responseType:t,response:s}=this.xmlhttp;if((t===""||t==="text")&&this.getResponseHeader("Content-Type")===m){if((0,p.isPlainObject)(s))return s;try{return JSON.parse(s)}catch(n){throw new x(n)}}return s}responseHandler(t,s){let{status:n}=this.xmlhttp,r=null;try{r=this.getResponse()}catch(i){return s(i)}return n>=q&&n<b||n===S&&(0,p.has)(r,"formresponse")?t(r):this.errorHandler(s,r)}setEventListeners(t,s){let n=this.options.onProgress;n&&["load","loadend","loadstart","progress"].forEach(r=>{this.xmlhttp.addEventListener(r,i=>n(i))}),["abort","error"].forEach(r=>{this.xmlhttp.addEventListener(r,()=>this.errorHandler(s))}),this.xmlhttp.addEventListener("timeout",()=>this.timeoutHandler(s)),this.xmlhttp.addEventListener("load",()=>this.responseHandler(t,s)),Object.keys(this.events).forEach(r=>{this.xmlhttp.addEventListener(r,this.events[r])})}openConnection(){this.xmlhttp.open(this.method,this.url,!0)}setBasicAuthentication(){if(o.hasItem("basic")){let t=o.getItem("basic");typeof t=="string"&&this.xmlhttp.setRequestHeader("Authorization",`Basic ${t}`)}}getResponseHeader(t){return this.xmlhttp.getResponseHeader(t)}setCustomHeaders(){let t=this.headers;Object.keys(t).forEach(s=>{this.xmlhttp.setRequestHeader(s,t[s])})}setOtherOptions(){(this.options.withCredentials||w("XHR_ALWAYS_WITH_CREDENTIALS",o.hasItem("basic")))&&(this.xmlhttp.withCredentials=!0),this.xmlhttp.responseType=this.responseType,this.xmlhttp.timeout=this.timeout}sendData(){if(this.data==null)this.xmlhttp.send();else{let t=typeof this.data=="object"?JSON.stringify(this.data):this.data;this.xmlhttp.send(t)}}handleXMLHttpRequest(){return new Promise((t,s)=>{this.setEventListeners(t,s),this.openConnection(),this.setBasicAuthentication(),this.setCustomHeaders(),this.setOtherOptions(),this.sendData()})}async fetch(){try{return await this.handleXMLHttpRequest()}catch(t){if(t instanceof u&&this.attempts<2)return this.attempts+=1,this.fetch();throw t}}},M=e=>{if(e==null)throw new a("Missing request options, expecting an object as argument for xhr");if(!(0,p.isPlainObject)(e))throw new a(`Expecting an object as argument for xhr, but received: ${e.toString()}`);if(!(0,p.has)(e,"url"))throw new a(`No url property found in arguments of xhr, received: ${JSON.stringify(e)}`);return!0},_=e=>(M(e),new l(e).fetch());var I=R(T(),1);var d="is-fetching",N=e=>{let t=3e3,s=100;return new Promise((n,r)=>{let i=()=>{if(o.getItem(e)!==d){let f=o.getItem(e);f!=null?n(f):r(new Error("Empty cached item"))}else t<=0?r(new Error("Empty cached item")):(t=t-s,setTimeout(i,s))};setTimeout(i,s)})},D=e=>{if(c()&&e.cache){let t=o.createResourceKey(e);if(o.hasItem(t)){let s=o.getItem(t);if(s!=null){if(s===d)return N(t);if((0,I.isPlainObject)(s))return Promise.resolve(s)}}o.addItem(t,d)}return _(e).then(t=>{if(c()&&e.cache&&(typeof t=="string"||typeof t=="object")){let s=o.createResourceKey(e);o.addItem(s,t)}return t})},nt=e=>(e.locale&&(e.headers={...e.headers,"Accept-Language":e.locale}),e.includeContext&&(e.url=`${e.url}?includeContext=true`),E?C(e):D(e));export{C as a,_ as b,nt as c};
2
+ //# sourceMappingURL=chunk-BTDN4ZDB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/fetch/graalFetch.ts","../src/utils/fetch/xhr.ts","../src/utils/fetch/universalFetch.ts"],"sourcesContent":["import { FetchException } from \"../../exceptions/FetchException\";\nimport { getContextPath } from \"../../settings/Paths\";\n\nimport type { RequestOptions } from \"./types\";\n\n/**\n * Fetch data from server (expects graaljs).\n */\nexport const graalFetch = (args: RequestOptions): Promise<unknown> => {\n // remove contextPath of url, when the request is internal the context path is not needed\n const urlNoBase = args.url.includes(\"http\")\n ? args.url\n : args.url.replace(getContextPath(), \"\");\n const params = args.params\n ? args.params.replace(\"includeContext=true\", \"\")\n : \"\";\n const url = params === \"\" ? urlNoBase : `${urlNoBase}?${params}`;\n\n const data = dataFetcher.fetch(url, args);\n\n try {\n const jsonData = JSON.parse(data);\n\n if (jsonData.error) {\n return Promise.reject(new FetchException(jsonData, undefined, args));\n }\n\n return Promise.resolve(jsonData);\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","import { has, isPlainObject } from \"lodash\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport { FetchException } from \"../../exceptions/FetchException\";\nimport { IllegalArgumentException } from \"../../exceptions/IllegalArgumentException\";\nimport { JsonParseException } from \"../../exceptions/JsonParseException\";\nimport { NetworkException } from \"../../exceptions/NetworkException\";\nimport { NotFoundException } from \"../../exceptions/NotFoundException\";\nimport { TimeoutException } from \"../../exceptions/TimeoutException\";\nimport { UnauthorizedException } from \"../../exceptions/UnauthorizedException\";\nimport { getNumberSetting, getSetting } from \"../../settings/Settings\";\nimport { Cache } from \"../storage/Cache\";\n\nimport type { ModularUIErrorJSON } from \"../../exceptions/types\";\nimport type { RequestOptions } from \"./types\";\n\ntype RejectFunction = (reason?: unknown) => void;\ntype ResolveFunction<R = unknown> = (value: R | PromiseLike<R>) => void;\n\nconst NETWORK_ERROR_CODE = 0;\nconst SUCCESS_CODE = 200;\nconst CLIENT_ERROR_CODE = 400;\nconst UNAUTHORIZED_CODE = 401;\nconst REDIRECTION_CODE = 300;\nconst NOT_FOUND_CODE = 404;\n\nconst JSON_TYPE = \"application/json\";\n\nclass XHR<R = unknown> {\n private _options: RequestOptions;\n private _attempts = 0;\n\n private _xmlhttp: XMLHttpRequest = new XMLHttpRequest();\n\n constructor(options: RequestOptions) {\n this._options = options;\n }\n\n get xmlhttp() {\n return this._xmlhttp;\n }\n\n set xmlhttp(xmlhttp: XMLHttpRequest) {\n this._xmlhttp = xmlhttp;\n }\n\n get options() {\n return this._options;\n }\n\n set options(options: RequestOptions) {\n this._options = options;\n }\n\n get attempts() {\n return this._attempts;\n }\n\n set attempts(attempts: number) {\n this._attempts = attempts;\n }\n\n /**\n * Create and fix url when params or both querystring and params exist.\n */\n get url() {\n const { url } = this.options;\n if (this.params !== \"\") {\n if (url.includes(\"?\")) {\n const aUrl = url.split(\"?\");\n\n return `${aUrl[0]}?${aUrl[1]}&${this.params}`;\n }\n\n return `${url}?${this.params}`;\n }\n\n return url;\n }\n\n get params() {\n return this.options.params || \"\";\n }\n\n get data() {\n return this.options.data || null;\n }\n\n get method(): HTTP_METHODS {\n return this.options.method || HTTP_METHODS.GET;\n }\n\n get timeout() {\n return this.options.timeout || getNumberSetting(\"XHR_TIMEOUT_MS\", 300000);\n }\n\n get responseType(): XMLHttpRequestResponseType {\n return this.options.responseType || \"json\";\n }\n\n private get events(): Record<string, () => undefined> {\n return this.options.events || {};\n }\n\n private getBaseLocale() {\n if (typeof navigator !== \"undefined\" && navigator.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n }\n\n get headers(): Record<string, string> {\n const baseHeaders = {\n Accept: JSON_TYPE,\n \"Content-Type\": JSON_TYPE,\n\n // needed for csrf, see: https://plaza.beinformed.com/amdoc/csrf-protection-in-modular-ui-services-40054554.html\n \"X-Requested-With\": \"XMLHttpRequest\",\n\n \"Accept-Language\": this.getBaseLocale(),\n };\n\n if (this.options.headers) {\n return {\n ...baseHeaders,\n ...this.options.headers,\n };\n }\n\n return baseHeaders;\n }\n\n timeoutHandler(reject: RejectFunction) {\n return reject(new TimeoutException(this.url, this.method));\n }\n\n errorHandler(reject: RejectFunction, responseJSON?: ModularUIErrorJSON) {\n const { status } = this.xmlhttp;\n const { isReload } = this.options;\n\n if (status === NETWORK_ERROR_CODE) {\n return reject(new NetworkException(this.url, this.method));\n }\n\n if (status === NOT_FOUND_CODE) {\n return reject(new NotFoundException(this.url, this.method, isReload));\n }\n\n if (status === UNAUTHORIZED_CODE) {\n return reject(\n new UnauthorizedException(this.url, this.method, responseJSON),\n );\n }\n\n return reject(new FetchException(responseJSON, this.xmlhttp, this.options));\n }\n\n getResponse(): R {\n const { responseType, response } = this.xmlhttp;\n\n if (\n (responseType === \"\" || responseType === \"text\") &&\n this.getResponseHeader(\"Content-Type\") === JSON_TYPE\n ) {\n if (isPlainObject(response)) {\n return response;\n }\n\n try {\n return JSON.parse(response);\n } catch (error) {\n throw new JsonParseException(error as SyntaxError);\n }\n }\n\n return response;\n }\n\n responseHandler(resolve: ResolveFunction<R>, reject: RejectFunction) {\n const { status } = this.xmlhttp;\n\n let response = null;\n try {\n response = this.getResponse();\n } catch (error) {\n return reject(error);\n }\n\n if (\n (status >= SUCCESS_CODE && status < REDIRECTION_CODE) ||\n (status === CLIENT_ERROR_CODE && has(response, \"formresponse\"))\n ) {\n return resolve(response);\n }\n\n return this.errorHandler(reject, response as ModularUIErrorJSON);\n }\n\n setEventListeners(resolve: ResolveFunction<R>, reject: RejectFunction) {\n const progressEvent = this.options.onProgress;\n if (progressEvent) {\n [\"load\", \"loadend\", \"loadstart\", \"progress\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, (event) =>\n progressEvent(event as ProgressEvent<XMLHttpRequest>),\n );\n });\n }\n\n [\"abort\", \"error\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, () => this.errorHandler(reject));\n });\n\n this.xmlhttp.addEventListener(\"timeout\", () => this.timeoutHandler(reject));\n\n this.xmlhttp.addEventListener(\"load\", () =>\n this.responseHandler(resolve, reject),\n );\n\n // Set custom events\n Object.keys(this.events).forEach((eventName) => {\n this.xmlhttp.addEventListener(eventName, this.events[eventName]);\n });\n }\n\n openConnection() {\n this.xmlhttp.open(this.method, this.url, true);\n }\n\n setBasicAuthentication() {\n if (Cache.hasItem(\"basic\")) {\n const basicToken = Cache.getItem(\"basic\");\n if (typeof basicToken === \"string\") {\n this.xmlhttp.setRequestHeader(\"Authorization\", `Basic ${basicToken}`);\n }\n }\n }\n\n getResponseHeader(headerName: string) {\n return this.xmlhttp.getResponseHeader(headerName);\n }\n\n setCustomHeaders() {\n const allHeaders = this.headers;\n\n Object.keys(allHeaders).forEach((headerName) => {\n this.xmlhttp.setRequestHeader(headerName, allHeaders[headerName]);\n });\n }\n\n setOtherOptions() {\n if (\n this.options.withCredentials ||\n getSetting(\"XHR_ALWAYS_WITH_CREDENTIALS\", Cache.hasItem(\"basic\"))\n ) {\n this.xmlhttp.withCredentials = true;\n }\n this.xmlhttp.responseType = this.responseType;\n this.xmlhttp.timeout = this.timeout;\n }\n\n sendData() {\n if (this.data == null) {\n this.xmlhttp.send();\n } else {\n const stringData =\n typeof this.data === \"object\" ? JSON.stringify(this.data) : this.data;\n this.xmlhttp.send(stringData);\n }\n }\n\n handleXMLHttpRequest(): Promise<R> {\n return new Promise((resolve, reject) => {\n this.setEventListeners(resolve, reject);\n\n this.openConnection();\n\n this.setBasicAuthentication();\n\n this.setCustomHeaders();\n\n this.setOtherOptions();\n\n this.sendData();\n });\n }\n\n async fetch(): Promise<R> {\n try {\n return await this.handleXMLHttpRequest();\n } catch (err) {\n if (err instanceof NetworkException && this.attempts < 2) {\n this.attempts += 1;\n return this.fetch();\n }\n\n throw err;\n }\n }\n}\n\nconst validateInputArguments = (args: RequestOptions) => {\n if (args == null) {\n throw new IllegalArgumentException(\n \"Missing request options, expecting an object as argument for xhr\",\n );\n }\n\n if (!isPlainObject(args)) {\n throw new IllegalArgumentException(\n `Expecting an object as argument for xhr, but received: ${args.toString()}`,\n );\n }\n\n if (!has(args, \"url\")) {\n throw new IllegalArgumentException(\n `No url property found in arguments of xhr, received: ${JSON.stringify(\n args,\n )}`,\n );\n }\n\n return true;\n};\n\nexport const xhr = <R = unknown>(args: RequestOptions): Promise<R> => {\n validateInputArguments(args);\n\n return new XHR<R>(args).fetch();\n};\n","import { isPlainObject } from \"lodash\";\n\nimport { IS_GRAALJS } from \"../../constants/Constants\";\nimport { cacheContributions } from \"../../settings/Settings\";\nimport { Cache } from \"../storage/Cache\";\nimport { graalFetch } from \"./graalFetch\";\nimport { xhr } from \"./xhr\";\n\nimport type { RequestOptions } from \"./types\";\n\ntype CachedResponse = unknown;\n\nconst IS_FETCHING = \"is-fetching\";\n\n/**\n * Checks each x ms if a cache item is set after fetching the item.\n */\nconst waitForCachedItem = (cacheKey: string) => {\n let TIMEOUT = 3000;\n const CHECK_TIMEOUT = 100;\n\n return new Promise<CachedResponse>((resolve, reject) => {\n const check = () => {\n if (Cache.getItem(cacheKey) !== IS_FETCHING) {\n const cachedItem = Cache.getItem(cacheKey);\n if (cachedItem != null) {\n resolve(cachedItem);\n } else {\n reject(new Error(\"Empty cached item\"));\n }\n } else if (TIMEOUT <= 0) {\n reject(new Error(\"Empty cached item\"));\n } else {\n TIMEOUT = TIMEOUT - CHECK_TIMEOUT;\n setTimeout(check, CHECK_TIMEOUT);\n }\n };\n\n setTimeout(check, CHECK_TIMEOUT);\n });\n};\n\nconst browserFetch = (args: RequestOptions) => {\n if (cacheContributions() && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n if (Cache.hasItem(cacheKey)) {\n const cacheItem = Cache.getItem(cacheKey);\n\n if (cacheItem != null) {\n if (cacheItem === IS_FETCHING) {\n return waitForCachedItem(cacheKey);\n } else if (isPlainObject(cacheItem)) {\n return Promise.resolve(cacheItem);\n }\n }\n }\n\n Cache.addItem(cacheKey, IS_FETCHING);\n }\n\n return xhr(args).then((response) => {\n if (cacheContributions() && args.cache) {\n if (typeof response === \"string\" || typeof response === \"object\") {\n const cacheKey = Cache.createResourceKey(args);\n Cache.addItem(cacheKey, response);\n }\n }\n\n return response;\n });\n};\n\n/**\n * Request data from server, uses server datafetcher or xhr in browser.\n */\nexport const universalFetch = (args: RequestOptions) => {\n // Set locale as Accept-Language header\n if (args.locale) {\n args.headers = {\n ...args.headers,\n \"Accept-Language\": args.locale,\n };\n }\n\n if (args.includeContext) {\n args.url = `${args.url}?includeContext=true`;\n }\n\n // server side no access to the browser cache apis, no cache available\n if (IS_GRAALJS) {\n return graalFetch(args);\n }\n\n return browserFetch(args);\n};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AEpC,CACF,CAEAL,EAAM,QAAQN,EAAUF,CAAW,CACrC,CAEA,OAAOc,EAAIH,CAAI,EAAE,KAAMI,GAAa,CAClC,GAAIH,EAAmB,GAAKD,EAAK,QAC3B,OAAOI,GAAa,UAAY,OAAOA,GAAa,UAAU,CAChE,IAAMb,EAAWM,EAAM,kBAAkBG,CAAI,EAC7CH,EAAM,QAAQN,EAAUa,CAAQ,CAClC,CAGF,OAAOA,CACT,CAAC,CACH,EAKaC,GAAkBL,IAEzBA,EAAK,SACPA,EAAK,QAAU,CACb,GAAGA,EAAK,QACR,kBAAmBA,EAAK,MAC1B,GAGEA,EAAK,iBACPA,EAAK,IAAM,GAAGA,EAAK,GAAG,wBAIpBM,EACKC,EAAWP,CAAI,EAGjBD,EAAaC,CAAI","names":["graalFetch","args","urlNoBase","getContextPath","params","url","data","jsonData","FetchException","error","import_lodash","NETWORK_ERROR_CODE","SUCCESS_CODE","CLIENT_ERROR_CODE","UNAUTHORIZED_CODE","REDIRECTION_CODE","NOT_FOUND_CODE","JSON_TYPE","XHR","options","xmlhttp","attempts","url","aUrl","getNumberSetting","baseHeaders","reject","TimeoutException","responseJSON","status","isReload","NetworkException","NotFoundException","UnauthorizedException","FetchException","responseType","response","error","JsonParseException","resolve","progressEvent","eventType","event","eventName","cacheInstance","basicToken","headerName","allHeaders","getSetting","stringData","err","validateInputArguments","args","IllegalArgumentException","xhr","import_lodash","IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","cacheInstance","cachedItem","browserFetch","args","cacheContributions","cacheItem","xhr","response","universalFetch","IS_GRAALJS","graalFetch"]}
1
+ {"version":3,"sources":["../src/utils/fetch/graalFetch.ts","../src/utils/fetch/xhr.ts","../src/utils/fetch/universalFetch.ts"],"sourcesContent":["import { FetchException } from \"../../exceptions/FetchException\";\nimport { getContextPath } from \"../../settings/Paths\";\n\nimport type { RequestOptions } from \"./types\";\n\n/**\n * Fetch data from server (expects graaljs).\n */\nexport const graalFetch = (args: RequestOptions): Promise<unknown> => {\n // remove contextPath of url, when the request is internal the context path is not needed\n const urlNoBase = args.url.includes(\"http\")\n ? args.url\n : args.url.replace(getContextPath(), \"\");\n const params = args.params\n ? args.params.replace(\"includeContext=true\", \"\")\n : \"\";\n const url = params === \"\" ? urlNoBase : `${urlNoBase}?${params}`;\n\n const data = dataFetcher.fetch(url, args);\n\n try {\n const jsonData = JSON.parse(data);\n\n if (jsonData.error) {\n return Promise.reject(new FetchException(jsonData, undefined, args));\n }\n\n return Promise.resolve(jsonData);\n } catch (error) {\n return Promise.reject(error);\n }\n};\n","import { has, isPlainObject } from \"lodash\";\n\nimport { HTTP_METHODS } from \"../../constants/Constants\";\nimport { FetchException } from \"../../exceptions/FetchException\";\nimport { IllegalArgumentException } from \"../../exceptions/IllegalArgumentException\";\nimport { JsonParseException } from \"../../exceptions/JsonParseException\";\nimport { NetworkException } from \"../../exceptions/NetworkException\";\nimport { NotFoundException } from \"../../exceptions/NotFoundException\";\nimport { TimeoutException } from \"../../exceptions/TimeoutException\";\nimport { UnauthorizedException } from \"../../exceptions/UnauthorizedException\";\nimport { getNumberSetting, getSetting } from \"../../settings/Settings\";\nimport { Cache } from \"../storage/Cache\";\n\nimport type { ModularUIErrorJSON } from \"../../exceptions/types\";\nimport type { RequestOptions } from \"./types\";\n\ntype RejectFunction = (reason?: unknown) => void;\ntype ResolveFunction<R = unknown> = (value: R | PromiseLike<R>) => void;\n\nconst NETWORK_ERROR_CODE = 0;\nconst SUCCESS_CODE = 200;\nconst CLIENT_ERROR_CODE = 400;\nconst UNAUTHORIZED_CODE = 401;\nconst REDIRECTION_CODE = 300;\nconst NOT_FOUND_CODE = 404;\n\nconst JSON_TYPE = \"application/json\";\n\nclass XHR<R = unknown> {\n private _options: RequestOptions;\n private _attempts = 0;\n\n private _xmlhttp: XMLHttpRequest = new XMLHttpRequest();\n\n constructor(options: RequestOptions) {\n this._options = options;\n }\n\n get xmlhttp() {\n return this._xmlhttp;\n }\n\n set xmlhttp(xmlhttp: XMLHttpRequest) {\n this._xmlhttp = xmlhttp;\n }\n\n get options() {\n return this._options;\n }\n\n set options(options: RequestOptions) {\n this._options = options;\n }\n\n get attempts() {\n return this._attempts;\n }\n\n set attempts(attempts: number) {\n this._attempts = attempts;\n }\n\n /**\n * Create and fix url when params or both querystring and params exist.\n */\n get url() {\n const { url } = this.options;\n if (this.params !== \"\") {\n if (url.includes(\"?\")) {\n const aUrl = url.split(\"?\");\n\n return `${aUrl[0]}?${aUrl[1]}&${this.params}`;\n }\n\n return `${url}?${this.params}`;\n }\n\n return url;\n }\n\n get params() {\n return this.options.params || \"\";\n }\n\n get data() {\n return this.options.data || null;\n }\n\n get method(): HTTP_METHODS {\n return this.options.method || HTTP_METHODS.GET;\n }\n\n get timeout() {\n return this.options.timeout || getNumberSetting(\"XHR_TIMEOUT_MS\", 300000);\n }\n\n get responseType(): XMLHttpRequestResponseType {\n return this.options.responseType || \"json\";\n }\n\n private get events(): Record<string, () => undefined> {\n return this.options.events || {};\n }\n\n private getBaseLocale() {\n if (typeof navigator !== \"undefined\" && navigator.language) {\n return navigator.language.split(\"-\")[0] || \"en\";\n }\n\n return \"en\";\n }\n\n get headers(): Record<string, string> {\n const baseHeaders = {\n Accept: JSON_TYPE,\n \"Content-Type\": JSON_TYPE,\n\n // needed for csrf, see: https://plaza.beinformed.com/amdoc/csrf-protection-in-modular-ui-services-40054554.html\n \"X-Requested-With\": \"XMLHttpRequest\",\n\n \"Accept-Language\": this.getBaseLocale(),\n };\n\n if (this.options.headers) {\n return {\n ...baseHeaders,\n ...this.options.headers,\n };\n }\n\n return baseHeaders;\n }\n\n timeoutHandler(reject: RejectFunction) {\n return reject(new TimeoutException(this.url, this.method));\n }\n\n errorHandler(reject: RejectFunction, responseJSON?: ModularUIErrorJSON) {\n const { status } = this.xmlhttp;\n const { isReload } = this.options;\n\n if (status === NETWORK_ERROR_CODE) {\n return reject(new NetworkException(this.url, this.method));\n }\n\n if (status === NOT_FOUND_CODE) {\n return reject(new NotFoundException(this.url, this.method, isReload));\n }\n\n if (status === UNAUTHORIZED_CODE) {\n return reject(\n new UnauthorizedException(this.url, this.method, responseJSON),\n );\n }\n\n return reject(new FetchException(responseJSON, this.xmlhttp, this.options));\n }\n\n getResponse(): R {\n const { responseType, response } = this.xmlhttp;\n\n if (\n (responseType === \"\" || responseType === \"text\") &&\n this.getResponseHeader(\"Content-Type\") === JSON_TYPE\n ) {\n if (isPlainObject(response)) {\n return response;\n }\n\n try {\n return JSON.parse(response);\n } catch (error) {\n throw new JsonParseException(error as SyntaxError);\n }\n }\n\n return response;\n }\n\n responseHandler(resolve: ResolveFunction<R>, reject: RejectFunction) {\n const { status } = this.xmlhttp;\n\n let response = null;\n try {\n response = this.getResponse();\n } catch (error) {\n return reject(error);\n }\n\n if (\n (status >= SUCCESS_CODE && status < REDIRECTION_CODE) ||\n (status === CLIENT_ERROR_CODE && has(response, \"formresponse\"))\n ) {\n return resolve(response);\n }\n\n return this.errorHandler(reject, response as ModularUIErrorJSON);\n }\n\n setEventListeners(resolve: ResolveFunction<R>, reject: RejectFunction) {\n const progressEvent = this.options.onProgress;\n if (progressEvent) {\n [\"load\", \"loadend\", \"loadstart\", \"progress\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, (event) =>\n progressEvent(event as ProgressEvent<XMLHttpRequest>),\n );\n });\n }\n\n [\"abort\", \"error\"].forEach((eventType) => {\n this.xmlhttp.addEventListener(eventType, () => this.errorHandler(reject));\n });\n\n this.xmlhttp.addEventListener(\"timeout\", () => this.timeoutHandler(reject));\n\n this.xmlhttp.addEventListener(\"load\", () =>\n this.responseHandler(resolve, reject),\n );\n\n // Set custom events\n Object.keys(this.events).forEach((eventName) => {\n this.xmlhttp.addEventListener(eventName, this.events[eventName]);\n });\n }\n\n openConnection() {\n this.xmlhttp.open(this.method, this.url, true);\n }\n\n setBasicAuthentication() {\n if (Cache.hasItem(\"basic\")) {\n const basicToken = Cache.getItem(\"basic\");\n if (typeof basicToken === \"string\") {\n this.xmlhttp.setRequestHeader(\"Authorization\", `Basic ${basicToken}`);\n }\n }\n }\n\n getResponseHeader(headerName: string) {\n return this.xmlhttp.getResponseHeader(headerName);\n }\n\n setCustomHeaders() {\n const allHeaders = this.headers;\n\n Object.keys(allHeaders).forEach((headerName) => {\n this.xmlhttp.setRequestHeader(headerName, allHeaders[headerName]);\n });\n }\n\n setOtherOptions() {\n if (\n this.options.withCredentials ||\n getSetting(\"XHR_ALWAYS_WITH_CREDENTIALS\", Cache.hasItem(\"basic\"))\n ) {\n this.xmlhttp.withCredentials = true;\n }\n this.xmlhttp.responseType = this.responseType;\n this.xmlhttp.timeout = this.timeout;\n }\n\n sendData() {\n if (this.data == null) {\n this.xmlhttp.send();\n } else {\n const stringData =\n typeof this.data === \"object\" ? JSON.stringify(this.data) : this.data;\n this.xmlhttp.send(stringData);\n }\n }\n\n handleXMLHttpRequest(): Promise<R> {\n return new Promise((resolve, reject) => {\n this.setEventListeners(resolve, reject);\n\n this.openConnection();\n\n this.setBasicAuthentication();\n\n this.setCustomHeaders();\n\n this.setOtherOptions();\n\n this.sendData();\n });\n }\n\n async fetch(): Promise<R> {\n try {\n return await this.handleXMLHttpRequest();\n } catch (err) {\n if (err instanceof NetworkException && this.attempts < 2) {\n this.attempts += 1;\n return this.fetch();\n }\n\n throw err;\n }\n }\n}\n\nconst validateInputArguments = (args: RequestOptions) => {\n if (args == null) {\n throw new IllegalArgumentException(\n \"Missing request options, expecting an object as argument for xhr\",\n );\n }\n\n if (!isPlainObject(args)) {\n throw new IllegalArgumentException(\n `Expecting an object as argument for xhr, but received: ${args.toString()}`,\n );\n }\n\n if (!has(args, \"url\")) {\n throw new IllegalArgumentException(\n `No url property found in arguments of xhr, received: ${JSON.stringify(\n args,\n )}`,\n );\n }\n\n return true;\n};\n\nexport const xhr = <R = unknown>(args: RequestOptions): Promise<R> => {\n validateInputArguments(args);\n\n return new XHR<R>(args).fetch();\n};\n","import { isPlainObject } from \"lodash\";\n\nimport { IS_GRAALJS } from \"../../constants/Constants\";\nimport { cacheContributions } from \"../../settings/Settings\";\nimport { Cache } from \"../storage/Cache\";\n\nimport { graalFetch } from \"./graalFetch\";\nimport { xhr } from \"./xhr\";\n\nimport type { RequestOptions } from \"./types\";\n\ntype CachedResponse = unknown;\n\nconst IS_FETCHING = \"is-fetching\";\n\n/**\n * Checks each x ms if a cache item is set after fetching the item.\n */\nconst waitForCachedItem = (cacheKey: string) => {\n let TIMEOUT = 3000;\n const CHECK_TIMEOUT = 100;\n\n return new Promise<CachedResponse>((resolve, reject) => {\n const check = () => {\n if (Cache.getItem(cacheKey) !== IS_FETCHING) {\n const cachedItem = Cache.getItem(cacheKey);\n if (cachedItem != null) {\n resolve(cachedItem);\n } else {\n reject(new Error(\"Empty cached item\"));\n }\n } else if (TIMEOUT <= 0) {\n reject(new Error(\"Empty cached item\"));\n } else {\n TIMEOUT = TIMEOUT - CHECK_TIMEOUT;\n setTimeout(check, CHECK_TIMEOUT);\n }\n };\n\n setTimeout(check, CHECK_TIMEOUT);\n });\n};\n\nconst browserFetch = (args: RequestOptions) => {\n if (cacheContributions() && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n if (Cache.hasItem(cacheKey)) {\n const cacheItem = Cache.getItem(cacheKey);\n\n if (cacheItem != null) {\n if (cacheItem === IS_FETCHING) {\n return waitForCachedItem(cacheKey);\n } else if (isPlainObject(cacheItem)) {\n return Promise.resolve(cacheItem);\n }\n }\n }\n\n Cache.addItem(cacheKey, IS_FETCHING);\n }\n\n return xhr(args).then((response) => {\n if (cacheContributions() && args.cache) {\n if (typeof response === \"string\" || typeof response === \"object\") {\n const cacheKey = Cache.createResourceKey(args);\n Cache.addItem(cacheKey, response);\n }\n }\n\n return response;\n });\n};\n\n/**\n * Request data from server, uses server datafetcher or xhr in browser.\n */\nexport const universalFetch = (args: RequestOptions) => {\n // Set locale as Accept-Language header\n if (args.locale) {\n args.headers = {\n ...args.headers,\n \"Accept-Language\": args.locale,\n };\n }\n\n if (args.includeContext) {\n args.url = `${args.url}?includeContext=true`;\n }\n\n // server side no access to the browser cache apis, no cache available\n if (IS_GRAALJS) {\n return graalFetch(args);\n }\n\n return browserFetch(args);\n};\n"],"mappings":"oQAQO,IAAMA,EAAcC,GAA2C,CAEpE,IAAMC,EAAYD,EAAK,IAAI,SAAS,MAAM,EACtCA,EAAK,IACLA,EAAK,IAAI,QAAQE,EAAe,EAAG,EAAE,EACnCC,EAASH,EAAK,OAChBA,EAAK,OAAO,QAAQ,sBAAuB,EAAE,EAC7C,GACEI,EAAMD,IAAW,GAAKF,EAAY,GAAGA,CAAS,IAAIE,CAAM,GAExDE,EAAO,YAAY,MAAMD,EAAKJ,CAAI,EAExC,GAAI,CACF,IAAMM,EAAW,KAAK,MAAMD,CAAI,EAEhC,OAAIC,EAAS,MACJ,QAAQ,OAAO,IAAIC,EAAeD,EAAU,OAAWN,CAAI,CAAC,EAG9D,QAAQ,QAAQM,CAAQ,CACjC,OAASE,EAAO,CACd,OAAO,QAAQ,OAAOA,CAAK,CAC7B,CACF,EC/BA,IAAAC,EAAmC,SAmBnC,IAAMC,EAAqB,EACrBC,EAAe,IACfC,EAAoB,IACpBC,EAAoB,IACpBC,EAAmB,IACnBC,EAAiB,IAEjBC,EAAY,mBAEZC,EAAN,KAAuB,CACb,SACA,UAAY,EAEZ,SAA2B,IAAI,eAEvC,YAAYC,EAAyB,CACnC,KAAK,SAAWA,CAClB,CAEA,IAAI,SAAU,CACZ,OAAO,KAAK,QACd,CAEA,IAAI,QAAQC,EAAyB,CACnC,KAAK,SAAWA,CAClB,CAEA,IAAI,SAAU,CACZ,OAAO,KAAK,QACd,CAEA,IAAI,QAAQD,EAAyB,CACnC,KAAK,SAAWA,CAClB,CAEA,IAAI,UAAW,CACb,OAAO,KAAK,SACd,CAEA,IAAI,SAASE,EAAkB,CAC7B,KAAK,UAAYA,CACnB,CAKA,IAAI,KAAM,CACR,GAAM,CAAE,IAAAC,CAAI,EAAI,K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,EAExC,GAAIW,GAAa,KAAM,CACrB,GAAIA,IAAcb,EAChB,OAAOC,EAAkBC,CAAQ,EAC5B,MAAI,iBAAcW,CAAS,EAChC,OAAO,QAAQ,QAAQA,CAAS,CAEpC,CACF,CAEAL,EAAM,QAAQN,EAAUF,CAAW,CACrC,CAEA,OAAOc,EAAIH,CAAI,EAAE,KAAMI,GAAa,CAClC,GAAIH,EAAmB,GAAKD,EAAK,QAC3B,OAAOI,GAAa,UAAY,OAAOA,GAAa,UAAU,CAChE,IAAMb,EAAWM,EAAM,kBAAkBG,CAAI,EAC7CH,EAAM,QAAQN,EAAUa,CAAQ,CAClC,CAGF,OAAOA,CACT,CAAC,CACH,EAKaC,GAAkBL,IAEzBA,EAAK,SACPA,EAAK,QAAU,CACb,GAAGA,EAAK,QACR,kBAAmBA,EAAK,MAC1B,GAGEA,EAAK,iBACPA,EAAK,IAAM,GAAGA,EAAK,GAAG,wBAIpBM,EACKC,EAAWP,CAAI,EAGjBD,EAAaC,CAAI","names":["graalFetch","args","urlNoBase","getContextPath","params","url","data","jsonData","FetchException","error","import_lodash","NETWORK_ERROR_CODE","SUCCESS_CODE","CLIENT_ERROR_CODE","UNAUTHORIZED_CODE","REDIRECTION_CODE","NOT_FOUND_CODE","JSON_TYPE","XHR","options","xmlhttp","attempts","url","aUrl","getNumberSetting","baseHeaders","reject","TimeoutException","responseJSON","status","isReload","NetworkException","NotFoundException","UnauthorizedException","FetchException","responseType","response","error","JsonParseException","resolve","progressEvent","eventType","event","eventName","cacheInstance","basicToken","headerName","allHeaders","getSetting","stringData","err","validateInputArguments","args","IllegalArgumentException","xhr","import_lodash","IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","cacheInstance","cachedItem","browserFetch","args","cacheContributions","cacheItem","xhr","response","universalFetch","IS_GRAALJS","graalFetch"]}