@tnf-dev/core 1.0.6-5 → 1.0.6-7

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.
Files changed (59) hide show
  1. package/dist/cjs/index.d.cts +74 -5
  2. package/dist/esm/index.d.ts +74 -5
  3. package/package.json +1 -1
  4. package/dist/cjs/client/http.cjs +0 -1
  5. package/dist/cjs/client/http.d.cts +0 -21
  6. package/dist/cjs/client/index.cjs +0 -1
  7. package/dist/cjs/client/index.d.cts +0 -2
  8. package/dist/cjs/dto/base/index.cjs +0 -1
  9. package/dist/cjs/dto/base/index.d.cts +0 -1
  10. package/dist/cjs/dto/base/record.interface.cjs +0 -1
  11. package/dist/cjs/dto/base/record.interface.d.cts +0 -6
  12. package/dist/cjs/dto/index.cjs +0 -1
  13. package/dist/cjs/dto/index.d.cts +0 -4
  14. package/dist/cjs/dto/notifications/index.cjs +0 -1
  15. package/dist/cjs/dto/notifications/index.d.cts +0 -2
  16. package/dist/cjs/dto/notifications/notification.interface.cjs +0 -1
  17. package/dist/cjs/dto/notifications/notification.interface.d.cts +0 -25
  18. package/dist/cjs/dto/request/index.cjs +0 -1
  19. package/dist/cjs/dto/request/index.d.cts +0 -1
  20. package/dist/cjs/dto/request/request.interface.cjs +0 -1
  21. package/dist/cjs/dto/request/request.interface.d.cts +0 -8
  22. package/dist/cjs/dto/response/index.cjs +0 -1
  23. package/dist/cjs/dto/response/index.d.cts +0 -1
  24. package/dist/cjs/dto/response/response.interface.cjs +0 -1
  25. package/dist/cjs/dto/response/response.interface.d.cts +0 -22
  26. package/dist/cjs/internal/index.cjs +0 -1
  27. package/dist/cjs/internal/index.d.cts +0 -1
  28. package/dist/cjs/internal/utils/index.cjs +0 -1
  29. package/dist/cjs/internal/utils/index.d.cts +0 -1
  30. package/dist/cjs/internal/utils/request.cjs +0 -1
  31. package/dist/cjs/internal/utils/request.d.cts +0 -3
  32. package/dist/esm/client/http.d.ts +0 -21
  33. package/dist/esm/client/http.js +0 -1
  34. package/dist/esm/client/index.d.ts +0 -2
  35. package/dist/esm/client/index.js +0 -1
  36. package/dist/esm/dto/base/index.d.ts +0 -1
  37. package/dist/esm/dto/base/index.js +0 -0
  38. package/dist/esm/dto/base/record.interface.d.ts +0 -6
  39. package/dist/esm/dto/base/record.interface.js +0 -0
  40. package/dist/esm/dto/index.d.ts +0 -4
  41. package/dist/esm/dto/index.js +0 -0
  42. package/dist/esm/dto/notifications/index.d.ts +0 -2
  43. package/dist/esm/dto/notifications/index.js +0 -0
  44. package/dist/esm/dto/notifications/notification.interface.d.ts +0 -25
  45. package/dist/esm/dto/notifications/notification.interface.js +0 -0
  46. package/dist/esm/dto/request/index.d.ts +0 -1
  47. package/dist/esm/dto/request/index.js +0 -0
  48. package/dist/esm/dto/request/request.interface.d.ts +0 -8
  49. package/dist/esm/dto/request/request.interface.js +0 -0
  50. package/dist/esm/dto/response/index.d.ts +0 -1
  51. package/dist/esm/dto/response/index.js +0 -0
  52. package/dist/esm/dto/response/response.interface.d.ts +0 -22
  53. package/dist/esm/dto/response/response.interface.js +0 -0
  54. package/dist/esm/internal/index.d.ts +0 -1
  55. package/dist/esm/internal/index.js +0 -1
  56. package/dist/esm/internal/utils/index.d.ts +0 -1
  57. package/dist/esm/internal/utils/index.js +0 -1
  58. package/dist/esm/internal/utils/request.d.ts +0 -3
  59. package/dist/esm/internal/utils/request.js +0 -1
@@ -1,5 +1,74 @@
1
- export { HttpClient, HttpClientOptions, RequestOptions } from './client/http.cjs';
2
- export { Notification, NotificationAction, NotificationData, NotificationPayload } from './dto/notifications/notification.interface.cjs';
3
- export { PaginationRequest } from './dto/request/request.interface.cjs';
4
- export { BaseResponse, ErrorResponse, PaginatedResponse, SingleResponse } from './dto/response/response.interface.cjs';
5
- import './dto/base/record.interface.cjs';
1
+ interface BaseRecord {
2
+ _id: string;
3
+ _creationTime: string;
4
+ }
5
+
6
+ interface NotificationAction {
7
+ label: string;
8
+ href: string;
9
+ target?: '_blank' | '_self';
10
+ rel?: string;
11
+ background_color?: string;
12
+ foreground_color?: string;
13
+ }
14
+ interface NotificationPayload extends Record<string, any> {
15
+ }
16
+ interface NotificationData extends Record<string, any> {
17
+ }
18
+ interface Notification extends BaseRecord {
19
+ title: string;
20
+ message: string;
21
+ isRead: boolean;
22
+ icon?: string;
23
+ actionButtons?: Array<NotificationAction>;
24
+ payload?: NotificationPayload;
25
+ data?: NotificationData;
26
+ }
27
+
28
+ interface PaginationRequest {
29
+ numItems?: number;
30
+ cursor?: string;
31
+ page?: number;
32
+ limit?: number;
33
+ }
34
+
35
+ interface BaseResponse<T = unknown> {
36
+ status: 'success' | 'error';
37
+ data: T;
38
+ error_message?: string;
39
+ error_code?: string;
40
+ }
41
+ interface PaginatedResponse<T> extends BaseResponse<T[]> {
42
+ pagination: {
43
+ continueCursor?: string;
44
+ total: number;
45
+ page?: number;
46
+ limit?: number;
47
+ };
48
+ }
49
+ interface SingleResponse<T> extends BaseResponse<T> {
50
+ }
51
+ interface ErrorResponse extends BaseResponse<null> {
52
+ error_message: string;
53
+ error_code: string;
54
+ }
55
+
56
+ interface HttpClientOptions {
57
+ baseUrl: string;
58
+ }
59
+ interface RequestOptions extends Omit<RequestInit, 'body'> {
60
+ body?: Record<string, any>;
61
+ params?: Record<string, any>;
62
+ }
63
+ declare class HttpClient {
64
+ #private;
65
+ constructor(options: HttpClientOptions);
66
+ get baseUrl(): string;
67
+ get<T extends BaseResponse = BaseResponse>(url: string, options?: Omit<RequestOptions, 'body'>): Promise<T>;
68
+ post<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: Omit<RequestOptions, 'body'>): Promise<T>;
69
+ put<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: Omit<RequestOptions, 'body'>): Promise<T>;
70
+ patch<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: RequestInit): Promise<T>;
71
+ delete<T extends BaseResponse = BaseResponse>(url: string, options?: Omit<RequestOptions, 'body'>): Promise<T>;
72
+ }
73
+
74
+ export { type BaseResponse, type ErrorResponse, HttpClient, type HttpClientOptions, type Notification, type NotificationAction, type NotificationData, type NotificationPayload, type PaginatedResponse, type PaginationRequest, type RequestOptions, type SingleResponse };
@@ -1,5 +1,74 @@
1
- export { HttpClient, HttpClientOptions, RequestOptions } from './client/http.js';
2
- export { Notification, NotificationAction, NotificationData, NotificationPayload } from './dto/notifications/notification.interface.js';
3
- export { PaginationRequest } from './dto/request/request.interface.js';
4
- export { BaseResponse, ErrorResponse, PaginatedResponse, SingleResponse } from './dto/response/response.interface.js';
5
- import './dto/base/record.interface.js';
1
+ interface BaseRecord {
2
+ _id: string;
3
+ _creationTime: string;
4
+ }
5
+
6
+ interface NotificationAction {
7
+ label: string;
8
+ href: string;
9
+ target?: '_blank' | '_self';
10
+ rel?: string;
11
+ background_color?: string;
12
+ foreground_color?: string;
13
+ }
14
+ interface NotificationPayload extends Record<string, any> {
15
+ }
16
+ interface NotificationData extends Record<string, any> {
17
+ }
18
+ interface Notification extends BaseRecord {
19
+ title: string;
20
+ message: string;
21
+ isRead: boolean;
22
+ icon?: string;
23
+ actionButtons?: Array<NotificationAction>;
24
+ payload?: NotificationPayload;
25
+ data?: NotificationData;
26
+ }
27
+
28
+ interface PaginationRequest {
29
+ numItems?: number;
30
+ cursor?: string;
31
+ page?: number;
32
+ limit?: number;
33
+ }
34
+
35
+ interface BaseResponse<T = unknown> {
36
+ status: 'success' | 'error';
37
+ data: T;
38
+ error_message?: string;
39
+ error_code?: string;
40
+ }
41
+ interface PaginatedResponse<T> extends BaseResponse<T[]> {
42
+ pagination: {
43
+ continueCursor?: string;
44
+ total: number;
45
+ page?: number;
46
+ limit?: number;
47
+ };
48
+ }
49
+ interface SingleResponse<T> extends BaseResponse<T> {
50
+ }
51
+ interface ErrorResponse extends BaseResponse<null> {
52
+ error_message: string;
53
+ error_code: string;
54
+ }
55
+
56
+ interface HttpClientOptions {
57
+ baseUrl: string;
58
+ }
59
+ interface RequestOptions extends Omit<RequestInit, 'body'> {
60
+ body?: Record<string, any>;
61
+ params?: Record<string, any>;
62
+ }
63
+ declare class HttpClient {
64
+ #private;
65
+ constructor(options: HttpClientOptions);
66
+ get baseUrl(): string;
67
+ get<T extends BaseResponse = BaseResponse>(url: string, options?: Omit<RequestOptions, 'body'>): Promise<T>;
68
+ post<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: Omit<RequestOptions, 'body'>): Promise<T>;
69
+ put<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: Omit<RequestOptions, 'body'>): Promise<T>;
70
+ patch<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: RequestInit): Promise<T>;
71
+ delete<T extends BaseResponse = BaseResponse>(url: string, options?: Omit<RequestOptions, 'body'>): Promise<T>;
72
+ }
73
+
74
+ export { type BaseResponse, type ErrorResponse, HttpClient, type HttpClientOptions, type Notification, type NotificationAction, type NotificationData, type NotificationPayload, type PaginatedResponse, type PaginationRequest, type RequestOptions, type SingleResponse };
package/package.json CHANGED
@@ -44,5 +44,5 @@
44
44
  "sideEffects": false,
45
45
  "type": "module",
46
46
  "types": "./dist/esm/index.d.ts",
47
- "version": "1.0.6-5"
47
+ "version": "1.0.6-7"
48
48
  }
@@ -1 +0,0 @@
1
- "use strict";var R=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var h=t=>{throw TypeError(t)};var q=(t,e)=>{for(var s in e)R(t,s,{get:e[s],enumerable:!0})},x=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of B(e))!$.call(t,r)&&r!==s&&R(t,r,{get:()=>e[r],enumerable:!(n=l(e,r))||n.enumerable});return t};var P=t=>x(R({},"__esModule",{value:!0}),t);var c=(t,e,s)=>e.has(t)||h("Cannot "+s);var a=(t,e,s)=>(c(t,e,"read from private field"),s?s.call(t):e.get(t)),g=(t,e,s)=>e.has(t)?h("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),m=(t,e,s,n)=>(c(t,e,"write to private field"),n?n.call(t,s):e.set(t,s),s),p=(t,e,s)=>(c(t,e,"access private method"),s);var f={};q(f,{HttpClient:()=>T});module.exports=P(f);var y=t=>new URLSearchParams(Object.keys(t).reduce((e,s)=>(t[s]!==void 0&&(e[s]=`${t[s]}`),e),{})).toString();var i,o,O,u,T=class{constructor(e){g(this,o);g(this,i);m(this,i,e.baseUrl)}get baseUrl(){return a(this,i)}get(e,s){return p(this,o,u).call(this,`${a(this,i)}${e}`,s)}post(e,s,n){return p(this,o,u).call(this,`${a(this,i)}${e}`,{...n,method:"POST",body:s})}put(e,s,n){return p(this,o,u).call(this,`${a(this,i)}${e}`,{...n,method:"PUT",body:s})}patch(e,s,n={}){return p(this,o,u).call(this,`${a(this,i)}${e}`,{...n,method:"PATCH",body:s})}delete(e,s){return p(this,o,u).call(this,`${a(this,i)}${e}`,{...s,method:"DELETE"})}};i=new WeakMap,o=new WeakSet,O=async function(e,{body:s,params:n,...r}={}){let d=e;n&&(d=`${e}?${y(n||{})}`);let b={...r,...s?{body:JSON.stringify(s)}:{},headers:{"Content-Type":"application/json",...r.headers}};return[d,b]},u=async function(e,s){let[n,r]=await p(this,o,O).call(this,e,s),d=await fetch(n,r);if(!d.ok)throw{status:"error",error_message:await d.text()};return{...await d.json(),status:"success"}};0&&(module.exports={HttpClient});
@@ -1,21 +0,0 @@
1
- import { BaseResponse } from '../dto/response/response.interface.cjs';
2
-
3
- interface HttpClientOptions {
4
- baseUrl: string;
5
- }
6
- interface RequestOptions extends Omit<RequestInit, 'body'> {
7
- body?: Record<string, any>;
8
- params?: Record<string, any>;
9
- }
10
- declare class HttpClient {
11
- #private;
12
- constructor(options: HttpClientOptions);
13
- get baseUrl(): string;
14
- get<T extends BaseResponse = BaseResponse>(url: string, options?: Omit<RequestOptions, 'body'>): Promise<T>;
15
- post<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: Omit<RequestOptions, 'body'>): Promise<T>;
16
- put<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: Omit<RequestOptions, 'body'>): Promise<T>;
17
- patch<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: RequestInit): Promise<T>;
18
- delete<T extends BaseResponse = BaseResponse>(url: string, options?: Omit<RequestOptions, 'body'>): Promise<T>;
19
- }
20
-
21
- export { HttpClient, type HttpClientOptions, type RequestOptions };
@@ -1 +0,0 @@
1
- "use strict";var R=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var h=t=>{throw TypeError(t)};var $=(t,e)=>{for(var s in e)R(t,s,{get:e[s],enumerable:!0})},q=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of x(e))!B.call(t,r)&&r!==s&&R(t,r,{get:()=>e[r],enumerable:!(n=l(e,r))||n.enumerable});return t};var f=t=>q(R({},"__esModule",{value:!0}),t);var c=(t,e,s)=>e.has(t)||h("Cannot "+s);var a=(t,e,s)=>(c(t,e,"read from private field"),s?s.call(t):e.get(t)),g=(t,e,s)=>e.has(t)?h("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,s),m=(t,e,s,n)=>(c(t,e,"write to private field"),n?n.call(t,s):e.set(t,s),s),p=(t,e,s)=>(c(t,e,"access private method"),s);var P={};$(P,{HttpClient:()=>T});module.exports=f(P);var y=t=>new URLSearchParams(Object.keys(t).reduce((e,s)=>(t[s]!==void 0&&(e[s]=`${t[s]}`),e),{})).toString();var o,i,O,u,T=class{constructor(e){g(this,i);g(this,o);m(this,o,e.baseUrl)}get baseUrl(){return a(this,o)}get(e,s){return p(this,i,u).call(this,`${a(this,o)}${e}`,s)}post(e,s,n){return p(this,i,u).call(this,`${a(this,o)}${e}`,{...n,method:"POST",body:s})}put(e,s,n){return p(this,i,u).call(this,`${a(this,o)}${e}`,{...n,method:"PUT",body:s})}patch(e,s,n={}){return p(this,i,u).call(this,`${a(this,o)}${e}`,{...n,method:"PATCH",body:s})}delete(e,s){return p(this,i,u).call(this,`${a(this,o)}${e}`,{...s,method:"DELETE"})}};o=new WeakMap,i=new WeakSet,O=async function(e,{body:s,params:n,...r}={}){let d=e;n&&(d=`${e}?${y(n||{})}`);let b={...r,...s?{body:JSON.stringify(s)}:{},headers:{"Content-Type":"application/json",...r.headers}};return[d,b]},u=async function(e,s){let[n,r]=await p(this,i,O).call(this,e,s),d=await fetch(n,r);if(!d.ok)throw{status:"error",error_message:await d.text()};return{...await d.json(),status:"success"}};0&&(module.exports={HttpClient});
@@ -1,2 +0,0 @@
1
- export { HttpClient, HttpClientOptions, RequestOptions } from './http.cjs';
2
- import '../dto/response/response.interface.cjs';
@@ -1 +0,0 @@
1
- "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,p,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!a.call(r,e)&&e!==p&&m(r,e,{get:()=>o[e],enumerable:!(f=t(o,e))||f.enumerable});return r};var c=r=>b(m({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
@@ -1 +0,0 @@
1
- export { BaseRecord } from './record.interface.cjs';
@@ -1 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var d=(i,e,a,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of o(e))!s.call(i,r)&&r!==a&&n(i,r,{get:()=>e[r],enumerable:!(t=c(e,r))||t.enumerable});return i};var g=i=>d(n({},"__esModule",{value:!0}),i);var _={};module.exports=g(_);
@@ -1,6 +0,0 @@
1
- interface BaseRecord {
2
- _id: string;
3
- _creationTime: string;
4
- }
5
-
6
- export type { BaseRecord };
@@ -1 +0,0 @@
1
- "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,p,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!a.call(r,e)&&e!==p&&m(r,e,{get:()=>o[e],enumerable:!(f=t(o,e))||f.enumerable});return r};var c=r=>b(m({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
@@ -1,4 +0,0 @@
1
- export { Notification, NotificationAction, NotificationData, NotificationPayload } from './notifications/notification.interface.cjs';
2
- export { PaginationRequest } from './request/request.interface.cjs';
3
- export { BaseResponse, ErrorResponse, PaginatedResponse, SingleResponse } from './response/response.interface.cjs';
4
- import './base/record.interface.cjs';
@@ -1 +0,0 @@
1
- "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,p,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!a.call(r,e)&&e!==p&&m(r,e,{get:()=>o[e],enumerable:!(f=t(o,e))||f.enumerable});return r};var c=r=>b(m({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
@@ -1,2 +0,0 @@
1
- export { Notification, NotificationAction, NotificationData, NotificationPayload } from './notification.interface.cjs';
2
- import '../base/record.interface.cjs';
@@ -1 +0,0 @@
1
- "use strict";var e=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var f=(i,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of c(t))!s.call(i,o)&&o!==n&&e(i,o,{get:()=>t[o],enumerable:!(a=r(t,o))||a.enumerable});return i};var d=i=>f(e({},"__esModule",{value:!0}),i);var g={};module.exports=d(g);
@@ -1,25 +0,0 @@
1
- import { BaseRecord } from '../base/record.interface.cjs';
2
-
3
- interface NotificationAction {
4
- label: string;
5
- href: string;
6
- target?: '_blank' | '_self';
7
- rel?: string;
8
- background_color?: string;
9
- foreground_color?: string;
10
- }
11
- interface NotificationPayload extends Record<string, any> {
12
- }
13
- interface NotificationData extends Record<string, any> {
14
- }
15
- interface Notification extends BaseRecord {
16
- title: string;
17
- message: string;
18
- isRead: boolean;
19
- icon?: string;
20
- actionButtons?: Array<NotificationAction>;
21
- payload?: NotificationPayload;
22
- data?: NotificationData;
23
- }
24
-
25
- export type { Notification, NotificationAction, NotificationData, NotificationPayload };
@@ -1 +0,0 @@
1
- "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,p,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!a.call(r,e)&&e!==p&&m(r,e,{get:()=>o[e],enumerable:!(f=t(o,e))||f.enumerable});return r};var c=r=>b(m({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
@@ -1 +0,0 @@
1
- export { PaginationRequest } from './request.interface.cjs';
@@ -1 +0,0 @@
1
- "use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var b=(n,e,m,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of a(e))!s.call(n,r)&&r!==m&&i(n,r,{get:()=>e[r],enumerable:!(t=u(e,r))||t.enumerable});return n};var g=n=>b(i({},"__esModule",{value:!0}),n);var o={};module.exports=g(o);
@@ -1,8 +0,0 @@
1
- interface PaginationRequest {
2
- numItems?: number;
3
- cursor?: string;
4
- page?: number;
5
- limit?: number;
6
- }
7
-
8
- export type { PaginationRequest };
@@ -1 +0,0 @@
1
- "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,p,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!a.call(r,e)&&e!==p&&m(r,e,{get:()=>o[e],enumerable:!(f=t(o,e))||f.enumerable});return r};var c=r=>b(m({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
@@ -1 +0,0 @@
1
- export { BaseResponse, ErrorResponse, PaginatedResponse, SingleResponse } from './response.interface.cjs';
@@ -1 +0,0 @@
1
- "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var g=(r,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of i(e))!p.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(n=a(e,s))||n.enumerable});return r};var c=r=>g(t({},"__esModule",{value:!0}),r);var u={};module.exports=c(u);
@@ -1,22 +0,0 @@
1
- interface BaseResponse<T = unknown> {
2
- status: 'success' | 'error';
3
- data: T;
4
- error_message?: string;
5
- error_code?: string;
6
- }
7
- interface PaginatedResponse<T> extends BaseResponse<T[]> {
8
- pagination: {
9
- continueCursor?: string;
10
- total: number;
11
- page?: number;
12
- limit?: number;
13
- };
14
- }
15
- interface SingleResponse<T> extends BaseResponse<T> {
16
- }
17
- interface ErrorResponse extends BaseResponse<null> {
18
- error_message: string;
19
- error_code: string;
20
- }
21
-
22
- export type { BaseResponse, ErrorResponse, PaginatedResponse, SingleResponse };
@@ -1 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var n in r)o(e,n,{get:r[n],enumerable:!0})},c=(e,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of d(r))!g.call(e,t)&&t!==n&&o(e,t,{get:()=>r[t],enumerable:!(i=s(r,t))||i.enumerable});return e};var a=e=>c(o({},"__esModule",{value:!0}),e);var R={};u(R,{paramsToQueryString:()=>f});module.exports=a(R);var f=e=>new URLSearchParams(Object.keys(e).reduce((r,n)=>(e[n]!==void 0&&(r[n]=`${e[n]}`),r),{})).toString();0&&(module.exports={paramsToQueryString});
@@ -1 +0,0 @@
1
- export { paramsToQueryString } from './utils/request.cjs';
@@ -1 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(e,r)=>{for(var n in r)o(e,n,{get:r[n],enumerable:!0})},c=(e,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of d(r))!g.call(e,t)&&t!==n&&o(e,t,{get:()=>r[t],enumerable:!(i=s(r,t))||i.enumerable});return e};var a=e=>c(o({},"__esModule",{value:!0}),e);var R={};u(R,{paramsToQueryString:()=>f});module.exports=a(R);var f=e=>new URLSearchParams(Object.keys(e).reduce((r,n)=>(e[n]!==void 0&&(r[n]=`${e[n]}`),r),{})).toString();0&&(module.exports={paramsToQueryString});
@@ -1 +0,0 @@
1
- export { paramsToQueryString } from './request.cjs';
@@ -1 +0,0 @@
1
- "use strict";var i=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(n,r)=>{for(var e in r)i(n,e,{get:r[e],enumerable:!0})},c=(n,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of d(r))!g.call(n,t)&&t!==e&&i(n,t,{get:()=>r[t],enumerable:!(o=s(r,t))||o.enumerable});return n};var a=n=>c(i({},"__esModule",{value:!0}),n);var S={};u(S,{paramsToQueryString:()=>R});module.exports=a(S);var R=n=>new URLSearchParams(Object.keys(n).reduce((r,e)=>(n[e]!==void 0&&(r[e]=`${n[e]}`),r),{})).toString();0&&(module.exports={paramsToQueryString});
@@ -1,3 +0,0 @@
1
- declare const paramsToQueryString: (params: Record<string, any>) => string;
2
-
3
- export { paramsToQueryString };
@@ -1,21 +0,0 @@
1
- import { BaseResponse } from '../dto/response/response.interface.js';
2
-
3
- interface HttpClientOptions {
4
- baseUrl: string;
5
- }
6
- interface RequestOptions extends Omit<RequestInit, 'body'> {
7
- body?: Record<string, any>;
8
- params?: Record<string, any>;
9
- }
10
- declare class HttpClient {
11
- #private;
12
- constructor(options: HttpClientOptions);
13
- get baseUrl(): string;
14
- get<T extends BaseResponse = BaseResponse>(url: string, options?: Omit<RequestOptions, 'body'>): Promise<T>;
15
- post<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: Omit<RequestOptions, 'body'>): Promise<T>;
16
- put<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: Omit<RequestOptions, 'body'>): Promise<T>;
17
- patch<T extends BaseResponse = BaseResponse>(url: string, data?: Record<string, any>, options?: RequestInit): Promise<T>;
18
- delete<T extends BaseResponse = BaseResponse>(url: string, options?: Omit<RequestOptions, 'body'>): Promise<T>;
19
- }
20
-
21
- export { HttpClient, type HttpClientOptions, type RequestOptions };
@@ -1 +0,0 @@
1
- var o=r=>new URLSearchParams(Object.keys(r).reduce((e,s)=>(r[s]!==void 0&&(e[s]=`${r[s]}`),e),{})).toString();var a=class{#e;constructor(e){this.#e=e.baseUrl}get baseUrl(){return this.#e}async#t(e,{body:s,params:t,...i}={}){let n=e;t&&(n=`${e}?${o(t||{})}`);let p={...i,...s?{body:JSON.stringify(s)}:{},headers:{"Content-Type":"application/json",...i.headers}};return[n,p]}async#s(e,s){let[t,i]=await this.#t(e,s),n=await fetch(t,i);if(!n.ok)throw{status:"error",error_message:await n.text()};return{...await n.json(),status:"success"}}get(e,s){return this.#s(`${this.#e}${e}`,s)}post(e,s,t){return this.#s(`${this.#e}${e}`,{...t,method:"POST",body:s})}put(e,s,t){return this.#s(`${this.#e}${e}`,{...t,method:"PUT",body:s})}patch(e,s,t={}){return this.#s(`${this.#e}${e}`,{...t,method:"PATCH",body:s})}delete(e,s){return this.#s(`${this.#e}${e}`,{...s,method:"DELETE"})}};export{a as HttpClient};
@@ -1,2 +0,0 @@
1
- export { HttpClient, HttpClientOptions, RequestOptions } from './http.js';
2
- import '../dto/response/response.interface.js';
@@ -1 +0,0 @@
1
- var i=r=>new URLSearchParams(Object.keys(r).reduce((e,s)=>(r[s]!==void 0&&(e[s]=`${r[s]}`),e),{})).toString();var a=class{#e;constructor(e){this.#e=e.baseUrl}get baseUrl(){return this.#e}async#t(e,{body:s,params:t,...o}={}){let n=e;t&&(n=`${e}?${i(t||{})}`);let p={...o,...s?{body:JSON.stringify(s)}:{},headers:{"Content-Type":"application/json",...o.headers}};return[n,p]}async#s(e,s){let[t,o]=await this.#t(e,s),n=await fetch(t,o);if(!n.ok)throw{status:"error",error_message:await n.text()};return{...await n.json(),status:"success"}}get(e,s){return this.#s(`${this.#e}${e}`,s)}post(e,s,t){return this.#s(`${this.#e}${e}`,{...t,method:"POST",body:s})}put(e,s,t){return this.#s(`${this.#e}${e}`,{...t,method:"PUT",body:s})}patch(e,s,t={}){return this.#s(`${this.#e}${e}`,{...t,method:"PATCH",body:s})}delete(e,s){return this.#s(`${this.#e}${e}`,{...s,method:"DELETE"})}};export{a as HttpClient};
@@ -1 +0,0 @@
1
- export { BaseRecord } from './record.interface.js';
File without changes
@@ -1,6 +0,0 @@
1
- interface BaseRecord {
2
- _id: string;
3
- _creationTime: string;
4
- }
5
-
6
- export type { BaseRecord };
File without changes
@@ -1,4 +0,0 @@
1
- export { Notification, NotificationAction, NotificationData, NotificationPayload } from './notifications/notification.interface.js';
2
- export { PaginationRequest } from './request/request.interface.js';
3
- export { BaseResponse, ErrorResponse, PaginatedResponse, SingleResponse } from './response/response.interface.js';
4
- import './base/record.interface.js';
File without changes
@@ -1,2 +0,0 @@
1
- export { Notification, NotificationAction, NotificationData, NotificationPayload } from './notification.interface.js';
2
- import '../base/record.interface.js';
File without changes
@@ -1,25 +0,0 @@
1
- import { BaseRecord } from '../base/record.interface.js';
2
-
3
- interface NotificationAction {
4
- label: string;
5
- href: string;
6
- target?: '_blank' | '_self';
7
- rel?: string;
8
- background_color?: string;
9
- foreground_color?: string;
10
- }
11
- interface NotificationPayload extends Record<string, any> {
12
- }
13
- interface NotificationData extends Record<string, any> {
14
- }
15
- interface Notification extends BaseRecord {
16
- title: string;
17
- message: string;
18
- isRead: boolean;
19
- icon?: string;
20
- actionButtons?: Array<NotificationAction>;
21
- payload?: NotificationPayload;
22
- data?: NotificationData;
23
- }
24
-
25
- export type { Notification, NotificationAction, NotificationData, NotificationPayload };
@@ -1 +0,0 @@
1
- export { PaginationRequest } from './request.interface.js';
File without changes
@@ -1,8 +0,0 @@
1
- interface PaginationRequest {
2
- numItems?: number;
3
- cursor?: string;
4
- page?: number;
5
- limit?: number;
6
- }
7
-
8
- export type { PaginationRequest };
File without changes
@@ -1 +0,0 @@
1
- export { BaseResponse, ErrorResponse, PaginatedResponse, SingleResponse } from './response.interface.js';
File without changes
@@ -1,22 +0,0 @@
1
- interface BaseResponse<T = unknown> {
2
- status: 'success' | 'error';
3
- data: T;
4
- error_message?: string;
5
- error_code?: string;
6
- }
7
- interface PaginatedResponse<T> extends BaseResponse<T[]> {
8
- pagination: {
9
- continueCursor?: string;
10
- total: number;
11
- page?: number;
12
- limit?: number;
13
- };
14
- }
15
- interface SingleResponse<T> extends BaseResponse<T> {
16
- }
17
- interface ErrorResponse extends BaseResponse<null> {
18
- error_message: string;
19
- error_code: string;
20
- }
21
-
22
- export type { BaseResponse, ErrorResponse, PaginatedResponse, SingleResponse };
File without changes
@@ -1 +0,0 @@
1
- export { paramsToQueryString } from './utils/request.js';
@@ -1 +0,0 @@
1
- var t=r=>new URLSearchParams(Object.keys(r).reduce((n,e)=>(r[e]!==void 0&&(n[e]=`${r[e]}`),n),{})).toString();export{t as paramsToQueryString};
@@ -1 +0,0 @@
1
- export { paramsToQueryString } from './request.js';
@@ -1 +0,0 @@
1
- var t=r=>new URLSearchParams(Object.keys(r).reduce((n,e)=>(r[e]!==void 0&&(n[e]=`${r[e]}`),n),{})).toString();export{t as paramsToQueryString};
@@ -1,3 +0,0 @@
1
- declare const paramsToQueryString: (params: Record<string, any>) => string;
2
-
3
- export { paramsToQueryString };
@@ -1 +0,0 @@
1
- var t=r=>new URLSearchParams(Object.keys(r).reduce((e,n)=>(r[n]!==void 0&&(e[n]=`${r[n]}`),e),{})).toString();export{t as paramsToQueryString};