@knocklabs/client 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.20.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 01d07af: Fix TypeScript type mismatch in SetPreferencesProperties. All fields (workflows, categories, channel_types, channels) are now optional to match the nullable nature of PreferenceSet returned by getPreferences(). This allows users to pass preference data without type errors and properly supports partial updates.
|
|
8
|
+
|
|
3
9
|
## 0.20.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/cjs/api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var o=(t,e,s)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var r=(t,e,s)=>o(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("axios"),c=require("axios-retry"),l=require("phoenix"),n=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},h=n(u),a=n(c);class d{constructor(e){r(this,"host");r(this,"apiKey");r(this,"userToken");r(this,"branch");r(this,"axiosClient");r(this,"socket");this.host=e.host,this.apiKey=e.apiKey,this.userToken=e.userToken||null,this.branch=e.branch||null,this.axiosClient=h.default.create({baseURL:this.host,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"X-Knock-User-Token":this.userToken,"X-Knock-Client":this.getKnockClientHeader(),"X-Knock-Branch":this.branch}}),typeof window<"u"&&(this.socket=new l.Socket(`${this.host.replace("http","ws")}/ws/v1`,{params:{user_token:this.userToken,api_key:this.apiKey,branch_slug:this.branch}})),a.default(this.axiosClient,{retries:3,retryCondition:this.canRetryRequest,retryDelay:a.default.exponentialDelay})}async makeRequest(e){try{const s=await this.axiosClient(e);return{statusCode:s.status<300?"ok":"error",body:s.data,error:void 0,status:s.status}}catch(s){return console.error(s),{statusCode:"error",status:500,body:void 0,error:s}}}canRetryRequest(e){return a.default.isNetworkError(e)?!0:e.response?e.response.status>=500&&e.response.status<=599||e.response.status===429:!1}getKnockClientHeader(){return"Knock/ClientJS 0.20.
|
|
1
|
+
"use strict";var i=Object.defineProperty;var o=(t,e,s)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var r=(t,e,s)=>o(t,typeof e!="symbol"?e+"":e,s);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("axios"),c=require("axios-retry"),l=require("phoenix"),n=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},h=n(u),a=n(c);class d{constructor(e){r(this,"host");r(this,"apiKey");r(this,"userToken");r(this,"branch");r(this,"axiosClient");r(this,"socket");this.host=e.host,this.apiKey=e.apiKey,this.userToken=e.userToken||null,this.branch=e.branch||null,this.axiosClient=h.default.create({baseURL:this.host,headers:{Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`,"X-Knock-User-Token":this.userToken,"X-Knock-Client":this.getKnockClientHeader(),"X-Knock-Branch":this.branch}}),typeof window<"u"&&(this.socket=new l.Socket(`${this.host.replace("http","ws")}/ws/v1`,{params:{user_token:this.userToken,api_key:this.apiKey,branch_slug:this.branch}})),a.default(this.axiosClient,{retries:3,retryCondition:this.canRetryRequest,retryDelay:a.default.exponentialDelay})}async makeRequest(e){try{const s=await this.axiosClient(e);return{statusCode:s.status<300?"ok":"error",body:s.data,error:void 0,status:s.status}}catch(s){return console.error(s),{statusCode:"error",status:500,body:void 0,error:s}}}canRetryRequest(e){return a.default.isNetworkError(e)?!0:e.response?e.response.status>=500&&e.response.status<=599||e.response.status===429:!1}getKnockClientHeader(){return"Knock/ClientJS 0.20.1"}}exports.default=d;
|
|
2
2
|
//# sourceMappingURL=api.js.map
|
package/dist/esm/api.mjs
CHANGED
|
@@ -56,7 +56,7 @@ class k {
|
|
|
56
56
|
return i.isNetworkError(e) ? !0 : e.response ? e.response.status >= 500 && e.response.status <= 599 || e.response.status === 429 : !1;
|
|
57
57
|
}
|
|
58
58
|
getKnockClientHeader() {
|
|
59
|
-
return "Knock/ClientJS 0.20.
|
|
59
|
+
return "Knock/ClientJS 0.20.1";
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
export {
|
|
@@ -15,10 +15,10 @@ export type WorkflowPreferenceSetting = boolean | {
|
|
|
15
15
|
} | ConditionalPreferenceSettings;
|
|
16
16
|
export type WorkflowPreferences = Partial<Record<string, WorkflowPreferenceSetting>>;
|
|
17
17
|
export interface SetPreferencesProperties {
|
|
18
|
-
workflows
|
|
19
|
-
categories
|
|
20
|
-
channel_types
|
|
21
|
-
channels
|
|
18
|
+
workflows?: WorkflowPreferences;
|
|
19
|
+
categories?: WorkflowPreferences;
|
|
20
|
+
channel_types?: ChannelTypePreferences;
|
|
21
|
+
channels?: ChannelPreferences;
|
|
22
22
|
}
|
|
23
23
|
export interface PreferenceSet {
|
|
24
24
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/clients/preferences/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;KAClC,EAAE,IAAI,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,6BAA6B;CAC9D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,6BAA6B,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,y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UAAU,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACvC,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACtC,aAAa,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC7C,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -23,10 +23,10 @@ export type WorkflowPreferences = Partial<
|
|
|
23
23
|
>;
|
|
24
24
|
|
|
25
25
|
export interface SetPreferencesProperties {
|
|
26
|
-
workflows
|
|
27
|
-
categories
|
|
28
|
-
channel_types
|
|
29
|
-
channels
|
|
26
|
+
workflows?: WorkflowPreferences;
|
|
27
|
+
categories?: WorkflowPreferences;
|
|
28
|
+
channel_types?: ChannelTypePreferences;
|
|
29
|
+
channels?: ChannelPreferences;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export interface PreferenceSet {
|