@next-bricks/ai-portal 0.46.1 → 0.46.2

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 (36) hide show
  1. package/dist/bricks.json +32 -32
  2. package/dist/chunks/{7570.a411e1f2.js → 7570.708bdafd.js} +2 -2
  3. package/dist/chunks/{7570.a411e1f2.js.map → 7570.708bdafd.js.map} +1 -1
  4. package/dist/chunks/{7954.48580daf.js → 7954.c1753f33.js} +2 -2
  5. package/dist/chunks/7954.c1753f33.js.map +1 -0
  6. package/dist/chunks/8882.30a26232.js +3 -0
  7. package/dist/chunks/8882.30a26232.js.map +1 -0
  8. package/dist/chunks/9328.c93d9ac1.js +2 -0
  9. package/dist/chunks/9328.c93d9ac1.js.map +1 -0
  10. package/dist/chunks/main.0a194943.js +2 -0
  11. package/dist/chunks/main.0a194943.js.map +1 -0
  12. package/dist/examples.json +10 -10
  13. package/dist/index.0ebd0c2a.js +2 -0
  14. package/dist/index.0ebd0c2a.js.map +1 -0
  15. package/dist/manifest.json +226 -226
  16. package/dist/types.json +278 -278
  17. package/dist-types/cruise-canvas/NodeRequirement/NodeRequirement.d.ts +2 -1
  18. package/dist-types/cruise-canvas/interfaces.d.ts +1 -0
  19. package/dist-types/shared/interfaces.d.ts +1 -0
  20. package/package.json +2 -2
  21. package/dist/chunks/1097.56d301a5.js +0 -3
  22. package/dist/chunks/1097.56d301a5.js.LICENSE.txt +0 -9
  23. package/dist/chunks/1097.56d301a5.js.map +0 -1
  24. package/dist/chunks/6862.32630cc8.js +0 -3
  25. package/dist/chunks/6862.32630cc8.js.map +0 -1
  26. package/dist/chunks/7954.48580daf.js.map +0 -1
  27. package/dist/chunks/9328.4ac010e3.js +0 -2
  28. package/dist/chunks/9328.4ac010e3.js.map +0 -1
  29. package/dist/chunks/9848.ab8ad988.js +0 -3
  30. package/dist/chunks/9848.ab8ad988.js.LICENSE.txt +0 -1
  31. package/dist/chunks/9848.ab8ad988.js.map +0 -1
  32. package/dist/chunks/main.8ec249fd.js +0 -2
  33. package/dist/chunks/main.8ec249fd.js.map +0 -1
  34. package/dist/index.609de131.js +0 -2
  35. package/dist/index.609de131.js.map +0 -1
  36. /package/dist/chunks/{6862.32630cc8.js.LICENSE.txt → 8882.30a26232.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -75,87 +75,6 @@
75
75
  }
76
76
  ]
77
77
  },
78
- "ai-portal.page-container": {
79
- "properties": [
80
- {
81
- "name": "pageTitle",
82
- "annotation": {
83
- "type": "keyword",
84
- "value": "string"
85
- }
86
- },
87
- {
88
- "name": "breadcrumbs",
89
- "annotation": {
90
- "type": "array",
91
- "elementType": {
92
- "type": "reference",
93
- "typeName": {
94
- "type": "identifier",
95
- "name": "Breadcrumb"
96
- }
97
- }
98
- }
99
- },
100
- {
101
- "name": "size",
102
- "annotation": {
103
- "type": "union",
104
- "types": [
105
- {
106
- "type": "jsLiteral",
107
- "value": "medium"
108
- },
109
- {
110
- "type": "jsLiteral",
111
- "value": "small"
112
- }
113
- ]
114
- }
115
- },
116
- {
117
- "name": "textContent",
118
- "annotation": {
119
- "type": "keyword",
120
- "value": "string"
121
- }
122
- }
123
- ],
124
- "events": [],
125
- "methods": [],
126
- "types": [
127
- {
128
- "type": "interface",
129
- "name": "Breadcrumb",
130
- "body": [
131
- {
132
- "type": "propertySignature",
133
- "key": {
134
- "type": "identifier",
135
- "name": "text"
136
- },
137
- "annotation": {
138
- "type": "keyword",
139
- "value": "string"
140
- },
141
- "computed": false
142
- },
143
- {
144
- "type": "propertySignature",
145
- "key": {
146
- "type": "identifier",
147
- "name": "url"
148
- },
149
- "annotation": {
150
- "type": "keyword",
151
- "value": "string"
152
- },
153
- "computed": false
154
- }
155
- ]
156
- }
157
- ]
158
- },
159
78
  "ai-portal.call-tool": {
160
79
  "type": "provider",
161
80
  "params": [
@@ -329,77 +248,6 @@
329
248
  }
330
249
  }
331
250
  },
332
- "ai-portal.tab-list": {
333
- "properties": [
334
- {
335
- "name": "tabs",
336
- "annotation": {
337
- "type": "array",
338
- "elementType": {
339
- "type": "reference",
340
- "typeName": {
341
- "type": "identifier",
342
- "name": "Tab"
343
- }
344
- }
345
- }
346
- },
347
- {
348
- "name": "activeTab",
349
- "annotation": {
350
- "type": "keyword",
351
- "value": "string"
352
- }
353
- }
354
- ],
355
- "events": [
356
- {
357
- "name": "tab.click",
358
- "detail": {
359
- "annotation": {
360
- "type": "reference",
361
- "typeName": {
362
- "type": "identifier",
363
- "name": "Tab"
364
- }
365
- }
366
- }
367
- }
368
- ],
369
- "methods": [],
370
- "types": [
371
- {
372
- "type": "interface",
373
- "name": "Tab",
374
- "body": [
375
- {
376
- "type": "propertySignature",
377
- "key": {
378
- "type": "identifier",
379
- "name": "id"
380
- },
381
- "annotation": {
382
- "type": "keyword",
383
- "value": "string"
384
- },
385
- "computed": false
386
- },
387
- {
388
- "type": "propertySignature",
389
- "key": {
390
- "type": "identifier",
391
- "name": "label"
392
- },
393
- "annotation": {
394
- "type": "keyword",
395
- "value": "string"
396
- },
397
- "computed": false
398
- }
399
- ]
400
- }
401
- ]
402
- },
403
251
  "ai-portal.stat-with-mini-chart": {
404
252
  "properties": [
405
253
  {
@@ -498,11 +346,163 @@
498
346
  ]
499
347
  }
500
348
  }
501
- }
349
+ }
350
+ }
351
+ ],
352
+ "events": [],
353
+ "methods": []
354
+ },
355
+ "ai-portal.page-container": {
356
+ "properties": [
357
+ {
358
+ "name": "pageTitle",
359
+ "annotation": {
360
+ "type": "keyword",
361
+ "value": "string"
362
+ }
363
+ },
364
+ {
365
+ "name": "breadcrumbs",
366
+ "annotation": {
367
+ "type": "array",
368
+ "elementType": {
369
+ "type": "reference",
370
+ "typeName": {
371
+ "type": "identifier",
372
+ "name": "Breadcrumb"
373
+ }
374
+ }
375
+ }
376
+ },
377
+ {
378
+ "name": "size",
379
+ "annotation": {
380
+ "type": "union",
381
+ "types": [
382
+ {
383
+ "type": "jsLiteral",
384
+ "value": "medium"
385
+ },
386
+ {
387
+ "type": "jsLiteral",
388
+ "value": "small"
389
+ }
390
+ ]
391
+ }
392
+ },
393
+ {
394
+ "name": "textContent",
395
+ "annotation": {
396
+ "type": "keyword",
397
+ "value": "string"
398
+ }
399
+ }
400
+ ],
401
+ "events": [],
402
+ "methods": [],
403
+ "types": [
404
+ {
405
+ "type": "interface",
406
+ "name": "Breadcrumb",
407
+ "body": [
408
+ {
409
+ "type": "propertySignature",
410
+ "key": {
411
+ "type": "identifier",
412
+ "name": "text"
413
+ },
414
+ "annotation": {
415
+ "type": "keyword",
416
+ "value": "string"
417
+ },
418
+ "computed": false
419
+ },
420
+ {
421
+ "type": "propertySignature",
422
+ "key": {
423
+ "type": "identifier",
424
+ "name": "url"
425
+ },
426
+ "annotation": {
427
+ "type": "keyword",
428
+ "value": "string"
429
+ },
430
+ "computed": false
431
+ }
432
+ ]
433
+ }
434
+ ]
435
+ },
436
+ "ai-portal.tab-list": {
437
+ "properties": [
438
+ {
439
+ "name": "tabs",
440
+ "annotation": {
441
+ "type": "array",
442
+ "elementType": {
443
+ "type": "reference",
444
+ "typeName": {
445
+ "type": "identifier",
446
+ "name": "Tab"
447
+ }
448
+ }
449
+ }
450
+ },
451
+ {
452
+ "name": "activeTab",
453
+ "annotation": {
454
+ "type": "keyword",
455
+ "value": "string"
456
+ }
457
+ }
458
+ ],
459
+ "events": [
460
+ {
461
+ "name": "tab.click",
462
+ "detail": {
463
+ "annotation": {
464
+ "type": "reference",
465
+ "typeName": {
466
+ "type": "identifier",
467
+ "name": "Tab"
468
+ }
469
+ }
470
+ }
471
+ }
472
+ ],
473
+ "methods": [],
474
+ "types": [
475
+ {
476
+ "type": "interface",
477
+ "name": "Tab",
478
+ "body": [
479
+ {
480
+ "type": "propertySignature",
481
+ "key": {
482
+ "type": "identifier",
483
+ "name": "id"
484
+ },
485
+ "annotation": {
486
+ "type": "keyword",
487
+ "value": "string"
488
+ },
489
+ "computed": false
490
+ },
491
+ {
492
+ "type": "propertySignature",
493
+ "key": {
494
+ "type": "identifier",
495
+ "name": "label"
496
+ },
497
+ "annotation": {
498
+ "type": "keyword",
499
+ "value": "string"
500
+ },
501
+ "computed": false
502
+ }
503
+ ]
502
504
  }
503
- ],
504
- "events": [],
505
- "methods": []
505
+ ]
506
506
  },
507
507
  "ai-portal.elevo-logo": {
508
508
  "properties": [],
@@ -679,6 +679,128 @@
679
679
  }
680
680
  ]
681
681
  },
682
+ "ai-portal.chat-box": {
683
+ "properties": [
684
+ {
685
+ "name": "disabled",
686
+ "annotation": {
687
+ "type": "keyword",
688
+ "value": "boolean"
689
+ }
690
+ },
691
+ {
692
+ "name": "placeholder",
693
+ "annotation": {
694
+ "type": "keyword",
695
+ "value": "string"
696
+ }
697
+ },
698
+ {
699
+ "name": "autoFocus",
700
+ "annotation": {
701
+ "type": "keyword",
702
+ "value": "boolean"
703
+ }
704
+ },
705
+ {
706
+ "name": "aiEmployees",
707
+ "annotation": {
708
+ "type": "array",
709
+ "elementType": {
710
+ "type": "reference",
711
+ "typeName": {
712
+ "type": "identifier",
713
+ "name": "AIEmployee"
714
+ }
715
+ }
716
+ }
717
+ }
718
+ ],
719
+ "events": [
720
+ {
721
+ "name": "message.submit",
722
+ "detail": {
723
+ "annotation": {
724
+ "type": "keyword",
725
+ "value": "string"
726
+ }
727
+ }
728
+ },
729
+ {
730
+ "name": "ai-employee.mention",
731
+ "detail": {
732
+ "annotation": {
733
+ "type": "union",
734
+ "types": [
735
+ {
736
+ "type": "reference",
737
+ "typeName": {
738
+ "type": "identifier",
739
+ "name": "AIEmployee"
740
+ }
741
+ },
742
+ {
743
+ "type": "keyword",
744
+ "value": "null"
745
+ }
746
+ ]
747
+ }
748
+ }
749
+ }
750
+ ],
751
+ "methods": [
752
+ {
753
+ "name": "setValue",
754
+ "params": [
755
+ {
756
+ "name": "value",
757
+ "annotation": {
758
+ "type": "keyword",
759
+ "value": "string"
760
+ }
761
+ }
762
+ ],
763
+ "returns": {}
764
+ },
765
+ {
766
+ "name": "getValue",
767
+ "params": [],
768
+ "returns": {}
769
+ }
770
+ ],
771
+ "types": [
772
+ {
773
+ "type": "interface",
774
+ "name": "AIEmployee",
775
+ "body": [
776
+ {
777
+ "type": "propertySignature",
778
+ "key": {
779
+ "type": "identifier",
780
+ "name": "employeeId"
781
+ },
782
+ "annotation": {
783
+ "type": "keyword",
784
+ "value": "string"
785
+ },
786
+ "computed": false
787
+ },
788
+ {
789
+ "type": "propertySignature",
790
+ "key": {
791
+ "type": "identifier",
792
+ "name": "name"
793
+ },
794
+ "annotation": {
795
+ "type": "keyword",
796
+ "value": "string"
797
+ },
798
+ "computed": false
799
+ }
800
+ ]
801
+ }
802
+ ]
803
+ },
682
804
  "ai-portal.show-cases": {
683
805
  "properties": [
684
806
  {
@@ -898,128 +1020,6 @@
898
1020
  }
899
1021
  ]
900
1022
  },
901
- "ai-portal.chat-box": {
902
- "properties": [
903
- {
904
- "name": "disabled",
905
- "annotation": {
906
- "type": "keyword",
907
- "value": "boolean"
908
- }
909
- },
910
- {
911
- "name": "placeholder",
912
- "annotation": {
913
- "type": "keyword",
914
- "value": "string"
915
- }
916
- },
917
- {
918
- "name": "autoFocus",
919
- "annotation": {
920
- "type": "keyword",
921
- "value": "boolean"
922
- }
923
- },
924
- {
925
- "name": "aiEmployees",
926
- "annotation": {
927
- "type": "array",
928
- "elementType": {
929
- "type": "reference",
930
- "typeName": {
931
- "type": "identifier",
932
- "name": "AIEmployee"
933
- }
934
- }
935
- }
936
- }
937
- ],
938
- "events": [
939
- {
940
- "name": "message.submit",
941
- "detail": {
942
- "annotation": {
943
- "type": "keyword",
944
- "value": "string"
945
- }
946
- }
947
- },
948
- {
949
- "name": "ai-employee.mention",
950
- "detail": {
951
- "annotation": {
952
- "type": "union",
953
- "types": [
954
- {
955
- "type": "reference",
956
- "typeName": {
957
- "type": "identifier",
958
- "name": "AIEmployee"
959
- }
960
- },
961
- {
962
- "type": "keyword",
963
- "value": "null"
964
- }
965
- ]
966
- }
967
- }
968
- }
969
- ],
970
- "methods": [
971
- {
972
- "name": "setValue",
973
- "params": [
974
- {
975
- "name": "value",
976
- "annotation": {
977
- "type": "keyword",
978
- "value": "string"
979
- }
980
- }
981
- ],
982
- "returns": {}
983
- },
984
- {
985
- "name": "getValue",
986
- "params": [],
987
- "returns": {}
988
- }
989
- ],
990
- "types": [
991
- {
992
- "type": "interface",
993
- "name": "AIEmployee",
994
- "body": [
995
- {
996
- "type": "propertySignature",
997
- "key": {
998
- "type": "identifier",
999
- "name": "employeeId"
1000
- },
1001
- "annotation": {
1002
- "type": "keyword",
1003
- "value": "string"
1004
- },
1005
- "computed": false
1006
- },
1007
- {
1008
- "type": "propertySignature",
1009
- "key": {
1010
- "type": "identifier",
1011
- "name": "name"
1012
- },
1013
- "annotation": {
1014
- "type": "keyword",
1015
- "value": "string"
1016
- },
1017
- "computed": false
1018
- }
1019
- ]
1020
- }
1021
- ]
1022
- },
1023
1023
  "ai-portal.ai-employees": {
1024
1024
  "properties": [
1025
1025
  {
@@ -1,6 +1,7 @@
1
1
  export interface NodeRequirementProps {
2
+ username?: string;
2
3
  content?: string;
3
4
  startTime?: number;
4
5
  active?: boolean;
5
6
  }
6
- export declare function NodeRequirement({ content, startTime, active, }: NodeRequirementProps): JSX.Element;
7
+ export declare function NodeRequirement({ username, content, startTime, active, }: NodeRequirementProps): JSX.Element;
@@ -15,6 +15,7 @@ export type GraphNode = RequirementGraphNode | LoadingGraphNode | InstructionGra
15
15
  export interface RequirementGraphNode extends BaseGraphNode {
16
16
  type: "requirement";
17
17
  content: string;
18
+ username?: string;
18
19
  }
19
20
  export interface LoadingGraphNode extends BaseGraphNode {
20
21
  type: "loading";
@@ -39,6 +39,7 @@ export interface Job {
39
39
  requestHumanAction?: HumanAction;
40
40
  humanAction?: string;
41
41
  aiEmployeeId?: string;
42
+ username?: string;
42
43
  }
43
44
  export type HumanAction = HumanActionConfirm | HumanActionSelect;
44
45
  export interface HumanActionConfirm {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/ai-portal",
3
- "version": "0.46.1",
3
+ "version": "0.46.2",
4
4
  "homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/ai-portal",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,5 +47,5 @@
47
47
  "@next-bricks/presentational": "*",
48
48
  "@next-bricks/vs": "*"
49
49
  },
50
- "gitHead": "8f310f5a894782a110be16a62339ef150777f0db"
50
+ "gitHead": "669357136c59a18445a991f539b810011bdeb428"
51
51
  }
@@ -1,3 +0,0 @@
1
- /*! For license information please see 1097.56d301a5.js.LICENSE.txt */
2
- "use strict";(globalThis.webpackChunk_next_bricks_ai_portal=globalThis.webpackChunk_next_bricks_ai_portal||[]).push([[1097],{11097:(e,t,n)=>{n.r(t),n.d(t,{analytics:()=>l,auth:()=>vt,checkInstalledApps:()=>r,checkPermissions:()=>mt,flowApi:()=>i,menu:()=>s,messageDispatcher:()=>gt});var o={};n.r(o),n.d(o,{addPathToBlackList:()=>b,authenticate:()=>A,getAuth:()=>w,isBlockedHref:()=>P,isBlockedPath:()=>I,isBlockedUrl:()=>k,isLoggedIn:()=>S,logout:()=>y});var r={};n.r(r),n.d(r,{getCheckedApp:()=>ae,preCheckInstalledApps:()=>ie,waitForCheckingApps:()=>se});var i={};n.r(i),n.d(i,{FLOW_API_PROVIDER:()=>le,clearCollectWidgetContract:()=>Se,clearDebugContract:()=>Ie,collectContract:()=>we,collectDebugContract:()=>be,collectWidgetContract:()=>ye,getArgsOfFlowApi:()=>Ee,isFlowApiProvider:()=>Pe,registerFlowApiProvider:()=>de});var s={};n.r(s),n.d(s,{fetchMenuById:()=>Ke,getMenuById:()=>Ye});var a={};n.r(a),n.d(a,{onRequest:()=>ut,onResponse:()=>pt,onResponseError:()=>dt});var c={};n.r(c),n.d(c,{create:()=>ft});var l={};n.r(l),n.d(l,{http:()=>a,initialize:()=>ct,pageView:()=>c});var u=n(7e4),p=n(86330),d=n(57372),h=function(){var e=(0,p.A)((function*(e,t){return(yield d.http.post("api/gateway/micro_app.permission.ValidatePermissions/api/micro_app/v1/permission/validate",e,t)).data}));return function(t,n){return e.apply(this,arguments)}}(),f=n(29475),m=n(11732);const g={};let v=new Set;function A(e){var t;Object.assign(g,{org:e.org,username:e.username,userInstanceId:e.userInstanceId,loginFrom:e.loginFrom,accessRule:e.accessRule,isAdmin:e.isAdmin,csrfToken:e.csrfToken,license:e.license,accessToken:e.accessToken,userShowValue:e.userShowValue}),v=new Set(null===(t=e.license)||void 0===t?void 0:t.blackList)}function w(){return{...g}}function y(){for(const e of Object.keys(g))g[e]=void 0;E.clear(),O.length=0,C.clear()}function S(){return void 0!==g.username}function b(e){v.add(e)}function I(e){return[...v].some((t=>(0,f.matchPath)(e,{path:t})))}function k(e){const t=("string"==typeof e?(0,m.createLocation)(e):e).pathname;return"string"==typeof t&&I(t)}function P(e){const t=(0,f.getBasePath)(),n=new URL(e,`${location.origin}${t}`);return!(n.origin!==location.origin||!n.pathname.startsWith(t))&&I(n.pathname.substring(t.length-1))}const E=new Map,O=[],C=new Map;function M(e){if(S()&&!w().isAdmin)return _((0,u.scanPermissionActionsInAny)(e))}async function _(e){const t=e.filter((e=>!O.includes(e)));if(0===t.length)return;const n=[],o=[];for(const e of t){const t=E.get(e);t?n.push(t):o.push(e)}if(o.length>0){const e=(async()=>{try{const e=await h({actions:o},{noAbortOnRouteChange:!0});for(const t of e.actions)C.set(t.action,t.authorizationStatus),"undefined"===t.authorizationStatus&&console.error(`Undefined permission action: "${t.action}"`)}catch(e){console.error("Pre-check permissions failed",e)}finally{O.push(...o)}})();for(const t of o)E.set(t,e);n.push(e)}await Promise.all(n)}var T=n(74635),N=n(70918),$=n(5536),R=n(12559),L=n(86121),B=n(70829),j=n(41030),W=new WeakMap,D=new WeakMap,x=new WeakMap,U=new WeakMap,F=new WeakMap,q=new WeakMap,z=new WeakMap,H=new WeakSet;class G{constructor(e){(0,T.A)(this,H),(0,N.A)(this,W,void 0),(0,N.A)(this,D,void 0),(0,N.A)(this,x,[]),(0,N.A)(this,U,new Set),(0,N.A)(this,F,new Set),(0,N.A)(this,q,0),(0,N.A)(this,z,!1),(0,L.A)(W,this,e)}send(e){(0,B.A)(D,this)||(0,L.A)(D,this,(0,R.A)(H,this,J).call(this));const t=JSON.stringify(e);(0,B.A)(D,this).readyState===WebSocket.OPEN?(0,B.A)(D,this).send(t):(0,B.A)(x,this).push(t)}onMessage(e){return(0,B.A)(U,this).add(e),()=>{(0,B.A)(U,this).delete(e)}}onClose(e){return(0,B.A)(F,this).add(e),()=>{(0,B.A)(F,this).delete(e)}}reset(){(0,B.A)(x,this).length=0,(0,B.A)(U,this).clear(),(0,B.A)(F,this).clear()}close(){var e;(0,L.A)(z,this,!0),(null===(e=(0,B.A)(D,this))||void 0===e?void 0:e.readyState)===WebSocket.OPEN&&(0,B.A)(D,this).close()}}function J(){console.log("WebSocket connecting ...");const e=new WebSocket((0,B.A)(W,this));let t;return e.addEventListener("open",(n=>{console.log("WebSocket open:",n),t=setTimeout((()=>{t=void 0,(0,L.A)(q,this,0)}),1e3);for(const t of(0,B.A)(x,this))e.send(t);(0,B.A)(x,this).length=0})),e.addEventListener("close",(e=>{(0,B.A)(z,this)||(void 0!==t&&clearTimeout(t),console.log("WebSocket close:",e),1e3!==e.code&&(0,R.A)(H,this,V).call(this))})),e.addEventListener("error",(e=>{console.error("WebSocket error:",e)})),e.addEventListener("message",(e=>{const t=JSON.parse(e.data);for(const e of(0,B.A)(U,this))e(t)})),e}function V(){if((0,B.A)(q,this)>=5){console.error("WebSocket connect retry limit exceeded");for(const e of(0,B.A)(F,this))e();return}const e=1e3*Math.pow(2,(0,B.A)(q,this));console.log("WebSocket will reconnect after %d seconds",e/1e3),setTimeout((()=>{var e;(0,L.A)(q,this,(e=(0,B.A)(q,this),++e)),(0,L.A)(D,this,(0,R.A)(H,this,J).call(this))}),e)}var Y=new WeakMap,K=new WeakMap,Q=new WeakMap,X=new WeakSet;function Z(e){if(!(0,B.A)(Y,e)){const t=`${"https:"===location.protocol?"wss:":"ws:"}//${window.location.host}${(0,f.getBasePath)()}api/websocket_service/v1/ws`;(0,L.A)(Y,e,new G(t))}return(0,B.A)(Y,e)}function ee(e,t,n,o){const r=(0,B.A)(K,this)[e].get(o);if(r)return r;const i={event:"sub"===e?"TOPIC.SUB":"TOPIC.UNSUB",payload:n},s=new Promise(((t,o)=>{const r=te(n),s=(0,$.A)(X,this,Z).onMessage((n=>{const i=n.event===("sub"===e?"TOPIC.SUB_SUCCESS":"TOPIC.UNSUB_SUCCESS"),c=n.event===("sub"===e?"TOPIC.SUB_FAILED":"TOPIC.UNSUB_FAILED");(i||c)&&r===te(n.payload)&&((i?t:o)(n),s(),a())})),a=(0,$.A)(X,this,Z).onClose((()=>{o({retryCount:5}),s(),a()}));(0,$.A)(X,this,Z).send(i)}));return"sub"===e&&(0,B.A)(Q,this).set(t,o),(0,B.A)(K,this)[e].set(o,s),s}function te(e){const{system:t,topic:n}=e;return JSON.stringify({system:t,topic:n})}var ne=function(){var e=(0,p.A)((function*(e,t){return(yield d.http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search",e,t)).data}));return function(t,n){return e.apply(this,arguments)}}();const oe=new Map,re=new Map;function ie(e,t){if(window.STANDALONE_MICRO_APPS&&!window.NO_AUTH_GUARD){const n=function(e){var t;const n={usedArgs:new Set},{customTemplates:o,menus:r}=null!==(t=e.meta)&&void 0!==t?t:{};return(0,u.traverseStoryboardExpressions)([e.routes,o,r],((e,t)=>{(0,u.collectInstalledAppsHasUsage)(n,e,t)}),"INSTALLED_APPS"),[...n.usedArgs]}(e),o=[];for(const e of n)oe.has(e)||t(e)||o.push(e);if(0===o.length)return;const r=ne({query:{appId:{$in:o}},fields:["appId","currentVersion","installStatus"]},{noAbortOnRouteChange:!0}).catch((e=>{console.error("Get off site standalone micro-apps failed",e)}));for(const e of o)oe.set(e,r.then((t=>{var n;const o=null==t||null===(n=t.list)||void 0===n?void 0:n.find((t=>t.appId===e)),r=o?{...o,id:e}:void 0;return re.set(e,r),r})))}}async function se(e){await Promise.all(e.map((e=>oe.get(e))))}function ae(e){if(window.STANDALONE_MICRO_APPS)return re.get(e)}var ce=n(94558);const le="core.provider-flow-api";function ue(e,t){return null==e?void 0:e.some((e=>e.source===t))}async function pe(e){let{url:t,originalUri:n,method:o="GET",responseWrapper:r=!0,ext_fields:i,request:s,isFileType:a,stream:c}=e;const l=["get","delete","head"].includes(o.toLowerCase()),u=a?{responseType:"blob"}:{};let p;for(var h=arguments.length,f=new Array(h>1?h-1:0),m=1;m<h;m++)f[m-1]=arguments[m];if(l){var g,v,A,w;let e,r;var y,S;if(n&&"object"===(null==s?void 0:s.type)&&(null!==(g=null===(v=n.match(/:([^/]+)/g))||void 0===v?void 0:v.length)&&void 0!==g?g:0)===(null!==(A=null===(w=s.fields)||void 0===w?void 0:w.length)&&void 0!==A?A:0)?[r]=f:[e,r]=f,c)return await(0,ce.createSSEStream)(d.http.getUrlWithParams(t,e),{...u,...r,method:o,headers:Object.fromEntries([...new Headers(null!==(y=null===(S=r)||void 0===S?void 0:S.headers)&&void 0!==y?y:{}).entries()])});p=await d.http.simpleRequest(o,t,{params:e,...u,...r})}else{const e=function(e){if("object"!==(null==e?void 0:e.type))return!1;const t=e=>!(0,j.isEmpty)(e)&&e.some((e=>["file","file[]"].includes(e.type)||t(e.fields)));return t(e.fields)}(s),n=function(e){const t=ue(e,"query");for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];if(t){if(ue(e,"body")){const[e,t,n]=o;return{data:e,options:{params:t,...n}}}const[t,n]=o;return{data:{},options:{params:t,...n}}}const[i,s]=o;return{data:i,options:s}}(i,...f),r=e?function(e){if(e instanceof FormData)return e;const t=new FormData;for(const[n,o]of Object.entries(e))Array.isArray(o)?o.forEach((e=>{t.append(n,e)})):!(0,j.isObject)(o)||o instanceof Blob||o instanceof Date?t.append(n,o):Object.entries(o).forEach((e=>{let[o,r]=e;t.append(`${n}[${o}]`,r)}));return t}(n.data):n.data;if(c){var b;const{body:e,headers:i}=d.http.getBodyAndHeaders(r,null===(b=n.options)||void 0===b?void 0:b.headers);return await(0,ce.createSSEStream)(t,{...u,...n.options,method:o,headers:Object.fromEntries([...new Headers(null!=i?i:{}).entries()]),body:e})}p=await d.http.requestWithBody(o,t,r,{...u,...n.options})}return!a&&r?p.data:p}function de(){customElements.define(le,(0,ce.createProviderClass)(pe))}var he=n(55310);const fe=async(e,t)=>(await d.http.post("api/gateway/next_builder.contract_center.BatchSearchContract/api/v1/contract/batch_search",e,t)).data,me=new Map,ge=new Map,ve=new Map,Ae=(e,t)=>{null==e||e.forEach((e=>{t.set(`${e.namespaceId}.${e.name}`,e)}))};function we(e){Ae(e,me)}function ye(e){Ae(e,ge)}function Se(){ge.clear()}function be(e){Ae(e,ve)}function Ie(){ve.clear()}const ke=new Map;function Pe(e){return e.includes("@")}async function Ee(e,t,n,o){if(!e.includes(":"))throw new Error(`You're using legacy Custom API "${e}" which is dropped in v3, please use Flow API instead`);const r=await async function(e){const[t,n]=e.split("@"),[o,r]=n.split(":"),i=function(e){return me.get(e)||ge.get(e)||ve.get(e)}(`${t}.${o}`);if(i)return{name:i.name,namespace:i.namespaceId,serviceName:i.serviceName,version:i.version,contract:{endpoint:i.endpoint,response:i.response,request:i.request}};let s=ke.get(e);return s||(s=async function(e,t,n){let o;const r=`${e}@${t}`;let i;try{const{list:e}=await fe({contract:[{fullContractName:r,version:n}]});o=e[0]}catch(e){i=e}return o?{name:o.name,namespace:o.namespaceId,serviceName:o.serviceName,version:o.version,contract:{endpoint:o.endpoint,response:o.response,request:o.request}}:(console.error(`Failed to fetch Flow API definition for "${r}:${n}"`,null!=i?i:"Contract not found"),null)}(t,o,r),ke.set(e,s)),s}(e);if(!r)throw new Oe(`Flow API not found: "${e}"`);const i=function(e,t){var n,o;const r="string"==typeof t.contract?he.safeLoad(t.contract,{schema:he.JSON_SCHEMA,json:!0}):t.contract,{uri:i,method:s="GET",ext_fields:a}=null!==(n=null==r?void 0:r.endpoint)&&void 0!==n?n:{},c=!(null==r||!r.response)&&!1!==r.response.wrapper;if(!i)throw new Error(`Missing endpoint.uri in contract of provider "${e}"`);return{uri:i,method:"list"===s.toLowerCase()?"get":s,ext_fields:a,name:t.name,namespace:t.namespace,serviceName:t.serviceName,version:t.version,isFileType:"file"===(null==r||null===(o=r.response)||void 0===o?void 0:o.type),responseWrapper:c,request:null==r?void 0:r.request}}(e,r);return function(e,t,n,o){const{uri:r,method:i,ext_fields:s,responseWrapper:a,isFileType:c,request:l}=e,u="saveAs"===n;let p,d=t;u&&(Array.isArray(t)?(d=t.slice(),p=d.shift()):p=t.filename);const{url:h,args:f}=function(e,t){const{uri:n,name:o,namespace:r,serviceName:i,version:s,method:a="GET",request:c,ext_fields:l}=e,u=s?"logic.api.gateway"===i||null!=i&&i.startsWith("logic.api.gateway.")?"":i?`api/gateway/${i}`:`api/gateway/${r}.${o}@${s}`:`api/gateway/api_service.${r}.${o}`;let p,d=[];if(Array.isArray(t))d=t.slice(),p=n.replace(/:([^/]+)/g,(()=>d.shift()));else{const e={...t.params};if(p=n.replace(/:([^/]+)/g,((t,n)=>{if((0,ce.hasOwnProperty)(e,n)){const t=e[n];return delete e[n],t}throw new Error(`Missing required param: "${n}"`)})),["get","delete","head"].includes(a.toLowerCase())){var h,f,m,g;"object"===(null==c?void 0:c.type)&&(null!==(h=null===(f=n.match(/:([^/]+)/g))||void 0===f?void 0:f.length)&&void 0!==h?h:0)===(null!==(m=null===(g=c.fields)||void 0===g?void 0:g.length)&&void 0!==m?m:0)||d.push(e)}else{const t=null==l?void 0:l.find((e=>"body"===e.source));if(t){let n;t.name&&(0,ce.hasOwnProperty)(e,t.name)&&(n=e[t.name],delete e[t.name]),d.push(n)}const n=null==l?void 0:l.find((e=>"query"===e.source));if(n){let t;n.name&&(0,ce.hasOwnProperty)(e,n.name)&&(t=e[n.name],delete e[n.name]),d.push(t)}t||n||d.push(e)}t.options&&d.push(t.options)}return{url:u?u+p:p.replace(/^\//,""),args:d}}(e,d);return[...u?[p]:[],{url:h,originalUri:r,method:i,ext_fields:s,responseWrapper:a,request:l,isFileType:c,stream:o},...f]}(i,t,n,o)}class Oe extends Error{constructor(e){super(e),this.name="FlowApiNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Oe)}}var Ce=function(){var e=(0,p.A)((function*(e,t,n){return(yield d.http.post("api/gateway/cmdb.instance.PostSearch/object/".concat(e,"/instance/_search"),t,n)).data}));return function(t,n,o){return e.apply(this,arguments)}}(),Me=n(69740),_e=function(){var e=(0,p.A)((function*(e,t,n){return(yield d.http.get("api/gateway/micro_app.installed_micro_app.GetMenusInfo/api/v1/micro-app/menus/".concat(e),(0,Me.A)((0,Me.A)({},n),{},{params:t}))).data}));return function(t,n,o){return e.apply(this,arguments)}}(),Te=n(87117);const Ne=Symbol("appId"),$e=Symbol("menuI18nNamespace"),Re=Symbol("overrideApp");async function Le(e,t,n){const o=e.find((e=>"inject"!==e.type));if(!o)return;const r=[],i=new Map,s=new WeakMap;for(const t of e)if(t.i18n){const e=`menu/${t.menuId}~${t.app[0].appId}+${t.instanceId}`;Object.entries(t.i18n).forEach((t=>{let[n,o]=t;Te.i18n.addResourceBundle(n,e,o)})),s.set(t,e)}await Promise.all(e.map((e=>async function(e,t,n,o){if(e.dynamicItems&&e.itemsResolve){const i=e.app[0].appId,s={...t,pendingPermissionsPreCheck:[...t.pendingPermissionsPreCheck,M(e.itemsResolve)]};var r;i!==t.app.id&&(s.overrideApp=window.STANDALONE_MICRO_APPS?e.overrideApp:null===(r=o.getStoryboardByAppId(i))||void 0===r?void 0:r.app,s.appendI18nNamespace=n.get(e));const a=await o.resolveData({transform:"items",...e.itemsResolve},s);e.items=a.items}}(e,t,s,n))));for(const t of e){var a;if(null!==(a=t.items)&&void 0!==a&&a.length)if("inject"===t.type&&t.injectMenuGroupId){let e=i.get(t.injectMenuGroupId);e||(e=[],i.set(t.injectMenuGroupId,e)),e.push(t)}else r.push(t)}return{...o,items:r.flatMap((e=>Be(e.items,e,i,s))),[$e]:s.get(o),[Re]:o.overrideApp}}function Be(e,t,n,o){return null==e?void 0:e.map((e=>{var r;const i=e.groupId&&n.get(e.groupId);return i&&n.delete(e.groupId),{...e,children:(null!==(r=Be(e.children,t,n,o))&&void 0!==r?r:[]).concat(i?i.flatMap((e=>Be(e.items,e,n,o))):[]),[Ne]:t.app[0].appId,[$e]:o.get(t),[Re]:t.overrideApp}}))}function je(e){e.items=We(e.items)}function We(e){return function(e){return(0,j.sortBy)(e,(e=>{var t;return null!==(t=e.sort)&&void 0!==t?t:-1/0}))}(e).map((e=>({...e,children:We(e.children)})))}var De=n(59933),xe=n(71321);function Ue(e,t,n,o){if("titleDataSource"in e&&(0,ce.isObject)(e.titleDataSource)&&Object.entries(e.titleDataSource).every((e=>{let[,t]=e;return null===t||""===t}))&&delete e.titleDataSource,"if"in e&&null===e.if&&delete e.if,"to"in e&&e.to&&!(0,xe.isEvaluable)(e.to)){const t=De.pipes.yaml(e.to);(0,ce.isObject)(t)&&["pathname","search","hash"].some((e=>(0,ce.hasOwnProperty)(t,e)))&&(e.to=t)}let r=n;if(t!==n.app.id){var i;const s=window.STANDALONE_MICRO_APPS?e[Re]:null===(i=o.getStoryboardByAppId(t))||void 0===i?void 0:i.app;r={...n,overrideApp:s,appendI18nNamespace:e[$e]}}return o.asyncComputeRealValue(e,r,{ignoreSymbols:!0})}function Fe(e,t,n){return Promise.all(e.map((async e=>{let{children:o,...r}=e;const[i,s]=await Promise.all([Ue(r,r[Ne],t,n),o&&await Fe(o,t,n)]);return{...i,children:s}})))}var qe=n(48518);const ze=new Map;async function He(e){if(e.title||(0,j.isEmpty)(e.titleDataSource))return e.title;const t=JSON.stringify(e.titleDataSource),n=ze.get(t);if(void 0!==n)return n;const{objectId:o,instanceId:r,attributeId:i}=e.titleDataSource,s=null!=i?i:"name",a=await(0,qe.y)(o,r,{fields:s});let c;if("#showKey"===i&&Array.isArray(a[s])){const[e,...t]=a[s];c=t.length>0?`${e}(${t.join(",")})`:String(e)}else c=String(a[s]);return ze.set(t,c),c}const Ge=new Map,Je=new Map;function Ve(e){return null==e?void 0:e.filter(f.checkIfOfComputed).map((e=>{const t=Ve(e.children);return"group"===e.type?{type:"group",title:e.text,childLayout:e.childLayout,items:t,groupId:e.groupId,groupFrom:e.groupFrom}:null!=t&&t.length?{type:"subMenu",childLayout:e.childLayout,title:e.text,icon:e.icon,items:t,defaultExpanded:e.defaultExpanded}:function(e){return e.href?P(e.href):!!e.to&&k(e.to)}(e)?null:(0,j.omit)(e,["type","items","children"])})).filter(Boolean)}function Ye(e){return Je.get(e)}function Ke(e,t,n){let o=Ge.get(e);return o||(o=async function(e,t,n){const o=window.STANDALONE_MICRO_APPS?function(e,t,n){var o,r,i,s;const a=n.getStoryboardByAppId(t);return(null!==(o=null!==(r=null===(i=a.meta)||void 0===i?void 0:i.injectMenus)&&void 0!==r?r:null===(s=a.meta)||void 0===s?void 0:s.menus)&&void 0!==o?o:[]).filter((t=>t.menuId===e)).map((e=>{var n;return{...e,...null!==(n=e.app)&&void 0!==n&&null!==(n=n[0])&&void 0!==n&&n.appId?{}:{app:[{appId:t}]}}}))}(e,t.app.id,n):t.flags["three-level-menu-layout"]?(await _e(e,{menuObjectId:"EASYOPS_STORYBOARD_MENU"})).menus:(await Ce("EASYOPS_STORYBOARD_MENU",{page:1,page_size:200,fields:{menuId:!0,title:!0,icon:!0,link:!0,titleDataSource:!0,defaultCollapsed:!0,defaultCollapsedBreakpoint:!0,type:!0,injectMenuGroupId:!0,dynamicItems:!0,itemsResolve:!0,items:!0,i18n:!0,"items.children":!0,"app.appId":!0},query:{menuId:{$eq:e},app:{$size:{$gt:0}}}})).list,r=await Le(o,t,n);if(!r)throw new Error(`Menu not found: ${e}`);je(r);const{items:i,app:s,...a}=r,c={...t,pendingPermissionsPreCheck:[...t.pendingPermissionsPreCheck,M([i,a])]};delete c.tplStateStoreId,delete c.forEachItem,delete c.forEachIndex,delete c.forEachSize;const l=s[0].appId,[u,p]=await Promise.all([Ue(a,l,c,n),Fe(i,c,n)]),d={title:await He(u),...(0,j.pick)(u,["icon","link","defaultCollapsed","defaultCollapsedBreakpoint"]),menuItems:Ve(p)};Je.set(e,d)}(e,t,n)),o}const Qe=[];let Xe=null;const Ze={maxWaitingTime:5e3,maxLoggedEvents:10};function et(){clearTimeout(Xe),Qe.length>Ze.maxLoggedEvents?tt():Xe=setTimeout(tt,Ze.maxWaitingTime)}function tt(){if(0===Qe.length)return;const e={model:"easyops.FRONTEND_STAT",columns:["_ver","st","et","lt","size","time","traceId","code","duration","page","uid","username","api","type","msg","status","pageId","route","apiCount","maxApiTimeCost","apiSizeCost","pageTitle"],data:Qe.splice(0,Ze.maxLoggedEvents)};var t;!function(e,t){const n=new Blob([JSON.stringify(t)],{type:"application/json"});window.navigator.sendBeacon(e,n)}(Ze.api,e),Qe.length&&(t=tt,(window.requestIdleCallback||window.requestAnimationFrame||(e=>setTimeout(e,17)))(t))}function nt(){window.addEventListener("beforeunload",tt,!1)}let ot,rt=!1,it=null,st=!0;const at=[];function ct(e){rt||(rt=!0,ot||(ot=function(e,t){return Object.assign(Ze,{...t,api:e}),{sendOnExit:nt,emit:et}}(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),ot.sendOnExit()))}const lt=Symbol("HttpAnalytics");function ut(e){const t=Math.round(performance.now()),n=Date.now();return e[lt]={st:n,time:Math.round(n/1e3),perfStartTime:t},e}function pt(e,t){return ht(!1,e,t)}function dt(e,t){return ht(!0,e,t)}function ht(e,t,n){const o=Math.round(performance.now()),r=Date.now(),{[lt]:i,url:s}=n;if(i&&!(e&&t instanceof d.HttpAbortError)){delete n[lt];const{st:c,time:l,perfStartTime:u}=i,{userInstanceId:p,username:h}=w();let f,m,g,v,A,y,S;if(e){const e=t instanceof d.HttpResponseError;(e||t instanceof d.HttpParseError)&&(({status:A,headers:y}=t.response),e&&(S=t.responseJson))}else({status:A,data:S,headers:y}=t);(0,ce.isObject)(S)&&({code:f,message:m}=S),y instanceof Headers&&(g=y.get("x-b3-traceid"),v=y.get("content-length")),a={st:c,_ver:c,uid:p,username:h,time:l,et:r,page:location.href,duration:o-u,api:s,type:"api",code:null!=f?f:-1,msg:null!=m?m:"",status:A,traceId:null!=g?g:"",size:v?Number(v):-1},it?Qe.push({...a,type:"apiRequest",...it}):at.push(a)}var a;return e?Promise.reject(t):t}function ft(){const e=Math.round(performance.now()),t=Date.now();return at.length=0,it=null,function(n){let{status:o,path:r,pageTitle:i}=n;if("ok"!==o)return Qe.push(...at),void(at.length=0);const s=Math.round(performance.now())-e,a=Date.now(),{username:c}=w();(function(e){const t=function(){const e=URL.createObjectURL(new Blob([]));let t=e.substring(e.lastIndexOf("/")+1);return URL.revokeObjectURL(e),st&&(t="88-"+t,st=!1),t}(),{lt:n,route:o}=e;it={lt:n,route:o,pageId:t},Qe.push({...e,pageId:t,apiCount:at.length,maxApiTimeCost:Math.max(0,...at.map((e=>e.duration))),size:at.map((e=>e.size)).filter((e=>e>0)).reduce(((e,t)=>e+t),0)});for(const e of at)Qe.push({...e,...it});at.length=0,ot.emit()})({type:"page",page:location.href,_ver:t,time:Math.round(t/1e3),st:t,et:a,lt:s,pageTitle:i,username:c,route:r}),window.dispatchEvent(new CustomEvent("route.render",{detail:{renderTime:s}}))}}const mt=Object.freeze({checkPermissions:function(){if(!S())return!1;if(w().isAdmin)return!0;for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const e of t)switch(C.get(e)){case"unauthorized":case"undefined":return!1;case void 0:return console.error(`Un-checked permission action: "${e}", please make sure the permission to check is defined in permissionsPreCheck.`),!1}return!0},preCheckPermissions:function(e){if(S()&&!w().isAdmin)return _((0,u.scanPermissionActionsInStoryboard)(e))},preCheckPermissionsForBrickOrRoute:async function(e,t){if(S()&&!w().isAdmin&&Array.isArray(e.permissionsPreCheck))return _(await t(e.permissionsPreCheck))}}),gt=new class{constructor(){(0,T.A)(this,X),(0,N.A)(this,Y,void 0),(0,N.A)(this,K,{sub:new Map,unsub:new Map}),(0,N.A)(this,Q,new Map)}subscribe(e,t){const n=JSON.stringify(t);return(0,R.A)(X,this,ee).call(this,"sub",e,t,n)}unsubscribe(e){const t=(0,B.A)(Q,this).get(e);if(!t){const t=`The message channel to unsubscribe "${e}" is not found`;return console.error(t),Promise.reject(new Error(t))}const n=JSON.parse(t),o=(0,R.A)(X,this,ee).call(this,"unsub",e,n,t);return(0,B.A)(K,this).sub.delete(t),o.then((()=>{(0,B.A)(Q,this).delete(e)})),o}onMessage(e,t){let n=(0,B.A)(Q,this).get(e),o=!1;return(0,$.A)(X,this,Z).onMessage((r=>{n||(n=(0,B.A)(Q,this).get(e)),n?"MESSAGE.PUSH"===r.event&&function(e,t){const n=JSON.parse(e);return n.system===t.system&&(n.topic===t.topic||"string"==typeof n.topic&&n.topic.includes("*")&&new RegExp(`^${n.topic.replace(/([^*]*)\*([^*]*)/g,((e,t,n)=>`${(0,j.escapeRegExp)(t)}[^/]*${(0,j.escapeRegExp)(n)}`))}$`).test(t.topic))}(n,r.payload)&&t(r.payload.message):o||(console.error(`Message channel: "${e}" not found`),o=!0)}))}onClose(e){return(0,$.A)(X,this,Z).onClose(e)}reset(){var e;(0,B.A)(K,this).sub.clear(),(0,B.A)(K,this).unsub.clear(),(0,B.A)(Q,this).clear(),null===(e=(0,B.A)(Y,this))||void 0===e||e.reset()}},vt=function(){const e=(0,f.getV2RuntimeFromDll)();if(e)return Object.freeze((0,j.pick)(e,["authenticate","getAuth","isLoggedIn","logout","addPathToBlackList","isBlockedPath","isBlockedUrl","isBlockedHref"]))}()||o}}]);
3
- //# sourceMappingURL=1097.56d301a5.js.map