@looker/run-it 0.9.28 → 0.9.32
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +46 -0
- package/lib/components/PerfTracker/perfUtils.d.ts +3 -1
- package/lib/components/PerfTracker/perfUtils.js +17 -1
- package/lib/components/PerfTracker/perfUtils.js.map +1 -1
- package/lib/esm/components/PerfTracker/perfUtils.js +17 -1
- package/lib/esm/components/PerfTracker/perfUtils.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,51 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### [0.9.32](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.31...run-it-v0.9.32) (2022-04-07)
|
4
|
+
|
5
|
+
|
6
|
+
### Dependencies
|
7
|
+
|
8
|
+
* The following workspace dependencies were updated
|
9
|
+
* dependencies
|
10
|
+
* @looker/code-editor bumped from ^0.1.20 to ^0.1.21
|
11
|
+
* @looker/extension-utils bumped from ^0.1.8 to ^0.1.9
|
12
|
+
* @looker/sdk bumped from ^22.4.1 to ^22.4.2
|
13
|
+
* @looker/sdk-codegen bumped from ^21.5.1 to ^21.5.2
|
14
|
+
* @looker/sdk-rtl bumped from ^21.3.2 to ^21.3.3
|
15
|
+
|
16
|
+
### [0.9.31](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.30...run-it-v0.9.31) (2022-04-07)
|
17
|
+
|
18
|
+
|
19
|
+
### Dependencies
|
20
|
+
|
21
|
+
* The following workspace dependencies were updated
|
22
|
+
* dependencies
|
23
|
+
* @looker/code-editor bumped from ^0.1.19 to ^0.1.20
|
24
|
+
* @looker/extension-utils bumped from ^0.1.7 to ^0.1.8
|
25
|
+
* @looker/sdk bumped from ^22.4.0 to ^22.4.1
|
26
|
+
* @looker/sdk-codegen bumped from ^21.5.0 to ^21.5.1
|
27
|
+
|
28
|
+
### [0.9.30](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.29...run-it-v0.9.30) (2022-03-24)
|
29
|
+
|
30
|
+
|
31
|
+
### Dependencies
|
32
|
+
|
33
|
+
* The following workspace dependencies were updated
|
34
|
+
* dependencies
|
35
|
+
* @looker/extension-utils bumped from ^0.1.6 to ^0.1.7
|
36
|
+
* @looker/sdk bumped from ^22.2.0 to ^22.4.0
|
37
|
+
|
38
|
+
### [0.9.29](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.28...run-it-v0.9.29) (2022-03-04)
|
39
|
+
|
40
|
+
|
41
|
+
### Dependencies
|
42
|
+
|
43
|
+
* The following workspace dependencies were updated
|
44
|
+
* dependencies
|
45
|
+
* @looker/code-editor bumped from ^0.1.18 to ^0.1.19
|
46
|
+
* @looker/extension-utils bumped from ^0.1.5 to ^0.1.6
|
47
|
+
* @looker/sdk-codegen bumped from ^21.4.0 to ^21.5.0
|
48
|
+
|
3
49
|
### [0.9.28](https://www.github.com/looker-open-source/sdk-codegen/compare/run-it-v0.9.27...run-it-v0.9.28) (2022-02-18)
|
4
50
|
|
5
51
|
|
@@ -36,7 +36,9 @@ export declare class LoadTimes implements IResourceLoadTimes {
|
|
36
36
|
export declare class PerfTimings {
|
37
37
|
private _full;
|
38
38
|
private _bufferSize;
|
39
|
-
static
|
39
|
+
private static _supported;
|
40
|
+
static get supported(): boolean;
|
41
|
+
static set supported(value: boolean);
|
40
42
|
constructor();
|
41
43
|
clear(): boolean;
|
42
44
|
entries(pattern?: string, type?: string): LoadTimes[];
|
@@ -81,6 +81,22 @@ class LoadTimes {
|
|
81
81
|
exports.LoadTimes = LoadTimes;
|
82
82
|
|
83
83
|
class PerfTimings {
|
84
|
+
static get supported() {
|
85
|
+
if (PerfTimings._supported === undefined) {
|
86
|
+
try {
|
87
|
+
PerfTimings._supported = performance !== undefined;
|
88
|
+
} catch (_unused) {
|
89
|
+
PerfTimings._supported = false;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
return PerfTimings._supported;
|
94
|
+
}
|
95
|
+
|
96
|
+
static set supported(value) {
|
97
|
+
PerfTimings._supported = value;
|
98
|
+
}
|
99
|
+
|
84
100
|
constructor() {
|
85
101
|
_defineProperty(this, "_full", false);
|
86
102
|
|
@@ -131,5 +147,5 @@ class PerfTimings {
|
|
131
147
|
|
132
148
|
exports.PerfTimings = PerfTimings;
|
133
149
|
|
134
|
-
_defineProperty(PerfTimings, "
|
150
|
+
_defineProperty(PerfTimings, "_supported", undefined);
|
135
151
|
//# sourceMappingURL=perfUtils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/PerfTracker/perfUtils.ts"],"names":["perfRound","num","Math","round","Number","EPSILON","diff","end","start","LoadTimes","constructor","entry","resource","redirect","redirectEnd","redirectStart","domainLookup","domainLookupEnd","domainLookupStart","connect","connectEnd","connectStart","secureConnectionStart","secureConnection","responseTime","responseEnd","responseStart","fetchStart","fetchUntilResponseEnd","requestStart","requestUntilResponseEnd","startTime","startUntilResponseEnd","calcProcessTime","duration","performance","getEntriesByName","undefined","entries","name","length","measure","processStart","processEnd","processDuration","PerfTimings","supported","onresourcetimingbufferfull","_ev","_full","clear","clearResourceTimings","clearMarks","clearMeasures","pattern","type","ex","RegExp","getEntriesByType","filter","p","test","map","bufferSize","_bufferSize","value","setResourceTimingBufferSize","isFull"],"mappings":";;;;;;;;;AAiDO,IAAMA,SAAS,GAAIC,GAAD,IACvBC,IAAI,CAACC,KAAL,CAAW,CAACF,GAAG,GAAGG,MAAM,CAACC,OAAd,IAAyB,KAApC,IAA6C,KADxC;;;;AASP,IAAMC,IAAI,GAAG,CAACC,GAAD,EAAcC,KAAd,KAAgCR,SAAS,CAACO,GAAG,GAAGC,KAAP,CAAtD;;AAEO,MAAMC,SAAN,CAA8C;AAcnDC,EAAAA,WAAW,CAAQC,KAAR,EAAiC;AAAA,SAAzBA,KAAyB,GAAzBA,KAAyB;;AAAA,sCAbjC,CAaiC;;AAAA,sCAZjC,CAYiC;;AAAA,0CAX7B,CAW6B;;AAAA,qCAVlC,CAUkC;;AAA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AAC1C,QAAIjB,WAAW,CAACkB,aAAZ,KAA8BhB,SAAlC,EAA6CF,WAAW,CAACkB,aAAZ;AAC7C,SAAKJ,KAAL,GAAa,KAAKX,OAAL,GAAeE,MAAf,KAA0B,CAAvC;AACA,WAAO,KAAKS,KAAZ;AACD;;AAEDX,EAAAA,OAAO,GAAoC;AAAA,QAAnCgB,OAAmC,uEAAzB,IAAyB;AAAA,QAAnBC,IAAmB,uEAAZ,UAAY;;AAEzC,QAAIV,WAAW,CAACC,SAAhB,EAA2B;AACzB,UAAMU,EAAE,GAAG,IAAIC,MAAJ,CAAWH,OAAX,EAAoB,GAApB,CAAX;AACA,aAAOnB,WAAW,CACfuB,gBADI,CACaH,IADb,EAEJI,MAFI,CAEIC,CAAD,IAAOJ,EAAE,CAACK,IAAH,CAAQD,CAAC,CAACrB,IAAV,CAFV,EAGJuB,GAHI,CAGCF,CAAD,IAAO,IAAInD,SAAJ,CAAcmD,CAAd,CAHP,CAAP;AAID;;AACD,WAAO,EAAP;AACD;;AAEa,MAAVG,UAAU,GAAG;AACf,WAAO,KAAKC,WAAZ;AACD;;AAEa,MAAVD,UAAU,CAACE,KAAD,EAAQ;AACpB,QACEpB,WAAW,CAACC,SAAZ,IACA,OAAOX,WAAW,CAAC+B,2BAAnB,KAAmD7B,SAFrD,EAGE;AACA,WAAK2B,WAAL,GAAmBC,KAAnB;AACA9B,MAAAA,WAAW,CAAC+B,2BAAZ,CAAwCD,KAAxC;AACD;AACF;;AAES,MAANE,MAAM,GAAG;AACX,WAAO,KAAKlB,KAAZ;AACD;;AApDsB;;;;gBAAZJ,W,eAGeV,WAAW,KAAKE,S","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\n/**\n * Calculation of Load times for a resource performance entry\n */\nexport interface IResourceLoadTimes {\n entry: PerformanceEntry\n name: string\n duration: number\n redirect: number\n domainLookup: number\n connect: number\n secureConnection: number\n responseTime: number\n fetchUntilResponseEnd: number\n requestUntilResponseEnd: number\n startUntilResponseEnd: number\n processStart: number\n processEnd: number\n processDuration: number\n}\n\n/**\n * Rounds a number to 3 decimal places\n */\nexport const perfRound = (num: number) =>\n Math.round((num + Number.EPSILON) * 10000) / 10000\n\n/**\n * Round and scale (if needed) the difference in performance metrics\n * @param end of high precision timer metric\n * @param start of high precision timer metric\n * @returns rounded difference of end - start\n */\nconst diff = (end: number, start: number) => perfRound(end - start)\n\nexport class LoadTimes implements IResourceLoadTimes {\n duration = 0\n redirect = 0\n domainLookup = 0\n connect = 0\n secureConnection = 0\n responseTime = 0\n fetchUntilResponseEnd = 0\n requestUntilResponseEnd = 0\n startUntilResponseEnd = 0\n processStart = 0\n processEnd = 0\n processDuration = 0\n\n constructor(public entry: PerformanceEntry) {\n if ('redirectStart' in entry) {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n // Either a `PerformanceResourceTiming` or `PerformanceTiming` instance\n const resource = entry as PerformanceResourceTiming\n this.redirect = diff(resource.redirectEnd, resource.redirectStart)\n this.domainLookup = diff(\n resource.domainLookupEnd,\n resource.domainLookupStart\n )\n this.connect = diff(resource.connectEnd, resource.connectStart)\n if (resource.secureConnectionStart > 0)\n this.secureConnection = diff(\n resource.connectEnd,\n resource.secureConnectionStart\n )\n this.responseTime = diff(resource.responseEnd, resource.responseStart)\n if (resource.fetchStart > 0)\n this.fetchUntilResponseEnd = diff(\n resource.responseEnd,\n resource.fetchStart\n )\n if (resource.requestStart > 0)\n this.requestUntilResponseEnd = diff(\n resource.responseEnd,\n resource.requestStart\n )\n if (resource.startTime > 0)\n this.startUntilResponseEnd = diff(\n resource.responseEnd,\n resource.startTime\n )\n this.calcProcessTime()\n }\n }\n\n private calcProcessTime() {\n this.duration = this.entry.duration\n if (performance.getEntriesByName !== undefined) {\n const entries = performance.getEntriesByName(\n `${this.name}-${this.entry.startTime}`,\n 'measure'\n )\n if (entries.length > 0) {\n const measure = entries[entries.length - 1] as PerformanceMeasure\n const resource = this.entry as PerformanceResourceTiming\n this.processStart = resource.responseEnd\n this.processEnd = resource.responseEnd + measure.duration\n this.processDuration = measure.duration\n this.duration += measure.duration\n }\n }\n }\n\n get name() {\n return this.entry.name\n }\n}\n\n/**\n * Performance API utility class\n *\n * Defaults to \"resource\" types\n * */\nexport class PerfTimings {\n private _full = false\n private _bufferSize = 0\n public static supported = performance !== undefined\n\n constructor() {\n if (PerfTimings.supported) {\n performance.onresourcetimingbufferfull = (_ev) => (this._full = true)\n // https://developer.mozilla.org/en-US/docs/Web/API/Performance/setResourceTimingBufferSize\n // says the buffer size should be at least 150, but I don't know if we need to set it\n // this.bufferSize = 50 // TODO what's the default bufferSize? Does it vary by browser?\n }\n }\n\n clear() {\n if (!PerfTimings.supported) return false\n if (performance.clearResourceTimings !== undefined)\n performance.clearResourceTimings()\n if (performance.clearMarks !== undefined) performance.clearMarks()\n if (performance.clearMeasures !== undefined) performance.clearMeasures()\n this._full = this.entries().length === 0\n return this._full\n }\n\n entries(pattern = '.*', type = 'resource') {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry\n if (PerfTimings.supported) {\n const ex = new RegExp(pattern, 'i')\n return performance\n .getEntriesByType(type)\n .filter((p) => ex.test(p.name))\n .map((p) => new LoadTimes(p))\n }\n return []\n }\n\n get bufferSize() {\n return this._bufferSize\n }\n\n set bufferSize(value) {\n if (\n PerfTimings.supported &&\n typeof performance.setResourceTimingBufferSize !== undefined\n ) {\n this._bufferSize = value\n performance.setResourceTimingBufferSize(value)\n }\n }\n\n get isFull() {\n return this._full\n }\n}\n"],"file":"perfUtils.js"}
|
1
|
+
{"version":3,"sources":["../../../src/components/PerfTracker/perfUtils.ts"],"names":["perfRound","num","Math","round","Number","EPSILON","diff","end","start","LoadTimes","constructor","entry","resource","redirect","redirectEnd","redirectStart","domainLookup","domainLookupEnd","domainLookupStart","connect","connectEnd","connectStart","secureConnectionStart","secureConnection","responseTime","responseEnd","responseStart","fetchStart","fetchUntilResponseEnd","requestStart","requestUntilResponseEnd","startTime","startUntilResponseEnd","calcProcessTime","duration","performance","getEntriesByName","undefined","entries","name","length","measure","processStart","processEnd","processDuration","PerfTimings","supported","_supported","value","onresourcetimingbufferfull","_ev","_full","clear","clearResourceTimings","clearMarks","clearMeasures","pattern","type","ex","RegExp","getEntriesByType","filter","p","test","map","bufferSize","_bufferSize","setResourceTimingBufferSize","isFull"],"mappings":";;;;;;;;;AAiDO,IAAMA,SAAS,GAAIC,GAAD,IACvBC,IAAI,CAACC,KAAL,CAAW,CAACF,GAAG,GAAGG,MAAM,CAACC,OAAd,IAAyB,KAApC,IAA6C,KADxC;;;;AASP,IAAMC,IAAI,GAAG,CAACC,GAAD,EAAcC,KAAd,KAAgCR,SAAS,CAACO,GAAG,GAAGC,KAAP,CAAtD;;AAEO,MAAMC,SAAN,CAA8C;AAcnDC,EAAAA,WAAW,CAAQC,KAAR,EAAiC;AAAA,SAAzBA,KAAyB,GAAzBA,KAAyB;;AAAA,sCAbjC,CAaiC;;AAAA,s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KAAmD9B,SAFrD,EAGE;AACA,WAAK6B,WAAL,GAAmBlB,KAAnB;AACAb,MAAAA,WAAW,CAACgC,2BAAZ,CAAwCnB,KAAxC;AACD;AACF;;AAES,MAANoB,MAAM,GAAG;AACX,WAAO,KAAKjB,KAAZ;AACD;;AAtEsB;;;;gBAAZN,W,gBAGsCR,S","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\n/**\n * Calculation of Load times for a resource performance entry\n */\nexport interface IResourceLoadTimes {\n entry: PerformanceEntry\n name: string\n duration: number\n redirect: number\n domainLookup: number\n connect: number\n secureConnection: number\n responseTime: number\n fetchUntilResponseEnd: number\n requestUntilResponseEnd: number\n startUntilResponseEnd: number\n processStart: number\n processEnd: number\n processDuration: number\n}\n\n/**\n * Rounds a number to 3 decimal places\n */\nexport const perfRound = (num: number) =>\n Math.round((num + Number.EPSILON) * 10000) / 10000\n\n/**\n * Round and scale (if needed) the difference in performance metrics\n * @param end of high precision timer metric\n * @param start of high precision timer metric\n * @returns rounded difference of end - start\n */\nconst diff = (end: number, start: number) => perfRound(end - start)\n\nexport class LoadTimes implements IResourceLoadTimes {\n duration = 0\n redirect = 0\n domainLookup = 0\n connect = 0\n secureConnection = 0\n responseTime = 0\n fetchUntilResponseEnd = 0\n requestUntilResponseEnd = 0\n startUntilResponseEnd = 0\n processStart = 0\n processEnd = 0\n processDuration = 0\n\n constructor(public entry: PerformanceEntry) {\n if ('redirectStart' in entry) {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n // Either a `PerformanceResourceTiming` or `PerformanceTiming` instance\n const resource = entry as PerformanceResourceTiming\n this.redirect = diff(resource.redirectEnd, resource.redirectStart)\n this.domainLookup = diff(\n resource.domainLookupEnd,\n resource.domainLookupStart\n )\n this.connect = diff(resource.connectEnd, resource.connectStart)\n if (resource.secureConnectionStart > 0)\n this.secureConnection = diff(\n resource.connectEnd,\n resource.secureConnectionStart\n )\n this.responseTime = diff(resource.responseEnd, resource.responseStart)\n if (resource.fetchStart > 0)\n this.fetchUntilResponseEnd = diff(\n resource.responseEnd,\n resource.fetchStart\n )\n if (resource.requestStart > 0)\n this.requestUntilResponseEnd = diff(\n resource.responseEnd,\n resource.requestStart\n )\n if (resource.startTime > 0)\n this.startUntilResponseEnd = diff(\n resource.responseEnd,\n resource.startTime\n )\n this.calcProcessTime()\n }\n }\n\n private calcProcessTime() {\n this.duration = this.entry.duration\n if (performance.getEntriesByName !== undefined) {\n const entries = performance.getEntriesByName(\n `${this.name}-${this.entry.startTime}`,\n 'measure'\n )\n if (entries.length > 0) {\n const measure = entries[entries.length - 1] as PerformanceMeasure\n const resource = this.entry as PerformanceResourceTiming\n this.processStart = resource.responseEnd\n this.processEnd = resource.responseEnd + measure.duration\n this.processDuration = measure.duration\n this.duration += measure.duration\n }\n }\n }\n\n get name() {\n return this.entry.name\n }\n}\n\n/**\n * Performance API utility class\n *\n * Defaults to \"resource\" types\n * */\nexport class PerfTimings {\n private _full = false\n private _bufferSize = 0\n private static _supported: boolean | undefined = undefined\n\n /** Are performance timings supported in this runtime? */\n public static get supported() {\n if (PerfTimings._supported === undefined) {\n // This gyration is necessary to avoid IDEA-based exceptions about performance being undefined,\n // which it may be, but this now throws up in IDEA\n try {\n PerfTimings._supported = performance !== undefined\n } catch {\n PerfTimings._supported = false\n }\n }\n return PerfTimings._supported\n }\n\n public static set supported(value: boolean) {\n PerfTimings._supported = value\n }\n\n constructor() {\n if (PerfTimings.supported) {\n performance.onresourcetimingbufferfull = (_ev) => (this._full = true)\n // https://developer.mozilla.org/en-US/docs/Web/API/Performance/setResourceTimingBufferSize\n // says the buffer size should be at least 150, but I don't know if we need to set it\n // this.bufferSize = 50 // TODO what's the default bufferSize? Does it vary by browser?\n }\n }\n\n clear() {\n if (!PerfTimings.supported) return false\n if (performance.clearResourceTimings !== undefined)\n performance.clearResourceTimings()\n if (performance.clearMarks !== undefined) performance.clearMarks()\n if (performance.clearMeasures !== undefined) performance.clearMeasures()\n this._full = this.entries().length === 0\n return this._full\n }\n\n entries(pattern = '.*', type = 'resource') {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry\n if (PerfTimings.supported) {\n const ex = new RegExp(pattern, 'i')\n return performance\n .getEntriesByType(type)\n .filter((p) => ex.test(p.name))\n .map((p) => new LoadTimes(p))\n }\n return []\n }\n\n get bufferSize() {\n return this._bufferSize\n }\n\n set bufferSize(value) {\n if (\n PerfTimings.supported &&\n typeof performance.setResourceTimingBufferSize !== undefined\n ) {\n this._bufferSize = value\n performance.setResourceTimingBufferSize(value)\n }\n }\n\n get isFull() {\n return this._full\n }\n}\n"],"file":"perfUtils.js"}
|
@@ -69,6 +69,22 @@ export class LoadTimes {
|
|
69
69
|
|
70
70
|
}
|
71
71
|
export class PerfTimings {
|
72
|
+
static get supported() {
|
73
|
+
if (PerfTimings._supported === undefined) {
|
74
|
+
try {
|
75
|
+
PerfTimings._supported = performance !== undefined;
|
76
|
+
} catch (_unused) {
|
77
|
+
PerfTimings._supported = false;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
return PerfTimings._supported;
|
82
|
+
}
|
83
|
+
|
84
|
+
static set supported(value) {
|
85
|
+
PerfTimings._supported = value;
|
86
|
+
}
|
87
|
+
|
72
88
|
constructor() {
|
73
89
|
_defineProperty(this, "_full", false);
|
74
90
|
|
@@ -117,5 +133,5 @@ export class PerfTimings {
|
|
117
133
|
|
118
134
|
}
|
119
135
|
|
120
|
-
_defineProperty(PerfTimings, "
|
136
|
+
_defineProperty(PerfTimings, "_supported", undefined);
|
121
137
|
//# sourceMappingURL=perfUtils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/PerfTracker/perfUtils.ts"],"names":["perfRound","num","Math","round","Number","EPSILON","diff","end","start","LoadTimes","constructor","entry","resource","redirect","redirectEnd","redirectStart","domainLookup","domainLookupEnd","domainLookupStart","connect","connectEnd","connectStart","secureConnectionStart","secureConnection","responseTime","responseEnd","responseStart","fetchStart","fetchUntilResponseEnd","requestStart","requestUntilResponseEnd","startTime","startUntilResponseEnd","calcProcessTime","duration","performance","getEntriesByName","undefined","entries","name","length","measure","processStart","processEnd","processDuration","PerfTimings","supported","onresourcetimingbufferfull","_ev","_full","clear","clearResourceTimings","clearMarks","clearMeasures","pattern","type","ex","RegExp","getEntriesByType","filter","p","test","map","bufferSize","_bufferSize","value","setResourceTimingBufferSize","isFull"],"mappings":";;AAiDA,OAAO,IAAMA,SAAS,GAAIC,GAAD,IACvBC,IAAI,CAACC,KAAL,CAAW,CAACF,GAAG,GAAGG,MAAM,CAACC,OAAd,IAAyB,KAApC,IAA6C,KADxC;;AASP,IAAMC,IAAI,GAAG,CAACC,GAAD,EAAcC,KAAd,KAAgCR,SAAS,CAACO,GAAG,GAAGC,KAAP,CAAtD;;AAEA,OAAO,MAAMC,SAAN,CAA8C;AAcnDC,EAAAA,WAAW,CAAQC,KAAR,EAAiC;AAAA,SAAzBA,KAA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Cd,SAAzC,EACEF,WAAW,CAACgB,oBAAZ;AACF,QAAIhB,WAAW,CAACiB,UAAZ,KAA2Bf,SAA/B,EAA0CF,WAAW,CAACiB,UAAZ;AAC1C,QAAIjB,WAAW,CAACkB,aAAZ,KAA8BhB,SAAlC,EAA6CF,WAAW,CAACkB,aAAZ;AAC7C,SAAKJ,KAAL,GAAa,KAAKX,OAAL,GAAeE,MAAf,KAA0B,CAAvC;AACA,WAAO,KAAKS,KAAZ;AACD;;AAEDX,EAAAA,OAAO,GAAoC;AAAA,QAAnCgB,OAAmC,uEAAzB,IAAyB;AAAA,QAAnBC,IAAmB,uEAAZ,UAAY;;AAEzC,QAAIV,WAAW,CAACC,SAAhB,EAA2B;AACzB,UAAMU,EAAE,GAAG,IAAIC,MAAJ,CAAWH,OAAX,EAAoB,GAApB,CAAX;AACA,aAAOnB,WAAW,CACfuB,gBADI,CACaH,IADb,EAEJI,MAFI,CAEIC,CAAD,IAAOJ,EAAE,CAACK,IAAH,CAAQD,CAAC,CAACrB,IAAV,CAFV,EAGJuB,GAHI,CAGCF,CAAD,IAAO,IAAInD,SAAJ,CAAcmD,CAAd,CAHP,CAAP;AAID;;AACD,WAAO,EAAP;AACD;;AAEa,MAAVG,UAAU,GAAG;AACf,WAAO,KAAKC,WAAZ;AACD;;AAEa,MAAVD,UAAU,CAACE,KAAD,EAAQ;AACpB,QACEpB,WAAW,CAACC,SAAZ,IACA,OAAOX,WAAW,CAAC+B,2BAAnB,KAAmD7B,SAFrD,EAGE;AACA,WAAK2B,WAAL,GAAmBC,KAAnB;AACA9B,MAAAA,WAAW,CAAC+B,2BAAZ,CAAwCD,KAAxC;AACD;AACF;;AAES,MAANE,MAAM,GAAG;AACX,WAAO,KAAKlB,KAAZ;AACD;;AApDsB;;gBAAZJ,W,eAGeV,WAAW,KAAKE,S","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\n/**\n * Calculation of Load times for a resource performance entry\n */\nexport interface IResourceLoadTimes {\n entry: PerformanceEntry\n name: string\n duration: number\n redirect: number\n domainLookup: number\n connect: number\n secureConnection: number\n responseTime: number\n fetchUntilResponseEnd: number\n requestUntilResponseEnd: number\n startUntilResponseEnd: number\n processStart: number\n processEnd: number\n processDuration: number\n}\n\n/**\n * Rounds a number to 3 decimal places\n */\nexport const perfRound = (num: number) =>\n Math.round((num + Number.EPSILON) * 10000) / 10000\n\n/**\n * Round and scale (if needed) the difference in performance metrics\n * @param end of high precision timer metric\n * @param start of high precision timer metric\n * @returns rounded difference of end - start\n */\nconst diff = (end: number, start: number) => perfRound(end - start)\n\nexport class LoadTimes implements IResourceLoadTimes {\n duration = 0\n redirect = 0\n domainLookup = 0\n connect = 0\n secureConnection = 0\n responseTime = 0\n fetchUntilResponseEnd = 0\n requestUntilResponseEnd = 0\n startUntilResponseEnd = 0\n processStart = 0\n processEnd = 0\n processDuration = 0\n\n constructor(public entry: PerformanceEntry) {\n if ('redirectStart' in entry) {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n // Either a `PerformanceResourceTiming` or `PerformanceTiming` instance\n const resource = entry as PerformanceResourceTiming\n this.redirect = diff(resource.redirectEnd, resource.redirectStart)\n this.domainLookup = diff(\n resource.domainLookupEnd,\n resource.domainLookupStart\n )\n this.connect = diff(resource.connectEnd, resource.connectStart)\n if (resource.secureConnectionStart > 0)\n this.secureConnection = diff(\n resource.connectEnd,\n resource.secureConnectionStart\n )\n this.responseTime = diff(resource.responseEnd, resource.responseStart)\n if (resource.fetchStart > 0)\n this.fetchUntilResponseEnd = diff(\n resource.responseEnd,\n resource.fetchStart\n )\n if (resource.requestStart > 0)\n this.requestUntilResponseEnd = diff(\n resource.responseEnd,\n resource.requestStart\n )\n if (resource.startTime > 0)\n this.startUntilResponseEnd = diff(\n resource.responseEnd,\n resource.startTime\n )\n this.calcProcessTime()\n }\n }\n\n private calcProcessTime() {\n this.duration = this.entry.duration\n if (performance.getEntriesByName !== undefined) {\n const entries = performance.getEntriesByName(\n `${this.name}-${this.entry.startTime}`,\n 'measure'\n )\n if (entries.length > 0) {\n const measure = entries[entries.length - 1] as PerformanceMeasure\n const resource = this.entry as PerformanceResourceTiming\n this.processStart = resource.responseEnd\n this.processEnd = resource.responseEnd + measure.duration\n this.processDuration = measure.duration\n this.duration += measure.duration\n }\n }\n }\n\n get name() {\n return this.entry.name\n }\n}\n\n/**\n * Performance API utility class\n *\n * Defaults to \"resource\" types\n * */\nexport class PerfTimings {\n private _full = false\n private _bufferSize = 0\n public static supported = performance !== undefined\n\n constructor() {\n if (PerfTimings.supported) {\n performance.onresourcetimingbufferfull = (_ev) => (this._full = true)\n // https://developer.mozilla.org/en-US/docs/Web/API/Performance/setResourceTimingBufferSize\n // says the buffer size should be at least 150, but I don't know if we need to set it\n // this.bufferSize = 50 // TODO what's the default bufferSize? Does it vary by browser?\n }\n }\n\n clear() {\n if (!PerfTimings.supported) return false\n if (performance.clearResourceTimings !== undefined)\n performance.clearResourceTimings()\n if (performance.clearMarks !== undefined) performance.clearMarks()\n if (performance.clearMeasures !== undefined) performance.clearMeasures()\n this._full = this.entries().length === 0\n return this._full\n }\n\n entries(pattern = '.*', type = 'resource') {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry\n if (PerfTimings.supported) {\n const ex = new RegExp(pattern, 'i')\n return performance\n .getEntriesByType(type)\n .filter((p) => ex.test(p.name))\n .map((p) => new LoadTimes(p))\n }\n return []\n }\n\n get bufferSize() {\n return this._bufferSize\n }\n\n set bufferSize(value) {\n if (\n PerfTimings.supported &&\n typeof performance.setResourceTimingBufferSize !== undefined\n ) {\n this._bufferSize = value\n performance.setResourceTimingBufferSize(value)\n }\n }\n\n get isFull() {\n return this._full\n }\n}\n"],"file":"perfUtils.js"}
|
1
|
+
{"version":3,"sources":["../../../../src/components/PerfTracker/perfUtils.ts"],"names":["perfRound","num","Math","round","Number","EPSILON","diff","end","start","LoadTimes","constructor","entry","resource","redirect","redirectEnd","redirectStart","domainLookup","domainLookupEnd","domainLookupStart","connect","connectEnd","connectStart","secureConnectionStart","secureConnection","responseTime","responseEnd","responseStart","fetchStart","fetchUntilResponseEnd","requestStart","requestUntilResponseEnd","startTime","startUntilResponseEnd","calcProcessTime","duration","performance","getEntriesByName","undefined","entries","name","length","measure","processStart","processEnd","processDuration","PerfTimings","supported","_supported","value","onresourcetimingbufferfull","_ev","_full","clear","clearResourceTimings","clearMarks","clearMeasures","pattern","type","ex","RegExp","getEntriesByType","filter","p","test","map","bufferSize","_bufferSize","setResourceTimingBufferSize","isFull"],"mappings":";;AAiDA,OAAO,IAAMA,SAAS,GAAIC,GAAD,IACvBC,IAAI,CAACC,KAAL,CAAW,CAACF,GAAG,GAAGG,MAAM,CAACC,OAAd,IAAyB,KAApC,IAA6C,KADxC;;AASP,IAAMC,IAAI,GAAG,CAACC,GAAD,EAAcC,KAAd,KAAgCR,SAAS,CAACO,GAAG,GAAGC,KAAP,CAAtD;;AAEA,OAAO,MAAMC,SAAN,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C,WAAZ;AACD;;AAEa,MAAVD,UAAU,CAACjB,KAAD,EAAQ;AACpB,QACEH,WAAW,CAACC,SAAZ,IACA,OAAOX,WAAW,CAACgC,2BAAnB,KAAmD9B,SAFrD,EAGE;AACA,WAAK6B,WAAL,GAAmBlB,KAAnB;AACAb,MAAAA,WAAW,CAACgC,2BAAZ,CAAwCnB,KAAxC;AACD;AACF;;AAES,MAANoB,MAAM,GAAG;AACX,WAAO,KAAKjB,KAAZ;AACD;;AAtEsB;;gBAAZN,W,gBAGsCR,S","sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\n/**\n * Calculation of Load times for a resource performance entry\n */\nexport interface IResourceLoadTimes {\n entry: PerformanceEntry\n name: string\n duration: number\n redirect: number\n domainLookup: number\n connect: number\n secureConnection: number\n responseTime: number\n fetchUntilResponseEnd: number\n requestUntilResponseEnd: number\n startUntilResponseEnd: number\n processStart: number\n processEnd: number\n processDuration: number\n}\n\n/**\n * Rounds a number to 3 decimal places\n */\nexport const perfRound = (num: number) =>\n Math.round((num + Number.EPSILON) * 10000) / 10000\n\n/**\n * Round and scale (if needed) the difference in performance metrics\n * @param end of high precision timer metric\n * @param start of high precision timer metric\n * @returns rounded difference of end - start\n */\nconst diff = (end: number, start: number) => perfRound(end - start)\n\nexport class LoadTimes implements IResourceLoadTimes {\n duration = 0\n redirect = 0\n domainLookup = 0\n connect = 0\n secureConnection = 0\n responseTime = 0\n fetchUntilResponseEnd = 0\n requestUntilResponseEnd = 0\n startUntilResponseEnd = 0\n processStart = 0\n processEnd = 0\n processDuration = 0\n\n constructor(public entry: PerformanceEntry) {\n if ('redirectStart' in entry) {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n // Either a `PerformanceResourceTiming` or `PerformanceTiming` instance\n const resource = entry as PerformanceResourceTiming\n this.redirect = diff(resource.redirectEnd, resource.redirectStart)\n this.domainLookup = diff(\n resource.domainLookupEnd,\n resource.domainLookupStart\n )\n this.connect = diff(resource.connectEnd, resource.connectStart)\n if (resource.secureConnectionStart > 0)\n this.secureConnection = diff(\n resource.connectEnd,\n resource.secureConnectionStart\n )\n this.responseTime = diff(resource.responseEnd, resource.responseStart)\n if (resource.fetchStart > 0)\n this.fetchUntilResponseEnd = diff(\n resource.responseEnd,\n resource.fetchStart\n )\n if (resource.requestStart > 0)\n this.requestUntilResponseEnd = diff(\n resource.responseEnd,\n resource.requestStart\n )\n if (resource.startTime > 0)\n this.startUntilResponseEnd = diff(\n resource.responseEnd,\n resource.startTime\n )\n this.calcProcessTime()\n }\n }\n\n private calcProcessTime() {\n this.duration = this.entry.duration\n if (performance.getEntriesByName !== undefined) {\n const entries = performance.getEntriesByName(\n `${this.name}-${this.entry.startTime}`,\n 'measure'\n )\n if (entries.length > 0) {\n const measure = entries[entries.length - 1] as PerformanceMeasure\n const resource = this.entry as PerformanceResourceTiming\n this.processStart = resource.responseEnd\n this.processEnd = resource.responseEnd + measure.duration\n this.processDuration = measure.duration\n this.duration += measure.duration\n }\n }\n }\n\n get name() {\n return this.entry.name\n }\n}\n\n/**\n * Performance API utility class\n *\n * Defaults to \"resource\" types\n * */\nexport class PerfTimings {\n private _full = false\n private _bufferSize = 0\n private static _supported: boolean | undefined = undefined\n\n /** Are performance timings supported in this runtime? */\n public static get supported() {\n if (PerfTimings._supported === undefined) {\n // This gyration is necessary to avoid IDEA-based exceptions about performance being undefined,\n // which it may be, but this now throws up in IDEA\n try {\n PerfTimings._supported = performance !== undefined\n } catch {\n PerfTimings._supported = false\n }\n }\n return PerfTimings._supported\n }\n\n public static set supported(value: boolean) {\n PerfTimings._supported = value\n }\n\n constructor() {\n if (PerfTimings.supported) {\n performance.onresourcetimingbufferfull = (_ev) => (this._full = true)\n // https://developer.mozilla.org/en-US/docs/Web/API/Performance/setResourceTimingBufferSize\n // says the buffer size should be at least 150, but I don't know if we need to set it\n // this.bufferSize = 50 // TODO what's the default bufferSize? Does it vary by browser?\n }\n }\n\n clear() {\n if (!PerfTimings.supported) return false\n if (performance.clearResourceTimings !== undefined)\n performance.clearResourceTimings()\n if (performance.clearMarks !== undefined) performance.clearMarks()\n if (performance.clearMeasures !== undefined) performance.clearMeasures()\n this._full = this.entries().length === 0\n return this._full\n }\n\n entries(pattern = '.*', type = 'resource') {\n // https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry\n if (PerfTimings.supported) {\n const ex = new RegExp(pattern, 'i')\n return performance\n .getEntriesByType(type)\n .filter((p) => ex.test(p.name))\n .map((p) => new LoadTimes(p))\n }\n return []\n }\n\n get bufferSize() {\n return this._bufferSize\n }\n\n set bufferSize(value) {\n if (\n PerfTimings.supported &&\n typeof performance.setResourceTimingBufferSize !== undefined\n ) {\n this._bufferSize = value\n performance.setResourceTimingBufferSize(value)\n }\n }\n\n get isFull() {\n return this._full\n }\n}\n"],"file":"perfUtils.js"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@looker/run-it",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.32",
|
4
4
|
"description": "A dynamic REST request input form and response visualizer",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "lib/esm/index.js",
|
@@ -51,16 +51,16 @@
|
|
51
51
|
"webpack-dev-server": "^3.11.2"
|
52
52
|
},
|
53
53
|
"dependencies": {
|
54
|
-
"@looker/code-editor": "^0.1.
|
54
|
+
"@looker/code-editor": "^0.1.21",
|
55
55
|
"@looker/components": "^2.8.1",
|
56
56
|
"@looker/components-date": "^2.4.1",
|
57
57
|
"@looker/design-tokens": "^2.7.1",
|
58
|
-
"@looker/extension-utils": "^0.1.
|
58
|
+
"@looker/extension-utils": "^0.1.9",
|
59
59
|
"@looker/icons": "^1.5.3",
|
60
|
-
"@looker/sdk": "^22.2
|
61
|
-
"@looker/sdk-codegen": "^21.
|
60
|
+
"@looker/sdk": "^22.4.2",
|
61
|
+
"@looker/sdk-codegen": "^21.5.2",
|
62
62
|
"@looker/sdk-codegen-utils": "^21.0.11",
|
63
|
-
"@looker/sdk-rtl": "^21.3.
|
63
|
+
"@looker/sdk-rtl": "^21.3.3",
|
64
64
|
"@styled-icons/material": "^10.28.0",
|
65
65
|
"@styled-icons/material-outlined": "^10.28.0",
|
66
66
|
"@styled-icons/material-rounded": "^10.28.0",
|
@@ -73,5 +73,5 @@
|
|
73
73
|
"react-is": "^16.13.1",
|
74
74
|
"styled-components": "^5.2.1"
|
75
75
|
},
|
76
|
-
"gitHead": "
|
76
|
+
"gitHead": "79b245fdf08c08faf46e120f0961bc820199dccd"
|
77
77
|
}
|