@knocklabs/client
Advanced tools
Comparing version 0.10.13 to 0.10.14
# Changelog | ||
## 0.10.14 | ||
### Patch Changes | ||
- 7510909: fix: ensure axios is always imported correctly | ||
## 0.10.13 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";var o=Object.defineProperty;var a=(s,e,t)=>e in s?o(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>a(s,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("axios"),i=require("axios-retry"),u=require("phoenix");class c{constructor(e){r(this,"host");r(this,"apiKey");r(this,"userToken");r(this,"axiosClient");r(this,"socket");this.host=e.host,this.apiKey=e.apiKey,this.userToken=e.userToken||null,this.axiosClient=n.create({baseURL:this.host,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"X-Knock-User-Token":this.userToken}}),typeof window<"u"&&(this.socket=new u.Socket(`${this.host.replace("http","ws")}/ws/v1`,{params:{user_token:this.userToken,api_key:this.apiKey}})),i(this.axiosClient,{retries:3,retryCondition:this.canRetryRequest,retryDelay:i.exponentialDelay})}async makeRequest(e){try{const t=await this.axiosClient(e);return{statusCode:t.status<300?"ok":"error",body:t.data,error:void 0,status:t.status}}catch(t){return console.error(t),{statusCode:"error",status:500,body:void 0,error:t}}}canRetryRequest(e){return i.isNetworkError(e)?!0:e.response?e.response.status>=500&&e.response.status<=599||e.response.status===429:!1}}exports.default=c; | ||
"use strict";var a=Object.defineProperty;var n=(s,e,t)=>e in s?a(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var r=(s,e,t)=>n(s,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("axios"),o=require("axios-retry"),u=require("phoenix");class c{constructor(e){r(this,"host");r(this,"apiKey");r(this,"userToken");r(this,"axiosClient");r(this,"socket");this.host=e.host,this.apiKey=e.apiKey,this.userToken=e.userToken||null;const t=i.default?i.default:i;this.axiosClient=t.create({baseURL:this.host,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"X-Knock-User-Token":this.userToken}}),typeof window<"u"&&(this.socket=new u.Socket(`${this.host.replace("http","ws")}/ws/v1`,{params:{user_token:this.userToken,api_key:this.apiKey}})),o(this.axiosClient,{retries:3,retryCondition:this.canRetryRequest,retryDelay:o.exponentialDelay})}async makeRequest(e){try{const t=await this.axiosClient(e);return{statusCode:t.status<300?"ok":"error",body:t.data,error:void 0,status:t.status}}catch(t){return console.error(t),{statusCode:"error",status:500,body:void 0,error:t}}}canRetryRequest(e){return o.isNetworkError(e)?!0:e.response?e.response.status>=500&&e.response.status<=599||e.response.status===429:!1}}exports.default=c; | ||
//# sourceMappingURL=api.js.map |
import { ChannelType } from '@knocklabs/types'; | ||
export type ChannelTypePreferences = { | ||
[K in ChannelType]?: boolean; | ||
[_K in ChannelType]?: boolean; | ||
}; | ||
@@ -6,0 +6,0 @@ export type WorkflowPreferenceSetting = boolean | { |
{ | ||
"name": "@knocklabs/client", | ||
"version": "0.10.13", | ||
"version": "0.10.14", | ||
"description": "The clientside library for interacting with Knock", | ||
@@ -50,7 +50,7 @@ "homepage": "https://github.com/knocklabs/javascript/tree/main/packages/client", | ||
"devDependencies": { | ||
"@babel/cli": "^7.25.6", | ||
"@babel/core": "^7.20.0", | ||
"@babel/cli": "^7.25.7", | ||
"@babel/core": "^7.25.7", | ||
"@babel/plugin-proposal-class-properties": "^7.16.7", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.16.7", | ||
"@babel/plugin-transform-runtime": "^7.16.7", | ||
"@babel/plugin-transform-runtime": "^7.25.4", | ||
"@babel/preset-env": "^7.16.7", | ||
@@ -60,3 +60,3 @@ "@babel/preset-typescript": "^7.16.7", | ||
"@typescript-eslint/eslint-plugin": "^6.20.0", | ||
"@typescript-eslint/parser": "^6.20.0", | ||
"@typescript-eslint/parser": "^8.8.1", | ||
"cross-env": "^7.0.3", | ||
@@ -68,4 +68,4 @@ "crypto": "^1.0.1", | ||
"rimraf": "^6.0.1", | ||
"rollup": "^4.21.0", | ||
"typescript": "^5.5.4", | ||
"rollup": "^4.22.5", | ||
"typescript": "^5.6.2", | ||
"vite": "^5.0.0", | ||
@@ -79,3 +79,3 @@ "vitest": "^2.0.5" | ||
"axios": "^1.7.4", | ||
"axios-retry": "^3.1.9", | ||
"axios-retry": "^4.5.0", | ||
"eventemitter2": "^6.4.5", | ||
@@ -82,0 +82,0 @@ "jwt-decode": "^4.0.0", |
@@ -33,4 +33,11 @@ import axios, { AxiosError, AxiosInstance, AxiosRequestConfig } from "axios"; | ||
// Create a retryable axios client | ||
this.axiosClient = axios.create({ | ||
// Create a retryable axios client, but account for issues where the axios export is not | ||
// the default in certain bundlers (Webpack). | ||
// | ||
// NOTE: This is a temporary fix that exists because of this issue: | ||
// https://github.com/axios/axios/issues/6591 | ||
const axiosInstance = // @ts-expect-error Fixing the issue described above | ||
(axios.default ? axios.default : axios) as AxiosStatic; | ||
this.axiosClient = axiosInstance.create({ | ||
baseURL: this.host, | ||
@@ -37,0 +44,0 @@ headers: { |
import { ChannelType } from "@knocklabs/types"; | ||
export type ChannelTypePreferences = { | ||
[K in ChannelType]?: boolean; | ||
[_K in ChannelType]?: boolean; | ||
}; | ||
@@ -6,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
344686
3628
+ Addedaxios-retry@4.5.0(transitive)
- Removedaxios-retry@3.9.1(transitive)
Updatedaxios-retry@^4.5.0