Skip to content

Commit 3ce04d5

Browse files
author
markzegarelli
authored
Merge pull request #3108 from segmentio/develop
Release 22.25.2
2 parents 4dadc4b + d985b87 commit 3ce04d5

File tree

28 files changed

+2324
-166
lines changed

28 files changed

+2324
-166
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ HTTP
5151
https
5252
HTTPS
5353
Hubspot
54+
incrementality
5455
ios
5556
iOS
5657
Javadoc
@@ -78,6 +79,7 @@ Preact
7879
Shopify
7980
Skalin
8081
Smartly
82+
Snapchat
8183
Subnet
8284
svg
8385
Totango

scripts/private-destination.js

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
const axios = require('axios');
2+
const path = require('path');
3+
const fs = require('fs');
4+
const fm = require('front-matter');
5+
const yaml = require('js-yaml');
6+
const {
7+
prompt
8+
} = require('enquirer');
9+
10+
require('dotenv').config();
11+
12+
13+
// Here, global variables are set
14+
const PAPI_URL = "https://api.segmentapis.com"
15+
16+
const PRIVATE_DESTINATIONS = yaml.load(fs.readFileSync(path.resolve(__dirname, `../src/_data/catalog/destinations_private.yml`)))
17+
const privateDests = PRIVATE_DESTINATIONS.items
18+
const getCatalog = async (url, page_token = "MA==") => {
19+
try {
20+
const res = await axios.get(url, {
21+
headers: {
22+
'Content-Type': 'application/json',
23+
'Authorization': `Bearer ${process.env.PAPI_TOKEN}`
24+
},
25+
data: {
26+
"pagination": {
27+
"count": 200,
28+
"cursor": page_token
29+
}
30+
}
31+
});
32+
33+
return res.data
34+
} catch (error) {
35+
console.log(error)
36+
}
37+
}
38+
39+
const addPrivateDestination = async () => {
40+
const DEST_ID = await prompt({
41+
type: 'input',
42+
name: 'id',
43+
message: 'Enter the destination ID'
44+
})
45+
46+
const privateIds = []
47+
for (let [key] of Object.entries(privateDests)) {
48+
privateIds.push(privateDests[key].id)
49+
}
50+
51+
if (privateIds.includes(DEST_ID.id)) {
52+
console.log("This destination is already captured.")
53+
return
54+
} else {
55+
const res = await getCatalog(`${PAPI_URL}/catalog/destinations/${DEST_ID.id}`)
56+
destination = res.data.destinationMetadata
57+
let settings = destination.options
58+
59+
settings.sort((a, b) => {
60+
if (a.name.toLowerCase() < b.name.toLowerCase()) {
61+
return -1;
62+
}
63+
if (a.name.toLowerCase() > b.name.toLowerCase()) {
64+
return 1;
65+
}
66+
return 0;
67+
})
68+
let actions = destination.actions
69+
let presets = destination.presets
70+
71+
if (destination.status == "PRIVATE_BETA") {
72+
73+
let updatePrivateDest = {
74+
id: destination.id,
75+
display_name: destination.name,
76+
name: destination.name,
77+
slug: destination.slug,
78+
previous_names: destination.previousNames,
79+
website: destination.website,
80+
status: destination.status,
81+
logo: {
82+
url: destination.logos.default
83+
},
84+
mark: {
85+
url: destination.logos.mark
86+
},
87+
methods: destination.supportedMethods,
88+
platforms: destination.supportedPlatforms,
89+
components: destination.components,
90+
browserUnbundlingSupported: destination.supportedFeatures.browserUnbundling,
91+
browserUnbundlingPublic: destination.supportedFeatures.browserUnbundlingPublic,
92+
replay: destination.supportedFeatures.replay,
93+
settings,
94+
actions,
95+
presets
96+
}
97+
98+
privateDests.push(updatePrivateDest)
99+
const options = {
100+
noArrayIndent: false
101+
}
102+
103+
output = "# AUTOGENERATED FROM PUBLIC API. DO NOT EDIT\n"
104+
var todayDate = new Date().toISOString().slice(0, 10);
105+
output += "# destination data last updated " + todayDate + " with " + destination.name + " \n";
106+
output += yaml.dump({
107+
items: privateDests
108+
}, options)
109+
//console.log(output)
110+
fs.writeFileSync(path.resolve(__dirname, `../src/_data/catalog/destinations_private.yml`), output);
111+
} else {
112+
console.log("This destination is already public")
113+
}
114+
}
115+
116+
}
117+
118+
119+
addPrivateDestination()

src/_data/catalog/destination_categories.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# AUTOGENERATED FROM PUBLIC API. DO NOT EDIT
2-
# destination categories last updated 2022-06-15
2+
# destination categories last updated 2022-06-23
33
items:
44
- display_name: A/B Testing
55
slug: a-b-testing

0 commit comments

Comments
 (0)