@gravity-rail/sdk 0.14.0 → 0.15.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/dist/{chunk-V7ZKEH4V.js → chunk-2YLKG4TT.js} +1 -1
- package/dist/chunk-2YLKG4TT.js.map +1 -0
- package/dist/{chunk-K4MDFGMO.js → chunk-QTJQTTIR.js} +45 -2
- package/dist/chunk-QTJQTTIR.js.map +1 -0
- package/dist/{client-CKudWmUT.d.cts → client-BLuz00Qr.d.cts} +166 -11
- package/dist/{client-EAvh7w0y.d.ts → client-CefA5Mxe.d.ts} +166 -11
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +48 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +48 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +5 -5
- package/dist/internal.d.ts +5 -5
- package/dist/internal.js +10 -2
- package/dist/internal.js.map +1 -1
- package/dist/{revision-state-BUBt9Rir.d.ts → revision-state-DL1ViZ57.d.ts} +21 -3
- package/dist/{revision-state-CY4LBdfa.d.cts → revision-state-axZ62kJk.d.cts} +21 -3
- package/dist/schemas.cjs +35 -20
- package/dist/schemas.cjs.map +1 -1
- package/dist/schemas.d.cts +54 -23
- package/dist/schemas.d.ts +54 -23
- package/dist/schemas.js +33 -20
- package/dist/schemas.js.map +1 -1
- package/dist/{tasks-iRrM4SaF.d.cts → tasks-Boi6AxGp.d.cts} +72 -7
- package/dist/{tasks-iRrM4SaF.d.ts → tasks-Boi6AxGp.d.ts} +72 -7
- package/package.json +1 -1
- package/dist/chunk-K4MDFGMO.js.map +0 -1
- package/dist/chunk-V7ZKEH4V.js.map +0 -1
package/dist/helpers.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { bU as WorkspaceMemberResponse, aK as DataRecordResponse } from './tasks-
|
|
1
|
+
import { e8 as GravityRailClient } from './client-BLuz00Qr.cjs';
|
|
2
|
+
import { bU as WorkspaceMemberResponse, aK as DataRecordResponse } from './tasks-Boi6AxGp.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
interface OutboundPhoneNumberOption {
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { bU as WorkspaceMemberResponse, aK as DataRecordResponse } from './tasks-
|
|
1
|
+
import { e8 as GravityRailClient } from './client-CefA5Mxe.js';
|
|
2
|
+
import { bU as WorkspaceMemberResponse, aK as DataRecordResponse } from './tasks-Boi6AxGp.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
interface OutboundPhoneNumberOption {
|
package/dist/index.cjs
CHANGED
|
@@ -146,6 +146,7 @@ __export(src_exports, {
|
|
|
146
146
|
TemplatesApi: () => TemplatesApi,
|
|
147
147
|
ToolkitState: () => ToolkitState,
|
|
148
148
|
WIDGET_SLUGS: () => WIDGET_SLUGS,
|
|
149
|
+
WORKFLOW_IMPLICIT_USE_SCOPE: () => WORKFLOW_IMPLICIT_USE_SCOPE,
|
|
149
150
|
WorkflowAccessWarningResourceType: () => WorkflowAccessWarningResourceType,
|
|
150
151
|
WorkflowBuilder: () => WorkflowBuilder,
|
|
151
152
|
WorkflowResourceType: () => WorkflowAccessWarningResourceType,
|
|
@@ -184,6 +185,9 @@ __export(src_exports, {
|
|
|
184
185
|
isSMSDeliveryFailureStatus: () => isSMSDeliveryFailureStatus,
|
|
185
186
|
parseOrgAuthChallenge: () => parseOrgAuthChallenge,
|
|
186
187
|
requiresAssistantParticipant: () => requiresAssistantParticipant,
|
|
188
|
+
roleCanUseWorkflow: () => roleCanUseWorkflow,
|
|
189
|
+
roleImplicitWorkflowUseScope: () => roleImplicitWorkflowUseScope,
|
|
190
|
+
roleWorkflowAccess: () => roleWorkflowAccess,
|
|
187
191
|
runWorkspaceScript: () => runWorkspaceScript,
|
|
188
192
|
usesBuiltinAssistant: () => usesBuiltinAssistant,
|
|
189
193
|
validateFeatureDependencies: () => validateFeatureDependencies
|
|
@@ -1954,6 +1958,8 @@ var ChatsApi = class extends BaseApiClient {
|
|
|
1954
1958
|
if (options.mine !== void 0) params.append("mine", options.mine.toString());
|
|
1955
1959
|
if (options.needsResponse !== void 0)
|
|
1956
1960
|
params.append("needsResponse", options.needsResponse.toString());
|
|
1961
|
+
if (options.needsResponseFirst !== void 0)
|
|
1962
|
+
params.append("needsResponseFirst", options.needsResponseFirst.toString());
|
|
1957
1963
|
if (options.paused !== void 0) params.append("paused", options.paused.toString());
|
|
1958
1964
|
if (options.archived !== void 0) params.append("archived", options.archived.toString());
|
|
1959
1965
|
if (options.channel) params.append("channel", options.channel);
|
|
@@ -2003,6 +2009,25 @@ var ChatsApi = class extends BaseApiClient {
|
|
|
2003
2009
|
async getChat(wid, id) {
|
|
2004
2010
|
return this.fetch(`w/${wid}/chats/${id}`);
|
|
2005
2011
|
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Create-chat preflight for SMS: is a conversation already live between this
|
|
2014
|
+
* workspace number and this member?
|
|
2015
|
+
*
|
|
2016
|
+
* An SMS conversation with a member is a single stream — inbound SMS resolves
|
|
2017
|
+
* to ONE current chat per (member phone, workspace phone) pair — so creating
|
|
2018
|
+
* a new SMS chat SUPERSEDES the existing one and the member's next reply
|
|
2019
|
+
* lands on the new chat. Callers use this to say so before committing.
|
|
2020
|
+
*
|
|
2021
|
+
* Read-only, `chats:read`, and PHI-safe by construction: status and timing
|
|
2022
|
+
* only, no message content and no chat title.
|
|
2023
|
+
*/
|
|
2024
|
+
async getCurrentSmsChat(wid, options) {
|
|
2025
|
+
const params = new URLSearchParams({
|
|
2026
|
+
memberId: options.memberId.toString(),
|
|
2027
|
+
phoneNumberId: options.phoneNumberId.toString()
|
|
2028
|
+
});
|
|
2029
|
+
return this.fetch(`w/${wid}/chats/current-sms?${params}`);
|
|
2030
|
+
}
|
|
2006
2031
|
/** Get token usage statistics for a chat. */
|
|
2007
2032
|
async getChatTokenUsage(wid, chatId) {
|
|
2008
2033
|
return this.fetch(`w/${wid}/chats/${chatId}/token-usage`);
|
|
@@ -8412,6 +8437,21 @@ function encodePermissions(permissions) {
|
|
|
8412
8437
|
if (permissions.delete) accessMode |= PERMISSION_DELETE;
|
|
8413
8438
|
return accessMode;
|
|
8414
8439
|
}
|
|
8440
|
+
var WORKFLOW_IMPLICIT_USE_SCOPE = "workflows:admin";
|
|
8441
|
+
function roleImplicitWorkflowUseScope(role) {
|
|
8442
|
+
return (role.grantedScopes ?? []).includes(WORKFLOW_IMPLICIT_USE_SCOPE) ? WORKFLOW_IMPLICIT_USE_SCOPE : null;
|
|
8443
|
+
}
|
|
8444
|
+
function roleWorkflowAccess(role, workflowId) {
|
|
8445
|
+
const viaScope = roleImplicitWorkflowUseScope(role);
|
|
8446
|
+
if (viaScope) {
|
|
8447
|
+
return { accessMode: PERMISSION_USE | PERMISSION_EDIT, viaScope };
|
|
8448
|
+
}
|
|
8449
|
+
const entry = (role.workflowAccess ?? []).find((wa) => wa.workflowId === workflowId);
|
|
8450
|
+
return { accessMode: entry?.accessMode ?? PERMISSION_NONE, viaScope: null };
|
|
8451
|
+
}
|
|
8452
|
+
function roleCanUseWorkflow(role, workflowId) {
|
|
8453
|
+
return (roleWorkflowAccess(role, workflowId).accessMode & PERMISSION_USE) !== 0;
|
|
8454
|
+
}
|
|
8415
8455
|
var Scope = /* @__PURE__ */ ((Scope2) => {
|
|
8416
8456
|
Scope2["WORKSPACE_READ"] = "workspace:read";
|
|
8417
8457
|
Scope2["WORKSPACE_WRITE"] = "workspace:write";
|
|
@@ -8570,6 +8610,7 @@ var EventRuleEventType = /* @__PURE__ */ ((EventRuleEventType2) => {
|
|
|
8570
8610
|
EventRuleEventType2["ROUTINE_TRIGGERED"] = "routine:triggered";
|
|
8571
8611
|
EventRuleEventType2["ASSISTANT_MESSAGE"] = "workflow:assistant_message";
|
|
8572
8612
|
EventRuleEventType2["USER_MESSAGE"] = "workflow:user_message";
|
|
8613
|
+
EventRuleEventType2["WORKFLOW_EXECUTE"] = "workflow:execute";
|
|
8573
8614
|
EventRuleEventType2["CALENDAR_EVENT_CREATED"] = "calendar_event:created";
|
|
8574
8615
|
EventRuleEventType2["CALENDAR_EVENT_UPDATED"] = "calendar_event:updated";
|
|
8575
8616
|
EventRuleEventType2["CALENDAR_EVENT_CANCELLED"] = "calendar_event:cancelled";
|
|
@@ -8639,7 +8680,6 @@ var WorkspaceFeature = /* @__PURE__ */ ((WorkspaceFeature2) => {
|
|
|
8639
8680
|
WorkspaceFeature2["WEB_SEARCH"] = "web_search";
|
|
8640
8681
|
WorkspaceFeature2["CALENDAR"] = "calendar";
|
|
8641
8682
|
WorkspaceFeature2["EXPERIMENTS"] = "experiments";
|
|
8642
|
-
WorkspaceFeature2["OPERATOR"] = "operator";
|
|
8643
8683
|
WorkspaceFeature2["GMAIL"] = "gmail";
|
|
8644
8684
|
WorkspaceFeature2["GCALENDAR"] = "gcalendar";
|
|
8645
8685
|
WorkspaceFeature2["GDRIVE"] = "gdrive";
|
|
@@ -9893,6 +9933,7 @@ var WORKSPACE_METHOD_NAMES = [
|
|
|
9893
9933
|
"getConnectionSyncConfig",
|
|
9894
9934
|
"getCredentialUpdateInvites",
|
|
9895
9935
|
"getCurrentMember",
|
|
9936
|
+
"getCurrentSmsChat",
|
|
9896
9937
|
"getCustomToolkit",
|
|
9897
9938
|
"getCustomToolkits",
|
|
9898
9939
|
"getDashboard",
|
|
@@ -10428,6 +10469,7 @@ function bindTasksMethods(target, tasks, abilities) {
|
|
|
10428
10469
|
function bindChatsMethods(target, chats) {
|
|
10429
10470
|
target.getChats = chats.getChats.bind(chats);
|
|
10430
10471
|
target.getChat = chats.getChat.bind(chats);
|
|
10472
|
+
target.getCurrentSmsChat = chats.getCurrentSmsChat.bind(chats);
|
|
10431
10473
|
target.getChatCallbacks = chats.getChatCallbacks.bind(chats);
|
|
10432
10474
|
target.cancelChatCallback = chats.cancelChatCallback.bind(chats);
|
|
10433
10475
|
target.getChatTokenUsage = chats.getChatTokenUsage.bind(chats);
|
|
@@ -11466,6 +11508,7 @@ var GravityRailClient = class {
|
|
|
11466
11508
|
// Chats API
|
|
11467
11509
|
getChats;
|
|
11468
11510
|
getChat;
|
|
11511
|
+
getCurrentSmsChat;
|
|
11469
11512
|
getChatCallbacks;
|
|
11470
11513
|
cancelChatCallback;
|
|
11471
11514
|
getChatTokenUsage;
|
|
@@ -15196,6 +15239,7 @@ function getRevisionState(workflow, revision) {
|
|
|
15196
15239
|
TemplatesApi,
|
|
15197
15240
|
ToolkitState,
|
|
15198
15241
|
WIDGET_SLUGS,
|
|
15242
|
+
WORKFLOW_IMPLICIT_USE_SCOPE,
|
|
15199
15243
|
WorkflowAccessWarningResourceType,
|
|
15200
15244
|
WorkflowBuilder,
|
|
15201
15245
|
WorkflowResourceType,
|
|
@@ -15234,6 +15278,9 @@ function getRevisionState(workflow, revision) {
|
|
|
15234
15278
|
isSMSDeliveryFailureStatus,
|
|
15235
15279
|
parseOrgAuthChallenge,
|
|
15236
15280
|
requiresAssistantParticipant,
|
|
15281
|
+
roleCanUseWorkflow,
|
|
15282
|
+
roleImplicitWorkflowUseScope,
|
|
15283
|
+
roleWorkflowAccess,
|
|
15237
15284
|
runWorkspaceScript,
|
|
15238
15285
|
usesBuiltinAssistant,
|
|
15239
15286
|
validateFeatureDependencies
|