Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

third-party-web

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

third-party-web - npm Package Compare versions

Comparing version 0.12.1 to 0.12.2

dist/entities-nostats.json

43

lib/create-entity-finder-api.js

@@ -31,4 +31,41 @@ const DOMAIN_IN_URL_REGEX = /:\/\/(\S*?)(:\d+)?(\/|$)/

function getProductInDataset(entityByDomain, entityByRootDomain, originOrURL) {
const entity = getEntityInDataset(entityByDomain, entityByRootDomain, originOrURL)
const products = entity && entity.products
if (!products) return undefined
if (typeof originOrURL !== 'string') return undefined
for (const product of products) {
for (const pattern of product.urlPatterns) {
if (pattern instanceof RegExp && pattern.test(originOrURL)) return product
if (typeof pattern === 'string' && originOrURL.includes(pattern)) return product
}
}
return undefined
}
function cloneEntities(entities) {
return entities.map(entity_ => {
const entity = {
company: entity_.name,
...entity_,
}
const products = (entity_.products || []).map(product => ({
company: entity.company,
categories: entity.categories,
facades: [],
...product,
urlPatterns: (product.urlPatterns || []).map(s =>
s.startsWith('REGEXP:') ? new RegExp(s.slice('REGEXP:'.length)) : s
),
}))
entity.products = products
return entity
})
}
function createAPIFromDataset(entities_) {
const entities = JSON.parse(JSON.stringify(entities_))
const entities = cloneEntities(entities_)
const entityByDomain = new Map()

@@ -38,3 +75,2 @@ const entityByRootDomain = new Map()

for (const entity of entities) {
if (!entity.company) entity.company = entity.name
entity.totalExecutionTime = Number(entity.totalExecutionTime) || 0

@@ -64,5 +100,6 @@ entity.totalOccurrences = Number(entity.totalOccurrences) || 0

const getEntity = getEntityInDataset.bind(null, entityByDomain, entityByRootDomain)
return {getEntity, getRootDomain, entities}
const getProduct = getProductInDataset.bind(null, entityByDomain, entityByRootDomain)
return {getEntity, getProduct, getRootDomain, entities}
}
module.exports = {createAPIFromDataset}

@@ -0,1 +1,15 @@

export interface IFacade {
name: string
repo: string
}
export interface IProduct {
name: string
company: string
homepage?: string
categories: string[]
urlPatterns?: string[]
facades?: IFacade[]
}
export interface IEntity {

@@ -7,2 +21,3 @@ name: string

domains: string[]
products?: IProduct[]
averageExecutionTime: number

@@ -16,1 +31,2 @@ totalExecutionTime: number

export declare function getEntity(url: string): IEntity | undefined
export declare function getProduct(url: string): IProduct | undefined
const fs = require('fs')
const path = require('path')
const JSON5 = require('json5')
const {entities, getRootDomain, getEntity} = require('./index.js')
const {entities, getRootDomain, getEntity, getProduct} = require('./index.js')

@@ -87,2 +86,20 @@ describe('getRootDomain', () => {

"name": "Facebook",
"products": Array [
Object {
"categories": Array [
"social",
],
"company": "Facebook",
"facades": Array [
Object {
"name": "React Live Chat Loader",
"repo": "https://github.com/calibreapp/react-live-chat-loader",
},
],
"name": "Facebook Messenger Customer Chat",
"urlPatterns": Array [
/connect\\\\\\.facebook\\\\\\.net\\\\/\\.\\*\\\\/sdk\\\\/xfbml\\\\\\.customerchat\\\\\\.js/,
],
},
],
"totalExecutionTime": 334391848,

@@ -112,2 +129,3 @@ "totalOccurrences": 1461331,

"name": "Adobe TypeKit",
"products": Array [],
"totalExecutionTime": 1722921,

@@ -139,6 +157,43 @@ "totalOccurrences": 18274,

describe('getProduct', () => {
it('works on basic url', () => {
expect(getProduct('https://www.youtube.com/embed/alGcULGtiv8')).toMatchObject({
name: 'YouTube Embedded Player',
company: 'YouTube',
categories: ['video'],
facades: [
{
name: 'Lite YouTube',
repo: 'https://github.com/paulirish/lite-youtube-embed',
},
],
})
})
it('works on regex based', () => {
expect(
getProduct('https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js')
).toMatchObject({
name: 'Facebook Messenger Customer Chat',
facades: [
{
name: 'React Live Chat Loader',
repo: 'https://github.com/calibreapp/react-live-chat-loader',
},
],
})
})
it('returns undefined when product does not match', () => {
expect(getProduct('https://js.connect.facebook.net/lib.js')).toEqual(undefined)
})
it('returns undefined with no products', () => {
expect(getProduct('https://unknown.typekit.net/fonts.css')).toEqual(undefined)
})
})
describe('build state', () => {
it('should use the complete entities set', () => {
const json = fs.readFileSync(path.join(__dirname, '../data/entities.json5'), 'utf8')
const sourceOfTruthEntities = JSON5.parse(json)
const sourceOfTruthEntities = require('../data/entities.js')
expect(entities).toHaveLength(sourceOfTruthEntities.length)

@@ -145,0 +200,0 @@ })

2

lib/markdown/faqs.partial.md

@@ -30,3 +30,3 @@ ---

Verify that the origins in `data/entities.json5` are correct. Most issues will simply be the result of mislabelling of shared origins. If everything checks out, there is likely no further action and the data is valid. If you still believe there's errors, file an issue to discuss futher.
Verify that the origins in `data/entities.js` are correct. Most issues will simply be the result of mislabelling of shared origins. If everything checks out, there is likely no further action and the data is valid. If you still believe there's errors, file an issue to discuss futher.

@@ -33,0 +33,0 @@ <a name="contribute"></a>

@@ -107,3 +107,3 @@ # [Third Party Web](https://www.thirdpartyweb.today/)

The domain->entity mapping can be found in `data/entities.json5`. Adding a new entity is as simple as adding a new array item with the following form.
The domain->entity mapping can be found in `data/entities.js`. Adding a new entity is as simple as adding a new array item with the following form.

@@ -110,0 +110,0 @@ ```js

{
"name": "third-party-web",
"version": "0.12.1",
"version": "0.12.2",
"description": "Categorized data on third party entities on the web.",

@@ -8,4 +8,4 @@ "main": "./lib/index.js",

"build:www": "cd www/ && npm install && npm run build",
"build": "node bin/convert-json5.js && node bin/generate-canonical-domain-csv.js && node bin/build-entity-json-files.js && node bin/generate-sql.js && generate-export-aliases",
"fix-entities": "prettier --print-width=100 --write data/entities.json5",
"build": "node bin/convert-entities-db.js && node bin/generate-canonical-domain-csv.js && node bin/build-entity-json-files.js && node bin/generate-sql.js && generate-export-aliases",
"lint:fix": "prettier --print-width=100 --write '**/*.js'",
"start": "mkdir -p .tmp && node bin/merge-origins-with-entities.js && node bin/create-markdown.js",

@@ -30,3 +30,2 @@ "test": "npm run build && jest 'lib/*'"

"jest": "^24.9.0",
"json5": "^2.1.0",
"lodash": "^4.17.15",

@@ -37,2 +36,3 @@ "prettier": "^1.18.2"

"exportAliases": {
"nostats-subset": "./lib/subsets/nostats.js",
"httparchive-nostats-subset": "./lib/subsets/httparchive-nostats.js",

@@ -39,0 +39,0 @@ "httparchive-subset": "./lib/subsets/httparchive.js"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc