@google-psat/analysis-utils 0.9.0-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.
Files changed (34) hide show
  1. package/.eslintrc.json +7 -0
  2. package/README.md +4 -0
  3. package/dist/browserManagement/collateCookieData.js +35 -0
  4. package/dist/browserManagement/collateCookieData.js.map +1 -0
  5. package/dist/browserManagement/index.js +532 -0
  6. package/dist/browserManagement/index.js.map +1 -0
  7. package/dist/browserManagement/parseNetworkDataToCookieData.js +187 -0
  8. package/dist/browserManagement/parseNetworkDataToCookieData.js.map +1 -0
  9. package/dist/browserManagement/types.js +18 -0
  10. package/dist/browserManagement/types.js.map +1 -0
  11. package/dist/index.js +33 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/procedures/analyzeCookiesUrlsAndFetchResources.js +71 -0
  14. package/dist/procedures/analyzeCookiesUrlsAndFetchResources.js.map +1 -0
  15. package/dist/procedures/analyzeCookiesUrlsInBatchesAndFetchResources.js +54 -0
  16. package/dist/procedures/analyzeCookiesUrlsInBatchesAndFetchResources.js.map +1 -0
  17. package/dist/procedures/analyzeTechnologiesUrlsInBatches.js +64 -0
  18. package/dist/procedures/analyzeTechnologiesUrlsInBatches.js.map +1 -0
  19. package/dist/procedures/index.js +25 -0
  20. package/dist/procedures/index.js.map +1 -0
  21. package/dist/types.js +3 -0
  22. package/dist/types.js.map +1 -0
  23. package/dist-types/browserManagement/collateCookieData.d.ts +11 -0
  24. package/dist-types/browserManagement/index.d.ts +53 -0
  25. package/dist-types/browserManagement/parseNetworkDataToCookieData.d.ts +6 -0
  26. package/dist-types/browserManagement/types.d.ts +37 -0
  27. package/dist-types/index.d.ts +1 -0
  28. package/dist-types/procedures/analyzeCookiesUrlsAndFetchResources.d.ts +10 -0
  29. package/dist-types/procedures/analyzeCookiesUrlsInBatchesAndFetchResources.d.ts +29 -0
  30. package/dist-types/procedures/analyzeTechnologiesUrlsInBatches.d.ts +14 -0
  31. package/dist-types/procedures/index.d.ts +3 -0
  32. package/dist-types/types.d.ts +80 -0
  33. package/package.json +49 -0
  34. package/tsconfig.json +16 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * External dependencies.
3
+ */
4
+ import { CookieData, CookieDatabase, LibraryData, LibraryMatchers } from '@google-psat/common';
5
+ export declare const analyzeCookiesUrlsInBatchesAndFetchResources: (urls: string[], Libraries: LibraryMatchers[], isHeadless: boolean, delayTime: number, cookieDictionary: CookieDatabase, batchSize?: number, spinnies?: {
6
+ add: (id: string, { text, indent }: {
7
+ text: string;
8
+ indent: number;
9
+ }) => void;
10
+ succeed: (id: string, { text, indent }: {
11
+ text: string;
12
+ indent: number;
13
+ }) => void;
14
+ }, shouldSkipAcceptBanner?: boolean) => Promise<{
15
+ url: string;
16
+ cookieData: {
17
+ [frameUrl: string]: {
18
+ frameCookies: {
19
+ [key: string]: CookieData;
20
+ };
21
+ };
22
+ };
23
+ resources: {
24
+ origin: string | null;
25
+ content: string;
26
+ type?: string;
27
+ }[];
28
+ domQueryMatches: LibraryData;
29
+ }[]>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Internal dependencies.
3
+ */
4
+ import { TechnologyDetailList } from '../types';
5
+ export declare const analyzeTechnologiesUrlsInBatches: (urls: Array<string>, batchSize?: number, spinnies?: {
6
+ add: (id: string, { text, indent }: {
7
+ text: string;
8
+ indent: number;
9
+ }) => void;
10
+ succeed: (id: string, { text, indent }: {
11
+ text: string;
12
+ indent: number;
13
+ }) => void;
14
+ }) => Promise<TechnologyDetailList[]>;
@@ -0,0 +1,3 @@
1
+ export { analyzeCookiesUrlsAndFetchResources } from './analyzeCookiesUrlsAndFetchResources';
2
+ export { analyzeCookiesUrlsInBatchesAndFetchResources } from './analyzeCookiesUrlsInBatchesAndFetchResources';
3
+ export { analyzeTechnologiesUrlsInBatches } from './analyzeTechnologiesUrlsInBatches';
@@ -0,0 +1,80 @@
1
+ /**
2
+ * External dependencies.
3
+ */
4
+ import { Protocol } from 'puppeteer';
5
+ import { type Cookie as SimpleCookie } from 'simple-cookie';
6
+ export interface Cookie extends Protocol.Network.Cookie {
7
+ partitionKey?: string;
8
+ }
9
+ export type ResponseReceivedExtraInfo = Protocol.Network.ResponseReceivedExtraInfoEvent;
10
+ export type ResponseReceived = Protocol.Network.ResponseReceivedEvent;
11
+ export type Cookies = Array<Cookie>;
12
+ export type CookiesObjects = {
13
+ [key: string]: Cookie;
14
+ };
15
+ export type ParsedCookie = SimpleCookie;
16
+ export interface TechnologyDetail {
17
+ name: string;
18
+ categories: string[];
19
+ }
20
+ export type TechnologyDetailList = Array<TechnologyDetail>;
21
+ export interface CookieLogDetails extends Omit<Cookie, 'sameSite' | 'size' | 'session' | 'priority' | 'sameParty' | 'sourceScheme' | 'sourcePort'> {
22
+ name: string;
23
+ domain: string;
24
+ platform: string;
25
+ category: string;
26
+ description: string;
27
+ isFirstParty: 'Yes' | 'No';
28
+ sameSite: string;
29
+ partitionKey?: string;
30
+ pageUrl: string;
31
+ requestUrls: {
32
+ [key: string]: string;
33
+ };
34
+ frameUrls: {
35
+ [key: string]: string;
36
+ };
37
+ isBlocked?: boolean;
38
+ blockedReasons: Array<string>;
39
+ }
40
+ export type BlockedCookie = {
41
+ blockedReasons: Array<string>;
42
+ cookieLine: string;
43
+ cookie?: Cookie;
44
+ };
45
+ export type BlockedCookies = Array<BlockedCookie>;
46
+ export type RequestDetail = {
47
+ requestID: string;
48
+ frameID: string;
49
+ type: string;
50
+ url: string;
51
+ frameURL: string;
52
+ allCookies: Cookies;
53
+ blockedCookies: BlockedCookies;
54
+ acceptedCookies: Cookies;
55
+ };
56
+ export type RequestDetails = {
57
+ [requestID: string]: RequestDetail;
58
+ };
59
+ export interface TechnologiesDetails {
60
+ name: string;
61
+ description: string;
62
+ confidence: number;
63
+ website: string;
64
+ categories: {
65
+ name: string;
66
+ }[];
67
+ }
68
+ export interface TechnologiesDetailsSitemap extends TechnologiesDetails {
69
+ frequency: number;
70
+ }
71
+ export type CookieLogDetailList = Array<CookieLogDetails>;
72
+ export type UniqueCookiesLogDetail = {
73
+ [key: string]: CookieLogDetails;
74
+ };
75
+ export interface Job {
76
+ data: any;
77
+ status: string;
78
+ response: any;
79
+ message: string;
80
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@google-psat/analysis-utils",
3
+ "version": "0.9.0-1",
4
+ "description": "A package for CLI analysis",
5
+ "main": "dist/index.js",
6
+ "types": "dist-types/index.d.ts",
7
+ "source": "src/index.ts",
8
+ "author": {
9
+ "name": "Google"
10
+ },
11
+ "customExports": {
12
+ ".": {
13
+ "default": "./src/index.ts"
14
+ }
15
+ },
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "dev": "tsc-watch",
19
+ "build:remove": "rimraf dist dist-types tsconfig.tsbuildinfo",
20
+ "publish:local": "npm publish --registry=http://localhost:4873",
21
+ "publish:remote": "npm publish --access=public --registry=https://registry.npmjs.org",
22
+ "unpublish:local": "npm unpublish --registry=http://localhost:4873 --force",
23
+ "unpublish:remote": "npm unpublish --registry=https://registry.npmjs.org --force"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/GoogleChromeLabs/ps-analysis-tool",
31
+ "directory": "packages/analysis-utils"
32
+ },
33
+ "license": "Apache-2.0",
34
+ "bugs": {
35
+ "url": "https://github.com/GoogleChromeLabs/ps-analysis-tool/issues"
36
+ },
37
+ "homepage": "https://github.com/GoogleChromeLabs/ps-analysis-tool",
38
+ "dependencies": {
39
+ "@google-psat/common": "*",
40
+ "puppeteer": "^22.10.0",
41
+ "simple-cookie": "^1.0.15",
42
+ "tldts": "^6.0.14",
43
+ "wappalyzer": "^6.10.66"
44
+ },
45
+ "devDependencies": {
46
+ "tsc-watch": "^6.0.4",
47
+ "typescript": "^5.0.4"
48
+ }
49
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "src",
4
+ "target": "es6",
5
+ "lib": ["es2021"],
6
+ "module": "commonjs",
7
+ "outDir": "dist",
8
+ "declarationDir": "dist-types",
9
+ "composite": true,
10
+ "strict": true,
11
+ "sourceMap": true,
12
+ "esModuleInterop": true,
13
+ "moduleResolution": "node"
14
+ },
15
+ "exclude": ["**/tests/**/*.ts", "dist/**", "dist-types/**"]
16
+ }