npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gingersnap-foundry-client

v6.0.82

Published

Client for connecting to foundry api gateway and communicating

Readme

gingersnap-foundry-client

NPM

Description

This repository authenticates with foundry, stores user data in cookies and configures an API Gateway client for usage on applications.

This package also manages refreshing the credentials for the SigV4Client every 50 minutes, so you should never have to manage that yourself.

The Sigv4 client signs all requests using the AWS signature methods.

The API gateway code is exported the the API GW export feature. This repository builds on top of the API GW exported code, to implement the custom logic for authenticating

Table of Contents

Getting Started

To install:

./install.sh

Publishing

Pull credentials

yarn pull:npm:creds

Bump package version versioning

# Run deployment

./deploy.sh

Versioning

  • Semantic Versioning semver
  • {major}.{minor}.{hotfix}

Structure

| Folders | Description | | -------------------- | -------------------------------------- | | apigw-generated-code | Generated code provided by AWS Gateway | | tests | Contains tests for the foundry-client |

| Files | Description | | -------------------------- | ----------------------------------------------- | | cognitoAuth.js | Foundry auth functions | | iotClientFactory.js | Code for creating iot client | | logger.js | Console logger | | GingersnapFoundryClient.js | Global package configuration | | apigClient.js | Generated code to connect to API Gateway client | | index.js | Package exports |

External Reference Links

Scripts

  • npm run clean - Remove dist/ directory
  • npm test - Run tests with linting and coverage results.
  • npm test:only - Run tests without linting or coverage.
  • npm test:watch - You can even re-run tests on file changes!
  • npm run lint - Run ESlint with airbnb-config
  • npm run cover - Get coverage report for your code.
  • npm run build - Babel will transpile ES6 => ES5 and minify the code.
  • npm run prepublish - Hook for npm. Do all the checks before publishing your module.

Config Options

| Name | Type | Description | Required | | ---------------------------- | ------ | ----------------------------------- | -------- | | username | String | Foundry Username | No | | password | String | Foundry Password | No | | accountId | String | Account ID | No | | apiGatewayEndpoint | String | API Gateway Endpoint URL | Yes | | cognitoDeveloperProviderName | String | AWS Cognito Developer Provider Name | Yes | | cognitoIdentityPoolId | String | AWS Cognito Identity Pool ID | Yes | | expireCookieDays | Number | Expire auth cookies in days | No |

Examples


const { GingersnapFoundryClient, authenticate, authorizeWithCookies } = require('./src')

/** this configuration can be retrieved from the foundry stack that is deployed */
const foundryConfig = {
  apiGatewayEndpoint: 'https://<your-foundry-apigateway-endpoint>.com/<foundry-env>/foundry', 
  cognitoDeveloperProviderName: 'com.<developer-name>.foundry',
  cognitoIdentityPoolId: '<aws-region>:<pool-id>',
}

// set the global configuration
GingersnapFoundryClient.setConfig(foundryConfig)

// authorize with credentials
authenticate(
  '<account-id>',
  '<username>',
  '<password>'
).then(async (user) => {
  console.log(user)
  // GingersnapFoundryClient.apigwClient is now populated 
  GingersnapFoundryClient.apigwClient
      .foundryUserUserIdGet({
        user_id: '7d3b50d0-2ad6-11ec-9205-c1884ebfd6e6',
      })
})
.catch((e) => {
  // failed to login
})
  

// authorize with cookies after the initial login above ^
// the package stores, retreives, and has a method to clear them
 authorizeWithCookies()
  .then(() => {
    GingersnapFoundryClient.apigwClient
        .foundryUserUserIdGet({
          user_id: '7d3b50d0-2ad6-11ec-9205-c1884ebfd6e6',
        })
  })
  .catch(e => {
    GingersnapFoundryClient.logout()    
  })


// logout clears all cookies and global AWS config
GingersnapFoundryClient.logout()
// Methods on client
- foundryAccountPut
- foundryAccountPost
- foundryAccountOptions
- foundryAccountIsEmptyGet
- foundryAccountIsEmptyOptions
- foundryAccountAclGet
- foundryAccountAclPut
- foundryAccountAclPost
- foundryAccountAclOptions
- foundryAccountAclSearchGet
- foundryAccountAclSearchOptions
- foundryAccountAclAclIdDelete
- foundryAccountAclAclIdOptions
- foundryAccountPicturePost
- foundryAccountPictureOptions
- foundryAccountAccountIdGet
- foundryAccountAccountIdDelete
- foundryAccountAccountIdOptions
- foundryAccountAccountIdMetadataGet
- foundryAccountAccountIdMetadataPut
- foundryAccountAccountIdMetadataPost
- foundryAccountAccountIdMetadataDelete
- foundryAccountAccountIdMetadataOptions
- foundryAccountAccountIdPreferencesGet
- foundryAccountAccountIdPreferencesPut
- foundryAccountAccountIdPreferencesOptions
- foundryAccountAccountIdRootPost
- foundryAccountAccountIdRootOptions
- foundryAccountsGet
- foundryAccountsOptions
- foundryAccountsTreeGet
- foundryAccountsTreeOptions
- foundryActionPost
- foundryActionOptions
- foundryActionHttpPost
- foundryActionHttpOptions
- foundryArScenePut
- foundryArScenePost
- foundryArSceneOptions
- foundryArSceneSceneIdGet
- foundryArSceneSceneIdDelete
- foundryArSceneSceneIdOptions
- foundryArScenesGet
- foundryArScenesOptions
- foundryAuthenticatePost
- foundryAuthenticateOptions
- foundryCertificatesGenerateGet
- foundryCertificatesGenerateOptions
- foundryCertificatesProvisionPost
- foundryCertificatesProvisionOptions
- foundryCertificatesRevokeDelete
- foundryCertificatesRevokeOptions
- foundryCftemplatePost
- foundryCftemplateOndeletePost
- foundryCheckRequestGet
- foundryCheckRequestOptions
- foundryCognitoDataGet
- foundryCognitoDataOptions
- foundryCustomPagePut
- foundryCustomPagePost
- foundryCustomPageOptions
- foundryCustomPageIdGet
- foundryCustomPageIdDelete
- foundryCustomPageIdOptions
- foundryCustomPagesOptions
- foundryCustomPagesAccountIdGet
- foundryCustomPagesAccountIdOptions
- foundryDevicePut
- foundryDevicePost
- foundryDeviceOptions
- foundryDeviceAttributesPut
- foundryDeviceAttributesOptions
- foundryDeviceTypePut
- foundryDeviceTypePost
- foundryDeviceTypeOptions
- foundryDeviceTypeDownloadPost
- foundryDeviceTypeDownloadOptions
- foundryDeviceTypeTypeIdGet
- foundryDeviceTypeTypeIdDelete
- foundryDeviceTypeTypeIdOptions
- foundryDeviceTypesGet
- foundryDeviceTypesOptions
- foundryDeviceDeviceDataPost
- foundryDeviceDeviceDataOptions
- foundryDeviceHistoryGet
- foundryDeviceHistoryOptions
- foundryDeviceHistoryExportPost
- foundryDeviceHistoryExportOptions
- foundryDeviceHistoryMqttGet
- foundryDeviceHistoryMqttOptions
- foundryDeviceHistoryMqttExportPost
- foundryDeviceHistoryMqttExportOptions
- foundryDeviceJunctionPost
- foundryDeviceJunctionDelete
- foundryDeviceJunctionOptions
- foundryDeviceDeviceIdGet
- foundryDeviceDeviceIdDelete
- foundryDeviceDeviceIdOptions
- foundryDeviceDeviceIdChildrenGet
- foundryDeviceDeviceIdChildrenOptions
- foundryDeviceDeviceIdJunctionsDelete
- foundryDeviceDeviceIdJunctionsOptions
- foundryDeviceDeviceIdParentsGet
- foundryDeviceDeviceIdParentsOptions
- foundryDevicesGet
- foundryDevicesPost
- foundryDevicesOptions
- foundryDevicesAdvancedSearchPost
- foundryDevicesAdvancedSearchOptions
- foundryDevicesAdvancedSearchExportPost
- foundryDevicesAdvancedSearchExportOptions
- foundryDevicesAdvancedSearchNewPost
- foundryDevicesAdvancedSearchNewOptions
- foundryDevicesAdvancedSearchPagePost
- foundryDevicesAdvancedSearchPageOptions
- foundryDevicesByTypeGet
- foundryDevicesByTypeOptions
- foundryDevicesHierarchyGet
- foundryDevicesHierarchyOptions
- foundryDevicesScheduledPost
- foundryDevicesScheduledOptions
- foundryDevicesSearchServiceGet
- foundryDevicesSearchServicePost
- foundryDevicesSearchServiceOptions
- foundryForgotPasswordGet
- foundryForgotPasswordPut
- foundryForgotPasswordPost
- foundryForgotPasswordOptions
- foundryFormToMqttPost
- foundryFormToMqttOptions
- foundryGroupAttributePut
- foundryGroupAttributePost
- foundryGroupAttributeOptions
- foundryGroupAttributeGroupIdGet
- foundryGroupAttributeGroupIdDelete
- foundryGroupAttributeGroupIdOptions
- foundryGroupAttributesGet
- foundryGroupAttributesOptions
- foundryIamCredentialsGet
- foundryIamCredentialsPut
- foundryIamCredentialsPost
- foundryIamCredentialsOptions
- foundryIamCredentialsCredentialsIdDelete
- foundryIamCredentialsCredentialsIdOptions
- foundryIotCertificateGet
- foundryIotCertificatePut
- foundryIotCertificatePost
- foundryIotCertificateDelete
- foundryIotCertificateOptions
- foundryIotRulesGet
- foundryIotRulesPut
- foundryIotRulesPost
- foundryIotRulesDelete
- foundryIotRulesOptions
- foundryIotRulesCustomSmsPut
- foundryIotRulesCustomSmsPost
- foundryIotRulesCustomSmsOptions
- foundryIotRulesDetailsGet
- foundryIotRulesDetailsPut
- foundryIotRulesDetailsOptions
- foundryListViewGet
- foundryListViewPut
- foundryListViewPost
- foundryListViewOptions
- foundryListViewIdDelete
- foundryListViewIdOptions
- foundryLoginGet
- foundryLoginOptions
- foundryLoginInternalPost
- foundryLoginInternalOptions
- foundryLoginSalesforcePost
- foundryLoginSalesforceOptions
- foundryMetricsPost
- foundryMetricsOptions
- foundryMigrationPost
- foundryMqttConfigGet
- foundryMqttConfigPost
- foundryMqttConfigOptions
- foundryMqttPublishGet
- foundryMqttPublishPost
- foundryMqttPublishOptions
- foundryMqttSubscribeGet
- foundryMqttSubscribePost
- foundryMqttSubscribeOptions
- foundryMqttSubscribeSubscribeIdDelete
- foundryMqttSubscribeSubscribeIdOptions
- foundryOAuthGet
- foundryOAuthPut
- foundryOAuthPost
- foundryOAuthDelete
- foundryOAuthOptions
- foundryObjectSearchPost
- foundryObjectSearchOptions
- foundryObjectSearchExportPost
- foundryObjectSearchExportOptions
- foundryPoliciesGet
- foundryPoliciesOptions
- foundryPolicyGet
- foundryPolicyPut
- foundryPolicyPost
- foundryPolicyDelete
- foundryPolicyOptions
- foundryPortalPagePut
- foundryPortalPagePost
- foundryPortalPageOptions
- foundryPortalPagePageIdGet
- foundryPortalPagePageIdDelete
- foundryPortalPagePageIdOptions
- foundryPortalPagesGet
- foundryPortalPagesOptions
- foundryPublishMqttPost
- foundryPublishMqttOptions
- foundryReferencePost
- foundryReferenceDelete
- foundryReferenceOptions
- foundryReferenceDeviceIdToGet
- foundryReferenceDeviceIdToOptions
- foundryS3Get
- foundryS3Post
- foundryS3Delete
- foundryS3Options
- foundryS3BucketGet
- foundryS3BucketPost
- foundryS3BucketOptions
- foundrySavedSearchGet
- foundrySavedSearchPut
- foundrySavedSearchPost
- foundrySavedSearchOptions
- foundrySavedSearchIdGet
- foundrySavedSearchIdDelete
- foundrySavedSearchIdOptions
- foundrySendEmailPost
- foundrySendEmailOptions
- foundrySfdcOptions
- foundrySfdcIdentityUrlGet
- foundrySfdcIdentityUrlOptions
- foundrySfdcTokensGet
- foundrySfdcTokensOptions
- foundrySfdcUserDetailsPost
- foundrySfdcUserDetailsOptions
- foundrySignupPost
- foundrySignupOptions
- foundrySyncPost
- foundrySyncStatusPost
- foundryTemplateGet
- foundryTemplatePut
- foundryTemplatePost
- foundryTemplateDelete
- foundryTemplateOptions
- foundryTemplateListGet
- foundryTemplateListOptions
- foundryTokenGet
- foundryTokenOptions
- foundryUserPut
- foundryUserPost
- foundryUserOptions
- foundryUserAcceptInvitePost
- foundryUserAcceptInviteOptions
- foundryUserCheckGet
- foundryUserCheckOptions
- foundryUserInvitePost
- foundryUserInviteOptions
- foundryUserPicturePost
- foundryUserPictureOptions
- foundryUserResendActivationPost
- foundryUserResendActivationOptions
- foundryUserSecretPut
- foundryUserSecretPost
- foundryUserSecretDelete
- foundryUserSecretOptions
- foundryUserSecretsGet
- foundryUserSecretsOptions
- foundryUserVerifyPut
- foundryUserVerifyPost
- foundryUserVerifyOptions
- foundryUserUserIdGet
- foundryUserUserIdDelete
- foundryUserUserIdOptions
- foundryUserUserIdActivatePut
- foundryUserUserIdActivateOptions
- foundryUserUserIdPolicyPost
- foundryUserUserIdPolicyDelete
- foundryUserUserIdPolicyOptions
- foundryUsersGet
- foundryUsersOptions