@commercelayer/js-auth
Advanced tools
Comparing version 4.3.0 to 5.0.0
@@ -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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
19723
42
282
3