wiil-core-js 0.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/core/account/index.d.ts +7 -0
- package/dist/core/account/index.js +23 -0
- package/dist/core/account/organization.schema.d.ts +118 -0
- package/dist/core/account/organization.schema.js +91 -0
- package/dist/core/account/project.schema.d.ts +121 -0
- package/dist/core/account/project.schema.js +102 -0
- package/dist/core/account/supported-business-verticals.d.ts +8 -0
- package/dist/core/account/supported-business-verticals.js +23 -0
- package/dist/core/assistant-setups/assistant-setup-result.schema.d.ts +115 -0
- package/dist/core/assistant-setups/assistant-setup-result.schema.js +17 -0
- package/dist/core/assistant-setups/base-assistant-setup.schema.d.ts +61 -0
- package/dist/core/assistant-setups/base-assistant-setup.schema.js +29 -0
- package/dist/core/assistant-setups/index.d.ts +4 -0
- package/dist/core/assistant-setups/index.js +21 -0
- package/dist/core/assistant-setups/phone-assistant-setup.schema.d.ts +63 -0
- package/dist/core/assistant-setups/phone-assistant-setup.schema.js +14 -0
- package/dist/core/assistant-setups/web-assitant-setup.schema.d.ts +56 -0
- package/dist/core/assistant-setups/web-assitant-setup.schema.js +17 -0
- package/dist/core/base.schema.d.ts +34 -0
- package/dist/core/base.schema.js +36 -0
- package/dist/core/business-mgt/appointment-additional-info.schema.d.ts +63 -0
- package/dist/core/business-mgt/appointment-additional-info.schema.js +53 -0
- package/dist/core/business-mgt/appointment-field-config.schema.d.ts +251 -0
- package/dist/core/business-mgt/appointment-field-config.schema.js +49 -0
- package/dist/core/business-mgt/bookings.shared.schema.d.ts +47 -0
- package/dist/core/business-mgt/bookings.shared.schema.js +60 -0
- package/dist/core/business-mgt/business-location.schema.d.ts +327 -0
- package/dist/core/business-mgt/business-location.schema.js +176 -0
- package/dist/core/business-mgt/customer-management/customer-group.schema.d.ts +87 -0
- package/dist/core/business-mgt/customer-management/customer-group.schema.js +53 -0
- package/dist/core/business-mgt/customer-management/customer.schema.d.ts +156 -0
- package/dist/core/business-mgt/customer-management/customer.schema.js +93 -0
- package/dist/core/business-mgt/customer-management/index.d.ts +7 -0
- package/dist/core/business-mgt/customer-management/index.js +23 -0
- package/dist/core/business-mgt/customer-management/shipping-address.schema.d.ts +112 -0
- package/dist/core/business-mgt/customer-management/shipping-address.schema.js +79 -0
- package/dist/core/business-mgt/customer.schema.d.ts +111 -0
- package/dist/core/business-mgt/customer.schema.js +73 -0
- package/dist/core/business-mgt/discount-rule.schema.d.ts +183 -0
- package/dist/core/business-mgt/discount-rule.schema.js +108 -0
- package/dist/core/business-mgt/index.d.ts +16 -0
- package/dist/core/business-mgt/index.js +38 -0
- package/dist/core/business-mgt/menu-config.schema.d.ts +165 -0
- package/dist/core/business-mgt/menu-config.schema.js +86 -0
- package/dist/core/business-mgt/menu-management/index.d.ts +11 -0
- package/dist/core/business-mgt/menu-management/index.js +27 -0
- package/dist/core/business-mgt/menu-management/menu-catalog.schema.d.ts +386 -0
- package/dist/core/business-mgt/menu-management/menu-catalog.schema.js +58 -0
- package/dist/core/business-mgt/menu-management/menu-config.schema.d.ts +301 -0
- package/dist/core/business-mgt/menu-management/menu-config.schema.js +169 -0
- package/dist/core/business-mgt/menu-management/menu-item-variant.schema.d.ts +143 -0
- package/dist/core/business-mgt/menu-management/menu-item-variant.schema.js +86 -0
- package/dist/core/business-mgt/menu-management/menu-pricing-rule.schema.d.ts +239 -0
- package/dist/core/business-mgt/menu-management/menu-pricing-rule.schema.js +117 -0
- package/dist/core/business-mgt/menu-management/menu-set.schema.d.ts +420 -0
- package/dist/core/business-mgt/menu-management/menu-set.schema.js +283 -0
- package/dist/core/business-mgt/menu-management/menu.order.schema.d.ts +654 -0
- package/dist/core/business-mgt/menu-management/menu.order.schema.js +204 -0
- package/dist/core/business-mgt/menu-management/modifier.schema.d.ts +585 -0
- package/dist/core/business-mgt/menu-management/modifier.schema.js +341 -0
- package/dist/core/business-mgt/menu.order.schema.d.ts +335 -0
- package/dist/core/business-mgt/menu.order.schema.js +149 -0
- package/dist/core/business-mgt/order.schema.d.ts +222 -0
- package/dist/core/business-mgt/order.schema.js +205 -0
- package/dist/core/business-mgt/pricing-rule.shared.schema.d.ts +56 -0
- package/dist/core/business-mgt/pricing-rule.shared.schema.js +68 -0
- package/dist/core/business-mgt/product-config.schema.d.ts +177 -0
- package/dist/core/business-mgt/product-config.schema.js +106 -0
- package/dist/core/business-mgt/product-management/index.d.ts +12 -0
- package/dist/core/business-mgt/product-management/index.js +28 -0
- package/dist/core/business-mgt/product-management/product-axis-binding.schema.d.ts +54 -0
- package/dist/core/business-mgt/product-management/product-axis-binding.schema.js +54 -0
- package/dist/core/business-mgt/product-management/product-config.schema.d.ts +1042 -0
- package/dist/core/business-mgt/product-management/product-config.schema.js +392 -0
- package/dist/core/business-mgt/product-management/product-display.schema.d.ts +548 -0
- package/dist/core/business-mgt/product-management/product-display.schema.js +80 -0
- package/dist/core/business-mgt/product-management/product-order.schema.d.ts +493 -0
- package/dist/core/business-mgt/product-management/product-order.schema.js +158 -0
- package/dist/core/business-mgt/product-management/product-pricing-rule.schema.d.ts +167 -0
- package/dist/core/business-mgt/product-management/product-pricing-rule.schema.js +68 -0
- package/dist/core/business-mgt/product-management/product-set.schema.d.ts +488 -0
- package/dist/core/business-mgt/product-management/product-set.schema.js +273 -0
- package/dist/core/business-mgt/product-management/product-variant-axis.schema.d.ts +156 -0
- package/dist/core/business-mgt/product-management/product-variant-axis.schema.js +98 -0
- package/dist/core/business-mgt/product-management/product-variant.schema.d.ts +219 -0
- package/dist/core/business-mgt/product-management/product-variant.schema.js +130 -0
- package/dist/core/business-mgt/product-order.schema.d.ts +326 -0
- package/dist/core/business-mgt/product-order.schema.js +153 -0
- package/dist/core/business-mgt/property-config.schema.d.ts +621 -0
- package/dist/core/business-mgt/property-config.schema.js +224 -0
- package/dist/core/business-mgt/property-inquiry.schema.d.ts +222 -0
- package/dist/core/business-mgt/property-inquiry.schema.js +112 -0
- package/dist/core/business-mgt/property-management/index.d.ts +6 -0
- package/dist/core/business-mgt/property-management/index.js +22 -0
- package/dist/core/business-mgt/property-management/property-config.schema.d.ts +1306 -0
- package/dist/core/business-mgt/property-management/property-config.schema.js +367 -0
- package/dist/core/business-mgt/property-management/property-inquiry.schema.d.ts +254 -0
- package/dist/core/business-mgt/property-management/property-inquiry.schema.js +131 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/index.d.ts +3 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/index.js +19 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-rental-assignment.schema.d.ts +139 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-rental-assignment.schema.js +90 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-room-assignment.schema.d.ts +104 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-room-assignment.schema.js +70 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-table-assignment.schema.d.ts +104 -0
- package/dist/core/business-mgt/reservation-mgt/assignment/reservation-table-assignment.schema.js +72 -0
- package/dist/core/business-mgt/reservation-mgt/index.d.ts +14 -0
- package/dist/core/business-mgt/reservation-mgt/index.js +31 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-floor-plan-definition.schema.d.ts +180 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-floor-plan-definition.schema.js +75 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-maintenance-block.schema.d.ts +91 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-maintenance-block.schema.js +57 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-rental.schema.d.ts +334 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-rental.schema.js +179 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-room.schema.d.ts +195 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-room.schema.js +106 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-section.schema.d.ts +402 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-section.schema.js +198 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-settings.schema.d.ts +229 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-settings.schema.js +127 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-slot-query.schema.d.ts +382 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-slot-query.schema.js +322 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table-layout.schema.d.ts +123 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table-layout.schema.js +83 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table.schema.d.ts +167 -0
- package/dist/core/business-mgt/reservation-mgt/reservation-table.schema.js +84 -0
- package/dist/core/business-mgt/reservation-mgt/reservation.schema.d.ts +0 -0
- package/dist/core/business-mgt/reservation-mgt/reservation.schema.js +153 -0
- package/dist/core/business-mgt/reservation-mgt/resource/index.d.ts +4 -0
- package/dist/core/business-mgt/reservation-mgt/resource/index.js +20 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-category.schema.d.ts +157 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-category.schema.js +76 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-instance.schema.d.ts +137 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource-instance.schema.js +94 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource.schema.d.ts +713 -0
- package/dist/core/business-mgt/reservation-mgt/resource/reservation-resource.schema.js +363 -0
- package/dist/core/business-mgt/reservation-mgt/resource/resource-versioning.schema.d.ts +151 -0
- package/dist/core/business-mgt/reservation-mgt/resource/resource-versioning.schema.js +147 -0
- package/dist/core/business-mgt/reservation-resource.schema.d.ts +154 -0
- package/dist/core/business-mgt/reservation-resource.schema.js +100 -0
- package/dist/core/business-mgt/reservation.schema.d.ts +119 -0
- package/dist/core/business-mgt/reservation.schema.js +89 -0
- package/dist/core/business-mgt/service-appointment.schema.d.ts +105 -0
- package/dist/core/business-mgt/service-appointment.schema.js +69 -0
- package/dist/core/business-mgt/service-config.schema.d.ts +453 -0
- package/dist/core/business-mgt/service-config.schema.js +102 -0
- package/dist/core/business-mgt/service-management/appointment-additional-info.schema.d.ts +110 -0
- package/dist/core/business-mgt/service-management/appointment-additional-info.schema.js +78 -0
- package/dist/core/business-mgt/service-management/appointment-field-config.schema.d.ts +304 -0
- package/dist/core/business-mgt/service-management/appointment-field-config.schema.js +75 -0
- package/dist/core/business-mgt/service-management/business-service-config.schema.d.ts +1226 -0
- package/dist/core/business-mgt/service-management/business-service-config.schema.js +317 -0
- package/dist/core/business-mgt/service-management/index.d.ts +13 -0
- package/dist/core/business-mgt/service-management/index.js +29 -0
- package/dist/core/business-mgt/service-management/service-appointment.schema.d.ts +531 -0
- package/dist/core/business-mgt/service-management/service-appointment.schema.js +116 -0
- package/dist/core/business-mgt/service-management/service-person.schema.d.ts +122 -0
- package/dist/core/business-mgt/service-management/service-person.schema.js +66 -0
- package/dist/core/business-mgt/service-management/service-pricing-rule.schema.d.ts +221 -0
- package/dist/core/business-mgt/service-management/service-pricing-rule.schema.js +118 -0
- package/dist/core/business-mgt/service-management/service-provider.schema.d.ts +90 -0
- package/dist/core/business-mgt/service-management/service-provider.schema.js +54 -0
- package/dist/core/business-mgt/service-management/service-slot-query.schema.d.ts +90 -0
- package/dist/core/business-mgt/service-management/service-slot-query.schema.js +113 -0
- package/dist/core/business-mgt/service-management/service-time-off.schema.d.ts +121 -0
- package/dist/core/business-mgt/service-management/service-time-off.schema.js +95 -0
- package/dist/core/business-mgt/service-person.schema.d.ts +43 -0
- package/dist/core/business-mgt/service-person.schema.js +38 -0
- package/dist/core/business-mgt/tax-rule.schema.d.ts +161 -0
- package/dist/core/business-mgt/tax-rule.schema.js +90 -0
- package/dist/core/conversation/conversation-config.schema.d.ts +644 -0
- package/dist/core/conversation/conversation-config.schema.js +351 -0
- package/dist/core/conversation/conversation-message.schema.d.ts +307 -0
- package/dist/core/conversation/conversation-message.schema.js +275 -0
- package/dist/core/conversation/index.d.ts +12 -0
- package/dist/core/conversation/index.js +28 -0
- package/dist/core/conversation/outbound-call.schema.d.ts +209 -0
- package/dist/core/conversation/outbound-call.schema.js +116 -0
- package/dist/core/conversation/outbound-email.schema.d.ts +338 -0
- package/dist/core/conversation/outbound-email.schema.js +150 -0
- package/dist/core/conversation/outbound-sms.schema.d.ts +163 -0
- package/dist/core/conversation/outbound-sms.schema.js +85 -0
- package/dist/core/conversation/outbound-template.schema.d.ts +375 -0
- package/dist/core/conversation/outbound-template.schema.js +160 -0
- package/dist/core/conversation/translation-config.schema.d.ts +92 -0
- package/dist/core/conversation/translation-config.schema.js +88 -0
- package/dist/core/conversation/translation-conversation.schema.d.ts +469 -0
- package/dist/core/conversation/translation-conversation.schema.js +175 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +30 -0
- package/dist/core/service-configuration/agent-config.schema.d.ts +236 -0
- package/dist/core/service-configuration/agent-config.schema.js +152 -0
- package/dist/core/service-configuration/base-agent-setup.d.ts +147 -0
- package/dist/core/service-configuration/base-agent-setup.js +123 -0
- package/dist/core/service-configuration/call-transfer-config.schema.d.ts +60 -0
- package/dist/core/service-configuration/call-transfer-config.schema.js +53 -0
- package/dist/core/service-configuration/deployment-config.schema.d.ts +522 -0
- package/dist/core/service-configuration/deployment-config.schema.js +271 -0
- package/dist/core/service-configuration/dynamic_setup/base-agent-setup.d.ts +130 -0
- package/dist/core/service-configuration/dynamic_setup/base-agent-setup.js +110 -0
- package/dist/core/service-configuration/dynamic_setup/index.d.ts +10 -0
- package/dist/core/service-configuration/dynamic_setup/index.js +26 -0
- package/dist/core/service-configuration/dynamic_setup/phone-agent-setup.d.ts +111 -0
- package/dist/core/service-configuration/dynamic_setup/phone-agent-setup.js +56 -0
- package/dist/core/service-configuration/dynamic_setup/web-agent-setup.d.ts +113 -0
- package/dist/core/service-configuration/dynamic_setup/web-agent-setup.js +55 -0
- package/dist/core/service-configuration/index.d.ts +17 -0
- package/dist/core/service-configuration/index.js +33 -0
- package/dist/core/service-configuration/instruction-config.schema.d.ts +183 -0
- package/dist/core/service-configuration/instruction-config.schema.js +139 -0
- package/dist/core/service-configuration/interaction-channels.schema.d.ts +469 -0
- package/dist/core/service-configuration/interaction-channels.schema.js +390 -0
- package/dist/core/service-configuration/knowledge.schema.d.ts +107 -0
- package/dist/core/service-configuration/knowledge.schema.js +106 -0
- package/dist/core/service-configuration/phone-config.schema.d.ts +206 -0
- package/dist/core/service-configuration/phone-config.schema.js +121 -0
- package/dist/core/service-configuration/phone-number.schema.d.ts +236 -0
- package/dist/core/service-configuration/phone-number.schema.js +211 -0
- package/dist/core/service-configuration/provisioning-config.d.ts +429 -0
- package/dist/core/service-configuration/provisioning-config.js +307 -0
- package/dist/core/service-configuration/support-llm.d.ts +95 -0
- package/dist/core/service-configuration/support-llm.js +76 -0
- package/dist/core/service-configuration/voice-language.schema.d.ts +200 -0
- package/dist/core/service-configuration/voice-language.schema.js +166 -0
- package/dist/core/type-definitions/account-definitions.d.ts +82 -0
- package/dist/core/type-definitions/account-definitions.js +88 -0
- package/dist/core/type-definitions/business-definitions.d.ts +394 -0
- package/dist/core/type-definitions/business-definitions.js +447 -0
- package/dist/core/type-definitions/conversation.type.definition.d.ts +223 -0
- package/dist/core/type-definitions/conversation.type.definition.js +236 -0
- package/dist/core/type-definitions/display-order.d.ts +154 -0
- package/dist/core/type-definitions/display-order.js +154 -0
- package/dist/core/type-definitions/dynamic-fields/field-definition.schema.d.ts +165 -0
- package/dist/core/type-definitions/dynamic-fields/field-definition.schema.js +97 -0
- package/dist/core/type-definitions/dynamic-fields/field-types.d.ts +49 -0
- package/dist/core/type-definitions/dynamic-fields/field-types.js +104 -0
- package/dist/core/type-definitions/dynamic-fields/index.d.ts +9 -0
- package/dist/core/type-definitions/dynamic-fields/index.js +25 -0
- package/dist/core/type-definitions/index.d.ts +10 -0
- package/dist/core/type-definitions/index.js +26 -0
- package/dist/core/type-definitions/knowledge-definitions.d.ts +30 -0
- package/dist/core/type-definitions/knowledge-definitions.js +37 -0
- package/dist/core/type-definitions/service-config.definitions.d.ts +112 -0
- package/dist/core/type-definitions/service-config.definitions.js +135 -0
- package/dist/core/validators/channel-validation.d.ts +19 -0
- package/dist/core/validators/channel-validation.js +40 -0
- package/dist/core/validators/index.d.ts +5 -0
- package/dist/core/validators/index.js +21 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +24 -0
- package/dist/request/index.d.ts +5 -0
- package/dist/request/index.js +21 -0
- package/dist/request/models/index.d.ts +6 -0
- package/dist/request/models/index.js +22 -0
- package/dist/request/models/paginated-quest.schema.d.ts +33 -0
- package/dist/request/models/paginated-quest.schema.js +35 -0
- package/dist/request/models/paginated-result.schema.d.ts +124 -0
- package/dist/request/models/paginated-result.schema.js +94 -0
- package/package.json +43 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeploymentChannelDeletionRequestSchema = exports.DeploymentChannelWithDeploymentSchema = exports.ChannelUpdateRequestSchema = exports.ChannelSetupRequestSchema = exports.DeploymentChannelUpdateRequestSchema = exports.CreateDeploymentChannelSchema = exports.DeploymentChannelSchema = exports.DeploymentChannelRequestSchema = exports.CreateMobileAppChannelSchema = exports.CreateWebChannelSchema = exports.MobileAppChannelSchema = exports.WebChannelSchema = exports.SmsChannelSchema = exports.CallChannelSchema = exports.MobileAppChannelConfigSchema = exports.WebChannelConfigSchema = exports.PhoneChannelConfigSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const base_schema_1 = require("../base.schema");
|
|
6
|
+
const type_definitions_1 = require("../type-definitions");
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Deployment channel schema definitions for multi-channel interactions.
|
|
9
|
+
*
|
|
10
|
+
* Deployment Channels define the single communication channel through which a deployment is accessible
|
|
11
|
+
* to end users. Each Deployment Configuration has exactly one Deployment Channel (1:1 relationship).
|
|
12
|
+
* To expose an agent through multiple channels (e.g., both phone and web), create separate Deployment
|
|
13
|
+
* Configurations for each channel.
|
|
14
|
+
*
|
|
15
|
+
* @module service-configuration/interaction-channels
|
|
16
|
+
*/
|
|
17
|
+
const phoneNumberPattern = /^(\+?\d{1,4}[-.\s]?)?(\(\d{1,3}\)[-.\s]?)?\d{1,4}[-.\s]?\d{1,4}[-.\s]?\d{1,9}$/;
|
|
18
|
+
const webSiteUrlPattern = /^(https?:\/\/)?(localhost|(\d{1,3}\.){3}\d{1,3}|([a-z0-9-]+\.)*[a-z0-9-]+\.[a-z]{2,})(:\d{1,5})?(\/.*)?$/i;
|
|
19
|
+
/**
|
|
20
|
+
* Zod schema for phone channel configuration.
|
|
21
|
+
*
|
|
22
|
+
* Configuration specific to phone-based channels supporting voice calls and SMS messaging.
|
|
23
|
+
* This configuration links to a PhoneConfiguration resource that manages the actual phone number
|
|
24
|
+
* and telephony provider settings.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* **Architecture Context:**
|
|
28
|
+
* - **Used By**: Call and SMS deployment channels
|
|
29
|
+
* - **Relationship**: References PhoneConfiguration via phoneConfigurationId
|
|
30
|
+
* - **Features**: Supports call forwarding to external numbers for escalation or overflow
|
|
31
|
+
*/
|
|
32
|
+
exports.PhoneChannelConfigSchema = zod_1.z.object({
|
|
33
|
+
phoneConfigurationId: zod_1.z.string().describe("ID of the PhoneConfiguration resource that manages the phone number and telephony provider settings for this channel"),
|
|
34
|
+
// hasForwardingEnabled: z.boolean().default(false).describe("Whether call forwarding is enabled for this phone channel, allowing calls to be forwarded to external numbers for escalation or overflow handling"),
|
|
35
|
+
// forwardingPhoneNumber: z.string().optional().nullable().describe("Phone number in E.164 format to forward calls to when forwarding is enabled (e.g., '+12125551234' for escalation or overflow)"),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Zod schema for web channel configuration.
|
|
39
|
+
*
|
|
40
|
+
* Configuration specific to web-based chat widget channels that can be embedded in websites
|
|
41
|
+
* and web applications for browser-based real-time communication.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* **Architecture Context:**
|
|
45
|
+
* - **Used By**: Web deployment channels
|
|
46
|
+
* - **Features**: Embeddable chat widget, WebSocket communication, rich media support
|
|
47
|
+
* - **Customization**: Supports custom CSS and theming for brand consistency
|
|
48
|
+
*/
|
|
49
|
+
exports.WebChannelConfigSchema = zod_1.z.object({
|
|
50
|
+
communicationType: zod_1.z.enum(type_definitions_1.OttCommunicationType).default(type_definitions_1.OttCommunicationType.UNIFIED).describe("Type of over-the-top (OTT) communication protocol used for the web channel (default: UNIFIED for combined text/media communication)"),
|
|
51
|
+
widgetConfiguration: zod_1.z.object({
|
|
52
|
+
position: zod_1.z.enum(['left', 'right']).default('right').describe("Position of the chat widget on the webpage (left or right side of the screen)"),
|
|
53
|
+
customTheme: zod_1.z.record(zod_1.z.string(), zod_1.z.string()).optional().default({}).describe("Custom theme properties as key-value pairs for advanced widget styling (e.g., primary color)"),
|
|
54
|
+
}).optional().describe("Configuration settings for the chat widget appearance and behavior"),
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Zod schema for mobile app channel configuration.
|
|
58
|
+
*
|
|
59
|
+
* Configuration specific to mobile application channels for native iOS and Android integrations.
|
|
60
|
+
* Enables SDK-based integration with platform-specific UI components.
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* **Architecture Context:**
|
|
64
|
+
* - **Used By**: Mobile deployment channels
|
|
65
|
+
* - **Features**: SDK-based integration, deep linking, platform-specific UI
|
|
66
|
+
* - **Status**: Coming soon - currently in development
|
|
67
|
+
*/
|
|
68
|
+
exports.MobileAppChannelConfigSchema = zod_1.z.object({
|
|
69
|
+
packageName: zod_1.z.string().default('').describe("Package name or bundle identifier for the mobile application (e.g., 'com.company.app' for Android or 'com.company.app' for iOS)"),
|
|
70
|
+
platform: zod_1.z.enum(type_definitions_1.MobilePlatform).default(type_definitions_1.MobilePlatform.IOS).describe("Mobile platform this channel targets (iOS or Android) for platform-specific SDK integration"),
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* Base deployment channel schema with common fields.
|
|
74
|
+
*
|
|
75
|
+
* Defines the single communication channel through which a Deployment Configuration is accessible.
|
|
76
|
+
* Each Deployment Configuration has exactly one Deployment Channel (1:1 relationship).
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* **Architecture Context:**
|
|
80
|
+
* - **Relationship**: 1:1 with Deployment Configuration (belongs to exactly one deployment)
|
|
81
|
+
* - **Channel Types**: Phone (calls/SMS), Web (chat widget), or Mobile App
|
|
82
|
+
* - **Pattern**: To expose an agent through multiple channels, create separate Deployment Configurations
|
|
83
|
+
*
|
|
84
|
+
* @typedef {Object} BaseDeploymentChannelProperties
|
|
85
|
+
* @property {string} id - Unique identifier for the deployment channel
|
|
86
|
+
* @property {DeploymentType} deploymentType - Type of deployment channel (CALLS, SMS, WEB, or MOBILE)
|
|
87
|
+
* @property {string} [channelName] - Optional human-readable name for the channel for display purposes
|
|
88
|
+
* @property {boolean} recordingEnabled - Whether interactions through this channel should be recorded for compliance and quality purposes (default: true)
|
|
89
|
+
* @property {number} [createdAt] - Unix timestamp (milliseconds) when the channel was created
|
|
90
|
+
* @property {number} [updatedAt] - Unix timestamp (milliseconds) when the channel was last updated
|
|
91
|
+
*/
|
|
92
|
+
const BaseDeploymentChannelSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
93
|
+
deploymentType: zod_1.z.enum(type_definitions_1.DeploymentType).describe("Type of deployment channel determining the communication medium (CALLS for voice, SMS for text messaging, WEB for chat widget, MOBILE for native apps)"),
|
|
94
|
+
channelName: zod_1.z.string().optional().describe("Optional human-readable name for the channel used in administrative interfaces and reporting"),
|
|
95
|
+
recordingEnabled: zod_1.z.boolean().default(true).describe("Whether interactions through this channel should be recorded for compliance, quality assurance, and training purposes"),
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Zod schema for call-based deployment channel.
|
|
99
|
+
*
|
|
100
|
+
* Defines a voice telephony channel for inbound and outbound phone calls. Integrates with
|
|
101
|
+
* telephony providers (SignalWire, Twilio) through PhoneConfiguration.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* **Architecture Context:**
|
|
105
|
+
* - **Channel Type**: Phone (Voice Calls)
|
|
106
|
+
* - **Integration**: PBX systems, contact centers, SIP trunks, cloud telephony
|
|
107
|
+
* - **Features**: Call recording, DTMF input, call forwarding, SIP/VoIP support
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const callChannel: CallChannelType = {
|
|
112
|
+
* id: '123*',
|
|
113
|
+
* channelIdentifier: '+12125551234',
|
|
114
|
+
* deploymentType: DeploymentType.CALLS,
|
|
115
|
+
* recordingEnabled: true,
|
|
116
|
+
* configuration: {
|
|
117
|
+
* phoneConfigurationId: '789*',
|
|
118
|
+
* hasForwardingEnabled: false
|
|
119
|
+
* }
|
|
120
|
+
* };
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
exports.CallChannelSchema = BaseDeploymentChannelSchema.omit({ deploymentType: true }).safeExtend({
|
|
124
|
+
channelIdentifier: zod_1.z.string().regex(phoneNumberPattern, 'Phone number must be in E.164 format (e.g., +12125551234)').describe("Phone number in E.164 international format that serves as the inbound endpoint for voice calls (e.g., '+12125551234')"),
|
|
125
|
+
deploymentType: zod_1.z.literal(type_definitions_1.DeploymentType.CALLS).describe("Channel type identifier, fixed to CALLS for voice telephony channels"),
|
|
126
|
+
configuration: exports.PhoneChannelConfigSchema.describe("Phone-specific configuration including telephony provider settings and call forwarding options")
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* Zod schema for SMS-based deployment channel.
|
|
130
|
+
*
|
|
131
|
+
* Defines an SMS messaging channel for text-based communication. Uses the same telephony
|
|
132
|
+
* infrastructure as voice calls but optimized for asynchronous text messaging.
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* **Architecture Context:**
|
|
136
|
+
* - **Channel Type**: Phone (SMS Messaging)
|
|
137
|
+
* - **Integration**: SMS gateways, telephony providers
|
|
138
|
+
* - **Features**: Asynchronous messaging, message history, multimedia support (MMS)
|
|
139
|
+
*/
|
|
140
|
+
exports.SmsChannelSchema = BaseDeploymentChannelSchema.omit({ deploymentType: true }).safeExtend({
|
|
141
|
+
channelIdentifier: zod_1.z.string().regex(phoneNumberPattern, 'Phone number must be in E.164 format (e.g., +12125551234)').describe("Phone number in E.164 international format that serves as the endpoint for SMS messaging (e.g., '+12125551234')"),
|
|
142
|
+
deploymentType: zod_1.z.literal(type_definitions_1.DeploymentType.SMS).describe("Channel type identifier, fixed to SMS for text messaging channels"),
|
|
143
|
+
configuration: exports.PhoneChannelConfigSchema.describe("Phone-specific configuration including telephony provider settings for SMS delivery")
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* Zod schema for web-based deployment channel.
|
|
147
|
+
*
|
|
148
|
+
* Defines a browser-based chat widget channel for website integration. Provides real-time
|
|
149
|
+
* messaging with rich media support through WebSocket connections.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* **Architecture Context:**
|
|
153
|
+
* - **Channel Type**: Web (Chat Widget)
|
|
154
|
+
* - **Integration**: Websites, web apps, customer portals, help centers
|
|
155
|
+
* - **Features**: Embeddable widget, WebSocket real-time communication, rich media, session persistence
|
|
156
|
+
*/
|
|
157
|
+
exports.WebChannelSchema = BaseDeploymentChannelSchema.omit({ deploymentType: true }).safeExtend({
|
|
158
|
+
channelIdentifier: zod_1.z.string().regex(webSiteUrlPattern, 'Invalid website URL format').describe("Website URL where the chat widget will be deployed (e.g., 'https://example.com' or 'localhost:3000' for development)"),
|
|
159
|
+
deploymentType: zod_1.z.literal(type_definitions_1.DeploymentType.WEB).describe("Channel type identifier, fixed to WEB for browser-based chat widget channels"),
|
|
160
|
+
configuration: exports.WebChannelConfigSchema.describe("Web-specific configuration including chat widget appearance, positioning, and theming options")
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* Zod schema for mobile app deployment channel.
|
|
164
|
+
*
|
|
165
|
+
* Defines a native mobile application channel for iOS and Android apps. Enables SDK-based
|
|
166
|
+
* integration with platform-specific UI components and capabilities.
|
|
167
|
+
*
|
|
168
|
+
* @remarks
|
|
169
|
+
* **Architecture Context:**
|
|
170
|
+
* - **Channel Type**: Mobile (Native App)
|
|
171
|
+
* - **Integration**: iOS apps, Android apps, cross-platform frameworks (React Native, Flutter)
|
|
172
|
+
* - **Features**: SDK integration, deep linking, platform-specific UI, push notifications
|
|
173
|
+
* - **Status**: Coming soon - currently in development
|
|
174
|
+
*/
|
|
175
|
+
exports.MobileAppChannelSchema = BaseDeploymentChannelSchema.omit({ deploymentType: true }).safeExtend({
|
|
176
|
+
channelIdentifier: zod_1.z.string().describe("Unique identifier for the mobile application deployment (typically the app bundle ID or package name)"),
|
|
177
|
+
deploymentType: zod_1.z.literal(type_definitions_1.DeploymentType.MOBILE).describe("Channel type identifier, fixed to MOBILE for native mobile application channels"),
|
|
178
|
+
configuration: exports.MobileAppChannelConfigSchema.describe("Mobile-specific configuration including platform selection and app package identification")
|
|
179
|
+
});
|
|
180
|
+
/**
|
|
181
|
+
* Zod schema for creating a new web channel.
|
|
182
|
+
*/
|
|
183
|
+
exports.CreateWebChannelSchema = exports.WebChannelSchema.omit({
|
|
184
|
+
id: true,
|
|
185
|
+
createdAt: true,
|
|
186
|
+
updatedAt: true,
|
|
187
|
+
});
|
|
188
|
+
/**
|
|
189
|
+
* Zod schema for creating a new mobile app channel.
|
|
190
|
+
*/
|
|
191
|
+
exports.CreateMobileAppChannelSchema = exports.MobileAppChannelSchema.omit({
|
|
192
|
+
id: true,
|
|
193
|
+
createdAt: true,
|
|
194
|
+
updatedAt: true,
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* Zod schema for deployment channel creation request.
|
|
198
|
+
*
|
|
199
|
+
* Flexible schema that validates channel configuration based on deployment type.
|
|
200
|
+
* Uses runtime validation to ensure channel-specific requirements are met.
|
|
201
|
+
*
|
|
202
|
+
* @remarks
|
|
203
|
+
* **Architecture Context:**
|
|
204
|
+
* - **Purpose**: Validates incoming requests to create new deployment channels
|
|
205
|
+
* - **Validation**: Type-specific validation ensures correct configuration for each channel type
|
|
206
|
+
* - **Usage**: Used by API endpoints for channel creation
|
|
207
|
+
*/
|
|
208
|
+
exports.DeploymentChannelRequestSchema = zod_1.z.object({
|
|
209
|
+
deploymentType: zod_1.z.enum(type_definitions_1.DeploymentType).describe("Type of deployment channel to create (CALLS, SMS, WEB, or MOBILE)"),
|
|
210
|
+
channelName: zod_1.z.string().optional().describe("Optional human-readable name for the channel"),
|
|
211
|
+
recordingEnabled: zod_1.z.boolean().default(true).describe("Whether to enable interaction recording for this channel"),
|
|
212
|
+
channelIdentifier: zod_1.z.string().describe("Channel-specific identifier (phone number for calls/SMS, URL for web, package name for mobile)"),
|
|
213
|
+
configuration: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).describe("Channel-specific configuration object matching the requirements of the deployment type"),
|
|
214
|
+
createdAt: zod_1.z.number().optional().describe("Unix timestamp (milliseconds) when the channel was created (auto-generated if not provided)"),
|
|
215
|
+
updatedAt: zod_1.z.number().optional().describe("Unix timestamp (milliseconds) when the channel was last updated (auto-generated if not provided)"),
|
|
216
|
+
}).refine((data) => {
|
|
217
|
+
switch (data.deploymentType) {
|
|
218
|
+
case type_definitions_1.DeploymentType.CALLS:
|
|
219
|
+
return exports.CallChannelSchema.omit({
|
|
220
|
+
id: true,
|
|
221
|
+
}).safeParse(data).success;
|
|
222
|
+
case type_definitions_1.DeploymentType.SMS:
|
|
223
|
+
return exports.SmsChannelSchema.omit({
|
|
224
|
+
id: true,
|
|
225
|
+
}).safeParse(data).success;
|
|
226
|
+
case type_definitions_1.DeploymentType.WEB:
|
|
227
|
+
return exports.WebChannelSchema.omit({
|
|
228
|
+
id: true,
|
|
229
|
+
}).safeParse(data).success;
|
|
230
|
+
case type_definitions_1.DeploymentType.MOBILE:
|
|
231
|
+
return exports.MobileAppChannelSchema.omit({
|
|
232
|
+
id: true,
|
|
233
|
+
}).safeParse(data).success;
|
|
234
|
+
default:
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
}, "Invalid channel configuration for deployment type");
|
|
238
|
+
/**
|
|
239
|
+
* Zod schema for main deployment channel with discriminated union.
|
|
240
|
+
*
|
|
241
|
+
* Provides type-safe channel configuration based on deployment type. This is the primary
|
|
242
|
+
* schema used for deployment channel entities throughout the system.
|
|
243
|
+
*
|
|
244
|
+
* @remarks
|
|
245
|
+
* **Architecture Context:**
|
|
246
|
+
* - **Relationship**: 1:1 with Deployment Configuration (each deployment has exactly one channel)
|
|
247
|
+
* - **Pattern**: Multi-channel deployments require separate Deployment Configurations per channel
|
|
248
|
+
* - **Validation**: Configuration must match the deployment type requirements
|
|
249
|
+
*
|
|
250
|
+
* **Design Note:**
|
|
251
|
+
* The discriminated union approach (commented code) provides stricter type safety but the
|
|
252
|
+
* current union-based approach offers more flexibility for runtime validation.
|
|
253
|
+
*/
|
|
254
|
+
// export const DeploymentChannelSchema = BaseDeploymentChannelSchema.safeExtend({
|
|
255
|
+
// channelIdentifier: z.string(),
|
|
256
|
+
// }).and(
|
|
257
|
+
// z.discriminatedUnion('deploymentType', [
|
|
258
|
+
// z.object({
|
|
259
|
+
// deploymentType: z.literal(DeploymentType.CALLS),
|
|
260
|
+
// channelIdentifier: z.string().regex(phoneNumberPattern),
|
|
261
|
+
// configuration: PhoneChannelConfigSchema,
|
|
262
|
+
// }),
|
|
263
|
+
// z.object({
|
|
264
|
+
// deploymentType: z.literal(DeploymentType.SMS),
|
|
265
|
+
// channelIdentifier: z.string().regex(phoneNumberPattern),
|
|
266
|
+
// configuration: PhoneChannelConfigSchema,
|
|
267
|
+
// }),
|
|
268
|
+
// z.object({
|
|
269
|
+
// deploymentType: z.literal(DeploymentType.WEB),
|
|
270
|
+
// channelIdentifier: z.string().regex(webSiteUrlPattern),
|
|
271
|
+
// configuration: WebChannelConfigSchema,
|
|
272
|
+
// }),
|
|
273
|
+
// z.object({
|
|
274
|
+
// deploymentType: z.literal(DeploymentType.MOBILE),
|
|
275
|
+
// channelIdentifier: z.string(),
|
|
276
|
+
// configuration: MobileAppChannelConfigSchema,
|
|
277
|
+
// }),
|
|
278
|
+
// ])
|
|
279
|
+
// );
|
|
280
|
+
exports.DeploymentChannelSchema = BaseDeploymentChannelSchema.safeExtend({
|
|
281
|
+
channelIdentifier: zod_1.z.string().describe("Channel-specific identifier: phone number (E.164 format) for calls/SMS, website URL for web, or app package name for mobile"),
|
|
282
|
+
configuration: zod_1.z.union([
|
|
283
|
+
exports.PhoneChannelConfigSchema,
|
|
284
|
+
exports.WebChannelConfigSchema,
|
|
285
|
+
exports.MobileAppChannelConfigSchema,
|
|
286
|
+
]).describe("Channel-specific configuration object matching the deployment type (PhoneChannelConfig for calls/SMS, WebChannelConfig for web, MobileAppChannelConfig for mobile)"),
|
|
287
|
+
});
|
|
288
|
+
/**
|
|
289
|
+
* Zod schema for creating deployment channel.
|
|
290
|
+
*/
|
|
291
|
+
exports.CreateDeploymentChannelSchema = exports.DeploymentChannelRequestSchema;
|
|
292
|
+
/**
|
|
293
|
+
* Zod schema for updating deployment channel.
|
|
294
|
+
*
|
|
295
|
+
* Supports partial updates to existing deployment channels. All fields are optional except id.
|
|
296
|
+
*
|
|
297
|
+
* @remarks
|
|
298
|
+
* **Architecture Context:**
|
|
299
|
+
* - **Purpose**: Enables modification of channel settings without recreating the deployment
|
|
300
|
+
* - **Validation**: Partial validation ensures only provided fields are validated
|
|
301
|
+
* - **Usage**: Used by API endpoints for channel updates
|
|
302
|
+
*/
|
|
303
|
+
exports.DeploymentChannelUpdateRequestSchema = zod_1.z.object({
|
|
304
|
+
id: zod_1.z.string().describe("Unique identifier of the deployment channel to update"),
|
|
305
|
+
deploymentType: zod_1.z.enum(type_definitions_1.DeploymentType).optional().describe("Optional update to the channel type (generally not recommended to change after creation)"),
|
|
306
|
+
channelName: zod_1.z.string().optional().describe("Optional update to the human-readable channel name"),
|
|
307
|
+
recordingEnabled: zod_1.z.boolean().optional().describe("Optional update to the recording settings for this channel"),
|
|
308
|
+
channelIdentifier: zod_1.z.string().optional().describe("Optional update to the channel identifier (phone number, URL, or package name)"),
|
|
309
|
+
configuration: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe("Optional update to the channel-specific configuration object"),
|
|
310
|
+
});
|
|
311
|
+
/**
|
|
312
|
+
* Zod schema for channel setup request.
|
|
313
|
+
*
|
|
314
|
+
* Complete setup request for creating a new deployment with its associated channel and configurations.
|
|
315
|
+
* This is a convenience schema that combines channel creation with deployment configuration references.
|
|
316
|
+
*
|
|
317
|
+
* @remarks
|
|
318
|
+
* **Architecture Context:**
|
|
319
|
+
* - **Purpose**: Simplifies deployment creation by bundling channel and configuration references
|
|
320
|
+
* - **Relationship**: Creates a Deployment Configuration with associated channel, project, agent, and instruction
|
|
321
|
+
* - **Pattern**: One request creates the complete deployment stack
|
|
322
|
+
*/
|
|
323
|
+
exports.ChannelSetupRequestSchema = zod_1.z.object({
|
|
324
|
+
channel: exports.DeploymentChannelRequestSchema.describe("Deployment channel configuration to create, including type, identifier, and channel-specific settings"),
|
|
325
|
+
projectId: zod_1.z.string().describe("ID of the project this deployment belongs to for organizational grouping and access control"),
|
|
326
|
+
agentConfigurationId: zod_1.z.string().describe("ID of the agent configuration that defines the agent's core behavior and capabilities (N:1 relationship)"),
|
|
327
|
+
instructionConfigurationId: zod_1.z.string().describe("ID of the instruction configuration that provides behavioral guidelines for the agent (N:1 relationship)"),
|
|
328
|
+
});
|
|
329
|
+
/**
|
|
330
|
+
* Zod schema for channel update request.
|
|
331
|
+
*
|
|
332
|
+
* Partial update request for modifying an existing deployment and its associated channel.
|
|
333
|
+
* Supports updating the channel configuration and/or changing the referenced configurations.
|
|
334
|
+
*
|
|
335
|
+
* @remarks
|
|
336
|
+
* **Architecture Context:**
|
|
337
|
+
* - **Purpose**: Enables modification of deployment configuration references and channel settings
|
|
338
|
+
* - **Flexibility**: All fields are optional for partial updates
|
|
339
|
+
* - **Usage**: Used to update deployments without full recreation
|
|
340
|
+
*/
|
|
341
|
+
exports.ChannelUpdateRequestSchema = zod_1.z.object({
|
|
342
|
+
channel: exports.DeploymentChannelUpdateRequestSchema.describe("Partial update to the deployment channel configuration"),
|
|
343
|
+
projectId: zod_1.z.string().optional().describe("Optional update to the project association for this deployment"),
|
|
344
|
+
agentConfigurationId: zod_1.z.string().optional().describe("Optional update to the agent configuration reference (switches to a different agent)"),
|
|
345
|
+
instructionConfigurationId: zod_1.z.string().optional().describe("Optional update to the instruction configuration reference (switches to different behavioral guidelines)"),
|
|
346
|
+
});
|
|
347
|
+
/**
|
|
348
|
+
* Zod schema for deployment channel with deployment information.
|
|
349
|
+
*
|
|
350
|
+
* Extended view that includes both the channel configuration and its associated deployment details.
|
|
351
|
+
* This schema is typically used for detailed views where the complete deployment context is needed.
|
|
352
|
+
*
|
|
353
|
+
* @remarks
|
|
354
|
+
* **Architecture Context:**
|
|
355
|
+
* - **Purpose**: Provides complete deployment context in a single response
|
|
356
|
+
* - **Usage**: Used for detail views and administrative interfaces
|
|
357
|
+
* - **Relationship**: Combines DeploymentChannel with its associated Deployment Configuration
|
|
358
|
+
*/
|
|
359
|
+
exports.DeploymentChannelWithDeploymentSchema = zod_1.z.object({
|
|
360
|
+
id: zod_1.z.string().describe("Unique identifier for the deployment channel"),
|
|
361
|
+
deploymentType: zod_1.z.enum(type_definitions_1.DeploymentType).describe("Type of deployment channel (CALLS, SMS, WEB, or MOBILE)"),
|
|
362
|
+
channelName: zod_1.z.string().optional().describe("Optional human-readable name for the channel"),
|
|
363
|
+
recordingEnabled: zod_1.z.boolean().default(true).describe("Whether interactions through this channel are being recorded"),
|
|
364
|
+
channelIdentifier: zod_1.z.string().describe("Channel-specific identifier (phone number, URL, or package name)"),
|
|
365
|
+
configuration: zod_1.z.union([
|
|
366
|
+
exports.PhoneChannelConfigSchema,
|
|
367
|
+
exports.WebChannelConfigSchema,
|
|
368
|
+
exports.MobileAppChannelConfigSchema,
|
|
369
|
+
]).describe("Channel-specific configuration object"),
|
|
370
|
+
deployment: zod_1.z.object({
|
|
371
|
+
id: zod_1.z.string().describe("Unique identifier for the deployment configuration"),
|
|
372
|
+
projectId: zod_1.z.string().describe("ID of the project this deployment belongs to"),
|
|
373
|
+
deploymentChannelId: zod_1.z.string().describe("ID of this deployment channel (should match the parent channel's id)"),
|
|
374
|
+
deploymentName: zod_1.z.string().optional().describe("Optional human-readable name for the deployment"),
|
|
375
|
+
agentConfigurationId: zod_1.z.string().describe("ID of the agent configuration used by this deployment"),
|
|
376
|
+
instructionConfigurationId: zod_1.z.string().describe("ID of the instruction configuration used by this deployment"),
|
|
377
|
+
provisioningConfigChainId: zod_1.z.string().optional().nullable().describe("Optional ID of the provisioning chain for voice processing (STT → Agent → TTS)"),
|
|
378
|
+
provisioningType: zod_1.z.enum(type_definitions_1.DeploymentProvisioningType).optional().nullable().describe("How this deployment is provisioned (DIRECT or CHAINED)"),
|
|
379
|
+
deploymentStatus: zod_1.z.enum(type_definitions_1.DeploymentStatus).describe("Current operational status of the deployment"),
|
|
380
|
+
isActive: zod_1.z.boolean().default(false).describe("Whether this deployment is currently active and accepting interactions"),
|
|
381
|
+
project: zod_1.z.any().optional().nullable().describe("Optional populated project details"),
|
|
382
|
+
agent: zod_1.z.any().optional().nullable().describe("Optional populated agent configuration details"),
|
|
383
|
+
instruction: zod_1.z.any().optional().nullable().describe("Optional populated instruction configuration details"),
|
|
384
|
+
createdAt: zod_1.z.number().describe("Unix timestamp (milliseconds) when the deployment was created"),
|
|
385
|
+
}).nullable().describe("Associated deployment configuration details (null if channel is not yet associated with a deployment)"),
|
|
386
|
+
});
|
|
387
|
+
exports.DeploymentChannelDeletionRequestSchema = zod_1.z.object({
|
|
388
|
+
id: zod_1.z.string().describe("Unique identifier of the deployment channel to delete"),
|
|
389
|
+
deletePhoneConfig: zod_1.z.boolean().optional().default(true).describe("Whether to also delete associated phone configurations"),
|
|
390
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { KnowledgeBaseProcessingStatus, KnowledgeTypes, StorageTier } from "../type-definitions";
|
|
3
|
+
/**
|
|
4
|
+
* @fileoverview Knowledge source schema definitions for managing AI knowledge bases.
|
|
5
|
+
*
|
|
6
|
+
* Knowledge Sources provide contextual information, documentation, and domain knowledge that
|
|
7
|
+
* Instruction Configurations can reference to enhance agent capabilities. They support multiple
|
|
8
|
+
* content types and intelligent storage tier management for cost optimization.
|
|
9
|
+
*
|
|
10
|
+
* @module service-configuration/knowledge
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Zod schema for Knowledge Source validation.
|
|
14
|
+
*
|
|
15
|
+
* Knowledge Sources provide contextual information and domain knowledge for AI agents. They are
|
|
16
|
+
* referenced by Instruction Configurations (1:N relationship) to give agents access to specific
|
|
17
|
+
* information, documentation, or business knowledge needed for their tasks.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* **Architecture Context:**
|
|
21
|
+
* - **Relationship**: Referenced by Instruction Configurations via knowledgeSourceIds (1:N)
|
|
22
|
+
* - **Purpose**: Provides domain knowledge, documentation, and context for agent responses
|
|
23
|
+
* - **Storage Strategy**: Multi-tier storage (Firestore, Cloud Storage) with automatic optimization
|
|
24
|
+
* - **Processing Pipeline**: Raw content → Processing → Prepared content optimized for AI consumption
|
|
25
|
+
*
|
|
26
|
+
* **Storage Tiers:**
|
|
27
|
+
* - **FIRESTORE**: Fast access for frequently used knowledge (stored in database)
|
|
28
|
+
* - **CLOUD_STORAGE**: Cost-effective for less frequently accessed content
|
|
29
|
+
* - **Automatic Optimization**: Access patterns drive tier migration for cost efficiency
|
|
30
|
+
*
|
|
31
|
+
* @typedef {Object} KnowledgeSourceProperties
|
|
32
|
+
* @property {string} id - Unique identifier for the knowledge source
|
|
33
|
+
* @property {string} name - Human-readable name for the knowledge source
|
|
34
|
+
* @property {KnowledgeTypes} sourceType - Type of knowledge source (DOCUMENT, URL, BUSINESS_WEBSITE, CORPUS, BATCH_DOCUMENT)
|
|
35
|
+
* @property {boolean} request_success - Flag indicating if the knowledge source creation and initial processing request was successful
|
|
36
|
+
* @property {KnowledgeBaseProcessingStatus} processingStatus - Current processing status (PENDING, PROCESSING, COMPLETED, FAILED) (default: PENDING)
|
|
37
|
+
* @property {string | null} [content] - Raw extracted content from the knowledge source (may be null if using cloud storage)
|
|
38
|
+
* @property {string | null} [prepped_content] - Processed and prepared content optimized for AI consumption with enhanced formatting
|
|
39
|
+
* @property {string | null} [content_path] - Storage path for the raw content file in the storage system
|
|
40
|
+
* @property {string | null} [prepped_content_path] - Storage path for the processed content file in the storage system
|
|
41
|
+
* @property {string | null} [original_content_url] - Original source URL or upload URL where the content was obtained
|
|
42
|
+
* @property {string | null} [stored_content_url] - Cloud storage URL for accessing the stored raw content
|
|
43
|
+
* @property {string | null} [prepped_content_url] - Cloud storage URL for accessing the processed content
|
|
44
|
+
* @property {number} [content_size] - Size of the raw content in bytes for storage tracking
|
|
45
|
+
* @property {number} [prepped_content_size] - Size of the processed content in bytes after preparation
|
|
46
|
+
* @property {StorageTier} storage_tier - Current storage tier for this knowledge source (FIRESTORE or CLOUD_STORAGE) (default: FIRESTORE)
|
|
47
|
+
* @property {number} [last_accessed] - Unix timestamp (milliseconds) when the knowledge source was last accessed by an agent
|
|
48
|
+
* @property {number} access_count - Number of times this knowledge source has been accessed, used for tier optimization (default: 0)
|
|
49
|
+
* @property {boolean} is_compressed - Flag indicating if the content is stored in compressed format to save space (default: false)
|
|
50
|
+
* @property {number} [compression_ratio] - Compression ratio achieved if content is compressed (e.g., 0.5 for 50% compression)
|
|
51
|
+
* @property {Record<string, any>} [metadata] - Additional metadata about the knowledge source (tags, categories, custom attributes)
|
|
52
|
+
* @property {string | null} [original_content_type] - Original MIME type of the source content (e.g., 'application/pdf', 'text/html')
|
|
53
|
+
* @property {string | null} [content_hash] - Hash of the content for deduplication and integrity verification
|
|
54
|
+
* @property {number} [createdAt] - Unix timestamp (milliseconds) when created
|
|
55
|
+
* @property {number} [updatedAt] - Unix timestamp (milliseconds) when last updated
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const knowledgeSource: KnowledgeSource = {
|
|
60
|
+
* id: '123*',
|
|
61
|
+
* name: 'Product Documentation',
|
|
62
|
+
* sourceType: KnowledgeTypes.DOCUMENT,
|
|
63
|
+
* request_success: true,
|
|
64
|
+
* processingStatus: KnowledgeBaseProcessingStatus.COMPLETED,
|
|
65
|
+
* content: 'Raw document content...',
|
|
66
|
+
* prepped_content: 'Processed content...',
|
|
67
|
+
* storage_tier: StorageTier.FIRESTORE,
|
|
68
|
+
* access_count: 42,
|
|
69
|
+
* is_compressed: false,
|
|
70
|
+
* createdAt: Date.now(),
|
|
71
|
+
* updatedAt: Date.now()
|
|
72
|
+
* };
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare const KnowledgeSourceSchema: z.ZodObject<{
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
updatedAt: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
sourceType: z.ZodEnum<typeof KnowledgeTypes>;
|
|
81
|
+
request_success: z.ZodBoolean;
|
|
82
|
+
processingStatus: z.ZodDefault<z.ZodEnum<typeof KnowledgeBaseProcessingStatus>>;
|
|
83
|
+
content: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
84
|
+
prepped_content: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
85
|
+
content_path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
86
|
+
prepped_content_path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
87
|
+
original_content_url: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
88
|
+
stored_content_url: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
89
|
+
prepped_content_url: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
90
|
+
content_size: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
prepped_content_size: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
storage_tier: z.ZodDefault<z.ZodEnum<typeof StorageTier>>;
|
|
93
|
+
last_accessed: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
access_count: z.ZodDefault<z.ZodNumber>;
|
|
95
|
+
is_compressed: z.ZodDefault<z.ZodBoolean>;
|
|
96
|
+
compression_ratio: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
metadata: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
98
|
+
original_content_type: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
99
|
+
content_hash: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
/**
|
|
102
|
+
* Type definition for Knowledge Source.
|
|
103
|
+
*
|
|
104
|
+
* Represents a complete knowledge source including all metadata,
|
|
105
|
+
* content storage, and processing information.
|
|
106
|
+
*/
|
|
107
|
+
export type KnowledgeSource = z.infer<typeof KnowledgeSourceSchema>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KnowledgeSourceSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const base_schema_1 = require("../base.schema");
|
|
6
|
+
const type_definitions_1 = require("../type-definitions");
|
|
7
|
+
/**
|
|
8
|
+
* @fileoverview Knowledge source schema definitions for managing AI knowledge bases.
|
|
9
|
+
*
|
|
10
|
+
* Knowledge Sources provide contextual information, documentation, and domain knowledge that
|
|
11
|
+
* Instruction Configurations can reference to enhance agent capabilities. They support multiple
|
|
12
|
+
* content types and intelligent storage tier management for cost optimization.
|
|
13
|
+
*
|
|
14
|
+
* @module service-configuration/knowledge
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Zod schema for Knowledge Source validation.
|
|
18
|
+
*
|
|
19
|
+
* Knowledge Sources provide contextual information and domain knowledge for AI agents. They are
|
|
20
|
+
* referenced by Instruction Configurations (1:N relationship) to give agents access to specific
|
|
21
|
+
* information, documentation, or business knowledge needed for their tasks.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* **Architecture Context:**
|
|
25
|
+
* - **Relationship**: Referenced by Instruction Configurations via knowledgeSourceIds (1:N)
|
|
26
|
+
* - **Purpose**: Provides domain knowledge, documentation, and context for agent responses
|
|
27
|
+
* - **Storage Strategy**: Multi-tier storage (Firestore, Cloud Storage) with automatic optimization
|
|
28
|
+
* - **Processing Pipeline**: Raw content → Processing → Prepared content optimized for AI consumption
|
|
29
|
+
*
|
|
30
|
+
* **Storage Tiers:**
|
|
31
|
+
* - **FIRESTORE**: Fast access for frequently used knowledge (stored in database)
|
|
32
|
+
* - **CLOUD_STORAGE**: Cost-effective for less frequently accessed content
|
|
33
|
+
* - **Automatic Optimization**: Access patterns drive tier migration for cost efficiency
|
|
34
|
+
*
|
|
35
|
+
* @typedef {Object} KnowledgeSourceProperties
|
|
36
|
+
* @property {string} id - Unique identifier for the knowledge source
|
|
37
|
+
* @property {string} name - Human-readable name for the knowledge source
|
|
38
|
+
* @property {KnowledgeTypes} sourceType - Type of knowledge source (DOCUMENT, URL, BUSINESS_WEBSITE, CORPUS, BATCH_DOCUMENT)
|
|
39
|
+
* @property {boolean} request_success - Flag indicating if the knowledge source creation and initial processing request was successful
|
|
40
|
+
* @property {KnowledgeBaseProcessingStatus} processingStatus - Current processing status (PENDING, PROCESSING, COMPLETED, FAILED) (default: PENDING)
|
|
41
|
+
* @property {string | null} [content] - Raw extracted content from the knowledge source (may be null if using cloud storage)
|
|
42
|
+
* @property {string | null} [prepped_content] - Processed and prepared content optimized for AI consumption with enhanced formatting
|
|
43
|
+
* @property {string | null} [content_path] - Storage path for the raw content file in the storage system
|
|
44
|
+
* @property {string | null} [prepped_content_path] - Storage path for the processed content file in the storage system
|
|
45
|
+
* @property {string | null} [original_content_url] - Original source URL or upload URL where the content was obtained
|
|
46
|
+
* @property {string | null} [stored_content_url] - Cloud storage URL for accessing the stored raw content
|
|
47
|
+
* @property {string | null} [prepped_content_url] - Cloud storage URL for accessing the processed content
|
|
48
|
+
* @property {number} [content_size] - Size of the raw content in bytes for storage tracking
|
|
49
|
+
* @property {number} [prepped_content_size] - Size of the processed content in bytes after preparation
|
|
50
|
+
* @property {StorageTier} storage_tier - Current storage tier for this knowledge source (FIRESTORE or CLOUD_STORAGE) (default: FIRESTORE)
|
|
51
|
+
* @property {number} [last_accessed] - Unix timestamp (milliseconds) when the knowledge source was last accessed by an agent
|
|
52
|
+
* @property {number} access_count - Number of times this knowledge source has been accessed, used for tier optimization (default: 0)
|
|
53
|
+
* @property {boolean} is_compressed - Flag indicating if the content is stored in compressed format to save space (default: false)
|
|
54
|
+
* @property {number} [compression_ratio] - Compression ratio achieved if content is compressed (e.g., 0.5 for 50% compression)
|
|
55
|
+
* @property {Record<string, any>} [metadata] - Additional metadata about the knowledge source (tags, categories, custom attributes)
|
|
56
|
+
* @property {string | null} [original_content_type] - Original MIME type of the source content (e.g., 'application/pdf', 'text/html')
|
|
57
|
+
* @property {string | null} [content_hash] - Hash of the content for deduplication and integrity verification
|
|
58
|
+
* @property {number} [createdAt] - Unix timestamp (milliseconds) when created
|
|
59
|
+
* @property {number} [updatedAt] - Unix timestamp (milliseconds) when last updated
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const knowledgeSource: KnowledgeSource = {
|
|
64
|
+
* id: '123*',
|
|
65
|
+
* name: 'Product Documentation',
|
|
66
|
+
* sourceType: KnowledgeTypes.DOCUMENT,
|
|
67
|
+
* request_success: true,
|
|
68
|
+
* processingStatus: KnowledgeBaseProcessingStatus.COMPLETED,
|
|
69
|
+
* content: 'Raw document content...',
|
|
70
|
+
* prepped_content: 'Processed content...',
|
|
71
|
+
* storage_tier: StorageTier.FIRESTORE,
|
|
72
|
+
* access_count: 42,
|
|
73
|
+
* is_compressed: false,
|
|
74
|
+
* createdAt: Date.now(),
|
|
75
|
+
* updatedAt: Date.now()
|
|
76
|
+
* };
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
exports.KnowledgeSourceSchema = base_schema_1.BaseModelSchema.safeExtend({
|
|
80
|
+
name: zod_1.z.string().describe("Human-readable name for the knowledge source (e.g., 'Product Documentation', 'Company Policies', 'Technical FAQs')"),
|
|
81
|
+
sourceType: zod_1.z.enum(type_definitions_1.KnowledgeTypes).describe("Type of knowledge source determining how content is ingested (DOCUMENT for files, URL for web pages, BUSINESS_WEBSITE for site crawls, CORPUS for collections, BATCH_DOCUMENT for multiple files)"),
|
|
82
|
+
request_success: zod_1.z.boolean().describe("Flag indicating whether the knowledge source creation and initial processing request completed successfully"),
|
|
83
|
+
processingStatus: zod_1.z.enum(type_definitions_1.KnowledgeBaseProcessingStatus).default(type_definitions_1.KnowledgeBaseProcessingStatus.PENDING).describe("Current processing status of the knowledge source (PENDING: awaiting processing, PROCESSING: being prepared, COMPLETED: ready for use, FAILED: processing error)"),
|
|
84
|
+
// Content storage
|
|
85
|
+
content: zod_1.z.string().optional().nullable().describe("Raw extracted content from the knowledge source stored inline (null if content is stored in cloud storage for size optimization)"),
|
|
86
|
+
prepped_content: zod_1.z.string().optional().nullable().describe("Processed and prepared content optimized for AI consumption with enhanced formatting, structure, and metadata (null if stored in cloud storage)"),
|
|
87
|
+
content_path: zod_1.z.string().optional().nullable().describe("Storage path for the raw content file in the cloud storage system (e.g., 'knowledge/org-123/doc-456/content.txt')"),
|
|
88
|
+
prepped_content_path: zod_1.z.string().optional().nullable().describe("Storage path for the processed content file in the cloud storage system (e.g., 'knowledge/org-123/doc-456/prepped.txt')"),
|
|
89
|
+
// Public URLs for client access
|
|
90
|
+
original_content_url: zod_1.z.string().optional().nullable().describe("Original source URL or upload URL where the content was obtained (for traceability and re-ingestion)"),
|
|
91
|
+
stored_content_url: zod_1.z.string().optional().nullable().describe("Cloud storage URL for accessing the stored raw content via HTTP (signed URL or public URL)"),
|
|
92
|
+
prepped_content_url: zod_1.z.string().optional().nullable().describe("Cloud storage URL for accessing the processed content via HTTP (signed URL or public URL)"),
|
|
93
|
+
// Storage metadata
|
|
94
|
+
content_size: zod_1.z.number().optional().describe("Size of the raw content in bytes, used for storage quota tracking and tier optimization decisions"),
|
|
95
|
+
prepped_content_size: zod_1.z.number().optional().describe("Size of the processed content in bytes after preparation and enhancement"),
|
|
96
|
+
storage_tier: zod_1.z.enum(type_definitions_1.StorageTier).default(type_definitions_1.StorageTier.FIRESTORE).describe("Current storage tier for this knowledge source: FIRESTORE for frequently accessed content (fast, expensive), CLOUD_STORAGE for infrequent access (slower, cost-effective)"),
|
|
97
|
+
// Access tracking for tier optimization
|
|
98
|
+
last_accessed: zod_1.z.number().optional().describe("Unix timestamp (milliseconds) when the knowledge source was last accessed by an agent, used for automatic tier migration"),
|
|
99
|
+
access_count: zod_1.z.number().default(0).describe("Number of times this knowledge source has been accessed by agents, used to determine optimal storage tier placement"),
|
|
100
|
+
// Compression info
|
|
101
|
+
is_compressed: zod_1.z.boolean().default(false).describe("Flag indicating whether the content is stored in compressed format (e.g., gzip) to reduce storage costs"),
|
|
102
|
+
compression_ratio: zod_1.z.number().optional().describe("Compression ratio achieved if content is compressed (e.g., 0.5 means compressed to 50% of original size)"),
|
|
103
|
+
metadata: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().default({}).describe("Additional metadata about the knowledge source including tags, categories, custom attributes, source information, or processing details"),
|
|
104
|
+
original_content_type: zod_1.z.string().optional().nullable().describe("Original MIME type of the source content (e.g., 'application/pdf', 'text/html', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document')"),
|
|
105
|
+
content_hash: zod_1.z.string().optional().nullable().describe("Hash of the content (e.g., SHA-256) for deduplication, change detection, and integrity verification"),
|
|
106
|
+
});
|