Skip to content

Commit 1ca5d5c

Browse files
committed
Merge branch 'develop' into Traits-extraction
2 parents 4e052c8 + d0cbb5e commit 1ca5d5c

File tree

132 files changed

+12251
-7350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+12251
-7350
lines changed

.github/styles/Vocab/Docs/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ aws
3535
background(?:ed|ing)
3636
Bento
3737
Bing
38+
Blackbaud
3839
Blitzllama
3940
blocklist
4041
Bluedot

CODEOWNERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ CODEOWNERS @segmentio/segment-doc-team
2121

2222

2323
# Libraries owners
24-
/src/connections/catalog/libraries @stayseesong @markzegarelli
24+
/src/connections/catalog/libraries @stayseesong
2525

2626

2727
# Destinations owners
28-
# /src/connections/destinations @stayseesong @markzegarelli
28+
# /src/connections/destinations @stayseesong=
2929

3030
# Stratconn
3131
## Adobe
@@ -41,7 +41,7 @@ CODEOWNERS @segmentio/segment-doc-team
4141

4242

4343
# Engage
44-
/src/engage/ @markzegarelli @pwseg @rchinn-segment
44+
/src/engage/ @pwseg @rchinn-segment
4545

4646
# Unify
4747
/src/unify @rchinn-segment
@@ -50,4 +50,4 @@ CODEOWNERS @segmentio/segment-doc-team
5050
/src/protocols @forstisabella
5151

5252
# Storage owners
53-
/src/connections/storage @forstisabella
53+
/src/connections/storage @forstisabella

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ serve: package
5656
@docker run -p 4000:80 segment-docs:latest
5757

5858
catalog:
59-
@node scripts/catalog_papi.js
59+
@node scripts/catalog/index.js
6060

6161
# make the list of beta connections
6262
.PHONY: beta
@@ -163,7 +163,7 @@ docker-build:
163163

164164
.PHONY: private-destination
165165
private_destination:
166-
@node scripts/private-destination.js
166+
@node scripts/catalog/addPrivateDestination.js
167167
#.PHONY: docs
168168
#docs: node_modules
169169
# $(BIN)/webpack --mode=production

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
[context.branch-deploy]
1616
command = "yarn build"
17-
# ignore = "./scripts/ignore.sh"
17+
# ignore = "./scripts/ignore.sh"
1818

1919
[context.develop]
2020
command = "yarn develop"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
const { prompt } = require('enquirer');
4+
const {
5+
getDestinationData,
6+
checkExistingStatus
7+
} = require('./utilities_private_destinations.js');
8+
9+
const addPrivateDestination = async () => {
10+
let ids = await checkExistingStatus();
11+
ids.sort();
12+
13+
const DEST_ID = await prompt({
14+
type: 'input',
15+
name: 'id',
16+
message: 'Enter the destination ID'
17+
});
18+
19+
20+
if (ids.includes(DEST_ID.id)) {
21+
console.log("This destination is already captured.");
22+
return;
23+
} else {
24+
ids.push(DEST_ID.id);
25+
fs.writeFileSync(path.resolve(__dirname, `../../src/_data/catalog/destinations_private.yml`), '');
26+
}
27+
ids.sort();
28+
29+
for (const element in ids) {
30+
let currentId = ids[element];
31+
await getDestinationData(currentId);
32+
}
33+
};
34+
35+
addPrivateDestination();

scripts/catalog/catalog_papi.js

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
const path = require('path');
2+
const fs = require('fs');
3+
const yaml = require('js-yaml');
4+
const {
5+
slugify,
6+
getCatalog,
7+
getConnectionModes,
8+
isCatalogItemHidden,
9+
sanitize,
10+
doesCatalogItemExist
11+
} = require('./utilities.js');
12+
13+
require('dotenv').config();
14+
15+
const PAPI_URL = "https://api.segmentapis.com";
16+
17+
const regionalSupport = yaml.load(fs.readFileSync(path.resolve(__dirname, `../src/_data/regional-support.yml`)));
18+
19+
// This file keeps a list of known test sources that show up in the system.
20+
// Because we don't have a status value for sources, they end up showing in our catalog.
21+
// We use this below to prevent them from being written to yaml.
22+
const testSources = yaml.load(fs.readFileSync(path.resolve(__dirname, `../src/_data/catalog/test_sources.yml`)));
23+
24+
25+
26+
const updateWarehouses = async () => {
27+
let warehouses = [];
28+
let nextPageToken = "MA==";
29+
let warehousesUpdated = [];
30+
31+
while (nextPageToken !== undefined) {
32+
const res = await getCatalog(`${PAPI_URL}/catalog/warehouses/`, nextPageToken);
33+
warehouses = warehouses.concat(res.data.warehousesCatalog);
34+
nextPageToken = res.data.pagination.next;
35+
}
36+
37+
warehouses.sort((a, b) => {
38+
if (a.name.toLowerCase() < b.name.toLowerCase()) {
39+
return -1;
40+
}
41+
if (a.name.toLowerCase() > b.name.toLowerCase()) {
42+
return 1;
43+
}
44+
return 0;
45+
});
46+
47+
const regionalWarehouseEndpoints = regionalSupport.warehouses.endpoint;
48+
const regionalWarehouseRegions = regionalSupport.warehouses.region;
49+
50+
warehouses.forEach(warehouse => {
51+
let slug = slugify(warehouse.slug);
52+
let endpoints = ['us'];
53+
let regions = ['us'];
54+
let url = `connections/storage/catalog/${slug}`;
55+
56+
if (regionalWarehouseEndpoints.includes(slug)) {
57+
endpoints.push('eu');
58+
}
59+
60+
if (regionalWarehouseRegions.includes(slug)) {
61+
regions.push('eu');
62+
}
63+
64+
let updatedWarehouse = {
65+
id: warehouse.id,
66+
display_name: warehouse.name,
67+
url,
68+
slug,
69+
endpoints,
70+
regions
71+
};
72+
73+
warehousesUpdated.push(updatedWarehouse);
74+
});
75+
76+
const options = {
77+
noArrayIndent: true
78+
};
79+
const todayDate = new Date().toISOString().slice(0, 10);
80+
81+
// Create regional support YAML file
82+
let output = "# AUTOGENERATED LIST OF CONNECTIONS THAT SUPPORT REGIONAL\n";
83+
output += "# Last updated " + todayDate + " \n";
84+
output += yaml.dump({
85+
warehouses: warehousesUpdated
86+
}, options);
87+
fs.writeFileSync(path.resolve(__dirname, `../src/_data/catalog/regional-supported.yml`), output);
88+
89+
console.log("warehouses done");
90+
};
91+
92+
// Execute the update functions
93+
updateWarehouses();
94+
updateSources();
95+
updateDestinations();

scripts/catalog/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const {updateSources} = require('./updateSources.js');
2+
const {updateDestinations} = require('./updateDestinations.js');
3+
const {updateWarehouses} = require('./updateWarehouses.js');
4+
const {updatePrivateDestinations} = require('./updatePrivateDestinations.js');
5+
6+
updateSources();
7+
updateWarehouses();
8+
9+
// Wait for the main catalog to update before updating the private destinations
10+
async function destinations() {
11+
await updateDestinations()
12+
updatePrivateDestinations();
13+
}
14+
15+
16+
17+
destinations();

0 commit comments

Comments
 (0)