Skip to content

Commit 07c5852

Browse files
Update resource group definitions
1 parent 27477cd commit 07c5852

File tree

11 files changed

+109
-80
lines changed

11 files changed

+109
-80
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
/lib
33
/types
44
/node_modules
5-
/service-groups.json
5+
/resource-groups.json
66
/tsconfig.tsbuildinfo

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@dataunlocker/service-groups",
3-
"version": "1.1.0",
4-
"description": "Default service group definitions for DataUnlocker.",
2+
"name": "@dataunlocker/resource-groups",
3+
"version": "2.0.0",
4+
"description": "Default resource group definitions for DataUnlocker.",
55
"type": "module",
66
"main": "lib/index.js",
77
"types": "lib/index.d.ts",
@@ -10,25 +10,25 @@
1010
"lib",
1111
"!lib/**/*.test.js",
1212
"!lib/**/*.test.d.ts",
13-
"service-groups.yml",
14-
"service-groups.json"
13+
"resource-groups.yml",
14+
"resource-groups.json"
1515
],
1616
"repository": {
1717
"type": "git",
18-
"url": "git+https://github.com/dataunlocker/service-groups.git"
18+
"url": "git+https://github.com/dataunlocker/resource-groups.git"
1919
},
2020
"bugs": {
21-
"url": "https://github.com/dataunlocker/service-groups/issues"
21+
"url": "https://github.com/dataunlocker/resource-groups/issues"
2222
},
23-
"homepage": "https://github.com/dataunlocker/service-groups#readme",
23+
"homepage": "https://github.com/dataunlocker/resource-groups#readme",
2424
"scripts": {
2525
"build": "tsc && tsc-alias && node ./bin/build.js",
2626
"test": "node ./bin/verify.js && node --test",
2727
"test:local": "npm run build && npm run test"
2828
},
2929
"keywords": [
3030
"dataunlocker",
31-
"service",
31+
"resource",
3232
"groups"
3333
],
3434
"author": "DataUnlocker",

readme.md

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,30 @@
1-
# DataUnlocker service groups
1+
# DataUnlocker Resource Groups
22

3-
Default service group definitions for DataUnlocker.
3+
Resource group definitions for [DataUnlocker](https://www.dataunlocker.com).
44

5-
To simplify third-party proxy configuration (what to proxy and what not), DataUnlocker
6-
uses a concept of "Service Groups". DataUnlocker customers can specify whether to enable
7-
or disable DataUnlocker's proxy for the entire service group, instead of each individual
8-
service (domain).
5+
<img width="589" height="364" alt="Image" src="https://github.com/user-attachments/assets/ad6f883e-1f59-48ea-ae75-217be90ef1cd" />
96

10-
Each Service Group contains a list of services (domains) like `google.com`. Original service
11-
groups are defined in [service-groups.yml](./service-groups.yml) and are additionally
12-
exported as:
7+
To simplify third-party proxy configuration (what to proxy and what not), DataUnlocker uses a concept of [Resource Groups](https://docs.dataunlocker.com/setup/config/traffic).
8+
Website with DataUnlocker installed can specify whether to enable or disable DataUnlocker's proxy for the entire resource group, instead of each individual resource (domain).
139

14-
- `service-groups.yml`
15-
- `service-groups.json` (built within the package)
16-
- JavaScript bindings (see below)
17-
18-
## Installation
19-
20-
This package uses NodeJS 20+.
21-
22-
```sh
23-
npm install @dataunlocker/service-groups
24-
```
25-
26-
```ts
27-
import { getServiceGroupIdByDomain } from "@dataunlocker/service-groups";
10+
Each Resource Group contains a list of resources (domains suffixes) like `google.com`.
11+
Original resource groups are defined in [resource-groups.yml](./resource-groups.yml) and are additionally exported from this package as:
2812

29-
getServiceGroupIdByDomain("google.com.ua"); // "google"
30-
getServiceGroupIdByDomain("googletagmanager.com"); // "google"
31-
```
13+
- `resource-groups.json` (built within the package)
14+
- JavaScript bindings (see below)
3215

33-
## Syntax
16+
## Syntax and structure
3417

3518
```yaml
36-
service-id:
37-
- service-name.com
38-
- service-name.com.au
39-
- service-name.io
19+
resource-name:
20+
- resource-name.com
21+
- resource-name.com.au
22+
- resource-name.io
4023
```
4124
4225
## Contributing
4326
44-
Pull requests to [service-groups.yml](./service-groups.yml) are welcome. For anything more
45-
complex please create an issue.
27+
Pull requests to [resource-groups.yml](./resource-groups.yml) are welcome.
28+
For anything more complex please create an issue.
4629
47-
DataUnlocker's infrastructure will gradually pick up service group definitions from this
48-
package after your contribution.
30+
DataUnlocker's infrastructure will gradually pick up resource group definitions from this package after your contribution.

service-groups.yml renamed to resource-groups.yml

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ adroll:
33
- adroll.com
44
- adroll.mgr.consensu.org
55

6+
amazon:
7+
- amazon-adsystem.com
8+
69
amplitude:
710
- amplitude.com
811

@@ -11,17 +14,19 @@ cloudflare:
1114
- cdnjs.cloudflare.com
1215
- cloudflareinsights.com
1316

17+
criteo:
18+
- criteo.com
19+
- criteo.net
20+
1421
dataunlocker:
1522
- dataunlocker.com
1623
- defender
1724

18-
meta:
19-
- facebook.com
20-
- facebook.net
21-
- instagram.com
22-
- fbcdn.net
23-
- fbsbx.com
24-
- cdninstagram.com
25+
fathom:
26+
- fathom.com
27+
28+
fullstory:
29+
- fullstory.com
2530

2631
google:
2732
- doubleclick.net
@@ -273,16 +278,45 @@ linkedin:
273278
- ads.linkedin.com
274279
- snap.licdn.com
275280

281+
meta:
282+
- facebook.com
283+
- facebook.net
284+
- instagram.com
285+
- fbcdn.net
286+
- fbsbx.com
287+
- cdninstagram.com
288+
276289
microsoft:
277290
- ajax.microsoft.com
278-
- bat.bing.com
279-
- c.bing.com
291+
- bing.com
292+
- bing.net
280293
- clarity.ms
281294

282295
mixpanel:
283296
- mixpanel.com
284297
- mxpnl.com
285298

299+
optimizely:
300+
- optimizely.com
301+
- optimizely.s3.amazonaws.com
302+
- cdn-assets-prod.s3.amazonaws.com
303+
304+
pinterest:
305+
- pinterest.com
306+
307+
plausible:
308+
- plausible.io
309+
310+
posthog:
311+
- posthog.com
312+
313+
quora:
314+
- quora.com
315+
316+
reddit:
317+
- reddit.com # events.reddit.com
318+
- redditstatic.com
319+
286320
segment:
287321
- segment.io
288322
- segment.com
@@ -291,16 +325,26 @@ sentry:
291325
- sentry-cdn.com
292326
- sentry.io
293327

328+
snapchat:
329+
- snapchat.com
330+
- sc-static.net
331+
294332
tiktok:
295-
- analytics.tiktok.com
333+
- tiktok.com
334+
- tiktokw.us
296335

297336
vercel:
298337
- vercel-insights.com
299338

339+
visualwebsiteoptimizer:
340+
- visualwebsiteoptimizer.com
341+
- vwo.com
342+
300343
x:
301344
- ads-twitter.com
302-
- twitter.com
345+
- analytics.twitter.com
303346
- x.com
347+
- t.co
304348

305349
yandex:
306350
- yandex.az

src/bin/common.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
import { ServiceGroupsJson, ServiceGroupsReversedMap } from "@/types/index.js";
1+
import {
2+
ResourceGroupsJson,
3+
ResourceGroupsReversedMap,
4+
} from "@/types/index.js";
25
import { readFileSync, writeFileSync } from "fs";
36
import JSON5 from "json5";
47
import { parse, stringify } from "yaml";
58

6-
const FILE_SOURCE_YML = "service-groups.yml";
7-
const FILE_SOURCE_JSON = "service-groups.json";
9+
const FILE_SOURCE_YML = "resource-groups.yml";
10+
const FILE_SOURCE_JSON = "resource-groups.json";
811
const FILE_SOURCE_REVERSE_MAP = "./lib/_generated/map-reverse.js";
912
const FILE_SOURCE_MAP = "./lib/_generated/map.js";
1013

11-
export const source: ServiceGroupsJson = parse(
14+
export const source: ResourceGroupsJson = parse(
1215
readFileSync(FILE_SOURCE_YML).toString()
1316
);
1417

15-
export const write = (json: ServiceGroupsJson) =>
18+
export const write = (json: ResourceGroupsJson) =>
1619
writeFileSync(FILE_SOURCE_YML, stringify(json));
17-
export const writeJson = (json: ServiceGroupsJson) =>
20+
export const writeJson = (json: ResourceGroupsJson) =>
1821
writeFileSync(FILE_SOURCE_JSON, JSON.stringify(json, null, 2));
1922

20-
export const writeReverseMap = (json: ServiceGroupsJson) => {
23+
export const writeReverseMap = (json: ResourceGroupsJson) => {
2124
const serviceGroupIds: string[] = [];
22-
const map: ServiceGroupsReversedMap = {};
25+
const map: ResourceGroupsReversedMap = {};
2326

2427
for (const serviceGroupId in json) {
2528
const serviceGroupIdKey = serviceGroupIds.length;
@@ -61,7 +64,7 @@ export const map = ${stringifiedMap};
6164
);
6265
};
6366

64-
export const writeMap = (json: ServiceGroupsJson) => {
67+
export const writeMap = (json: ResourceGroupsJson) => {
6568
writeFileSync(
6669
FILE_SOURCE_MAP,
6770
`export const map = ${JSON5.stringify(json)};

src/bin/verify.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { source } from "./common.js";
22

3-
// Verify the "google" service config is not missing domains officially announced by Google.
3+
// Verify the "google" resource config is not missing domains officially announced by Google.
44
await (async () => {
55
const googleDomainsRequest = await fetch(
66
"https://www.google.com/supported_domains"
@@ -22,7 +22,7 @@ await (async () => {
2222
}
2323
})();
2424

25-
// Verify no duplicates among service groups and inside a service group.
25+
// Verify no duplicates among resource groups and inside a resource group.
2626
await (async () => {
2727
const allServices = new Set();
2828

src/lib/_generated/map-reverse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* WARNING: this file is automatically generated and replaced on build.
44
*/
55

6-
import { ServiceGroupsReversedMap } from "@/types/index.js";
6+
import { ResourceGroupsReversedMap } from "@/types/index.js";
77

88
/** Sample data will be overridden on build. */
99

1010
export const mapKeys = ["google"];
11-
export const map: ServiceGroupsReversedMap = {
11+
export const map: ResourceGroupsReversedMap = {
1212
com: {
1313
google: 0,
1414
},

src/lib/_generated/map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* WARNING: this file is automatically generated and replaced on build.
44
*/
55

6-
import { ServiceGroupsJson } from "@/types/index.js";
6+
import { ResourceGroupsJson } from "@/types/index.js";
77

88
/** Sample data will be overridden on build. */
99

10-
export const map: ServiceGroupsJson = {
10+
export const map: ResourceGroupsJson = {
1111
google: ["google.com", "google.com.ua"],
1212
};

src/lib/map.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { ServiceGroupsJson } from "@/types/index.js";
1+
import { ResourceGroupsJson } from "@/types/index.js";
22
import { map } from "./_generated/map.js";
33

44
/** Returns a list of domains in a service group. */
55
export const getDomainsByServiceGroupId = (serviceGroupId: string): string[] =>
66
map[serviceGroupId] || [];
77

88
/** Returns a map of service group ID to a list of domains of this service group. */
9-
export const getServiceGroupsMap = (): ServiceGroupsJson => map;
9+
export const getServiceGroupsMap = (): ResourceGroupsJson => map;

0 commit comments

Comments
 (0)