viasocket-apps 0.5.0 → 0.6.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/README.md +3 -0
- package/dist/cjs/browser.js +2 -0
- package/dist/esm/browser.d.ts +7 -0
- package/dist/esm/browser.js +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -104,6 +104,9 @@ import { connect } from 'viasocket-apps/browser'
|
|
|
104
104
|
// for their scopes; skipActionSelection goes straight to the app's consent screen.
|
|
105
105
|
const { authId } = await connect({ embedToken, serviceId: 'rowbu58rc', actions: ['<action_id>'], skipActionSelection: true })
|
|
106
106
|
// Send authId to your backend, which enables the app and stores the script_id.
|
|
107
|
+
|
|
108
|
+
// When user.listConnections() shows a connection with isExpired: true, sign in to it again:
|
|
109
|
+
await connect({ embedToken, serviceId: 'rowbu58rc', authId }) // updates it in place; resolves with the same authId
|
|
107
110
|
```
|
|
108
111
|
|
|
109
112
|
`serviceId` is the app's `service_id` exactly as the catalog returns it — a bare id such as
|
package/dist/cjs/browser.js
CHANGED
|
@@ -144,6 +144,8 @@ async function connect(options) {
|
|
|
144
144
|
scriptOptions.filteredActions = options.actions;
|
|
145
145
|
if (options.skipActionSelection)
|
|
146
146
|
scriptOptions.skipActionSelection = true;
|
|
147
|
+
if (options.authId)
|
|
148
|
+
scriptOptions.authId = options.authId;
|
|
147
149
|
if (Object.keys(scriptOptions).length)
|
|
148
150
|
open(options.embedToken, serviceId, scriptOptions);
|
|
149
151
|
else
|
package/dist/esm/browser.d.ts
CHANGED
|
@@ -50,6 +50,12 @@ export interface ConnectOptions {
|
|
|
50
50
|
actions?: string[];
|
|
51
51
|
/** With `actions`: skip the action list and open the app's consent screen directly. */
|
|
52
52
|
skipActionSelection?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* An existing connection's `authId`, to sign in to it again — when it has expired (`isExpired` in
|
|
55
|
+
* `user.listConnections()`), or to grant scopes it lacks. The popup updates that connection in
|
|
56
|
+
* place and resolves with the same `authId`, so nothing stored against it changes.
|
|
57
|
+
*/
|
|
58
|
+
authId?: string;
|
|
53
59
|
/**
|
|
54
60
|
* Called if the connection completes after `connect()` already rejected with `'closed'` — the
|
|
55
61
|
* close was inferred while the user was still on the app's sign-in page. Treat it exactly like
|
|
@@ -67,6 +73,7 @@ export interface ConnectOptions {
|
|
|
67
73
|
interface ConnectScriptOptions {
|
|
68
74
|
filteredActions?: string[];
|
|
69
75
|
skipActionSelection?: boolean;
|
|
76
|
+
authId?: string;
|
|
70
77
|
}
|
|
71
78
|
export interface ConnectResult {
|
|
72
79
|
/** The connection. Every later call for this app takes it as auth_id. */
|
package/dist/esm/browser.js
CHANGED
|
@@ -138,6 +138,8 @@ export async function connect(options) {
|
|
|
138
138
|
scriptOptions.filteredActions = options.actions;
|
|
139
139
|
if (options.skipActionSelection)
|
|
140
140
|
scriptOptions.skipActionSelection = true;
|
|
141
|
+
if (options.authId)
|
|
142
|
+
scriptOptions.authId = options.authId;
|
|
141
143
|
if (Object.keys(scriptOptions).length)
|
|
142
144
|
open(options.embedToken, serviceId, scriptOptions);
|
|
143
145
|
else
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viasocket-apps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Server-side client for the viaSocket Apps API: let your users connect Slack, GitHub, Google Sheets or any of 2,300+ apps from your own product, then run actions and receive events through one API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"viasocket",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsc -p tsconfig.esm.json && tsc -p tsconfig.cjs.json && node scripts/finish-build.mjs",
|
|
50
|
-
"test": "npm run build && node --test test/token.test.mjs test/client.test.mjs",
|
|
50
|
+
"test": "npm run build && node --test test/token.test.mjs test/client.test.mjs test/browser.test.mjs",
|
|
51
51
|
"prepublishOnly": "npm test"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|