style: auto format whole project
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import sendMessageToChannel from "./send-message-to-channel";
|
||||
import sendMessageToChannel from './send-message-to-channel';
|
||||
|
||||
export default [
|
||||
sendMessageToChannel
|
||||
];
|
||||
export default [sendMessageToChannel];
|
||||
|
@@ -17,12 +17,12 @@ export default async function createAuthData($: IGlobalVariable) {
|
||||
scope: scopes.join(' '),
|
||||
});
|
||||
|
||||
const url = `${$.app.apiBaseUrl}/oauth2/authorize?${searchParams.toString()}`;
|
||||
const url = `${
|
||||
$.app.apiBaseUrl
|
||||
}/oauth2/authorize?${searchParams.toString()}`;
|
||||
|
||||
await $.auth.set({ url });
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Error occured while verifying credentials: ${error}`
|
||||
);
|
||||
throw new Error(`Error occured while verifying credentials: ${error}`);
|
||||
}
|
||||
}
|
||||
|
@@ -12,9 +12,10 @@ export default {
|
||||
readOnly: true,
|
||||
value: '{WEB_APP_URL}/app/discord/connections/add',
|
||||
placeholder: null,
|
||||
description: 'When asked to input an OAuth callback or redirect URL in Discord OAuth, enter the URL above.',
|
||||
description:
|
||||
'When asked to input an OAuth callback or redirect URL in Discord OAuth, enter the URL above.',
|
||||
docUrl: 'https://automatisch.io/docs/discord#oauth-redirect-url',
|
||||
clickToCopy: true
|
||||
clickToCopy: true,
|
||||
},
|
||||
{
|
||||
key: 'consumerKey',
|
||||
@@ -26,7 +27,7 @@ export default {
|
||||
placeholder: null,
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/discord#consumer-key',
|
||||
clickToCopy: false
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'consumerSecret',
|
||||
@@ -38,7 +39,7 @@ export default {
|
||||
placeholder: null,
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/discord#consumer-secret',
|
||||
clickToCopy: false
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'botToken',
|
||||
@@ -50,8 +51,8 @@ export default {
|
||||
placeholder: null,
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/discord#bot-token',
|
||||
clickToCopy: false
|
||||
}
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
@@ -60,7 +61,7 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: '{key}'
|
||||
value: '{key}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
@@ -68,19 +69,19 @@ export default {
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}'
|
||||
value: '{fields.consumerKey}',
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}'
|
||||
value: '{fields.consumerSecret}',
|
||||
},
|
||||
{
|
||||
name: 'botToken',
|
||||
value: '{fields.botToken}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
value: '{fields.botToken}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -88,9 +89,9 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
}
|
||||
]
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'openWithPopup' as const,
|
||||
@@ -98,9 +99,9 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}'
|
||||
}
|
||||
]
|
||||
value: '{createAuthData.url}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -108,7 +109,7 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
@@ -116,11 +117,11 @@ export default {
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.code}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
value: '{openAuthPopup.code}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -128,10 +129,10 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
}
|
||||
]
|
||||
}
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
|
@@ -28,10 +28,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
expires_in: expiresIn,
|
||||
scope: scope,
|
||||
token_type: tokenType,
|
||||
guild: {
|
||||
id: guildId,
|
||||
name: guildName,
|
||||
}
|
||||
guild: { id: guildId, name: guildName },
|
||||
} = verifiedCredentials;
|
||||
|
||||
await $.auth.set({
|
||||
@@ -40,7 +37,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
expiresIn,
|
||||
scope,
|
||||
tokenType,
|
||||
})
|
||||
});
|
||||
|
||||
const user = await getCurrentUser($);
|
||||
|
||||
|
@@ -1,5 +1,3 @@
|
||||
import listChannels from "./list-channels";
|
||||
import listChannels from './list-channels';
|
||||
|
||||
export default [
|
||||
listChannels,
|
||||
];
|
||||
export default [listChannels];
|
||||
|
@@ -13,7 +13,9 @@ export default {
|
||||
error: null,
|
||||
};
|
||||
|
||||
const response = await $.http.get(`/guilds/${$.auth.data.guildId}/channels`);
|
||||
const response = await $.http.get(
|
||||
`/guilds/${$.auth.data.guildId}/channels`
|
||||
);
|
||||
|
||||
channels.data = response.data
|
||||
.filter((channel: IJSONObject) => {
|
||||
|
@@ -12,9 +12,10 @@ export default {
|
||||
readOnly: true,
|
||||
value: '{WEB_APP_URL}/app/flickr/connections/add',
|
||||
placeholder: null,
|
||||
description: 'When asked to input an OAuth callback or redirect URL in Flickr OAuth, enter the URL above.',
|
||||
description:
|
||||
'When asked to input an OAuth callback or redirect URL in Flickr OAuth, enter the URL above.',
|
||||
docUrl: 'https://automatisch.io/docs/flickr#oauth-redirect-url',
|
||||
clickToCopy: true
|
||||
clickToCopy: true,
|
||||
},
|
||||
{
|
||||
key: 'consumerKey',
|
||||
@@ -26,7 +27,7 @@ export default {
|
||||
placeholder: null,
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/flickr#consumer-key',
|
||||
clickToCopy: false
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'consumerSecret',
|
||||
@@ -38,8 +39,8 @@ export default {
|
||||
placeholder: null,
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/flickr#consumer-secret',
|
||||
clickToCopy: false
|
||||
}
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
@@ -48,7 +49,7 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: '{key}'
|
||||
value: '{key}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
@@ -56,15 +57,15 @@ export default {
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}'
|
||||
value: '{fields.consumerKey}',
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
value: '{fields.consumerSecret}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -72,9 +73,9 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
}
|
||||
]
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'openWithPopup' as const,
|
||||
@@ -82,9 +83,9 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}'
|
||||
}
|
||||
]
|
||||
value: '{createAuthData.url}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -92,7 +93,7 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
@@ -100,11 +101,11 @@ export default {
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.oauth_verifier}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
value: '{openAuthPopup.oauth_verifier}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -112,10 +113,10 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
}
|
||||
]
|
||||
}
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
|
@@ -6,7 +6,7 @@ const isStillVerified = async ($: IGlobalVariable) => {
|
||||
method: 'flickr.test.login',
|
||||
format: 'json',
|
||||
nojsoncallback: 1,
|
||||
}
|
||||
};
|
||||
const response = await $.http.get('/rest', { params });
|
||||
return !!response.data.user.id;
|
||||
} catch (error) {
|
||||
|
@@ -10,7 +10,7 @@ type TPhotoset = {
|
||||
title: {
|
||||
_content: string;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'List albums',
|
||||
@@ -25,7 +25,7 @@ export default {
|
||||
format: 'json',
|
||||
nojsoncallback: 1,
|
||||
};
|
||||
let response = await $.http.get('/rest', { params, });
|
||||
let response = await $.http.get('/rest', { params });
|
||||
|
||||
const aggregatedResponse: TResponse = {
|
||||
data: [...response.data.photosets.photoset],
|
||||
@@ -35,19 +35,21 @@ export default {
|
||||
response = await $.http.get('/rest', {
|
||||
params: {
|
||||
...params,
|
||||
page: response.data.photosets.page
|
||||
}
|
||||
page: response.data.photosets.page,
|
||||
},
|
||||
});
|
||||
|
||||
aggregatedResponse.data.push(...response.data.photosets.photoset);
|
||||
}
|
||||
|
||||
aggregatedResponse.data = aggregatedResponse.data.map((photoset: TPhotoset) => {
|
||||
return {
|
||||
value: photoset.id,
|
||||
name: photoset.title._content,
|
||||
} as IJSONObject;
|
||||
});
|
||||
aggregatedResponse.data = aggregatedResponse.data.map(
|
||||
(photoset: TPhotoset) => {
|
||||
return {
|
||||
value: photoset.id,
|
||||
name: photoset.title._content,
|
||||
} as IJSONObject;
|
||||
}
|
||||
);
|
||||
|
||||
return aggregatedResponse;
|
||||
},
|
||||
|
@@ -3,9 +3,4 @@ import newFavoritePhotos from './new-favorite-photos';
|
||||
import newPhotos from './new-photos';
|
||||
import newPhotosInAlbums from './new-photos-in-album';
|
||||
|
||||
export default [
|
||||
newAlbums,
|
||||
newFavoritePhotos,
|
||||
newPhotos,
|
||||
newPhotosInAlbums,
|
||||
];
|
||||
export default [newAlbums, newFavoritePhotos, newPhotos, newPhotosInAlbums];
|
||||
|
@@ -13,7 +13,9 @@ export default async function createAuthData($: IGlobalVariable) {
|
||||
scope: scopes.join(','),
|
||||
});
|
||||
|
||||
const url = `${$.app.baseUrl}/login/oauth/authorize?${searchParams.toString()}`;
|
||||
const url = `${
|
||||
$.app.baseUrl
|
||||
}/login/oauth/authorize?${searchParams.toString()}`;
|
||||
|
||||
await $.auth.set({
|
||||
url,
|
||||
|
@@ -12,9 +12,10 @@ export default {
|
||||
readOnly: true,
|
||||
value: '{WEB_APP_URL}/app/github/connections/add',
|
||||
placeholder: null,
|
||||
description: 'When asked to input an OAuth callback or redirect URL in Github OAuth, enter the URL above.',
|
||||
description:
|
||||
'When asked to input an OAuth callback or redirect URL in Github OAuth, enter the URL above.',
|
||||
docUrl: 'https://automatisch.io/docs/github#oauth-redirect-url',
|
||||
clickToCopy: true
|
||||
clickToCopy: true,
|
||||
},
|
||||
{
|
||||
key: 'consumerKey',
|
||||
@@ -26,7 +27,7 @@ export default {
|
||||
placeholder: null,
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/github#client-id',
|
||||
clickToCopy: false
|
||||
clickToCopy: false,
|
||||
},
|
||||
{
|
||||
key: 'consumerSecret',
|
||||
@@ -38,8 +39,8 @@ export default {
|
||||
placeholder: null,
|
||||
description: null,
|
||||
docUrl: 'https://automatisch.io/docs/github#client-secret',
|
||||
clickToCopy: false
|
||||
}
|
||||
clickToCopy: false,
|
||||
},
|
||||
],
|
||||
authenticationSteps: [
|
||||
{
|
||||
@@ -48,7 +49,7 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'key',
|
||||
value: '{key}'
|
||||
value: '{key}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
@@ -56,15 +57,15 @@ export default {
|
||||
properties: [
|
||||
{
|
||||
name: 'consumerKey',
|
||||
value: '{fields.consumerKey}'
|
||||
value: '{fields.consumerKey}',
|
||||
},
|
||||
{
|
||||
name: 'consumerSecret',
|
||||
value: '{fields.consumerSecret}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
value: '{fields.consumerSecret}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -72,9 +73,9 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
}
|
||||
]
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'openWithPopup' as const,
|
||||
@@ -82,9 +83,9 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'url',
|
||||
value: '{createAuthData.url}'
|
||||
}
|
||||
]
|
||||
value: '{createAuthData.url}',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -92,7 +93,7 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
{
|
||||
name: 'formattedData',
|
||||
@@ -100,11 +101,11 @@ export default {
|
||||
properties: [
|
||||
{
|
||||
name: 'oauthVerifier',
|
||||
value: '{openAuthPopup.code}'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
value: '{openAuthPopup.code}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'mutation' as const,
|
||||
@@ -112,10 +113,10 @@ export default {
|
||||
arguments: [
|
||||
{
|
||||
name: 'id',
|
||||
value: '{createConnection.id}'
|
||||
}
|
||||
]
|
||||
}
|
||||
value: '{createConnection.id}',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
createAuthData,
|
||||
|
@@ -12,9 +12,10 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/json'
|
||||
}
|
||||
});
|
||||
Accept: 'application/json',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const data = response.data;
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
import { TBeforeRequest } from "@automatisch/types";
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if (requestConfig.headers && $.auth.data?.accessToken) {
|
||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`
|
||||
requestConfig.headers.Authorization = `Bearer ${$.auth.data.accessToken}`;
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
}
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
||||
|
@@ -1,15 +1,17 @@
|
||||
type TRepoOwnerAndRepo = {
|
||||
repoOwner?: string;
|
||||
repo?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export default function getRepoOwnerAndRepo(repoFullName: string): TRepoOwnerAndRepo {
|
||||
export default function getRepoOwnerAndRepo(
|
||||
repoFullName: string
|
||||
): TRepoOwnerAndRepo {
|
||||
if (!repoFullName) return {};
|
||||
|
||||
const [repoOwner, repo] = repoFullName.split('/');
|
||||
|
||||
return {
|
||||
repoOwner,
|
||||
repo
|
||||
repo,
|
||||
};
|
||||
}
|
||||
|
@@ -1,7 +1,4 @@
|
||||
import listLabels from './list-labels';
|
||||
import listRepos from './list-repos';
|
||||
|
||||
export default [
|
||||
listLabels,
|
||||
listRepos,
|
||||
];
|
||||
export default [listLabels, listRepos];
|
||||
|
@@ -7,10 +7,9 @@ export default {
|
||||
key: 'listLabels',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const {
|
||||
repoOwner,
|
||||
repo,
|
||||
} = getRepoOwnerAndRepo($.step.parameters.repo as string);
|
||||
const { repoOwner, repo } = getRepoOwnerAndRepo(
|
||||
$.step.parameters.repo as string
|
||||
);
|
||||
|
||||
if (!repo) return { data: [] };
|
||||
|
||||
|
@@ -3,9 +3,4 @@ import newPullRequests from './new-pull-requests';
|
||||
import newStargazers from './new-stargazers';
|
||||
import newWatchers from './new-watchers';
|
||||
|
||||
export default [
|
||||
newIssues,
|
||||
newPullRequests,
|
||||
newStargazers,
|
||||
newWatchers,
|
||||
];
|
||||
export default [newIssues, newPullRequests, newStargazers, newWatchers];
|
||||
|
@@ -10,15 +10,13 @@ export default async function createAuthData($: IGlobalVariable) {
|
||||
const searchParams = qs.stringify({
|
||||
client_id: $.auth.data.consumerKey as string,
|
||||
redirect_uri: redirectUri,
|
||||
response_type: 'code'
|
||||
})
|
||||
response_type: 'code',
|
||||
});
|
||||
|
||||
await $.auth.set({
|
||||
url: `${$.auth.data.oauth2Url}/authorize?${searchParams}`,
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Error occured while verifying credentials: ${error}`
|
||||
);
|
||||
throw new Error(`Error occured while verifying credentials: ${error}`);
|
||||
}
|
||||
}
|
||||
|
@@ -34,8 +34,8 @@ export default {
|
||||
{
|
||||
label: 'sandbox',
|
||||
value: 'https://test.salesforce.com/services/oauth2',
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'consumerKey',
|
||||
@@ -76,7 +76,7 @@ export default {
|
||||
properties: [
|
||||
{
|
||||
name: 'oauth2Url',
|
||||
value: '{fields.oauth2Url}'
|
||||
value: '{fields.oauth2Url}',
|
||||
},
|
||||
{
|
||||
name: 'consumerKey',
|
||||
|
@@ -13,10 +13,10 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
grant_type: 'authorization_code',
|
||||
client_id: $.auth.data.consumerKey as string,
|
||||
client_secret: $.auth.data.consumerSecret as string,
|
||||
redirect_uri: redirectUri
|
||||
redirect_uri: redirectUri,
|
||||
});
|
||||
const { data } = await $.http.post(
|
||||
`${$.auth.data.oauth2Url}/token?${searchParams}`,
|
||||
`${$.auth.data.oauth2Url}/token?${searchParams}`
|
||||
);
|
||||
|
||||
await $.auth.set({
|
||||
|
@@ -1,7 +1,4 @@
|
||||
import listObjects from './list-objects';
|
||||
import listFields from './list-fields';
|
||||
|
||||
export default [
|
||||
listObjects,
|
||||
listFields,
|
||||
];
|
||||
export default [listObjects, listFields];
|
||||
|
@@ -2,19 +2,21 @@ import { IGlobalVariable } from '@automatisch/types';
|
||||
|
||||
type TResponse = {
|
||||
sobjects: TObject[];
|
||||
}
|
||||
};
|
||||
|
||||
type TObject = {
|
||||
name: string;
|
||||
label: string;
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
name: 'List objects',
|
||||
key: 'listObjects',
|
||||
|
||||
async run($: IGlobalVariable) {
|
||||
const response = await $.http.get<TResponse>('/services/data/v56.0/sobjects');
|
||||
const response = await $.http.get<TResponse>(
|
||||
'/services/data/v56.0/sobjects'
|
||||
);
|
||||
|
||||
const objects = response.data.sobjects.map((object) => {
|
||||
return {
|
||||
|
@@ -1,5 +1,3 @@
|
||||
import updatedFieldInRecords from "./updated-field-in-records";
|
||||
import updatedFieldInRecords from './updated-field-in-records';
|
||||
|
||||
export default [
|
||||
updatedFieldInRecords
|
||||
];
|
||||
export default [updatedFieldInRecords];
|
||||
|
@@ -23,7 +23,7 @@ const updatedFieldInRecord = async ($: IGlobalVariable): Promise<void> => {
|
||||
const options = {
|
||||
params: {
|
||||
q: getQuery(object, limit, offset),
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
response = await $.http.get('/services/data/v56.0/query', options);
|
||||
@@ -34,7 +34,7 @@ const updatedFieldInRecord = async ($: IGlobalVariable): Promise<void> => {
|
||||
raw: record,
|
||||
meta: {
|
||||
internalId: `${record.Id}-${record[field]}`,
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,8 @@ const cronTimes = {
|
||||
everyHourExcludingWeekends: '0 * * * 1-5',
|
||||
everyDayAt: (hour: number) => `0 ${hour} * * *`,
|
||||
everyDayExcludingWeekendsAt: (hour: number) => `0 ${hour} * * 1-5`,
|
||||
everyWeekOnAndAt: (weekday: number, hour: number) => `0 ${hour} * * ${weekday}`,
|
||||
everyWeekOnAndAt: (weekday: number, hour: number) =>
|
||||
`0 ${hour} * * ${weekday}`,
|
||||
everyMonthOnAndAt: (day: number, hour: number) => `0 ${hour} ${day} * *`,
|
||||
};
|
||||
|
||||
|
@@ -4,7 +4,9 @@ import cronParser from 'cron-parser';
|
||||
export default function getNextCronDateTime(cronString: string) {
|
||||
const cronDate = cronParser.parseExpression(cronString);
|
||||
const matchingNextCronDateTime = cronDate.next();
|
||||
const matchingNextDateTime = DateTime.fromJSDate(matchingNextCronDateTime.toDate());
|
||||
const matchingNextDateTime = DateTime.fromJSDate(
|
||||
matchingNextCronDateTime.toDate()
|
||||
);
|
||||
|
||||
return matchingNextDateTime;
|
||||
};
|
||||
}
|
||||
|
@@ -3,9 +3,4 @@ import everyDay from './every-day';
|
||||
import everyWeek from './every-week';
|
||||
import everyMonth from './every-month';
|
||||
|
||||
export default [
|
||||
everyHour,
|
||||
everyDay,
|
||||
everyWeek,
|
||||
everyMonth,
|
||||
];
|
||||
export default [everyHour, everyDay, everyWeek, everyMonth];
|
||||
|
@@ -1,7 +1,4 @@
|
||||
import findMessage from './find-message';
|
||||
import sendMessageToChannel from './send-a-message-to-channel';
|
||||
|
||||
export default [
|
||||
findMessage,
|
||||
sendMessageToChannel,
|
||||
];
|
||||
export default [findMessage, sendMessageToChannel];
|
||||
|
@@ -38,7 +38,8 @@ export default defineAction({
|
||||
type: 'dropdown' as const,
|
||||
required: false,
|
||||
value: false,
|
||||
description: 'If you choose no, this message will appear to come from you. Direct messages are always sent by bots.',
|
||||
description:
|
||||
'If you choose no, this message will appear to come from you. Direct messages are always sent by bots.',
|
||||
variables: false,
|
||||
options: [
|
||||
{
|
||||
@@ -48,8 +49,8 @@ export default defineAction({
|
||||
{
|
||||
label: 'No',
|
||||
value: false,
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Bot name',
|
||||
@@ -57,7 +58,8 @@ export default defineAction({
|
||||
type: 'string' as const,
|
||||
required: true,
|
||||
value: 'Automatisch',
|
||||
description: 'Specify the bot name which appears as a bold username above the message inside Slack. Defaults to Automatisch.',
|
||||
description:
|
||||
'Specify the bot name which appears as a bold username above the message inside Slack. Defaults to Automatisch.',
|
||||
variables: true,
|
||||
},
|
||||
{
|
||||
@@ -65,7 +67,8 @@ export default defineAction({
|
||||
key: 'botIcon',
|
||||
type: 'string' as const,
|
||||
required: false,
|
||||
description: 'Either an image url or an emoji available to your team (surrounded by :). For example, https://example.com/icon_256.png or :robot_face:',
|
||||
description:
|
||||
'Either an image url or an emoji available to your team (surrounded by :). For example, https://example.com/icon_256.png or :robot_face:',
|
||||
variables: true,
|
||||
},
|
||||
],
|
||||
|
@@ -7,7 +7,7 @@ type TData = {
|
||||
username?: string;
|
||||
icon_url?: string;
|
||||
icon_emoji?: string;
|
||||
}
|
||||
};
|
||||
|
||||
const postMessage = async ($: IGlobalVariable) => {
|
||||
const { parameters } = $.step;
|
||||
@@ -37,11 +37,9 @@ const postMessage = async ($: IGlobalVariable) => {
|
||||
sendAsBot,
|
||||
};
|
||||
|
||||
const response = await $.http.post(
|
||||
'/chat.postMessage',
|
||||
data,
|
||||
{ additionalProperties: customConfig },
|
||||
);
|
||||
const response = await $.http.post('/chat.postMessage', data, {
|
||||
additionalProperties: customConfig,
|
||||
});
|
||||
|
||||
if (response.data.ok === false) {
|
||||
throw new Error(JSON.stringify(response.data));
|
||||
|
@@ -59,4 +59,4 @@ export default async function createAuthData($: IGlobalVariable) {
|
||||
await $.auth.set({
|
||||
url,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@@ -22,14 +22,9 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
|
||||
const {
|
||||
bot_user_id: botId,
|
||||
authed_user: {
|
||||
id: userId,
|
||||
access_token: userAccessToken,
|
||||
},
|
||||
authed_user: { id: userId, access_token: userAccessToken },
|
||||
access_token: botAccessToken,
|
||||
team: {
|
||||
name: teamName,
|
||||
}
|
||||
team: { name: teamName },
|
||||
} = response.data;
|
||||
|
||||
await $.auth.set({
|
||||
@@ -44,7 +39,7 @@ const verifyCredentials = async ($: IGlobalVariable) => {
|
||||
const currentUser = await getCurrentUser($);
|
||||
|
||||
await $.auth.set({
|
||||
screenName: `${currentUser.real_name} @ ${teamName}`
|
||||
screenName: `${currentUser.real_name} @ ${teamName}`,
|
||||
});
|
||||
};
|
||||
|
||||
|
@@ -3,9 +3,9 @@ import { TBeforeRequest } from '@automatisch/types';
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
const authData = $.auth.data;
|
||||
if (
|
||||
requestConfig.headers
|
||||
&& authData?.userAccessToken
|
||||
&& authData?.botAccessToken
|
||||
requestConfig.headers &&
|
||||
authData?.userAccessToken &&
|
||||
authData?.botAccessToken
|
||||
) {
|
||||
if (requestConfig.additionalProperties?.sendAsBot) {
|
||||
requestConfig.headers.Authorization = `Bearer ${authData.botAccessToken}`;
|
||||
@@ -14,7 +14,8 @@ const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
requestConfig.headers['Content-Type'] = requestConfig.headers['Content-Type'] || 'application/json; charset=utf-8';
|
||||
requestConfig.headers['Content-Type'] =
|
||||
requestConfig.headers['Content-Type'] || 'application/json; charset=utf-8';
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
@@ -3,7 +3,7 @@ import { IGlobalVariable, IJSONObject } from '@automatisch/types';
|
||||
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
|
||||
const params = {
|
||||
user: $.auth.data.userId as string,
|
||||
}
|
||||
};
|
||||
const response = await $.http.get('/users.info', { params });
|
||||
const currentUser = response.data.user;
|
||||
|
||||
|
@@ -3,9 +3,4 @@ import newFollowerOfMe from './new-follower-of-me';
|
||||
import searchTweets from './search-tweets';
|
||||
import userTweets from './user-tweets';
|
||||
|
||||
export default [
|
||||
myTweets,
|
||||
newFollowerOfMe,
|
||||
searchTweets,
|
||||
userTweets,
|
||||
];
|
||||
export default [myTweets, newFollowerOfMe, searchTweets, userTweets];
|
||||
|
Reference in New Issue
Block a user