insite-client 2.3.5 → 2.5.0
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/LICENSE +1 -1
- package/README.md +201 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/package.json +54 -38
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,13 +1,210 @@
|
|
|
1
|
-
#
|
|
1
|
+
# insite-client
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/insite-client)
|
|
4
|
+
|
|
5
|
+
Client-side inSite SDK — WebSocket, auth, subscriptions, file transfers. Single entry point for connecting to an inSite server.
|
|
6
|
+
|
|
7
|
+
Part of [inSite](../../README.md) — built on [insite-ws](../ws/README.md), [insite-cookie](../cookie/README.md), [insite-users-client](../users-client/README.md), [insite-subscriptions-client](../subscriptions-client/README.md), [insite-ws-transfers](../ws-transfers/README.md).
|
|
2
8
|
|
|
3
9
|
## Installation
|
|
4
10
|
|
|
5
11
|
```sh
|
|
6
|
-
|
|
12
|
+
npm install insite-client
|
|
7
13
|
```
|
|
8
14
|
|
|
9
|
-
Or
|
|
15
|
+
Or:
|
|
10
16
|
|
|
11
17
|
```sh
|
|
12
|
-
|
|
18
|
+
bun add insite-client
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { InSite } from "insite-client";
|
|
25
|
+
|
|
26
|
+
// Sync — returns InSite immediately, init runs in background
|
|
27
|
+
const inSite = InSite.init({
|
|
28
|
+
ws: { url: "wss://your-server.example.com" }
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
inSite.on("ready", () => {
|
|
32
|
+
console.log("Connected");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Async — returns Promise that resolves when ready
|
|
36
|
+
const inSite = await InSite.init(
|
|
37
|
+
{ ws: { url: "wss://your-server.example.com" } },
|
|
38
|
+
true
|
|
39
|
+
);
|
|
13
40
|
```
|
|
41
|
+
|
|
42
|
+
## API Reference
|
|
43
|
+
|
|
44
|
+
### Exports
|
|
45
|
+
|
|
46
|
+
| Export | Type | Description |
|
|
47
|
+
|--------|------|-------------|
|
|
48
|
+
| `InSite` | class | Main facade class |
|
|
49
|
+
| `Options<AS>` | type | Client options |
|
|
50
|
+
| `AbilitiesSchema`, `AbilitySchema`, `AbilityParamSchema`, `Abilities`, `ScanAbilitySchemas` | type | From [insite-common](../common/README.md) |
|
|
51
|
+
| `CookieSetter`, `CookieOptions` | class/type | From [insite-cookie](../cookie/README.md) |
|
|
52
|
+
| `Subscription`, `SubscriptionGroup`, `SubscriptionGroupItem`, `SubscriptionArray`, `SubscriptionMap`, `SubscriptionObject`, `SubscriptionMapWithSubscription`, `SubscriptionObjectWithSubscription` | class | From [insite-subscriptions-client](../subscriptions-client/README.md) |
|
|
53
|
+
| `Updated`, `Definition`, `SubscriptionType`, `SubscriptionGroupOptions`, `SubscriptionGroupTarget` | type | From [insite-subscriptions-client](../subscriptions-client/README.md) |
|
|
54
|
+
| `UsersSubscriptionGroup`, `UsersSubscriptionGroupOptions` | class/type | From [insite-users-client](../users-client/README.md) |
|
|
55
|
+
| `CurrentUser`, `Org`, `Orgs`, `OrgsExtended`, `Role`, `Roles`, `User`, `Users`, `UsersExtended` | type | From [insite-users-client](../users-client/README.md) |
|
|
56
|
+
| `IncomingTransport`, `OutgoingTransport`, `IncomingTransfer`, `OutgoingTransfer`, `WithTransfer`, `WithOnTransfer`, `IncomingTransportOptions`, `arrayBufferToBase64` | — | From [insite-ws-transfers](../ws-transfers/README.md) |
|
|
57
|
+
| `WS`, `WSOptions` | class/type | From [insite-ws](../ws/README.md) |
|
|
58
|
+
|
|
59
|
+
### InSite
|
|
60
|
+
|
|
61
|
+
| Member | Description |
|
|
62
|
+
|--------|-------------|
|
|
63
|
+
| `new InSite(options?)` | Constructor, optionally calls `init` |
|
|
64
|
+
| `InSite.init(options?, asPromise?)` | Static factory, returns `InSite` or `Promise<InSite>` |
|
|
65
|
+
| `ws` | WS instance (with `transfer`/`onTransfer` when transports enabled) |
|
|
66
|
+
| `incomingTransport` | IncomingTransport (when `ws.incomingTransport: true`) |
|
|
67
|
+
| `outgoingTransport` | OutgoingTransport (when `ws.outgoingTransport: true`) |
|
|
68
|
+
| `cookie` | CookieSetter (when `cookie` not null) |
|
|
69
|
+
| `usersSubscriptionGroup` | UsersSubscriptionGroup (when `users` + not `public`) |
|
|
70
|
+
| `user` | `CurrentUser \| null` (when `users`) |
|
|
71
|
+
| `users` | `Users \| UsersExtended` |
|
|
72
|
+
| `orgs` | `Orgs \| OrgsExtended` |
|
|
73
|
+
| `roles` | `Roles` |
|
|
74
|
+
| `isLoggedIn` | `boolean` |
|
|
75
|
+
| `login(email, password)` | `Promise` (when `users`) |
|
|
76
|
+
| `logout()` | `Promise` (when `users`) |
|
|
77
|
+
| `isReady` | `boolean` |
|
|
78
|
+
| `whenReady()` | `StatefulPromise<this>` |
|
|
79
|
+
| Events | `ready`, `login`, `logout` |
|
|
80
|
+
|
|
81
|
+
### Options
|
|
82
|
+
|
|
83
|
+
`Options<AS>` where `AS extends AbilitiesSchema`.
|
|
84
|
+
|
|
85
|
+
| Property | Type | Description |
|
|
86
|
+
|----------|------|-------------|
|
|
87
|
+
| `ws` | `WSOptions & { subscriptions?, incomingTransport?, outgoingTransport? }` | WebSocket config. Set `subscriptions: true` for pub/sub. Set `incomingTransport` / `outgoingTransport` for file transfers. |
|
|
88
|
+
| `cookie` | `CookieOptions \| null` | Cookie auth. Use `{}` to enable, `null` to disable. |
|
|
89
|
+
| `users` | `{ abilities?: AS } \| null` | Users/orgs/roles. Use `{}` to enable, `null` to disable. |
|
|
90
|
+
| `public` | `boolean` | When `true` with `users`, only `user` is loaded (no orgs, roles, users list). |
|
|
91
|
+
|
|
92
|
+
### WS
|
|
93
|
+
|
|
94
|
+
WebSocket client with auto-reconnect and request/response.
|
|
95
|
+
|
|
96
|
+
**Properties:** `url`, `name`, `protocols`, `reconnectAfter`, `signal`, `connectionQuality`, `webSocket`, `state`, `isConnecting`, `isOpen`, `isClosed`, `closedWith`
|
|
97
|
+
|
|
98
|
+
**Methods:** `open()`, `close()`, `send()`, `sendMessage()`, `sendRequest()`, `addRequestListener()`, `removeRequestListener()`, `destroy()`
|
|
99
|
+
|
|
100
|
+
**Events:** `connecting`, `open`, `close`, `message`, `message:${kind}`, `error`, `connection-quality-change`, `server-change`, `responsive`, `unresponsive`, `destroy`
|
|
101
|
+
|
|
102
|
+
### CookieSetter
|
|
103
|
+
|
|
104
|
+
Sets auth cookie via XHR when server sends a token.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
constructor(ws: WS, options?: {
|
|
108
|
+
method?: "GET" | "POST";
|
|
109
|
+
url?: string;
|
|
110
|
+
onload?: (this: XMLHttpRequest, event: ProgressEvent) => unknown;
|
|
111
|
+
onerror?: (this: XMLHttpRequest, event: ProgressEvent) => unknown;
|
|
112
|
+
})
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Subscription
|
|
116
|
+
|
|
117
|
+
Low-level subscription to server publications. Use `Subscription.bindTo(ws)` before creating instances.
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
Subscription.bindTo(ws);
|
|
121
|
+
|
|
122
|
+
const sub = new Subscription(
|
|
123
|
+
"object", // type: "array" | "map" | "object"
|
|
124
|
+
"user", // publicationName
|
|
125
|
+
[ true ], // args
|
|
126
|
+
(user) => { ... }, // handler
|
|
127
|
+
true // immediately (default: true)
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
sub.start(); // (re)subscribe
|
|
131
|
+
sub.cancel(); // unsubscribe
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### IncomingTransport
|
|
135
|
+
|
|
136
|
+
Handles incoming file/data transfers. Adds `onTransfer()` and `onceTransfer()` to WS when enabled.
|
|
137
|
+
|
|
138
|
+
**Properties:** `sizeLimit`
|
|
139
|
+
|
|
140
|
+
**Methods:** `on()`, `once()`, `off()`, `addTransferListener()`, `removeTransferListener()`
|
|
141
|
+
|
|
142
|
+
### OutgoingTransport
|
|
143
|
+
|
|
144
|
+
Handles outgoing file/data transfers. Adds `transfer()` to WS when enabled.
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
ws.transfer("avatar", {
|
|
148
|
+
data: file,
|
|
149
|
+
onProgress: (transfer) => { ... },
|
|
150
|
+
onEnd: (transfer) => { ... }
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### UsersSubscriptionGroup
|
|
155
|
+
|
|
156
|
+
Subscription group for users, orgs, roles. Extends `SubscriptionGroup`.
|
|
157
|
+
|
|
158
|
+
**Methods:** `extend()` — load roles and extended user/org data; `unextend()` — detach extended subscriptions
|
|
159
|
+
|
|
160
|
+
## Usage Examples
|
|
161
|
+
|
|
162
|
+
**Minimal — WebSocket only:**
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
InSite.init({ ws: { url: "wss://..." } });
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**With auth (public portal — current user only):**
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
InSite.init({
|
|
172
|
+
ws: { url: "wss://...", subscriptions: true },
|
|
173
|
+
cookie: {},
|
|
174
|
+
users: {},
|
|
175
|
+
public: true
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**With auth (admin — full users/orgs/roles):**
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
InSite.init({
|
|
183
|
+
ws: { url: "wss://...", subscriptions: true },
|
|
184
|
+
cookie: {},
|
|
185
|
+
users: {}
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**With file transfers:**
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
InSite.init({
|
|
193
|
+
ws: {
|
|
194
|
+
url: "wss://...",
|
|
195
|
+
incomingTransport: true,
|
|
196
|
+
outgoingTransport: true
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Use cases:** Public portal — `public: true`, `user` only. Admin panel — `users: {}`, full `UsersSubscriptionGroup`. File uploads — `outgoingTransport: true`, `ws.transfer(kind, props)`.
|
|
202
|
+
|
|
203
|
+
## Related
|
|
204
|
+
|
|
205
|
+
- [insite-server](../server/README.md) — backend this client connects to
|
|
206
|
+
- [insite-ws](../ws/README.md), [insite-cookie](../cookie/README.md), [insite-users-client](../users-client/README.md), [insite-subscriptions-client](../subscriptions-client/README.md), [insite-ws-transfers](../ws-transfers/README.md), [insite-common](../common/README.md)
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
MIT
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x=Object.defineProperty;var m=i=>{throw TypeError(i)};var w=(i,t,s)=>t in i?x(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s;var e=(i,t,s)=>w(i,typeof t!="symbol"?t+"":t,s),b=(i,t,s)=>t.has(i)||m("Cannot "+s);var a=(i,t,s)=>(b(i,t,"read from private field"),s?s.call(i):t.get(i)),d=(i,t,s)=>t.has(i)?m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s);import R from"eventemitter3";import{StatefulPromise as L}from"@nesvet/n";import{CookieSetter as P}from"insite-cookie/client";import{Subscription as O}from"insite-subscriptions-client";import{UsersSubscriptionGroup as T}from"insite-users-client";import{IncomingTransport as A,OutgoingTransport as U}from"insite-ws-transfers/browser";import{WS as W}from"insite-ws/client";function k(i,t){return this.ws.sendRequest("login",i,t)}function v(){return this.ws.sendRequest("logout")}var n,l=class l extends R{constructor(s){super();e(this,"ws");e(this,"incomingTransport");e(this,"outgoingTransport");e(this,"cookie");e(this,"usersSubscriptionGroup");e(this,"user");e(this,"users");e(this,"orgs");e(this,"roles");e(this,"isLoggedIn",!1);e(this,"login");e(this,"logout");e(this,"isReady",!1);d(this,n,new L);s&&this.init(s)}async init(s){if(!this.isReady){let{ws:r={},cookie:o,users:c,public:I}=s??{},{subscriptions:h,incomingTransport:p,outgoingTransport:y,...S}=r;this.ws=new W(S),h!==null&&O.bindTo(this.ws),p&&(this.incomingTransport=new A(this.ws,typeof p=="object"?p:{})),y&&(this.outgoingTransport=new U(this.ws)),o!==null&&(this.cookie=new P(this.ws,o)),c!==null&&h!==null&&o!==null&&(this.user=null,this.login=k,this.logout=v,I?await new Promise(u=>{new O("object","user",[!0],g=>{this.user=g,this.user?this.isLoggedIn||(this.isLoggedIn=!0,this.emit("login",!0)):this.isLoggedIn&&(this.isLoggedIn=!1,this.emit("logout",!1)),this.isReady||u()})}):(this.usersSubscriptionGroup=new T({target:this}),await new Promise(u=>{this.usersSubscriptionGroup.once("init",()=>{this.isLoggedIn=!!this.user,this.usersSubscriptionGroup.on("update.user",g=>{g.valueOf()?this.isLoggedIn||(this.isLoggedIn=!0,this.emit("login",!0)):this.isLoggedIn&&(this.isLoggedIn=!1,this.emit("logout",!1))}),u(),this.isLoggedIn&&this.emit("login",!0)})}))),this.isReady=!0,this.emit("ready",!0),a(this,n).resolve(this)}}whenReady(){return a(this,n)}static init(s,r=!1){let o=new l(s);return r?o.whenReady():o}};n=new WeakMap;var f=l;export*from"insite-common/frontend";export*from"insite-cookie/client";export*from"insite-subscriptions-client";export*from"insite-users-client";export*from"insite-ws-transfers/browser";export*from"insite-ws/client";export{f as InSite};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/InSite.ts", "
|
|
4
|
-
"sourcesContent": ["import EventEmitter from \"eventemitter3\";\nimport { StatefulPromise } from \"@nesvet/n\";\nimport type { AbilitiesSchema } from \"insite-common\";\nimport { CookieSetter } from \"insite-cookie/client\";\nimport { Subscription } from \"insite-subscriptions-client\";\nimport {\n\tUsersSubscriptionGroup,\n\ttype CurrentUser,\n\ttype Orgs,\n\ttype OrgsExtended,\n\ttype Roles,\n\ttype Users,\n\ttype UsersExtended\n} from \"insite-users-client\";\nimport { IncomingTransport, OutgoingTransport } from \"insite-ws-transfers/browser\";\nimport { WS } from \"insite-ws/client\";\nimport type { OmitRedundant, Options, WSWithActualProps } from \"./types\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\n/** @this InSite */\nfunction login<O extends Options<any>>(this: InSite<O>, email: string, password: string) {\n\treturn this.ws.sendRequest(\"login\", email, password);\n}\n\n/** @this InSite */\nfunction logout<O extends Options<any>>(this: InSite<O>) {\n\treturn this.ws.sendRequest(\"logout\");\n}\n\n\nexport class InSite<\n\tO extends Options<any>,\n\tAS extends AbilitiesSchema = O extends Options<infer A> ? A : never\n> extends EventEmitter {\n\tconstructor(options?: O) {\n\t\tsuper();\n\t\t\n\t\tif (options)\n\t\t\tvoid this.init(options);\n\t\t\n\t}\n\t\n\tws!: WSWithActualProps<O>;\n\tincomingTransport!: IncomingTransport;\n\toutgoingTransport!: OutgoingTransport;\n\tcookie!: CookieSetter;\n\tusersSubscriptionGroup!: UsersSubscriptionGroup;\n\tuser!: CurrentUser<AS> | null;\n\tusers!: Users | UsersExtended;\n\torgs!: Orgs | OrgsExtended;\n\troles!: Roles;\n\tisLoggedIn = false;\n\t\n\tlogin!: typeof login<O>;\n\tlogout!: typeof logout<O>;\n\t\n\tisReady = false;\n\t\n\tprotected async init(options?: O) {\n\t\t\n\t\tif (!this.isReady) {\n\t\t\tconst {\n\t\t\t\tws: wsWithOtherOptions = {},\n\t\t\t\tcookie: cookieOptions,\n\t\t\t\tusers,\n\t\t\t\tpublic: isPublic\n\t\t\t} = options ?? {};\n\t\t\t\n\t\t\tconst {\n\t\t\t\tsubscriptions,\n\t\t\t\tincomingTransport,\n\t\t\t\toutgoingTransport,\n\t\t\t\t...wsOptions\n\t\t\t} = wsWithOtherOptions;\n\t\t\t\n\t\t\tthis.ws = new WS(wsOptions) as WSWithActualProps<O>;\n\t\t\t\n\t\t\tif (subscriptions !== null)\n\t\t\t\tSubscription.bindTo(this.ws);\n\t\t\t\n\t\t\tif (incomingTransport)\n\t\t\t\tthis.incomingTransport = new IncomingTransport(this.ws, typeof incomingTransport == \"object\" ? incomingTransport : {});\n\t\t\t\n\t\t\tif (outgoingTransport)\n\t\t\t\tthis.outgoingTransport = new OutgoingTransport(this.ws);\n\t\t\t\n\t\t\tif (cookieOptions !== null)\n\t\t\t\tthis.cookie = new CookieSetter(this.ws, cookieOptions);\n\t\t\t\n\t\t\tif (users !== null && subscriptions !== null && cookieOptions !== null) {\n\t\t\t\tthis.user = null;\n\t\t\t\tthis.login = login<O>;\n\t\t\t\tthis.logout = logout<O>;\n\t\t\t\t\n\t\t\t\tif (isPublic)\n\t\t\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\t\t\t\n\t\t\t\t\t\tnew Subscription(\"object\", \"user\", [ true ], user => {\n\t\t\t\t\t\t\tthis.user = user;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (this.user) {\n\t\t\t\t\t\t\t\tif (!this.isLoggedIn) {\n\t\t\t\t\t\t\t\t\tthis.isLoggedIn = true;\n\t\t\t\t\t\t\t\t\tthis.emit(\"login\", true);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (this.isLoggedIn) {\n\t\t\t\t\t\t\t\tthis.isLoggedIn = false;\n\t\t\t\t\t\t\t\tthis.emit(\"logout\", false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (!this.isReady)\n\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\telse {\n\t\t\t\t\tthis.usersSubscriptionGroup = new UsersSubscriptionGroup({ target: this });\n\t\t\t\t\t\n\t\t\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis.usersSubscriptionGroup.once(\"init\", () => {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tthis.isLoggedIn = !!this.user;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tthis.usersSubscriptionGroup.on(\"update.user\", (user: CurrentUser) => {\n\t\t\t\t\t\t\t\tif (user.valueOf()) {\n\t\t\t\t\t\t\t\t\tif (!this.isLoggedIn) {\n\t\t\t\t\t\t\t\t\t\tthis.isLoggedIn = true;\n\t\t\t\t\t\t\t\t\t\tthis.emit(\"login\", true);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (this.isLoggedIn) {\n\t\t\t\t\t\t\t\t\tthis.isLoggedIn = false;\n\t\t\t\t\t\t\t\t\tthis.emit(\"logout\", false);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (this.isLoggedIn)\n\t\t\t\t\t\t\t\tthis.emit(\"login\", true);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tthis.isReady = true;\n\t\t\tthis.emit(\"ready\", true);\n\t\t\t\n\t\t\tthis.#initPromise.resolve(this);\n\t\t}\n\t\t\n\t}\n\t\n\t#initPromise = new StatefulPromise<this>();\n\t\n\twhenReady() {\n\t\treturn this.#initPromise;\n\t}\n\t\n\t\n\tstatic init<IO extends Options<any>, IS extends InSite<IO>>(options: IO, asPromise: true): Promise<OmitRedundant<IS, IO>>;\n\tstatic init<IO extends Options<any>, IS extends InSite<IO>>(options?: IO, asPromise?: false): OmitRedundant<IS, IO>;\n\tstatic init<IO extends Options<any>, IS extends InSite<IO>>(options?: IO, asPromise = false) {\n\t\tconst inSite = new InSite(options) as IS;\n\t\t\n\t\treturn asPromise ?\n\t\t\tinSite.whenReady() :\n\t\t\tinSite;\n\t}\n\t\n}\n", "export function noop() { /**/ }\n", "/* eslint-disable @typescript-eslint/no-explicit-any */\n\ntype Value<T> = PromiseLike<T> | T;\ntype Resolve<T> = (value: Value<T>) => void;\ntype Reject = (reason?: any) => void;\n\ntype Options = {\n\tsignal?: AbortSignal;\n\ttimeout?: number;\n};\n\nconst nativesMap = new WeakMap<StatefulPromise<any>, { resolve: Resolve<any>; reject: Reject }>();\n\n\nexport class StatefulPromise<T> extends Promise<T> {\n\tconstructor(\n\t\texecutor?: (resolve: Resolve<T>, reject: Reject) => void,\n\t\toptions?: Options\n\t) {\n\t\tlet nativeResolve: Resolve<T>;\n\t\tlet nativeReject: Reject;\n\t\t\n\t\tsuper((resolve, reject) => {\n\t\t\tnativeResolve = resolve;\n\t\t\tnativeReject = reject;\n\t\t\t\n\t\t});\n\t\t\n\t\tnativesMap.set(this, { resolve: nativeResolve!, reject: nativeReject! });\n\t\t\n\t\tif (options?.signal)\n\t\t\tif (options.signal.aborted)\n\t\t\t\tthis.reject(new DOMException(\"Aborted\", \"AbortError\"));\n\t\t\telse {\n\t\t\t\tconst abortListener = () => this.reject(new DOMException(\"Aborted\", \"AbortError\"));\n\t\t\t\t\n\t\t\t\toptions.signal.addEventListener(\"abort\", abortListener);\n\t\t\t\t\n\t\t\t\tthis.finally(() => options.signal?.removeEventListener(\"abort\", abortListener));\n\t\t\t}\n\t\t\n\t\tif (typeof options?.timeout === \"number\" && Number.isFinite(options.timeout)) {\n\t\t\tconst timeout = setTimeout(() => this.reject(new DOMException(\"Timeout exceeded\", \"TimeoutError\")), options.timeout);\n\t\t\t\n\t\t\tthis.finally(() => clearTimeout(timeout));\n\t\t}\n\t\t\n\t\texecutor?.(this.resolve, this.reject);\n\t\t\n\t}\n\t\n\tisPending = true;\n\tisFulfilled = false;\n\tisRejected = false;\n\t\n\tstate: \"fulfilled\" | \"pending\" | \"rejected\" = \"pending\";\n\t\n\tresult?: T | unknown;\n\t\n\treadonly resolve = (value: Value<T>) => {\n\t\t\n\t\tif (this.isPending) {\n\t\t\tthis.isPending = false;\n\t\t\tthis.isFulfilled = true;\n\t\t\tthis.state = \"fulfilled\";\n\t\t\tthis.result = value;\n\t\t\t\n\t\t\tconst native = nativesMap.get(this);\n\t\t\t\n\t\t\tif (native) {\n\t\t\t\tnative.resolve.call(this, value);\n\t\t\t\tnativesMap.delete(this);\n\t\t\t}\n\t\t}\n\t\t\n\t};\n\t\n\treadonly reject = (reason?: any) => {\n\t\t\n\t\tif (this.isPending) {\n\t\t\tthis.isPending = false;\n\t\t\tthis.isRejected = true;\n\t\t\tthis.state = \"rejected\";\n\t\t\tthis.result = reason;\n\t\t\t\n\t\t\tconst native = nativesMap.get(this);\n\t\t\t\n\t\t\tif (native) {\n\t\t\t\tnative.reject.call(this, reason);\n\t\t\t\tnativesMap.delete(this);\n\t\t\t}\n\t\t}\n\t\t\n\t};\n\t\n\t\n\tstatic resolved<U>(value: U): StatefulPromise<U> {\n\t\treturn new StatefulPromise<U>(resolve => resolve(value));\n\t}\n\t\n\tstatic rejected(reason: unknown): StatefulPromise<never> {\n\t\treturn new StatefulPromise((_, reject) => reject(reason));\n\t}\n\t\n}\n", "import { noop } from \"./noop.js\";\nimport { StatefulPromise } from \"./StatefulPromise.js\";\n\n\ntype Callback = (...args: any[]) => unknown;// eslint-disable-line @typescript-eslint/no-explicit-any\ntype FunctionOrBoolean = (() => unknown) | boolean;\ntype Options = { leading?: FunctionOrBoolean; maxWait?: number; trailing?: FunctionOrBoolean };\n\ntype DebouncedFunction<C extends Callback> = {\n\t(this: ThisParameterType<C>, ...args: Parameters<C>): Promise<Awaited<ReturnType<C>>>;\n};\n\nexport type Debounced<C extends Callback, R extends ReturnType<C>> = DebouncedFunction<C> & {\n\tcallback: C;\n\tpromise: StatefulPromise<R>;\n\tresolve: (value: R) => void;\n\treject: (reason?: unknown) => void;\n\trun(): Promise<R>;\n\tclear(shouldRun?: boolean): Promise<void>;\n};\n\n\nexport function debounce<C extends Callback, R extends ReturnType<C>>(callback: C, limit = 0, options: Options = {}) {\n\tlet { leading = false, trailing = true } = options;\n\tconst { maxWait = Infinity } = options;\n\t\n\tlet timeout: ReturnType<typeof setTimeout> | undefined;\n\tlet maxWaitTimeout: ReturnType<typeof setTimeout> | undefined;\n\tlet end: number | undefined;\n\tlet context: ThisParameterType<C>;\n\tlet args: unknown[];\n\tlet initial: FunctionOrBoolean;\n\tlet final: FunctionOrBoolean;\n\tlet result: R;\n\t\n\tconst expired = async () => {\n\t\t\n\t\tconst n = Date.now();\n\t\t\n\t\tif (n >= end!) {\n\t\t\ttimeout = undefined;\n\t\t\tend = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tmaxWaitTimeout = undefined;\n\t\t\t\n\t\t\tif (typeof final == \"function\")\n\t\t\t\tawait final();\n\t\t\t\n\t\t\tdebounced.resolve(result);\n\t\t\t\n\t\t\tinitial = leading;\n\t\t} else {\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = setTimeout(expired, end! - n);\n\t\t}\n\t\t\n\t};\n\t\n\tconst maxWaitExpired = Number.isFinite(maxWait) ? () => {\n\t\t\n\t\tif (final === run)\n\t\t\tfinal = false;\n\t\t\n\t\trun();\n\t\t\n\t\tmaxWaitTimeout = setTimeout(maxWaitExpired as TimerHandler, maxWait);\n\t\t\n\t} : null;\n\t\n\tasync function run() {\n\t\ttry {\n\t\t\tresult = await callback.apply(context, args) as R;\n\t\t\t\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tdebounced.reject(error);\n\t\t\t\n\t\t\tthrow error;\n\t\t}\n\t}\n\t\n\tif (leading && typeof leading == \"boolean\")\n\t\tleading = run;\n\tinitial = leading;\n\t\n\tif (trailing && typeof trailing == \"boolean\")\n\t\ttrailing = run;\n\tfinal = trailing;\n\t\n\tconst debounced: Debounced<C, R> = Object.assign(function (..._args) {\n\t\targs = _args;\n\t\tcontext = this;// eslint-disable-line no-invalid-this\n\t\t\n\t\tend = Date.now() + limit;\n\t\tfinal = trailing;\n\t\t\n\t\tif (!debounced.promise.isPending)\n\t\t\tdebounced.promise = new StatefulPromise<R>((resolve, reject) => {\n\t\t\t\tdebounced.resolve = resolve;\n\t\t\t\tdebounced.reject = reject;\n\t\t\t\t\n\t\t\t\tif (typeof initial == \"function\") {\n\t\t\t\t\tinitial();\n\t\t\t\t\t\n\t\t\t\t\tinitial = false;\n\t\t\t\t\t\n\t\t\t\t\tif (final === run)\n\t\t\t\t\t\tfinal = false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!timeout) {\n\t\t\t\t\ttimeout = setTimeout(expired, limit);\n\t\t\t\t\t\n\t\t\t\t\tif (maxWaitExpired)\n\t\t\t\t\t\tmaxWaitTimeout = setTimeout(maxWaitExpired, maxWait);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t});\n\t\t\n\t\treturn debounced.promise;\n\t} as DebouncedFunction<C>, {\n\t\tcallback,\n\t\tpromise: StatefulPromise.resolved(undefined as unknown as R),\n\t\tresolve: noop,\n\t\treject: noop,\n\t\trun,\n\t\tclear: async (shouldRun?: boolean) => {\n\t\t\t\n\t\t\tclearTimeout(timeout);\n\t\t\ttimeout = undefined;\n\t\t\t\n\t\t\tclearTimeout(maxWaitTimeout);\n\t\t\tmaxWaitTimeout = undefined;\n\t\t\t\n\t\t\tdebounced.resolve(shouldRun ? await run() : result);\n\t\t\t\n\t\t}\n\t});\n\t\n\treturn debounced;\n}\n\n\ndebounce.noop = Object.assign(() => { /**/ }, {\n\tcallback: noop,\n\tpromise: StatefulPromise.resolved(undefined), // eslint-disable-line unicorn/no-useless-undefined\n\tresolve: noop,\n\treject: noop,\n\trun: noop,\n\tclear: noop\n}) as Debounced<() => void, void>;\n\n\nexport function throttle(callback: Callback, limit?: number, options?: Options) {\n\treturn debounce(callback, limit, {\n\t\tmaxWait: limit,\n\t\tleading: true,\n\t\ttrailing: true,\n\t\t...options\n\t});\n}\n", "export function howmuch(number: [] | number, one: string, two: string, five: boolean | string, shouldPrintNumber = true) {\n\tif (Array.isArray(number))\n\t\tnumber = number.length;\n\t\n\tif (typeof five != \"string\") {\n\t\tshouldPrintNumber = five ?? true;\n\t\tfive = two;\n\t}\n\t\n\t\n\treturn (shouldPrintNumber ? `${number}\u00A0` : \"\") + howmuch.raw(number, one, two, five);\n}\n\nhowmuch.raw = (number: number, one: string, two: string, five = two) => {\n\tnumber = Math.abs(number);\n\tconst u = number % 10;\n\tconst d = number % 100;\n\t\n\treturn (\n\t\t(u === 1 && d !== 11) ?\n\t\t\tone :\n\t\t\t((u >= 2 && u <= 4) && !(d >= 12 && d <= 15)) ?\n\t\t\t\ttwo :\n\t\t\t\tfive\n\t);\n};\n", "export * from \"./InSite\";\nexport type { Options } from \"./types\";\nexport * from \"insite-common/frontend\";\nexport type { Options as CookieOptions } from \"insite-cookie/client\";\nexport * from \"insite-cookie/client\";\nexport * from \"insite-subscriptions-client\";\nexport * from \"insite-users-client\";\nexport * from \"insite-ws-transfers/browser\";\nexport type { Options as WSOptions } from \"insite-ws/client\";\nexport * from \"insite-ws/client\";\n"],
|
|
5
|
-
"mappings": "iaAAA,OAAOA,MAAkB,
|
|
6
|
-
"names": ["EventEmitter", "
|
|
3
|
+
"sources": ["../src/InSite.ts", "../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import EventEmitter from \"eventemitter3\";\nimport { StatefulPromise } from \"@nesvet/n\";\nimport type { AbilitiesSchema } from \"insite-common\";\nimport { CookieSetter } from \"insite-cookie/client\";\nimport { Subscription } from \"insite-subscriptions-client\";\nimport {\n\tUsersSubscriptionGroup,\n\ttype CurrentUser,\n\ttype Orgs,\n\ttype OrgsExtended,\n\ttype Roles,\n\ttype Users,\n\ttype UsersExtended\n} from \"insite-users-client\";\nimport { IncomingTransport, OutgoingTransport } from \"insite-ws-transfers/browser\";\nimport { WS } from \"insite-ws/client\";\nimport type { OmitRedundant, Options, WSWithActualProps } from \"./types\";\n\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n\n/** @this InSite */\nfunction login<O extends Options<any>>(this: InSite<O>, email: string, password: string) {\n\treturn this.ws.sendRequest(\"login\", email, password);\n}\n\n/** @this InSite */\nfunction logout<O extends Options<any>>(this: InSite<O>) {\n\treturn this.ws.sendRequest(\"logout\");\n}\n\n\nexport class InSite<\n\tO extends Options<any>,\n\tAS extends AbilitiesSchema = O extends Options<infer A> ? A : never\n> extends EventEmitter {\n\tconstructor(options?: O) {\n\t\tsuper();\n\t\t\n\t\tif (options)\n\t\t\tvoid this.init(options);\n\t\t\n\t}\n\t\n\tws!: WSWithActualProps<O>;\n\tincomingTransport!: IncomingTransport;\n\toutgoingTransport!: OutgoingTransport;\n\tcookie!: CookieSetter;\n\tusersSubscriptionGroup!: UsersSubscriptionGroup;\n\tuser!: CurrentUser<AS> | null;\n\tusers!: Users | UsersExtended;\n\torgs!: Orgs | OrgsExtended;\n\troles!: Roles;\n\tisLoggedIn = false;\n\t\n\tlogin!: typeof login<O>;\n\tlogout!: typeof logout<O>;\n\t\n\tisReady = false;\n\t\n\tprotected async init(options?: O) {\n\t\t\n\t\tif (!this.isReady) {\n\t\t\tconst {\n\t\t\t\tws: wsWithOtherOptions = {},\n\t\t\t\tcookie: cookieOptions,\n\t\t\t\tusers,\n\t\t\t\tpublic: isPublic\n\t\t\t} = options ?? {};\n\t\t\t\n\t\t\tconst {\n\t\t\t\tsubscriptions,\n\t\t\t\tincomingTransport,\n\t\t\t\toutgoingTransport,\n\t\t\t\t...wsOptions\n\t\t\t} = wsWithOtherOptions;\n\t\t\t\n\t\t\tthis.ws = new WS(wsOptions) as WSWithActualProps<O>;\n\t\t\t\n\t\t\tif (subscriptions !== null)\n\t\t\t\tSubscription.bindTo(this.ws);\n\t\t\t\n\t\t\tif (incomingTransport)\n\t\t\t\tthis.incomingTransport = new IncomingTransport(this.ws, typeof incomingTransport == \"object\" ? incomingTransport : {});\n\t\t\t\n\t\t\tif (outgoingTransport)\n\t\t\t\tthis.outgoingTransport = new OutgoingTransport(this.ws);\n\t\t\t\n\t\t\tif (cookieOptions !== null)\n\t\t\t\tthis.cookie = new CookieSetter(this.ws, cookieOptions);\n\t\t\t\n\t\t\tif (users !== null && subscriptions !== null && cookieOptions !== null) {\n\t\t\t\tthis.user = null;\n\t\t\t\tthis.login = login<O>;\n\t\t\t\tthis.logout = logout<O>;\n\t\t\t\t\n\t\t\t\tif (isPublic)\n\t\t\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\t\t\t\n\t\t\t\t\t\tnew Subscription(\"object\", \"user\", [ true ], user => {\n\t\t\t\t\t\t\tthis.user = user;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (this.user) {\n\t\t\t\t\t\t\t\tif (!this.isLoggedIn) {\n\t\t\t\t\t\t\t\t\tthis.isLoggedIn = true;\n\t\t\t\t\t\t\t\t\tthis.emit(\"login\", true);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (this.isLoggedIn) {\n\t\t\t\t\t\t\t\tthis.isLoggedIn = false;\n\t\t\t\t\t\t\t\tthis.emit(\"logout\", false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (!this.isReady)\n\t\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\telse {\n\t\t\t\t\tthis.usersSubscriptionGroup = new UsersSubscriptionGroup({ target: this });\n\t\t\t\t\t\n\t\t\t\t\tawait new Promise<void>(resolve => {\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis.usersSubscriptionGroup.once(\"init\", () => {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tthis.isLoggedIn = !!this.user;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tthis.usersSubscriptionGroup.on(\"update.user\", (user: CurrentUser) => {\n\t\t\t\t\t\t\t\tif (user.valueOf()) {\n\t\t\t\t\t\t\t\t\tif (!this.isLoggedIn) {\n\t\t\t\t\t\t\t\t\t\tthis.isLoggedIn = true;\n\t\t\t\t\t\t\t\t\t\tthis.emit(\"login\", true);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (this.isLoggedIn) {\n\t\t\t\t\t\t\t\t\tthis.isLoggedIn = false;\n\t\t\t\t\t\t\t\t\tthis.emit(\"logout\", false);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (this.isLoggedIn)\n\t\t\t\t\t\t\t\tthis.emit(\"login\", true);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tthis.isReady = true;\n\t\t\tthis.emit(\"ready\", true);\n\t\t\t\n\t\t\tthis.#initPromise.resolve(this);\n\t\t}\n\t\t\n\t}\n\t\n\t#initPromise = new StatefulPromise<this>();\n\t\n\twhenReady() {\n\t\treturn this.#initPromise;\n\t}\n\t\n\t\n\tstatic init<IO extends Options<any>, IS extends InSite<IO>>(options: IO, asPromise: true): Promise<OmitRedundant<IS, IO>>;\n\tstatic init<IO extends Options<any>, IS extends InSite<IO>>(options?: IO, asPromise?: false): OmitRedundant<IS, IO>;\n\tstatic init<IO extends Options<any>, IS extends InSite<IO>>(options?: IO, asPromise = false) {\n\t\tconst inSite = new InSite(options) as IS;\n\t\t\n\t\treturn asPromise ?\n\t\t\tinSite.whenReady() :\n\t\t\tinSite;\n\t}\n\t\n}\n", "export * from \"./InSite\";\nexport type { Options } from \"./types\";\nexport * from \"insite-common/frontend\";\nexport type { Options as CookieOptions } from \"insite-cookie/client\";\nexport * from \"insite-cookie/client\";\nexport * from \"insite-subscriptions-client\";\nexport * from \"insite-users-client\";\nexport * from \"insite-ws-transfers/browser\";\nexport type { Options as WSOptions } from \"insite-ws/client\";\nexport * from \"insite-ws/client\";\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["EventEmitter", "StatefulPromise", "CookieSetter", "Subscription", "UsersSubscriptionGroup", "IncomingTransport", "OutgoingTransport", "WS", "login", "email", "password", "logout", "_initPromise", "_InSite", "EventEmitter", "options", "__publicField", "__privateAdd", "StatefulPromise", "wsWithOtherOptions", "cookieOptions", "users", "isPublic", "subscriptions", "incomingTransport", "outgoingTransport", "wsOptions", "WS", "Subscription", "IncomingTransport", "OutgoingTransport", "CookieSetter", "resolve", "user", "UsersSubscriptionGroup", "__privateGet", "asPromise", "inSite", "InSite"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
"name": "insite-client",
|
|
3
|
+
"version": "2.5.0",
|
|
4
|
+
"description": "Client-side inSite SDK — WebSocket, auth, subscriptions, file transfers",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"insite",
|
|
7
|
+
"sdk",
|
|
8
|
+
"client",
|
|
9
|
+
"websocket",
|
|
10
|
+
"auth",
|
|
11
|
+
"subscriptions"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/nesvet/insite#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/nesvet/insite/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/nesvet/insite.git",
|
|
20
|
+
"directory": "packages/client"
|
|
21
|
+
},
|
|
22
|
+
"funding": {
|
|
23
|
+
"type": "patreon",
|
|
24
|
+
"url": "https://www.patreon.com/nesvet"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"author": "Eugene Nesvetaev <dev@nesvet.dev> (https://nesvet.dev/)",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"module": "./dist/index.js",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "bun .conveyer.js",
|
|
38
|
+
"postbuild": "tsc -p .",
|
|
39
|
+
"clean": "rm -rf dist",
|
|
40
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
41
|
+
"typecheck": "tsc --noEmit"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@nesvet/n": "^1.2.1",
|
|
45
|
+
"eventemitter3": "^5.0.4",
|
|
46
|
+
"insite-common": "^2.5.0",
|
|
47
|
+
"insite-cookie": "^2.5.0",
|
|
48
|
+
"insite-subscriptions-client": "^2.5.0",
|
|
49
|
+
"insite-users-client": "^2.5.0",
|
|
50
|
+
"insite-ws": "^2.5.0",
|
|
51
|
+
"insite-ws-transfers": "^2.5.0"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=20.0.0"
|
|
55
|
+
}
|
|
40
56
|
}
|