@c-rex/core 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OIDC.js +239 -27
- package/dist/OIDC.js.map +1 -1
- package/dist/OIDC.mjs +239 -27
- package/dist/OIDC.mjs.map +1 -1
- package/dist/logger.js +239 -27
- package/dist/logger.js.map +1 -1
- package/dist/logger.mjs +239 -27
- package/dist/logger.mjs.map +1 -1
- package/dist/requests.d.mts +66 -2
- package/dist/requests.d.ts +66 -2
- package/dist/requests.js +866 -47
- package/dist/requests.js.map +1 -1
- package/dist/requests.mjs +842 -46
- package/dist/requests.mjs.map +1 -1
- package/dist/sdk.js +124 -9
- package/dist/sdk.js.map +1 -1
- package/dist/sdk.mjs +124 -9
- package/dist/sdk.mjs.map +1 -1
- package/package.json +70 -69
package/dist/requests.mjs
CHANGED
|
@@ -9,6 +9,7 @@ var AdministrativeMetadataModelFields = {
|
|
|
9
9
|
descriptions: "descriptions",
|
|
10
10
|
synonyms: "synonyms",
|
|
11
11
|
packages: "packages",
|
|
12
|
+
hasInformationUnits: "hasInformationUnits",
|
|
12
13
|
links: "links"
|
|
13
14
|
};
|
|
14
15
|
var AdministrativeMetadataModelFieldsAll = Object.values(AdministrativeMetadataModelFields);
|
|
@@ -23,6 +24,24 @@ var AuthStateModelFields = {
|
|
|
23
24
|
roles: "roles"
|
|
24
25
|
};
|
|
25
26
|
var AuthStateModelFieldsAll = Object.values(AuthStateModelFields);
|
|
27
|
+
var CategoryModelFields = {
|
|
28
|
+
id: "id",
|
|
29
|
+
shortId: "shortId",
|
|
30
|
+
score: "score",
|
|
31
|
+
class: "class",
|
|
32
|
+
labels: "labels",
|
|
33
|
+
comments: "comments",
|
|
34
|
+
descriptions: "descriptions",
|
|
35
|
+
synonyms: "synonyms",
|
|
36
|
+
packages: "packages",
|
|
37
|
+
hasInformationUnits: "hasInformationUnits",
|
|
38
|
+
links: "links",
|
|
39
|
+
parents: "parents",
|
|
40
|
+
ancestors: "ancestors",
|
|
41
|
+
ancestorsOrSelf: "ancestorsOrSelf",
|
|
42
|
+
categories: "categories"
|
|
43
|
+
};
|
|
44
|
+
var CategoryModelFieldsAll = Object.values(CategoryModelFields);
|
|
26
45
|
var ComponentModelFields = {
|
|
27
46
|
id: "id",
|
|
28
47
|
shortId: "shortId",
|
|
@@ -33,6 +52,7 @@ var ComponentModelFields = {
|
|
|
33
52
|
descriptions: "descriptions",
|
|
34
53
|
synonyms: "synonyms",
|
|
35
54
|
packages: "packages",
|
|
55
|
+
hasInformationUnits: "hasInformationUnits",
|
|
36
56
|
links: "links",
|
|
37
57
|
productGraphic: "productGraphic",
|
|
38
58
|
titles: "titles",
|
|
@@ -56,6 +76,7 @@ var ContentLifeCycleStatusModelFields = {
|
|
|
56
76
|
descriptions: "descriptions",
|
|
57
77
|
synonyms: "synonyms",
|
|
58
78
|
packages: "packages",
|
|
79
|
+
hasInformationUnits: "hasInformationUnits",
|
|
59
80
|
links: "links",
|
|
60
81
|
dateOfEffect: "dateOfEffect",
|
|
61
82
|
dateOfExpiry: "dateOfExpiry",
|
|
@@ -75,6 +96,7 @@ var ContentLifeCycleStatusValueModelFields = {
|
|
|
75
96
|
descriptions: "descriptions",
|
|
76
97
|
synonyms: "synonyms",
|
|
77
98
|
packages: "packages",
|
|
99
|
+
hasInformationUnits: "hasInformationUnits",
|
|
78
100
|
links: "links"
|
|
79
101
|
};
|
|
80
102
|
var ContentLifeCycleStatusValueModelFieldsAll = Object.values(ContentLifeCycleStatusValueModelFields);
|
|
@@ -88,6 +110,7 @@ var DirectoryNodeModelFields = {
|
|
|
88
110
|
descriptions: "descriptions",
|
|
89
111
|
synonyms: "synonyms",
|
|
90
112
|
packages: "packages",
|
|
113
|
+
hasInformationUnits: "hasInformationUnits",
|
|
91
114
|
links: "links",
|
|
92
115
|
structureType: "structureType",
|
|
93
116
|
parents: "parents",
|
|
@@ -107,6 +130,7 @@ var DirectoryNodeTypeModelFields = {
|
|
|
107
130
|
descriptions: "descriptions",
|
|
108
131
|
synonyms: "synonyms",
|
|
109
132
|
packages: "packages",
|
|
133
|
+
hasInformationUnits: "hasInformationUnits",
|
|
110
134
|
links: "links"
|
|
111
135
|
};
|
|
112
136
|
var DirectoryNodeTypeModelFieldsAll = Object.values(DirectoryNodeTypeModelFields);
|
|
@@ -120,6 +144,7 @@ var DocumentModelFields = {
|
|
|
120
144
|
descriptions: "descriptions",
|
|
121
145
|
synonyms: "synonyms",
|
|
122
146
|
packages: "packages",
|
|
147
|
+
hasInformationUnits: "hasInformationUnits",
|
|
123
148
|
links: "links",
|
|
124
149
|
revision: "revision",
|
|
125
150
|
created: "created",
|
|
@@ -161,6 +186,7 @@ var DocumentTypeModelFields = {
|
|
|
161
186
|
descriptions: "descriptions",
|
|
162
187
|
synonyms: "synonyms",
|
|
163
188
|
packages: "packages",
|
|
189
|
+
hasInformationUnits: "hasInformationUnits",
|
|
164
190
|
links: "links"
|
|
165
191
|
};
|
|
166
192
|
var DocumentTypeModelFieldsAll = Object.values(DocumentTypeModelFields);
|
|
@@ -174,6 +200,7 @@ var DocumentationMetadataModelFields = {
|
|
|
174
200
|
descriptions: "descriptions",
|
|
175
201
|
synonyms: "synonyms",
|
|
176
202
|
packages: "packages",
|
|
203
|
+
hasInformationUnits: "hasInformationUnits",
|
|
177
204
|
links: "links"
|
|
178
205
|
};
|
|
179
206
|
var DocumentationMetadataModelFieldsAll = Object.values(DocumentationMetadataModelFields);
|
|
@@ -186,7 +213,8 @@ var DomainEntityModelFields = {
|
|
|
186
213
|
comments: "comments",
|
|
187
214
|
descriptions: "descriptions",
|
|
188
215
|
synonyms: "synonyms",
|
|
189
|
-
packages: "packages"
|
|
216
|
+
packages: "packages",
|
|
217
|
+
hasInformationUnits: "hasInformationUnits"
|
|
190
218
|
};
|
|
191
219
|
var DomainEntityModelFieldsAll = Object.values(DomainEntityModelFields);
|
|
192
220
|
var EventModelFields = {
|
|
@@ -199,6 +227,7 @@ var EventModelFields = {
|
|
|
199
227
|
descriptions: "descriptions",
|
|
200
228
|
synonyms: "synonyms",
|
|
201
229
|
packages: "packages",
|
|
230
|
+
hasInformationUnits: "hasInformationUnits",
|
|
202
231
|
links: "links",
|
|
203
232
|
eventCode: "eventCode",
|
|
204
233
|
eventType: "eventType"
|
|
@@ -214,6 +243,7 @@ var ExternalProductGraphicModelFields = {
|
|
|
214
243
|
descriptions: "descriptions",
|
|
215
244
|
synonyms: "synonyms",
|
|
216
245
|
packages: "packages",
|
|
246
|
+
hasInformationUnits: "hasInformationUnits",
|
|
217
247
|
links: "links",
|
|
218
248
|
revision: "revision",
|
|
219
249
|
created: "created",
|
|
@@ -266,6 +296,7 @@ var FragmentModelFields = {
|
|
|
266
296
|
descriptions: "descriptions",
|
|
267
297
|
synonyms: "synonyms",
|
|
268
298
|
packages: "packages",
|
|
299
|
+
hasInformationUnits: "hasInformationUnits",
|
|
269
300
|
links: "links",
|
|
270
301
|
revision: "revision",
|
|
271
302
|
created: "created",
|
|
@@ -307,6 +338,7 @@ var FunctionalMetadataModelFields = {
|
|
|
307
338
|
descriptions: "descriptions",
|
|
308
339
|
synonyms: "synonyms",
|
|
309
340
|
packages: "packages",
|
|
341
|
+
hasInformationUnits: "hasInformationUnits",
|
|
310
342
|
links: "links"
|
|
311
343
|
};
|
|
312
344
|
var FunctionalMetadataModelFieldsAll = Object.values(FunctionalMetadataModelFields);
|
|
@@ -320,6 +352,7 @@ var IdentityDomainModelFields = {
|
|
|
320
352
|
descriptions: "descriptions",
|
|
321
353
|
synonyms: "synonyms",
|
|
322
354
|
packages: "packages",
|
|
355
|
+
hasInformationUnits: "hasInformationUnits",
|
|
323
356
|
links: "links",
|
|
324
357
|
parties: "parties"
|
|
325
358
|
};
|
|
@@ -334,6 +367,7 @@ var IdentityModelFields = {
|
|
|
334
367
|
descriptions: "descriptions",
|
|
335
368
|
synonyms: "synonyms",
|
|
336
369
|
packages: "packages",
|
|
370
|
+
hasInformationUnits: "hasInformationUnits",
|
|
337
371
|
links: "links",
|
|
338
372
|
identifier: "identifier",
|
|
339
373
|
identityDomain: "identityDomain"
|
|
@@ -349,6 +383,7 @@ var InformationObjectModelFields = {
|
|
|
349
383
|
descriptions: "descriptions",
|
|
350
384
|
synonyms: "synonyms",
|
|
351
385
|
packages: "packages",
|
|
386
|
+
hasInformationUnits: "hasInformationUnits",
|
|
352
387
|
links: "links",
|
|
353
388
|
identities: "identities"
|
|
354
389
|
};
|
|
@@ -363,6 +398,7 @@ var InformationSubjectCollectionModelFields = {
|
|
|
363
398
|
descriptions: "descriptions",
|
|
364
399
|
synonyms: "synonyms",
|
|
365
400
|
packages: "packages",
|
|
401
|
+
hasInformationUnits: "hasInformationUnits",
|
|
366
402
|
links: "links"
|
|
367
403
|
};
|
|
368
404
|
var InformationSubjectCollectionModelFieldsAll = Object.values(InformationSubjectCollectionModelFields);
|
|
@@ -376,6 +412,7 @@ var InformationSubjectConformityModelFields = {
|
|
|
376
412
|
descriptions: "descriptions",
|
|
377
413
|
synonyms: "synonyms",
|
|
378
414
|
packages: "packages",
|
|
415
|
+
hasInformationUnits: "hasInformationUnits",
|
|
379
416
|
links: "links"
|
|
380
417
|
};
|
|
381
418
|
var InformationSubjectConformityModelFieldsAll = Object.values(InformationSubjectConformityModelFields);
|
|
@@ -389,6 +426,7 @@ var InformationSubjectFormalityModelFields = {
|
|
|
389
426
|
descriptions: "descriptions",
|
|
390
427
|
synonyms: "synonyms",
|
|
391
428
|
packages: "packages",
|
|
429
|
+
hasInformationUnits: "hasInformationUnits",
|
|
392
430
|
links: "links"
|
|
393
431
|
};
|
|
394
432
|
var InformationSubjectFormalityModelFieldsAll = Object.values(InformationSubjectFormalityModelFields);
|
|
@@ -402,6 +440,7 @@ var InformationSubjectFunctionalityModelFields = {
|
|
|
402
440
|
descriptions: "descriptions",
|
|
403
441
|
synonyms: "synonyms",
|
|
404
442
|
packages: "packages",
|
|
443
|
+
hasInformationUnits: "hasInformationUnits",
|
|
405
444
|
links: "links"
|
|
406
445
|
};
|
|
407
446
|
var InformationSubjectFunctionalityModelFieldsAll = Object.values(InformationSubjectFunctionalityModelFields);
|
|
@@ -415,6 +454,7 @@ var InformationSubjectModelFields = {
|
|
|
415
454
|
descriptions: "descriptions",
|
|
416
455
|
synonyms: "synonyms",
|
|
417
456
|
packages: "packages",
|
|
457
|
+
hasInformationUnits: "hasInformationUnits",
|
|
418
458
|
links: "links"
|
|
419
459
|
};
|
|
420
460
|
var InformationSubjectModelFieldsAll = Object.values(InformationSubjectModelFields);
|
|
@@ -428,6 +468,7 @@ var InformationSubjectProcessModelFields = {
|
|
|
428
468
|
descriptions: "descriptions",
|
|
429
469
|
synonyms: "synonyms",
|
|
430
470
|
packages: "packages",
|
|
471
|
+
hasInformationUnits: "hasInformationUnits",
|
|
431
472
|
links: "links"
|
|
432
473
|
};
|
|
433
474
|
var InformationSubjectProcessModelFieldsAll = Object.values(InformationSubjectProcessModelFields);
|
|
@@ -441,6 +482,7 @@ var InformationSubjectSafetyModelFields = {
|
|
|
441
482
|
descriptions: "descriptions",
|
|
442
483
|
synonyms: "synonyms",
|
|
443
484
|
packages: "packages",
|
|
485
|
+
hasInformationUnits: "hasInformationUnits",
|
|
444
486
|
links: "links"
|
|
445
487
|
};
|
|
446
488
|
var InformationSubjectSafetyModelFieldsAll = Object.values(InformationSubjectSafetyModelFields);
|
|
@@ -454,6 +496,7 @@ var InformationSubjectSafetyWarningMessageModelFields = {
|
|
|
454
496
|
descriptions: "descriptions",
|
|
455
497
|
synonyms: "synonyms",
|
|
456
498
|
packages: "packages",
|
|
499
|
+
hasInformationUnits: "hasInformationUnits",
|
|
457
500
|
links: "links"
|
|
458
501
|
};
|
|
459
502
|
var InformationSubjectSafetyWarningMessageModelFieldsAll = Object.values(InformationSubjectSafetyWarningMessageModelFields);
|
|
@@ -467,6 +510,7 @@ var InformationSubjectTechnicalDataModelFields = {
|
|
|
467
510
|
descriptions: "descriptions",
|
|
468
511
|
synonyms: "synonyms",
|
|
469
512
|
packages: "packages",
|
|
513
|
+
hasInformationUnits: "hasInformationUnits",
|
|
470
514
|
links: "links"
|
|
471
515
|
};
|
|
472
516
|
var InformationSubjectTechnicalDataModelFieldsAll = Object.values(InformationSubjectTechnicalDataModelFields);
|
|
@@ -480,6 +524,7 @@ var InformationSubjectTechnicalOverviewModelFields = {
|
|
|
480
524
|
descriptions: "descriptions",
|
|
481
525
|
synonyms: "synonyms",
|
|
482
526
|
packages: "packages",
|
|
527
|
+
hasInformationUnits: "hasInformationUnits",
|
|
483
528
|
links: "links"
|
|
484
529
|
};
|
|
485
530
|
var InformationSubjectTechnicalOverviewModelFieldsAll = Object.values(InformationSubjectTechnicalOverviewModelFields);
|
|
@@ -493,6 +538,7 @@ var InformationTypeModelFields = {
|
|
|
493
538
|
descriptions: "descriptions",
|
|
494
539
|
synonyms: "synonyms",
|
|
495
540
|
packages: "packages",
|
|
541
|
+
hasInformationUnits: "hasInformationUnits",
|
|
496
542
|
links: "links"
|
|
497
543
|
};
|
|
498
544
|
var InformationTypeModelFieldsAll = Object.values(InformationTypeModelFields);
|
|
@@ -506,6 +552,7 @@ var InformationUnitModelFields = {
|
|
|
506
552
|
descriptions: "descriptions",
|
|
507
553
|
synonyms: "synonyms",
|
|
508
554
|
packages: "packages",
|
|
555
|
+
hasInformationUnits: "hasInformationUnits",
|
|
509
556
|
links: "links",
|
|
510
557
|
revision: "revision",
|
|
511
558
|
created: "created",
|
|
@@ -546,7 +593,8 @@ var OwlClassModelFields = {
|
|
|
546
593
|
comments: "comments",
|
|
547
594
|
descriptions: "descriptions",
|
|
548
595
|
synonyms: "synonyms",
|
|
549
|
-
packages: "packages"
|
|
596
|
+
packages: "packages",
|
|
597
|
+
hasInformationUnits: "hasInformationUnits"
|
|
550
598
|
};
|
|
551
599
|
var OwlClassModelFieldsAll = Object.values(OwlClassModelFields);
|
|
552
600
|
var PackageModelFields = {
|
|
@@ -559,6 +607,7 @@ var PackageModelFields = {
|
|
|
559
607
|
descriptions: "descriptions",
|
|
560
608
|
synonyms: "synonyms",
|
|
561
609
|
packages: "packages",
|
|
610
|
+
hasInformationUnits: "hasInformationUnits",
|
|
562
611
|
links: "links",
|
|
563
612
|
revision: "revision",
|
|
564
613
|
created: "created",
|
|
@@ -603,6 +652,7 @@ var PartyModelFields = {
|
|
|
603
652
|
descriptions: "descriptions",
|
|
604
653
|
synonyms: "synonyms",
|
|
605
654
|
packages: "packages",
|
|
655
|
+
hasInformationUnits: "hasInformationUnits",
|
|
606
656
|
links: "links",
|
|
607
657
|
partyRole: "partyRole",
|
|
608
658
|
vcard: "vcard"
|
|
@@ -618,6 +668,7 @@ var PartyRoleModelFields = {
|
|
|
618
668
|
descriptions: "descriptions",
|
|
619
669
|
synonyms: "synonyms",
|
|
620
670
|
packages: "packages",
|
|
671
|
+
hasInformationUnits: "hasInformationUnits",
|
|
621
672
|
links: "links"
|
|
622
673
|
};
|
|
623
674
|
var PartyRoleModelFieldsAll = Object.values(PartyRoleModelFields);
|
|
@@ -631,6 +682,7 @@ var PlanningDownTimeModelFields = {
|
|
|
631
682
|
descriptions: "descriptions",
|
|
632
683
|
synonyms: "synonyms",
|
|
633
684
|
packages: "packages",
|
|
685
|
+
hasInformationUnits: "hasInformationUnits",
|
|
634
686
|
links: "links",
|
|
635
687
|
duration: "duration"
|
|
636
688
|
};
|
|
@@ -645,6 +697,7 @@ var PlanningMaintenanceIntervalModelFields = {
|
|
|
645
697
|
descriptions: "descriptions",
|
|
646
698
|
synonyms: "synonyms",
|
|
647
699
|
packages: "packages",
|
|
700
|
+
hasInformationUnits: "hasInformationUnits",
|
|
648
701
|
links: "links",
|
|
649
702
|
duration: "duration",
|
|
650
703
|
frequency: "frequency"
|
|
@@ -660,6 +713,7 @@ var PlanningSetupTimeModelFields = {
|
|
|
660
713
|
descriptions: "descriptions",
|
|
661
714
|
synonyms: "synonyms",
|
|
662
715
|
packages: "packages",
|
|
716
|
+
hasInformationUnits: "hasInformationUnits",
|
|
663
717
|
links: "links",
|
|
664
718
|
duration: "duration"
|
|
665
719
|
};
|
|
@@ -674,6 +728,7 @@ var PlanningTimeModelFields = {
|
|
|
674
728
|
descriptions: "descriptions",
|
|
675
729
|
synonyms: "synonyms",
|
|
676
730
|
packages: "packages",
|
|
731
|
+
hasInformationUnits: "hasInformationUnits",
|
|
677
732
|
links: "links",
|
|
678
733
|
duration: "duration"
|
|
679
734
|
};
|
|
@@ -688,6 +743,7 @@ var PlanningWorkingTimeModelFields = {
|
|
|
688
743
|
descriptions: "descriptions",
|
|
689
744
|
synonyms: "synonyms",
|
|
690
745
|
packages: "packages",
|
|
746
|
+
hasInformationUnits: "hasInformationUnits",
|
|
691
747
|
links: "links",
|
|
692
748
|
duration: "duration"
|
|
693
749
|
};
|
|
@@ -702,6 +758,7 @@ var ProductFeatureModelFields = {
|
|
|
702
758
|
descriptions: "descriptions",
|
|
703
759
|
synonyms: "synonyms",
|
|
704
760
|
packages: "packages",
|
|
761
|
+
hasInformationUnits: "hasInformationUnits",
|
|
705
762
|
links: "links"
|
|
706
763
|
};
|
|
707
764
|
var ProductFeatureModelFieldsAll = Object.values(ProductFeatureModelFields);
|
|
@@ -715,6 +772,7 @@ var ProductFunctionModelFields = {
|
|
|
715
772
|
descriptions: "descriptions",
|
|
716
773
|
synonyms: "synonyms",
|
|
717
774
|
packages: "packages",
|
|
775
|
+
hasInformationUnits: "hasInformationUnits",
|
|
718
776
|
links: "links"
|
|
719
777
|
};
|
|
720
778
|
var ProductFunctionModelFieldsAll = Object.values(ProductFunctionModelFields);
|
|
@@ -728,6 +786,7 @@ var ProductLcpAfterUseModelFields = {
|
|
|
728
786
|
descriptions: "descriptions",
|
|
729
787
|
synonyms: "synonyms",
|
|
730
788
|
packages: "packages",
|
|
789
|
+
hasInformationUnits: "hasInformationUnits",
|
|
731
790
|
links: "links"
|
|
732
791
|
};
|
|
733
792
|
var ProductLcpAfterUseModelFieldsAll = Object.values(ProductLcpAfterUseModelFields);
|
|
@@ -741,6 +800,7 @@ var ProductLcpDesignAndRealizationModelFields = {
|
|
|
741
800
|
descriptions: "descriptions",
|
|
742
801
|
synonyms: "synonyms",
|
|
743
802
|
packages: "packages",
|
|
803
|
+
hasInformationUnits: "hasInformationUnits",
|
|
744
804
|
links: "links"
|
|
745
805
|
};
|
|
746
806
|
var ProductLcpDesignAndRealizationModelFieldsAll = Object.values(ProductLcpDesignAndRealizationModelFields);
|
|
@@ -754,6 +814,7 @@ var ProductLcpPuttingToUseModelFields = {
|
|
|
754
814
|
descriptions: "descriptions",
|
|
755
815
|
synonyms: "synonyms",
|
|
756
816
|
packages: "packages",
|
|
817
|
+
hasInformationUnits: "hasInformationUnits",
|
|
757
818
|
links: "links"
|
|
758
819
|
};
|
|
759
820
|
var ProductLcpPuttingToUseModelFieldsAll = Object.values(ProductLcpPuttingToUseModelFields);
|
|
@@ -767,6 +828,7 @@ var ProductLcpUseModelFields = {
|
|
|
767
828
|
descriptions: "descriptions",
|
|
768
829
|
synonyms: "synonyms",
|
|
769
830
|
packages: "packages",
|
|
831
|
+
hasInformationUnits: "hasInformationUnits",
|
|
770
832
|
links: "links"
|
|
771
833
|
};
|
|
772
834
|
var ProductLcpUseModelFieldsAll = Object.values(ProductLcpUseModelFields);
|
|
@@ -780,6 +842,7 @@ var ProductLifeCyclePhaseModelFields = {
|
|
|
780
842
|
descriptions: "descriptions",
|
|
781
843
|
synonyms: "synonyms",
|
|
782
844
|
packages: "packages",
|
|
845
|
+
hasInformationUnits: "hasInformationUnits",
|
|
783
846
|
links: "links"
|
|
784
847
|
};
|
|
785
848
|
var ProductLifeCyclePhaseModelFieldsAll = Object.values(ProductLifeCyclePhaseModelFields);
|
|
@@ -793,6 +856,7 @@ var ProductMetadataModelFields = {
|
|
|
793
856
|
descriptions: "descriptions",
|
|
794
857
|
synonyms: "synonyms",
|
|
795
858
|
packages: "packages",
|
|
859
|
+
hasInformationUnits: "hasInformationUnits",
|
|
796
860
|
links: "links"
|
|
797
861
|
};
|
|
798
862
|
var ProductMetadataModelFieldsAll = Object.values(ProductMetadataModelFields);
|
|
@@ -806,6 +870,7 @@ var ProductPropertyModelFields = {
|
|
|
806
870
|
descriptions: "descriptions",
|
|
807
871
|
synonyms: "synonyms",
|
|
808
872
|
packages: "packages",
|
|
873
|
+
hasInformationUnits: "hasInformationUnits",
|
|
809
874
|
links: "links"
|
|
810
875
|
};
|
|
811
876
|
var ProductPropertyModelFieldsAll = Object.values(ProductPropertyModelFields);
|
|
@@ -819,6 +884,7 @@ var ProductVariantModelFields = {
|
|
|
819
884
|
descriptions: "descriptions",
|
|
820
885
|
synonyms: "synonyms",
|
|
821
886
|
packages: "packages",
|
|
887
|
+
hasInformationUnits: "hasInformationUnits",
|
|
822
888
|
links: "links",
|
|
823
889
|
identities: "identities",
|
|
824
890
|
parties: "parties"
|
|
@@ -834,6 +900,7 @@ var QualificationModelFields = {
|
|
|
834
900
|
descriptions: "descriptions",
|
|
835
901
|
synonyms: "synonyms",
|
|
836
902
|
packages: "packages",
|
|
903
|
+
hasInformationUnits: "hasInformationUnits",
|
|
837
904
|
links: "links"
|
|
838
905
|
};
|
|
839
906
|
var QualificationModelFieldsAll = Object.values(QualificationModelFields);
|
|
@@ -847,6 +914,7 @@ var QualificationRoleModelFields = {
|
|
|
847
914
|
descriptions: "descriptions",
|
|
848
915
|
synonyms: "synonyms",
|
|
849
916
|
packages: "packages",
|
|
917
|
+
hasInformationUnits: "hasInformationUnits",
|
|
850
918
|
links: "links"
|
|
851
919
|
};
|
|
852
920
|
var QualificationRoleModelFieldsAll = Object.values(QualificationRoleModelFields);
|
|
@@ -860,6 +928,7 @@ var QualificationSkillLevelModelFields = {
|
|
|
860
928
|
descriptions: "descriptions",
|
|
861
929
|
synonyms: "synonyms",
|
|
862
930
|
packages: "packages",
|
|
931
|
+
hasInformationUnits: "hasInformationUnits",
|
|
863
932
|
links: "links"
|
|
864
933
|
};
|
|
865
934
|
var QualificationSkillLevelModelFieldsAll = Object.values(QualificationSkillLevelModelFields);
|
|
@@ -873,6 +942,7 @@ var RenditionModelFields = {
|
|
|
873
942
|
descriptions: "descriptions",
|
|
874
943
|
synonyms: "synonyms",
|
|
875
944
|
packages: "packages",
|
|
945
|
+
hasInformationUnits: "hasInformationUnits",
|
|
876
946
|
links: "links",
|
|
877
947
|
source: "source",
|
|
878
948
|
format: "format",
|
|
@@ -890,7 +960,8 @@ var RenditionSelectorModelFields = {
|
|
|
890
960
|
comments: "comments",
|
|
891
961
|
descriptions: "descriptions",
|
|
892
962
|
synonyms: "synonyms",
|
|
893
|
-
packages: "packages"
|
|
963
|
+
packages: "packages",
|
|
964
|
+
hasInformationUnits: "hasInformationUnits"
|
|
894
965
|
};
|
|
895
966
|
var RenditionSelectorModelFieldsAll = Object.values(RenditionSelectorModelFields);
|
|
896
967
|
var SupplyConsumableModelFields = {
|
|
@@ -903,6 +974,7 @@ var SupplyConsumableModelFields = {
|
|
|
903
974
|
descriptions: "descriptions",
|
|
904
975
|
synonyms: "synonyms",
|
|
905
976
|
packages: "packages",
|
|
977
|
+
hasInformationUnits: "hasInformationUnits",
|
|
906
978
|
links: "links"
|
|
907
979
|
};
|
|
908
980
|
var SupplyConsumableModelFieldsAll = Object.values(SupplyConsumableModelFields);
|
|
@@ -916,6 +988,7 @@ var SupplyHardwareToolModelFields = {
|
|
|
916
988
|
descriptions: "descriptions",
|
|
917
989
|
synonyms: "synonyms",
|
|
918
990
|
packages: "packages",
|
|
991
|
+
hasInformationUnits: "hasInformationUnits",
|
|
919
992
|
links: "links"
|
|
920
993
|
};
|
|
921
994
|
var SupplyHardwareToolModelFieldsAll = Object.values(SupplyHardwareToolModelFields);
|
|
@@ -929,6 +1002,7 @@ var SupplyLubricantModelFields = {
|
|
|
929
1002
|
descriptions: "descriptions",
|
|
930
1003
|
synonyms: "synonyms",
|
|
931
1004
|
packages: "packages",
|
|
1005
|
+
hasInformationUnits: "hasInformationUnits",
|
|
932
1006
|
links: "links"
|
|
933
1007
|
};
|
|
934
1008
|
var SupplyLubricantModelFieldsAll = Object.values(SupplyLubricantModelFields);
|
|
@@ -942,6 +1016,7 @@ var SupplyModelFields = {
|
|
|
942
1016
|
descriptions: "descriptions",
|
|
943
1017
|
synonyms: "synonyms",
|
|
944
1018
|
packages: "packages",
|
|
1019
|
+
hasInformationUnits: "hasInformationUnits",
|
|
945
1020
|
links: "links"
|
|
946
1021
|
};
|
|
947
1022
|
var SupplyModelFieldsAll = Object.values(SupplyModelFields);
|
|
@@ -955,6 +1030,7 @@ var SupplyOperatingModelFields = {
|
|
|
955
1030
|
descriptions: "descriptions",
|
|
956
1031
|
synonyms: "synonyms",
|
|
957
1032
|
packages: "packages",
|
|
1033
|
+
hasInformationUnits: "hasInformationUnits",
|
|
958
1034
|
links: "links"
|
|
959
1035
|
};
|
|
960
1036
|
var SupplyOperatingModelFieldsAll = Object.values(SupplyOperatingModelFields);
|
|
@@ -968,6 +1044,7 @@ var SupplySparePartModelFields = {
|
|
|
968
1044
|
descriptions: "descriptions",
|
|
969
1045
|
synonyms: "synonyms",
|
|
970
1046
|
packages: "packages",
|
|
1047
|
+
hasInformationUnits: "hasInformationUnits",
|
|
971
1048
|
links: "links"
|
|
972
1049
|
};
|
|
973
1050
|
var SupplySparePartModelFieldsAll = Object.values(SupplySparePartModelFields);
|
|
@@ -981,6 +1058,7 @@ var TopicModelFields = {
|
|
|
981
1058
|
descriptions: "descriptions",
|
|
982
1059
|
synonyms: "synonyms",
|
|
983
1060
|
packages: "packages",
|
|
1061
|
+
hasInformationUnits: "hasInformationUnits",
|
|
984
1062
|
links: "links",
|
|
985
1063
|
revision: "revision",
|
|
986
1064
|
created: "created",
|
|
@@ -1022,6 +1100,7 @@ var TopicTypeConceptModelFields = {
|
|
|
1022
1100
|
descriptions: "descriptions",
|
|
1023
1101
|
synonyms: "synonyms",
|
|
1024
1102
|
packages: "packages",
|
|
1103
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1025
1104
|
links: "links"
|
|
1026
1105
|
};
|
|
1027
1106
|
var TopicTypeConceptModelFieldsAll = Object.values(TopicTypeConceptModelFields);
|
|
@@ -1035,6 +1114,7 @@ var TopicTypeFormModelFields = {
|
|
|
1035
1114
|
descriptions: "descriptions",
|
|
1036
1115
|
synonyms: "synonyms",
|
|
1037
1116
|
packages: "packages",
|
|
1117
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1038
1118
|
links: "links"
|
|
1039
1119
|
};
|
|
1040
1120
|
var TopicTypeFormModelFieldsAll = Object.values(TopicTypeFormModelFields);
|
|
@@ -1048,6 +1128,7 @@ var TopicTypeLearningModelFields = {
|
|
|
1048
1128
|
descriptions: "descriptions",
|
|
1049
1129
|
synonyms: "synonyms",
|
|
1050
1130
|
packages: "packages",
|
|
1131
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1051
1132
|
links: "links"
|
|
1052
1133
|
};
|
|
1053
1134
|
var TopicTypeLearningModelFieldsAll = Object.values(TopicTypeLearningModelFields);
|
|
@@ -1061,6 +1142,7 @@ var TopicTypeModelFields = {
|
|
|
1061
1142
|
descriptions: "descriptions",
|
|
1062
1143
|
synonyms: "synonyms",
|
|
1063
1144
|
packages: "packages",
|
|
1145
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1064
1146
|
links: "links"
|
|
1065
1147
|
};
|
|
1066
1148
|
var TopicTypeModelFieldsAll = Object.values(TopicTypeModelFields);
|
|
@@ -1074,6 +1156,7 @@ var TopicTypeReferenceModelFields = {
|
|
|
1074
1156
|
descriptions: "descriptions",
|
|
1075
1157
|
synonyms: "synonyms",
|
|
1076
1158
|
packages: "packages",
|
|
1159
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1077
1160
|
links: "links"
|
|
1078
1161
|
};
|
|
1079
1162
|
var TopicTypeReferenceModelFieldsAll = Object.values(TopicTypeReferenceModelFields);
|
|
@@ -1087,6 +1170,7 @@ var TopicTypeTaskModelFields = {
|
|
|
1087
1170
|
descriptions: "descriptions",
|
|
1088
1171
|
synonyms: "synonyms",
|
|
1089
1172
|
packages: "packages",
|
|
1173
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1090
1174
|
links: "links"
|
|
1091
1175
|
};
|
|
1092
1176
|
var TopicTypeTaskModelFieldsAll = Object.values(TopicTypeTaskModelFields);
|
|
@@ -1100,6 +1184,7 @@ var TopicTypeTroubleShootingModelFields = {
|
|
|
1100
1184
|
descriptions: "descriptions",
|
|
1101
1185
|
synonyms: "synonyms",
|
|
1102
1186
|
packages: "packages",
|
|
1187
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1103
1188
|
links: "links"
|
|
1104
1189
|
};
|
|
1105
1190
|
var TopicTypeTroubleShootingModelFieldsAll = Object.values(TopicTypeTroubleShootingModelFields);
|
|
@@ -1113,6 +1198,7 @@ var VCardCalendarModelFields = {
|
|
|
1113
1198
|
descriptions: "descriptions",
|
|
1114
1199
|
synonyms: "synonyms",
|
|
1115
1200
|
packages: "packages",
|
|
1201
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1116
1202
|
source: "source"
|
|
1117
1203
|
};
|
|
1118
1204
|
var VCardCalendarModelFieldsAll = Object.values(VCardCalendarModelFields);
|
|
@@ -1126,6 +1212,7 @@ var VCardGroupModelFields = {
|
|
|
1126
1212
|
descriptions: "descriptions",
|
|
1127
1213
|
synonyms: "synonyms",
|
|
1128
1214
|
packages: "packages",
|
|
1215
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1129
1216
|
links: "links",
|
|
1130
1217
|
fullName: "fullName",
|
|
1131
1218
|
photos: "photos",
|
|
@@ -1147,6 +1234,7 @@ var VCardImageModelFields = {
|
|
|
1147
1234
|
descriptions: "descriptions",
|
|
1148
1235
|
synonyms: "synonyms",
|
|
1149
1236
|
packages: "packages",
|
|
1237
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1150
1238
|
classes: "classes",
|
|
1151
1239
|
value: "value",
|
|
1152
1240
|
source: "source"
|
|
@@ -1162,6 +1250,7 @@ var VCardIndividualModelFields = {
|
|
|
1162
1250
|
descriptions: "descriptions",
|
|
1163
1251
|
synonyms: "synonyms",
|
|
1164
1252
|
packages: "packages",
|
|
1253
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1165
1254
|
links: "links",
|
|
1166
1255
|
fullName: "fullName",
|
|
1167
1256
|
photos: "photos",
|
|
@@ -1180,6 +1269,7 @@ var VCardInfoModelFields = {
|
|
|
1180
1269
|
shortId: "shortId",
|
|
1181
1270
|
score: "score",
|
|
1182
1271
|
classes: "classes",
|
|
1272
|
+
types: "types",
|
|
1183
1273
|
value: "value",
|
|
1184
1274
|
countryName: "countryName",
|
|
1185
1275
|
locality: "locality",
|
|
@@ -1197,6 +1287,7 @@ var VCardLocationModelFields = {
|
|
|
1197
1287
|
descriptions: "descriptions",
|
|
1198
1288
|
synonyms: "synonyms",
|
|
1199
1289
|
packages: "packages",
|
|
1290
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1200
1291
|
links: "links",
|
|
1201
1292
|
fullName: "fullName",
|
|
1202
1293
|
photos: "photos",
|
|
@@ -1218,6 +1309,7 @@ var VCardModelFields = {
|
|
|
1218
1309
|
descriptions: "descriptions",
|
|
1219
1310
|
synonyms: "synonyms",
|
|
1220
1311
|
packages: "packages",
|
|
1312
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1221
1313
|
links: "links",
|
|
1222
1314
|
fullName: "fullName",
|
|
1223
1315
|
photos: "photos",
|
|
@@ -1238,6 +1330,7 @@ var VCardOrganizationModelFields = {
|
|
|
1238
1330
|
descriptions: "descriptions",
|
|
1239
1331
|
synonyms: "synonyms",
|
|
1240
1332
|
packages: "packages",
|
|
1333
|
+
hasInformationUnits: "hasInformationUnits",
|
|
1241
1334
|
links: "links",
|
|
1242
1335
|
fullName: "fullName",
|
|
1243
1336
|
photos: "photos",
|
|
@@ -1268,15 +1361,24 @@ var CREX_TOKEN_HEADER_KEY = "crex-token";
|
|
|
1268
1361
|
|
|
1269
1362
|
// src/requests.ts
|
|
1270
1363
|
import { cookies as cookies2 } from "next/headers";
|
|
1364
|
+
import { revalidateTag } from "next/cache";
|
|
1365
|
+
import { NextResponse } from "next/server";
|
|
1366
|
+
import { appendFileSync, mkdirSync } from "fs";
|
|
1367
|
+
import { dirname } from "path";
|
|
1271
1368
|
|
|
1272
1369
|
// src/logger.ts
|
|
1273
1370
|
import winston from "winston";
|
|
1274
1371
|
|
|
1275
1372
|
// src/transports/matomo.ts
|
|
1276
1373
|
import Transport from "winston-transport";
|
|
1374
|
+
import axios from "axios";
|
|
1375
|
+
import https from "https";
|
|
1376
|
+
import { readFileSync } from "fs";
|
|
1277
1377
|
var MatomoTransport = class extends Transport {
|
|
1278
|
-
matomoTransport;
|
|
1279
1378
|
configs;
|
|
1379
|
+
endpointUrl;
|
|
1380
|
+
httpsAgent;
|
|
1381
|
+
enabled;
|
|
1280
1382
|
/**
|
|
1281
1383
|
* Creates a new instance of MatomoTransport.
|
|
1282
1384
|
*
|
|
@@ -1287,8 +1389,18 @@ var MatomoTransport = class extends Transport {
|
|
|
1287
1389
|
level: configs.logs.matomo.minimumLevel,
|
|
1288
1390
|
silent: configs.logs.matomo.silent
|
|
1289
1391
|
});
|
|
1290
|
-
this.matomoTransport = new Transport();
|
|
1291
1392
|
this.configs = configs;
|
|
1393
|
+
const rawHost = configs.logs.matomo.hostname?.trim();
|
|
1394
|
+
this.enabled = !!rawHost;
|
|
1395
|
+
const normalizedHost = rawHost ? rawHost.replace(/^https?:\/\//i, "") : "";
|
|
1396
|
+
const hasPort = typeof configs.logs.matomo.port === "number" && configs.logs.matomo.port > 0;
|
|
1397
|
+
this.endpointUrl = this.enabled ? `https://${normalizedHost}${hasPort ? `:${configs.logs.matomo.port}` : ""}/matomo.php` : "";
|
|
1398
|
+
const rejectUnauthorized = process.env.LOG_MATOMO_TLS_REJECT_UNAUTHORIZED !== "false";
|
|
1399
|
+
const caFile = process.env.LOG_MATOMO_TLS_CA_FILE?.trim();
|
|
1400
|
+
this.httpsAgent = new https.Agent({
|
|
1401
|
+
rejectUnauthorized,
|
|
1402
|
+
ca: caFile ? readFileSync(caFile) : void 0
|
|
1403
|
+
});
|
|
1292
1404
|
}
|
|
1293
1405
|
/**
|
|
1294
1406
|
* Logs a message to Matomo if the message category is included in the configured categories.
|
|
@@ -1298,18 +1410,67 @@ var MatomoTransport = class extends Transport {
|
|
|
1298
1410
|
*/
|
|
1299
1411
|
log(info, callback) {
|
|
1300
1412
|
const matomoCategory = this.configs.logs.matomo.categoriesLevel;
|
|
1301
|
-
|
|
1302
|
-
|
|
1413
|
+
const category = info.category ?? "Scenario";
|
|
1414
|
+
if (!info.category || matomoCategory.includes(info.category) || matomoCategory.includes(ALL)) {
|
|
1415
|
+
if (!this.enabled) {
|
|
1416
|
+
callback();
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
const siteId = this.configs.logs.matomo.siteId ?? 1;
|
|
1420
|
+
const tokenAuth = this.configs.logs.matomo.tokenAuth;
|
|
1421
|
+
const requestParams = new URLSearchParams({
|
|
1422
|
+
idsite: String(siteId),
|
|
1423
|
+
rec: "1",
|
|
1424
|
+
apiv: "1",
|
|
1425
|
+
action_name: info.message,
|
|
1426
|
+
e_c: category,
|
|
1427
|
+
e_a: info.level,
|
|
1428
|
+
e_n: info.message.slice(0, 120),
|
|
1429
|
+
url: process.env.NEXT_PUBLIC_API_URL || process.env.NEXT_URL || this.configs.baseUrl,
|
|
1430
|
+
rand: `${Date.now()}`,
|
|
1431
|
+
cdh: "0",
|
|
1432
|
+
cdm: "0",
|
|
1433
|
+
cds: "0"
|
|
1434
|
+
});
|
|
1435
|
+
if (tokenAuth && tokenAuth.trim().length > 0) {
|
|
1436
|
+
requestParams.append("token_auth", tokenAuth.trim());
|
|
1437
|
+
}
|
|
1438
|
+
void axios.post(this.endpointUrl, requestParams.toString(), {
|
|
1439
|
+
timeout: 4e3,
|
|
1440
|
+
httpsAgent: this.httpsAgent,
|
|
1441
|
+
headers: {
|
|
1442
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1443
|
+
}
|
|
1444
|
+
}).catch((error) => {
|
|
1445
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1446
|
+
console.error(`[MatomoTransport] Failed to post log to ${this.endpointUrl}: ${message}`);
|
|
1447
|
+
});
|
|
1448
|
+
callback();
|
|
1449
|
+
return;
|
|
1303
1450
|
}
|
|
1451
|
+
callback();
|
|
1304
1452
|
}
|
|
1305
1453
|
};
|
|
1306
1454
|
|
|
1307
1455
|
// src/transports/graylog.ts
|
|
1308
1456
|
import Transport2 from "winston-transport";
|
|
1309
|
-
import
|
|
1457
|
+
import axios2 from "axios";
|
|
1458
|
+
import https2 from "https";
|
|
1459
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
1310
1460
|
var GraylogTransport = class extends Transport2 {
|
|
1311
|
-
graylogTransport;
|
|
1312
1461
|
configs;
|
|
1462
|
+
endpointUrl;
|
|
1463
|
+
httpsAgent;
|
|
1464
|
+
levelToSyslog = {
|
|
1465
|
+
critical: 2,
|
|
1466
|
+
error: 3,
|
|
1467
|
+
warning: 4,
|
|
1468
|
+
info: 6,
|
|
1469
|
+
debug: 7
|
|
1470
|
+
};
|
|
1471
|
+
resolveDomain() {
|
|
1472
|
+
return process.env.NEXT_PUBLIC_API_URL?.trim() || process.env.NEXT_URL?.trim() || this.configs.baseUrl;
|
|
1473
|
+
}
|
|
1313
1474
|
/**
|
|
1314
1475
|
* Creates a new instance of GraylogTransport.
|
|
1315
1476
|
*
|
|
@@ -1319,20 +1480,18 @@ var GraylogTransport = class extends Transport2 {
|
|
|
1319
1480
|
if (!configs.logs.graylog.hostname || configs.logs.graylog.port === void 0) {
|
|
1320
1481
|
throw new Error("Graylog hostname and port must be defined");
|
|
1321
1482
|
}
|
|
1483
|
+
const normalizedHost = configs.logs.graylog.hostname.replace(/^https?:\/\//i, "");
|
|
1322
1484
|
super({
|
|
1323
1485
|
level: configs.logs.graylog.minimumLevel,
|
|
1324
1486
|
silent: configs.logs.graylog.silent
|
|
1325
1487
|
});
|
|
1326
1488
|
this.configs = configs;
|
|
1327
|
-
this.
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
{ host: configs.logs.graylog.hostname, port: configs.logs.graylog.port }
|
|
1334
|
-
]
|
|
1335
|
-
}
|
|
1489
|
+
this.endpointUrl = `https://${normalizedHost}:${configs.logs.graylog.port}/gelf`;
|
|
1490
|
+
const rejectUnauthorized = process.env.LOG_GRAYLOG_TLS_REJECT_UNAUTHORIZED !== "false";
|
|
1491
|
+
const caFile = process.env.LOG_GRAYLOG_TLS_CA_FILE?.trim();
|
|
1492
|
+
this.httpsAgent = new https2.Agent({
|
|
1493
|
+
rejectUnauthorized,
|
|
1494
|
+
ca: caFile ? readFileSync2(caFile) : void 0
|
|
1336
1495
|
});
|
|
1337
1496
|
}
|
|
1338
1497
|
/**
|
|
@@ -1343,9 +1502,40 @@ var GraylogTransport = class extends Transport2 {
|
|
|
1343
1502
|
*/
|
|
1344
1503
|
log(info, callback) {
|
|
1345
1504
|
const graylogCategory = this.configs.logs.graylog.categoriesLevel;
|
|
1346
|
-
if (graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {
|
|
1347
|
-
|
|
1505
|
+
if (!info.category || graylogCategory.includes(info.category) || graylogCategory.includes(ALL)) {
|
|
1506
|
+
const timestamp = /* @__PURE__ */ new Date();
|
|
1507
|
+
const level = String(info.level).toLowerCase();
|
|
1508
|
+
const syslogLevel = this.levelToSyslog[level] ?? 6;
|
|
1509
|
+
const category = info.category ?? "Scenario";
|
|
1510
|
+
void axios2.post(this.endpointUrl, {
|
|
1511
|
+
// GELF-compatible core fields
|
|
1512
|
+
version: "1.1",
|
|
1513
|
+
host: this.configs.logs.graylog.app,
|
|
1514
|
+
short_message: info.message,
|
|
1515
|
+
full_message: info.message,
|
|
1516
|
+
timestamp: timestamp.getTime() / 1e3,
|
|
1517
|
+
level: syslogLevel,
|
|
1518
|
+
facility: this.configs.logs.graylog.app,
|
|
1519
|
+
// Legacy/classic compatibility fields
|
|
1520
|
+
message: info.message,
|
|
1521
|
+
stringLevel: level,
|
|
1522
|
+
category,
|
|
1523
|
+
Application: this.configs.logs.graylog.app,
|
|
1524
|
+
Domain: this.resolveDomain()
|
|
1525
|
+
}, {
|
|
1526
|
+
timeout: 4e3,
|
|
1527
|
+
httpsAgent: this.httpsAgent,
|
|
1528
|
+
headers: {
|
|
1529
|
+
"Content-Type": "application/json"
|
|
1530
|
+
}
|
|
1531
|
+
}).catch((error) => {
|
|
1532
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1533
|
+
console.error(`[GraylogTransport] Failed to post log to ${this.endpointUrl}: ${message}`);
|
|
1534
|
+
});
|
|
1535
|
+
callback();
|
|
1536
|
+
return;
|
|
1348
1537
|
}
|
|
1538
|
+
callback();
|
|
1349
1539
|
}
|
|
1350
1540
|
};
|
|
1351
1541
|
|
|
@@ -1392,6 +1582,23 @@ var generateWarnings = (vars) => {
|
|
|
1392
1582
|
});
|
|
1393
1583
|
return warnings;
|
|
1394
1584
|
};
|
|
1585
|
+
var normalizeGraylogHostname = (rawHostname) => {
|
|
1586
|
+
if (!rawHostname) return void 0;
|
|
1587
|
+
const trimmed = rawHostname.trim();
|
|
1588
|
+
if (trimmed.length === 0) return void 0;
|
|
1589
|
+
if (trimmed.includes("://")) {
|
|
1590
|
+
try {
|
|
1591
|
+
return new URL(trimmed).hostname;
|
|
1592
|
+
} catch {
|
|
1593
|
+
return trimmed;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
const firstColon = trimmed.indexOf(":");
|
|
1597
|
+
if (firstColon > -1 && !trimmed.includes("]")) {
|
|
1598
|
+
return trimmed.slice(0, firstColon);
|
|
1599
|
+
}
|
|
1600
|
+
return trimmed;
|
|
1601
|
+
};
|
|
1395
1602
|
var createUserOIDCConfig = () => {
|
|
1396
1603
|
const warnings = [];
|
|
1397
1604
|
const userDefaults = {
|
|
@@ -1495,17 +1702,17 @@ var createGraylogLoggerConfig = (projectName) => {
|
|
|
1495
1702
|
app: `NextJs-Project-${projectName}`,
|
|
1496
1703
|
minimumLevel: "info",
|
|
1497
1704
|
silent: false,
|
|
1498
|
-
hostname: "
|
|
1705
|
+
hostname: "log.c-rex.net",
|
|
1499
1706
|
port: 12202,
|
|
1500
1707
|
categoriesLevel: ["NoLicense", "Scenario", "Document", "Search", "Notification", "History", "UserProfile"]
|
|
1501
1708
|
};
|
|
1502
1709
|
const graylogEnvs = {
|
|
1503
1710
|
app: process.env.LOG_GRAYLOG_APP_NAME,
|
|
1504
1711
|
silent: process.env.LOG_GRAYLOG_SILENT == void 0 ? void 0 : process.env.LOG_GRAYLOG_SILENT == "true",
|
|
1505
|
-
hostname: process.env.LOG_GRAYLOG_HOSTNAME,
|
|
1712
|
+
hostname: normalizeGraylogHostname(process.env.LOG_GRAYLOG_HOSTNAME),
|
|
1506
1713
|
port: process.env.LOG_GRAYLOG_PORT == void 0 ? void 0 : Number(process.env.LOG_GRAYLOG_PORT),
|
|
1507
1714
|
minimumLevel: process.env.LOG_GRAYLOG_LEVEL,
|
|
1508
|
-
categoriesLevel: process.env.LOG_GRAYLOG_CATEGORIES == void 0 ? void 0 : process.env.LOG_GRAYLOG_CATEGORIES.split(",")
|
|
1715
|
+
categoriesLevel: process.env.LOG_GRAYLOG_CATEGORIES == void 0 ? void 0 : process.env.LOG_GRAYLOG_CATEGORIES.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0)
|
|
1509
1716
|
};
|
|
1510
1717
|
const graylog = mergeConfigs(graylogDefaults, graylogEnvs);
|
|
1511
1718
|
if (graylog.silent == false) {
|
|
@@ -1533,21 +1740,26 @@ var createMatomoLoggerConfig = (projectName) => {
|
|
|
1533
1740
|
silent: true,
|
|
1534
1741
|
hostname: "",
|
|
1535
1742
|
port: 0,
|
|
1743
|
+
siteId: 1,
|
|
1744
|
+
tokenAuth: void 0,
|
|
1536
1745
|
categoriesLevel: ["NoLicense", "Scenario", "Document", "Search", "Notification", "History", "UserProfile"]
|
|
1537
1746
|
};
|
|
1538
1747
|
const matomoEnvs = {
|
|
1539
1748
|
app: process.env.LOG_MATOMO_APP_NAME,
|
|
1540
1749
|
silent: process.env.LOG_MATOMO_SILENT == void 0 ? void 0 : process.env.LOG_MATOMO_SILENT == "true",
|
|
1541
|
-
hostname: process.env.LOG_MATOMO_HOSTNAME,
|
|
1750
|
+
hostname: normalizeGraylogHostname(process.env.LOG_MATOMO_HOSTNAME),
|
|
1542
1751
|
port: process.env.LOG_MATOMO_PORT == void 0 ? void 0 : Number(process.env.LOG_MATOMO_PORT),
|
|
1752
|
+
siteId: process.env.LOG_MATOMO_SITE_ID == void 0 ? void 0 : Number(process.env.LOG_MATOMO_SITE_ID),
|
|
1753
|
+
tokenAuth: process.env.LOG_MATOMO_TOKEN_AUTH,
|
|
1543
1754
|
minimumLevel: process.env.LOG_MATOMO_LEVEL,
|
|
1544
|
-
categoriesLevel: process.env.LOG_MATOMO_CATEGORIES == void 0 ? void 0 : process.env.LOG_MATOMO_CATEGORIES.split(",")
|
|
1755
|
+
categoriesLevel: process.env.LOG_MATOMO_CATEGORIES == void 0 ? void 0 : process.env.LOG_MATOMO_CATEGORIES.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0)
|
|
1545
1756
|
};
|
|
1546
1757
|
const matomo = mergeConfigs(matomoDefaults, matomoEnvs);
|
|
1547
1758
|
const matomoSilentVars = [
|
|
1548
1759
|
{ key: "LOG_MATOMO_SILENT", value: process.env.LOG_MATOMO_SILENT },
|
|
1549
1760
|
{ key: "LOG_MATOMO_HOSTNAME", value: process.env.LOG_MATOMO_HOSTNAME },
|
|
1550
|
-
{ key: "LOG_MATOMO_PORT", value: process.env.LOG_MATOMO_PORT }
|
|
1761
|
+
{ key: "LOG_MATOMO_PORT", value: process.env.LOG_MATOMO_PORT },
|
|
1762
|
+
{ key: "LOG_MATOMO_SITE_ID", value: process.env.LOG_MATOMO_SITE_ID }
|
|
1551
1763
|
];
|
|
1552
1764
|
matomoSilentVars.forEach((variable) => {
|
|
1553
1765
|
if (variable.value === void 0) {
|
|
@@ -1739,7 +1951,11 @@ var CrexLogger = class {
|
|
|
1739
1951
|
await this.initLogger();
|
|
1740
1952
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
1741
1953
|
const newMessage = `[${timestamp}] ${message}`;
|
|
1742
|
-
this.logger.log(
|
|
1954
|
+
this.logger.log({
|
|
1955
|
+
level,
|
|
1956
|
+
message: newMessage,
|
|
1957
|
+
category
|
|
1958
|
+
});
|
|
1743
1959
|
}
|
|
1744
1960
|
/**
|
|
1745
1961
|
* Creates a new Winston logger instance with configured transports.
|
|
@@ -1788,10 +2004,405 @@ var getToken = async () => {
|
|
|
1788
2004
|
};
|
|
1789
2005
|
|
|
1790
2006
|
// src/requests.ts
|
|
2007
|
+
import { createRemoteJWKSet, errors as joseErrors, jwtVerify } from "jose";
|
|
2008
|
+
var AREA_PREFIX_PATTERN = /^(ids|iirds|iirdsmch|rdf|vcard|crex)\/v1\//i;
|
|
2009
|
+
var CREX_API_CACHE_TAG = "crex-api";
|
|
2010
|
+
var CREX_API_CACHE_VCARD_TAG = "crex-api:vcard";
|
|
2011
|
+
var CREX_READMODEL_CACHE_TAG = "crex-readmodel";
|
|
2012
|
+
var CREX_READMODEL_CACHE_VCARD_TAG = "crex-readmodel:vcard";
|
|
2013
|
+
var CREX_READMODEL_CACHE_METADATA_TAG = "crex-readmodel:metadata";
|
|
2014
|
+
var CREX_READMODEL_CACHE_ORGANIZATION_TAG = "crex-readmodel:organization";
|
|
2015
|
+
var CREX_READMODEL_CACHE_INFORMATION_SUBJECTS_TAG = "crex-readmodel:information-subjects";
|
|
2016
|
+
var CREX_READMODEL_CACHE_DOCUMENT_TYPES_TAG = "crex-readmodel:document-types";
|
|
2017
|
+
var CREX_READMODEL_CACHE_COMPONENTS_TAG = "crex-readmodel:components";
|
|
2018
|
+
var CREX_READMODEL_CACHE_PARTIES_TAG = "crex-readmodel:parties";
|
|
2019
|
+
var CREX_CACHE_SEGMENT_ALL = "all";
|
|
2020
|
+
var CREX_CACHE_SEGMENT_METADATA = "metadata";
|
|
2021
|
+
var CREX_CACHE_SEGMENT_VCARD = "vcard";
|
|
2022
|
+
var CREX_CACHE_SEGMENT_REQUESTS = "requests";
|
|
2023
|
+
var CREX_CACHE_SEGMENT_TO_TAGS = {
|
|
2024
|
+
[CREX_CACHE_SEGMENT_VCARD]: [
|
|
2025
|
+
CREX_API_CACHE_VCARD_TAG,
|
|
2026
|
+
CREX_READMODEL_CACHE_VCARD_TAG,
|
|
2027
|
+
CREX_READMODEL_CACHE_ORGANIZATION_TAG
|
|
2028
|
+
],
|
|
2029
|
+
[CREX_CACHE_SEGMENT_METADATA]: [
|
|
2030
|
+
CREX_READMODEL_CACHE_METADATA_TAG,
|
|
2031
|
+
CREX_READMODEL_CACHE_TAG
|
|
2032
|
+
],
|
|
2033
|
+
[CREX_CACHE_SEGMENT_REQUESTS]: [
|
|
2034
|
+
CREX_API_CACHE_TAG,
|
|
2035
|
+
CREX_API_CACHE_VCARD_TAG
|
|
2036
|
+
],
|
|
2037
|
+
[CREX_CACHE_SEGMENT_ALL]: [
|
|
2038
|
+
CREX_API_CACHE_TAG,
|
|
2039
|
+
CREX_API_CACHE_VCARD_TAG,
|
|
2040
|
+
CREX_READMODEL_CACHE_TAG,
|
|
2041
|
+
CREX_READMODEL_CACHE_VCARD_TAG,
|
|
2042
|
+
CREX_READMODEL_CACHE_METADATA_TAG,
|
|
2043
|
+
CREX_READMODEL_CACHE_ORGANIZATION_TAG
|
|
2044
|
+
]
|
|
2045
|
+
};
|
|
2046
|
+
var resolveCacheTagsForSegments = (segments) => {
|
|
2047
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
2048
|
+
for (const rawSegment of segments) {
|
|
2049
|
+
const normalized = rawSegment.trim().toLowerCase();
|
|
2050
|
+
const mappedTags = CREX_CACHE_SEGMENT_TO_TAGS[normalized];
|
|
2051
|
+
if (!mappedTags) continue;
|
|
2052
|
+
mappedTags.forEach((tag) => resolved.add(tag));
|
|
2053
|
+
}
|
|
2054
|
+
return Array.from(resolved);
|
|
2055
|
+
};
|
|
2056
|
+
var getSupportedCacheSegments = () => [
|
|
2057
|
+
CREX_CACHE_SEGMENT_ALL,
|
|
2058
|
+
CREX_CACHE_SEGMENT_METADATA,
|
|
2059
|
+
CREX_CACHE_SEGMENT_VCARD,
|
|
2060
|
+
CREX_CACHE_SEGMENT_REQUESTS
|
|
2061
|
+
];
|
|
2062
|
+
var CacheClearAuthUnauthorizedError = class extends Error {
|
|
2063
|
+
constructor(message) {
|
|
2064
|
+
super(message);
|
|
2065
|
+
this.name = "CacheClearAuthUnauthorizedError";
|
|
2066
|
+
}
|
|
2067
|
+
};
|
|
2068
|
+
var CacheClearAuthConfigurationError = class extends Error {
|
|
2069
|
+
constructor(message) {
|
|
2070
|
+
super(message);
|
|
2071
|
+
this.name = "CacheClearAuthConfigurationError";
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
2074
|
+
var CACHE_CLEAR_JWT_DISCOVERY_PATH = "/.well-known/openid-configuration";
|
|
2075
|
+
var cacheClearIssuerDiscoveryCache = /* @__PURE__ */ new Map();
|
|
2076
|
+
var cacheClearIssuerJwksCache = /* @__PURE__ */ new Map();
|
|
2077
|
+
var trimTrailingSlashes = (value) => value.replace(/\/+$/, "");
|
|
2078
|
+
var normalizeIssuerForClaimValidation = (rawIssuer) => {
|
|
2079
|
+
const trimmed = rawIssuer.trim();
|
|
2080
|
+
if (!trimmed) return "";
|
|
2081
|
+
const normalized = trimTrailingSlashes(trimmed);
|
|
2082
|
+
const lowered = normalized.toLowerCase();
|
|
2083
|
+
const loweredSuffix = CACHE_CLEAR_JWT_DISCOVERY_PATH.toLowerCase();
|
|
2084
|
+
if (lowered.endsWith(loweredSuffix)) {
|
|
2085
|
+
return normalized.slice(0, normalized.length - CACHE_CLEAR_JWT_DISCOVERY_PATH.length);
|
|
2086
|
+
}
|
|
2087
|
+
return normalized;
|
|
2088
|
+
};
|
|
2089
|
+
var resolveCacheClearJwtConfig = () => {
|
|
2090
|
+
const sdk = new CrexSDK();
|
|
2091
|
+
let configIssuer = "";
|
|
2092
|
+
let configAudience = "";
|
|
2093
|
+
try {
|
|
2094
|
+
const serverConfig = sdk.getServerConfig();
|
|
2095
|
+
configIssuer = serverConfig.OIDC.user.issuer || serverConfig.OIDC.client.issuer || "";
|
|
2096
|
+
configAudience = serverConfig.OIDC.user.id || serverConfig.OIDC.client.id || "";
|
|
2097
|
+
} catch {
|
|
2098
|
+
}
|
|
2099
|
+
const issuer = normalizeIssuerForClaimValidation(
|
|
2100
|
+
process.env.CREX_CACHE_CLEAR_JWT_ISSUER || process.env.OIDC_ISSUER || configIssuer
|
|
2101
|
+
);
|
|
2102
|
+
const audience = (process.env.CREX_CACHE_CLEAR_JWT_AUDIENCE || process.env.CREX_IDS_CLIENT_ID || configAudience).trim();
|
|
2103
|
+
if (!issuer || !audience) {
|
|
2104
|
+
throw new CacheClearAuthConfigurationError(
|
|
2105
|
+
"JWT validation is not configured. Set OIDC_ISSUER and CREX_IDS_CLIENT_ID (or explicit cache-clear overrides)."
|
|
2106
|
+
);
|
|
2107
|
+
}
|
|
2108
|
+
return { issuer, audience };
|
|
2109
|
+
};
|
|
2110
|
+
var getCacheClearIssuerJwksUri = async (issuer) => {
|
|
2111
|
+
const cached = cacheClearIssuerDiscoveryCache.get(issuer);
|
|
2112
|
+
if (cached) return (await cached).jwksUri;
|
|
2113
|
+
const discoveryPromise = (async () => {
|
|
2114
|
+
const response = await fetch(`${issuer}${CACHE_CLEAR_JWT_DISCOVERY_PATH}`, {
|
|
2115
|
+
cache: "no-store"
|
|
2116
|
+
});
|
|
2117
|
+
if (!response.ok) {
|
|
2118
|
+
throw new CacheClearAuthConfigurationError(
|
|
2119
|
+
`OIDC discovery failed for cache-clear authorization: HTTP ${response.status}`
|
|
2120
|
+
);
|
|
2121
|
+
}
|
|
2122
|
+
const payload = await response.json();
|
|
2123
|
+
const jwksUri = payload.jwks_uri?.trim();
|
|
2124
|
+
if (!jwksUri) {
|
|
2125
|
+
throw new CacheClearAuthConfigurationError(
|
|
2126
|
+
"OIDC discovery payload for cache-clear authorization has no jwks_uri"
|
|
2127
|
+
);
|
|
2128
|
+
}
|
|
2129
|
+
return { jwksUri };
|
|
2130
|
+
})();
|
|
2131
|
+
cacheClearIssuerDiscoveryCache.set(issuer, discoveryPromise);
|
|
2132
|
+
try {
|
|
2133
|
+
return (await discoveryPromise).jwksUri;
|
|
2134
|
+
} catch (error) {
|
|
2135
|
+
cacheClearIssuerDiscoveryCache.delete(issuer);
|
|
2136
|
+
throw error;
|
|
2137
|
+
}
|
|
2138
|
+
};
|
|
2139
|
+
var getCacheClearIssuerJwks = async (issuer) => {
|
|
2140
|
+
const cached = cacheClearIssuerJwksCache.get(issuer);
|
|
2141
|
+
if (cached) return cached;
|
|
2142
|
+
const jwksUri = await getCacheClearIssuerJwksUri(issuer);
|
|
2143
|
+
const jwks = createRemoteJWKSet(new URL(jwksUri));
|
|
2144
|
+
cacheClearIssuerJwksCache.set(issuer, jwks);
|
|
2145
|
+
return jwks;
|
|
2146
|
+
};
|
|
2147
|
+
var verifyCacheClearBearerToken = async (token) => {
|
|
2148
|
+
if (!token) {
|
|
2149
|
+
throw new CacheClearAuthUnauthorizedError("missing bearer token");
|
|
2150
|
+
}
|
|
2151
|
+
const { issuer, audience } = resolveCacheClearJwtConfig();
|
|
2152
|
+
const jwks = await getCacheClearIssuerJwks(issuer);
|
|
2153
|
+
try {
|
|
2154
|
+
const verified = await jwtVerify(token, jwks, {
|
|
2155
|
+
issuer,
|
|
2156
|
+
audience
|
|
2157
|
+
});
|
|
2158
|
+
return verified.payload;
|
|
2159
|
+
} catch (error) {
|
|
2160
|
+
if (error instanceof joseErrors.JWTInvalid || error instanceof joseErrors.JOSEError) {
|
|
2161
|
+
throw new CacheClearAuthUnauthorizedError(
|
|
2162
|
+
error.message || "invalid jwt"
|
|
2163
|
+
);
|
|
2164
|
+
}
|
|
2165
|
+
throw error;
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
2168
|
+
var extractScopesFromJwtPayload = (payload) => {
|
|
2169
|
+
if (!payload) return [];
|
|
2170
|
+
const rawValues = [payload.scope, payload["crex-scope"], payload.crex_scope];
|
|
2171
|
+
const scopes = [];
|
|
2172
|
+
for (const rawValue of rawValues) {
|
|
2173
|
+
if (typeof rawValue === "string") {
|
|
2174
|
+
scopes.push(...rawValue.split(/\s+/).filter(Boolean));
|
|
2175
|
+
continue;
|
|
2176
|
+
}
|
|
2177
|
+
if (Array.isArray(rawValue)) {
|
|
2178
|
+
scopes.push(
|
|
2179
|
+
...rawValue.filter((item) => typeof item === "string" && item.trim().length > 0)
|
|
2180
|
+
);
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
return Array.from(new Set(scopes));
|
|
2184
|
+
};
|
|
2185
|
+
var CACHE_CLEAR_ALLOWED_ADMIN_SCOPE = "crex_sysadmin";
|
|
2186
|
+
var handleCacheClearPostRequest = async (req) => {
|
|
2187
|
+
const traceId = req.headers.get("x-request-id") || req.headers.get("x-correlation-id") || "n/a";
|
|
2188
|
+
const authHeader = req.headers.get("authorization") || "";
|
|
2189
|
+
const bearerToken = authHeader.startsWith("Bearer ") ? authHeader.slice("Bearer ".length).trim() : "";
|
|
2190
|
+
let scopes = [];
|
|
2191
|
+
try {
|
|
2192
|
+
const jwtPayload = await verifyCacheClearBearerToken(bearerToken);
|
|
2193
|
+
scopes = extractScopesFromJwtPayload(jwtPayload);
|
|
2194
|
+
} catch (error) {
|
|
2195
|
+
if (error instanceof CacheClearAuthUnauthorizedError) {
|
|
2196
|
+
console.warn("[cache-clear] unauthorized-invalid-jwt", {
|
|
2197
|
+
traceId,
|
|
2198
|
+
reason: error instanceof Error ? error.message : "jwt validation failed"
|
|
2199
|
+
});
|
|
2200
|
+
return NextResponse.json({ error: "unauthorized" }, { status: 401 });
|
|
2201
|
+
}
|
|
2202
|
+
if (error instanceof CacheClearAuthConfigurationError) {
|
|
2203
|
+
console.error("[cache-clear] auth-validation-error", {
|
|
2204
|
+
traceId,
|
|
2205
|
+
reason: error.message
|
|
2206
|
+
});
|
|
2207
|
+
return NextResponse.json({ error: "cache-clear auth misconfigured" }, { status: 500 });
|
|
2208
|
+
}
|
|
2209
|
+
console.error("[cache-clear] auth-validation-error", {
|
|
2210
|
+
traceId,
|
|
2211
|
+
reason: error instanceof Error ? error.message : "unknown error"
|
|
2212
|
+
});
|
|
2213
|
+
return NextResponse.json({ error: "internal error" }, { status: 500 });
|
|
2214
|
+
}
|
|
2215
|
+
if (!scopes.includes(CACHE_CLEAR_ALLOWED_ADMIN_SCOPE)) {
|
|
2216
|
+
console.warn("[cache-clear] forbidden", {
|
|
2217
|
+
traceId,
|
|
2218
|
+
scopeCount: scopes.length
|
|
2219
|
+
});
|
|
2220
|
+
return NextResponse.json({ error: "forbidden" }, { status: 403 });
|
|
2221
|
+
}
|
|
2222
|
+
const payload = await req.json().catch(() => ({}));
|
|
2223
|
+
const requestedSegments = payload.segments || [CREX_CACHE_SEGMENT_ALL];
|
|
2224
|
+
const tagsToClear = new Set(resolveCacheTagsForSegments(requestedSegments));
|
|
2225
|
+
for (const key of payload.keys || []) {
|
|
2226
|
+
const normalizedKey = key.trim();
|
|
2227
|
+
if (normalizedKey.length > 0) {
|
|
2228
|
+
tagsToClear.add(normalizedKey);
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
if (tagsToClear.size === 0) {
|
|
2232
|
+
console.warn("[cache-clear] no-tags", {
|
|
2233
|
+
traceId,
|
|
2234
|
+
requestedSegments,
|
|
2235
|
+
keyCount: (payload.keys || []).length
|
|
2236
|
+
});
|
|
2237
|
+
return NextResponse.json(
|
|
2238
|
+
{ error: "no cache segments/keys to clear" },
|
|
2239
|
+
{ status: 400 }
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2242
|
+
tagsToClear.forEach((tag) => revalidateTag(tag));
|
|
2243
|
+
clearProcessLocalRequestCaches();
|
|
2244
|
+
console.info("[cache-clear] revalidated", {
|
|
2245
|
+
traceId,
|
|
2246
|
+
requestedSegments,
|
|
2247
|
+
clearedTagCount: tagsToClear.size,
|
|
2248
|
+
clearedTags: Array.from(tagsToClear)
|
|
2249
|
+
});
|
|
2250
|
+
return NextResponse.json({
|
|
2251
|
+
ok: true,
|
|
2252
|
+
clearedTags: Array.from(tagsToClear),
|
|
2253
|
+
appliedSegments: requestedSegments,
|
|
2254
|
+
supportedSegments: getSupportedCacheSegments()
|
|
2255
|
+
});
|
|
2256
|
+
};
|
|
2257
|
+
var DEBUG_TIMINGS = process.env.CREX_DEBUG_TIMINGS === "true";
|
|
2258
|
+
var DISABLE_FETCH_CACHE = process.env.CREX_DISABLE_FETCH_CACHE === "true";
|
|
2259
|
+
var TIMING_LOG_FILE = process.env.CREX_TIMING_LOG_FILE;
|
|
2260
|
+
var DEFAULT_REQUESTS_REVALIDATE_SECONDS = 15 * 60;
|
|
2261
|
+
var DEFAULT_VCARD_REVALIDATE_SECONDS = 6 * 60 * 60;
|
|
2262
|
+
var readPositiveInt = (rawValue, fallback) => {
|
|
2263
|
+
const parsed = Number(rawValue);
|
|
2264
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return fallback;
|
|
2265
|
+
return Math.floor(parsed);
|
|
2266
|
+
};
|
|
2267
|
+
var REQUESTS_REVALIDATE_SECONDS = readPositiveInt(
|
|
2268
|
+
process.env.CREX_CACHE_REVALIDATE_REQUESTS_SECONDS,
|
|
2269
|
+
DEFAULT_REQUESTS_REVALIDATE_SECONDS
|
|
2270
|
+
);
|
|
2271
|
+
var VCARD_REVALIDATE_SECONDS = readPositiveInt(
|
|
2272
|
+
process.env.CREX_CACHE_REVALIDATE_VCARD_SECONDS,
|
|
2273
|
+
DEFAULT_VCARD_REVALIDATE_SECONDS
|
|
2274
|
+
);
|
|
2275
|
+
var cachedOidcToken = null;
|
|
2276
|
+
var inFlightOidcTokenPromise = null;
|
|
2277
|
+
var OIDC_TOKEN_EXPIRY_SAFETY_SECONDS = 30;
|
|
2278
|
+
var getCacheTagsForUrl = (url) => {
|
|
2279
|
+
const normalized = url.toLowerCase();
|
|
2280
|
+
const tags = [CREX_API_CACHE_TAG];
|
|
2281
|
+
if (normalized.includes("/vcard/v1/")) {
|
|
2282
|
+
tags.push(CREX_API_CACHE_VCARD_TAG);
|
|
2283
|
+
}
|
|
2284
|
+
return tags;
|
|
2285
|
+
};
|
|
2286
|
+
var INFLIGHT_GET_REQUESTS = /* @__PURE__ */ new Map();
|
|
2287
|
+
var GET_MICROCACHE_TTL_MS = readPositiveInt(
|
|
2288
|
+
process.env.CREX_GET_MICROCACHE_TTL_MS,
|
|
2289
|
+
1e4
|
|
2290
|
+
);
|
|
2291
|
+
var GET_MICROCACHE_MAX_ENTRIES = readPositiveInt(
|
|
2292
|
+
process.env.CREX_GET_MICROCACHE_MAX_ENTRIES,
|
|
2293
|
+
1e3
|
|
2294
|
+
);
|
|
2295
|
+
var GET_MICROCACHE_PRUNE_INTERVAL_MS = readPositiveInt(
|
|
2296
|
+
process.env.CREX_GET_MICROCACHE_PRUNE_INTERVAL_MS,
|
|
2297
|
+
3e4
|
|
2298
|
+
);
|
|
2299
|
+
var GET_MICROCACHE_METRICS_EVERY_N_EVENTS = readPositiveInt(
|
|
2300
|
+
process.env.CREX_GET_MICROCACHE_METRICS_EVERY_N_EVENTS,
|
|
2301
|
+
250
|
|
2302
|
+
);
|
|
2303
|
+
var GET_RESPONSE_MICROCACHE = /* @__PURE__ */ new Map();
|
|
2304
|
+
var getMicrocacheLastPruneEpochMs = 0;
|
|
2305
|
+
var getMicrocacheStats = {
|
|
2306
|
+
hits: 0,
|
|
2307
|
+
misses: 0,
|
|
2308
|
+
sets: 0,
|
|
2309
|
+
expiredPruned: 0,
|
|
2310
|
+
lruEvicted: 0,
|
|
2311
|
+
events: 0
|
|
2312
|
+
};
|
|
2313
|
+
var clearProcessLocalRequestCaches = () => {
|
|
2314
|
+
INFLIGHT_GET_REQUESTS.clear();
|
|
2315
|
+
GET_RESPONSE_MICROCACHE.clear();
|
|
2316
|
+
getMicrocacheLastPruneEpochMs = 0;
|
|
2317
|
+
getMicrocacheStats.hits = 0;
|
|
2318
|
+
getMicrocacheStats.misses = 0;
|
|
2319
|
+
getMicrocacheStats.sets = 0;
|
|
2320
|
+
getMicrocacheStats.expiredPruned = 0;
|
|
2321
|
+
getMicrocacheStats.lruEvicted = 0;
|
|
2322
|
+
getMicrocacheStats.events = 0;
|
|
2323
|
+
};
|
|
2324
|
+
var maybePruneExpiredMicrocacheEntries = (nowEpochMs) => {
|
|
2325
|
+
if (nowEpochMs - getMicrocacheLastPruneEpochMs < GET_MICROCACHE_PRUNE_INTERVAL_MS) return;
|
|
2326
|
+
getMicrocacheLastPruneEpochMs = nowEpochMs;
|
|
2327
|
+
for (const [key, entry] of GET_RESPONSE_MICROCACHE.entries()) {
|
|
2328
|
+
if (entry.expiresAtEpochMs <= nowEpochMs) {
|
|
2329
|
+
GET_RESPONSE_MICROCACHE.delete(key);
|
|
2330
|
+
getMicrocacheStats.expiredPruned += 1;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
var enforceMicrocacheMaxSize = () => {
|
|
2335
|
+
while (GET_RESPONSE_MICROCACHE.size > GET_MICROCACHE_MAX_ENTRIES) {
|
|
2336
|
+
const oldestKey = GET_RESPONSE_MICROCACHE.keys().next().value;
|
|
2337
|
+
if (!oldestKey) return;
|
|
2338
|
+
GET_RESPONSE_MICROCACHE.delete(oldestKey);
|
|
2339
|
+
getMicrocacheStats.lruEvicted += 1;
|
|
2340
|
+
}
|
|
2341
|
+
};
|
|
2342
|
+
var cloneForMicrocache = (value) => {
|
|
2343
|
+
try {
|
|
2344
|
+
if (typeof structuredClone === "function") {
|
|
2345
|
+
return structuredClone(value);
|
|
2346
|
+
}
|
|
2347
|
+
} catch {
|
|
2348
|
+
}
|
|
2349
|
+
return JSON.parse(JSON.stringify(value));
|
|
2350
|
+
};
|
|
2351
|
+
var GET_RETRY_ATTEMPTS = readPositiveInt(
|
|
2352
|
+
process.env.CREX_GET_RETRY_ATTEMPTS,
|
|
2353
|
+
2
|
|
2354
|
+
);
|
|
2355
|
+
var GET_RETRY_DELAY_MS = readPositiveInt(
|
|
2356
|
+
process.env.CREX_GET_RETRY_DELAY_MS,
|
|
2357
|
+
150
|
|
2358
|
+
);
|
|
2359
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2360
|
+
var extractNodeErrorCodes = (error) => {
|
|
2361
|
+
const maybeError = error;
|
|
2362
|
+
const codes = /* @__PURE__ */ new Set();
|
|
2363
|
+
if (maybeError?.code) codes.add(maybeError.code);
|
|
2364
|
+
if (maybeError?.cause?.code) codes.add(maybeError.cause.code);
|
|
2365
|
+
if (Array.isArray(maybeError?.cause?.errors)) {
|
|
2366
|
+
maybeError.cause.errors.forEach((inner) => {
|
|
2367
|
+
if (inner?.code) codes.add(inner.code);
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2370
|
+
return Array.from(codes);
|
|
2371
|
+
};
|
|
2372
|
+
var isTransientNetworkFetchError = (error) => {
|
|
2373
|
+
const codes = extractNodeErrorCodes(error);
|
|
2374
|
+
return codes.some((code) => code === "ETIMEDOUT" || code === "ENETUNREACH" || code === "ECONNRESET");
|
|
2375
|
+
};
|
|
1791
2376
|
var CrexApi = class {
|
|
1792
2377
|
customerConfig;
|
|
1793
2378
|
baseUrl;
|
|
1794
2379
|
logger;
|
|
2380
|
+
debugTiming(message) {
|
|
2381
|
+
if (!DEBUG_TIMINGS) return;
|
|
2382
|
+
const line = `[CrexApi][Timing] ${message}`;
|
|
2383
|
+
if (TIMING_LOG_FILE) {
|
|
2384
|
+
try {
|
|
2385
|
+
mkdirSync(dirname(TIMING_LOG_FILE), { recursive: true });
|
|
2386
|
+
appendFileSync(TIMING_LOG_FILE, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
|
|
2387
|
+
`, "utf8");
|
|
2388
|
+
} catch {
|
|
2389
|
+
console.info(line);
|
|
2390
|
+
}
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
console.info(line);
|
|
2394
|
+
}
|
|
2395
|
+
resolveLogCategory(url) {
|
|
2396
|
+
const normalized = url.toLowerCase();
|
|
2397
|
+
if (normalized.includes("/search")) return "Search";
|
|
2398
|
+
if (normalized.includes("/notification")) return "Notification";
|
|
2399
|
+
if (normalized.includes("/history")) return "History";
|
|
2400
|
+
if (normalized.includes("/vcard/")) return "UserProfile";
|
|
2401
|
+
if (normalized.includes("/informationunits") || normalized.includes("/documents") || normalized.includes("/topics") || normalized.includes("/fragments") || normalized.includes("/packages")) {
|
|
2402
|
+
return "Document";
|
|
2403
|
+
}
|
|
2404
|
+
return "Scenario";
|
|
2405
|
+
}
|
|
1795
2406
|
/**
|
|
1796
2407
|
* Initializes the API client if it hasn't been initialized yet.
|
|
1797
2408
|
* Loads customer configuration and initializes the logger.
|
|
@@ -1811,21 +2422,62 @@ var CrexApi = class {
|
|
|
1811
2422
|
this.baseUrl = this.customerConfig.baseUrl;
|
|
1812
2423
|
}
|
|
1813
2424
|
}
|
|
1814
|
-
async manageToken() {
|
|
2425
|
+
async manageToken(options) {
|
|
2426
|
+
const startedAt = Date.now();
|
|
1815
2427
|
try {
|
|
2428
|
+
if (options?.authToken && options.authToken.trim().length > 0) {
|
|
2429
|
+
this.debugTiming(`manageToken source=explicit durationMs=${Date.now() - startedAt}`);
|
|
2430
|
+
return options.authToken;
|
|
2431
|
+
}
|
|
1816
2432
|
let token = "";
|
|
1817
|
-
const
|
|
2433
|
+
const allowCookieLookup = options?.skipCookieTokenLookup !== true;
|
|
2434
|
+
let hasToken;
|
|
2435
|
+
if (allowCookieLookup) {
|
|
2436
|
+
try {
|
|
2437
|
+
hasToken = cookies2().get(CREX_TOKEN_HEADER_KEY);
|
|
2438
|
+
} catch {
|
|
2439
|
+
hasToken = void 0;
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
1818
2442
|
if (hasToken == void 0 || hasToken.value === null) {
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1821
|
-
|
|
2443
|
+
const nowSeconds = Math.floor(Date.now() / 1e3);
|
|
2444
|
+
const isCachedTokenValid = Boolean(
|
|
2445
|
+
cachedOidcToken?.token && cachedOidcToken.expiresAtEpochSeconds > nowSeconds + OIDC_TOKEN_EXPIRY_SAFETY_SECONDS
|
|
2446
|
+
);
|
|
2447
|
+
if (isCachedTokenValid && cachedOidcToken) {
|
|
2448
|
+
token = cachedOidcToken.token;
|
|
2449
|
+
} else {
|
|
2450
|
+
if (!inFlightOidcTokenPromise) {
|
|
2451
|
+
inFlightOidcTokenPromise = (async () => {
|
|
2452
|
+
const { token: tokenResult, expiresAt } = await getToken();
|
|
2453
|
+
if (!tokenResult || tokenResult.length === 0 || !expiresAt) {
|
|
2454
|
+
return null;
|
|
2455
|
+
}
|
|
2456
|
+
return {
|
|
2457
|
+
token: tokenResult,
|
|
2458
|
+
expiresAtEpochSeconds: expiresAt
|
|
2459
|
+
};
|
|
2460
|
+
})().finally(() => {
|
|
2461
|
+
inFlightOidcTokenPromise = null;
|
|
2462
|
+
});
|
|
2463
|
+
}
|
|
2464
|
+
const resolvedToken = await inFlightOidcTokenPromise;
|
|
2465
|
+
if (!resolvedToken?.token) throw new Error("Token is undefined");
|
|
2466
|
+
cachedOidcToken = resolvedToken;
|
|
2467
|
+
token = resolvedToken.token;
|
|
2468
|
+
}
|
|
2469
|
+
this.debugTiming(`manageToken source=oidc durationMs=${Date.now() - startedAt}`);
|
|
1822
2470
|
} else {
|
|
1823
|
-
token = hasToken.value;
|
|
2471
|
+
token = hasToken.value || "";
|
|
2472
|
+
if (token.length === 0) throw new Error("Token is undefined");
|
|
2473
|
+
this.debugTiming(`manageToken source=cookie durationMs=${Date.now() - startedAt}`);
|
|
1824
2474
|
}
|
|
1825
2475
|
return token;
|
|
1826
2476
|
} catch (error) {
|
|
2477
|
+
this.debugTiming(`manageToken source=error durationMs=${Date.now() - startedAt}`);
|
|
1827
2478
|
this.logger.log({
|
|
1828
2479
|
level: "error",
|
|
2480
|
+
category: "Scenario",
|
|
1829
2481
|
message: `CrexAPI.manageToken error: ${error}`
|
|
1830
2482
|
});
|
|
1831
2483
|
throw error;
|
|
@@ -1840,7 +2492,11 @@ var CrexApi = class {
|
|
|
1840
2492
|
* @returns The full URL with query string
|
|
1841
2493
|
*/
|
|
1842
2494
|
buildUrl(url, params) {
|
|
1843
|
-
const
|
|
2495
|
+
const normalizedUrl = url.replace(/^\/+/, "");
|
|
2496
|
+
const isAbsoluteUrl = /^https?:\/\//i.test(normalizedUrl);
|
|
2497
|
+
const apiRoot = this.getApiRootUrl();
|
|
2498
|
+
const shouldResolveAgainstApiRoot = AREA_PREFIX_PATTERN.test(normalizedUrl);
|
|
2499
|
+
const fullUrl = isAbsoluteUrl ? new URL(normalizedUrl) : new URL(normalizedUrl, shouldResolveAgainstApiRoot ? apiRoot : this.baseUrl);
|
|
1844
2500
|
if (params) {
|
|
1845
2501
|
Object.entries(params).forEach(([key, value]) => {
|
|
1846
2502
|
if (value !== void 0) {
|
|
@@ -1854,6 +2510,16 @@ var CrexApi = class {
|
|
|
1854
2510
|
}
|
|
1855
2511
|
return fullUrl.toString();
|
|
1856
2512
|
}
|
|
2513
|
+
getApiRootUrl() {
|
|
2514
|
+
const parsed = new URL(this.baseUrl);
|
|
2515
|
+
const marker = "/ids/api/";
|
|
2516
|
+
const markerIndex = parsed.pathname.toLowerCase().indexOf(marker);
|
|
2517
|
+
if (markerIndex < 0) {
|
|
2518
|
+
return this.baseUrl;
|
|
2519
|
+
}
|
|
2520
|
+
const apiRootPath = parsed.pathname.slice(0, markerIndex + marker.length);
|
|
2521
|
+
return `${parsed.origin}${apiRootPath}`;
|
|
2522
|
+
}
|
|
1857
2523
|
/**
|
|
1858
2524
|
* Executes an API request with caching, authentication, and retry logic.
|
|
1859
2525
|
*
|
|
@@ -1871,8 +2537,12 @@ var CrexApi = class {
|
|
|
1871
2537
|
method,
|
|
1872
2538
|
params,
|
|
1873
2539
|
body,
|
|
1874
|
-
headers = {}
|
|
2540
|
+
headers = {},
|
|
2541
|
+
skipCookieTokenLookup,
|
|
2542
|
+
authToken
|
|
1875
2543
|
}) {
|
|
2544
|
+
const startedAt = Date.now();
|
|
2545
|
+
const normalizedMethod = method.toUpperCase();
|
|
1876
2546
|
try {
|
|
1877
2547
|
await this.initAPI();
|
|
1878
2548
|
const requestHeaders = {
|
|
@@ -1880,25 +2550,128 @@ var CrexApi = class {
|
|
|
1880
2550
|
...headers
|
|
1881
2551
|
};
|
|
1882
2552
|
if (this.customerConfig.OIDC.client.enabled) {
|
|
1883
|
-
const token = await this.manageToken();
|
|
2553
|
+
const token = await this.manageToken({ skipCookieTokenLookup, authToken });
|
|
1884
2554
|
requestHeaders["Authorization"] = `Bearer ${token}`;
|
|
1885
2555
|
}
|
|
1886
2556
|
const fullUrl = this.buildUrl(url, params);
|
|
1887
|
-
const
|
|
1888
|
-
|
|
1889
|
-
method,
|
|
2557
|
+
const category = this.resolveLogCategory(fullUrl);
|
|
2558
|
+
const requestInit = {
|
|
2559
|
+
method: normalizedMethod,
|
|
1890
2560
|
headers: requestHeaders,
|
|
1891
2561
|
body: body ? JSON.stringify(body) : void 0
|
|
1892
|
-
}
|
|
1893
|
-
if (
|
|
1894
|
-
|
|
1895
|
-
|
|
2562
|
+
};
|
|
2563
|
+
if (DISABLE_FETCH_CACHE) {
|
|
2564
|
+
requestInit.cache = "no-store";
|
|
2565
|
+
} else {
|
|
2566
|
+
const cacheTags = getCacheTagsForUrl(fullUrl);
|
|
2567
|
+
const revalidateSeconds = fullUrl.toLowerCase().includes("/vcard/v1/") ? VCARD_REVALIDATE_SECONDS : REQUESTS_REVALIDATE_SECONDS;
|
|
2568
|
+
requestInit.cache = "force-cache";
|
|
2569
|
+
requestInit.next = {
|
|
2570
|
+
tags: cacheTags,
|
|
2571
|
+
revalidate: revalidateSeconds
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
const executeRequest = async () => {
|
|
2575
|
+
const maxAttempts = normalizedMethod === "GET" ? Math.max(1, GET_RETRY_ATTEMPTS) : 1;
|
|
2576
|
+
let lastError = void 0;
|
|
2577
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
2578
|
+
try {
|
|
2579
|
+
this.debugTiming(`execute start method=${normalizedMethod} url=${fullUrl} attempt=${attempt}/${maxAttempts}`);
|
|
2580
|
+
const response = await fetch(fullUrl, requestInit);
|
|
2581
|
+
if (!response.ok) {
|
|
2582
|
+
const responseText = await response.clone().text().catch(() => "");
|
|
2583
|
+
this.logger.log({
|
|
2584
|
+
level: "error",
|
|
2585
|
+
category,
|
|
2586
|
+
message: `CrexAPI.execute error: ${fullUrl} - HTTP ${response.status}${responseText ? ` - ${responseText.slice(0, 300)}` : ""}`
|
|
2587
|
+
});
|
|
2588
|
+
console.error(`[CrexApi] Request failed: ${response.status} ${response.statusText} - ${fullUrl}`);
|
|
2589
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
2590
|
+
}
|
|
2591
|
+
this.logger.log({
|
|
2592
|
+
level: "debug",
|
|
2593
|
+
category,
|
|
2594
|
+
message: `CrexAPI.execute success: ${fullUrl}`
|
|
2595
|
+
});
|
|
2596
|
+
this.debugTiming(`execute success method=${normalizedMethod} url=${fullUrl} status=${response.status} durationMs=${Date.now() - startedAt} attempt=${attempt}/${maxAttempts}`);
|
|
2597
|
+
return await response.json();
|
|
2598
|
+
} catch (error) {
|
|
2599
|
+
lastError = error;
|
|
2600
|
+
if (normalizedMethod !== "GET" || attempt >= maxAttempts || !isTransientNetworkFetchError(error)) {
|
|
2601
|
+
throw error;
|
|
2602
|
+
}
|
|
2603
|
+
const delay = GET_RETRY_DELAY_MS * attempt;
|
|
2604
|
+
this.logger.log({
|
|
2605
|
+
level: "info",
|
|
2606
|
+
category,
|
|
2607
|
+
message: `CrexAPI.execute retrying transient GET error: ${fullUrl} attempt=${attempt}/${maxAttempts} delayMs=${delay}`
|
|
2608
|
+
});
|
|
2609
|
+
await sleep(delay);
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
throw lastError instanceof Error ? lastError : new Error("Request failed");
|
|
2613
|
+
};
|
|
2614
|
+
const canDedupe = normalizedMethod === "GET";
|
|
2615
|
+
const dedupeKey = canDedupe ? `${normalizedMethod}:${fullUrl}:${requestHeaders["Authorization"] || ""}` : void 0;
|
|
2616
|
+
if (canDedupe && dedupeKey) {
|
|
2617
|
+
const nowEpochMs = Date.now();
|
|
2618
|
+
maybePruneExpiredMicrocacheEntries(nowEpochMs);
|
|
2619
|
+
const microCached = GET_RESPONSE_MICROCACHE.get(dedupeKey);
|
|
2620
|
+
if (microCached && microCached.expiresAtEpochMs > nowEpochMs) {
|
|
2621
|
+
microCached.lastAccessEpochMs = nowEpochMs;
|
|
2622
|
+
GET_RESPONSE_MICROCACHE.delete(dedupeKey);
|
|
2623
|
+
GET_RESPONSE_MICROCACHE.set(dedupeKey, microCached);
|
|
2624
|
+
getMicrocacheStats.hits += 1;
|
|
2625
|
+
getMicrocacheStats.events += 1;
|
|
2626
|
+
if (getMicrocacheStats.events % GET_MICROCACHE_METRICS_EVERY_N_EVENTS === 0) {
|
|
2627
|
+
this.debugTiming(
|
|
2628
|
+
`microcache stats hits=${getMicrocacheStats.hits} misses=${getMicrocacheStats.misses} sets=${getMicrocacheStats.sets} expiredPruned=${getMicrocacheStats.expiredPruned} lruEvicted=${getMicrocacheStats.lruEvicted} size=${GET_RESPONSE_MICROCACHE.size}`
|
|
2629
|
+
);
|
|
2630
|
+
}
|
|
2631
|
+
this.debugTiming(`execute microcache hit method=${normalizedMethod} url=${fullUrl}`);
|
|
2632
|
+
return cloneForMicrocache(microCached.value);
|
|
2633
|
+
}
|
|
2634
|
+
getMicrocacheStats.misses += 1;
|
|
2635
|
+
getMicrocacheStats.events += 1;
|
|
2636
|
+
if (getMicrocacheStats.events % GET_MICROCACHE_METRICS_EVERY_N_EVENTS === 0) {
|
|
2637
|
+
this.debugTiming(
|
|
2638
|
+
`microcache stats hits=${getMicrocacheStats.hits} misses=${getMicrocacheStats.misses} sets=${getMicrocacheStats.sets} expiredPruned=${getMicrocacheStats.expiredPruned} lruEvicted=${getMicrocacheStats.lruEvicted} size=${GET_RESPONSE_MICROCACHE.size}`
|
|
2639
|
+
);
|
|
2640
|
+
}
|
|
2641
|
+
const existing = INFLIGHT_GET_REQUESTS.get(dedupeKey);
|
|
2642
|
+
if (existing) return await existing;
|
|
2643
|
+
const inFlight = executeRequest().then((result) => {
|
|
2644
|
+
const writeNowEpochMs = Date.now();
|
|
2645
|
+
maybePruneExpiredMicrocacheEntries(writeNowEpochMs);
|
|
2646
|
+
if (GET_RESPONSE_MICROCACHE.has(dedupeKey)) {
|
|
2647
|
+
GET_RESPONSE_MICROCACHE.delete(dedupeKey);
|
|
2648
|
+
}
|
|
2649
|
+
GET_RESPONSE_MICROCACHE.set(dedupeKey, {
|
|
2650
|
+
expiresAtEpochMs: writeNowEpochMs + GET_MICROCACHE_TTL_MS,
|
|
2651
|
+
value: cloneForMicrocache(result),
|
|
2652
|
+
lastAccessEpochMs: writeNowEpochMs
|
|
2653
|
+
});
|
|
2654
|
+
enforceMicrocacheMaxSize();
|
|
2655
|
+
getMicrocacheStats.sets += 1;
|
|
2656
|
+
getMicrocacheStats.events += 1;
|
|
2657
|
+
if (getMicrocacheStats.events % GET_MICROCACHE_METRICS_EVERY_N_EVENTS === 0) {
|
|
2658
|
+
this.debugTiming(
|
|
2659
|
+
`microcache stats hits=${getMicrocacheStats.hits} misses=${getMicrocacheStats.misses} sets=${getMicrocacheStats.sets} expiredPruned=${getMicrocacheStats.expiredPruned} lruEvicted=${getMicrocacheStats.lruEvicted} size=${GET_RESPONSE_MICROCACHE.size}`
|
|
2660
|
+
);
|
|
2661
|
+
}
|
|
2662
|
+
return result;
|
|
2663
|
+
}).finally(() => {
|
|
2664
|
+
INFLIGHT_GET_REQUESTS.delete(dedupeKey);
|
|
2665
|
+
});
|
|
2666
|
+
INFLIGHT_GET_REQUESTS.set(dedupeKey, inFlight);
|
|
2667
|
+
return await inFlight;
|
|
1896
2668
|
}
|
|
1897
|
-
|
|
1898
|
-
return data;
|
|
2669
|
+
return await executeRequest();
|
|
1899
2670
|
} catch (error) {
|
|
2671
|
+
this.debugTiming(`execute error method=${normalizedMethod} url=${url} durationMs=${Date.now() - startedAt}`);
|
|
1900
2672
|
this.logger.log({
|
|
1901
2673
|
level: "error",
|
|
2674
|
+
category: this.resolveLogCategory(url),
|
|
1902
2675
|
message: `CrexAPI.execute error: ${error}`
|
|
1903
2676
|
});
|
|
1904
2677
|
throw error;
|
|
@@ -1906,6 +2679,29 @@ var CrexApi = class {
|
|
|
1906
2679
|
}
|
|
1907
2680
|
};
|
|
1908
2681
|
export {
|
|
1909
|
-
|
|
2682
|
+
CREX_API_CACHE_TAG,
|
|
2683
|
+
CREX_API_CACHE_VCARD_TAG,
|
|
2684
|
+
CREX_CACHE_SEGMENT_ALL,
|
|
2685
|
+
CREX_CACHE_SEGMENT_METADATA,
|
|
2686
|
+
CREX_CACHE_SEGMENT_REQUESTS,
|
|
2687
|
+
CREX_CACHE_SEGMENT_TO_TAGS,
|
|
2688
|
+
CREX_CACHE_SEGMENT_VCARD,
|
|
2689
|
+
CREX_READMODEL_CACHE_COMPONENTS_TAG,
|
|
2690
|
+
CREX_READMODEL_CACHE_DOCUMENT_TYPES_TAG,
|
|
2691
|
+
CREX_READMODEL_CACHE_INFORMATION_SUBJECTS_TAG,
|
|
2692
|
+
CREX_READMODEL_CACHE_METADATA_TAG,
|
|
2693
|
+
CREX_READMODEL_CACHE_ORGANIZATION_TAG,
|
|
2694
|
+
CREX_READMODEL_CACHE_PARTIES_TAG,
|
|
2695
|
+
CREX_READMODEL_CACHE_TAG,
|
|
2696
|
+
CREX_READMODEL_CACHE_VCARD_TAG,
|
|
2697
|
+
CacheClearAuthConfigurationError,
|
|
2698
|
+
CacheClearAuthUnauthorizedError,
|
|
2699
|
+
CrexApi,
|
|
2700
|
+
clearProcessLocalRequestCaches,
|
|
2701
|
+
extractScopesFromJwtPayload,
|
|
2702
|
+
getSupportedCacheSegments,
|
|
2703
|
+
handleCacheClearPostRequest,
|
|
2704
|
+
resolveCacheTagsForSegments,
|
|
2705
|
+
verifyCacheClearBearerToken
|
|
1910
2706
|
};
|
|
1911
2707
|
//# sourceMappingURL=requests.mjs.map
|