@hibira-io/piece-hibira 0.1.1 → 0.2.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 +1 -0
- package/dist/src/i18n/translation.json +27 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -0
- package/dist/src/lib/actions/get-approval.d.ts +12 -0
- package/dist/src/lib/actions/get-approval.d.ts.map +1 -0
- package/dist/src/lib/actions/get-approval.js +33 -0
- package/dist/src/lib/actions/request-approval.d.ts +19 -0
- package/dist/src/lib/actions/request-approval.d.ts.map +1 -0
- package/dist/src/lib/actions/request-approval.js +85 -0
- package/dist/src/lib/common/approvals.d.ts +18 -0
- package/dist/src/lib/common/approvals.d.ts.map +1 -0
- package/dist/src/lib/common/approvals.js +30 -0
- package/dist/src/lib/common/client.d.ts +2 -1
- package/dist/src/lib/common/client.d.ts.map +1 -1
- package/dist/src/lib/common/client.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ The connection is checked with a signed request when you save it.
|
|
|
30
30
|
- **List Occupied Channels**, **Get Channel**, **Get Users in Presence Channel** (pages through `presence-large-` channels).
|
|
31
31
|
- **Disconnect User**: close every connection of a signed-in user.
|
|
32
32
|
- **Send Push Notification to Interests**, **Send Push Notification to Users**, **Delete Push User**.
|
|
33
|
+
- **Request Approval**, **Get Approval**: ask a person to approve or choose (2 to 4 choices, the first approves) through a Hibira-hosted answer link, optionally delivered by push or announced on a channel for the `@hibira-io/approvals` inbox. Request Approval can wait up to 9 minutes for the answer and returns `status` (`approved`, `rejected`, `pending`, `expired`) and `choice`; for longer waits, send the link and check later with Get Approval. Needs an app in a Hibira account.
|
|
33
34
|
|
|
34
35
|
## Trigger
|
|
35
36
|
|
|
@@ -67,5 +67,30 @@
|
|
|
67
67
|
"Starts the flow when a channel is occupied or vacated, a presence member joins or leaves, a client sends an event, and more.": "Starts the flow when a channel is occupied or vacated, a presence member joins or leaves, a client sends an event, and more.",
|
|
68
68
|
"Events": "Events",
|
|
69
69
|
"Channel Prefix": "Channel Prefix",
|
|
70
|
-
"Only events of channels whose name starts with this text, for example presence-.": "Only events of channels whose name starts with this text, for example presence-."
|
|
71
|
-
|
|
70
|
+
"Only events of channels whose name starts with this text, for example presence-.": "Only events of channels whose name starts with this text, for example presence-.",
|
|
71
|
+
"Request Approval": "Request Approval",
|
|
72
|
+
"Asks a person to approve or choose through a Hibira-hosted answer link, and can wait for the answer.": "Asks a person to approve or choose through a Hibira-hosted answer link, and can wait for the answer.",
|
|
73
|
+
"Question": "Question",
|
|
74
|
+
"What needs a decision, as a short question (at most 200 characters), such as \"Refund order #1042 for $89?\".": "What needs a decision, as a short question (at most 200 characters), such as \"Refund order #1042 for $89?\".",
|
|
75
|
+
"Choices": "Choices",
|
|
76
|
+
"2 to 4 choices, separated by commas. The first one approves; any other rejects.": "2 to 4 choices, separated by commas. The first one approves; any other rejects.",
|
|
77
|
+
"Details": "Details",
|
|
78
|
+
"Context shown to the person: what will happen and why (at most 4000 characters).": "Context shown to the person: what will happen and why (at most 4000 characters).",
|
|
79
|
+
"Wait for Answer": "Wait for Answer",
|
|
80
|
+
"Keep the flow at this step until the person answers, for up to 9 minutes. Otherwise the step returns the link at once; check later with Get Approval.": "Keep the flow at this step until the person answers, for up to 9 minutes. Otherwise the step returns the link at once; check later with Get Approval.",
|
|
81
|
+
"Max Wait (Minutes)": "Max Wait (Minutes)",
|
|
82
|
+
"Stop waiting after this long (1 to 9) and return the request as still pending.": "Stop waiting after this long (1 to 9) and return the request as still pending.",
|
|
83
|
+
"Expires In (Minutes)": "Expires In (Minutes)",
|
|
84
|
+
"How long the link can be answered (default 60, at most 10080 = 7 days).": "How long the link can be answered (default 60, at most 10080 = 7 days).",
|
|
85
|
+
"Channel to announce the request and its answer on, for the @hibira-io/approvals inbox components.": "Channel to announce the request and its answer on, for the @hibira-io/approvals inbox components.",
|
|
86
|
+
"Push to Interests": "Push to Interests",
|
|
87
|
+
"Send the link as a push notification to these interests, separated by commas (the app needs Push enabled).": "Send the link as a push notification to these interests, separated by commas (the app needs Push enabled).",
|
|
88
|
+
"Push to User IDs": "Push to User IDs",
|
|
89
|
+
"Send the link as a push notification to these user IDs instead of interests.": "Send the link as a push notification to these user IDs instead of interests.",
|
|
90
|
+
"Get Approval": "Get Approval",
|
|
91
|
+
"Gets the status (pending, approved, rejected or expired) and answer of an approval request.": "Gets the status (pending, approved, rejected or expired) and answer of an approval request.",
|
|
92
|
+
"Approval ID": "Approval ID",
|
|
93
|
+
"The approval_id returned by Request Approval (apr_...).": "The approval_id returned by Request Approval (apr_...).",
|
|
94
|
+
"Wait (Minutes)": "Wait (Minutes)",
|
|
95
|
+
"Wait up to this long (0 to 9) for a pending request to be answered. 0 returns at once.": "Wait up to this long (0 to 9) for a pending request to be answered. 0 returns at once."
|
|
96
|
+
}
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAaxC,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,eAAO,MAAM,MAAM;;;;;;;GAqBjB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -6,11 +6,13 @@ const shared_1 = require("@activepieces/shared");
|
|
|
6
6
|
const auth_1 = require("./lib/auth");
|
|
7
7
|
Object.defineProperty(exports, "hibiraAuth", { enumerable: true, get: function () { return auth_1.hibiraAuth; } });
|
|
8
8
|
const delete_push_user_1 = require("./lib/actions/delete-push-user");
|
|
9
|
+
const get_approval_1 = require("./lib/actions/get-approval");
|
|
9
10
|
const get_channel_1 = require("./lib/actions/get-channel");
|
|
10
11
|
const get_presence_users_1 = require("./lib/actions/get-presence-users");
|
|
11
12
|
const list_channels_1 = require("./lib/actions/list-channels");
|
|
12
13
|
const publish_to_interests_1 = require("./lib/actions/publish-to-interests");
|
|
13
14
|
const publish_to_users_1 = require("./lib/actions/publish-to-users");
|
|
15
|
+
const request_approval_1 = require("./lib/actions/request-approval");
|
|
14
16
|
const terminate_user_connections_1 = require("./lib/actions/terminate-user-connections");
|
|
15
17
|
const trigger_event_1 = require("./lib/actions/trigger-event");
|
|
16
18
|
const new_webhook_event_1 = require("./lib/triggers/new-webhook-event");
|
|
@@ -31,6 +33,8 @@ exports.hibira = (0, pieces_framework_1.createPiece)({
|
|
|
31
33
|
publish_to_interests_1.publishToInterests,
|
|
32
34
|
publish_to_users_1.publishToUsers,
|
|
33
35
|
delete_push_user_1.deletePushUser,
|
|
36
|
+
request_approval_1.requestApproval,
|
|
37
|
+
get_approval_1.getApproval,
|
|
34
38
|
],
|
|
35
39
|
triggers: [new_webhook_event_1.newWebhookEvent],
|
|
36
40
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const getApproval: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
secret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
pushInstanceId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
pushSecretKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
7
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
}>, {
|
|
9
|
+
approvalId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
maxWaitMinutes: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=get-approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-approval.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-approval.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;;;;;;EAyBtB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getApproval = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const approvals_1 = require("../common/approvals");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
exports.getApproval = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_1.hibiraAuth,
|
|
10
|
+
name: 'get_approval',
|
|
11
|
+
displayName: 'Get Approval',
|
|
12
|
+
description: 'Gets the status (pending, approved, rejected or expired) and answer of an approval request.',
|
|
13
|
+
props: {
|
|
14
|
+
approvalId: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Approval ID',
|
|
16
|
+
description: 'The approval_id returned by Request Approval (apr_...).',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
maxWaitMinutes: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Wait (Minutes)',
|
|
21
|
+
description: `Wait up to this long (0 to ${approvals_1.MAX_WAIT_MINUTES}) for a pending request to be answered. 0 returns at once.`,
|
|
22
|
+
required: false,
|
|
23
|
+
defaultValue: 0,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
async run({ auth, propsValue }) {
|
|
27
|
+
const current = await client_1.hibiraClient.channels(auth, {
|
|
28
|
+
method: 'GET',
|
|
29
|
+
path: `/approvals/${encodeURIComponent(propsValue.approvalId.trim())}`,
|
|
30
|
+
});
|
|
31
|
+
return (0, approvals_1.waitForApproval)(auth, current, propsValue.maxWaitMinutes ?? 0);
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const requestApproval: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
appId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
key: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
secret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
pushInstanceId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
pushSecretKey: import("@activepieces/pieces-framework").SecretTextProperty<false>;
|
|
7
|
+
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
}>, {
|
|
9
|
+
title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
options: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
details: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
12
|
+
waitForAnswer: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
13
|
+
maxWaitMinutes: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
14
|
+
expiresInMinutes: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
15
|
+
channel: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
16
|
+
pushInterests: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
17
|
+
pushUsers: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=request-approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-approval.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/request-approval.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;EAuE1B,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requestApproval = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const approvals_1 = require("../common/approvals");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
exports.requestApproval = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_1.hibiraAuth,
|
|
10
|
+
name: 'request_approval',
|
|
11
|
+
displayName: 'Request Approval',
|
|
12
|
+
description: 'Asks a person to approve or choose through a Hibira-hosted answer link, and can wait for the answer.',
|
|
13
|
+
props: {
|
|
14
|
+
title: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Question',
|
|
16
|
+
description: 'What needs a decision, as a short question (at most 200 characters), such as "Refund order #1042 for $89?".',
|
|
17
|
+
required: true,
|
|
18
|
+
}),
|
|
19
|
+
options: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Choices',
|
|
21
|
+
description: '2 to 4 choices, separated by commas. The first one approves; any other rejects.',
|
|
22
|
+
required: false,
|
|
23
|
+
defaultValue: 'Approve, Reject',
|
|
24
|
+
}),
|
|
25
|
+
details: pieces_framework_1.Property.LongText({
|
|
26
|
+
displayName: 'Details',
|
|
27
|
+
description: 'Context shown to the person: what will happen and why (at most 4000 characters).',
|
|
28
|
+
required: false,
|
|
29
|
+
}),
|
|
30
|
+
waitForAnswer: pieces_framework_1.Property.Checkbox({
|
|
31
|
+
displayName: 'Wait for Answer',
|
|
32
|
+
description: `Keep the flow at this step until the person answers, for up to ${approvals_1.MAX_WAIT_MINUTES} minutes. Otherwise the step returns the link at once; check later with Get Approval.`,
|
|
33
|
+
required: false,
|
|
34
|
+
defaultValue: true,
|
|
35
|
+
}),
|
|
36
|
+
maxWaitMinutes: pieces_framework_1.Property.Number({
|
|
37
|
+
displayName: 'Max Wait (Minutes)',
|
|
38
|
+
description: `Stop waiting after this long (1 to ${approvals_1.MAX_WAIT_MINUTES}) and return the request as still pending.`,
|
|
39
|
+
required: false,
|
|
40
|
+
defaultValue: 5,
|
|
41
|
+
}),
|
|
42
|
+
expiresInMinutes: pieces_framework_1.Property.Number({
|
|
43
|
+
displayName: 'Expires In (Minutes)',
|
|
44
|
+
description: 'How long the link can be answered (default 60, at most 10080 = 7 days).',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
channel: pieces_framework_1.Property.ShortText({
|
|
48
|
+
displayName: 'Channel',
|
|
49
|
+
description: 'Channel to announce the request and its answer on, for the @hibira-io/approvals inbox components.',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
pushInterests: pieces_framework_1.Property.ShortText({
|
|
53
|
+
displayName: 'Push to Interests',
|
|
54
|
+
description: 'Send the link as a push notification to these interests, separated by commas (the app needs Push enabled).',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
pushUsers: pieces_framework_1.Property.ShortText({
|
|
58
|
+
displayName: 'Push to User IDs',
|
|
59
|
+
description: 'Send the link as a push notification to these user IDs instead of interests.',
|
|
60
|
+
required: false,
|
|
61
|
+
}),
|
|
62
|
+
},
|
|
63
|
+
async run({ auth, propsValue }) {
|
|
64
|
+
const body = { title: propsValue.title, agent: 'Activepieces' };
|
|
65
|
+
const options = (0, client_1.splitList)(propsValue.options);
|
|
66
|
+
if (options.length > 0)
|
|
67
|
+
body['options'] = options;
|
|
68
|
+
if (propsValue.details)
|
|
69
|
+
body['details'] = propsValue.details;
|
|
70
|
+
if (propsValue.expiresInMinutes)
|
|
71
|
+
body['expires_in_minutes'] = propsValue.expiresInMinutes;
|
|
72
|
+
if (propsValue.channel)
|
|
73
|
+
body['channel'] = propsValue.channel;
|
|
74
|
+
const interests = (0, client_1.splitList)(propsValue.pushInterests);
|
|
75
|
+
const users = (0, client_1.splitList)(propsValue.pushUsers);
|
|
76
|
+
if (interests.length > 0)
|
|
77
|
+
body['push_interests'] = interests;
|
|
78
|
+
if (users.length > 0)
|
|
79
|
+
body['push_users'] = users;
|
|
80
|
+
const created = await client_1.hibiraClient.channels(auth, { method: 'POST', path: '/approvals', body });
|
|
81
|
+
if (propsValue.waitForAnswer === false)
|
|
82
|
+
return created;
|
|
83
|
+
return (0, approvals_1.waitForApproval)(auth, created, propsValue.maxWaitMinutes ?? 5);
|
|
84
|
+
},
|
|
85
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HibiraAuthProps } from './client';
|
|
2
|
+
export type Approval = {
|
|
3
|
+
approval_id: string;
|
|
4
|
+
status: 'pending' | 'approved' | 'rejected' | 'expired';
|
|
5
|
+
url?: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
/** Longest wait a step may hold a flow (Activepieces stops steps after 10 minutes). */
|
|
9
|
+
export declare const MAX_WAIT_MINUTES = 9;
|
|
10
|
+
/**
|
|
11
|
+
* Long-polls an approval (25 s per request, no timers) until it is answered
|
|
12
|
+
* or expires, or maxWaitMinutes runs out. Keeps the answer link of the
|
|
13
|
+
* request in the result.
|
|
14
|
+
*/
|
|
15
|
+
export declare function waitForApproval(auth: {
|
|
16
|
+
props: HibiraAuthProps;
|
|
17
|
+
} | HibiraAuthProps, approval: Approval, maxWaitMinutes: number): Promise<Approval>;
|
|
18
|
+
//# sourceMappingURL=approvals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvals.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/approvals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,eAAe,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,MAAM,QAAQ,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,uFAAuF;AACvF,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE;IAAE,KAAK,EAAE,eAAe,CAAA;CAAE,GAAG,eAAe,EAClD,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,QAAQ,CAAC,CAgBnB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_WAIT_MINUTES = void 0;
|
|
4
|
+
exports.waitForApproval = waitForApproval;
|
|
5
|
+
const client_1 = require("./client");
|
|
6
|
+
/** Longest wait a step may hold a flow (Activepieces stops steps after 10 minutes). */
|
|
7
|
+
exports.MAX_WAIT_MINUTES = 9;
|
|
8
|
+
/**
|
|
9
|
+
* Long-polls an approval (25 s per request, no timers) until it is answered
|
|
10
|
+
* or expires, or maxWaitMinutes runs out. Keeps the answer link of the
|
|
11
|
+
* request in the result.
|
|
12
|
+
*/
|
|
13
|
+
async function waitForApproval(auth, approval, maxWaitMinutes) {
|
|
14
|
+
const minutes = Math.min(Math.max(maxWaitMinutes, 0), exports.MAX_WAIT_MINUTES);
|
|
15
|
+
const deadline = Date.now() + minutes * 60_000;
|
|
16
|
+
let current = approval;
|
|
17
|
+
while (current.status === 'pending') {
|
|
18
|
+
const left = Math.floor((deadline - Date.now()) / 1000);
|
|
19
|
+
if (left <= 0)
|
|
20
|
+
break;
|
|
21
|
+
const next = await client_1.hibiraClient.channels(auth, {
|
|
22
|
+
method: 'GET',
|
|
23
|
+
path: `/approvals/${encodeURIComponent(approval.approval_id)}`,
|
|
24
|
+
query: { wait: String(Math.min(25, left)) },
|
|
25
|
+
timeout: 40_000,
|
|
26
|
+
});
|
|
27
|
+
current = approval.url === undefined ? next : { ...next, url: approval.url };
|
|
28
|
+
}
|
|
29
|
+
return current;
|
|
30
|
+
}
|
|
@@ -13,11 +13,12 @@ type AuthValue = {
|
|
|
13
13
|
export declare function splitList(value: string | string[] | undefined): string[];
|
|
14
14
|
export declare const hibiraClient: {
|
|
15
15
|
/** Signed request to the app's Channels HTTP API (/apps/{appId}{path}). */
|
|
16
|
-
channels<T = Record<string, unknown>>(auth: AuthValue, { method, path, query, body, }: {
|
|
16
|
+
channels<T = Record<string, unknown>>(auth: AuthValue, { method, path, query, body, timeout, }: {
|
|
17
17
|
method: "GET" | "POST" | "DELETE";
|
|
18
18
|
path: string;
|
|
19
19
|
query?: Record<string, string>;
|
|
20
20
|
body?: unknown;
|
|
21
|
+
timeout?: number;
|
|
21
22
|
}): Promise<T>;
|
|
22
23
|
/** Request to the Beams-compatible push API, with {instance} filled in. */
|
|
23
24
|
push<T = Record<string, unknown>>(auth: AuthValue, { method, path, body }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,KAAK,EAAE,eAAe,CAAA;CAAE,GAAG,eAAe,CAAC;AAU9D,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAGxE;AAED,eAAO,MAAM,YAAY;IACvB,2EAA2E;aAC5D,CAAC,kCACR,SAAS,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,SAAS,GAAG;IAAE,KAAK,EAAE,eAAe,CAAA;CAAE,GAAG,eAAe,CAAC;AAU9D,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,CAGxE;AAED,eAAO,MAAM,YAAY;IACvB,2EAA2E;aAC5D,CAAC,kCACR,SAAS,2CAOZ;QACD,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;QAClC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,GACA,OAAO,CAAC,CAAC,CAAC;IAgBb,2EAA2E;SAChE,CAAC,kCACJ,SAAS,0BACS;QAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,GAClF,OAAO,CAAC,CAAC,CAAC;CAad,CAAC"}
|
|
@@ -17,7 +17,7 @@ function splitList(value) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.hibiraClient = {
|
|
19
19
|
/** Signed request to the app's Channels HTTP API (/apps/{appId}{path}). */
|
|
20
|
-
async channels(auth, { method, path, query = {}, body, }) {
|
|
20
|
+
async channels(auth, { method, path, query = {}, body, timeout, }) {
|
|
21
21
|
const a = props(auth);
|
|
22
22
|
const fullPath = `/apps/${encodeURIComponent(a.appId)}${path}`;
|
|
23
23
|
const raw = body === undefined ? undefined : JSON.stringify(body);
|
|
@@ -28,6 +28,7 @@ exports.hibiraClient = {
|
|
|
28
28
|
queryParams,
|
|
29
29
|
headers: raw === undefined ? {} : { 'Content-Type': 'application/json' },
|
|
30
30
|
body: raw,
|
|
31
|
+
...(timeout === undefined ? {} : { timeout }),
|
|
31
32
|
});
|
|
32
33
|
return response.body;
|
|
33
34
|
},
|