@gravity-rail/cli 0.7.1 → 0.7.2
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/cli-utils.js +0 -1
- package/dist/{errors-4MAJGD3C.js → errors-SMY7LZJB.js} +1 -2
- package/dist/gr.js +335 -1706
- package/dist/gr.js.map +1 -1
- package/dist/lib.d.ts +15 -12
- package/dist/lib.js +6352 -5468
- package/dist/lib.js.map +1 -1
- package/dist/register-special-commands.js +1 -1670
- package/dist/register-special-commands.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-424PT5DM.js +0 -23
- package/dist/errors-4MAJGD3C.js.map +0 -1
- /package/dist/{chunk-424PT5DM.js.map → errors-SMY7LZJB.js.map} +0 -0
package/dist/gr.js
CHANGED
|
@@ -2671,7 +2671,7 @@ var init_libphonenumber_js = __esm({
|
|
|
2671
2671
|
}
|
|
2672
2672
|
});
|
|
2673
2673
|
|
|
2674
|
-
// ../sdk/dist/chunk-
|
|
2674
|
+
// ../sdk/dist/chunk-WXSLDWIA.js
|
|
2675
2675
|
function getCookieValue(name) {
|
|
2676
2676
|
if (typeof document === "undefined") return void 0;
|
|
2677
2677
|
const cookies = document.cookie.split(";");
|
|
@@ -3712,8 +3712,8 @@ function bindSupportRequestMethods(target, supportRequests) {
|
|
|
3712
3712
|
target.clickWorkspaceSupportRequestResource = supportRequests.clickWorkspaceSupportRequestResource.bind(supportRequests);
|
|
3713
3713
|
}
|
|
3714
3714
|
var ApiError, BaseApiClient, AbilitiesApi, AccessGrantsApi, AgentTasksApi, AgentsApi, AIModelsApi, ApiKeysApi, AppsApi, AssignmentsApi, VoiceApi, AuthApi, BuildersApi, CalendarsApi, CallsApi, CELApi, ChatsApi, ConfluenceApi, CustomToolkitsApi, DataTypesApi, DiscordBotsApi, SlackAppsApi, EventsApi, FeaturesApi, FhirConnectionsApi, HealthieApi, FilesApi, InboxesApi, InquiriesApi, AppConnectionsApi, McpServersApi, MembersApi, MilestonesApi, MondayIntegrationApi, NotificationRulesApi, OperatorApi, OrgApi, OAuthConnectionsApi, OAuthApi, PhoneNumbersApi, PronunciationsApi, PromptsApi, PersonasApi, QualificationsApi, ReportsApi, SalesforceApi, ConnectionSyncApi, HubspotApi, SitesApi, SubscriptionsApi, SupportRequestsApi, CustomersApi, ResellersApi, SupervisorsApi, TasksApi, TemplatesApi, ToolkitsApi, JourneysApi, WorkflowsApi, WorkflowNotesApi, EventRuleEventType, WorkspaceInvitationsApi, WorkspacesApi, TeamsAppsApi, ExperimentsApi, GravityRailClient, CHAT_TYPES, BUILTIN_ASSISTANT_CHAT_TYPES;
|
|
3715
|
-
var
|
|
3716
|
-
"../sdk/dist/chunk-
|
|
3715
|
+
var init_chunk_WXSLDWIA = __esm({
|
|
3716
|
+
"../sdk/dist/chunk-WXSLDWIA.js"() {
|
|
3717
3717
|
init_libphonenumber_js();
|
|
3718
3718
|
ApiError = class extends Error {
|
|
3719
3719
|
statusCode;
|
|
@@ -11849,1671 +11849,13 @@ var init_chunk_QS6ZRQUZ = __esm({
|
|
|
11849
11849
|
}
|
|
11850
11850
|
});
|
|
11851
11851
|
|
|
11852
|
-
// ../sdk/dist/internal.js
|
|
11853
|
-
var init_internal = __esm({
|
|
11854
|
-
"../sdk/dist/internal.js"() {
|
|
11855
|
-
init_chunk_PEWFZXNK();
|
|
11856
|
-
init_chunk_QS6ZRQUZ();
|
|
11857
|
-
}
|
|
11858
|
-
});
|
|
11859
|
-
|
|
11860
11852
|
// ../sdk/dist/index.js
|
|
11861
11853
|
var init_dist = __esm({
|
|
11862
11854
|
"../sdk/dist/index.js"() {
|
|
11863
|
-
|
|
11855
|
+
init_chunk_WXSLDWIA();
|
|
11864
11856
|
init_chunk_QS6ZRQUZ();
|
|
11865
11857
|
}
|
|
11866
11858
|
});
|
|
11867
|
-
|
|
11868
|
-
// ../client/dist/index.mjs
|
|
11869
|
-
function supportRequestParams2(params) {
|
|
11870
|
-
const searchParams = new URLSearchParams();
|
|
11871
|
-
if (params?.page) searchParams.append("page", params.page.toString());
|
|
11872
|
-
if (params?.pageSize) searchParams.append("pageSize", params.pageSize.toString());
|
|
11873
|
-
if (params?.status) searchParams.append("status", params.status);
|
|
11874
|
-
if (params?.supportRequestType) {
|
|
11875
|
-
searchParams.append("supportRequestType", params.supportRequestType);
|
|
11876
|
-
}
|
|
11877
|
-
if (params?.severity) searchParams.append("severity", params.severity);
|
|
11878
|
-
if (params?.source) searchParams.append("source", params.source);
|
|
11879
|
-
if (params?.organizationId !== void 0) {
|
|
11880
|
-
searchParams.append("organizationId", params.organizationId.toString());
|
|
11881
|
-
}
|
|
11882
|
-
if (params?.workspaceId !== void 0) {
|
|
11883
|
-
searchParams.append("workspaceId", params.workspaceId.toString());
|
|
11884
|
-
}
|
|
11885
|
-
if (params?.linearLinked !== void 0) {
|
|
11886
|
-
searchParams.append("linearLinked", params.linearLinked.toString());
|
|
11887
|
-
}
|
|
11888
|
-
const query = searchParams.toString();
|
|
11889
|
-
return query ? `?${query}` : "";
|
|
11890
|
-
}
|
|
11891
|
-
function appendTemporalWorkspaceParams(params, options) {
|
|
11892
|
-
const seen = /* @__PURE__ */ new Set();
|
|
11893
|
-
const push = (raw) => {
|
|
11894
|
-
if (!raw) return;
|
|
11895
|
-
const trimmed = raw.trim();
|
|
11896
|
-
if (!trimmed || seen.has(trimmed)) return;
|
|
11897
|
-
seen.add(trimmed);
|
|
11898
|
-
params.append("workspace_uuid", trimmed);
|
|
11899
|
-
};
|
|
11900
|
-
if (options.workspaceUuids) {
|
|
11901
|
-
for (const value of options.workspaceUuids) push(value);
|
|
11902
|
-
}
|
|
11903
|
-
push(options.workspaceUuid);
|
|
11904
|
-
}
|
|
11905
|
-
function bindAdminMethods(target, admin) {
|
|
11906
|
-
target.listSupportRequestsAsAdmin = admin.listSupportRequestsAsAdmin.bind(admin);
|
|
11907
|
-
target.getSupportRequestAsAdmin = admin.getSupportRequestAsAdmin.bind(admin);
|
|
11908
|
-
target.commentOnSupportRequestAsAdmin = admin.commentOnSupportRequestAsAdmin.bind(admin);
|
|
11909
|
-
target.noteOnSupportRequestAsAdmin = admin.noteOnSupportRequestAsAdmin.bind(admin);
|
|
11910
|
-
target.updateSupportRequestStatusAsAdmin = admin.updateSupportRequestStatusAsAdmin.bind(admin);
|
|
11911
|
-
target.updateSupportRequestAttributesAsAdmin = admin.updateSupportRequestAttributesAsAdmin.bind(admin);
|
|
11912
|
-
target.createSupportRequestLinearIssueAsAdmin = admin.createSupportRequestLinearIssueAsAdmin.bind(admin);
|
|
11913
|
-
target.createOutboundSupportRequestAsAdmin = admin.createOutboundSupportRequestAsAdmin.bind(admin);
|
|
11914
|
-
target.attachSupportRequestResourceAsAdmin = admin.attachSupportRequestResourceAsAdmin.bind(admin);
|
|
11915
|
-
target.revokeSupportRequestResourceAsAdmin = admin.revokeSupportRequestResourceAsAdmin.bind(admin);
|
|
11916
|
-
target.listCustomerActivityEvents = admin.listCustomerActivityEvents.bind(admin);
|
|
11917
|
-
target.getCustomerActivityEvent = admin.getCustomerActivityEvent.bind(admin);
|
|
11918
|
-
target.setCustomerActivityEventDisposition = admin.setCustomerActivityEventDisposition.bind(admin);
|
|
11919
|
-
target.setCustomerActivityEventStatus = admin.setCustomerActivityEventStatus.bind(admin);
|
|
11920
|
-
target.reclassifyCustomerActivityEvent = admin.reclassifyCustomerActivityEvent.bind(admin);
|
|
11921
|
-
target.getAccounts = admin.getAccounts.bind(admin);
|
|
11922
|
-
target.getAccountDetails = admin.getAccountDetails.bind(admin);
|
|
11923
|
-
target.getAccountByUuid = admin.getAccountByUuid.bind(admin);
|
|
11924
|
-
target.getAccountMemberships = admin.getAccountMemberships.bind(admin);
|
|
11925
|
-
target.getAccountOrgMemberships = admin.getAccountOrgMemberships.bind(admin);
|
|
11926
|
-
target.createAccountOrgMembership = admin.createAccountOrgMembership.bind(admin);
|
|
11927
|
-
target.deleteAccountOrgMembership = admin.deleteAccountOrgMembership.bind(admin);
|
|
11928
|
-
target.getAccountMembership = admin.getAccountMembership.bind(admin);
|
|
11929
|
-
target.updateAccountMembership = admin.updateAccountMembership.bind(admin);
|
|
11930
|
-
target.createAccountMembership = admin.createAccountMembership.bind(admin);
|
|
11931
|
-
target.deleteAccountMembership = admin.deleteAccountMembership.bind(admin);
|
|
11932
|
-
target.updateAccountAsAdmin = admin.updateAccountAsAdmin.bind(admin);
|
|
11933
|
-
target.createAccountAsAdmin = admin.createAccountAsAdmin.bind(admin);
|
|
11934
|
-
target.deleteAccountAsAdmin = admin.deleteAccountAsAdmin.bind(admin);
|
|
11935
|
-
target.lookupAccount = admin.lookupAccount.bind(admin);
|
|
11936
|
-
target.exportAccountData = admin.exportAccountData.bind(admin);
|
|
11937
|
-
target.requestAccountDeletion = admin.requestAccountDeletion.bind(admin);
|
|
11938
|
-
target.cancelAccountDeletion = admin.cancelAccountDeletion.bind(admin);
|
|
11939
|
-
target.getOrganizations = admin.getOrganizations.bind(admin);
|
|
11940
|
-
target.getOrganization = admin.getOrganization.bind(admin);
|
|
11941
|
-
target.getOrganizationAsAdmin = admin.getOrganizationAsAdmin.bind(admin);
|
|
11942
|
-
target.getOrganizationMembersAsAdmin = admin.getOrganizationMembersAsAdmin.bind(admin);
|
|
11943
|
-
target.createOrganization = admin.createOrganization.bind(admin);
|
|
11944
|
-
target.updateOrganization = admin.updateOrganization.bind(admin);
|
|
11945
|
-
target.deleteOrganization = admin.deleteOrganization.bind(admin);
|
|
11946
|
-
target.joinOrganization = admin.joinOrganization.bind(admin);
|
|
11947
|
-
target.leaveOrganization = admin.leaveOrganization.bind(admin);
|
|
11948
|
-
target.generateLogoUploadUrl = admin.generateLogoUploadUrl.bind(admin);
|
|
11949
|
-
target.importProducts = admin.importProducts.bind(admin);
|
|
11950
|
-
target.createProductAsAdmin = admin.createProductAsAdmin.bind(admin);
|
|
11951
|
-
target.getProductsAsAdmin = admin.getProductsAsAdmin.bind(admin);
|
|
11952
|
-
target.getProductAsAdmin = admin.getProductAsAdmin.bind(admin);
|
|
11953
|
-
target.updateProductAsAdmin = admin.updateProductAsAdmin.bind(admin);
|
|
11954
|
-
target.deleteProductAsAdmin = admin.deleteProductAsAdmin.bind(admin);
|
|
11955
|
-
target.getWorkspacesAsAdmin = admin.getWorkspacesAsAdmin.bind(admin);
|
|
11956
|
-
target.getWorkspaceAsAdmin = admin.getWorkspaceAsAdmin.bind(admin);
|
|
11957
|
-
target.getWorkspaceByNumericIdAsAdmin = admin.getWorkspaceByNumericIdAsAdmin.bind(admin);
|
|
11958
|
-
target.createWorkspaceAsAdmin = admin.createWorkspaceAsAdmin.bind(admin);
|
|
11959
|
-
target.updateWorkspaceAsAdmin = admin.updateWorkspaceAsAdmin.bind(admin);
|
|
11960
|
-
target.deleteWorkspaceAsAdmin = admin.deleteWorkspaceAsAdmin.bind(admin);
|
|
11961
|
-
target.createSchemaAsAdmin = admin.createSchemaAsAdmin.bind(admin);
|
|
11962
|
-
target.migrateSchemaAsAdmin = admin.migrateSchemaAsAdmin.bind(admin);
|
|
11963
|
-
target.provisionWorkspaceAsAdmin = admin.provisionWorkspaceAsAdmin.bind(admin);
|
|
11964
|
-
target.refreshProvisionStatusAsAdmin = admin.refreshProvisionStatusAsAdmin.bind(admin);
|
|
11965
|
-
target.enableMaintenanceMode = admin.enableMaintenanceMode.bind(admin);
|
|
11966
|
-
target.disableMaintenanceMode = admin.disableMaintenanceMode.bind(admin);
|
|
11967
|
-
target.getWorkspaceHealth = admin.getWorkspaceHealth.bind(admin);
|
|
11968
|
-
target.provisionPlanFeatures = admin.provisionPlanFeatures.bind(admin);
|
|
11969
|
-
target.changeWorkspaceProduct = admin.changeWorkspaceProduct.bind(admin);
|
|
11970
|
-
target.validateWorkflowAccessAsAdmin = admin.validateWorkflowAccessAsAdmin.bind(admin);
|
|
11971
|
-
target.mergeMembers = admin.mergeMembers.bind(admin);
|
|
11972
|
-
target.getAdminWorkspaceMember = admin.getAdminWorkspaceMember.bind(admin);
|
|
11973
|
-
target.createAdminWorkspaceMember = admin.createAdminWorkspaceMember.bind(admin);
|
|
11974
|
-
target.updateAdminWorkspaceMember = admin.updateAdminWorkspaceMember.bind(admin);
|
|
11975
|
-
target.unarchiveAdminWorkspaceMember = admin.unarchiveAdminWorkspaceMember.bind(admin);
|
|
11976
|
-
target.getAdminWorkspaceMemberRoles = admin.getAdminWorkspaceMemberRoles.bind(admin);
|
|
11977
|
-
target.getMissingMemberships = admin.getMissingMemberships.bind(admin);
|
|
11978
|
-
target.linkMissingMembership = admin.linkMissingMembership.bind(admin);
|
|
11979
|
-
target.getUnmappedPhoneNumbers = admin.getUnmappedPhoneNumbers.bind(admin);
|
|
11980
|
-
target.getWorkspaceUnmappedPhoneNumbers = admin.getWorkspaceUnmappedPhoneNumbers.bind(admin);
|
|
11981
|
-
target.getWorkspacePhoneNumbersAsAdmin = admin.getWorkspacePhoneNumbersAsAdmin.bind(admin);
|
|
11982
|
-
target.getProviderPhoneNumbers = admin.getProviderPhoneNumbers.bind(admin);
|
|
11983
|
-
target.getProviderPhoneNumber = admin.getProviderPhoneNumber.bind(admin);
|
|
11984
|
-
target.updateProviderPhoneNumber = admin.updateProviderPhoneNumber.bind(admin);
|
|
11985
|
-
target.mapMainAccountPhone = admin.mapMainAccountPhone.bind(admin);
|
|
11986
|
-
target.unmapPhoneNumber = admin.unmapPhoneNumber.bind(admin);
|
|
11987
|
-
target.searchAvailablePhoneNumbersAsAdmin = admin.searchAvailablePhoneNumbersAsAdmin.bind(admin);
|
|
11988
|
-
target.purchasePhoneNumberAsAdmin = admin.purchasePhoneNumberAsAdmin.bind(admin);
|
|
11989
|
-
target.startBulkPhoneClassification = admin.startBulkPhoneClassification.bind(admin);
|
|
11990
|
-
target.getOrgA2PStatusAsAdmin = admin.getOrgA2PStatusAsAdmin.bind(admin);
|
|
11991
|
-
target.resetOrgA2PStatusAsAdmin = admin.resetOrgA2PStatusAsAdmin.bind(admin);
|
|
11992
|
-
target.getSiteMappings = admin.getSiteMappings.bind(admin);
|
|
11993
|
-
target.getSiteMapping = admin.getSiteMapping.bind(admin);
|
|
11994
|
-
target.updateSiteMapping = admin.updateSiteMapping.bind(admin);
|
|
11995
|
-
target.updateSiteMappingWorkspace = admin.updateSiteMappingWorkspace.bind(admin);
|
|
11996
|
-
target.adminDeleteSiteMapping = admin.adminDeleteSiteMapping.bind(admin);
|
|
11997
|
-
target.createSiteMapping = admin.createSiteMapping.bind(admin);
|
|
11998
|
-
target.createOrUpdateSiteMapping = admin.createOrUpdateSiteMapping.bind(admin);
|
|
11999
|
-
target.deleteSiteMapping = admin.deleteSiteMapping.bind(admin);
|
|
12000
|
-
target.getInboxMappings = admin.getInboxMappings.bind(admin);
|
|
12001
|
-
target.getInboxMapping = admin.getInboxMapping.bind(admin);
|
|
12002
|
-
target.updateInboxMapping = admin.updateInboxMapping.bind(admin);
|
|
12003
|
-
target.deleteAdminInboxMapping = admin.deleteAdminInboxMapping.bind(admin);
|
|
12004
|
-
target.generateChatSummaries = admin.generateChatSummaries.bind(admin);
|
|
12005
|
-
target.executeQuery = admin.executeQuery.bind(admin);
|
|
12006
|
-
target.getTraceUrl = admin.getTraceUrl.bind(admin);
|
|
12007
|
-
target.listAllThemes = admin.listAllThemes.bind(admin);
|
|
12008
|
-
target.startBulkTOSAcceptance = admin.startBulkTOSAcceptance.bind(admin);
|
|
12009
|
-
target.startTokenUsageBackfill = admin.startTokenUsageBackfill.bind(admin);
|
|
12010
|
-
target.updateChatMessage = admin.updateChatMessage.bind(admin);
|
|
12011
|
-
target.createCustomerFromAccount = admin.createCustomerFromAccount.bind(admin);
|
|
12012
|
-
target.getCustomers = admin.getCustomers.bind(admin);
|
|
12013
|
-
target.getCustomer = admin.getCustomer.bind(admin);
|
|
12014
|
-
target.createCustomer = admin.createCustomer.bind(admin);
|
|
12015
|
-
target.updateCustomer = admin.updateCustomer.bind(admin);
|
|
12016
|
-
target.getCustomerAccounts = admin.getCustomerAccounts.bind(admin);
|
|
12017
|
-
target.linkCustomerToAccount = admin.linkCustomerToAccount.bind(admin);
|
|
12018
|
-
target.unlinkCustomerFromAccount = admin.unlinkCustomerFromAccount.bind(admin);
|
|
12019
|
-
target.syncCustomerToStripe = admin.syncCustomerToStripe.bind(admin);
|
|
12020
|
-
target.getStripeCustomer = admin.getStripeCustomer.bind(admin);
|
|
12021
|
-
target.createStripeCustomer = admin.createStripeCustomer.bind(admin);
|
|
12022
|
-
target.updateStripeCustomer = admin.updateStripeCustomer.bind(admin);
|
|
12023
|
-
target.getStripeSubscriptions = admin.getStripeSubscriptions.bind(admin);
|
|
12024
|
-
target.createStripeSubscription = admin.createStripeSubscription.bind(admin);
|
|
12025
|
-
target.createDirectSubscription = admin.createDirectSubscription.bind(admin);
|
|
12026
|
-
target.updateStripeSubscription = admin.updateStripeSubscription.bind(admin);
|
|
12027
|
-
target.cancelStripeSubscription = admin.cancelStripeSubscription.bind(admin);
|
|
12028
|
-
target.provisionWorkspaceForSubscription = admin.provisionWorkspaceForSubscription.bind(admin);
|
|
12029
|
-
target.associateWorkspaceWithSubscription = admin.associateWorkspaceWithSubscription.bind(admin);
|
|
12030
|
-
target.createSubscriptionPaymentLink = admin.createSubscriptionPaymentLink.bind(admin);
|
|
12031
|
-
target.createSetupIntent = admin.createSetupIntent.bind(admin);
|
|
12032
|
-
target.getStripePaymentMethods = admin.getStripePaymentMethods.bind(admin);
|
|
12033
|
-
target.attachStripePaymentMethod = admin.attachStripePaymentMethod.bind(admin);
|
|
12034
|
-
target.detachStripePaymentMethod = admin.detachStripePaymentMethod.bind(admin);
|
|
12035
|
-
target.setDefaultStripePaymentMethod = admin.setDefaultStripePaymentMethod.bind(admin);
|
|
12036
|
-
target.convertSubscriptionToStripe = admin.convertSubscriptionToStripe.bind(admin);
|
|
12037
|
-
target.createCustomerSetupIntent = admin.createCustomerSetupIntent.bind(admin);
|
|
12038
|
-
target.getCustomerPaymentMethods = admin.getCustomerPaymentMethods.bind(admin);
|
|
12039
|
-
target.attachCustomerPaymentMethod = admin.attachCustomerPaymentMethod.bind(admin);
|
|
12040
|
-
target.detachCustomerPaymentMethod = admin.detachCustomerPaymentMethod.bind(admin);
|
|
12041
|
-
target.setDefaultCustomerPaymentMethod = admin.setDefaultCustomerPaymentMethod.bind(admin);
|
|
12042
|
-
target.previewWorkspaceOrganizationChange = admin.previewWorkspaceOrganizationChange.bind(admin);
|
|
12043
|
-
target.changeWorkspaceOrganization = admin.changeWorkspaceOrganization.bind(admin);
|
|
12044
|
-
target.createStripeInvoice = admin.createStripeInvoice.bind(admin);
|
|
12045
|
-
target.getStripeInvoices = admin.getStripeInvoices.bind(admin);
|
|
12046
|
-
target.getStripeUpcomingInvoice = admin.getStripeUpcomingInvoice.bind(admin);
|
|
12047
|
-
target.getBillingPeriods = admin.getBillingPeriods.bind(admin);
|
|
12048
|
-
target.generateInvoice = admin.generateInvoice.bind(admin);
|
|
12049
|
-
target.getInvoices = admin.getInvoices.bind(admin);
|
|
12050
|
-
target.getInvoiceDownloadUrl = admin.getInvoiceDownloadUrl.bind(admin);
|
|
12051
|
-
target.getReceiptDownloadUrl = admin.getReceiptDownloadUrl.bind(admin);
|
|
12052
|
-
target.recordInvoicePayment = admin.recordInvoicePayment.bind(admin);
|
|
12053
|
-
target.getWorkspaceUsageDashboard = admin.getWorkspaceUsageDashboard.bind(admin);
|
|
12054
|
-
target.compareProductsWithStripe = admin.compareProductsWithStripe.bind(admin);
|
|
12055
|
-
target.syncProductToStripe = admin.syncProductToStripe.bind(admin);
|
|
12056
|
-
target.searchStripeProducts = admin.searchStripeProducts.bind(admin);
|
|
12057
|
-
target.getUsageReport = admin.getUsageReport.bind(admin);
|
|
12058
|
-
target.getSubscriptionsAsAdmin = admin.getSubscriptionsAsAdmin.bind(admin);
|
|
12059
|
-
target.getSubscriptionAsAdmin = admin.getSubscriptionAsAdmin.bind(admin);
|
|
12060
|
-
target.updateSubscriptionStatusAsAdmin = admin.updateSubscriptionStatusAsAdmin.bind(admin);
|
|
12061
|
-
target.updateSubscriptionCreditSettingsAsAdmin = admin.updateSubscriptionCreditSettingsAsAdmin.bind(admin);
|
|
12062
|
-
target.grantCreditsAsAdmin = admin.grantCreditsAsAdmin.bind(admin);
|
|
12063
|
-
target.listCreditGrantsAsAdmin = admin.listCreditGrantsAsAdmin.bind(admin);
|
|
12064
|
-
target.getVoiceMetrics = admin.getVoiceMetrics.bind(admin);
|
|
12065
|
-
target.getHealthMetrics = admin.getHealthMetrics.bind(admin);
|
|
12066
|
-
target.getHealthDetail = admin.getHealthDetail.bind(admin);
|
|
12067
|
-
target.getWorkspaceInboxesAsAdmin = admin.getWorkspaceInboxesAsAdmin.bind(admin);
|
|
12068
|
-
target.listWorkspaceChats = admin.listWorkspaceChats.bind(admin);
|
|
12069
|
-
target.getWorkspaceChat = admin.getWorkspaceChat.bind(admin);
|
|
12070
|
-
target.rateWorkspaceChatMessage = admin.rateWorkspaceChatMessage.bind(admin);
|
|
12071
|
-
target.getTemporalAdminConfig = admin.getTemporalAdminConfig.bind(admin);
|
|
12072
|
-
target.listFailedTemporalWorkflows = admin.listFailedTemporalWorkflows.bind(admin);
|
|
12073
|
-
target.listStuckTemporalWorkflows = admin.listStuckTemporalWorkflows.bind(admin);
|
|
12074
|
-
target.getTemporalSummary = admin.getTemporalSummary.bind(admin);
|
|
12075
|
-
target.getTemporalWorkflowDetail = admin.getTemporalWorkflowDetail.bind(admin);
|
|
12076
|
-
target.getResellers = admin.getResellers.bind(admin);
|
|
12077
|
-
target.getReseller = admin.getReseller.bind(admin);
|
|
12078
|
-
target.createReseller = admin.createReseller.bind(admin);
|
|
12079
|
-
target.updateReseller = admin.updateReseller.bind(admin);
|
|
12080
|
-
target.getResellerAccounts = admin.getResellerAccounts.bind(admin);
|
|
12081
|
-
target.linkResellerToAccount = admin.linkResellerToAccount.bind(admin);
|
|
12082
|
-
target.unlinkResellerFromAccount = admin.unlinkResellerFromAccount.bind(admin);
|
|
12083
|
-
}
|
|
12084
|
-
var AdminApi, ApiClient;
|
|
12085
|
-
var init_dist2 = __esm({
|
|
12086
|
-
"../client/dist/index.mjs"() {
|
|
12087
|
-
init_internal();
|
|
12088
|
-
init_internal();
|
|
12089
|
-
init_dist();
|
|
12090
|
-
AdminApi = class extends BaseApiClient {
|
|
12091
|
-
// Support Requests API
|
|
12092
|
-
async listSupportRequestsAsAdmin(params) {
|
|
12093
|
-
return this.fetch(
|
|
12094
|
-
`admin/support-requests${supportRequestParams2(params)}`
|
|
12095
|
-
);
|
|
12096
|
-
}
|
|
12097
|
-
async getSupportRequestAsAdmin(uuid) {
|
|
12098
|
-
return this.fetch(`admin/support-requests/${uuid}`);
|
|
12099
|
-
}
|
|
12100
|
-
async commentOnSupportRequestAsAdmin(uuid, data) {
|
|
12101
|
-
return this.fetch(`admin/support-requests/${uuid}/comments`, {
|
|
12102
|
-
method: "POST",
|
|
12103
|
-
body: JSON.stringify(data)
|
|
12104
|
-
});
|
|
12105
|
-
}
|
|
12106
|
-
async noteOnSupportRequestAsAdmin(uuid, data) {
|
|
12107
|
-
return this.fetch(`admin/support-requests/${uuid}/notes`, {
|
|
12108
|
-
method: "POST",
|
|
12109
|
-
body: JSON.stringify(data)
|
|
12110
|
-
});
|
|
12111
|
-
}
|
|
12112
|
-
async updateSupportRequestStatusAsAdmin(uuid, data) {
|
|
12113
|
-
return this.fetch(`admin/support-requests/${uuid}/status`, {
|
|
12114
|
-
method: "POST",
|
|
12115
|
-
body: JSON.stringify(data)
|
|
12116
|
-
});
|
|
12117
|
-
}
|
|
12118
|
-
async updateSupportRequestAttributesAsAdmin(uuid, data) {
|
|
12119
|
-
return this.fetch(`admin/support-requests/${uuid}/attributes`, {
|
|
12120
|
-
method: "POST",
|
|
12121
|
-
body: JSON.stringify(data)
|
|
12122
|
-
});
|
|
12123
|
-
}
|
|
12124
|
-
async createSupportRequestLinearIssueAsAdmin(uuid) {
|
|
12125
|
-
return this.fetch(`admin/support-requests/${uuid}/linear-issue`, {
|
|
12126
|
-
method: "POST"
|
|
12127
|
-
});
|
|
12128
|
-
}
|
|
12129
|
-
// Proactive Support: outbound (us→customer) requests + resources
|
|
12130
|
-
async createOutboundSupportRequestAsAdmin(data) {
|
|
12131
|
-
return this.fetch("admin/support-requests/outbound", {
|
|
12132
|
-
method: "POST",
|
|
12133
|
-
body: JSON.stringify(data)
|
|
12134
|
-
});
|
|
12135
|
-
}
|
|
12136
|
-
async attachSupportRequestResourceAsAdmin(uuid, data) {
|
|
12137
|
-
return this.fetch(`admin/support-requests/${uuid}/resources`, {
|
|
12138
|
-
method: "POST",
|
|
12139
|
-
body: JSON.stringify(data)
|
|
12140
|
-
});
|
|
12141
|
-
}
|
|
12142
|
-
async revokeSupportRequestResourceAsAdmin(uuid, resourceUuid) {
|
|
12143
|
-
return this.fetch(
|
|
12144
|
-
`admin/support-requests/${uuid}/resources/${resourceUuid}/revoke`,
|
|
12145
|
-
{ method: "POST" }
|
|
12146
|
-
);
|
|
12147
|
-
}
|
|
12148
|
-
// Admin Accounts API
|
|
12149
|
-
async getAccounts(options) {
|
|
12150
|
-
const params = new URLSearchParams();
|
|
12151
|
-
if (options.search) params.append("search", options.search);
|
|
12152
|
-
if (options.createdAfter) params.append("created_after", options.createdAfter);
|
|
12153
|
-
if (options.createdBefore) params.append("created_before", options.createdBefore);
|
|
12154
|
-
if (options.sortBy) params.append("sortBy", options.sortBy);
|
|
12155
|
-
if (options.sortOrder) params.append("sortOrder", options.sortOrder);
|
|
12156
|
-
if (options.page) params.append("page", options.page.toString());
|
|
12157
|
-
if (options.pageSize) params.append("pageSize", options.pageSize.toString());
|
|
12158
|
-
if (options.isActive !== void 0) params.append("isActive", options.isActive.toString());
|
|
12159
|
-
if (options.organizationId !== void 0)
|
|
12160
|
-
params.append("organizationId", options.organizationId.toString());
|
|
12161
|
-
if (options.workspaceId !== void 0)
|
|
12162
|
-
params.append("workspaceId", options.workspaceId.toString());
|
|
12163
|
-
if (options.pendingDeletion !== void 0)
|
|
12164
|
-
params.append("pendingDeletion", options.pendingDeletion.toString());
|
|
12165
|
-
return this.fetch(`admin/accounts?${params.toString()}`);
|
|
12166
|
-
}
|
|
12167
|
-
async getAccountDetails(id) {
|
|
12168
|
-
return this.fetch(`admin/accounts/${id}`);
|
|
12169
|
-
}
|
|
12170
|
-
async getAccountByUuid(uuid) {
|
|
12171
|
-
return this.fetch(`admin/accounts/${uuid}`);
|
|
12172
|
-
}
|
|
12173
|
-
async getAccountMemberships(accountId) {
|
|
12174
|
-
return this.fetch(`admin/accounts/${accountId}/memberships`);
|
|
12175
|
-
}
|
|
12176
|
-
async getAccountOrgMemberships(accountId) {
|
|
12177
|
-
return this.fetch(`admin/accounts/${accountId}/org-memberships`);
|
|
12178
|
-
}
|
|
12179
|
-
async createAccountOrgMembership(accountId, organizationId, role = "member") {
|
|
12180
|
-
return this.fetch(`admin/accounts/${accountId}/org-memberships`, {
|
|
12181
|
-
method: "POST",
|
|
12182
|
-
body: JSON.stringify({ organizationId, role })
|
|
12183
|
-
});
|
|
12184
|
-
}
|
|
12185
|
-
async deleteAccountOrgMembership(accountId, organizationId) {
|
|
12186
|
-
return this.fetch(`admin/accounts/${accountId}/org-memberships/${organizationId}`, {
|
|
12187
|
-
method: "DELETE"
|
|
12188
|
-
});
|
|
12189
|
-
}
|
|
12190
|
-
async getAccountMembership(accountId, workspaceId) {
|
|
12191
|
-
return this.fetch(
|
|
12192
|
-
`admin/accounts/${accountId}/memberships/${workspaceId}`
|
|
12193
|
-
);
|
|
12194
|
-
}
|
|
12195
|
-
async updateAccountMembership(accountId, workspaceId, updates) {
|
|
12196
|
-
return this.fetch(
|
|
12197
|
-
`admin/accounts/${accountId}/memberships/${workspaceId}`,
|
|
12198
|
-
{
|
|
12199
|
-
method: "PUT",
|
|
12200
|
-
body: JSON.stringify(updates)
|
|
12201
|
-
}
|
|
12202
|
-
);
|
|
12203
|
-
}
|
|
12204
|
-
async createAccountMembership(accountId, workspaceId, data) {
|
|
12205
|
-
return this.fetch(
|
|
12206
|
-
`admin/accounts/${accountId}/memberships/${workspaceId}`,
|
|
12207
|
-
{
|
|
12208
|
-
method: "POST",
|
|
12209
|
-
body: JSON.stringify(data)
|
|
12210
|
-
}
|
|
12211
|
-
);
|
|
12212
|
-
}
|
|
12213
|
-
async deleteAccountMembership(accountId, workspaceId) {
|
|
12214
|
-
return this.fetch(`admin/accounts/${accountId}/memberships/${workspaceId}`, {
|
|
12215
|
-
method: "DELETE"
|
|
12216
|
-
});
|
|
12217
|
-
}
|
|
12218
|
-
async updateAccountAsAdmin(id, updates) {
|
|
12219
|
-
return this.fetch(`admin/accounts/${id}`, {
|
|
12220
|
-
method: "PUT",
|
|
12221
|
-
body: JSON.stringify(updates)
|
|
12222
|
-
});
|
|
12223
|
-
}
|
|
12224
|
-
async createAccountAsAdmin(data) {
|
|
12225
|
-
return this.fetch("admin/accounts", {
|
|
12226
|
-
method: "POST",
|
|
12227
|
-
body: JSON.stringify(data)
|
|
12228
|
-
});
|
|
12229
|
-
}
|
|
12230
|
-
async deleteAccountAsAdmin(id) {
|
|
12231
|
-
return this.fetch(`admin/accounts/${id}`, {
|
|
12232
|
-
method: "DELETE"
|
|
12233
|
-
});
|
|
12234
|
-
}
|
|
12235
|
-
// GDPR Data Subject Rights (superuser only)
|
|
12236
|
-
async exportAccountData(accountId) {
|
|
12237
|
-
return this.fetch(`admin/data-rights/${accountId}/export`, {
|
|
12238
|
-
method: "POST"
|
|
12239
|
-
});
|
|
12240
|
-
}
|
|
12241
|
-
async requestAccountDeletion(accountId) {
|
|
12242
|
-
return this.fetch(`admin/data-rights/${accountId}/delete`, {
|
|
12243
|
-
method: "POST"
|
|
12244
|
-
});
|
|
12245
|
-
}
|
|
12246
|
-
async cancelAccountDeletion(accountId) {
|
|
12247
|
-
return this.fetch(`admin/data-rights/${accountId}/cancel-delete`, {
|
|
12248
|
-
method: "POST"
|
|
12249
|
-
});
|
|
12250
|
-
}
|
|
12251
|
-
/**
|
|
12252
|
-
* Look up an account by email or phone. Returns verification status.
|
|
12253
|
-
* Used to check if a verified account exists before creating a new one.
|
|
12254
|
-
*/
|
|
12255
|
-
async lookupAccount(options) {
|
|
12256
|
-
const params = new URLSearchParams();
|
|
12257
|
-
if (options.email) params.append("email", options.email);
|
|
12258
|
-
if (options.phone) params.append("phone", options.phone);
|
|
12259
|
-
return this.fetch(`admin/accounts/lookup?${params.toString()}`);
|
|
12260
|
-
}
|
|
12261
|
-
// Admin Organizations API
|
|
12262
|
-
async getOrganizations(options) {
|
|
12263
|
-
const params = new URLSearchParams();
|
|
12264
|
-
if (options?.search) params.append("search", options.search);
|
|
12265
|
-
if (options?.page) params.append("page", options.page.toString());
|
|
12266
|
-
if (options?.pageSize) params.append("pageSize", options.pageSize.toString());
|
|
12267
|
-
if (options?.noSubscription) params.append("no_subscription", "true");
|
|
12268
|
-
if (options?.sortBy) params.append("sortBy", options.sortBy);
|
|
12269
|
-
if (options?.sortOrder) params.append("sortOrder", options.sortOrder);
|
|
12270
|
-
return this.fetch(
|
|
12271
|
-
`admin/organizations?${params.toString()}`
|
|
12272
|
-
);
|
|
12273
|
-
}
|
|
12274
|
-
/**
|
|
12275
|
-
* Get organization by ID or UUID.
|
|
12276
|
-
* Returns different response based on user's role:
|
|
12277
|
-
* - Admins/Owners: AdminOrganization with full details
|
|
12278
|
-
* - Members: MemberOrgView with basic info and workspace list
|
|
12279
|
-
*
|
|
12280
|
-
* Use `viewType` field to determine the response type:
|
|
12281
|
-
* - 'admin': AdminOrganization
|
|
12282
|
-
* - 'member': MemberOrgView
|
|
12283
|
-
*/
|
|
12284
|
-
async getOrganization(idOrUuid) {
|
|
12285
|
-
return this.fetch(`o/${idOrUuid}`);
|
|
12286
|
-
}
|
|
12287
|
-
/**
|
|
12288
|
-
* Get organization by numeric ID or UUID via admin endpoint.
|
|
12289
|
-
* Does NOT require organization membership — superuser-only.
|
|
12290
|
-
*/
|
|
12291
|
-
async getOrganizationAsAdmin(idOrUuid) {
|
|
12292
|
-
return this.fetch(`admin/organizations/${idOrUuid}`);
|
|
12293
|
-
}
|
|
12294
|
-
async getOrganizationMembersAsAdmin(organizationId, options) {
|
|
12295
|
-
const params = new URLSearchParams();
|
|
12296
|
-
if (options?.search) params.append("search", options.search);
|
|
12297
|
-
if (options?.role) params.append("role", options.role);
|
|
12298
|
-
if (options?.page) params.append("page", options.page.toString());
|
|
12299
|
-
if (options?.pageSize) params.append("pageSize", options.pageSize.toString());
|
|
12300
|
-
const qs = params.toString();
|
|
12301
|
-
return this.fetch(
|
|
12302
|
-
`admin/organizations/${organizationId}/members${qs ? `?${qs}` : ""}`
|
|
12303
|
-
);
|
|
12304
|
-
}
|
|
12305
|
-
async createOrganization(data) {
|
|
12306
|
-
return this.fetch("admin/organizations", {
|
|
12307
|
-
method: "POST",
|
|
12308
|
-
body: JSON.stringify(data)
|
|
12309
|
-
});
|
|
12310
|
-
}
|
|
12311
|
-
async updateOrganization(id, data) {
|
|
12312
|
-
return this.fetch(`admin/organizations/${id}`, {
|
|
12313
|
-
method: "PUT",
|
|
12314
|
-
body: JSON.stringify(data)
|
|
12315
|
-
});
|
|
12316
|
-
}
|
|
12317
|
-
async deleteOrganization(id) {
|
|
12318
|
-
return this.fetch(`admin/organizations/${id}`, {
|
|
12319
|
-
method: "DELETE"
|
|
12320
|
-
});
|
|
12321
|
-
}
|
|
12322
|
-
/**
|
|
12323
|
-
* Join an organization with a specified role (superuser only).
|
|
12324
|
-
* Creates or updates membership in the target org.
|
|
12325
|
-
* @param orgUuid - Organization UUID or numeric ID as string
|
|
12326
|
-
*/
|
|
12327
|
-
async joinOrganization(orgUuid, role = "owner") {
|
|
12328
|
-
return this.fetch(`admin/organizations/${orgUuid}/join`, {
|
|
12329
|
-
method: "POST",
|
|
12330
|
-
body: JSON.stringify({ role })
|
|
12331
|
-
});
|
|
12332
|
-
}
|
|
12333
|
-
/**
|
|
12334
|
-
* Leave an organization (superuser only).
|
|
12335
|
-
* @param orgUuid - Organization UUID or numeric ID as string
|
|
12336
|
-
*/
|
|
12337
|
-
async leaveOrganization(orgUuid) {
|
|
12338
|
-
return this.fetch(`admin/organizations/${orgUuid}/join`, {
|
|
12339
|
-
method: "DELETE"
|
|
12340
|
-
});
|
|
12341
|
-
}
|
|
12342
|
-
async generateLogoUploadUrl(organizationUuid, data) {
|
|
12343
|
-
return this.fetch(`o/${organizationUuid}/logo-upload-url`, {
|
|
12344
|
-
method: "POST",
|
|
12345
|
-
body: JSON.stringify(data)
|
|
12346
|
-
});
|
|
12347
|
-
}
|
|
12348
|
-
// Organization Members API - moved to OrgApi at /api/v2/o/{org_uuid}/members
|
|
12349
|
-
// See packages/client/src/api/org.ts
|
|
12350
|
-
// Organization Invitations API - moved to OrgApi at /api/v2/o/{org_uuid}/invitations
|
|
12351
|
-
// See packages/client/src/api/org.ts
|
|
12352
|
-
// Admin Products API
|
|
12353
|
-
async importProducts(workspaceId) {
|
|
12354
|
-
return this.fetch("admin/import-products", {
|
|
12355
|
-
method: "POST",
|
|
12356
|
-
body: JSON.stringify({ workspaceId })
|
|
12357
|
-
});
|
|
12358
|
-
}
|
|
12359
|
-
// ===== Product CRUD =====
|
|
12360
|
-
async createProductAsAdmin(product) {
|
|
12361
|
-
return this.fetch("admin/products", {
|
|
12362
|
-
method: "POST",
|
|
12363
|
-
body: JSON.stringify(product)
|
|
12364
|
-
});
|
|
12365
|
-
}
|
|
12366
|
-
async getProductsAsAdmin(workspaceUuid, productTypes) {
|
|
12367
|
-
const params = new URLSearchParams();
|
|
12368
|
-
if (workspaceUuid) {
|
|
12369
|
-
params.append("workspace_uuid", workspaceUuid);
|
|
12370
|
-
}
|
|
12371
|
-
if (productTypes && productTypes.length > 0) {
|
|
12372
|
-
productTypes.forEach((type) => params.append("product_types", type));
|
|
12373
|
-
}
|
|
12374
|
-
const queryString = params.toString();
|
|
12375
|
-
return this.fetch(`admin/products${queryString ? `?${queryString}` : ""}`);
|
|
12376
|
-
}
|
|
12377
|
-
async getProductAsAdmin(productId) {
|
|
12378
|
-
return this.fetch(`admin/products/${productId}`);
|
|
12379
|
-
}
|
|
12380
|
-
async updateProductAsAdmin(product_id, product) {
|
|
12381
|
-
return this.fetch(`admin/products/${product_id}`, {
|
|
12382
|
-
method: "PUT",
|
|
12383
|
-
body: JSON.stringify(product)
|
|
12384
|
-
});
|
|
12385
|
-
}
|
|
12386
|
-
async deleteProductAsAdmin(productId) {
|
|
12387
|
-
return this.fetch(`admin/products/${productId}`, {
|
|
12388
|
-
method: "DELETE"
|
|
12389
|
-
});
|
|
12390
|
-
}
|
|
12391
|
-
// Admin Workspace API
|
|
12392
|
-
async getWorkspacesAsAdmin(options = {}) {
|
|
12393
|
-
const params = new URLSearchParams();
|
|
12394
|
-
if (options.page !== void 0) params.append("page", options.page.toString());
|
|
12395
|
-
if (options.pageSize !== void 0) params.append("pageSize", options.pageSize.toString());
|
|
12396
|
-
if (options.sortBy) params.append("sortBy", options.sortBy);
|
|
12397
|
-
if (options.sortOrder) params.append("sortOrder", options.sortOrder);
|
|
12398
|
-
if (options.search) params.append("search", options.search);
|
|
12399
|
-
if (options.isReseller !== void 0)
|
|
12400
|
-
params.append("isReseller", options.isReseller.toString());
|
|
12401
|
-
if (options.organizationId !== void 0)
|
|
12402
|
-
params.append("organizationId", options.organizationId.toString());
|
|
12403
|
-
if (options.noActiveSubscription) params.append("noActiveSubscription", "true");
|
|
12404
|
-
return this.fetch(`admin/workspaces?${params.toString()}`);
|
|
12405
|
-
}
|
|
12406
|
-
async getWorkspaceAsAdmin(wid) {
|
|
12407
|
-
return this.fetch(`admin/workspaces/${wid}`);
|
|
12408
|
-
}
|
|
12409
|
-
async getWorkspaceByNumericIdAsAdmin(workspace_id) {
|
|
12410
|
-
return this.fetch(`admin/workspaces/id/${workspace_id}`);
|
|
12411
|
-
}
|
|
12412
|
-
async createWorkspaceAsAdmin(ws) {
|
|
12413
|
-
return this.fetch("admin/workspaces", {
|
|
12414
|
-
method: "POST",
|
|
12415
|
-
body: JSON.stringify(ws)
|
|
12416
|
-
});
|
|
12417
|
-
}
|
|
12418
|
-
async updateWorkspaceAsAdmin(wid, ws) {
|
|
12419
|
-
return this.fetch(`admin/workspaces/${wid}`, {
|
|
12420
|
-
method: "PUT",
|
|
12421
|
-
body: JSON.stringify(ws)
|
|
12422
|
-
});
|
|
12423
|
-
}
|
|
12424
|
-
async deleteWorkspaceAsAdmin(wid) {
|
|
12425
|
-
return this.fetch(`admin/workspaces/${wid}`, {
|
|
12426
|
-
method: "DELETE"
|
|
12427
|
-
});
|
|
12428
|
-
}
|
|
12429
|
-
async createSchemaAsAdmin(wid) {
|
|
12430
|
-
return this.fetch(`admin/workspaces/${wid}/provision/create`, {
|
|
12431
|
-
method: "POST"
|
|
12432
|
-
});
|
|
12433
|
-
}
|
|
12434
|
-
async migrateSchemaAsAdmin(wid) {
|
|
12435
|
-
return this.fetch(`admin/workspaces/${wid}/provision/migrate`, {
|
|
12436
|
-
method: "POST"
|
|
12437
|
-
});
|
|
12438
|
-
}
|
|
12439
|
-
async provisionWorkspaceAsAdmin(wid) {
|
|
12440
|
-
return this.fetch(`admin/workspaces/${wid}/provision`, {
|
|
12441
|
-
method: "POST"
|
|
12442
|
-
});
|
|
12443
|
-
}
|
|
12444
|
-
async refreshProvisionStatusAsAdmin(wid) {
|
|
12445
|
-
return this.fetch(`admin/workspaces/${wid}/provision/refresh`, {
|
|
12446
|
-
method: "POST"
|
|
12447
|
-
});
|
|
12448
|
-
}
|
|
12449
|
-
async enableMaintenanceMode(wid) {
|
|
12450
|
-
return this.fetch(`admin/workspaces/${wid}/maintenance`, {
|
|
12451
|
-
method: "PUT"
|
|
12452
|
-
});
|
|
12453
|
-
}
|
|
12454
|
-
async disableMaintenanceMode(wid) {
|
|
12455
|
-
return this.fetch(`admin/workspaces/${wid}/maintenance`, {
|
|
12456
|
-
method: "DELETE"
|
|
12457
|
-
});
|
|
12458
|
-
}
|
|
12459
|
-
// ===== Workspace Health Check =====
|
|
12460
|
-
async getWorkspaceHealth(workspaceUuid) {
|
|
12461
|
-
return this.fetch(`admin/workspaces/${workspaceUuid}/health`);
|
|
12462
|
-
}
|
|
12463
|
-
async provisionPlanFeatures(workspaceUuid, request) {
|
|
12464
|
-
return this.fetch(`admin/workspaces/${workspaceUuid}/provision-plan`, {
|
|
12465
|
-
method: "POST",
|
|
12466
|
-
body: JSON.stringify(request || {})
|
|
12467
|
-
});
|
|
12468
|
-
}
|
|
12469
|
-
/**
|
|
12470
|
-
* Switch a workspace's plan product on its active SubscriptionItem.
|
|
12471
|
-
*
|
|
12472
|
-
* Superuser only. Re-syncs ``workspace.features`` from the new product
|
|
12473
|
-
* and emits a ``WORKSPACE_PRODUCT_CHANGED`` audit event identifying the
|
|
12474
|
-
* actor, target workspace, prior and new product, and feature diff.
|
|
12475
|
-
*
|
|
12476
|
-
* Stripe is not touched here; price-id changes belong to the dedicated
|
|
12477
|
-
* Stripe sync surface (``syncProductToStripe``).
|
|
12478
|
-
*/
|
|
12479
|
-
async changeWorkspaceProduct(workspaceUuid, productId) {
|
|
12480
|
-
const body = { productId };
|
|
12481
|
-
return this.fetch(
|
|
12482
|
-
`admin/workspaces/${workspaceUuid}/product`,
|
|
12483
|
-
{
|
|
12484
|
-
method: "POST",
|
|
12485
|
-
body: JSON.stringify(body)
|
|
12486
|
-
}
|
|
12487
|
-
);
|
|
12488
|
-
}
|
|
12489
|
-
// ===== Workflow Access Validation =====
|
|
12490
|
-
async validateWorkflowAccessAsAdmin(workspaceUuid) {
|
|
12491
|
-
const params = new URLSearchParams();
|
|
12492
|
-
if (workspaceUuid) params.append("workspace_uuid", workspaceUuid);
|
|
12493
|
-
const qs = params.toString();
|
|
12494
|
-
return this.fetch(
|
|
12495
|
-
`admin/workspaces/validate-workflow-access${qs ? `?${qs}` : ""}`
|
|
12496
|
-
);
|
|
12497
|
-
}
|
|
12498
|
-
async mergeMembers(wid, request) {
|
|
12499
|
-
return this.fetch(`admin/workspaces/${wid}/merge-members`, {
|
|
12500
|
-
method: "POST",
|
|
12501
|
-
body: JSON.stringify(request)
|
|
12502
|
-
});
|
|
12503
|
-
}
|
|
12504
|
-
async getAdminWorkspaceMember(wid) {
|
|
12505
|
-
return this.fetch(`admin/workspaces/${wid}/me`, {
|
|
12506
|
-
method: "GET"
|
|
12507
|
-
});
|
|
12508
|
-
}
|
|
12509
|
-
async createAdminWorkspaceMember(wid, data) {
|
|
12510
|
-
return this.fetch(`admin/workspaces/${wid}/me`, {
|
|
12511
|
-
method: "POST",
|
|
12512
|
-
body: JSON.stringify(data)
|
|
12513
|
-
});
|
|
12514
|
-
}
|
|
12515
|
-
async updateAdminWorkspaceMember(wid, data) {
|
|
12516
|
-
return this.fetch(`admin/workspaces/${wid}/me`, {
|
|
12517
|
-
method: "PUT",
|
|
12518
|
-
body: JSON.stringify(data)
|
|
12519
|
-
});
|
|
12520
|
-
}
|
|
12521
|
-
async unarchiveAdminWorkspaceMember(wid) {
|
|
12522
|
-
return this.fetch(`admin/workspaces/${wid}/me/unarchive`, {
|
|
12523
|
-
method: "POST"
|
|
12524
|
-
});
|
|
12525
|
-
}
|
|
12526
|
-
async getAdminWorkspaceMemberRoles(wid) {
|
|
12527
|
-
return this.fetch(`admin/workspaces/${wid}/member-roles`);
|
|
12528
|
-
}
|
|
12529
|
-
async getUnmappedPhoneNumbers() {
|
|
12530
|
-
return this.fetch(`admin/phone-numbers/unmapped`);
|
|
12531
|
-
}
|
|
12532
|
-
async getWorkspaceUnmappedPhoneNumbers(workspaceId) {
|
|
12533
|
-
return this.fetch(
|
|
12534
|
-
`admin/phone-numbers/workspace/${workspaceId}/unmapped`
|
|
12535
|
-
);
|
|
12536
|
-
}
|
|
12537
|
-
async getWorkspacePhoneNumbersAsAdmin(workspaceRef) {
|
|
12538
|
-
return this.fetch(`admin/workspaces/${workspaceRef}/phone-numbers`);
|
|
12539
|
-
}
|
|
12540
|
-
// Phone Numbers API (Provider phone numbers from Twilio, AWS, etc.)
|
|
12541
|
-
async getProviderPhoneNumbers(options = {}) {
|
|
12542
|
-
const params = new URLSearchParams();
|
|
12543
|
-
if (options.page) params.append("page", options.page.toString());
|
|
12544
|
-
if (options.pageSize) params.append("pageSize", options.pageSize.toString());
|
|
12545
|
-
if (options.search) params.append("search", options.search);
|
|
12546
|
-
if (options.isAssigned !== void 0)
|
|
12547
|
-
params.append("is_assigned", String(options.isAssigned));
|
|
12548
|
-
if (options.provider) params.append("provider", options.provider);
|
|
12549
|
-
if (options.organizationId !== void 0)
|
|
12550
|
-
params.append("organizationId", options.organizationId.toString());
|
|
12551
|
-
if (options.sortBy) params.append("sortBy", options.sortBy);
|
|
12552
|
-
if (options.sortOrder) params.append("sortOrder", options.sortOrder);
|
|
12553
|
-
return this.fetch(
|
|
12554
|
-
`admin/phone-numbers${params.toString() ? `?${params.toString()}` : ""}`
|
|
12555
|
-
);
|
|
12556
|
-
}
|
|
12557
|
-
async getProviderPhoneNumber(id) {
|
|
12558
|
-
return this.fetch(`admin/phone-numbers/${id}`);
|
|
12559
|
-
}
|
|
12560
|
-
async updateProviderPhoneNumber(id, data) {
|
|
12561
|
-
return this.fetch(`admin/phone-numbers/${id}`, {
|
|
12562
|
-
method: "PATCH",
|
|
12563
|
-
body: JSON.stringify(data)
|
|
12564
|
-
});
|
|
12565
|
-
}
|
|
12566
|
-
async mapMainAccountPhone(data) {
|
|
12567
|
-
return this.fetch(`admin/phone-numbers/map-from-main-account`, {
|
|
12568
|
-
method: "POST",
|
|
12569
|
-
body: JSON.stringify(data)
|
|
12570
|
-
});
|
|
12571
|
-
}
|
|
12572
|
-
async unmapPhoneNumber(data) {
|
|
12573
|
-
return this.fetch(`admin/phone-numbers/unmap`, {
|
|
12574
|
-
method: "POST",
|
|
12575
|
-
body: JSON.stringify(data)
|
|
12576
|
-
});
|
|
12577
|
-
}
|
|
12578
|
-
async searchAvailablePhoneNumbersAsAdmin(data) {
|
|
12579
|
-
return this.fetch(`admin/phone-numbers/search`, {
|
|
12580
|
-
method: "POST",
|
|
12581
|
-
body: JSON.stringify(data)
|
|
12582
|
-
});
|
|
12583
|
-
}
|
|
12584
|
-
async purchasePhoneNumberAsAdmin(data) {
|
|
12585
|
-
return this.fetch(`admin/phone-numbers/purchase`, {
|
|
12586
|
-
method: "POST",
|
|
12587
|
-
body: JSON.stringify(data)
|
|
12588
|
-
});
|
|
12589
|
-
}
|
|
12590
|
-
async getOrgA2PStatusAsAdmin(organizationId) {
|
|
12591
|
-
return this.fetch(`admin/organizations/${organizationId}/a2p-status`);
|
|
12592
|
-
}
|
|
12593
|
-
async resetOrgA2PStatusAsAdmin(organizationId) {
|
|
12594
|
-
return this.fetch(`admin/organizations/${organizationId}/a2p-status`, {
|
|
12595
|
-
method: "DELETE"
|
|
12596
|
-
});
|
|
12597
|
-
}
|
|
12598
|
-
// Site Mappings API
|
|
12599
|
-
async getSiteMappings(options) {
|
|
12600
|
-
const queryParams = new URLSearchParams();
|
|
12601
|
-
if (options?.search) queryParams.append("search", options.search);
|
|
12602
|
-
if (options?.page) queryParams.append("page", options.page.toString());
|
|
12603
|
-
if (options?.pageSize) queryParams.append("pageSize", options.pageSize.toString());
|
|
12604
|
-
const queryString = queryParams.toString();
|
|
12605
|
-
const url = `admin/site-mappings${queryString ? `?${queryString}` : ""}`;
|
|
12606
|
-
return this.fetch(url);
|
|
12607
|
-
}
|
|
12608
|
-
async getSiteMapping(siteId) {
|
|
12609
|
-
return this.fetch(`admin/site-mappings/${siteId}`);
|
|
12610
|
-
}
|
|
12611
|
-
async updateSiteMapping(siteId, data) {
|
|
12612
|
-
return this.fetch(`admin/site-mappings/${siteId}`, {
|
|
12613
|
-
method: "PUT",
|
|
12614
|
-
body: JSON.stringify(data)
|
|
12615
|
-
});
|
|
12616
|
-
}
|
|
12617
|
-
async updateSiteMappingWorkspace(siteId, workspaceId) {
|
|
12618
|
-
return this.updateSiteMapping(siteId, {
|
|
12619
|
-
workspaceId,
|
|
12620
|
-
siteUuid: ""
|
|
12621
|
-
// These fields are required by the type but will be ignored on the server
|
|
12622
|
-
});
|
|
12623
|
-
}
|
|
12624
|
-
async adminDeleteSiteMapping(siteId) {
|
|
12625
|
-
return this.fetch(`admin/site-mappings/${siteId}`, {
|
|
12626
|
-
method: "DELETE"
|
|
12627
|
-
});
|
|
12628
|
-
}
|
|
12629
|
-
async createSiteMapping(mapping) {
|
|
12630
|
-
return this.fetch(`admin/site-mappings`, {
|
|
12631
|
-
method: "POST",
|
|
12632
|
-
body: JSON.stringify(mapping)
|
|
12633
|
-
});
|
|
12634
|
-
}
|
|
12635
|
-
// Keep for backward compatibility
|
|
12636
|
-
async createOrUpdateSiteMapping(wid, mapping) {
|
|
12637
|
-
return this.fetch(`admin/workspaces/${wid}/site-mappings`, {
|
|
12638
|
-
method: "POST",
|
|
12639
|
-
body: JSON.stringify(mapping)
|
|
12640
|
-
});
|
|
12641
|
-
}
|
|
12642
|
-
async deleteSiteMapping(wid, siteUuid) {
|
|
12643
|
-
return this.fetch(`admin/workspaces/${wid}/site-mappings/${siteUuid}`, {
|
|
12644
|
-
method: "DELETE"
|
|
12645
|
-
});
|
|
12646
|
-
}
|
|
12647
|
-
async getWorkspaceInboxesAsAdmin(workspaceUuid) {
|
|
12648
|
-
return this.fetch(
|
|
12649
|
-
`admin/workspaces/${workspaceUuid}/inboxes`
|
|
12650
|
-
);
|
|
12651
|
-
}
|
|
12652
|
-
// Admin Inbox Mappings API
|
|
12653
|
-
async getInboxMappings(options = {}) {
|
|
12654
|
-
const params = new URLSearchParams();
|
|
12655
|
-
if (options.page) params.append("page", options.page.toString());
|
|
12656
|
-
if (options.pageSize) params.append("pageSize", options.pageSize.toString());
|
|
12657
|
-
if (options.search) params.append("search", options.search);
|
|
12658
|
-
if (options.workspaceId) params.append("workspaceId", options.workspaceId.toString());
|
|
12659
|
-
return this.fetch(
|
|
12660
|
-
`admin/inbox-mappings${params.toString() ? `?${params.toString()}` : ""}`
|
|
12661
|
-
);
|
|
12662
|
-
}
|
|
12663
|
-
async getInboxMapping(id) {
|
|
12664
|
-
return this.fetch(`admin/inbox-mappings/${id}`);
|
|
12665
|
-
}
|
|
12666
|
-
async updateInboxMapping(id, workspaceId) {
|
|
12667
|
-
return this.fetch(`admin/inbox-mappings/${id}`, {
|
|
12668
|
-
method: "PUT",
|
|
12669
|
-
body: JSON.stringify({ workspaceId })
|
|
12670
|
-
});
|
|
12671
|
-
}
|
|
12672
|
-
async deleteAdminInboxMapping(id) {
|
|
12673
|
-
return this.fetch(`admin/inbox-mappings/${id}`, {
|
|
12674
|
-
method: "DELETE"
|
|
12675
|
-
});
|
|
12676
|
-
}
|
|
12677
|
-
// Evaluation API
|
|
12678
|
-
async generateChatSummaries(options) {
|
|
12679
|
-
return this.fetch("admin/generate-summaries", {
|
|
12680
|
-
method: "POST",
|
|
12681
|
-
body: JSON.stringify({
|
|
12682
|
-
after_date: options.afterDate ? options.afterDate.toISOString().split("T")[0] + "T" + options.afterDate.toTimeString().split(" ")[0] : void 0,
|
|
12683
|
-
only_without_summaries: options.onlyWithoutSummaries ?? true
|
|
12684
|
-
})
|
|
12685
|
-
});
|
|
12686
|
-
}
|
|
12687
|
-
async executeQuery(options) {
|
|
12688
|
-
return this.fetch("admin/execute-query", {
|
|
12689
|
-
method: "POST",
|
|
12690
|
-
body: JSON.stringify({
|
|
12691
|
-
query: options.query,
|
|
12692
|
-
workspace_uuid: options.workspaceUuid
|
|
12693
|
-
})
|
|
12694
|
-
});
|
|
12695
|
-
}
|
|
12696
|
-
/**
|
|
12697
|
-
* Resolve a Langfuse trace UI URL from a trace ID, chat ID, or message ID.
|
|
12698
|
-
*
|
|
12699
|
-
* URL-only: never fetches Langfuse payloads, Message content, or
|
|
12700
|
-
* tool arguments. Exactly one of ``traceId``, ``chatId``, or
|
|
12701
|
-
* ``messageId`` must be set; chat/message forms require a
|
|
12702
|
-
* workspaceUuid. See
|
|
12703
|
-
* docs/development/observability/llm-call-investigation.md.
|
|
12704
|
-
*/
|
|
12705
|
-
async getTraceUrl(options) {
|
|
12706
|
-
return this.fetch("admin/trace/url", {
|
|
12707
|
-
method: "POST",
|
|
12708
|
-
body: JSON.stringify({
|
|
12709
|
-
trace_id: options.traceId,
|
|
12710
|
-
chat_id: options.chatId,
|
|
12711
|
-
message_id: options.messageId,
|
|
12712
|
-
workspace_uuid: options.workspaceUuid
|
|
12713
|
-
})
|
|
12714
|
-
});
|
|
12715
|
-
}
|
|
12716
|
-
// Admin Themes API
|
|
12717
|
-
async listAllThemes() {
|
|
12718
|
-
return this.fetch("admin/themes/list");
|
|
12719
|
-
}
|
|
12720
|
-
// Missing Memberships API
|
|
12721
|
-
async getMissingMemberships(workspaceId) {
|
|
12722
|
-
return this.fetch(
|
|
12723
|
-
`admin/workspaces/${workspaceId}/missing-memberships`
|
|
12724
|
-
);
|
|
12725
|
-
}
|
|
12726
|
-
async linkMissingMembership(workspaceId, memberId, accountId) {
|
|
12727
|
-
return this.fetch(
|
|
12728
|
-
`admin/workspaces/${workspaceId}/link-membership?member_id=${memberId}&account_id=${accountId}`,
|
|
12729
|
-
{
|
|
12730
|
-
method: "POST"
|
|
12731
|
-
}
|
|
12732
|
-
);
|
|
12733
|
-
}
|
|
12734
|
-
// Bulk Phone Classification API
|
|
12735
|
-
async startBulkPhoneClassification(workspaceUuid, includeUnknown = false) {
|
|
12736
|
-
const params = new URLSearchParams();
|
|
12737
|
-
params.append("include_unknown", includeUnknown.toString());
|
|
12738
|
-
return this.fetch(`admin/workspaces/${workspaceUuid}/bulk-classify-phones?${params.toString()}`, {
|
|
12739
|
-
method: "POST"
|
|
12740
|
-
});
|
|
12741
|
-
}
|
|
12742
|
-
// Bulk TOS Acceptance API
|
|
12743
|
-
async startBulkTOSAcceptance(workspaceUuid) {
|
|
12744
|
-
return this.fetch(`admin/workspaces/${workspaceUuid}/bulk-accept-tos`, {
|
|
12745
|
-
method: "POST"
|
|
12746
|
-
});
|
|
12747
|
-
}
|
|
12748
|
-
// Token Usage Backfill API
|
|
12749
|
-
async startTokenUsageBackfill(workspaceUuid) {
|
|
12750
|
-
return this.fetch(`admin/workspaces/${workspaceUuid}/backfill-token-usage`, {
|
|
12751
|
-
method: "POST"
|
|
12752
|
-
});
|
|
12753
|
-
}
|
|
12754
|
-
// ===== Admin Chat Endpoints =====
|
|
12755
|
-
async listWorkspaceChats(workspaceUuid, options) {
|
|
12756
|
-
const params = new URLSearchParams();
|
|
12757
|
-
if (options?.page) params.set("page", String(options.page));
|
|
12758
|
-
if (options?.pageSize) params.set("pageSize", String(options.pageSize));
|
|
12759
|
-
if (options?.search) params.set("search", options.search);
|
|
12760
|
-
if (options?.chatType) params.set("chatType", options.chatType);
|
|
12761
|
-
if (options?.channel) params.set("channel", options.channel);
|
|
12762
|
-
if (options?.archived !== void 0) params.set("archived", String(options.archived));
|
|
12763
|
-
const qs = params.toString();
|
|
12764
|
-
return this.fetch(
|
|
12765
|
-
`admin/workspaces/${workspaceUuid}/chats${qs ? `?${qs}` : ""}`
|
|
12766
|
-
);
|
|
12767
|
-
}
|
|
12768
|
-
async getWorkspaceChat(workspaceUuid, chatId, options) {
|
|
12769
|
-
const params = new URLSearchParams();
|
|
12770
|
-
if (options?.page) params.set("page", String(options.page));
|
|
12771
|
-
if (options?.pageSize) params.set("pageSize", String(options.pageSize));
|
|
12772
|
-
const qs = params.toString();
|
|
12773
|
-
return this.fetch(
|
|
12774
|
-
`admin/workspaces/${workspaceUuid}/chats/${chatId}${qs ? `?${qs}` : ""}`
|
|
12775
|
-
);
|
|
12776
|
-
}
|
|
12777
|
-
// Update chat message content
|
|
12778
|
-
async updateChatMessage(workspaceUuid, chatId, messageId, content) {
|
|
12779
|
-
return this.fetch(`admin/workspaces/${workspaceUuid}/chats/${chatId}/messages/${messageId}`, {
|
|
12780
|
-
method: "POST",
|
|
12781
|
-
body: JSON.stringify({ content })
|
|
12782
|
-
});
|
|
12783
|
-
}
|
|
12784
|
-
async rateWorkspaceChatMessage(workspaceUuid, chatId, messageId, rating, comment) {
|
|
12785
|
-
return this.fetch(
|
|
12786
|
-
`admin/workspaces/${workspaceUuid}/chats/${chatId}/messages/${messageId}/rate`,
|
|
12787
|
-
{
|
|
12788
|
-
method: "POST",
|
|
12789
|
-
body: JSON.stringify({ rating, comment })
|
|
12790
|
-
}
|
|
12791
|
-
);
|
|
12792
|
-
}
|
|
12793
|
-
// ===== Stripe Customer Management =====
|
|
12794
|
-
async getStripeCustomer(accountId) {
|
|
12795
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/customer`);
|
|
12796
|
-
}
|
|
12797
|
-
async createStripeCustomer(accountId, data) {
|
|
12798
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/customer`, {
|
|
12799
|
-
method: "POST",
|
|
12800
|
-
body: JSON.stringify(data)
|
|
12801
|
-
});
|
|
12802
|
-
}
|
|
12803
|
-
async updateStripeCustomer(accountId, data) {
|
|
12804
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/customer`, {
|
|
12805
|
-
method: "PUT",
|
|
12806
|
-
body: JSON.stringify(data)
|
|
12807
|
-
});
|
|
12808
|
-
}
|
|
12809
|
-
// ===== Customer Management =====
|
|
12810
|
-
async createCustomerFromAccount(accountId) {
|
|
12811
|
-
return this.fetch(`admin/accounts/${accountId}/customer`, {
|
|
12812
|
-
method: "POST"
|
|
12813
|
-
});
|
|
12814
|
-
}
|
|
12815
|
-
async getCustomers(options) {
|
|
12816
|
-
const params = new URLSearchParams();
|
|
12817
|
-
if (options?.search) params.set("search", options.search);
|
|
12818
|
-
if (options?.page) params.set("page", String(options.page));
|
|
12819
|
-
if (options?.pageSize) params.set("page_size", String(options.pageSize));
|
|
12820
|
-
const qs = params.toString();
|
|
12821
|
-
return this.fetch(`admin/customers${qs ? `?${qs}` : ""}`);
|
|
12822
|
-
}
|
|
12823
|
-
async getCustomer(customerId) {
|
|
12824
|
-
return this.fetch(`admin/customers/${customerId}`);
|
|
12825
|
-
}
|
|
12826
|
-
async createCustomer(data) {
|
|
12827
|
-
return this.fetch("admin/customers", {
|
|
12828
|
-
method: "POST",
|
|
12829
|
-
body: JSON.stringify(data)
|
|
12830
|
-
});
|
|
12831
|
-
}
|
|
12832
|
-
async updateCustomer(customerId, data) {
|
|
12833
|
-
return this.fetch(`admin/customers/${customerId}`, {
|
|
12834
|
-
method: "PUT",
|
|
12835
|
-
body: JSON.stringify(data)
|
|
12836
|
-
});
|
|
12837
|
-
}
|
|
12838
|
-
async syncCustomerToStripe(customerId) {
|
|
12839
|
-
return this.fetch(`admin/customers/${customerId}/stripe/sync`, {
|
|
12840
|
-
method: "POST"
|
|
12841
|
-
});
|
|
12842
|
-
}
|
|
12843
|
-
async getCustomerAccounts(customerId) {
|
|
12844
|
-
return this.fetch(`admin/customers/${customerId}/accounts`);
|
|
12845
|
-
}
|
|
12846
|
-
async linkCustomerToAccount(customerId, accountId, role) {
|
|
12847
|
-
return this.fetch(`admin/customers/${customerId}/accounts`, {
|
|
12848
|
-
method: "POST",
|
|
12849
|
-
body: JSON.stringify({ accountId, role })
|
|
12850
|
-
});
|
|
12851
|
-
}
|
|
12852
|
-
async unlinkCustomerFromAccount(customerId, accountId) {
|
|
12853
|
-
await this.fetch(`admin/customers/${customerId}/accounts/${accountId}`, {
|
|
12854
|
-
method: "DELETE"
|
|
12855
|
-
});
|
|
12856
|
-
}
|
|
12857
|
-
// ===== Stripe Subscription Management =====
|
|
12858
|
-
async getStripeSubscriptions(accountId) {
|
|
12859
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/subscriptions`);
|
|
12860
|
-
}
|
|
12861
|
-
async createStripeSubscription(customerId, data) {
|
|
12862
|
-
return this.fetch(`admin/customers/${customerId}/stripe/subscriptions`, {
|
|
12863
|
-
method: "POST",
|
|
12864
|
-
body: JSON.stringify(data)
|
|
12865
|
-
});
|
|
12866
|
-
}
|
|
12867
|
-
async createDirectSubscription(customerId, data) {
|
|
12868
|
-
return this.fetch(`admin/customers/${customerId}/direct/subscriptions`, {
|
|
12869
|
-
method: "POST",
|
|
12870
|
-
body: JSON.stringify(data)
|
|
12871
|
-
});
|
|
12872
|
-
}
|
|
12873
|
-
async updateStripeSubscription(accountId, subscriptionId, data) {
|
|
12874
|
-
return this.fetch(
|
|
12875
|
-
`admin/accounts/${accountId}/stripe/subscriptions/${subscriptionId}`,
|
|
12876
|
-
{
|
|
12877
|
-
method: "PUT",
|
|
12878
|
-
body: JSON.stringify(data)
|
|
12879
|
-
}
|
|
12880
|
-
);
|
|
12881
|
-
}
|
|
12882
|
-
async cancelStripeSubscription(accountId, subscriptionId) {
|
|
12883
|
-
return this.fetch(
|
|
12884
|
-
`admin/accounts/${accountId}/stripe/subscriptions/${subscriptionId}`,
|
|
12885
|
-
{
|
|
12886
|
-
method: "DELETE"
|
|
12887
|
-
}
|
|
12888
|
-
);
|
|
12889
|
-
}
|
|
12890
|
-
async provisionWorkspaceForSubscription(accountId, subscriptionId) {
|
|
12891
|
-
return this.fetch(
|
|
12892
|
-
`admin/accounts/${accountId}/stripe/subscriptions/${subscriptionId}/provision`,
|
|
12893
|
-
{
|
|
12894
|
-
method: "POST"
|
|
12895
|
-
}
|
|
12896
|
-
);
|
|
12897
|
-
}
|
|
12898
|
-
async associateWorkspaceWithSubscription(accountId, subscriptionId, workspaceId) {
|
|
12899
|
-
return this.fetch(
|
|
12900
|
-
`admin/accounts/${accountId}/stripe/subscriptions/${subscriptionId}/associate?workspace_id=${workspaceId}`,
|
|
12901
|
-
{
|
|
12902
|
-
method: "POST"
|
|
12903
|
-
}
|
|
12904
|
-
);
|
|
12905
|
-
}
|
|
12906
|
-
async createSubscriptionPaymentLink(accountId, subscriptionId) {
|
|
12907
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/subscriptions/${subscriptionId}/payment-link`, {
|
|
12908
|
-
method: "POST"
|
|
12909
|
-
});
|
|
12910
|
-
}
|
|
12911
|
-
// ===== Stripe Payment Methods Management =====
|
|
12912
|
-
async createSetupIntent(accountId) {
|
|
12913
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/setup-intent`, {
|
|
12914
|
-
method: "POST"
|
|
12915
|
-
});
|
|
12916
|
-
}
|
|
12917
|
-
async getStripePaymentMethods(accountId) {
|
|
12918
|
-
return this.fetch(
|
|
12919
|
-
`admin/accounts/${accountId}/stripe/payment-methods`
|
|
12920
|
-
);
|
|
12921
|
-
}
|
|
12922
|
-
async attachStripePaymentMethod(accountId, paymentMethodId, setAsDefault = false) {
|
|
12923
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/payment-methods/${paymentMethodId}/attach`, {
|
|
12924
|
-
method: "POST",
|
|
12925
|
-
body: JSON.stringify({ setAsDefault })
|
|
12926
|
-
});
|
|
12927
|
-
}
|
|
12928
|
-
async detachStripePaymentMethod(accountId, paymentMethodId) {
|
|
12929
|
-
return this.fetch(
|
|
12930
|
-
`admin/accounts/${accountId}/stripe/payment-methods/${paymentMethodId}`,
|
|
12931
|
-
{
|
|
12932
|
-
method: "DELETE"
|
|
12933
|
-
}
|
|
12934
|
-
);
|
|
12935
|
-
}
|
|
12936
|
-
async setDefaultStripePaymentMethod(accountId, paymentMethodId) {
|
|
12937
|
-
return this.fetch(
|
|
12938
|
-
`admin/accounts/${accountId}/stripe/payment-methods/${paymentMethodId}/set-default`,
|
|
12939
|
-
{
|
|
12940
|
-
method: "PUT"
|
|
12941
|
-
}
|
|
12942
|
-
);
|
|
12943
|
-
}
|
|
12944
|
-
// ===== Convert Direct Subscription to Stripe =====
|
|
12945
|
-
async convertSubscriptionToStripe(customerId, subscriptionId) {
|
|
12946
|
-
return this.fetch(
|
|
12947
|
-
`admin/customers/${customerId}/subscriptions/${subscriptionId}/convert-to-stripe`,
|
|
12948
|
-
{ method: "POST" }
|
|
12949
|
-
);
|
|
12950
|
-
}
|
|
12951
|
-
// ===== Customer-Level Stripe Payment Methods =====
|
|
12952
|
-
async createCustomerSetupIntent(customerId) {
|
|
12953
|
-
return this.fetch(`admin/customers/${customerId}/stripe/setup-intent`, {
|
|
12954
|
-
method: "POST"
|
|
12955
|
-
});
|
|
12956
|
-
}
|
|
12957
|
-
async getCustomerPaymentMethods(customerId) {
|
|
12958
|
-
return this.fetch(
|
|
12959
|
-
`admin/customers/${customerId}/stripe/payment-methods`
|
|
12960
|
-
);
|
|
12961
|
-
}
|
|
12962
|
-
async attachCustomerPaymentMethod(customerId, paymentMethodId, setAsDefault = false) {
|
|
12963
|
-
return this.fetch(`admin/customers/${customerId}/stripe/payment-methods/${paymentMethodId}/attach`, {
|
|
12964
|
-
method: "POST",
|
|
12965
|
-
body: JSON.stringify({ setAsDefault })
|
|
12966
|
-
});
|
|
12967
|
-
}
|
|
12968
|
-
async detachCustomerPaymentMethod(customerId, paymentMethodId) {
|
|
12969
|
-
return this.fetch(
|
|
12970
|
-
`admin/customers/${customerId}/stripe/payment-methods/${paymentMethodId}`,
|
|
12971
|
-
{
|
|
12972
|
-
method: "DELETE"
|
|
12973
|
-
}
|
|
12974
|
-
);
|
|
12975
|
-
}
|
|
12976
|
-
async setDefaultCustomerPaymentMethod(customerId, paymentMethodId) {
|
|
12977
|
-
return this.fetch(
|
|
12978
|
-
`admin/customers/${customerId}/stripe/payment-methods/${paymentMethodId}/set-default`,
|
|
12979
|
-
{
|
|
12980
|
-
method: "PUT"
|
|
12981
|
-
}
|
|
12982
|
-
);
|
|
12983
|
-
}
|
|
12984
|
-
// ===== Workspace Organization Migration =====
|
|
12985
|
-
async previewWorkspaceOrganizationChange(workspaceUuid, targetOrganizationId, newCreatorId) {
|
|
12986
|
-
return this.fetch(`admin/workspaces/${workspaceUuid}/change-org/preview`, {
|
|
12987
|
-
method: "POST",
|
|
12988
|
-
headers: {
|
|
12989
|
-
"Content-Type": "application/json"
|
|
12990
|
-
},
|
|
12991
|
-
body: JSON.stringify({
|
|
12992
|
-
targetOrganizationId,
|
|
12993
|
-
newCreatorId
|
|
12994
|
-
})
|
|
12995
|
-
});
|
|
12996
|
-
}
|
|
12997
|
-
async changeWorkspaceOrganization(workspaceUuid, targetOrganizationId, newCreatorId) {
|
|
12998
|
-
return this.fetch(`admin/workspaces/${workspaceUuid}/change-org`, {
|
|
12999
|
-
method: "POST",
|
|
13000
|
-
body: JSON.stringify({
|
|
13001
|
-
targetOrganizationId,
|
|
13002
|
-
newCreatorId
|
|
13003
|
-
})
|
|
13004
|
-
});
|
|
13005
|
-
}
|
|
13006
|
-
// ===== Stripe Invoice Management =====
|
|
13007
|
-
async createStripeInvoice(accountId, data) {
|
|
13008
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/invoices`, {
|
|
13009
|
-
method: "POST",
|
|
13010
|
-
body: JSON.stringify({
|
|
13011
|
-
customer: data.customer,
|
|
13012
|
-
description: data.description,
|
|
13013
|
-
collection_method: data.collectionMethod,
|
|
13014
|
-
days_until_due: data.daysUntilDue,
|
|
13015
|
-
auto_advance: data.autoAdvance,
|
|
13016
|
-
metadata: data.metadata
|
|
13017
|
-
})
|
|
13018
|
-
});
|
|
13019
|
-
}
|
|
13020
|
-
async getStripeInvoices(accountId, options) {
|
|
13021
|
-
const params = new URLSearchParams();
|
|
13022
|
-
if (options?.limit) params.append("limit", options.limit.toString());
|
|
13023
|
-
if (options?.startingAfter) params.append("starting_after", options.startingAfter);
|
|
13024
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/invoices?${params.toString()}`);
|
|
13025
|
-
}
|
|
13026
|
-
async getStripeUpcomingInvoice(accountId, subscriptionId) {
|
|
13027
|
-
const params = new URLSearchParams();
|
|
13028
|
-
if (subscriptionId) params.append("subscription_id", subscriptionId);
|
|
13029
|
-
return this.fetch(`admin/accounts/${accountId}/stripe/upcoming-invoice?${params.toString()}`);
|
|
13030
|
-
}
|
|
13031
|
-
// Billing Dashboard API
|
|
13032
|
-
async getWorkspaceUsageDashboard(workspaceUuid) {
|
|
13033
|
-
return this.fetch(
|
|
13034
|
-
`admin/workspaces/${workspaceUuid}/usage-dashboard`
|
|
13035
|
-
);
|
|
13036
|
-
}
|
|
13037
|
-
// Product Stripe Sync API
|
|
13038
|
-
async compareProductsWithStripe(workspaceUuid) {
|
|
13039
|
-
const params = workspaceUuid ? `?workspace_uuid=${encodeURIComponent(workspaceUuid)}` : "";
|
|
13040
|
-
return this.fetch(`admin/products/compare-stripe${params}`);
|
|
13041
|
-
}
|
|
13042
|
-
async syncProductToStripe(productId, request) {
|
|
13043
|
-
return this.fetch(`admin/products/${productId}/sync-stripe`, {
|
|
13044
|
-
method: "POST",
|
|
13045
|
-
body: JSON.stringify({ ...request, productId })
|
|
13046
|
-
});
|
|
13047
|
-
}
|
|
13048
|
-
// Search Stripe products
|
|
13049
|
-
async searchStripeProducts(query, limit = 10) {
|
|
13050
|
-
const params = new URLSearchParams({ query, limit: limit.toString() });
|
|
13051
|
-
return this.fetch(`admin/products/stripe/search?${params.toString()}`);
|
|
13052
|
-
}
|
|
13053
|
-
// ===== Subscriptions API =====
|
|
13054
|
-
async getSubscriptionsAsAdmin(options) {
|
|
13055
|
-
const params = new URLSearchParams();
|
|
13056
|
-
if (options?.productId) params.append("product_id", options.productId.toString());
|
|
13057
|
-
if (options?.productType) params.append("product_type", options.productType);
|
|
13058
|
-
if (options?.customerId) params.append("customer_id", options.customerId.toString());
|
|
13059
|
-
if (options?.organizationId)
|
|
13060
|
-
params.append("organization_id", options.organizationId.toString());
|
|
13061
|
-
if (options?.accountId) params.append("account_id", options.accountId.toString());
|
|
13062
|
-
if (options?.isDirect !== void 0) params.append("is_direct", options.isDirect.toString());
|
|
13063
|
-
if (options?.status) params.append("status", options.status);
|
|
13064
|
-
if (options?.page) params.append("page", options.page.toString());
|
|
13065
|
-
if (options?.pageSize) params.append("page_size", options.pageSize.toString());
|
|
13066
|
-
const queryString = params.toString();
|
|
13067
|
-
return this.fetch(
|
|
13068
|
-
`admin/subscriptions${queryString ? `?${queryString}` : ""}`
|
|
13069
|
-
);
|
|
13070
|
-
}
|
|
13071
|
-
async getSubscriptionAsAdmin(subscriptionId) {
|
|
13072
|
-
return this.fetch(`admin/subscriptions/${subscriptionId}`);
|
|
13073
|
-
}
|
|
13074
|
-
async updateSubscriptionStatusAsAdmin(subscriptionId, subscriptionStatus) {
|
|
13075
|
-
return this.fetch(`admin/subscriptions/${subscriptionId}`, {
|
|
13076
|
-
method: "PUT",
|
|
13077
|
-
body: JSON.stringify({ subscription_status: subscriptionStatus })
|
|
13078
|
-
});
|
|
13079
|
-
}
|
|
13080
|
-
async updateSubscriptionCreditSettingsAsAdmin(subscriptionId, settings) {
|
|
13081
|
-
return this.fetch(`admin/subscriptions/${subscriptionId}`, {
|
|
13082
|
-
method: "PUT",
|
|
13083
|
-
body: JSON.stringify(settings)
|
|
13084
|
-
});
|
|
13085
|
-
}
|
|
13086
|
-
/** Grant credits to a subscription (superuser only). */
|
|
13087
|
-
async grantCreditsAsAdmin(subscriptionId, creditUnits, grantType, reason) {
|
|
13088
|
-
return this.fetch(`admin/subscriptions/${subscriptionId}/grant-credits`, {
|
|
13089
|
-
method: "POST",
|
|
13090
|
-
body: JSON.stringify({ credit_units: creditUnits, grant_type: grantType, reason })
|
|
13091
|
-
});
|
|
13092
|
-
}
|
|
13093
|
-
/** List credit grants for a subscription (superuser only). */
|
|
13094
|
-
async listCreditGrantsAsAdmin(subscriptionId) {
|
|
13095
|
-
return this.fetch(`admin/subscriptions/${subscriptionId}/credit-grants`);
|
|
13096
|
-
}
|
|
13097
|
-
// ===== Usage API =====
|
|
13098
|
-
async getUsageReport(request) {
|
|
13099
|
-
return this.fetch("admin/usage", {
|
|
13100
|
-
method: "POST",
|
|
13101
|
-
body: JSON.stringify(request)
|
|
13102
|
-
});
|
|
13103
|
-
}
|
|
13104
|
-
// Voice Metrics API
|
|
13105
|
-
async getVoiceMetrics(options) {
|
|
13106
|
-
const params = new URLSearchParams();
|
|
13107
|
-
if (options?.hours) params.append("hours", options.hours.toString());
|
|
13108
|
-
if (options?.period) params.append("period", options.period.toString());
|
|
13109
|
-
if (options?.workspace_uuid) params.append("workspace_uuid", options.workspace_uuid);
|
|
13110
|
-
if (options?.organization_id != null)
|
|
13111
|
-
params.append("organization_id", options.organization_id.toString());
|
|
13112
|
-
if (options?.engine) params.append("engine", options.engine);
|
|
13113
|
-
if (options?.channel) params.append("channel", options.channel);
|
|
13114
|
-
const qs = params.toString();
|
|
13115
|
-
return this.fetch(`admin/voice-metrics${qs ? `?${qs}` : ""}`);
|
|
13116
|
-
}
|
|
13117
|
-
// Health Dashboard API
|
|
13118
|
-
async getHealthMetrics(request) {
|
|
13119
|
-
return this.fetch("admin/health/metrics", {
|
|
13120
|
-
method: "POST",
|
|
13121
|
-
body: JSON.stringify(request)
|
|
13122
|
-
});
|
|
13123
|
-
}
|
|
13124
|
-
async getHealthDetail(workspaceUuid, request) {
|
|
13125
|
-
return this.fetch(`admin/health/detail/${workspaceUuid}`, {
|
|
13126
|
-
method: "POST",
|
|
13127
|
-
body: JSON.stringify(request)
|
|
13128
|
-
});
|
|
13129
|
-
}
|
|
13130
|
-
// ===== Reseller Management =====
|
|
13131
|
-
async getResellers(options) {
|
|
13132
|
-
const params = new URLSearchParams();
|
|
13133
|
-
if (options?.search) params.set("search", options.search);
|
|
13134
|
-
if (options?.page) params.set("page", String(options.page));
|
|
13135
|
-
if (options?.pageSize) params.set("page_size", String(options.pageSize));
|
|
13136
|
-
const qs = params.toString();
|
|
13137
|
-
return this.fetch(`admin/resellers${qs ? `?${qs}` : ""}`);
|
|
13138
|
-
}
|
|
13139
|
-
async getReseller(resellerId) {
|
|
13140
|
-
return this.fetch(`admin/resellers/${resellerId}`);
|
|
13141
|
-
}
|
|
13142
|
-
async createReseller(data) {
|
|
13143
|
-
return this.fetch("admin/resellers", {
|
|
13144
|
-
method: "POST",
|
|
13145
|
-
body: JSON.stringify(data)
|
|
13146
|
-
});
|
|
13147
|
-
}
|
|
13148
|
-
async updateReseller(resellerId, data) {
|
|
13149
|
-
return this.fetch(`admin/resellers/${resellerId}`, {
|
|
13150
|
-
method: "PUT",
|
|
13151
|
-
body: JSON.stringify(data)
|
|
13152
|
-
});
|
|
13153
|
-
}
|
|
13154
|
-
async getResellerAccounts(resellerId) {
|
|
13155
|
-
return this.fetch(`admin/resellers/${resellerId}/accounts`);
|
|
13156
|
-
}
|
|
13157
|
-
async linkResellerToAccount(resellerId, data) {
|
|
13158
|
-
return this.fetch(`admin/resellers/${resellerId}/accounts`, {
|
|
13159
|
-
method: "POST",
|
|
13160
|
-
body: JSON.stringify({ account_id: data.accountId, role: data.role })
|
|
13161
|
-
});
|
|
13162
|
-
}
|
|
13163
|
-
async unlinkResellerFromAccount(resellerId, accountId) {
|
|
13164
|
-
await this.fetch(`admin/resellers/${resellerId}/accounts/${accountId}`, {
|
|
13165
|
-
method: "DELETE"
|
|
13166
|
-
});
|
|
13167
|
-
}
|
|
13168
|
-
// ===== Invoice Management =====
|
|
13169
|
-
async generateInvoice(data) {
|
|
13170
|
-
return this.fetch("admin/invoices/generate", {
|
|
13171
|
-
method: "POST",
|
|
13172
|
-
body: JSON.stringify(data)
|
|
13173
|
-
});
|
|
13174
|
-
}
|
|
13175
|
-
async getInvoices(subscriptionId, pageOpts) {
|
|
13176
|
-
const params = new URLSearchParams();
|
|
13177
|
-
if (subscriptionId !== void 0) params.set("subscription_id", String(subscriptionId));
|
|
13178
|
-
if (pageOpts?.page !== void 0) params.set("page", String(pageOpts.page));
|
|
13179
|
-
if (pageOpts?.pageSize !== void 0) params.set("pageSize", String(pageOpts.pageSize));
|
|
13180
|
-
const qs = params.toString();
|
|
13181
|
-
return this.fetch(`admin/invoices${qs ? `?${qs}` : ""}`);
|
|
13182
|
-
}
|
|
13183
|
-
async getBillingPeriods(subscriptionId) {
|
|
13184
|
-
return this.fetch(
|
|
13185
|
-
`admin/invoices/periods?subscription_id=${subscriptionId}`
|
|
13186
|
-
);
|
|
13187
|
-
}
|
|
13188
|
-
async getInvoiceDownloadUrl(invoiceId) {
|
|
13189
|
-
return this.fetch(
|
|
13190
|
-
`admin/invoices/${invoiceId}/download`
|
|
13191
|
-
);
|
|
13192
|
-
}
|
|
13193
|
-
async getReceiptDownloadUrl(invoiceId) {
|
|
13194
|
-
return this.fetch(
|
|
13195
|
-
`admin/invoices/${invoiceId}/receipt`
|
|
13196
|
-
);
|
|
13197
|
-
}
|
|
13198
|
-
async recordInvoicePayment(invoiceId, data) {
|
|
13199
|
-
return this.fetch(`admin/invoices/${invoiceId}/record-payment`, {
|
|
13200
|
-
method: "POST",
|
|
13201
|
-
body: JSON.stringify(data)
|
|
13202
|
-
});
|
|
13203
|
-
}
|
|
13204
|
-
// ===== Admin Temporal Inspection (PHI-safe, read-only) =====
|
|
13205
|
-
/**
|
|
13206
|
-
* Server-enforced bounds for admin Temporal queries (lookback, thresholds,
|
|
13207
|
-
* page sizes, history event cap). Superuser only.
|
|
13208
|
-
*/
|
|
13209
|
-
async getTemporalAdminConfig() {
|
|
13210
|
-
return this.fetch("admin/temporal/config");
|
|
13211
|
-
}
|
|
13212
|
-
/**
|
|
13213
|
-
* List recent Temporal workflows in FAILED, TIMED_OUT, or TERMINATED
|
|
13214
|
-
* status. Returns only PHI-safe operational metadata. Superuser only.
|
|
13215
|
-
*
|
|
13216
|
-
* Pass `options.status` to filter to a single status and enable
|
|
13217
|
-
* deep pagination via `nextPageToken`. Merged mode (no status) returns
|
|
13218
|
-
* the first page only and always emits `nextPageToken: null`.
|
|
13219
|
-
*/
|
|
13220
|
-
async listFailedTemporalWorkflows(options = {}) {
|
|
13221
|
-
const params = new URLSearchParams();
|
|
13222
|
-
if (options.lookbackHours !== void 0)
|
|
13223
|
-
params.set("lookback_hours", String(options.lookbackHours));
|
|
13224
|
-
if (options.pageSize !== void 0) params.set("page_size", String(options.pageSize));
|
|
13225
|
-
if (options.status) params.set("status", String(options.status));
|
|
13226
|
-
if (options.nextPageToken) params.set("next_page_token", options.nextPageToken);
|
|
13227
|
-
appendTemporalWorkspaceParams(params, options);
|
|
13228
|
-
const qs = params.toString();
|
|
13229
|
-
return this.fetch(
|
|
13230
|
-
`admin/temporal/workflows/failed${qs ? `?${qs}` : ""}`
|
|
13231
|
-
);
|
|
13232
|
-
}
|
|
13233
|
-
/**
|
|
13234
|
-
* List open Temporal workflows older than the stuck threshold.
|
|
13235
|
-
* Superuser only.
|
|
13236
|
-
*/
|
|
13237
|
-
async listStuckTemporalWorkflows(options = {}) {
|
|
13238
|
-
const params = new URLSearchParams();
|
|
13239
|
-
if (options.thresholdMinutes !== void 0)
|
|
13240
|
-
params.set("threshold_minutes", String(options.thresholdMinutes));
|
|
13241
|
-
if (options.pageSize !== void 0) params.set("page_size", String(options.pageSize));
|
|
13242
|
-
if (options.nextPageToken) params.set("next_page_token", options.nextPageToken);
|
|
13243
|
-
appendTemporalWorkspaceParams(params, options);
|
|
13244
|
-
const qs = params.toString();
|
|
13245
|
-
return this.fetch(
|
|
13246
|
-
`admin/temporal/workflows/stuck${qs ? `?${qs}` : ""}`
|
|
13247
|
-
);
|
|
13248
|
-
}
|
|
13249
|
-
/**
|
|
13250
|
-
* Return grouped counts for recent Temporal executions. Superuser only.
|
|
13251
|
-
*/
|
|
13252
|
-
async getTemporalSummary(options = {}) {
|
|
13253
|
-
const params = new URLSearchParams();
|
|
13254
|
-
if (options.lookbackHours !== void 0)
|
|
13255
|
-
params.set("lookback_hours", String(options.lookbackHours));
|
|
13256
|
-
appendTemporalWorkspaceParams(params, options);
|
|
13257
|
-
const qs = params.toString();
|
|
13258
|
-
return this.fetch(
|
|
13259
|
-
`admin/temporal/workflows/summary${qs ? `?${qs}` : ""}`
|
|
13260
|
-
);
|
|
13261
|
-
}
|
|
13262
|
-
/**
|
|
13263
|
-
* Fetch metadata + bounded sanitized history summary for one Temporal
|
|
13264
|
-
* workflow. Superuser only. Does not return raw events or payloads.
|
|
13265
|
-
*/
|
|
13266
|
-
async getTemporalWorkflowDetail(workflowId, options = {}) {
|
|
13267
|
-
const params = new URLSearchParams();
|
|
13268
|
-
if (options.runId) params.set("run_id", options.runId);
|
|
13269
|
-
appendTemporalWorkspaceParams(params, options);
|
|
13270
|
-
const qs = params.toString();
|
|
13271
|
-
const encoded = encodeURIComponent(workflowId);
|
|
13272
|
-
return this.fetch(
|
|
13273
|
-
`admin/temporal/workflows/${encoded}${qs ? `?${qs}` : ""}`
|
|
13274
|
-
);
|
|
13275
|
-
}
|
|
13276
|
-
// ── Customer activity events (cross-workspace operator feed) ──────────────
|
|
13277
|
-
async listCustomerActivityEvents(params = {}) {
|
|
13278
|
-
const qs = new URLSearchParams();
|
|
13279
|
-
if (params.page) qs.set("page", String(params.page));
|
|
13280
|
-
if (params.pageSize) qs.set("pageSize", String(params.pageSize));
|
|
13281
|
-
if (params.status) qs.set("status", params.status);
|
|
13282
|
-
if (params.subjectType) qs.set("subjectType", params.subjectType);
|
|
13283
|
-
if (params.source) qs.set("source", params.source);
|
|
13284
|
-
if (params.severity) qs.set("severity", params.severity);
|
|
13285
|
-
if (params.disposition) qs.set("disposition", params.disposition);
|
|
13286
|
-
if (params.workspaceId !== void 0) qs.set("workspaceId", String(params.workspaceId));
|
|
13287
|
-
if (params.organizationId !== void 0)
|
|
13288
|
-
qs.set("organizationId", String(params.organizationId));
|
|
13289
|
-
if (params.accountId !== void 0) qs.set("accountId", String(params.accountId));
|
|
13290
|
-
const query = qs.toString();
|
|
13291
|
-
return this.fetch(
|
|
13292
|
-
`admin/customer-activity${query ? `?${query}` : ""}`
|
|
13293
|
-
);
|
|
13294
|
-
}
|
|
13295
|
-
async getCustomerActivityEvent(uuid) {
|
|
13296
|
-
return this.fetch(`admin/customer-activity/${uuid}`);
|
|
13297
|
-
}
|
|
13298
|
-
async setCustomerActivityEventDisposition(uuid, data) {
|
|
13299
|
-
return this.fetch(`admin/customer-activity/${uuid}/disposition`, {
|
|
13300
|
-
method: "POST",
|
|
13301
|
-
body: JSON.stringify(data)
|
|
13302
|
-
});
|
|
13303
|
-
}
|
|
13304
|
-
async setCustomerActivityEventStatus(uuid, data) {
|
|
13305
|
-
return this.fetch(`admin/customer-activity/${uuid}/status`, {
|
|
13306
|
-
method: "POST",
|
|
13307
|
-
body: JSON.stringify(data)
|
|
13308
|
-
});
|
|
13309
|
-
}
|
|
13310
|
-
async reclassifyCustomerActivityEvent(uuid) {
|
|
13311
|
-
return this.fetch(`admin/customer-activity/${uuid}/reclassify`, {
|
|
13312
|
-
method: "POST"
|
|
13313
|
-
});
|
|
13314
|
-
}
|
|
13315
|
-
};
|
|
13316
|
-
ApiClient = class extends GravityRailClient {
|
|
13317
|
-
// Admin API
|
|
13318
|
-
listSupportRequestsAsAdmin;
|
|
13319
|
-
getSupportRequestAsAdmin;
|
|
13320
|
-
commentOnSupportRequestAsAdmin;
|
|
13321
|
-
noteOnSupportRequestAsAdmin;
|
|
13322
|
-
updateSupportRequestStatusAsAdmin;
|
|
13323
|
-
updateSupportRequestAttributesAsAdmin;
|
|
13324
|
-
createSupportRequestLinearIssueAsAdmin;
|
|
13325
|
-
createOutboundSupportRequestAsAdmin;
|
|
13326
|
-
attachSupportRequestResourceAsAdmin;
|
|
13327
|
-
revokeSupportRequestResourceAsAdmin;
|
|
13328
|
-
listCustomerActivityEvents;
|
|
13329
|
-
getCustomerActivityEvent;
|
|
13330
|
-
setCustomerActivityEventDisposition;
|
|
13331
|
-
setCustomerActivityEventStatus;
|
|
13332
|
-
reclassifyCustomerActivityEvent;
|
|
13333
|
-
getAccounts;
|
|
13334
|
-
getAccountDetails;
|
|
13335
|
-
getAccountByUuid;
|
|
13336
|
-
getAccountMemberships;
|
|
13337
|
-
getAccountOrgMemberships;
|
|
13338
|
-
createAccountOrgMembership;
|
|
13339
|
-
deleteAccountOrgMembership;
|
|
13340
|
-
getAccountMembership;
|
|
13341
|
-
updateAccountMembership;
|
|
13342
|
-
createAccountMembership;
|
|
13343
|
-
deleteAccountMembership;
|
|
13344
|
-
updateAccountAsAdmin;
|
|
13345
|
-
createAccountAsAdmin;
|
|
13346
|
-
deleteAccountAsAdmin;
|
|
13347
|
-
lookupAccount;
|
|
13348
|
-
exportAccountData;
|
|
13349
|
-
requestAccountDeletion;
|
|
13350
|
-
cancelAccountDeletion;
|
|
13351
|
-
getOrganizations;
|
|
13352
|
-
getOrganization;
|
|
13353
|
-
getOrganizationAsAdmin;
|
|
13354
|
-
getOrganizationMembersAsAdmin;
|
|
13355
|
-
createOrganization;
|
|
13356
|
-
updateOrganization;
|
|
13357
|
-
deleteOrganization;
|
|
13358
|
-
joinOrganization;
|
|
13359
|
-
leaveOrganization;
|
|
13360
|
-
generateLogoUploadUrl;
|
|
13361
|
-
importProducts;
|
|
13362
|
-
createProductAsAdmin;
|
|
13363
|
-
getProductsAsAdmin;
|
|
13364
|
-
getProductAsAdmin;
|
|
13365
|
-
updateProductAsAdmin;
|
|
13366
|
-
deleteProductAsAdmin;
|
|
13367
|
-
getWorkspacesAsAdmin;
|
|
13368
|
-
getWorkspaceAsAdmin;
|
|
13369
|
-
getWorkspaceByNumericIdAsAdmin;
|
|
13370
|
-
createWorkspaceAsAdmin;
|
|
13371
|
-
updateWorkspaceAsAdmin;
|
|
13372
|
-
deleteWorkspaceAsAdmin;
|
|
13373
|
-
createSchemaAsAdmin;
|
|
13374
|
-
migrateSchemaAsAdmin;
|
|
13375
|
-
provisionWorkspaceAsAdmin;
|
|
13376
|
-
refreshProvisionStatusAsAdmin;
|
|
13377
|
-
enableMaintenanceMode;
|
|
13378
|
-
disableMaintenanceMode;
|
|
13379
|
-
getWorkspaceHealth;
|
|
13380
|
-
provisionPlanFeatures;
|
|
13381
|
-
changeWorkspaceProduct;
|
|
13382
|
-
validateWorkflowAccessAsAdmin;
|
|
13383
|
-
mergeMembers;
|
|
13384
|
-
getAdminWorkspaceMember;
|
|
13385
|
-
createAdminWorkspaceMember;
|
|
13386
|
-
updateAdminWorkspaceMember;
|
|
13387
|
-
unarchiveAdminWorkspaceMember;
|
|
13388
|
-
getAdminWorkspaceMemberRoles;
|
|
13389
|
-
getMissingMemberships;
|
|
13390
|
-
linkMissingMembership;
|
|
13391
|
-
getUnmappedPhoneNumbers;
|
|
13392
|
-
getWorkspaceUnmappedPhoneNumbers;
|
|
13393
|
-
getWorkspacePhoneNumbersAsAdmin;
|
|
13394
|
-
getProviderPhoneNumbers;
|
|
13395
|
-
getProviderPhoneNumber;
|
|
13396
|
-
updateProviderPhoneNumber;
|
|
13397
|
-
mapMainAccountPhone;
|
|
13398
|
-
unmapPhoneNumber;
|
|
13399
|
-
searchAvailablePhoneNumbersAsAdmin;
|
|
13400
|
-
purchasePhoneNumberAsAdmin;
|
|
13401
|
-
startBulkPhoneClassification;
|
|
13402
|
-
getOrgA2PStatusAsAdmin;
|
|
13403
|
-
resetOrgA2PStatusAsAdmin;
|
|
13404
|
-
getSiteMappings;
|
|
13405
|
-
getSiteMapping;
|
|
13406
|
-
updateSiteMapping;
|
|
13407
|
-
updateSiteMappingWorkspace;
|
|
13408
|
-
adminDeleteSiteMapping;
|
|
13409
|
-
createSiteMapping;
|
|
13410
|
-
createOrUpdateSiteMapping;
|
|
13411
|
-
deleteSiteMapping;
|
|
13412
|
-
getInboxMappings;
|
|
13413
|
-
getInboxMapping;
|
|
13414
|
-
updateInboxMapping;
|
|
13415
|
-
deleteAdminInboxMapping;
|
|
13416
|
-
generateChatSummaries;
|
|
13417
|
-
executeQuery;
|
|
13418
|
-
getTraceUrl;
|
|
13419
|
-
listAllThemes;
|
|
13420
|
-
startBulkTOSAcceptance;
|
|
13421
|
-
startTokenUsageBackfill;
|
|
13422
|
-
updateChatMessage;
|
|
13423
|
-
createCustomerFromAccount;
|
|
13424
|
-
getCustomers;
|
|
13425
|
-
getCustomer;
|
|
13426
|
-
createCustomer;
|
|
13427
|
-
updateCustomer;
|
|
13428
|
-
getCustomerAccounts;
|
|
13429
|
-
linkCustomerToAccount;
|
|
13430
|
-
unlinkCustomerFromAccount;
|
|
13431
|
-
syncCustomerToStripe;
|
|
13432
|
-
getStripeCustomer;
|
|
13433
|
-
createStripeCustomer;
|
|
13434
|
-
updateStripeCustomer;
|
|
13435
|
-
getStripeSubscriptions;
|
|
13436
|
-
createStripeSubscription;
|
|
13437
|
-
createDirectSubscription;
|
|
13438
|
-
updateStripeSubscription;
|
|
13439
|
-
cancelStripeSubscription;
|
|
13440
|
-
provisionWorkspaceForSubscription;
|
|
13441
|
-
associateWorkspaceWithSubscription;
|
|
13442
|
-
createSubscriptionPaymentLink;
|
|
13443
|
-
createSetupIntent;
|
|
13444
|
-
getStripePaymentMethods;
|
|
13445
|
-
attachStripePaymentMethod;
|
|
13446
|
-
detachStripePaymentMethod;
|
|
13447
|
-
setDefaultStripePaymentMethod;
|
|
13448
|
-
createCustomerSetupIntent;
|
|
13449
|
-
getCustomerPaymentMethods;
|
|
13450
|
-
attachCustomerPaymentMethod;
|
|
13451
|
-
detachCustomerPaymentMethod;
|
|
13452
|
-
setDefaultCustomerPaymentMethod;
|
|
13453
|
-
convertSubscriptionToStripe;
|
|
13454
|
-
previewWorkspaceOrganizationChange;
|
|
13455
|
-
changeWorkspaceOrganization;
|
|
13456
|
-
createStripeInvoice;
|
|
13457
|
-
getStripeInvoices;
|
|
13458
|
-
getStripeUpcomingInvoice;
|
|
13459
|
-
getWorkspaceUsageDashboard;
|
|
13460
|
-
compareProductsWithStripe;
|
|
13461
|
-
syncProductToStripe;
|
|
13462
|
-
searchStripeProducts;
|
|
13463
|
-
getUsageReport;
|
|
13464
|
-
getSubscriptionsAsAdmin;
|
|
13465
|
-
getSubscriptionAsAdmin;
|
|
13466
|
-
updateSubscriptionStatusAsAdmin;
|
|
13467
|
-
updateSubscriptionCreditSettingsAsAdmin;
|
|
13468
|
-
grantCreditsAsAdmin;
|
|
13469
|
-
listCreditGrantsAsAdmin;
|
|
13470
|
-
getVoiceMetrics;
|
|
13471
|
-
getHealthMetrics;
|
|
13472
|
-
getHealthDetail;
|
|
13473
|
-
getWorkspaceInboxesAsAdmin;
|
|
13474
|
-
listWorkspaceChats;
|
|
13475
|
-
getWorkspaceChat;
|
|
13476
|
-
rateWorkspaceChatMessage;
|
|
13477
|
-
getTemporalAdminConfig;
|
|
13478
|
-
listFailedTemporalWorkflows;
|
|
13479
|
-
listStuckTemporalWorkflows;
|
|
13480
|
-
getTemporalSummary;
|
|
13481
|
-
getTemporalWorkflowDetail;
|
|
13482
|
-
getResellers;
|
|
13483
|
-
getReseller;
|
|
13484
|
-
createReseller;
|
|
13485
|
-
updateReseller;
|
|
13486
|
-
getResellerAccounts;
|
|
13487
|
-
linkResellerToAccount;
|
|
13488
|
-
unlinkResellerFromAccount;
|
|
13489
|
-
getBillingPeriods;
|
|
13490
|
-
generateInvoice;
|
|
13491
|
-
getInvoices;
|
|
13492
|
-
getInvoiceDownloadUrl;
|
|
13493
|
-
getReceiptDownloadUrl;
|
|
13494
|
-
recordInvoicePayment;
|
|
13495
|
-
adminApi;
|
|
13496
|
-
constructor(apiKey, baseUrl3, customFetch) {
|
|
13497
|
-
super(apiKey, baseUrl3, customFetch);
|
|
13498
|
-
this.adminApi = new AdminApi(apiKey, baseUrl3, customFetch);
|
|
13499
|
-
bindAdminMethods(this, this.adminApi);
|
|
13500
|
-
}
|
|
13501
|
-
/**
|
|
13502
|
-
* Propagates acting member switches to the admin API module as well.
|
|
13503
|
-
*/
|
|
13504
|
-
setActingMember(memberUuid) {
|
|
13505
|
-
super.setActingMember(memberUuid);
|
|
13506
|
-
if (typeof this.adminApi.setActingMember === "function") {
|
|
13507
|
-
this.adminApi.setActingMember(memberUuid);
|
|
13508
|
-
}
|
|
13509
|
-
}
|
|
13510
|
-
// setOrgToken is intentionally NOT overridden here. Admin routes
|
|
13511
|
-
// (/api/v2/admin/*) are protected by the bearer token's superuser claim and
|
|
13512
|
-
// ignore X-Org-Token entirely, so propagating an org token to adminApi is
|
|
13513
|
-
// dead code that would only obscure auth flow if admin route logic changes.
|
|
13514
|
-
};
|
|
13515
|
-
}
|
|
13516
|
-
});
|
|
13517
11859
|
function detectWorktreePorts() {
|
|
13518
11860
|
let dir = resolve(process.cwd());
|
|
13519
11861
|
let overridePath;
|
|
@@ -32858,7 +31200,7 @@ var init_pinned_fetch = __esm({
|
|
|
32858
31200
|
});
|
|
32859
31201
|
function makeApiClient(accessToken, apiUrl) {
|
|
32860
31202
|
const fetchFn = createSandboxFetchFromEnv(apiUrl);
|
|
32861
|
-
const apiClient = new
|
|
31203
|
+
const apiClient = new GravityRailClient(accessToken, apiUrl, fetchFn);
|
|
32862
31204
|
registerOrgAuthHandler(apiClient, apiUrl, accessToken);
|
|
32863
31205
|
return apiClient;
|
|
32864
31206
|
}
|
|
@@ -32918,7 +31260,7 @@ async function createPublicAuthenticatedContext(opts) {
|
|
|
32918
31260
|
}
|
|
32919
31261
|
var init_context = __esm({
|
|
32920
31262
|
"src/lib/context.ts"() {
|
|
32921
|
-
|
|
31263
|
+
init_dist();
|
|
32922
31264
|
init_cli_utils();
|
|
32923
31265
|
init_output();
|
|
32924
31266
|
init_realm();
|
|
@@ -33368,7 +31710,7 @@ function crudCommands(config) {
|
|
|
33368
31710
|
if (config.createMethod) {
|
|
33369
31711
|
cmds.push({
|
|
33370
31712
|
path: [...prefix, "create"],
|
|
33371
|
-
description: `Create a ${entityName}`,
|
|
31713
|
+
description: config.createHelp ?? `Create a ${entityName}`,
|
|
33372
31714
|
mutates: true,
|
|
33373
31715
|
requiresWorkspace,
|
|
33374
31716
|
...config.createExamples ? { examples: config.createExamples } : {},
|
|
@@ -33382,7 +31724,7 @@ function crudCommands(config) {
|
|
|
33382
31724
|
if (config.updateMethod) {
|
|
33383
31725
|
cmds.push({
|
|
33384
31726
|
path: [...prefix, "update"],
|
|
33385
|
-
description: `Update a ${entityName}`,
|
|
31727
|
+
description: config.updateHelp ?? `Update a ${entityName}`,
|
|
33386
31728
|
mutates: true,
|
|
33387
31729
|
args: [{ name: "id", description: `${entityName} ID`, required: true }],
|
|
33388
31730
|
requiresWorkspace,
|
|
@@ -34460,6 +32802,28 @@ var tasksDomain = {
|
|
|
34460
32802
|
|
|
34461
32803
|
// src/domains/workflows.ts
|
|
34462
32804
|
init_errors();
|
|
32805
|
+
|
|
32806
|
+
// src/lib/workflows/field-help.ts
|
|
32807
|
+
var WORKFLOW_FIELD_REFERENCE = `
|
|
32808
|
+
Field reference for --data JSON (create/update):
|
|
32809
|
+
|
|
32810
|
+
Core
|
|
32811
|
+
name (string) Display name
|
|
32812
|
+
description (string, optional)
|
|
32813
|
+
defaultPhoneNumberId (number|null) Outbound caller ID (workspace phone id)
|
|
32814
|
+
permissions (object, optional) Workflow-level permission flags
|
|
32815
|
+
|
|
32816
|
+
Member role access (memberRoleAccess)
|
|
32817
|
+
Array of objects, NOT bare role ids:
|
|
32818
|
+
[{"memberRoleId": 6, "accessMode": 1}]
|
|
32819
|
+
accessMode is a non-negative bitmask of workflow permissions (see API docs).
|
|
32820
|
+
|
|
32821
|
+
Other
|
|
32822
|
+
archived (bool) Archive flag on update
|
|
32823
|
+
dataRecords / tasks / versions Use dedicated subcommands \u2014 not inline here
|
|
32824
|
+
`;
|
|
32825
|
+
|
|
32826
|
+
// src/domains/workflows.ts
|
|
34463
32827
|
init_output();
|
|
34464
32828
|
init_context();
|
|
34465
32829
|
var COLUMNS5 = [
|
|
@@ -34722,6 +33086,41 @@ var workflowsDomain = {
|
|
|
34722
33086
|
process.stdout.write(`Deleted workflow contributor ${contributorId}
|
|
34723
33087
|
`);
|
|
34724
33088
|
}
|
|
33089
|
+
},
|
|
33090
|
+
{
|
|
33091
|
+
path: ["workflows", "create"],
|
|
33092
|
+
description: `Create a workflow
|
|
33093
|
+
|
|
33094
|
+
${WORKFLOW_FIELD_REFERENCE}`,
|
|
33095
|
+
mutates: true,
|
|
33096
|
+
requiresWorkspace: true,
|
|
33097
|
+
handler: async ({ ctx, workspace, data }) => {
|
|
33098
|
+
if (!data || typeof data !== "object") {
|
|
33099
|
+
throw new CLIError("JSON data required (--data, --file, or stdin)");
|
|
33100
|
+
}
|
|
33101
|
+
const result2 = await requireAuth(ctx).apiClient.createWorkflow(workspace, data);
|
|
33102
|
+
outputSingle(result2, ctx, COLUMNS5);
|
|
33103
|
+
}
|
|
33104
|
+
},
|
|
33105
|
+
{
|
|
33106
|
+
path: ["workflows", "update"],
|
|
33107
|
+
description: `Update a workflow
|
|
33108
|
+
|
|
33109
|
+
${WORKFLOW_FIELD_REFERENCE}`,
|
|
33110
|
+
mutates: true,
|
|
33111
|
+
requiresWorkspace: true,
|
|
33112
|
+
args: [{ name: "id", description: "Workflow ID", required: true }],
|
|
33113
|
+
handler: async ({ ctx, workspace, args, data }) => {
|
|
33114
|
+
if (!data || typeof data !== "object") {
|
|
33115
|
+
throw new CLIError("JSON data required (--data, --file, or stdin)");
|
|
33116
|
+
}
|
|
33117
|
+
const result2 = await requireAuth(ctx).apiClient.updateWorkflow(
|
|
33118
|
+
workspace,
|
|
33119
|
+
requireNumber(args, "id"),
|
|
33120
|
+
data
|
|
33121
|
+
);
|
|
33122
|
+
outputSingle(result2, ctx, COLUMNS5);
|
|
33123
|
+
}
|
|
34725
33124
|
}
|
|
34726
33125
|
]
|
|
34727
33126
|
};
|
|
@@ -36129,6 +34528,57 @@ var dataTypesDomain = {
|
|
|
36129
34528
|
init_output();
|
|
36130
34529
|
init_pagination();
|
|
36131
34530
|
init_context();
|
|
34531
|
+
|
|
34532
|
+
// src/lib/events/field-help.ts
|
|
34533
|
+
var EVENT_RULE_FIELD_REFERENCE = `
|
|
34534
|
+
Field reference for --data JSON (create/update):
|
|
34535
|
+
|
|
34536
|
+
Required
|
|
34537
|
+
objectType (string) task | routine | journey | workflow | calendar | ...
|
|
34538
|
+
eventType (string) e.g. routine:triggered, journey_step:execute, chat:created
|
|
34539
|
+
actionType (string) e.g. chat:create, member:label, sms:send, webhook:send
|
|
34540
|
+
|
|
34541
|
+
Common optional
|
|
34542
|
+
name (string)
|
|
34543
|
+
active (bool)
|
|
34544
|
+
order (number) Execution order when multiple rules match
|
|
34545
|
+
delay (number) Seconds to wait before running the action
|
|
34546
|
+
conditions (string) CEL expression; omit when always true
|
|
34547
|
+
actionParams (object) Shape depends on actionType \u2014 see examples below
|
|
34548
|
+
|
|
34549
|
+
Scope (set exactly one when objectType requires it)
|
|
34550
|
+
routineId, workflowId, taskId, dataTypeId, journeyStepId, calendarId, ...
|
|
34551
|
+
|
|
34552
|
+
chat:create actionParams (outbound voice/SMS)
|
|
34553
|
+
{"workflowId":<id>,"channel":"phone-voice"|"phone-sms","phoneNumberId":<id>,
|
|
34554
|
+
"inboxId":<optional>,"assistantEnabled":<bool>}
|
|
34555
|
+
|
|
34556
|
+
member:label actionParams
|
|
34557
|
+
{"addLabelIds":["<uuid>"],"removeLabelIds":["<uuid>"]}
|
|
34558
|
+
`;
|
|
34559
|
+
|
|
34560
|
+
// src/lib/routines/field-help.ts
|
|
34561
|
+
var ROUTINE_FIELD_REFERENCE = `
|
|
34562
|
+
Field reference for --data JSON (create/update):
|
|
34563
|
+
|
|
34564
|
+
Core
|
|
34565
|
+
name (string) Display name
|
|
34566
|
+
workflowId (number) Workflow run when the routine fires
|
|
34567
|
+
targetMemberId (number) Member who receives the scheduled outreach
|
|
34568
|
+
|
|
34569
|
+
Schedule
|
|
34570
|
+
scheduleEnabled (bool) Master on/off for the cron trigger
|
|
34571
|
+
scheduleMode (string) "CRON" (only mode today)
|
|
34572
|
+
cronString (string) Standard cron, e.g. "0 7 * * *"
|
|
34573
|
+
timezone (string, optional) IANA name, e.g. "America/Los_Angeles"
|
|
34574
|
+
Defaults to workspace timezone, else UTC
|
|
34575
|
+
|
|
34576
|
+
Visibility / lifecycle
|
|
34577
|
+
archived (bool) Archive flag on update
|
|
34578
|
+
event rules Use gr events rules create \u2014 not inline here
|
|
34579
|
+
`;
|
|
34580
|
+
|
|
34581
|
+
// src/domains/events.ts
|
|
36132
34582
|
var RULE_COLUMNS = [
|
|
36133
34583
|
COL.id(),
|
|
36134
34584
|
COL.name(),
|
|
@@ -36152,6 +34602,12 @@ var eventRulesCrudNoList = crudCommands({
|
|
|
36152
34602
|
updateMethod: "updateEventRule",
|
|
36153
34603
|
deleteMethod: "deleteEventRule",
|
|
36154
34604
|
columns: RULE_COLUMNS,
|
|
34605
|
+
createHelp: `Create an event rule
|
|
34606
|
+
|
|
34607
|
+
${EVENT_RULE_FIELD_REFERENCE}`,
|
|
34608
|
+
updateHelp: `Update an event rule
|
|
34609
|
+
|
|
34610
|
+
${EVENT_RULE_FIELD_REFERENCE}`,
|
|
36155
34611
|
createExamples: [
|
|
36156
34612
|
`gr events rules create -w $WID --data '{"name":"Label on step","objectType":"journey",`,
|
|
36157
34613
|
' "eventType":"journey_step:execute","actionType":"member:label",',
|
|
@@ -36312,6 +34768,12 @@ var eventsDomain = {
|
|
|
36312
34768
|
deleteMethod: "deleteRoutine",
|
|
36313
34769
|
paginationSupport: "full",
|
|
36314
34770
|
columns: ROUTINE_COLUMNS,
|
|
34771
|
+
createHelp: `Create a routine
|
|
34772
|
+
|
|
34773
|
+
${ROUTINE_FIELD_REFERENCE}`,
|
|
34774
|
+
updateHelp: `Update a routine
|
|
34775
|
+
|
|
34776
|
+
${ROUTINE_FIELD_REFERENCE}`,
|
|
36315
34777
|
createExamples: [
|
|
36316
34778
|
"Daily 7am check-in in the member\u2019s timezone (cron is interpreted in `timezone`):",
|
|
36317
34779
|
`gr routines create -w $WID --allow-write --data '{"name":"AM check-in",`,
|
|
@@ -39934,6 +38396,13 @@ function collectPhoneNumberWarnings(phone) {
|
|
|
39934
38396
|
message: "Phone line is not linked to an org provider number (isMapped=false). Inbound PSTN will not reach this workspace until linked.",
|
|
39935
38397
|
fixCommand: "gr org phone-numbers assign \u2026 then gr phone-numbers link -w $WID --id <id> --provider-phone-uuid <uuid> --allow-write"
|
|
39936
38398
|
});
|
|
38399
|
+
} else if (phone.twilioInboundReady !== true) {
|
|
38400
|
+
warnings.push({
|
|
38401
|
+
severity: "error",
|
|
38402
|
+
code: "provider_incomplete",
|
|
38403
|
+
message: "Linked to a provider record but Twilio inbound is not ready (missing provider SID/number). isMapped only means UUID link exists \u2014 PSTN may not hit GR.",
|
|
38404
|
+
fixCommand: "gr phone-numbers link -w $WID --id <id> --provider-phone-uuid <uuid> --allow-write"
|
|
38405
|
+
});
|
|
39937
38406
|
}
|
|
39938
38407
|
if (enableVoice && (defaultWorkflowId === null || defaultWorkflowId === void 0)) {
|
|
39939
38408
|
warnings.push({
|
|
@@ -40023,18 +38492,42 @@ function simulateInboundRouting(phone, opts = {}) {
|
|
|
40023
38492
|
outcome: "reject",
|
|
40024
38493
|
detail: "enableVoice=false \u2014 plays voiceUnavailableMessage or default"
|
|
40025
38494
|
});
|
|
40026
|
-
return finish(
|
|
40027
|
-
"voice_disabled_message",
|
|
40028
|
-
false,
|
|
40029
|
-
false,
|
|
40030
|
-
steps,
|
|
40031
|
-
recommendations,
|
|
40032
|
-
opts.asRole
|
|
40033
|
-
);
|
|
38495
|
+
return finish("voice_disabled_message", false, true, steps, recommendations, opts.asRole);
|
|
40034
38496
|
}
|
|
40035
38497
|
steps.push({ step: "channel_voice", outcome: "ok" });
|
|
38498
|
+
const twilioInboundReady = phone.twilioInboundReady === true;
|
|
38499
|
+
const twilioSid = phone.twilioNumberSid;
|
|
38500
|
+
if (!twilioInboundReady || !twilioSid) {
|
|
38501
|
+
steps.push({
|
|
38502
|
+
step: "provider_webhook",
|
|
38503
|
+
outcome: "missing",
|
|
38504
|
+
detail: "Provider record lacks Twilio SID or inbound webhooks were never configured \u2014 PSTN will not reach GR"
|
|
38505
|
+
});
|
|
38506
|
+
recommendations.push(
|
|
38507
|
+
"Re-link with gr phone-numbers link -w $WID --id <id> --provider-phone-uuid <uuid> --allow-write (configures Twilio voice/SMS URLs)"
|
|
38508
|
+
);
|
|
38509
|
+
return finish("reject_no_twilio_webhook", false, false, steps, recommendations, opts.asRole);
|
|
38510
|
+
}
|
|
38511
|
+
steps.push({
|
|
38512
|
+
step: "provider_webhook",
|
|
38513
|
+
outcome: "ok",
|
|
38514
|
+
detail: "Twilio SID present (webhooks expected on link/create)"
|
|
38515
|
+
});
|
|
40036
38516
|
const callerRole = inferCallerRole(phone, opts);
|
|
40037
|
-
|
|
38517
|
+
let resolutionDetail;
|
|
38518
|
+
if (opts.matchedMemberId !== void 0) {
|
|
38519
|
+
resolutionDetail = `matched_member_id=${opts.matchedMemberId}`;
|
|
38520
|
+
if (opts.matchedMemberPhoneType) {
|
|
38521
|
+
resolutionDetail += ` phoneType=${opts.matchedMemberPhoneType}`;
|
|
38522
|
+
}
|
|
38523
|
+
} else if (opts.asRole === void 0 && callerRole === "anonymous") {
|
|
38524
|
+
resolutionDetail = "no workspace member matched caller E.164";
|
|
38525
|
+
}
|
|
38526
|
+
steps.push({
|
|
38527
|
+
step: "caller_resolution",
|
|
38528
|
+
outcome: callerRole,
|
|
38529
|
+
detail: resolutionDetail
|
|
38530
|
+
});
|
|
40038
38531
|
if (callerRole === "member") {
|
|
40039
38532
|
steps.push({ step: "member_access", outcome: "proceed" });
|
|
40040
38533
|
} else if (callerRole === "anonymous") {
|
|
@@ -40047,7 +38540,7 @@ function simulateInboundRouting(phone, opts = {}) {
|
|
|
40047
38540
|
recommendations.push(
|
|
40048
38541
|
"Set anonymousMemberRoleId or disable allowAnonymous (gr member-roles list -w $WID)"
|
|
40049
38542
|
);
|
|
40050
|
-
return finish("misconfigured_anonymous", false,
|
|
38543
|
+
return finish("misconfigured_anonymous", false, true, steps, recommendations, callerRole);
|
|
40051
38544
|
}
|
|
40052
38545
|
steps.push({ step: "anonymous_member", outcome: "create_ephemeral_member" });
|
|
40053
38546
|
} else if (callerRole === "signup") {
|
|
@@ -40059,7 +38552,7 @@ function simulateInboundRouting(phone, opts = {}) {
|
|
|
40059
38552
|
outcome: "reject",
|
|
40060
38553
|
detail: "Unknown caller; anonymous and signup disabled"
|
|
40061
38554
|
});
|
|
40062
|
-
return finish("anonymous_rejection_tts", false,
|
|
38555
|
+
return finish("anonymous_rejection_tts", false, true, steps, recommendations, callerRole);
|
|
40063
38556
|
}
|
|
40064
38557
|
const voiceWorkMode = phone.voiceWorkMode;
|
|
40065
38558
|
if (voiceWorkMode === "always_forward" && phone.voiceForwardNumber) {
|
|
@@ -40099,6 +38592,7 @@ function simulateInboundRouting(phone, opts = {}) {
|
|
|
40099
38592
|
function finish(code, createsChat, createsPhoneCall, steps, recommendations, callerRole) {
|
|
40100
38593
|
const labels = {
|
|
40101
38594
|
reject_unmapped: "Reject \u2014 not mapped to provider",
|
|
38595
|
+
reject_no_twilio_webhook: "Reject \u2014 Twilio inbound webhooks not configured",
|
|
40102
38596
|
voice_disabled_message: "Play voice-unavailable message",
|
|
40103
38597
|
misconfigured_anonymous: "Reject \u2014 anonymous misconfigured",
|
|
40104
38598
|
signup_consent_redirect: "Redirect to voice signup consent",
|
|
@@ -40250,6 +38744,63 @@ async function findOutboundPhoneUsers(client, workspace, phone) {
|
|
|
40250
38744
|
return users;
|
|
40251
38745
|
}
|
|
40252
38746
|
|
|
38747
|
+
// src/lib/phone-numbers/caller-resolution.ts
|
|
38748
|
+
init_libphonenumber_js();
|
|
38749
|
+
function normalizeCallerE164(phone) {
|
|
38750
|
+
const parsed = parsePhoneNumber4(phone, "US");
|
|
38751
|
+
if (parsed?.isValid()) {
|
|
38752
|
+
return parsed.format("E.164");
|
|
38753
|
+
}
|
|
38754
|
+
return void 0;
|
|
38755
|
+
}
|
|
38756
|
+
var MEMBER_SEARCH_PAGE_SIZE = 100;
|
|
38757
|
+
async function resolveMemberByCallerPhone(client, workspace, callerE164) {
|
|
38758
|
+
const normalized = normalizeCallerE164(callerE164);
|
|
38759
|
+
const candidates = [normalized, callerE164.trim()].filter(
|
|
38760
|
+
(v, i, arr) => Boolean(v) && arr.indexOf(v) === i
|
|
38761
|
+
);
|
|
38762
|
+
const matchInRows = (rows) => {
|
|
38763
|
+
for (const row of rows) {
|
|
38764
|
+
const phone = typeof row.phone === "string" ? row.phone : "";
|
|
38765
|
+
if (candidates.some((c) => c === phone || c === normalizeCallerE164(phone))) {
|
|
38766
|
+
const id = typeof row.id === "number" ? row.id : Number(row.id);
|
|
38767
|
+
if (!Number.isFinite(id)) {
|
|
38768
|
+
continue;
|
|
38769
|
+
}
|
|
38770
|
+
return {
|
|
38771
|
+
memberId: id,
|
|
38772
|
+
memberRoleId: typeof row.memberRoleId === "number" ? row.memberRoleId : void 0,
|
|
38773
|
+
phoneType: typeof row.phoneType === "string" ? row.phoneType : void 0
|
|
38774
|
+
};
|
|
38775
|
+
}
|
|
38776
|
+
}
|
|
38777
|
+
return void 0;
|
|
38778
|
+
};
|
|
38779
|
+
for (const query of candidates) {
|
|
38780
|
+
let page = 1;
|
|
38781
|
+
while (true) {
|
|
38782
|
+
const result2 = await client.getWorkspaceMembers(
|
|
38783
|
+
workspace,
|
|
38784
|
+
page,
|
|
38785
|
+
MEMBER_SEARCH_PAGE_SIZE,
|
|
38786
|
+
void 0,
|
|
38787
|
+
query
|
|
38788
|
+
);
|
|
38789
|
+
const items = result2.items ?? result2;
|
|
38790
|
+
const list = Array.isArray(items) ? items : [];
|
|
38791
|
+
const hit = matchInRows(list);
|
|
38792
|
+
if (hit) {
|
|
38793
|
+
return hit;
|
|
38794
|
+
}
|
|
38795
|
+
if (list.length < MEMBER_SEARCH_PAGE_SIZE) {
|
|
38796
|
+
break;
|
|
38797
|
+
}
|
|
38798
|
+
page += 1;
|
|
38799
|
+
}
|
|
38800
|
+
}
|
|
38801
|
+
return void 0;
|
|
38802
|
+
}
|
|
38803
|
+
|
|
40253
38804
|
// src/domains/phone-numbers.ts
|
|
40254
38805
|
function asPhoneRecord(value) {
|
|
40255
38806
|
return value;
|
|
@@ -40298,7 +38849,11 @@ var phoneNumbersDomain = {
|
|
|
40298
38849
|
requiresWorkspace: true,
|
|
40299
38850
|
args: [
|
|
40300
38851
|
{ name: "id", description: "Phone number ID", required: true },
|
|
40301
|
-
{
|
|
38852
|
+
{
|
|
38853
|
+
name: "raw",
|
|
38854
|
+
description: "Output full JSON instead of behavior matrix",
|
|
38855
|
+
isFlag: true
|
|
38856
|
+
}
|
|
40302
38857
|
],
|
|
40303
38858
|
handler: async ({ ctx, workspace, args }) => {
|
|
40304
38859
|
const client = requireAuth(ctx).apiClient;
|
|
@@ -40310,10 +38865,8 @@ var phoneNumbersDomain = {
|
|
|
40310
38865
|
return;
|
|
40311
38866
|
}
|
|
40312
38867
|
const outboundUsers = await findOutboundPhoneUsers(client, workspace, phone);
|
|
40313
|
-
process.stdout.write(
|
|
40314
|
-
|
|
40315
|
-
`
|
|
40316
|
-
);
|
|
38868
|
+
process.stdout.write(`${formatPhoneNumberBehaviorMatrix(phone, outboundUsers)}
|
|
38869
|
+
`);
|
|
40317
38870
|
}
|
|
40318
38871
|
},
|
|
40319
38872
|
{
|
|
@@ -40390,10 +38943,17 @@ ${PHONE_NUMBER_FIELD_REFERENCE}`,
|
|
|
40390
38943
|
description: "Inbound defaultWorkflowId"
|
|
40391
38944
|
},
|
|
40392
38945
|
{ name: "area-code", description: "Area code when requesting a new number" },
|
|
40393
|
-
{
|
|
38946
|
+
{
|
|
38947
|
+
name: "provider-phone-uuid",
|
|
38948
|
+
description: "Existing org provider phone UUID to link"
|
|
38949
|
+
},
|
|
40394
38950
|
{ name: "enable-voice", description: "Enable voice (default true)", isFlag: true },
|
|
40395
38951
|
{ name: "enable-sms", description: "Enable SMS (default true)", isFlag: true },
|
|
40396
|
-
{
|
|
38952
|
+
{
|
|
38953
|
+
name: "allow-anonymous",
|
|
38954
|
+
description: "Allow anonymous inbound callers",
|
|
38955
|
+
isFlag: true
|
|
38956
|
+
},
|
|
40397
38957
|
{
|
|
40398
38958
|
name: "anonymous-member-role-id",
|
|
40399
38959
|
description: "Role id when --allow-anonymous"
|
|
@@ -40418,9 +38978,7 @@ ${PHONE_NUMBER_FIELD_REFERENCE}`,
|
|
|
40418
38978
|
let phone;
|
|
40419
38979
|
try {
|
|
40420
38980
|
if (payload.providerPhoneUuid) {
|
|
40421
|
-
phone = asPhoneRecord(
|
|
40422
|
-
await client.createPhoneNumber(workspace, payload)
|
|
40423
|
-
);
|
|
38981
|
+
phone = asPhoneRecord(await client.createPhoneNumber(workspace, payload));
|
|
40424
38982
|
} else if (typeof args["area-code"] === "string") {
|
|
40425
38983
|
phone = asPhoneRecord(
|
|
40426
38984
|
await client.requestPhoneNumber(workspace, {
|
|
@@ -40430,10 +38988,14 @@ ${PHONE_NUMBER_FIELD_REFERENCE}`,
|
|
|
40430
38988
|
);
|
|
40431
38989
|
if (payload.defaultWorkflowId) {
|
|
40432
38990
|
phone = asPhoneRecord(
|
|
40433
|
-
await client.updatePhoneNumber(
|
|
40434
|
-
|
|
40435
|
-
|
|
40436
|
-
|
|
38991
|
+
await client.updatePhoneNumber(
|
|
38992
|
+
workspace,
|
|
38993
|
+
phone.id,
|
|
38994
|
+
{
|
|
38995
|
+
defaultWorkflowId: payload.defaultWorkflowId,
|
|
38996
|
+
...payload
|
|
38997
|
+
}
|
|
38998
|
+
)
|
|
40437
38999
|
);
|
|
40438
39000
|
}
|
|
40439
39001
|
} else {
|
|
@@ -40449,10 +39011,8 @@ Setup complete: id=${phone.id} uuid=${phone.uuid}
|
|
|
40449
39011
|
|
|
40450
39012
|
`);
|
|
40451
39013
|
const outboundUsers = await findOutboundPhoneUsers(client, workspace, phone);
|
|
40452
|
-
process.stdout.write(
|
|
40453
|
-
|
|
40454
|
-
`
|
|
40455
|
-
);
|
|
39014
|
+
process.stdout.write(`${formatPhoneNumberBehaviorMatrix(phone, outboundUsers)}
|
|
39015
|
+
`);
|
|
40456
39016
|
}
|
|
40457
39017
|
},
|
|
40458
39018
|
{
|
|
@@ -40474,10 +39034,22 @@ Setup complete: id=${phone.id} uuid=${phone.uuid}
|
|
|
40474
39034
|
const phone = asPhoneRecord(await client.getPhoneNumber(workspace, id));
|
|
40475
39035
|
const asRole = parseCallerRole(args["as-role"]);
|
|
40476
39036
|
let hasMemberMatch = asRole === "member";
|
|
39037
|
+
let matchedMemberId;
|
|
39038
|
+
let matchedMemberPhoneType;
|
|
40477
39039
|
if (!asRole && typeof args.as === "string") {
|
|
40478
|
-
|
|
39040
|
+
const match = await resolveMemberByCallerPhone(client, workspace, args.as);
|
|
39041
|
+
if (match) {
|
|
39042
|
+
hasMemberMatch = true;
|
|
39043
|
+
matchedMemberId = match.memberId;
|
|
39044
|
+
matchedMemberPhoneType = match.phoneType;
|
|
39045
|
+
}
|
|
40479
39046
|
}
|
|
40480
|
-
const sim = simulateInboundRouting(phone, {
|
|
39047
|
+
const sim = simulateInboundRouting(phone, {
|
|
39048
|
+
asRole,
|
|
39049
|
+
hasMemberMatch,
|
|
39050
|
+
matchedMemberId,
|
|
39051
|
+
matchedMemberPhoneType
|
|
39052
|
+
});
|
|
40481
39053
|
process.stdout.write(`${formatRoutingSimulation(sim, phone)}
|
|
40482
39054
|
`);
|
|
40483
39055
|
}
|
|
@@ -40526,12 +39098,24 @@ ${formatRoutingSimulation(sim, phone)}
|
|
|
40526
39098
|
const id = requireNumber(args, "id");
|
|
40527
39099
|
const phone = asPhoneRecord(await client.getPhoneNumber(workspace, id));
|
|
40528
39100
|
const asRole = parseCallerRole(args["as-role"]);
|
|
39101
|
+
let hasMemberMatch = asRole === "member";
|
|
39102
|
+
let matchedMemberId;
|
|
39103
|
+
if (!asRole && typeof args.as === "string") {
|
|
39104
|
+
const match = await resolveMemberByCallerPhone(client, workspace, args.as);
|
|
39105
|
+
if (match) {
|
|
39106
|
+
hasMemberMatch = true;
|
|
39107
|
+
matchedMemberId = match.memberId;
|
|
39108
|
+
}
|
|
39109
|
+
}
|
|
40529
39110
|
const sim = simulateInboundRouting(phone, {
|
|
40530
39111
|
asRole,
|
|
40531
|
-
hasMemberMatch
|
|
39112
|
+
hasMemberMatch,
|
|
39113
|
+
matchedMemberId
|
|
40532
39114
|
});
|
|
40533
|
-
process.stdout.write(
|
|
40534
|
-
|
|
39115
|
+
process.stdout.write(
|
|
39116
|
+
`${JSON.stringify({ phoneNumberId: id, simulation: sim }, null, 2)}
|
|
39117
|
+
`
|
|
39118
|
+
);
|
|
40535
39119
|
}
|
|
40536
39120
|
},
|
|
40537
39121
|
{
|
|
@@ -40549,7 +39133,7 @@ ${formatRoutingSimulation(sim, phone)}
|
|
|
40549
39133
|
},
|
|
40550
39134
|
{
|
|
40551
39135
|
path: ["phone-numbers", "inbound-log"],
|
|
40552
|
-
description: "Recent inbound call activity for this line (
|
|
39136
|
+
description: "Recent inbound call activity for this line (includes pre-routing rejections via terminationReason)",
|
|
40553
39137
|
requiresWorkspace: true,
|
|
40554
39138
|
args: [
|
|
40555
39139
|
{
|
|
@@ -40570,10 +39154,8 @@ ${formatRoutingSimulation(sim, phone)}
|
|
|
40570
39154
|
{ inbound: true }
|
|
40571
39155
|
);
|
|
40572
39156
|
const inbound = result2.items ?? [];
|
|
40573
|
-
process.stdout.write(
|
|
40574
|
-
|
|
40575
|
-
`
|
|
40576
|
-
);
|
|
39157
|
+
process.stdout.write(`Inbound calls (most recent page): ${inbound.length} shown
|
|
39158
|
+
`);
|
|
40577
39159
|
process.stdout.write(
|
|
40578
39160
|
"Tip: gr phone-numbers diagnose --id <id> --as +1\u2026 simulates routing without a live call.\n"
|
|
40579
39161
|
);
|
|
@@ -40654,6 +39236,53 @@ ${formatRoutingSimulation(sim, phone)}
|
|
|
40654
39236
|
outputData(result2, ctx);
|
|
40655
39237
|
}
|
|
40656
39238
|
},
|
|
39239
|
+
{
|
|
39240
|
+
path: ["phone-numbers", "calls", "inspect"],
|
|
39241
|
+
description: "Inspect one call record (status, termination, chat linkage)",
|
|
39242
|
+
requiresWorkspace: true,
|
|
39243
|
+
args: [
|
|
39244
|
+
{
|
|
39245
|
+
name: "phone-number-id",
|
|
39246
|
+
aliases: ["id"],
|
|
39247
|
+
description: "Phone number ID",
|
|
39248
|
+
required: true
|
|
39249
|
+
},
|
|
39250
|
+
{ name: "call-id", description: "Phone call ID", required: true },
|
|
39251
|
+
{ name: "page", description: "Page number when scanning call list (default 1)" },
|
|
39252
|
+
{ name: "page-size", description: "Page size when scanning call list (default 50)" }
|
|
39253
|
+
],
|
|
39254
|
+
handler: async ({ ctx, workspace, args }) => {
|
|
39255
|
+
const client = requireAuth(ctx).apiClient;
|
|
39256
|
+
const phoneNumberId = requireNumberFrom(args, "phone-number-id", "id");
|
|
39257
|
+
const callId = requireNumber(args, "call-id");
|
|
39258
|
+
const page = args.page ? Number(args.page) : 1;
|
|
39259
|
+
const pageSize = args["page-size"] ? Number(args["page-size"]) : 50;
|
|
39260
|
+
const result2 = await client.getPhoneNumberCalls(
|
|
39261
|
+
workspace,
|
|
39262
|
+
phoneNumberId,
|
|
39263
|
+
page,
|
|
39264
|
+
pageSize
|
|
39265
|
+
);
|
|
39266
|
+
const items = result2.items ?? result2;
|
|
39267
|
+
const call = Array.isArray(items) ? items.find((row) => Number(row.id) === callId) : void 0;
|
|
39268
|
+
if (!call) {
|
|
39269
|
+
throw new CLIError(
|
|
39270
|
+
`Call id=${callId} not found on phone-number-id=${phoneNumberId} (page=${page}, page-size=${pageSize}). Try another page or increase --page-size.`
|
|
39271
|
+
);
|
|
39272
|
+
}
|
|
39273
|
+
const chatId = call.chatId;
|
|
39274
|
+
let chatSummary;
|
|
39275
|
+
if (chatId) {
|
|
39276
|
+
try {
|
|
39277
|
+
chatSummary = await client.getChat(workspace, chatId);
|
|
39278
|
+
} catch {
|
|
39279
|
+
chatSummary = { id: chatId, note: "chat fetch failed" };
|
|
39280
|
+
}
|
|
39281
|
+
}
|
|
39282
|
+
process.stdout.write(`${JSON.stringify({ call, chat: chatSummary }, null, 2)}
|
|
39283
|
+
`);
|
|
39284
|
+
}
|
|
39285
|
+
},
|
|
40657
39286
|
{
|
|
40658
39287
|
path: ["phone-numbers", "messages", "list"],
|
|
40659
39288
|
description: "List messages for a phone number",
|
|
@@ -45666,7 +44295,7 @@ function registerSpecialCommands(registry) {
|
|
|
45666
44295
|
|
|
45667
44296
|
// package.json
|
|
45668
44297
|
var package_default = {
|
|
45669
|
-
version: "0.7.
|
|
44298
|
+
version: "0.7.2"};
|
|
45670
44299
|
|
|
45671
44300
|
// src/gr.ts
|
|
45672
44301
|
var VERSION = package_default.version;
|