Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(res => z.JSON.parse(res.content))
.then(results => {
return results.map(result => {
// so maybe /movies.json is thin content but
// /movies/:id.json has more details we want...
result.moreData = z.dehydrate(getExtraDataFunction, {
id: result.id
});
return result;
});
});
};
const App = {
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
// don't forget to register hydrators here!
// it can be imported from any module
hydrators: {
getExtraData: getExtraDataFunction
},
triggers: {
new_movie: {
noun: 'Movie',
display: {
label: 'New Movie',
description: 'Triggers when a new Movie is added.'
},
operation: {
perform: movieList
const App = {
// both version strings are required
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
// see "Authentication" section below
authentication: {},
// see "Dehydration" section below
hydrators: {},
// see "Making HTTP Requests" section below
requestTemplate: {},
beforeRequest: [],
afterResponse: [],
// See "Resources" section below
resources: {},
// See "Triggers/Searches/Creates" section below
.then(results => {
return results.map(result => {
// lazily convert a secret_download_url to a stashed url
// zapier won't do this until we need it
result.file = z.dehydrateFile(stashPDFfunction, {
downloadUrl: result.secret_download_url
});
delete result.secret_download_url;
return result;
});
});
};
const App = {
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
hydrators: {
stashPDF: stashPDFfunction
},
triggers: {
new_pdf: {
noun: 'PDF',
display: {
label: 'New PDF',
description: 'Triggers when a new PDF is added.'
},
operation: {
perform: pdfList
}
}
const FulfillmentParameters = require('./lib/triggers/fulfillment_parameters');
const Hubs = require('./lib/triggers/hubs');
// creates
const RejectRequest = require('./lib/creates/reject_request');
const CreatePurchaseRequest = require('./lib/creates/create_purchase_request');
const ApproveRequest = require('./lib/creates/approve_request');
const InquireRequestLIS = require('./lib/creates/inquire_request_lis');
const InquireRequest = require('./lib/creates/inquire_request');
const NoteRequest = require('./lib/creates/note_request');
const CreateMessage = require('./lib/creates/create_message');
const FillFulfillmentParametersLIS = require('./lib/creates/fill_fulfillment_parameters_lis');
const FillFulfillmentParameters = require('./lib/creates/fill_fulfillment_parameters');
// searches
const SearchRequest = require('./lib/searches/search_requests');
const platformVersion = zapier.version;
const { version } = require('./package.json');
const App = {
version,
platformVersion,
authentication: authentication.authentication,
beforeRequest: [middleware.addTaskIdToHeader],
afterResponse: [],
resources: {},
triggers: {
[NewRequests.key]: NewRequests,
[NewUpdatedRequests.key]: NewUpdatedRequests,
[GetMessagesRequest.key]: GetMessagesRequest,
[LatestPublishedProduct.key]: LatestPublishedProduct,
[ActivationTemplates.key]: ActivationTemplates,
[FulfillmentParameters.key]: FulfillmentParameters,
// If we get a response and it is a 401, we can raise a special error telling Zapier to retry this after another exchange.
const sessionRefreshIf401 = (response, z, bundle) => {
if (bundle.authData.sessionKey) {
if (response.status === 401) {
throw new z.errors.RefreshAuthError('Session apikey needs refreshing.');
}
}
return response;
};
// We can roll up all our behaviors in an App.
const App = {
// This is just shorthand to reference the installed dependencies you have. Zapier will
// need to know these before we can upload
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication: authentication,
// beforeRequest & afterResponse are optional hooks into the provided HTTP client
beforeRequest: [
includeSessionKeyHeader
],
afterResponse: [
sessionRefreshIf401
],
// If you want to define optional resources to simplify creation of triggers, searches, creates - do that here!
resources: {
},
const issueCreate = require('./creates/issue');
const issueTrigger = require('./triggers/issue');
const authentication = require('./authentication');
const handleHTTPError = (response, z) => {
if (response.status >= 400) {
throw new Error(`Unexpected status code ${response.status}`);
}
return response;
};
const App = {
// This is just shorthand to reference the installed dependencies you have. Zapier will
// need to know these before we can upload
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication: authentication,
// beforeRequest & afterResponse are optional hooks into the provided HTTP client
beforeRequest: [
],
afterResponse: [
handleHTTPError
],
// If you want to define optional resources to simplify creation of triggers, searches, creates - do that here!
resources: {
},
// If you want your trigger to show up, you better include it here!
triggers: {
const authentication = require("./authentification");
const aircraftSearch = require("./searches/aircraft");
const emptyLegsSearch = require("./searches/emptyLegs");
const scheduleSearch = require("./searches/schedule");
const App = {
// This is just shorthand to reference the installed dependencies you have. Zapier will
// need to know these before we can upload
version: require("../package.json").version,
platformVersion: require("zapier-platform-core").version,
authentication: authentication.definition,
// beforeRequest & afterResponse are optional hooks into the provided HTTP client
beforeRequest: [authentication.attachAccessToken],
afterResponse: [],
// If you want to define optional resources to simplify creation of triggers, searches, creates - do that here!
resources: {},
// If you want your trigger to show up, you better include it here!
triggers: {},
// If you want your searches to show up, you better include it here!
searches: {
scope: "read,write"
},
test: async z => {
const response = await z.request(`${BASE_URL}/oauth2/test`);
if (response.status === 401) {
throw new Error("The access token you supplied is not valid");
}
return true;
}
};
zapier.version;
const testCreateAppTester = async () => {
const zapierApp = {};
const appTester = await zapier.createAppTester(zapierApp);
};
const ContactUpdatedTrigger = require('./triggers/contactUpdated');
const ContactCreatedTrigger = require('./triggers/contactCreated');
const PointsChangedTrigger = require('./triggers/pointsChanged');
const FormSubmittedTrigger = require('./triggers/formSubmitted');
const EmailsTrigger = require('./triggers/emails');
const FormsTrigger = require('./triggers/forms');
const PagesTrigger = require('./triggers/pages');
const TagsTrigger = require('./triggers/tags');
const UsersTrigger = require('./triggers/users');
const EmailOpenedTrigger = require('./triggers/emailOpened');
const PageHitTrigger = require('./triggers/pageHit');
const contactCreate = require('./creates/contact');
const App = {
version: require('./package.json').version,
platformVersion: require('zapier-platform-core').version,
authentication: require('./authentication'),
beforeRequest: require('./middlewares/beforeRequest'),
afterResponse: require('./middlewares/afterResponse'),
triggers: {
[ContactUpdatedTrigger.key]: ContactUpdatedTrigger,
[ContactCreatedTrigger.key]: ContactCreatedTrigger,
[PointsChangedTrigger.key]: PointsChangedTrigger,
[FormSubmittedTrigger.key]: FormSubmittedTrigger,
[EmailsTrigger.key]: EmailsTrigger,
[FormsTrigger.key]: FormsTrigger,
[PagesTrigger.key]: PagesTrigger,
[TagsTrigger.key]: TagsTrigger,
[UsersTrigger.key]: UsersTrigger,
[EmailOpenedTrigger.key]: EmailOpenedTrigger,
[PageHitTrigger.key]: PageHitTrigger,
},