@tnf-dev/api 1.0.1-10 → 1.0.1-11
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/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.d.cts +2 -1
- package/dist/cjs/internal/index.cjs +1 -1
- package/dist/cjs/internal/utils/const.cjs +1 -1
- package/dist/cjs/internal/utils/const.d.cts +1 -1
- package/dist/cjs/internal/utils/index.cjs +1 -1
- package/dist/cjs/lib/index.cjs +1 -1
- package/dist/cjs/lib/index.d.cts +2 -1
- package/dist/cjs/lib/teknify.cjs +1 -1
- package/dist/cjs/lib/teknify.d.cts +15 -2
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal/index.js +1 -1
- package/dist/esm/internal/utils/const.d.ts +1 -1
- package/dist/esm/internal/utils/const.js +1 -1
- package/dist/esm/internal/utils/index.js +1 -1
- package/dist/esm/lib/index.d.ts +2 -1
- package/dist/esm/lib/index.js +1 -1
- package/dist/esm/lib/teknify.d.ts +15 -2
- package/dist/esm/lib/teknify.js +1 -1
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var m=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var I=r=>{throw TypeError(r)};var P=(r,e)=>{for(var t in e)m(r,t,{get:e[t],enumerable:!0})},C=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of R(e))!A.call(r,s)&&s!==t&&m(r,s,{get:()=>e[s],enumerable:!(a=E(e,s))||a.enumerable});return r};var L=r=>C(m({},"__esModule",{value:!0}),r);var b=(r,e,t)=>e.has(r)||I("Cannot "+t);var i=(r,e,t)=>(b(r,e,"read from private field"),t?t.call(r):e.get(r)),n=(r,e,t)=>e.has(r)?I("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),p=(r,e,t,a)=>(b(r,e,"write to private field"),a?a.call(r,t):e.set(r,t),t),d=(r,e,t)=>(b(r,e,"access private method"),t);var _={};P(_,{Teknify:()=>T});module.exports=L(_);var S=r=>new URLSearchParams(Object.keys(r).reduce((e,t)=>(r[t]!==void 0&&(e[t]=`${r[t]}`),e),{})).toString(),o,h,k,g,U,$=(U=class{constructor(r){n(this,h);n(this,o);p(this,o,r.baseUrl)}get baseUrl(){return i(this,o)}get(r,e){return d(this,h,g).call(this,`${i(this,o)}${r}`,e)}post(r,e,t){return d(this,h,g).call(this,`${i(this,o)}${r}`,{...t,method:"POST",body:e})}put(r,e,t){return d(this,h,g).call(this,`${i(this,o)}${r}`,{...t,method:"PUT",body:e})}patch(r,e,t={}){return d(this,h,g).call(this,`${i(this,o)}${r}`,{...t,method:"PATCH",body:e})}delete(r,e){return d(this,h,g).call(this,`${i(this,o)}${r}`,{...e,method:"DELETE"})}},o=new WeakMap,h=new WeakSet,k=async function(r,{body:e,params:t,...a}={}){let s=r;t&&(s=`${r}?${S(t||{})}`);let v={...a,...e?{body:JSON.stringify(e)}:{},headers:{"Content-Type":"application/json",...a.headers}};return[s,v]},g=async function(r,e){let[t,a]=await d(this,h,k).call(this,r,e),s=await fetch(t,a);if(!s.ok)throw{status:"error",error_message:await s.text()};return{data:await s.json(),status:"success"}},U);var x="https://teknify-server.teknix.services";var l,y,f,c,u,w,T=class{constructor(e){n(this,l);n(this,y);n(this,f);n(this,c);n(this,u);n(this,w,{});if(!e.channelId)throw new Error("channelId is required");if(!e.appId)throw new Error("appId is required");if(!e.apiKey)throw new Error("apiKey is required");p(this,f,e.apiKey),p(this,c,e.baseUrl||x),p(this,y,e.appId),p(this,l,e.channelId),p(this,u,new $({baseUrl:i(this,c)})),p(this,w,{"x-channel-id":i(this,l),"x-api-key":i(this,f)})}get baseUrl(){return i(this,c)}async trigger(e){return await i(this,u).post("/api/workflows/trigger",{appId:i(this,y),...e},{headers:{...i(this,w)}})}};l=new WeakMap,y=new WeakMap,f=new WeakMap,c=new WeakMap,u=new WeakMap,w=new WeakMap;0&&(module.exports={Teknify});
|
package/dist/cjs/index.d.cts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
export { Teknify, TeknifyOptions, TeknifyTriggerParams } from './lib/teknify.cjs';
|
1
|
+
export { Teknify, TeknifyOptions, TeknifyTriggerParams, TeknifyTriggerResponse } from './lib/teknify.cjs';
|
2
|
+
import '@tnf-dev/core';
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var s in e)o(t,s,{get:e[s],enumerable:!0})},f=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!x.call(t,r)&&r!==s&&o(t,r,{get:()=>e[r],enumerable:!(i=n(e,r))||i.enumerable});return t};var k=t=>f(o({},"__esModule",{value:!0}),t);var A={};c(A,{DEFAULT_BASE_URL:()=>v});module.exports=k(A);var v="https://teknify-server.teknix.services";0&&(module.exports={DEFAULT_BASE_URL});
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var o=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},v=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!o.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(n=c(e,s))||n.enumerable});return t};var x=t=>v(i({},"__esModule",{value:!0}),t);var E={};p(E,{DEFAULT_BASE_URL:()=>A});module.exports=x(E);var A="https://teknify-server.teknix.services";0&&(module.exports={DEFAULT_BASE_URL});
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var o=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var c=(t,e)=>{for(var s in e)o(t,s,{get:e[s],enumerable:!0})},f=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p(e))!x.call(t,r)&&r!==s&&o(t,r,{get:()=>e[r],enumerable:!(i=n(e,r))||i.enumerable});return t};var k=t=>f(o({},"__esModule",{value:!0}),t);var A={};c(A,{DEFAULT_BASE_URL:()=>v});module.exports=k(A);var v="https://teknify-server.teknix.services";0&&(module.exports={DEFAULT_BASE_URL});
|
package/dist/cjs/lib/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var m=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var I=r=>{throw TypeError(r)};var P=(r,e)=>{for(var t in e)m(r,t,{get:e[t],enumerable:!0})},C=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of R(e))!A.call(r,s)&&s!==t&&m(r,s,{get:()=>e[s],enumerable:!(a=E(e,s))||a.enumerable});return r};var L=r=>C(m({},"__esModule",{value:!0}),r);var b=(r,e,t)=>e.has(r)||I("Cannot "+t);var i=(r,e,t)=>(b(r,e,"read from private field"),t?t.call(r):e.get(r)),n=(r,e,t)=>e.has(r)?I("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),p=(r,e,t,a)=>(b(r,e,"write to private field"),a?a.call(r,t):e.set(r,t),t),d=(r,e,t)=>(b(r,e,"access private method"),t);var _={};P(_,{Teknify:()=>T});module.exports=L(_);var S=r=>new URLSearchParams(Object.keys(r).reduce((e,t)=>(r[t]!==void 0&&(e[t]=`${r[t]}`),e),{})).toString(),o,h,k,g,U,$=(U=class{constructor(r){n(this,h);n(this,o);p(this,o,r.baseUrl)}get baseUrl(){return i(this,o)}get(r,e){return d(this,h,g).call(this,`${i(this,o)}${r}`,e)}post(r,e,t){return d(this,h,g).call(this,`${i(this,o)}${r}`,{...t,method:"POST",body:e})}put(r,e,t){return d(this,h,g).call(this,`${i(this,o)}${r}`,{...t,method:"PUT",body:e})}patch(r,e,t={}){return d(this,h,g).call(this,`${i(this,o)}${r}`,{...t,method:"PATCH",body:e})}delete(r,e){return d(this,h,g).call(this,`${i(this,o)}${r}`,{...e,method:"DELETE"})}},o=new WeakMap,h=new WeakSet,k=async function(r,{body:e,params:t,...a}={}){let s=r;t&&(s=`${r}?${S(t||{})}`);let v={...a,...e?{body:JSON.stringify(e)}:{},headers:{"Content-Type":"application/json",...a.headers}};return[s,v]},g=async function(r,e){let[t,a]=await d(this,h,k).call(this,r,e),s=await fetch(t,a);if(!s.ok)throw{status:"error",error_message:await s.text()};return{data:await s.json(),status:"success"}},U);var x="https://teknify-server.teknix.services";var l,y,f,c,u,w,T=class{constructor(e){n(this,l);n(this,y);n(this,f);n(this,c);n(this,u);n(this,w,{});if(!e.channelId)throw new Error("channelId is required");if(!e.appId)throw new Error("appId is required");if(!e.apiKey)throw new Error("apiKey is required");p(this,f,e.apiKey),p(this,c,e.baseUrl||x),p(this,y,e.appId),p(this,l,e.channelId),p(this,u,new $({baseUrl:i(this,c)})),p(this,w,{"x-channel-id":i(this,l),"x-api-key":i(this,f)})}get baseUrl(){return i(this,c)}async trigger(e){return await i(this,u).post("/api/workflows/trigger",{appId:i(this,y),...e},{headers:{...i(this,w)}})}};l=new WeakMap,y=new WeakMap,f=new WeakMap,c=new WeakMap,u=new WeakMap,w=new WeakMap;0&&(module.exports={Teknify});
|
package/dist/cjs/lib/index.d.cts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
export { Teknify, TeknifyOptions, TeknifyTriggerParams } from './teknify.cjs';
|
1
|
+
export { Teknify, TeknifyOptions, TeknifyTriggerParams, TeknifyTriggerResponse } from './teknify.cjs';
|
2
|
+
import '@tnf-dev/core';
|
package/dist/cjs/lib/teknify.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var b=Object.defineProperty;var
|
1
|
+
"use strict";var b=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var I=r=>{throw TypeError(r)};var P=(r,e)=>{for(var t in e)b(r,t,{get:e[t],enumerable:!0})},C=(r,e,t,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of R(e))!A.call(r,s)&&s!==t&&b(r,s,{get:()=>e[s],enumerable:!(a=E(e,s))||a.enumerable});return r};var L=r=>C(b({},"__esModule",{value:!0}),r);var m=(r,e,t)=>e.has(r)||I("Cannot "+t);var i=(r,e,t)=>(m(r,e,"read from private field"),t?t.call(r):e.get(r)),n=(r,e,t)=>e.has(r)?I("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),p=(r,e,t,a)=>(m(r,e,"write to private field"),a?a.call(r,t):e.set(r,t),t),d=(r,e,t)=>(m(r,e,"access private method"),t);var _={};P(_,{Teknify:()=>T});module.exports=L(_);var S=r=>new URLSearchParams(Object.keys(r).reduce((e,t)=>(r[t]!==void 0&&(e[t]=`${r[t]}`),e),{})).toString(),h,o,k,g,U,$=(U=class{constructor(r){n(this,o);n(this,h);p(this,h,r.baseUrl)}get baseUrl(){return i(this,h)}get(r,e){return d(this,o,g).call(this,`${i(this,h)}${r}`,e)}post(r,e,t){return d(this,o,g).call(this,`${i(this,h)}${r}`,{...t,method:"POST",body:e})}put(r,e,t){return d(this,o,g).call(this,`${i(this,h)}${r}`,{...t,method:"PUT",body:e})}patch(r,e,t={}){return d(this,o,g).call(this,`${i(this,h)}${r}`,{...t,method:"PATCH",body:e})}delete(r,e){return d(this,o,g).call(this,`${i(this,h)}${r}`,{...e,method:"DELETE"})}},h=new WeakMap,o=new WeakSet,k=async function(r,{body:e,params:t,...a}={}){let s=r;t&&(s=`${r}?${S(t||{})}`);let v={...a,...e?{body:JSON.stringify(e)}:{},headers:{"Content-Type":"application/json",...a.headers}};return[s,v]},g=async function(r,e){let[t,a]=await d(this,o,k).call(this,r,e),s=await fetch(t,a);if(!s.ok)throw{status:"error",error_message:await s.text()};return{data:await s.json(),status:"success"}},U);var x="https://teknify-server.teknix.services";var l,y,u,c,f,w,T=class{constructor(e){n(this,l);n(this,y);n(this,u);n(this,c);n(this,f);n(this,w,{});if(!e.channelId)throw new Error("channelId is required");if(!e.appId)throw new Error("appId is required");if(!e.apiKey)throw new Error("apiKey is required");p(this,u,e.apiKey),p(this,c,e.baseUrl||x),p(this,y,e.appId),p(this,l,e.channelId),p(this,f,new $({baseUrl:i(this,c)})),p(this,w,{"x-channel-id":i(this,l),"x-api-key":i(this,u)})}get baseUrl(){return i(this,c)}async trigger(e){return await i(this,f).post("/api/workflows/trigger",{appId:i(this,y),...e},{headers:{...i(this,w)}})}};l=new WeakMap,y=new WeakMap,u=new WeakMap,c=new WeakMap,f=new WeakMap,w=new WeakMap;0&&(module.exports={Teknify});
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { BaseResponse } from '@tnf-dev/core';
|
2
|
+
|
1
3
|
interface TeknifyOptions {
|
2
4
|
channelId: string;
|
3
5
|
appId: string;
|
@@ -16,11 +18,22 @@ interface TeknifyTriggerParams {
|
|
16
18
|
provider?: Array<string>;
|
17
19
|
};
|
18
20
|
}
|
21
|
+
interface TeknifyTriggerResponse extends BaseResponse {
|
22
|
+
data: {
|
23
|
+
eventsData: Array<{
|
24
|
+
id: string;
|
25
|
+
identifier: string;
|
26
|
+
is_active: string;
|
27
|
+
name: string;
|
28
|
+
provider: string;
|
29
|
+
}>;
|
30
|
+
};
|
31
|
+
}
|
19
32
|
declare class Teknify {
|
20
33
|
#private;
|
21
34
|
constructor(options: TeknifyOptions);
|
22
35
|
get baseUrl(): string;
|
23
|
-
trigger(params: TeknifyTriggerParams): Promise<
|
36
|
+
trigger(params: TeknifyTriggerParams): Promise<TeknifyTriggerResponse>;
|
24
37
|
}
|
25
38
|
|
26
|
-
export { Teknify, type TeknifyOptions, type TeknifyTriggerParams };
|
39
|
+
export { Teknify, type TeknifyOptions, type TeknifyTriggerParams, type TeknifyTriggerResponse };
|
package/dist/esm/index.d.ts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
export { Teknify, TeknifyOptions, TeknifyTriggerParams } from './lib/teknify.js';
|
1
|
+
export { Teknify, TeknifyOptions, TeknifyTriggerParams, TeknifyTriggerResponse } from './lib/teknify.js';
|
2
|
+
import '@tnf-dev/core';
|
package/dist/esm/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var p=
|
1
|
+
var p=r=>new URLSearchParams(Object.keys(r).reduce((e,t)=>(r[t]!==void 0&&(e[t]=`${r[t]}`),e),{})).toString(),a=class{#e;constructor(r){this.#e=r.baseUrl}get baseUrl(){return this.#e}async#t(r,{body:e,params:t,...s}={}){let i=r;t&&(i=`${r}?${p(t||{})}`);let h={...s,...e?{body:JSON.stringify(e)}:{},headers:{"Content-Type":"application/json",...s.headers}};return[i,h]}async#r(r,e){let[t,s]=await this.#t(r,e),i=await fetch(t,s);if(!i.ok)throw{status:"error",error_message:await i.text()};return{data:await i.json(),status:"success"}}get(r,e){return this.#r(`${this.#e}${r}`,e)}post(r,e,t){return this.#r(`${this.#e}${r}`,{...t,method:"POST",body:e})}put(r,e,t){return this.#r(`${this.#e}${r}`,{...t,method:"PUT",body:e})}patch(r,e,t={}){return this.#r(`${this.#e}${r}`,{...t,method:"PATCH",body:e})}delete(r,e){return this.#r(`${this.#e}${r}`,{...e,method:"DELETE"})}};var n="https://teknify-server.teknix.services";var o=class{#e;#t;#r;#i;#s;#a={};constructor(e){if(!e.channelId)throw new Error("channelId is required");if(!e.appId)throw new Error("appId is required");if(!e.apiKey)throw new Error("apiKey is required");this.#r=e.apiKey,this.#i=e.baseUrl||n,this.#t=e.appId,this.#e=e.channelId,this.#s=new a({baseUrl:this.#i}),this.#a={"x-channel-id":this.#e,"x-api-key":this.#r}}get baseUrl(){return this.#i}async trigger(e){return await this.#s.post("/api/workflows/trigger",{appId:this.#t,...e},{headers:{...this.#a}})}};export{o as Teknify};
|
@@ -1 +1 @@
|
|
1
|
-
var
|
1
|
+
var e="https://teknify-server.teknix.services";export{e as DEFAULT_BASE_URL};
|
@@ -1 +1 @@
|
|
1
|
-
var
|
1
|
+
var e="https://teknify-server.teknix.services";export{e as DEFAULT_BASE_URL};
|
@@ -1 +1 @@
|
|
1
|
-
var
|
1
|
+
var e="https://teknify-server.teknix.services";export{e as DEFAULT_BASE_URL};
|
package/dist/esm/lib/index.d.ts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
export { Teknify, TeknifyOptions, TeknifyTriggerParams } from './teknify.js';
|
1
|
+
export { Teknify, TeknifyOptions, TeknifyTriggerParams, TeknifyTriggerResponse } from './teknify.js';
|
2
|
+
import '@tnf-dev/core';
|
package/dist/esm/lib/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var p=
|
1
|
+
var p=r=>new URLSearchParams(Object.keys(r).reduce((e,t)=>(r[t]!==void 0&&(e[t]=`${r[t]}`),e),{})).toString(),a=class{#e;constructor(r){this.#e=r.baseUrl}get baseUrl(){return this.#e}async#t(r,{body:e,params:t,...s}={}){let i=r;t&&(i=`${r}?${p(t||{})}`);let h={...s,...e?{body:JSON.stringify(e)}:{},headers:{"Content-Type":"application/json",...s.headers}};return[i,h]}async#r(r,e){let[t,s]=await this.#t(r,e),i=await fetch(t,s);if(!i.ok)throw{status:"error",error_message:await i.text()};return{data:await i.json(),status:"success"}}get(r,e){return this.#r(`${this.#e}${r}`,e)}post(r,e,t){return this.#r(`${this.#e}${r}`,{...t,method:"POST",body:e})}put(r,e,t){return this.#r(`${this.#e}${r}`,{...t,method:"PUT",body:e})}patch(r,e,t={}){return this.#r(`${this.#e}${r}`,{...t,method:"PATCH",body:e})}delete(r,e){return this.#r(`${this.#e}${r}`,{...e,method:"DELETE"})}};var n="https://teknify-server.teknix.services";var o=class{#e;#t;#r;#i;#s;#a={};constructor(e){if(!e.channelId)throw new Error("channelId is required");if(!e.appId)throw new Error("appId is required");if(!e.apiKey)throw new Error("apiKey is required");this.#r=e.apiKey,this.#i=e.baseUrl||n,this.#t=e.appId,this.#e=e.channelId,this.#s=new a({baseUrl:this.#i}),this.#a={"x-channel-id":this.#e,"x-api-key":this.#r}}get baseUrl(){return this.#i}async trigger(e){return await this.#s.post("/api/workflows/trigger",{appId:this.#t,...e},{headers:{...this.#a}})}};export{o as Teknify};
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import { BaseResponse } from '@tnf-dev/core';
|
2
|
+
|
1
3
|
interface TeknifyOptions {
|
2
4
|
channelId: string;
|
3
5
|
appId: string;
|
@@ -16,11 +18,22 @@ interface TeknifyTriggerParams {
|
|
16
18
|
provider?: Array<string>;
|
17
19
|
};
|
18
20
|
}
|
21
|
+
interface TeknifyTriggerResponse extends BaseResponse {
|
22
|
+
data: {
|
23
|
+
eventsData: Array<{
|
24
|
+
id: string;
|
25
|
+
identifier: string;
|
26
|
+
is_active: string;
|
27
|
+
name: string;
|
28
|
+
provider: string;
|
29
|
+
}>;
|
30
|
+
};
|
31
|
+
}
|
19
32
|
declare class Teknify {
|
20
33
|
#private;
|
21
34
|
constructor(options: TeknifyOptions);
|
22
35
|
get baseUrl(): string;
|
23
|
-
trigger(params: TeknifyTriggerParams): Promise<
|
36
|
+
trigger(params: TeknifyTriggerParams): Promise<TeknifyTriggerResponse>;
|
24
37
|
}
|
25
38
|
|
26
|
-
export { Teknify, type TeknifyOptions, type TeknifyTriggerParams };
|
39
|
+
export { Teknify, type TeknifyOptions, type TeknifyTriggerParams, type TeknifyTriggerResponse };
|
package/dist/esm/lib/teknify.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var p=
|
1
|
+
var p=r=>new URLSearchParams(Object.keys(r).reduce((e,t)=>(r[t]!==void 0&&(e[t]=`${r[t]}`),e),{})).toString(),a=class{#e;constructor(r){this.#e=r.baseUrl}get baseUrl(){return this.#e}async#t(r,{body:e,params:t,...s}={}){let i=r;t&&(i=`${r}?${p(t||{})}`);let o={...s,...e?{body:JSON.stringify(e)}:{},headers:{"Content-Type":"application/json",...s.headers}};return[i,o]}async#r(r,e){let[t,s]=await this.#t(r,e),i=await fetch(t,s);if(!i.ok)throw{status:"error",error_message:await i.text()};return{data:await i.json(),status:"success"}}get(r,e){return this.#r(`${this.#e}${r}`,e)}post(r,e,t){return this.#r(`${this.#e}${r}`,{...t,method:"POST",body:e})}put(r,e,t){return this.#r(`${this.#e}${r}`,{...t,method:"PUT",body:e})}patch(r,e,t={}){return this.#r(`${this.#e}${r}`,{...t,method:"PATCH",body:e})}delete(r,e){return this.#r(`${this.#e}${r}`,{...e,method:"DELETE"})}};var n="https://teknify-server.teknix.services";var h=class{#e;#t;#r;#i;#s;#a={};constructor(e){if(!e.channelId)throw new Error("channelId is required");if(!e.appId)throw new Error("appId is required");if(!e.apiKey)throw new Error("apiKey is required");this.#r=e.apiKey,this.#i=e.baseUrl||n,this.#t=e.appId,this.#e=e.channelId,this.#s=new a({baseUrl:this.#i}),this.#a={"x-channel-id":this.#e,"x-api-key":this.#r}}get baseUrl(){return this.#i}async trigger(e){return await this.#s.post("/api/workflows/trigger",{appId:this.#t,...e},{headers:{...this.#a}})}};export{h as Teknify};
|
package/package.json
CHANGED