Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0e3f4e5

Browse files
authored
Merge pull requestsegmentio#3898 from segmentio/develop
Release 22.48.3
2 parents02a9d49 +610b267 commit0e3f4e5

File tree

10 files changed

+2048
-1428
lines changed

10 files changed

+2048
-1428
lines changed

‎scripts/private-destination.js‎

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ const yaml = require('js-yaml');
66
const{
77
prompt
88
}=require('enquirer');
9+
const{
10+
type
11+
}=require('os');
912

1013
require('dotenv').config();
1114

@@ -37,9 +40,15 @@ const getCatalog = async (url, page_token = "MA==") => {
3740
}
3841
}
3942

43+
44+
constcheckDestinationStatus=async(id)=>{
45+
constres=awaitgetCatalog(`${PAPI_URL}/catalog/destinations/${id}`)
46+
letdestination=res.data.destinationMetadata
47+
returndestination
48+
}
4049
constgetDestinationData=async(id)=>{
4150
constres=awaitgetCatalog(`${PAPI_URL}/catalog/destinations/${id}`)
42-
destination=res.data.destinationMetadata
51+
letdestination=res.data.destinationMetadata
4352
letsettings=destination.options
4453
settings.sort((a,b)=>{
4554
if(a.name.toLowerCase()<b.name.toLowerCase()){
@@ -101,30 +110,60 @@ const getDestinationData = async (id) => {
101110
}
102111

103112

113+
constcheckExistingStatus=async()=>{
114+
letexistingIds=[]
115+
letnewIds=[]
116+
for(let[key]ofObject.entries(privateDests)){
117+
existingIds.push(privateDests[key].id)
118+
}
119+
120+
existingIds.sort()
104121

122+
for(iinexistingIds){
123+
letid=existingIds[i]
124+
letdestination=awaitcheckDestinationStatus(id)
125+
letstatus=destination.status
105126

127+
if(status==="PRIVATE_BETA"){
128+
// console.log(`${destination.name} is private`)
129+
newIds.push(id)
130+
}else{
131+
// console.log(`${destination.name}is public`)
132+
}
133+
}
134+
returnnewIds
135+
}
106136
constaddPrivateDestination=async()=>{
137+
letids=awaitcheckExistingStatus()
138+
ids.sort();
107139
constDEST_ID=awaitprompt({
108140
type:'input',
109141
name:'id',
110142
message:'Enter the destination ID'
111143
})
112144

113-
constprivateIds=[]
114-
for(let[key]ofObject.entries(privateDests)){
115-
privateIds.push(privateDests[key].id)
116-
}
117-
118-
if(privateIds.includes(DEST_ID.id)){
119-
console.log("This destination is already captured.")
120-
return
145+
if(DEST_ID.id='0'){
146+
for(constelementinids){
147+
letcurrentId=ids[element]
148+
awaitgetDestinationData(currentId)
149+
}
150+
console.log("Updating exsting Private Beta destinations.")
121151
}else{
122-
privateIds.push(DEST_ID.id)
123-
}
124-
privateIds.sort();
125-
for(constelementinprivateIds){
126-
letcurrentId=privateIds[element]
127-
getDestinationData(currentId)
152+
if(ids.includes(DEST_ID.id)){
153+
console.log("This destination is already captured.")
154+
return
155+
}else{
156+
ids.push(DEST_ID.id)
157+
fs.writeFileSync(path.resolve(__dirname,`../src/_data/catalog/destinations_private.yml`),'');
158+
159+
}
160+
ids.sort();
161+
162+
163+
for(constelementinids){
164+
letcurrentId=ids[element]
165+
awaitgetDestinationData(currentId)
166+
}
128167
}
129168

130169
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp