@google-psat/common 0.14.1 → 1.2.1
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/attributionReporting.types.js +1 -2
- package/dist/cookies.types.js +6 -9
- package/dist/cookies.types.js.map +1 -1
- package/dist/data/cookieExclusionAndWarningReasons/cookieBlockedReason.js +1 -3
- package/dist/data/cookieExclusionAndWarningReasons/cookieBlockedReason.js.map +1 -1
- package/dist/data/cookieExclusionAndWarningReasons/cookieExclusionReason.js +20 -45
- package/dist/data/cookieExclusionAndWarningReasons/cookieExclusionReason.js.map +1 -1
- package/dist/data/cookieExclusionAndWarningReasons/cookieExclusionReasonHTMLContent.js +16 -19
- package/dist/data/cookieExclusionAndWarningReasons/cookieExclusionReasonHTMLContent.js.map +1 -1
- package/dist/data/cookieExclusionAndWarningReasons/cookieWarningReason.js +32 -57
- package/dist/data/cookieExclusionAndWarningReasons/cookieWarningReason.js.map +1 -1
- package/dist/data/cookieExclusionAndWarningReasons/cookieWarningReasonHTMLContent.js +29 -32
- package/dist/data/cookieExclusionAndWarningReasons/cookieWarningReasonHTMLContent.js.map +1 -1
- package/dist/data/cookieExclusionAndWarningReasons/index.js +7 -12
- package/dist/data/cookieExclusionAndWarningReasons/index.js.map +1 -1
- package/dist/data/cookieExemptionReason/exemptionReasons.js +10 -12
- package/dist/data/cookieExemptionReason/exemptionReasons.js.map +1 -1
- package/dist/data/cookieExemptionReason/index.js +1 -8
- package/dist/data/cookieExemptionReason/index.js.map +1 -1
- package/dist/data/index.js +3 -11
- package/dist/data/index.js.map +1 -1
- package/dist/index.js +40 -88
- package/dist/index.js.map +1 -1
- package/dist/mdl.types.js +2 -0
- package/dist/mdl.types.js.map +1 -0
- package/dist/prebid.types.js +2 -0
- package/dist/prebid.types.js.map +1 -0
- package/dist/prebidGlobal.types.js +2 -0
- package/dist/prebidGlobal.types.js.map +1 -0
- package/dist/protectedAudience.types.js +1 -2
- package/dist/prtToken.types.js +2 -0
- package/dist/prtToken.types.js.map +1 -0
- package/dist/test-utils/data.mock.js +4 -12
- package/dist/test-utils/data.mock.js.map +1 -1
- package/dist/utils/addUTMParams.js +5 -8
- package/dist/utils/addUTMParams.js.map +1 -1
- package/dist/utils/auctions/bidderCreator.js +117 -0
- package/dist/utils/auctions/bidderCreator.js.map +1 -0
- package/dist/utils/auctions/findMaximumBidderDuration.js +10 -0
- package/dist/utils/auctions/findMaximumBidderDuration.js.map +1 -0
- package/dist/{worker/enums.js → utils/auctions/formatDuration.js} +8 -9
- package/dist/utils/auctions/formatDuration.js.map +1 -0
- package/dist/utils/auctions/formatTimestamp.js +26 -0
- package/dist/utils/auctions/formatTimestamp.js.map +1 -0
- package/dist/utils/auctions/index.js +21 -0
- package/dist/utils/auctions/index.js.map +1 -0
- package/dist/utils/auctions/prepareTimelineData.js +176 -0
- package/dist/utils/auctions/prepareTimelineData.js.map +1 -0
- package/dist/utils/auctions/types.js +23 -0
- package/dist/utils/auctions/types.js.map +1 -0
- package/dist/utils/calculateEffectiveExpiryDate.js +3 -6
- package/dist/utils/calculateEffectiveExpiryDate.js.map +1 -1
- package/dist/utils/contextSelector/createContext.js +3 -5
- package/dist/utils/contextSelector/createContext.js.map +1 -1
- package/dist/utils/contextSelector/index.js +2 -10
- package/dist/utils/contextSelector/index.js.map +1 -1
- package/dist/utils/contextSelector/shallowEqual.js +3 -7
- package/dist/utils/contextSelector/shallowEqual.js.map +1 -1
- package/dist/utils/contextSelector/useContextSelector.js +7 -9
- package/dist/utils/contextSelector/useContextSelector.js.map +1 -1
- package/dist/utils/delay.js +1 -3
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/deriveBlockingStatus.js +11 -14
- package/dist/utils/deriveBlockingStatus.js.map +1 -1
- package/dist/utils/extractCookies.js +10 -8
- package/dist/utils/extractCookies.js.map +1 -1
- package/dist/utils/extractReportData.js +14 -20
- package/dist/utils/extractReportData.js.map +1 -1
- package/dist/utils/extractUrl.js +3 -6
- package/dist/utils/extractUrl.js.map +1 -1
- package/dist/utils/fetchLocalData.js +5 -16
- package/dist/utils/fetchLocalData.js.map +1 -1
- package/dist/utils/filterCookiesByFrame.js +3 -7
- package/dist/utils/filterCookiesByFrame.js.map +1 -1
- package/dist/utils/filterFramesWithCookies.js +3 -8
- package/dist/utils/filterFramesWithCookies.js.map +1 -1
- package/dist/utils/findAnalyticsMatch.js +4 -8
- package/dist/utils/findAnalyticsMatch.js.map +1 -1
- package/dist/utils/generateErrorLogs.js +4 -9
- package/dist/utils/generateErrorLogs.js.map +1 -1
- package/dist/utils/generateReports/generateAllCookiesCSV.js +22 -28
- package/dist/utils/generateReports/generateAllCookiesCSV.js.map +1 -1
- package/dist/utils/generateReports/generateCLICookieTableCSV.js +29 -35
- package/dist/utils/generateReports/generateCLICookieTableCSV.js.map +1 -1
- package/dist/utils/generateReports/generateCookiesWithIssuesCSV.js +33 -40
- package/dist/utils/generateReports/generateCookiesWithIssuesCSV.js.map +1 -1
- package/dist/utils/generateReports/generateExtensionCookietableCSV.js +34 -40
- package/dist/utils/generateReports/generateExtensionCookietableCSV.js.map +1 -1
- package/dist/utils/generateReports/generateRootSummaryDataCSV.js +12 -20
- package/dist/utils/generateReports/generateRootSummaryDataCSV.js.map +1 -1
- package/dist/utils/generateReports/generateSummaryDataCSV.js +14 -16
- package/dist/utils/generateReports/generateSummaryDataCSV.js.map +1 -1
- package/dist/utils/generateReports/index.js +6 -18
- package/dist/utils/generateReports/index.js.map +1 -1
- package/dist/utils/getCookieKey.js +4 -6
- package/dist/utils/getCookieKey.js.map +1 -1
- package/dist/utils/getCurrentDateAndTime.js +1 -3
- package/dist/utils/getCurrentDateAndTime.js.map +1 -1
- package/dist/utils/getDomainFromUrl.js +3 -6
- package/dist/utils/getDomainFromUrl.js.map +1 -1
- package/dist/utils/getLegendDescription.js +4 -6
- package/dist/utils/getLegendDescription.js.map +1 -1
- package/dist/utils/getValueByKey.js +2 -4
- package/dist/utils/getValueByKey.js.map +1 -1
- package/dist/utils/isFirstParty.js +5 -7
- package/dist/utils/isFirstParty.js.map +1 -1
- package/dist/{worker/devToolWorker.js → utils/isValidURL.js} +12 -10
- package/dist/utils/isValidURL.js.map +1 -0
- package/dist/utils/mergeDeep.js +1 -3
- package/dist/utils/mergeDeep.js.map +1 -1
- package/dist/utils/noop.js +1 -3
- package/dist/utils/noop.js.map +1 -1
- package/dist/utils/parseRequestWillBeSentExtraInfo.js +22 -33
- package/dist/utils/parseRequestWillBeSentExtraInfo.js.map +1 -1
- package/dist/utils/parseResponseReceivedExtraInfo.js +35 -38
- package/dist/utils/parseResponseReceivedExtraInfo.js.map +1 -1
- package/dist/utils/parseUrl.js +1 -5
- package/dist/utils/parseUrl.js.map +1 -1
- package/dist/utils/removeAndAddNewSpinnerText.js +1 -4
- package/dist/utils/removeAndAddNewSpinnerText.js.map +1 -1
- package/dist/utils/reshapeCookies.js +51 -50
- package/dist/utils/reshapeCookies.js.map +1 -1
- package/dist/utils/resolveWithTimeout.js +1 -4
- package/dist/utils/resolveWithTimeout.js.map +1 -1
- package/dist/utils/sanitizeCsvRecord.js +1 -3
- package/dist/utils/sanitizeCsvRecord.js.map +1 -1
- package/dist/utils/sessionStorage.js +6 -20
- package/dist/utils/sessionStorage.js.map +1 -1
- package/dist-types/cookies.types.d.ts +0 -4
- package/dist-types/index.d.ts +7 -4
- package/dist-types/mdl.types.d.ts +7 -0
- package/dist-types/prebid.types.d.ts +29 -0
- package/dist-types/prebidGlobal.types.d.ts +674 -0
- package/dist-types/protectedAudience.types.d.ts +32 -1
- package/dist-types/prtToken.types.d.ts +33 -0
- package/dist-types/utils/auctions/bidderCreator.d.ts +39 -0
- package/dist-types/utils/auctions/findMaximumBidderDuration.d.ts +5 -0
- package/dist-types/utils/auctions/formatDuration.d.ts +1 -0
- package/dist-types/utils/auctions/formatTimestamp.d.ts +1 -0
- package/dist-types/utils/auctions/index.d.ts +5 -0
- package/dist-types/utils/auctions/prepareTimelineData.d.ts +6 -0
- package/dist-types/utils/auctions/types.d.ts +24 -0
- package/dist-types/utils/extractReportData.d.ts +0 -4
- package/dist-types/utils/isValidURL.d.ts +7 -0
- package/package.json +5 -3
- package/tsconfig.json +3 -3
- package/dist/libraryDetection.types.js +0 -3
- package/dist/libraryDetection.types.js.map +0 -1
- package/dist/worker/devToolWorker.js.map +0 -1
- package/dist/worker/enums.js.map +0 -1
- package/dist/worker/executeTaskInDevToolWorker.js +0 -43
- package/dist/worker/executeTaskInDevToolWorker.js.map +0 -1
- package/dist-types/libraryDetection.types.d.ts +0 -50
- package/dist-types/worker/devToolWorker.d.ts +0 -6
- package/dist-types/worker/enums.d.ts +0 -3
- package/dist-types/worker/executeTaskInDevToolWorker.d.ts +0 -11
|
@@ -14,9 +14,10 @@ export interface singleAuctionEvent {
|
|
|
14
14
|
componentSellerOrigin?: string;
|
|
15
15
|
time: number;
|
|
16
16
|
auctionConfig?: object;
|
|
17
|
+
url?: string;
|
|
17
18
|
interestGroupConfig?: Protocol.Storage.InterestGroupAccessedEvent;
|
|
18
19
|
parentAuctionId?: Protocol.Storage.InterestGroupAuctionId;
|
|
19
|
-
eventType: 'interestGroupAuctionEventOccurred' | 'interestGroupAuctionNetworkRequestCompleted' | 'interestGroupAuctionNetworkRequestCreated' | 'interestGroupAccessed';
|
|
20
|
+
eventType: 'interestGroupAuctionEventOccurred' | 'interestGroupAuctionNetworkRequestCompleted' | 'interestGroupAuctionNetworkRequestCreated' | 'interestGroupAccessed' | 'BidAvailable';
|
|
20
21
|
}
|
|
21
22
|
export interface auctionData {
|
|
22
23
|
[uniqueAuctionId: Protocol.Storage.InterestGroupAuctionId]: {
|
|
@@ -45,6 +46,14 @@ export type NoBidsType = {
|
|
|
45
46
|
mediaContainerSize?: number[][];
|
|
46
47
|
};
|
|
47
48
|
};
|
|
49
|
+
export type PrebidNoBidsType = {
|
|
50
|
+
[adUnitCode: string]: {
|
|
51
|
+
bidder: string[];
|
|
52
|
+
uniqueAuctionId: string;
|
|
53
|
+
adUnitCode?: string;
|
|
54
|
+
mediaContainerSize?: number[][];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
48
57
|
export type AdsAndBiddersTypeData = {
|
|
49
58
|
adUnitCode: string;
|
|
50
59
|
bidders: string[];
|
|
@@ -52,6 +61,7 @@ export type AdsAndBiddersTypeData = {
|
|
|
52
61
|
winningBid: number;
|
|
53
62
|
bidCurrency: string;
|
|
54
63
|
winningBidder: string;
|
|
64
|
+
winningMediaContainerSize?: number[][];
|
|
55
65
|
};
|
|
56
66
|
export type AdsAndBiddersType = {
|
|
57
67
|
[adUnitCode: string]: AdsAndBiddersTypeData;
|
|
@@ -61,3 +71,24 @@ export type ReceivedBids = singleAuctionEvent & {
|
|
|
61
71
|
mediaContainerSize?: number[][];
|
|
62
72
|
adType?: string;
|
|
63
73
|
};
|
|
74
|
+
export interface PrebidDebugModuleConfig {
|
|
75
|
+
enabled?: boolean;
|
|
76
|
+
intercept: PrebidDebugModuleConfigRule[];
|
|
77
|
+
}
|
|
78
|
+
export interface PrebidDebugModuleConfigRule {
|
|
79
|
+
when: {
|
|
80
|
+
[key: string]: string | number;
|
|
81
|
+
};
|
|
82
|
+
then: {
|
|
83
|
+
[key: string]: string | number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export type AuctionEventsType = {
|
|
87
|
+
[adunit: string]: {
|
|
88
|
+
[time: string]: {
|
|
89
|
+
[sellerURL: string]: {
|
|
90
|
+
[auctionHostURL: string]: singleAuctionEvent[];
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ProbablisticRevealToken {
|
|
2
|
+
version: number;
|
|
3
|
+
u: Uint8Array<any>;
|
|
4
|
+
e: Uint8Array<any>;
|
|
5
|
+
epochId: Uint8Array<any>;
|
|
6
|
+
prtHeader: string;
|
|
7
|
+
epochIdBase64: string;
|
|
8
|
+
}
|
|
9
|
+
interface DecryptedToken {
|
|
10
|
+
plainText: Uint8Array<any>;
|
|
11
|
+
hmacSecret: Uint8Array<ArrayBuffer>;
|
|
12
|
+
}
|
|
13
|
+
interface PlaintTextToken {
|
|
14
|
+
uint8Signal: Uint8Array<any>;
|
|
15
|
+
ordinal: Uint8Array<any>;
|
|
16
|
+
version: number;
|
|
17
|
+
hmacValid: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface PRTMetadata {
|
|
20
|
+
origin: string;
|
|
21
|
+
isInMDL: boolean;
|
|
22
|
+
decryptionKeyAvailable: boolean;
|
|
23
|
+
prtHeader: string;
|
|
24
|
+
nonZeroUint8Signal: boolean;
|
|
25
|
+
owner: string;
|
|
26
|
+
}
|
|
27
|
+
export type UniquePlainTextToken = PlaintTextToken & {
|
|
28
|
+
prtHeader?: string;
|
|
29
|
+
};
|
|
30
|
+
export type UniqueDecryptedToken = DecryptedToken & {
|
|
31
|
+
prtHeader?: string;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { PrebidAuctionEventType } from '../../prebid.types';
|
|
5
|
+
import { BidRequestedEvent, BidResponse, BidTimeoutEvent, NoBid } from '../../prebidGlobal.types';
|
|
6
|
+
import { Bidder, BidderType } from './types';
|
|
7
|
+
/**
|
|
8
|
+
* Forms data for received bids in an auction
|
|
9
|
+
* @param receivedBids Array of bid responses received in the auction
|
|
10
|
+
* @param bidderRequest The bidder request event data
|
|
11
|
+
* @param auctionEndTimestamp Timestamp marking the end of the auction
|
|
12
|
+
* @returns {Partial<Bidder> | null} Bidder data object or null if no matching bid is found
|
|
13
|
+
*/
|
|
14
|
+
export declare function formReceivedBidData(receivedBids: BidResponse[], bidderRequest: BidRequestedEvent, auctionEndTimestamp: number): {
|
|
15
|
+
name: string;
|
|
16
|
+
startTime: number;
|
|
17
|
+
endTime: number;
|
|
18
|
+
duration: string;
|
|
19
|
+
type: BidderType;
|
|
20
|
+
data: BidRequestedEvent;
|
|
21
|
+
} | null;
|
|
22
|
+
/**
|
|
23
|
+
* Forms data for bids that received no response
|
|
24
|
+
* @param noBids Array of bid responses that received no bids
|
|
25
|
+
* @param bidderRequest The bidder request event data
|
|
26
|
+
* @param auctionEndTimestamp Timestamp marking the end of the auction
|
|
27
|
+
* @param events Array of Prebid auction events
|
|
28
|
+
* @returns {Partial<Bidder> | null} Bidder data object or null if no matching bid is found
|
|
29
|
+
*/
|
|
30
|
+
export declare function formNoBidData(noBids: NoBid[], bidderRequest: BidRequestedEvent, auctionEndTimestamp: number, events: PrebidAuctionEventType[]): Partial<Bidder> | null;
|
|
31
|
+
/**
|
|
32
|
+
* Forms data for bids that received no response
|
|
33
|
+
* @param timedOutBids Array of bid responses that received no bids
|
|
34
|
+
* @param bidderRequest The bidder request event data
|
|
35
|
+
* @param auctionEndTimestamp Timestamp marking the end of the auction
|
|
36
|
+
* @param events Array of Prebid auction events
|
|
37
|
+
* @returns {Partial<Bidder> | null} Bidder data object or null if no matching bid is found
|
|
38
|
+
*/
|
|
39
|
+
export declare function formTimedOutBids(timedOutBids: BidTimeoutEvent[], bidderRequest: BidRequestedEvent, auctionEndTimestamp: number, events: PrebidAuctionEventType[]): Partial<Bidder> | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatDuration: (value: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatTimestamp: (timestamp: number) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies.
|
|
3
|
+
*/
|
|
4
|
+
import { PrebidEvents } from '../../prebid.types';
|
|
5
|
+
import { AuctionEventsType } from '../../protectedAudience.types';
|
|
6
|
+
export declare const prepareTimelineData: (auctionEvents: PrebidEvents["auctionEvents"] | AuctionEventsType, isPrebid: boolean) => any;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare enum BidderType {
|
|
2
|
+
BID = "bid",
|
|
3
|
+
NO_BID = "no-bid",
|
|
4
|
+
WON = "won",
|
|
5
|
+
TIMED_OUT = "timed-out"
|
|
6
|
+
}
|
|
7
|
+
export interface Bidder {
|
|
8
|
+
name: string;
|
|
9
|
+
duration: string;
|
|
10
|
+
type: BidderType;
|
|
11
|
+
data?: any;
|
|
12
|
+
startTime: number;
|
|
13
|
+
endTime: number;
|
|
14
|
+
adUnitCode: string;
|
|
15
|
+
serverResponseTimeMs?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface TimelineData {
|
|
18
|
+
auctionTimeout: number;
|
|
19
|
+
auctionId: string;
|
|
20
|
+
auctionStartTimeFormatted: string;
|
|
21
|
+
auctionTime: string;
|
|
22
|
+
bidders: Bidder[];
|
|
23
|
+
auctionEndDuration: number;
|
|
24
|
+
}
|
|
@@ -2,12 +2,8 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { CompleteJson, ErroredOutUrlsData } from '../cookies.types';
|
|
5
|
-
import { LibraryData } from '../libraryDetection.types';
|
|
6
5
|
declare const extractReportData: (data: CompleteJson[]) => {
|
|
7
6
|
landingPageCookies: {};
|
|
8
|
-
consolidatedLibraryMatches: {
|
|
9
|
-
[url: string]: LibraryData;
|
|
10
|
-
};
|
|
11
7
|
erroredOutUrlsData: ErroredOutUrlsData[];
|
|
12
8
|
};
|
|
13
9
|
export default extractReportData;
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-psat/common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A package for common utilities that are being used in multiple packages",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist-types/index.d.ts",
|
|
7
8
|
"source": "src/index.ts",
|
|
@@ -38,8 +39,9 @@
|
|
|
38
39
|
"dependencies": {
|
|
39
40
|
"@google-psat/i18n": "*",
|
|
40
41
|
"@types/lodash-es": "^4.17.12",
|
|
41
|
-
"lodash-es": "^4.17.
|
|
42
|
-
"tldts": "^6.0.14"
|
|
42
|
+
"lodash-es": "^4.17.23",
|
|
43
|
+
"tldts": "^6.0.14",
|
|
44
|
+
"use-context-selector": "^1.4.1"
|
|
43
45
|
},
|
|
44
46
|
"devDependencies": {
|
|
45
47
|
"devtools-protocol": "^0.0.1345247"
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"libraryDetection.types.js","sourceRoot":"","sources":["../src/libraryDetection.types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devToolWorker.js","sourceRoot":"","sources":["../../src/worker/devToolWorker.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;GAcG;AACH,IAAI,aAAa,GAAkB,IAAI,CAAC;AAExC;;;GAGG;AACH,MAAM,gBAAgB,GAAG,GAAW,EAAE;IACpC,aAAa,GAAG,aAAa,IAAI,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC;IAEzD,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
|
package/dist/worker/enums.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/worker/enums.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,IAAY,6BAEX;AAFD,WAAY,6BAA6B;IACvC,sFAAqD,CAAA;AACvD,CAAC,EAFW,6BAA6B,6CAA7B,6BAA6B,QAExC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
/*
|
|
7
|
-
* Copyright 2023 Google LLC
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License.
|
|
11
|
-
* You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* https://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
* See the License for the specific language governing permissions and
|
|
19
|
-
* limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Internal dependencies.
|
|
23
|
-
*/
|
|
24
|
-
const devToolWorker_1 = __importDefault(require("./devToolWorker"));
|
|
25
|
-
/**
|
|
26
|
-
* Execute a task using a web worker.
|
|
27
|
-
* This is a highlevel abstraction over webworker.
|
|
28
|
-
* @param {string} task - The predefined task to be executed by the worker.
|
|
29
|
-
* @param {unknown} payload - The payload or data required for the task.
|
|
30
|
-
* @param {Function} onMessage callback.
|
|
31
|
-
*/
|
|
32
|
-
const executeTaskInDevToolWorker = (task, payload, onMessage) => {
|
|
33
|
-
const worker = (0, devToolWorker_1.default)();
|
|
34
|
-
worker.postMessage({
|
|
35
|
-
task,
|
|
36
|
-
payload,
|
|
37
|
-
});
|
|
38
|
-
worker.onmessage = (resultEvent) => {
|
|
39
|
-
onMessage(resultEvent.data);
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
exports.default = executeTaskInDevToolWorker;
|
|
43
|
-
//# sourceMappingURL=executeTaskInDevToolWorker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executeTaskInDevToolWorker.js","sourceRoot":"","sources":["../../src/worker/executeTaskInDevToolWorker.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH;;GAEG;AACH,oEAA+C;AAI/C;;;;;;GAMG;AACH,MAAM,0BAA0B,GAAG,CACjC,IAAmC,EACnC,OAAgB,EAChB,SAAgD,EAChD,EAAE;IACF,MAAM,MAAM,GAAG,IAAA,uBAAgB,GAAE,CAAC;IAElC,MAAM,CAAC,WAAW,CAAC;QACjB,IAAI;QACJ,OAAO;KACR,CAAC,CAAC;IAEH,MAAM,CAAC,SAAS,GAAG,CAAC,WAAyB,EAAE,EAAE;QAC/C,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export type DetectedSignature = {
|
|
2
|
-
feature: {
|
|
3
|
-
type: 'link';
|
|
4
|
-
text: string;
|
|
5
|
-
url: string;
|
|
6
|
-
};
|
|
7
|
-
subItems: {
|
|
8
|
-
type: 'subitems';
|
|
9
|
-
items: {
|
|
10
|
-
sourceLocation: string;
|
|
11
|
-
snippet: string;
|
|
12
|
-
}[];
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
export type LibraryData = {
|
|
16
|
-
[key: string]: {
|
|
17
|
-
signatureMatches?: number;
|
|
18
|
-
moduleMatch?: number;
|
|
19
|
-
matches?: DetectedSignature[];
|
|
20
|
-
domQuerymatches?: [string] | null;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export type ScriptTagUnderCheck = {
|
|
24
|
-
origin: string | null;
|
|
25
|
-
content: string;
|
|
26
|
-
type?: string;
|
|
27
|
-
};
|
|
28
|
-
export type DetectionFunctions = (arg0: ScriptTagUnderCheck, arg1: DetectedSignature[], arg2: number, arg3: number) => {
|
|
29
|
-
signatureMatches: number;
|
|
30
|
-
matches: DetectedSignature[];
|
|
31
|
-
moduleMatch?: number;
|
|
32
|
-
};
|
|
33
|
-
export type LibraryMatchers = {
|
|
34
|
-
name?: string;
|
|
35
|
-
component: React.FC;
|
|
36
|
-
signatures?: {
|
|
37
|
-
strongMatches: {
|
|
38
|
-
signature: string;
|
|
39
|
-
helpUrl: string;
|
|
40
|
-
}[];
|
|
41
|
-
weakMatches: {
|
|
42
|
-
signature: string;
|
|
43
|
-
helpUrl: string;
|
|
44
|
-
}[];
|
|
45
|
-
};
|
|
46
|
-
domainsToSkip?: string[];
|
|
47
|
-
helpUrl: string;
|
|
48
|
-
detectionFunction?: DetectionFunctions;
|
|
49
|
-
domQueryFunction?: (externalDocument?: Document | null) => string[];
|
|
50
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { LibraryData } from '../libraryDetection.types';
|
|
2
|
-
import { LIBRARY_DETECTION_WORKER_TASK } from './enums';
|
|
3
|
-
/**
|
|
4
|
-
* Execute a task using a web worker.
|
|
5
|
-
* This is a highlevel abstraction over webworker.
|
|
6
|
-
* @param {string} task - The predefined task to be executed by the worker.
|
|
7
|
-
* @param {unknown} payload - The payload or data required for the task.
|
|
8
|
-
* @param {Function} onMessage callback.
|
|
9
|
-
*/
|
|
10
|
-
declare const executeTaskInDevToolWorker: (task: LIBRARY_DETECTION_WORKER_TASK, payload: unknown, onMessage: (dataFromThread: LibraryData) => void) => void;
|
|
11
|
-
export default executeTaskInDevToolWorker;
|