@paddockai/client 0.0.3 → 0.0.5
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 +202 -0
- package/dist/index.cjs +17 -10
- package/dist/index.d.cts +478 -433
- package/dist/index.d.ts +478 -433
- package/dist/index.js +17 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,8 +11,10 @@ var streamEventNames = [
|
|
|
11
11
|
"config.applied",
|
|
12
12
|
"session.status",
|
|
13
13
|
"outbox.queued",
|
|
14
|
+
"outbox.retrying",
|
|
14
15
|
"outbox.delivered",
|
|
15
16
|
"outbox.failed",
|
|
17
|
+
"inbox.failed",
|
|
16
18
|
"status.update",
|
|
17
19
|
"error"
|
|
18
20
|
];
|
|
@@ -512,9 +514,12 @@ var SessionOperations = class {
|
|
|
512
514
|
get base() {
|
|
513
515
|
return `/sessions/${segment(this.id)}`;
|
|
514
516
|
}
|
|
515
|
-
/**
|
|
516
|
-
|
|
517
|
-
|
|
517
|
+
/**
|
|
518
|
+
* Stores a user message; resolves with its event once stored (004#messages). author, the person
|
|
519
|
+
* the message speaks for, is allowed with an API key or a function token, never a session token.
|
|
520
|
+
*/
|
|
521
|
+
send(text, options = {}) {
|
|
522
|
+
return this.transport.request({ method: "POST", path: `${this.base}/messages`, json: { text, ...options } });
|
|
518
523
|
}
|
|
519
524
|
/** Stores a stop.requested event and resolves with it. */
|
|
520
525
|
stop() {
|
|
@@ -524,13 +529,15 @@ var SessionOperations = class {
|
|
|
524
529
|
stream(options = {}) {
|
|
525
530
|
return new EventStream(this.transport, `${this.base}/stream`, options);
|
|
526
531
|
}
|
|
527
|
-
/**
|
|
532
|
+
/**
|
|
533
|
+
* Mints a session token for the browser: ttl in seconds; participant authors the token's
|
|
534
|
+
* messages; readOnly makes a token that can only read and follow the session (004#credentials).
|
|
535
|
+
*/
|
|
528
536
|
createToken(options) {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
});
|
|
537
|
+
const json = { ttlSeconds: options.ttl };
|
|
538
|
+
if (options.participant) json.participant = options.participant;
|
|
539
|
+
if (options.readOnly) json.readOnly = true;
|
|
540
|
+
return this.transport.request({ method: "POST", path: `${this.base}/tokens`, json });
|
|
534
541
|
}
|
|
535
542
|
/** Reads the session. */
|
|
536
543
|
get() {
|
|
@@ -677,7 +684,7 @@ var SessionFold = class {
|
|
|
677
684
|
};
|
|
678
685
|
|
|
679
686
|
// src/version.ts
|
|
680
|
-
var version = "0.0.
|
|
687
|
+
var version = "0.0.5";
|
|
681
688
|
|
|
682
689
|
// src/client.ts
|
|
683
690
|
var loadPage = 200;
|