How to use the zapier-platform-core.version function in zapier-platform-core

To help you get started, we’ve selected a few zapier-platform-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zapier / zapier-platform-cli / snippets / dehydration.js View on Github external
.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
github zapier / zapier-platform-cli / snippets / app-def.js View on Github external
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
github zapier / zapier-platform-cli / snippets / stash-file.js View on Github external
.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
      }
    }
github cloudblue / connect-fulfillment-zapier-app / index.js View on Github external
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,
github Dolibarr / dolibarr / dev / examples / zapier / index.js View on Github external
// 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: {
    },
github zapier / zapier-platform-example-app-github / index.js View on Github external
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: {
github leonaero / zapier-app / src / index.js View on Github external
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: {
github DefinitelyTyped / DefinitelyTyped / types / zapier-platform-core / zapier-platform-core-tests.ts View on Github external
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);
};
github mautic / mautic-zapier / index.js View on Github external
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,
  },

zapier-platform-core

The core SDK for CLI apps in the Zapier Developer Platform.

SEE LICENSE IN LICENSE
Latest version published 4 days ago

Package Health Score

87 / 100
Full package analysis

Similar packages