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.0.0 to 4.1.0

2

lib/cjs/index.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),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}=_a,options=tslib_1.__rest(_a,["domain","slug"]);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:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(body)}).then(response=>tslib_1.__awaiter(this,void 0,void 0,function*(){const json=yield response.json();return 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;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),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}=_a,options=tslib_1.__rest(_a,["domain","slug"]);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:{"Content-Type":"application/json",Accept:"application/json"},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;

@@ -38,6 +38,10 @@ import { type TPasswordReturn, type TPassword } from './password';

/**
* The expiration date of the access token.
* The access token expiration time in seconds.
*/
expiresIn: number;
/**
* The access token expiration date.
*/
expires: Date;
/**
* The access token scope (market, stock location).

@@ -44,0 +48,0 @@ */

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

import{camelCaseToSnake}from"./utils/camelCaseToSnake";import{snakeToCamelCase}from"./utils/snakeToCamelCase";export async function authentication(grantType,{domain="commercelayer.io",slug,...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"},body:JSON.stringify(body)}).then(async response=>{const json=await response.json();return Object.keys(json).reduce((acc,key)=>{const camelKey=snakeToCamelCase(key);return acc[camelKey]=json[key],acc},{})})}export default authentication;
import{camelCaseToSnake}from"./utils/camelCaseToSnake";import{snakeToCamelCase}from"./utils/snakeToCamelCase";export async function authentication(grantType,{domain="commercelayer.io",slug,...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"},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;

@@ -38,6 +38,10 @@ import { type TPasswordReturn, type TPassword } from './password';

/**
* The expiration date of the access token.
* The access token expiration time in seconds.
*/
expiresIn: number;
/**
* The access token expiration date.
*/
expires: Date;
/**
* The access token scope (market, stock location).

@@ -44,0 +48,0 @@ */

{
"name": "@commercelayer/js-auth",
"version": "4.0.0",
"version": "4.1.0",
"description": "Commerce Layer Javascript Auth",

@@ -48,2 +48,5 @@ "repository": {

},
"engines": {
"node": ">=18.0.0"
},
"scripts": {

@@ -50,0 +53,0 @@ "lint": "eslint src",

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