@tnf-dev/js 1.0.6-6 → 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.
- package/dist/cjs/index.d.cts +63 -4
- package/dist/esm/index.d.ts +63 -4
- package/package.json +2 -2
- package/dist/cjs/client/client.cjs +0 -1
- package/dist/cjs/client/client.d.cts +0 -19
- package/dist/cjs/client/convex.cjs +0 -1
- package/dist/cjs/client/convex.d.cts +0 -1
- package/dist/cjs/client/index.cjs +0 -1
- package/dist/cjs/client/index.d.cts +0 -4
- package/dist/cjs/client/notification.cjs +0 -1
- package/dist/cjs/client/notification.d.cts +0 -49
- package/dist/cjs/utils/const.cjs +0 -1
- package/dist/cjs/utils/const.d.cts +0 -4
- package/dist/cjs/utils/index.cjs +0 -1
- package/dist/cjs/utils/index.d.cts +0 -1
- package/dist/esm/client/client.d.ts +0 -19
- package/dist/esm/client/client.js +0 -1
- package/dist/esm/client/convex.d.ts +0 -1
- package/dist/esm/client/convex.js +0 -1
- package/dist/esm/client/index.d.ts +0 -4
- package/dist/esm/client/index.js +0 -1
- package/dist/esm/client/notification.d.ts +0 -49
- package/dist/esm/client/notification.js +0 -1
- package/dist/esm/utils/const.d.ts +0 -4
- package/dist/esm/utils/const.js +0 -1
- package/dist/esm/utils/index.d.ts +0 -1
- package/dist/esm/utils/index.js +0 -1
package/dist/cjs/index.d.cts
CHANGED
@@ -1,4 +1,63 @@
|
|
1
|
-
|
2
|
-
import '
|
3
|
-
|
4
|
-
|
1
|
+
import { HttpClient, PaginationRequest, PaginatedResponse, Notification, BaseResponse, HttpClientOptions } from '@tnf-dev/core';
|
2
|
+
import { ConvexClient } from 'convex/browser';
|
3
|
+
|
4
|
+
interface Handler {
|
5
|
+
(updatedNotifications: Notification[], options: {
|
6
|
+
counts: {
|
7
|
+
unread: number;
|
8
|
+
};
|
9
|
+
}): void;
|
10
|
+
}
|
11
|
+
interface GetNotificationParams extends PaginationRequest {
|
12
|
+
}
|
13
|
+
interface GetNotificationsResponse extends PaginatedResponse<Notification> {
|
14
|
+
unread: number;
|
15
|
+
}
|
16
|
+
interface NotificationClientOptions {
|
17
|
+
subscriberId: string;
|
18
|
+
applicationId: string;
|
19
|
+
language?: string;
|
20
|
+
}
|
21
|
+
declare class NotificationClient {
|
22
|
+
#private;
|
23
|
+
private httpClient;
|
24
|
+
private convexClient;
|
25
|
+
private options;
|
26
|
+
constructor(httpClient: HttpClient, convexClient: ConvexClient, options: NotificationClientOptions);
|
27
|
+
getNotifications(params: GetNotificationParams): Promise<GetNotificationsResponse>;
|
28
|
+
counts(): Promise<{
|
29
|
+
unread: any;
|
30
|
+
}>;
|
31
|
+
getNotification(notificationId: string): Promise<BaseResponse<Notification>>;
|
32
|
+
markAsRead(notificationId: string): Promise<BaseResponse<Notification>>;
|
33
|
+
markAsUnread(notificationId: string): Promise<BaseResponse<Notification>>;
|
34
|
+
markAllAsRead(): Promise<BaseResponse<void>>;
|
35
|
+
archive(notificationId: string): Promise<BaseResponse<Notification>>;
|
36
|
+
unarchive(notificationId: string): Promise<BaseResponse<Notification>>;
|
37
|
+
/**
|
38
|
+
* Add listener to notification change
|
39
|
+
* @param handler Handle function
|
40
|
+
*/
|
41
|
+
on(handler: Handler): void;
|
42
|
+
/**
|
43
|
+
* Remove listener to notification change
|
44
|
+
* @param handler Handle function
|
45
|
+
*/
|
46
|
+
off(handler: Handler): void;
|
47
|
+
}
|
48
|
+
|
49
|
+
interface TeknifyClientOptions extends Omit<HttpClientOptions, 'baseUrl'> {
|
50
|
+
applicationId: string;
|
51
|
+
subscriberId: string;
|
52
|
+
baseUrl?: string;
|
53
|
+
socketUrl?: string;
|
54
|
+
language?: string;
|
55
|
+
}
|
56
|
+
declare class TeknifyClient {
|
57
|
+
#private;
|
58
|
+
constructor(options: TeknifyClientOptions);
|
59
|
+
get notification(): NotificationClient;
|
60
|
+
close(): Promise<void>;
|
61
|
+
}
|
62
|
+
|
63
|
+
export { TeknifyClient, type TeknifyClientOptions };
|
package/dist/esm/index.d.ts
CHANGED
@@ -1,4 +1,63 @@
|
|
1
|
-
|
2
|
-
import '
|
3
|
-
|
4
|
-
|
1
|
+
import { HttpClient, PaginationRequest, PaginatedResponse, Notification, BaseResponse, HttpClientOptions } from '@tnf-dev/core';
|
2
|
+
import { ConvexClient } from 'convex/browser';
|
3
|
+
|
4
|
+
interface Handler {
|
5
|
+
(updatedNotifications: Notification[], options: {
|
6
|
+
counts: {
|
7
|
+
unread: number;
|
8
|
+
};
|
9
|
+
}): void;
|
10
|
+
}
|
11
|
+
interface GetNotificationParams extends PaginationRequest {
|
12
|
+
}
|
13
|
+
interface GetNotificationsResponse extends PaginatedResponse<Notification> {
|
14
|
+
unread: number;
|
15
|
+
}
|
16
|
+
interface NotificationClientOptions {
|
17
|
+
subscriberId: string;
|
18
|
+
applicationId: string;
|
19
|
+
language?: string;
|
20
|
+
}
|
21
|
+
declare class NotificationClient {
|
22
|
+
#private;
|
23
|
+
private httpClient;
|
24
|
+
private convexClient;
|
25
|
+
private options;
|
26
|
+
constructor(httpClient: HttpClient, convexClient: ConvexClient, options: NotificationClientOptions);
|
27
|
+
getNotifications(params: GetNotificationParams): Promise<GetNotificationsResponse>;
|
28
|
+
counts(): Promise<{
|
29
|
+
unread: any;
|
30
|
+
}>;
|
31
|
+
getNotification(notificationId: string): Promise<BaseResponse<Notification>>;
|
32
|
+
markAsRead(notificationId: string): Promise<BaseResponse<Notification>>;
|
33
|
+
markAsUnread(notificationId: string): Promise<BaseResponse<Notification>>;
|
34
|
+
markAllAsRead(): Promise<BaseResponse<void>>;
|
35
|
+
archive(notificationId: string): Promise<BaseResponse<Notification>>;
|
36
|
+
unarchive(notificationId: string): Promise<BaseResponse<Notification>>;
|
37
|
+
/**
|
38
|
+
* Add listener to notification change
|
39
|
+
* @param handler Handle function
|
40
|
+
*/
|
41
|
+
on(handler: Handler): void;
|
42
|
+
/**
|
43
|
+
* Remove listener to notification change
|
44
|
+
* @param handler Handle function
|
45
|
+
*/
|
46
|
+
off(handler: Handler): void;
|
47
|
+
}
|
48
|
+
|
49
|
+
interface TeknifyClientOptions extends Omit<HttpClientOptions, 'baseUrl'> {
|
50
|
+
applicationId: string;
|
51
|
+
subscriberId: string;
|
52
|
+
baseUrl?: string;
|
53
|
+
socketUrl?: string;
|
54
|
+
language?: string;
|
55
|
+
}
|
56
|
+
declare class TeknifyClient {
|
57
|
+
#private;
|
58
|
+
constructor(options: TeknifyClientOptions);
|
59
|
+
get notification(): NotificationClient;
|
60
|
+
close(): Promise<void>;
|
61
|
+
}
|
62
|
+
|
63
|
+
export { TeknifyClient, type TeknifyClientOptions };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"browser": "./dist/esm/index.js",
|
3
3
|
"dependencies": {
|
4
|
-
"@tnf-dev/core": "1.0.6-
|
4
|
+
"@tnf-dev/core": "1.0.6-7",
|
5
5
|
"convex": "^1.24.8"
|
6
6
|
},
|
7
7
|
"devDependencies": {
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"sideEffects": false,
|
50
50
|
"type": "module",
|
51
51
|
"types": "./dist/esm/index.d.ts",
|
52
|
-
"version": "1.0.6-
|
52
|
+
"version": "1.0.6-7"
|
53
53
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var h=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var m=i=>{throw TypeError(i)};var P=(i,t)=>{for(var n in t)h(i,n,{get:t[n],enumerable:!0})},k=(i,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of y(t))!A.call(i,e)&&e!==n&&h(i,e,{get:()=>t[e],enumerable:!(s=U(t,e))||s.enumerable});return i};var H=i=>k(h({},"__esModule",{value:!0}),i);var C=(i,t,n)=>t.has(i)||m("Cannot "+n);var o=(i,t,n)=>(C(i,t,"read from private field"),n?n.call(i):t.get(i)),r=(i,t,n)=>t.has(i)?m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,n),c=(i,t,n,s)=>(C(i,t,"write to private field"),s?s.call(i,n):t.set(i,n),n);var w={};P(w,{TeknifyClient:()=>g});module.exports=H(w);var v=require("@tnf-dev/core"),I=require("convex/browser");var b="https://teknify-server.teknix.services",x="https://convex-be.teknix.services";var p=require("convex/server");var a,f=class{constructor(t,n,s){this.httpClient=t;this.convexClient=n;this.options=s;r(this,a,[]);this.convexClient.onUpdate(p.anyApi.notifications.listenToNotificationsCount,{subscriberId:this.options.subscriberId,...this.options.language?{}:{}},async({latest:e})=>{if(!e)return;let{unread:R}=await this.counts();o(this,a).forEach(N=>N([e],{counts:{unread:R}}))})}async getNotifications(t){let[n,s]=await Promise.all([this.convexClient.action(p.anyApi.notifications.getTranslated,{numItems:t.numItems,cursor:t.cursor,filter:{subscriberId:this.options.subscriberId,appId:this.options.applicationId},...this.options.language?{lang:this.options.language}:{}}),this.counts()]).catch(e=>{throw console.log(e),e});return n?{data:n.page,pagination:{continueCursor:n.isDone?null:n.continueCursor,total:s.unread},status:"success",unread:s.unread}:{data:[],pagination:{continueCursor:void 0,total:0},status:"error",unread:0}}async counts(){let[t]=await Promise.all([this.convexClient.query(p.anyApi.notifications.countUnreadNotifications,{subscriberId:this.options.subscriberId,appId:this.options.applicationId})]);return{unread:t}}async getNotification(t){return this.httpClient.get(`/notifications/${t}`)}async markAsRead(t){return await this.convexClient.mutation(p.anyApi.notifications.markAsRead,{id:t})}async markAsUnread(t){return this.httpClient.put(`/notifications/${t}/unread`,{})}async markAllAsRead(){return this.convexClient.mutation(p.anyApi.notifications.markAsReadAll,{subscriberId:this.options.subscriberId})}async archive(t){return this.httpClient.put(`/notifications/${t}/archive`,{})}async unarchive(t){return this.httpClient.put(`/notifications/${t}/unarchive`,{})}on(t){o(this,a).push(t)}off(t){c(this,a,o(this,a).filter(n=>n===t))}};a=new WeakMap;var l,u,d,g=class{constructor(t){r(this,l);r(this,u);r(this,d);c(this,l,new v.HttpClient({...t,baseUrl:t.baseUrl||b})),c(this,u,new I.ConvexClient(t.socketUrl||x)),c(this,d,new f(o(this,l),o(this,u),{applicationId:t.applicationId,subscriberId:t.subscriberId,language:t.language}))}get notification(){return o(this,d)}async close(){await o(this,u).close()}};l=new WeakMap,u=new WeakMap,d=new WeakMap;0&&(module.exports={TeknifyClient});
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { HttpClientOptions } from '@tnf-dev/core';
|
2
|
-
import { NotificationClient } from './notification.cjs';
|
3
|
-
import 'convex/browser';
|
4
|
-
|
5
|
-
interface TeknifyClientOptions extends Omit<HttpClientOptions, 'baseUrl'> {
|
6
|
-
applicationId: string;
|
7
|
-
subscriberId: string;
|
8
|
-
baseUrl?: string;
|
9
|
-
socketUrl?: string;
|
10
|
-
language?: string;
|
11
|
-
}
|
12
|
-
declare class TeknifyClient {
|
13
|
-
#private;
|
14
|
-
constructor(options: TeknifyClientOptions);
|
15
|
-
get notification(): NotificationClient;
|
16
|
-
close(): Promise<void>;
|
17
|
-
}
|
18
|
-
|
19
|
-
export { TeknifyClient, type TeknifyClientOptions };
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var t=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var m=(o,e)=>{for(var r in e)t(o,r,{get:e[r],enumerable:!0})},p=(o,e,r,x)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of i(e))!l.call(o,n)&&n!==r&&t(o,n,{get:()=>e[n],enumerable:!(x=f(e,n))||x.enumerable});return o};var v=o=>p(t({},"__esModule",{value:!0}),o);var a={};m(a,{ConvexClient:()=>C.ConvexClient});module.exports=v(a);var C=require("convex/browser");0&&(module.exports={ConvexClient});
|
@@ -1 +0,0 @@
|
|
1
|
-
export { ConvexClient } from 'convex/browser';
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var h=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var m=i=>{throw TypeError(i)};var P=(i,t)=>{for(var n in t)h(i,n,{get:t[n],enumerable:!0})},k=(i,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of y(t))!A.call(i,e)&&e!==n&&h(i,e,{get:()=>t[e],enumerable:!(s=U(t,e))||s.enumerable});return i};var H=i=>k(h({},"__esModule",{value:!0}),i);var C=(i,t,n)=>t.has(i)||m("Cannot "+n);var o=(i,t,n)=>(C(i,t,"read from private field"),n?n.call(i):t.get(i)),r=(i,t,n)=>t.has(i)?m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,n),c=(i,t,n,s)=>(C(i,t,"write to private field"),s?s.call(i,n):t.set(i,n),n);var w={};P(w,{TeknifyClient:()=>g});module.exports=H(w);var v=require("@tnf-dev/core"),I=require("convex/browser");var b="https://teknify-server.teknix.services",x="https://convex-be.teknix.services";var p=require("convex/server");var a,f=class{constructor(t,n,s){this.httpClient=t;this.convexClient=n;this.options=s;r(this,a,[]);this.convexClient.onUpdate(p.anyApi.notifications.listenToNotificationsCount,{subscriberId:this.options.subscriberId,...this.options.language?{}:{}},async({latest:e})=>{if(!e)return;let{unread:R}=await this.counts();o(this,a).forEach(N=>N([e],{counts:{unread:R}}))})}async getNotifications(t){let[n,s]=await Promise.all([this.convexClient.action(p.anyApi.notifications.getTranslated,{numItems:t.numItems,cursor:t.cursor,filter:{subscriberId:this.options.subscriberId,appId:this.options.applicationId},...this.options.language?{lang:this.options.language}:{}}),this.counts()]).catch(e=>{throw console.log(e),e});return n?{data:n.page,pagination:{continueCursor:n.isDone?null:n.continueCursor,total:s.unread},status:"success",unread:s.unread}:{data:[],pagination:{continueCursor:void 0,total:0},status:"error",unread:0}}async counts(){let[t]=await Promise.all([this.convexClient.query(p.anyApi.notifications.countUnreadNotifications,{subscriberId:this.options.subscriberId,appId:this.options.applicationId})]);return{unread:t}}async getNotification(t){return this.httpClient.get(`/notifications/${t}`)}async markAsRead(t){return await this.convexClient.mutation(p.anyApi.notifications.markAsRead,{id:t})}async markAsUnread(t){return this.httpClient.put(`/notifications/${t}/unread`,{})}async markAllAsRead(){return this.convexClient.mutation(p.anyApi.notifications.markAsReadAll,{subscriberId:this.options.subscriberId})}async archive(t){return this.httpClient.put(`/notifications/${t}/archive`,{})}async unarchive(t){return this.httpClient.put(`/notifications/${t}/unarchive`,{})}on(t){o(this,a).push(t)}off(t){c(this,a,o(this,a).filter(n=>n===t))}};a=new WeakMap;var l,u,d,g=class{constructor(t){r(this,l);r(this,u);r(this,d);c(this,l,new v.HttpClient({...t,baseUrl:t.baseUrl||b})),c(this,u,new I.ConvexClient(t.socketUrl||x)),c(this,d,new f(o(this,l),o(this,u),{applicationId:t.applicationId,subscriberId:t.subscriberId,language:t.language}))}get notification(){return o(this,d)}async close(){await o(this,u).close()}};l=new WeakMap,u=new WeakMap,d=new WeakMap;0&&(module.exports={TeknifyClient});
|
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var p=i=>{throw TypeError(i)};var N=(i,t)=>{for(var n in t)c(i,n,{get:t[n],enumerable:!0})},v=(i,t,n,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of C(t))!b.call(i,s)&&s!==n&&c(i,s,{get:()=>t[s],enumerable:!(e=m(t,s))||e.enumerable});return i};var R=i=>v(c({},"__esModule",{value:!0}),i);var d=(i,t,n)=>t.has(i)||p("Cannot "+n);var r=(i,t,n)=>(d(i,t,"read from private field"),n?n.call(i):t.get(i)),l=(i,t,n)=>t.has(i)?p("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,n),f=(i,t,n,e)=>(d(i,t,"write to private field"),e?e.call(i,n):t.set(i,n),n);var I={};N(I,{NotificationClient:()=>u});module.exports=R(I);var a=require("convex/server");var o,u=class{constructor(t,n,e){this.httpClient=t;this.convexClient=n;this.options=e;l(this,o,[]);this.convexClient.onUpdate(a.anyApi.notifications.listenToNotificationsCount,{subscriberId:this.options.subscriberId,...this.options.language?{}:{}},async({latest:s})=>{if(!s)return;let{unread:h}=await this.counts();r(this,o).forEach(g=>g([s],{counts:{unread:h}}))})}async getNotifications(t){let[n,e]=await Promise.all([this.convexClient.action(a.anyApi.notifications.getTranslated,{numItems:t.numItems,cursor:t.cursor,filter:{subscriberId:this.options.subscriberId,appId:this.options.applicationId},...this.options.language?{lang:this.options.language}:{}}),this.counts()]).catch(s=>{throw console.log(s),s});return n?{data:n.page,pagination:{continueCursor:n.isDone?null:n.continueCursor,total:e.unread},status:"success",unread:e.unread}:{data:[],pagination:{continueCursor:void 0,total:0},status:"error",unread:0}}async counts(){let[t]=await Promise.all([this.convexClient.query(a.anyApi.notifications.countUnreadNotifications,{subscriberId:this.options.subscriberId,appId:this.options.applicationId})]);return{unread:t}}async getNotification(t){return this.httpClient.get(`/notifications/${t}`)}async markAsRead(t){return await this.convexClient.mutation(a.anyApi.notifications.markAsRead,{id:t})}async markAsUnread(t){return this.httpClient.put(`/notifications/${t}/unread`,{})}async markAllAsRead(){return this.convexClient.mutation(a.anyApi.notifications.markAsReadAll,{subscriberId:this.options.subscriberId})}async archive(t){return this.httpClient.put(`/notifications/${t}/archive`,{})}async unarchive(t){return this.httpClient.put(`/notifications/${t}/unarchive`,{})}on(t){r(this,o).push(t)}off(t){f(this,o,r(this,o).filter(n=>n===t))}};o=new WeakMap;0&&(module.exports={NotificationClient});
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { HttpClient, PaginationRequest, PaginatedResponse, Notification, BaseResponse } from '@tnf-dev/core';
|
2
|
-
import { ConvexClient } from 'convex/browser';
|
3
|
-
|
4
|
-
interface Handler {
|
5
|
-
(updatedNotifications: Notification[], options: {
|
6
|
-
counts: {
|
7
|
-
unread: number;
|
8
|
-
};
|
9
|
-
}): void;
|
10
|
-
}
|
11
|
-
interface GetNotificationParams extends PaginationRequest {
|
12
|
-
}
|
13
|
-
interface GetNotificationsResponse extends PaginatedResponse<Notification> {
|
14
|
-
unread: number;
|
15
|
-
}
|
16
|
-
interface NotificationClientOptions {
|
17
|
-
subscriberId: string;
|
18
|
-
applicationId: string;
|
19
|
-
language?: string;
|
20
|
-
}
|
21
|
-
declare class NotificationClient {
|
22
|
-
#private;
|
23
|
-
private httpClient;
|
24
|
-
private convexClient;
|
25
|
-
private options;
|
26
|
-
constructor(httpClient: HttpClient, convexClient: ConvexClient, options: NotificationClientOptions);
|
27
|
-
getNotifications(params: GetNotificationParams): Promise<GetNotificationsResponse>;
|
28
|
-
counts(): Promise<{
|
29
|
-
unread: any;
|
30
|
-
}>;
|
31
|
-
getNotification(notificationId: string): Promise<BaseResponse<Notification>>;
|
32
|
-
markAsRead(notificationId: string): Promise<BaseResponse<Notification>>;
|
33
|
-
markAsUnread(notificationId: string): Promise<BaseResponse<Notification>>;
|
34
|
-
markAllAsRead(): Promise<BaseResponse<void>>;
|
35
|
-
archive(notificationId: string): Promise<BaseResponse<Notification>>;
|
36
|
-
unarchive(notificationId: string): Promise<BaseResponse<Notification>>;
|
37
|
-
/**
|
38
|
-
* Add listener to notification change
|
39
|
-
* @param handler Handle function
|
40
|
-
*/
|
41
|
-
on(handler: Handler): void;
|
42
|
-
/**
|
43
|
-
* Remove listener to notification change
|
44
|
-
* @param handler Handle function
|
45
|
-
*/
|
46
|
-
off(handler: Handler): void;
|
47
|
-
}
|
48
|
-
|
49
|
-
export { type GetNotificationParams, type GetNotificationsResponse, NotificationClient, type NotificationClientOptions };
|
package/dist/cjs/utils/const.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var r=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var n in e)r(t,n,{get:e[n],enumerable:!0})},v=(t,e,n,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of o(e))!x.call(t,s)&&s!==n&&r(t,s,{get:()=>e[s],enumerable:!(c=i(e,s))||c.enumerable});return t};var E=t=>v(r({},"__esModule",{value:!0}),t);var _={};p(_,{DEFAULT_BASE_URL:()=>L,DEFAULT_SOCKET_URL:()=>U});module.exports=E(_);var L="https://teknify-server.teknix.services",U="https://convex-be.teknix.services";0&&(module.exports={DEFAULT_BASE_URL,DEFAULT_SOCKET_URL});
|
package/dist/cjs/utils/index.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var o=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},v=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of c(e))!i.call(t,s)&&s!==r&&o(t,s,{get:()=>e[s],enumerable:!(n=x(e,s))||n.enumerable});return t};var E=t=>v(o({},"__esModule",{value:!0}),t);var _={};p(_,{DEFAULT_BASE_URL:()=>L,DEFAULT_SOCKET_URL:()=>U});module.exports=E(_);var L="https://teknify-server.teknix.services",U="https://convex-be.teknix.services";0&&(module.exports={DEFAULT_BASE_URL,DEFAULT_SOCKET_URL});
|
@@ -1 +0,0 @@
|
|
1
|
-
export { DEFAULT_BASE_URL, DEFAULT_SOCKET_URL } from './const.cjs';
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { HttpClientOptions } from '@tnf-dev/core';
|
2
|
-
import { NotificationClient } from './notification.js';
|
3
|
-
import 'convex/browser';
|
4
|
-
|
5
|
-
interface TeknifyClientOptions extends Omit<HttpClientOptions, 'baseUrl'> {
|
6
|
-
applicationId: string;
|
7
|
-
subscriberId: string;
|
8
|
-
baseUrl?: string;
|
9
|
-
socketUrl?: string;
|
10
|
-
language?: string;
|
11
|
-
}
|
12
|
-
declare class TeknifyClient {
|
13
|
-
#private;
|
14
|
-
constructor(options: TeknifyClientOptions);
|
15
|
-
get notification(): NotificationClient;
|
16
|
-
close(): Promise<void>;
|
17
|
-
}
|
18
|
-
|
19
|
-
export { TeknifyClient, type TeknifyClientOptions };
|
@@ -1 +0,0 @@
|
|
1
|
-
import{HttpClient as d}from"@tnf-dev/core";import{ConvexClient as f}from"convex/browser";var a="https://teknify-server.teknix.services",r="https://convex-be.teknix.services";import{anyApi as e}from"convex/server";var s=class{constructor(t,i,o){this.httpClient=t;this.convexClient=i;this.options=o;this.convexClient.onUpdate(e.notifications.listenToNotificationsCount,{subscriberId:this.options.subscriberId,...this.options.language?{}:{}},async({latest:n})=>{if(!n)return;let{unread:u}=await this.counts();this.#t.forEach(l=>l([n],{counts:{unread:u}}))})}#t=[];async getNotifications(t){let[i,o]=await Promise.all([this.convexClient.action(e.notifications.getTranslated,{numItems:t.numItems,cursor:t.cursor,filter:{subscriberId:this.options.subscriberId,appId:this.options.applicationId},...this.options.language?{lang:this.options.language}:{}}),this.counts()]).catch(n=>{throw console.log(n),n});return i?{data:i.page,pagination:{continueCursor:i.isDone?null:i.continueCursor,total:o.unread},status:"success",unread:o.unread}:{data:[],pagination:{continueCursor:void 0,total:0},status:"error",unread:0}}async counts(){let[t]=await Promise.all([this.convexClient.query(e.notifications.countUnreadNotifications,{subscriberId:this.options.subscriberId,appId:this.options.applicationId})]);return{unread:t}}async getNotification(t){return this.httpClient.get(`/notifications/${t}`)}async markAsRead(t){return await this.convexClient.mutation(e.notifications.markAsRead,{id:t})}async markAsUnread(t){return this.httpClient.put(`/notifications/${t}/unread`,{})}async markAllAsRead(){return this.convexClient.mutation(e.notifications.markAsReadAll,{subscriberId:this.options.subscriberId})}async archive(t){return this.httpClient.put(`/notifications/${t}/archive`,{})}async unarchive(t){return this.httpClient.put(`/notifications/${t}/unarchive`,{})}on(t){this.#t.push(t)}off(t){this.#t=this.#t.filter(i=>i===t)}};var c=class{#t;#i;#n;constructor(t){this.#t=new d({...t,baseUrl:t.baseUrl||a}),this.#i=new f(t.socketUrl||r),this.#n=new s(this.#t,this.#i,{applicationId:t.applicationId,subscriberId:t.subscriberId,language:t.language})}get notification(){return this.#n}async close(){await this.#i.close()}};export{c as TeknifyClient};
|
@@ -1 +0,0 @@
|
|
1
|
-
export { ConvexClient } from 'convex/browser';
|
@@ -1 +0,0 @@
|
|
1
|
-
import{ConvexClient as n}from"convex/browser";export{n as ConvexClient};
|
package/dist/esm/client/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
import{HttpClient as d}from"@tnf-dev/core";import{ConvexClient as f}from"convex/browser";var a="https://teknify-server.teknix.services",r="https://convex-be.teknix.services";import{anyApi as e}from"convex/server";var s=class{constructor(t,i,o){this.httpClient=t;this.convexClient=i;this.options=o;this.convexClient.onUpdate(e.notifications.listenToNotificationsCount,{subscriberId:this.options.subscriberId,...this.options.language?{}:{}},async({latest:n})=>{if(!n)return;let{unread:u}=await this.counts();this.#t.forEach(l=>l([n],{counts:{unread:u}}))})}#t=[];async getNotifications(t){let[i,o]=await Promise.all([this.convexClient.action(e.notifications.getTranslated,{numItems:t.numItems,cursor:t.cursor,filter:{subscriberId:this.options.subscriberId,appId:this.options.applicationId},...this.options.language?{lang:this.options.language}:{}}),this.counts()]).catch(n=>{throw console.log(n),n});return i?{data:i.page,pagination:{continueCursor:i.isDone?null:i.continueCursor,total:o.unread},status:"success",unread:o.unread}:{data:[],pagination:{continueCursor:void 0,total:0},status:"error",unread:0}}async counts(){let[t]=await Promise.all([this.convexClient.query(e.notifications.countUnreadNotifications,{subscriberId:this.options.subscriberId,appId:this.options.applicationId})]);return{unread:t}}async getNotification(t){return this.httpClient.get(`/notifications/${t}`)}async markAsRead(t){return await this.convexClient.mutation(e.notifications.markAsRead,{id:t})}async markAsUnread(t){return this.httpClient.put(`/notifications/${t}/unread`,{})}async markAllAsRead(){return this.convexClient.mutation(e.notifications.markAsReadAll,{subscriberId:this.options.subscriberId})}async archive(t){return this.httpClient.put(`/notifications/${t}/archive`,{})}async unarchive(t){return this.httpClient.put(`/notifications/${t}/unarchive`,{})}on(t){this.#t.push(t)}off(t){this.#t=this.#t.filter(i=>i===t)}};var c=class{#t;#i;#n;constructor(t){this.#t=new d({...t,baseUrl:t.baseUrl||a}),this.#i=new f(t.socketUrl||r),this.#n=new s(this.#t,this.#i,{applicationId:t.applicationId,subscriberId:t.subscriberId,language:t.language})}get notification(){return this.#n}async close(){await this.#i.close()}};export{c as TeknifyClient};
|
@@ -1,49 +0,0 @@
|
|
1
|
-
import { HttpClient, PaginationRequest, PaginatedResponse, Notification, BaseResponse } from '@tnf-dev/core';
|
2
|
-
import { ConvexClient } from 'convex/browser';
|
3
|
-
|
4
|
-
interface Handler {
|
5
|
-
(updatedNotifications: Notification[], options: {
|
6
|
-
counts: {
|
7
|
-
unread: number;
|
8
|
-
};
|
9
|
-
}): void;
|
10
|
-
}
|
11
|
-
interface GetNotificationParams extends PaginationRequest {
|
12
|
-
}
|
13
|
-
interface GetNotificationsResponse extends PaginatedResponse<Notification> {
|
14
|
-
unread: number;
|
15
|
-
}
|
16
|
-
interface NotificationClientOptions {
|
17
|
-
subscriberId: string;
|
18
|
-
applicationId: string;
|
19
|
-
language?: string;
|
20
|
-
}
|
21
|
-
declare class NotificationClient {
|
22
|
-
#private;
|
23
|
-
private httpClient;
|
24
|
-
private convexClient;
|
25
|
-
private options;
|
26
|
-
constructor(httpClient: HttpClient, convexClient: ConvexClient, options: NotificationClientOptions);
|
27
|
-
getNotifications(params: GetNotificationParams): Promise<GetNotificationsResponse>;
|
28
|
-
counts(): Promise<{
|
29
|
-
unread: any;
|
30
|
-
}>;
|
31
|
-
getNotification(notificationId: string): Promise<BaseResponse<Notification>>;
|
32
|
-
markAsRead(notificationId: string): Promise<BaseResponse<Notification>>;
|
33
|
-
markAsUnread(notificationId: string): Promise<BaseResponse<Notification>>;
|
34
|
-
markAllAsRead(): Promise<BaseResponse<void>>;
|
35
|
-
archive(notificationId: string): Promise<BaseResponse<Notification>>;
|
36
|
-
unarchive(notificationId: string): Promise<BaseResponse<Notification>>;
|
37
|
-
/**
|
38
|
-
* Add listener to notification change
|
39
|
-
* @param handler Handle function
|
40
|
-
*/
|
41
|
-
on(handler: Handler): void;
|
42
|
-
/**
|
43
|
-
* Remove listener to notification change
|
44
|
-
* @param handler Handle function
|
45
|
-
*/
|
46
|
-
off(handler: Handler): void;
|
47
|
-
}
|
48
|
-
|
49
|
-
export { type GetNotificationParams, type GetNotificationsResponse, NotificationClient, type NotificationClientOptions };
|
@@ -1 +0,0 @@
|
|
1
|
-
import{anyApi as s}from"convex/server";var o=class{constructor(t,i,e){this.httpClient=t;this.convexClient=i;this.options=e;this.convexClient.onUpdate(s.notifications.listenToNotificationsCount,{subscriberId:this.options.subscriberId,...this.options.language?{}:{}},async({latest:n})=>{if(!n)return;let{unread:a}=await this.counts();this.#t.forEach(r=>r([n],{counts:{unread:a}}))})}#t=[];async getNotifications(t){let[i,e]=await Promise.all([this.convexClient.action(s.notifications.getTranslated,{numItems:t.numItems,cursor:t.cursor,filter:{subscriberId:this.options.subscriberId,appId:this.options.applicationId},...this.options.language?{lang:this.options.language}:{}}),this.counts()]).catch(n=>{throw console.log(n),n});return i?{data:i.page,pagination:{continueCursor:i.isDone?null:i.continueCursor,total:e.unread},status:"success",unread:e.unread}:{data:[],pagination:{continueCursor:void 0,total:0},status:"error",unread:0}}async counts(){let[t]=await Promise.all([this.convexClient.query(s.notifications.countUnreadNotifications,{subscriberId:this.options.subscriberId,appId:this.options.applicationId})]);return{unread:t}}async getNotification(t){return this.httpClient.get(`/notifications/${t}`)}async markAsRead(t){return await this.convexClient.mutation(s.notifications.markAsRead,{id:t})}async markAsUnread(t){return this.httpClient.put(`/notifications/${t}/unread`,{})}async markAllAsRead(){return this.convexClient.mutation(s.notifications.markAsReadAll,{subscriberId:this.options.subscriberId})}async archive(t){return this.httpClient.put(`/notifications/${t}/archive`,{})}async unarchive(t){return this.httpClient.put(`/notifications/${t}/unarchive`,{})}on(t){this.#t.push(t)}off(t){this.#t=this.#t.filter(i=>i===t)}};export{o as NotificationClient};
|
package/dist/esm/utils/const.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
var e="https://teknify-server.teknix.services",t="https://convex-be.teknix.services";export{e as DEFAULT_BASE_URL,t as DEFAULT_SOCKET_URL};
|
@@ -1 +0,0 @@
|
|
1
|
-
export { DEFAULT_BASE_URL, DEFAULT_SOCKET_URL } from './const.js';
|
package/dist/esm/utils/index.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
var e="https://teknify-server.teknix.services",t="https://convex-be.teknix.services";export{e as DEFAULT_BASE_URL,t as DEFAULT_SOCKET_URL};
|