File tree Expand file tree Collapse file tree 6 files changed +41
-14
lines changed
types/src/sdk/server/apis Expand file tree Collapse file tree 6 files changed +41
-14
lines changed Original file line number Diff line number Diff line change 77 "directory" : " packages/ai"
88 },
99 "license" : " MIT" ,
10- "main" : " ./dist/server/ index.js" ,
11- "types" : " ./dist/server/ index.d.ts" ,
10+ "main" : " ./dist/index.js" ,
11+ "types" : " ./dist/index.d.ts" ,
1212 "files" : [
1313 " dist" ,
1414 " bin"
Original file line number Diff line number Diff line change @@ -138,9 +138,9 @@ export const getModuleById = async (
138138 moduleId : string ,
139139) : Promise < {
140140 module : {
141- id : string ;
142- renderId : string ;
143- webpackId : string | number ;
141+ id : number ;
142+ renderId ? : string ;
143+ webpackId : string ;
144144 path : string ;
145145 isPreferSource : boolean ;
146146 imported : number [ ] ;
@@ -216,11 +216,11 @@ export const getPackageDependency = async () => {
216216} ;
217217
218218export const getRuleInfo = async ( ) => {
219- return await sendRequest ( SDK . ServerAPI . API . GetOverlayAlerts , { } ) ;
219+ return await sendRequest ( SDK . ServerAPI . API . GetBundleAlerts , { } ) ;
220220} ;
221221
222222export const getDuplicatePackages = async ( ) => {
223- const ruleInfo = await sendRequest ( SDK . ServerAPI . API . GetOverlayAlerts , { } ) ;
223+ const ruleInfo = await sendRequest ( SDK . ServerAPI . API . GetBundleAlerts , { } ) ;
224224
225225 if ( ! ruleInfo ) {
226226 return {
@@ -233,9 +233,7 @@ export const getDuplicatePackages = async () => {
233233
234234 // Assuming ruleInfo contains a 'rules' array
235235 // @ts -ignore
236- const e1001Rule = ruleInfo ?. find ( ( rule ) =>
237- rule . description ?. includes ( 'E1001' ) ,
238- ) ;
236+ const e1001Rule = ruleInfo ?. find ( ( rule ) => rule . code ?. includes ( 'E1001' ) ) ;
239237
240238 if ( e1001Rule ) {
241239 return {
Original file line number Diff line number Diff line change @@ -18,6 +18,11 @@ export interface AlertsAPIResponse {
1818 * get the alerts list which use to display in overlay at the client page
1919 */
2020 [ API . GetOverlayAlerts ] : OverlayRuleStoreData [ ] ;
21+
22+ /**
23+ * get the alerts list which use to display in category bundle at the client page
24+ */
25+ [ API . GetBundleAlerts ] : OverlayRuleStoreData [ ] ;
2126}
2227
2328export interface AlertsAPIRequestBody {
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export enum API {
7979 /** Alerts API */
8080 GetPackageRelationAlertDetails = '/api/alerts/details/package/relation' ,
8181 GetOverlayAlerts = '/api/alerts/overlay' ,
82+ GetBundleAlerts = '/api/alerts/bundle' ,
8283
8384 /** BundleDiff API */
8485 BundleDiffManifest = '/api/bundle_diff/manifest.json' ,
Original file line number Diff line number Diff line change @@ -405,9 +405,18 @@ export class APIDataLoader {
405405
406406 case SDK . ServerAPI . API . GetOverlayAlerts :
407407 return this . loader . loadData ( 'errors' ) . then ( ( res ) => {
408- return ( res || [ ] ) . filter (
408+ const results = ( res || [ ] ) . filter (
409409 ( e ) => e . code === Rule . RuleMessageCodeEnumerated . Overlay ,
410- ) as R ;
410+ ) as Rule . OverlayRuleStoreData [ ] ;
411+ return results as R ;
412+ } ) ;
413+
414+ case SDK . ServerAPI . API . GetBundleAlerts :
415+ return this . loader . loadData ( 'errors' ) . then ( ( res ) => {
416+ const results = ( res || [ ] ) . filter (
417+ ( e ) => e . category === Rule . RuleMessageCategory . Bundle ,
418+ ) as Rule . OverlayRuleStoreData [ ] ;
419+ return results as R ;
411420 } ) ;
412421
413422 /** Bundle Diff API */
@@ -523,8 +532,8 @@ export class APIDataLoader {
523532
524533 case SDK . ServerAPI . API . GetChunkGraphAI :
525534 return this . loader . loadData ( 'chunkGraph' ) . then ( ( res ) => {
526- const { chunks = [ ] } = res || { } ;
527- const filteredChunks = chunks . map ( ( { modules , ...rest } ) => rest ) ;
535+ const { assets = [ ] } = res || { } ;
536+ const filteredChunks = assets . map ( ( { content , ...rest } ) => rest ) ;
528537 return filteredChunks as R ;
529538 } ) ;
530539
You can’t perform that action at this time.
0 commit comments