Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@commercelayer/js-auth

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercelayer/js-auth - npm Package Compare versions

Comparing version 4.3.0 to 5.0.0

lib/cjs/core.d.ts

7

lib/cjs/index.d.ts

@@ -1,7 +0,2 @@

import { type TReturn, type GrantType, type TOptions } from './types/index';
export declare function authentication<G extends GrantType>(grantType: G, { domain, slug, headers, ...options }: TOptions<G>): Promise<TReturn<G>>;
export default authentication;
export { core } from './core';
export { provisioning } from './provisioning';
export declare const core: {
authentication: typeof authentication;
};

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.core=exports.provisioning=exports.authentication=void 0;const tslib_1=require("tslib"),camelCaseToSnake_1=require("./utils/camelCaseToSnake"),snakeToCamelCase_1=require("./utils/snakeToCamelCase");function authentication(grantType,_a){var{domain="commercelayer.io",slug,headers}=_a,options=tslib_1.__rest(_a,["domain","slug","headers"]);return tslib_1.__awaiter(this,void 0,void 0,function*(){const attributes=Object.assign({grant_type:grantType},options),body=Object.keys(attributes).reduce((acc,key)=>{const camelKey=(0,camelCaseToSnake_1.camelCaseToSnake)(key);return acc[camelKey]=attributes[key],acc},{});return yield fetch(`https://${slug}.${domain}/oauth/token`,{method:"POST",headers:Object.assign({"Content-Type":"application/json",Accept:"application/json"},headers),body:JSON.stringify(body)}).then(response=>tslib_1.__awaiter(this,void 0,void 0,function*(){const json=yield response.json();return json.expires=new Date(Date.now()+json.expires_in*1e3),Object.keys(json).reduce((acc,key)=>{const camelKey=(0,snakeToCamelCase_1.snakeToCamelCase)(key);return acc[camelKey]=json[key],acc},{})}))})}exports.authentication=authentication,exports.default=authentication;var provisioning_1=require("./provisioning");Object.defineProperty(exports,"provisioning",{enumerable:!0,get:function(){return provisioning_1.provisioning}}),exports.core={authentication};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.provisioning=exports.core=void 0;var core_1=require("./core");Object.defineProperty(exports,"core",{enumerable:!0,get:function(){return core_1.core}});var provisioning_1=require("./provisioning");Object.defineProperty(exports,"provisioning",{enumerable:!0,get:function(){return provisioning_1.provisioning}});

@@ -1,7 +0,2 @@

import { type TReturn, type GrantType, type TOptions } from './types/index';
export declare function authentication<G extends GrantType>(grantType: G, { domain, slug, headers, ...options }: TOptions<G>): Promise<TReturn<G>>;
export default authentication;
export { core } from './core';
export { provisioning } from './provisioning';
export declare const core: {
authentication: typeof authentication;
};

@@ -1,1 +0,1 @@

import{camelCaseToSnake}from"./utils/camelCaseToSnake";import{snakeToCamelCase}from"./utils/snakeToCamelCase";export async function authentication(grantType,{domain="commercelayer.io",slug,headers,...options}){const attributes={grant_type:grantType,...options},body=Object.keys(attributes).reduce((acc,key)=>{const camelKey=camelCaseToSnake(key);return acc[camelKey]=attributes[key],acc},{});return await fetch(`https://${slug}.${domain}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...headers},body:JSON.stringify(body)}).then(async response=>{const json=await response.json();return json.expires=new Date(Date.now()+json.expires_in*1e3),Object.keys(json).reduce((acc,key)=>{const camelKey=snakeToCamelCase(key);return acc[camelKey]=json[key],acc},{})})}export default authentication;export{provisioning}from"./provisioning";export const core={authentication};
export{core}from"./core";export{provisioning}from"./provisioning";
{
"name": "@commercelayer/js-auth",
"version": "4.3.0",
"version": "5.0.0",
"description": "Commerce Layer Javascript Auth",

@@ -5,0 +5,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc