@teambit/insights 0.0.582 → 0.0.586
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/insight-manager.js
CHANGED
|
@@ -21,6 +21,16 @@ function _defineProperty2() {
|
|
|
21
21
|
return data;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function _pMapSeries() {
|
|
25
|
+
const data = _interopRequireDefault(require("p-map-series"));
|
|
26
|
+
|
|
27
|
+
_pMapSeries = function () {
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return data;
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
function _insightAlreadyExists() {
|
|
25
35
|
const data = _interopRequireDefault(require("./exceptions/insight-already-exists"));
|
|
26
36
|
|
|
@@ -102,8 +112,11 @@ class InsightManager {
|
|
|
102
112
|
|
|
103
113
|
|
|
104
114
|
async run(insightNames, opts) {
|
|
105
|
-
const res = [];
|
|
106
|
-
|
|
115
|
+
const res = []; // the reason for not using Promise.all here is that the current both insights building the graph.
|
|
116
|
+
// if it happens at the same time, some props are not populated in one of the instances. it obviously
|
|
117
|
+
// should be fixed in the GraphBuilder class. see "todo" there.
|
|
118
|
+
|
|
119
|
+
await (0, _pMapSeries().default)(insightNames, async insightName => {
|
|
107
120
|
const insight = this.getByName(insightName);
|
|
108
121
|
|
|
109
122
|
if (insight) {
|
|
@@ -115,7 +128,7 @@ class InsightManager {
|
|
|
115
128
|
|
|
116
129
|
res.push(insightRes);
|
|
117
130
|
}
|
|
118
|
-
})
|
|
131
|
+
});
|
|
119
132
|
return res;
|
|
120
133
|
}
|
|
121
134
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["insight-manager.ts"],"names":["InsightManager","constructor","insights","Map","forEach","insight","register","name","has","InsightAlreadyExists","set","listInsights","keys","getByName","insightName","get","delete","InsightNotFound","run","insightNames","opts","res","
|
|
1
|
+
{"version":3,"sources":["insight-manager.ts"],"names":["InsightManager","constructor","insights","Map","forEach","insight","register","name","has","InsightAlreadyExists","set","listInsights","keys","getByName","insightName","get","delete","InsightNotFound","run","insightNames","opts","res","insightRes","renderData","renderedData","push","runAll","allInsightNames"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAMO,MAAMA,cAAN,CAAqB;AAC1B;AAEAC,EAAAA,WAAW;AACT;AACJ;AACA;AACIC,EAAAA,QAJS,EAKT;AAAA,sDANwC,IAAIC,GAAJ,EAMxC;AACAD,IAAAA,QAAQ,CAACE,OAAT,CAAkBC,OAAD,IAAa;AAC5B,WAAKC,QAAL,CAAcD,OAAd;AACD,KAFD;AAGD;AAED;AACF;AACA;;;AACEC,EAAAA,QAAQ,CAACD,OAAD,EAAmB;AACzB,UAAME,IAAI,GAAGF,OAAO,CAACE,IAArB;;AACA,QAAI,KAAKL,QAAL,CAAcM,GAAd,CAAkBD,IAAlB,CAAJ,EAA6B;AAC3B,YAAM,KAAIE,+BAAJ,EAAyBF,IAAzB,CAAN;AACD;;AACD,SAAKL,QAAL,CAAcQ,GAAd,CAAkBH,IAAlB,EAAwBF,OAAxB;AACD;AACD;AACF;AACA;;;AACEM,EAAAA,YAAY,GAAa;AACvB,WAAO,CAAC,GAAG,KAAKT,QAAL,CAAcU,IAAd,EAAJ,CAAP;AACD;AAED;AACF;AACA;;;AACEC,EAAAA,SAAS,CAACC,WAAD,EAA2C;AAClD,WAAO,KAAKZ,QAAL,CAAca,GAAd,CAAkBD,WAAlB,CAAP;AACD;AAED;AACF;AACA;;;AACEE,EAAAA,MAAM,CAACF,WAAD,EAAsB;AAC1B,QAAI,CAAC,KAAKZ,QAAL,CAAcM,GAAd,CAAkBM,WAAlB,CAAL,EAAqC;AACnC,YAAM,KAAIG,0BAAJ,EAAoBH,WAApB,CAAN;AACD;;AACD,SAAKZ,QAAL,CAAcc,MAAd,CAAqBF,WAArB;AACD;AAED;AACF;AACA;AACA;;;AACW,QAAHI,GAAG,CAACC,YAAD,EAAyBC,IAAzB,EAA4E;AACnF,UAAMC,GAAoB,GAAG,EAA7B,CADmF,CAEnF;AACA;AACA;;AACA,UAAM,2BAAWF,YAAX,EAAyB,MAAOL,WAAP,IAAuB;AACpD,YAAMT,OAAO,GAAG,KAAKQ,SAAL,CAAeC,WAAf,CAAhB;;AACA,UAAIT,OAAJ,EAAa;AACX,cAAMiB,UAAyB,GAAG,MAAMjB,OAAO,CAACa,GAAR,EAAxC;;AACA,YAAI,CAACE,IAAI,CAACG,UAAV,EAAsB;AACpB,iBAAOD,UAAU,CAACE,YAAlB;AACD;;AACDH,QAAAA,GAAG,CAACI,IAAJ,CAASH,UAAT;AACD;AACF,KATK,CAAN;AAUA,WAAOD,GAAP;AACD;AAED;AACF;AACA;AACA;;;AACc,QAANK,MAAM,CAACN,IAAD,EAAoD;AAC9D,UAAMO,eAAe,GAAG,KAAKhB,YAAL,EAAxB;AACA,WAAO,KAAKO,GAAL,CAASS,eAAT,EAA0BP,IAA1B,CAAP;AACD;;AA7EyB","sourcesContent":["import pMapSeries from 'p-map-series';\nimport InsightAlreadyExists from './exceptions/insight-already-exists';\nimport InsightNotFound from './exceptions/insight-not-found';\nimport { Insight, InsightResult } from './insight';\n\nexport type RunInsightOptions = {\n renderData: boolean;\n};\nexport class InsightManager {\n /** insights is an insight registry */\n readonly insights: Map<string, Insight> = new Map();\n constructor(\n /**\n * array of registered insights\n */\n insights: Insight[]\n ) {\n insights.forEach((insight) => {\n this.register(insight);\n });\n }\n\n /**\n * registers a new insight and returns the updated insight registry map\n */\n register(insight: Insight) {\n const name = insight.name;\n if (this.insights.has(name)) {\n throw new InsightAlreadyExists(name);\n }\n this.insights.set(name, insight);\n }\n /**\n * list of all registered insights\n */\n listInsights(): string[] {\n return [...this.insights.keys()];\n }\n\n /**\n * gets a specific insight by its name or undefined if doesn't exist\n */\n getByName(insightName: string): Insight | undefined {\n return this.insights.get(insightName);\n }\n\n /**\n * deletes a specific insight by its name if exists\n */\n delete(insightName: string) {\n if (!this.insights.has(insightName)) {\n throw new InsightNotFound(insightName);\n }\n this.insights.delete(insightName);\n }\n\n /**\n * execute an array of insights\n *\n */\n async run(insightNames: string[], opts: RunInsightOptions): Promise<InsightResult[]> {\n const res: InsightResult[] = [];\n // the reason for not using Promise.all here is that the current both insights building the graph.\n // if it happens at the same time, some props are not populated in one of the instances. it obviously\n // should be fixed in the GraphBuilder class. see \"todo\" there.\n await pMapSeries(insightNames, async (insightName) => {\n const insight = this.getByName(insightName);\n if (insight) {\n const insightRes: InsightResult = await insight.run();\n if (!opts.renderData) {\n delete insightRes.renderedData;\n }\n res.push(insightRes);\n }\n });\n return res;\n }\n\n /**\n * execute all insights in the registry\n *\n */\n async runAll(opts: RunInsightOptions): Promise<InsightResult[]> {\n const allInsightNames = this.listInsights();\n return this.run(allInsightNames, opts);\n }\n}\n"]}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/insights",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.586",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/explorer/insights",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.explorer",
|
|
8
8
|
"name": "insights",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.586"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"p-map-series": "2.1.0",
|
|
12
13
|
"@teambit/harmony": "0.2.11",
|
|
13
14
|
"chalk": "2.4.2",
|
|
14
15
|
"semver": "7.3.4",
|
|
15
16
|
"@babel/runtime": "7.12.18",
|
|
16
17
|
"core-js": "^3.0.0",
|
|
17
|
-
"@teambit/graph": "0.0.
|
|
18
|
-
"@teambit/cli": "0.0.
|
|
19
|
-
"@teambit/component": "0.0.
|
|
20
|
-
"@teambit/bit-error": "0.0.
|
|
18
|
+
"@teambit/graph": "0.0.586",
|
|
19
|
+
"@teambit/cli": "0.0.402",
|
|
20
|
+
"@teambit/component": "0.0.586",
|
|
21
|
+
"@teambit/bit-error": "0.0.388"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/semver": "7.3.4",
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"@types/node": "12.20.4"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"@teambit/legacy": "1.0.
|
|
33
|
+
"@teambit/legacy": "1.0.188",
|
|
33
34
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
34
35
|
"react": "^16.8.0 || ^17.0.0"
|
|
35
36
|
},
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
"react": "-"
|
|
58
59
|
},
|
|
59
60
|
"peerDependencies": {
|
|
60
|
-
"@teambit/legacy": "1.0.
|
|
61
|
+
"@teambit/legacy": "1.0.188",
|
|
61
62
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
62
63
|
"react": "^16.8.0 || ^17.0.0"
|
|
63
64
|
}
|
package/tsconfig.json
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"skipLibCheck": true,
|
|
16
16
|
"moduleResolution": "node",
|
|
17
17
|
"esModuleInterop": true,
|
|
18
|
+
"resolveJsonModule": true,
|
|
18
19
|
"composite": true,
|
|
19
20
|
"emitDeclarationOnly": true,
|
|
20
21
|
"outDir": "dist",
|
|
@@ -25,8 +26,7 @@
|
|
|
25
26
|
"strict": true,
|
|
26
27
|
"noImplicitAny": false,
|
|
27
28
|
"rootDir": ".",
|
|
28
|
-
"preserveConstEnums": true
|
|
29
|
-
"resolveJsonModule": true
|
|
29
|
+
"preserveConstEnums": true
|
|
30
30
|
},
|
|
31
31
|
"exclude": [
|
|
32
32
|
"dist"
|
|
Binary file
|