@next-bricks/ai-portal 0.46.0 → 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 (47) hide show
  1. package/dist/bricks.json +36 -36
  2. package/dist/chunks/7431.23127b05.js +3 -0
  3. package/dist/chunks/7431.23127b05.js.map +1 -0
  4. package/dist/chunks/{7570.a411e1f2.js → 7570.708bdafd.js} +2 -2
  5. package/dist/chunks/{7570.a411e1f2.js.map → 7570.708bdafd.js.map} +1 -1
  6. package/dist/chunks/{7954.48580daf.js → 7954.c1753f33.js} +2 -2
  7. package/dist/chunks/7954.c1753f33.js.map +1 -0
  8. package/dist/chunks/8882.30a26232.js +3 -0
  9. package/dist/chunks/8882.30a26232.js.map +1 -0
  10. package/dist/chunks/9328.c93d9ac1.js +2 -0
  11. package/dist/chunks/9328.c93d9ac1.js.map +1 -0
  12. package/dist/chunks/goal-card-list.a9057f02.js +3 -0
  13. package/dist/chunks/goal-card-list.a9057f02.js.map +1 -0
  14. package/dist/chunks/main.0a194943.js +2 -0
  15. package/dist/chunks/main.0a194943.js.map +1 -0
  16. package/dist/examples.json +12 -12
  17. package/dist/index.0ebd0c2a.js +2 -0
  18. package/dist/index.0ebd0c2a.js.map +1 -0
  19. package/dist/manifest.json +242 -242
  20. package/dist/types.json +137 -137
  21. package/dist-types/cruise-canvas/NodeRequirement/NodeRequirement.d.ts +2 -1
  22. package/dist-types/cruise-canvas/interfaces.d.ts +1 -0
  23. package/dist-types/goal-card-list/CardItem/CardItem.d.ts +2 -1
  24. package/dist-types/shared/interfaces.d.ts +1 -0
  25. package/package.json +2 -2
  26. package/dist/chunks/1097.56d301a5.js +0 -3
  27. package/dist/chunks/1097.56d301a5.js.LICENSE.txt +0 -9
  28. package/dist/chunks/1097.56d301a5.js.map +0 -1
  29. package/dist/chunks/6862.32630cc8.js +0 -3
  30. package/dist/chunks/6862.32630cc8.js.map +0 -1
  31. package/dist/chunks/7431.23a1dd60.js +0 -3
  32. package/dist/chunks/7431.23a1dd60.js.map +0 -1
  33. package/dist/chunks/7954.48580daf.js.map +0 -1
  34. package/dist/chunks/9328.4ac010e3.js +0 -2
  35. package/dist/chunks/9328.4ac010e3.js.map +0 -1
  36. package/dist/chunks/9848.ab8ad988.js +0 -3
  37. package/dist/chunks/9848.ab8ad988.js.LICENSE.txt +0 -1
  38. package/dist/chunks/9848.ab8ad988.js.map +0 -1
  39. package/dist/chunks/goal-card-list.a1db72ad.js +0 -3
  40. package/dist/chunks/goal-card-list.a1db72ad.js.map +0 -1
  41. package/dist/chunks/main.d0fc7f5d.js +0 -2
  42. package/dist/chunks/main.d0fc7f5d.js.map +0 -1
  43. package/dist/index.db92c25e.js +0 -2
  44. package/dist/index.db92c25e.js.map +0 -1
  45. /package/dist/chunks/{7431.23a1dd60.js.LICENSE.txt → 7431.23127b05.js.LICENSE.txt} +0 -0
  46. /package/dist/chunks/{6862.32630cc8.js.LICENSE.txt → 8882.30a26232.js.LICENSE.txt} +0 -0
  47. /package/dist/chunks/{goal-card-list.a1db72ad.js.LICENSE.txt → goal-card-list.a9057f02.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -75,6 +75,62 @@
75
75
  }
76
76
  ]
77
77
  },
78
+ "ai-portal.call-tool": {
79
+ "type": "provider",
80
+ "params": [
81
+ {
82
+ "name": "tool",
83
+ "annotation": {
84
+ "type": "reference",
85
+ "typeName": {
86
+ "type": "identifier",
87
+ "name": "ToolInfo"
88
+ }
89
+ }
90
+ },
91
+ {
92
+ "name": "params",
93
+ "annotation": {
94
+ "type": "reference",
95
+ "typeName": {
96
+ "type": "identifier",
97
+ "name": "Record"
98
+ },
99
+ "typeParameters": {
100
+ "type": "typeParameterInstantiation",
101
+ "params": [
102
+ {
103
+ "type": "keyword",
104
+ "value": "string"
105
+ },
106
+ {
107
+ "type": "keyword",
108
+ "value": "unknown"
109
+ }
110
+ ]
111
+ }
112
+ }
113
+ }
114
+ ],
115
+ "returns": {
116
+ "annotation": {
117
+ "type": "reference",
118
+ "typeName": {
119
+ "type": "identifier",
120
+ "name": "Promise"
121
+ },
122
+ "typeParameters": {
123
+ "type": "typeParameterInstantiation",
124
+ "params": [
125
+ {
126
+ "type": "keyword",
127
+ "value": "unknown"
128
+ }
129
+ ]
130
+ }
131
+ }
132
+ }
133
+ },
78
134
  "ai-portal.save-request-store": {
79
135
  "type": "provider",
80
136
  "params": [
@@ -192,143 +248,6 @@
192
248
  }
193
249
  }
194
250
  },
195
- "ai-portal.call-tool": {
196
- "type": "provider",
197
- "params": [
198
- {
199
- "name": "tool",
200
- "annotation": {
201
- "type": "reference",
202
- "typeName": {
203
- "type": "identifier",
204
- "name": "ToolInfo"
205
- }
206
- }
207
- },
208
- {
209
- "name": "params",
210
- "annotation": {
211
- "type": "reference",
212
- "typeName": {
213
- "type": "identifier",
214
- "name": "Record"
215
- },
216
- "typeParameters": {
217
- "type": "typeParameterInstantiation",
218
- "params": [
219
- {
220
- "type": "keyword",
221
- "value": "string"
222
- },
223
- {
224
- "type": "keyword",
225
- "value": "unknown"
226
- }
227
- ]
228
- }
229
- }
230
- }
231
- ],
232
- "returns": {
233
- "annotation": {
234
- "type": "reference",
235
- "typeName": {
236
- "type": "identifier",
237
- "name": "Promise"
238
- },
239
- "typeParameters": {
240
- "type": "typeParameterInstantiation",
241
- "params": [
242
- {
243
- "type": "keyword",
244
- "value": "unknown"
245
- }
246
- ]
247
- }
248
- }
249
- }
250
- },
251
- "ai-portal.page-container": {
252
- "properties": [
253
- {
254
- "name": "pageTitle",
255
- "annotation": {
256
- "type": "keyword",
257
- "value": "string"
258
- }
259
- },
260
- {
261
- "name": "breadcrumbs",
262
- "annotation": {
263
- "type": "array",
264
- "elementType": {
265
- "type": "reference",
266
- "typeName": {
267
- "type": "identifier",
268
- "name": "Breadcrumb"
269
- }
270
- }
271
- }
272
- },
273
- {
274
- "name": "size",
275
- "annotation": {
276
- "type": "union",
277
- "types": [
278
- {
279
- "type": "jsLiteral",
280
- "value": "medium"
281
- },
282
- {
283
- "type": "jsLiteral",
284
- "value": "small"
285
- }
286
- ]
287
- }
288
- },
289
- {
290
- "name": "textContent",
291
- "annotation": {
292
- "type": "keyword",
293
- "value": "string"
294
- }
295
- }
296
- ],
297
- "events": [],
298
- "methods": [],
299
- "types": [
300
- {
301
- "type": "interface",
302
- "name": "Breadcrumb",
303
- "body": [
304
- {
305
- "type": "propertySignature",
306
- "key": {
307
- "type": "identifier",
308
- "name": "text"
309
- },
310
- "annotation": {
311
- "type": "keyword",
312
- "value": "string"
313
- },
314
- "computed": false
315
- },
316
- {
317
- "type": "propertySignature",
318
- "key": {
319
- "type": "identifier",
320
- "name": "url"
321
- },
322
- "annotation": {
323
- "type": "keyword",
324
- "value": "string"
325
- },
326
- "computed": false
327
- }
328
- ]
329
- }
330
- ]
331
- },
332
251
  "ai-portal.stat-with-mini-chart": {
333
252
  "properties": [
334
253
  {
@@ -433,6 +352,87 @@
433
352
  "events": [],
434
353
  "methods": []
435
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
436
  "ai-portal.tab-list": {
437
437
  "properties": [
438
438
  {
@@ -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";
@@ -21,6 +21,7 @@ export interface GoalItem {
21
21
  }
22
22
  interface GoalCardItemProps {
23
23
  goalItem: GoalItem;
24
+ idWidth?: number;
24
25
  cardStyle?: React.CSSProperties;
25
26
  isActive?: boolean;
26
27
  onTitleChange?: (newTitle: string) => void;
@@ -30,5 +31,5 @@ interface GoalCardItemProps {
30
31
  onAppendChild?: () => void;
31
32
  onRevokeAppendChild?: () => void;
32
33
  }
33
- export declare function GoalCardItem({ goalItem, cardStyle, onStatusChange, onTitleChange, onClick, onNewChat, onAppendChild, onRevokeAppendChild, isActive, }: GoalCardItemProps): React.JSX.Element;
34
+ export declare function GoalCardItem({ goalItem, idWidth, cardStyle, onStatusChange, onTitleChange, onClick, onNewChat, onAppendChild, onRevokeAppendChild, isActive, }: GoalCardItemProps): React.JSX.Element;
34
35
  export {};
@@ -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.0",
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": "775252ed45f90c6eeb5e2e32744e9c8a8ed06b88"
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
@@ -1,9 +0,0 @@
1
- /**! @contract easyops.api.cmdb.instance.PostSearch@1.1.0 */
2
-
3
- /**! @contract easyops.api.micro_app.installed_micro_app.GetMenusInfo@1.0.0 */
4
-
5
- /**! @contract easyops.api.micro_app.permission.ValidatePermissions@1.0.0 */
6
-
7
- /**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
8
-
9
- /**! @contract easyops.api.next_builder.contract_center.BatchSearchContract@1.0.0 */