@talkpilot/core-db 1.3.57 → 1.3.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -21
- package/dist/configuration/models/index.d.ts +1 -1
- package/dist/configuration/models/index.d.ts.map +1 -1
- package/dist/configuration/models/models.types.d.ts +12 -0
- package/dist/configuration/models/models.types.d.ts.map +1 -1
- package/dist/talkpilot/clients/clients.getters.d.ts +0 -1
- package/dist/talkpilot/clients/clients.getters.d.ts.map +1 -1
- package/dist/talkpilot/clients/clients.getters.js +1 -3
- package/dist/talkpilot/clients/clients.getters.js.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts +0 -6
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.d.ts.map +1 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.js +1 -32
- package/dist/talkpilot/phone_numbers/phone_numbers.getter.js.map +1 -1
- package/package.json +1 -1
- package/src/configuration/models/__tests__/models.getters.spec.ts +19 -0
- package/src/configuration/models/index.ts +1 -0
- package/src/configuration/models/models.types.ts +13 -0
- package/src/talkpilot/clients/clients.getters.ts +0 -3
- package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +1 -249
- package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +0 -64
- package/dist/configuration/models/models.seed.d.ts +0 -5
- package/dist/configuration/models/models.seed.d.ts.map +0 -1
- package/dist/configuration/models/models.seed.js +0 -16
- package/dist/configuration/models/models.seed.js.map +0 -1
- package/dist/configuration/models/realtimeUiFields.constants.d.ts +0 -4
- package/dist/configuration/models/realtimeUiFields.constants.d.ts.map +0 -1
- package/dist/configuration/models/realtimeUiFields.constants.js +0 -80
- package/dist/configuration/models/realtimeUiFields.constants.js.map +0 -1
- package/dist/configuration/models/uiFields.types.d.ts +0 -29
- package/dist/configuration/models/uiFields.types.d.ts.map +0 -1
- package/dist/configuration/models/uiFields.types.js +0 -12
- package/dist/configuration/models/uiFields.types.js.map +0 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.utils.d.ts +0 -6
- package/dist/talkpilot/phone_numbers/phone_numbers.utils.d.ts.map +0 -1
- package/dist/talkpilot/phone_numbers/phone_numbers.utils.js +0 -11
- package/dist/talkpilot/phone_numbers/phone_numbers.utils.js.map +0 -1
- package/src/talkpilot/phone_numbers/phone_numbers.utils.ts +0 -9
package/README.md
CHANGED
|
@@ -178,7 +178,7 @@ Refer to `DEVELOPMENT.md` for the full walkthrough, token instructions, and fact
|
|
|
178
178
|
| 1.3.47 | Added optional `accountOwnerEmail` field to `WebsiteTalkProduct` (CP-1715): the recipient for the end-of-call summary email, set once from the client's login email and editable in Settings. |
|
|
179
179
|
| 1.3.48 | Fixed `getScanPages` search (CP-1726): user search input was passed unescaped into MongoDB's `$regex`, so a URL/title containing regex-special characters (e.g. `?`) failed to match even when the document existed. Added `escapeRegex()` and applied it before building the `url`/`title` `$regex` filter. No API changes. |
|
|
180
180
|
| 1.3.49 | Internal tools configuration on flows (CP-1723): `Flow.internalTools` keyed by tool name (`enabled`, optional `maxCalls`, per-parameter `description`/`value` overrides) with matching `$jsonSchema` validator, plus `createFlow` / `updateFlowById` mutators and the `FlowUpdateParams` type so consumers stop writing to the `flows` collection directly. |
|
|
181
|
-
| 1.3.
|
|
181
|
+
| 1.3.59 | Optional `uiFields` (`include` / `exclude` catalog paths) on `RealtimeModelDoc` so the flow editor can show provider fields per model. |
|
|
182
182
|
|
|
183
183
|
### 1.1.9
|
|
184
184
|
|
|
@@ -767,26 +767,6 @@ No — purely additive.
|
|
|
767
767
|
|
|
768
768
|
No API changes. **WTIS** (the only current consumer of `getScanPages`) should upgrade to 1.3.48 or later to pick up the fix.
|
|
769
769
|
|
|
770
|
-
### 1.3.57 — Phone-number bind getters
|
|
771
|
-
|
|
772
|
-
TalkPilot can bind any owned number to a flow without querying Mongo in the service layer. `flow_id` is matched as ObjectId or as a leftover string.
|
|
773
|
-
|
|
774
|
-
**Added**
|
|
775
|
-
|
|
776
|
-
| Export | Purpose |
|
|
777
|
-
| --- | --- |
|
|
778
|
-
| `getClientByClientId(clientId)` | Fetch a client by `clientId`. |
|
|
779
|
-
| `findPhoneNumbersByClientId(clientId)` | All `phone_numbers` for a client. |
|
|
780
|
-
| `getOwnedPhoneNumber(clientId, phoneNumber)` | One number that belongs to the client, or `null`. |
|
|
781
|
-
| `getPhoneNumberByClientAndFlow(clientId, flowId)` | Number bound to that flow for that client. |
|
|
782
|
-
| `clearPhoneNumberFlow(clientId, phoneNumber)` | Unset `flow_id` on one number. |
|
|
783
|
-
| `assignExclusiveFlow(clientId, phoneNumber, flowId)` | Bind the number and clear the same flow on the client's other numbers. |
|
|
784
|
-
| `unbindFlowFromClientNumbers(clientId, flowId)` | Unset `flow_id` on every number of that client pointing at the flow. |
|
|
785
|
-
|
|
786
|
-
**Do I need to update my app?**
|
|
787
|
-
|
|
788
|
-
No — purely additive. **TalkPilot Server** should upgrade to **1.3.57** for multi-number bind/list.
|
|
789
|
-
|
|
790
770
|
## 🛠 CI/CD & deployment
|
|
791
771
|
|
|
792
772
|
- This package is consumed by Cloud Build-based services (TalkPilot Server, MIS, CIS) as a dependency when Docker images are built. Keep `dist/` in sync with your builds because the compiled artifact is what downstream services install.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { MODELS_COLLECTION, MODEL_CONFIG_DEFAULTS_CONTEXT_WINDOW, MODEL_TYPES, REALTIME_MODEL_PROVIDERS, STT_MODEL_PROVIDERS, } from "./models.constants";
|
|
2
2
|
export { getModelsCollection, findModels, getModelByModelId, getModelContextWindow, getModelsByProvider, getModelsByType, getAvailableModelsByType, } from "./models.getters";
|
|
3
|
-
export type { ModelType, RealtimeModelProvider, SttModelProvider, SemanticVad, ServerVad, TurnDetection, RealtimeModelDoc, SttModelDoc, ModelDoc, } from "./models.types";
|
|
3
|
+
export type { ModelType, RealtimeModelProvider, SttModelProvider, SemanticVad, ServerVad, TurnDetection, RealtimeModelDoc, SttModelDoc, ModelDoc, ModelUiFields, } from "./models.types";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,oCAAoC,EACpC,WAAW,EACX,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,oCAAoC,EACpC,WAAW,EACX,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,aAAa,GACd,MAAM,gBAAgB,CAAC"}
|
|
@@ -18,6 +18,13 @@ export type ServerVad = {
|
|
|
18
18
|
interrupt_response?: boolean;
|
|
19
19
|
};
|
|
20
20
|
export type TurnDetection = SemanticVad | ServerVad;
|
|
21
|
+
/** Which provider-catalog keys this realtime model should show in the flow editor. */
|
|
22
|
+
export type ModelUiFields = {
|
|
23
|
+
/** If set, only these catalog paths are shown. */
|
|
24
|
+
include?: string[];
|
|
25
|
+
/** Drop these catalog paths even if they would otherwise show. */
|
|
26
|
+
exclude?: string[];
|
|
27
|
+
};
|
|
21
28
|
type BaseModelDoc = {
|
|
22
29
|
_id: ObjectId;
|
|
23
30
|
/** Public identifier used by the provider, not to be confused with mongo id */
|
|
@@ -38,6 +45,8 @@ export type RealtimeModelDoc = BaseModelDoc & {
|
|
|
38
45
|
supportsText?: boolean;
|
|
39
46
|
vad?: TurnDetection;
|
|
40
47
|
};
|
|
48
|
+
/** Flow-editor field selection for this model. Missing means the full provider catalog. */
|
|
49
|
+
uiFields?: ModelUiFields;
|
|
41
50
|
};
|
|
42
51
|
/** STT engine/preset (openai-stt, google-stt, deepgram-stt/-flux, elevenlabs-scribe, gladia-stt). */
|
|
43
52
|
export type SttModelDoc = BaseModelDoc & {
|
|
@@ -62,6 +71,9 @@ export type SttModelDoc = BaseModelDoc & {
|
|
|
62
71
|
* budget) — shape varies per `provider`
|
|
63
72
|
* - `createdAt` / `updatedAt`
|
|
64
73
|
*
|
|
74
|
+
* Realtime-only:
|
|
75
|
+
* - `uiFields?` — `include` / `exclude` lists of provider-catalog paths for the flow editor
|
|
76
|
+
*
|
|
65
77
|
* Type-specific fields: see {@link RealtimeModelDoc}, {@link SttModelDoc}.
|
|
66
78
|
*/
|
|
67
79
|
export type ModelDoc = RealtimeModelDoc | SttModelDoc;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.types.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/models.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACrD,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CA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A+E;IAC/E,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,gGAAgG;AAChG,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG;IAC5C,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,CAAC,EAAE;QACT,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,GAAG,CAAC,EAAE,aAAa,CAAC;KACrB,CAAC;IACF,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,qGAAqG;AACrG,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG;IACvC,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE;QACT,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,QAAQ,GAAG,gBAAgB,GAAG,WAAW,CAAC"}
|
|
@@ -2,5 +2,4 @@ import { Client } from "../index";
|
|
|
2
2
|
import { Collection } from "mongodb";
|
|
3
3
|
export declare const getClientsCollection: () => Collection<Client>;
|
|
4
4
|
export declare const getClientByAPIKey: (apiKey: string) => Promise<Client | null>;
|
|
5
|
-
export declare const getClientByClientId: (clientId: string) => Promise<Client | null>;
|
|
6
5
|
//# sourceMappingURL=clients.getters.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clients.getters.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/clients/clients.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,oBAAoB,QAAO,UAAU,CAAC,MAAM,CAExD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,KACb,OAAO,CAAC,MAAM,GAAG,IAAI,CAMvB,CAAC
|
|
1
|
+
{"version":3,"file":"clients.getters.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/clients/clients.getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,oBAAoB,QAAO,UAAU,CAAC,MAAM,CAExD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,KACb,OAAO,CAAC,MAAM,GAAG,IAAI,CAMvB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getClientByAPIKey = exports.getClientsCollection = void 0;
|
|
4
4
|
const index_1 = require("../index");
|
|
5
5
|
const getClientsCollection = () => {
|
|
6
6
|
return (0, index_1.getDb)().collection("clients");
|
|
@@ -14,6 +14,4 @@ const getClientByAPIKey = async (apiKey) => {
|
|
|
14
14
|
return client ? client : null;
|
|
15
15
|
};
|
|
16
16
|
exports.getClientByAPIKey = getClientByAPIKey;
|
|
17
|
-
const getClientByClientId = (clientId) => (0, exports.getClientsCollection)().findOne({ clientId });
|
|
18
|
-
exports.getClientByClientId = getClientByClientId;
|
|
19
17
|
//# sourceMappingURL=clients.getters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clients.getters.js","sourceRoot":"","sources":["../../../src/talkpilot/clients/clients.getters.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAGlC,MAAM,oBAAoB,GAAG,GAAuB,EAAE;IAC3D,OAAO,IAAA,aAAK,GAAE,CAAC,UAAU,CAAS,SAAS,CAAC,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B;AAEK,MAAM,iBAAiB,GAAG,KAAK,EACpC,MAAc,EACU,EAAE;IAC1B,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAoB,GAAE,CAAC,OAAO,CAAC;QAClD,MAAM;QACN,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAChC,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B
|
|
1
|
+
{"version":3,"file":"clients.getters.js","sourceRoot":"","sources":["../../../src/talkpilot/clients/clients.getters.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAGlC,MAAM,oBAAoB,GAAG,GAAuB,EAAE;IAC3D,OAAO,IAAA,aAAK,GAAE,CAAC,UAAU,CAAS,SAAS,CAAC,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,oBAAoB,wBAE/B;AAEK,MAAM,iBAAiB,GAAG,KAAK,EACpC,MAAc,EACU,EAAE;IAC1B,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAoB,GAAE,CAAC,OAAO,CAAC;QAClD,MAAM;QACN,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AAChC,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
|
|
@@ -13,10 +13,4 @@ export declare const createPurchasedPhoneNumber: (phoneNumber: string, providerP
|
|
|
13
13
|
export declare const findClientByPhoneNumber: (phoneNumber: string) => Promise<Client>;
|
|
14
14
|
export declare const getPrimaryPhoneFlowId: (clientId: string) => Promise<string | null>;
|
|
15
15
|
export declare const bindClientPhoneToFlow: (clientId: string, flowId: string) => Promise<void>;
|
|
16
|
-
export declare const findPhoneNumbersByClientId: (clientId: string) => Promise<PhoneNumber[]>;
|
|
17
|
-
export declare const getOwnedPhoneNumber: (clientId: string, phoneNumber: string) => Promise<PhoneNumber | null>;
|
|
18
|
-
export declare const getPhoneNumberByClientAndFlow: (clientId: string, flowId: string) => Promise<PhoneNumber | null>;
|
|
19
|
-
export declare const clearPhoneNumberFlow: (clientId: string, phoneNumber: string) => Promise<void>;
|
|
20
|
-
export declare const assignExclusiveFlow: (clientId: string, phoneNumber: string, flowId: string) => Promise<void>;
|
|
21
|
-
export declare const unbindFlowFromClientNumbers: (clientId: string, flowId: string) => Promise<void>;
|
|
22
16
|
//# sourceMappingURL=phone_numbers.getter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_numbers.getter.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/phone_numbers/phone_numbers.getter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EACL,MAAM,EAMP,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,wBAAwB,EACxB,WAAW,EACX,mBAAmB,EACnB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"phone_numbers.getter.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/phone_numbers/phone_numbers.getter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EACL,MAAM,EAMP,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,wBAAwB,EACxB,WAAW,EACX,mBAAmB,EACnB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,yBAAyB,QAAO,UAAU,CAAC,WAAW,CACjB,CAAC;AAEnD,eAAO,MAAM,yBAAyB,GACpC,aAAa,MAAM,KAClB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAwBpC,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,UAAU,MAAM,KACf,OAAO,CAAC,MAAM,GAAG,IAAI,CASvB,CAAC;AAEF,eAAO,MAAM,oBAAoB,aAZrB,MAAM,KACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAWuC,CAAC;AAEhE,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,EAChB,YAAY,OAAO,KAClB,OAAO,CAAC,WAAW,GAAG,IAAI,CAK5B,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,UAAU,MAAM,KACf,OAAO,CAAC,wBAAwB,EAAE,CAepC,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,aAAa,MAAM,EACnB,QAAQ,MAAM,EACd,UAAU,MAAM,KACf,OAAO,CAAC,WAAW,CAerB,CAAC;AAEF,yFAAyF;AACzF,eAAO,MAAM,0BAA0B,GACrC,aAAa,MAAM,EACnB,iBAAiB,6BAA6B,EAC9C,UAAU,MAAM,EAChB,SAAS,MAAM,GAAG,IAAI,KACrB,OAAO,CAAC,WAAW,CA0BrB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,aAAa,MAAM,KAClB,OAAO,CAAC,MAAM,CAShB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAGnF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,UAAU,MAAM,EAChB,QAAQ,MAAM,KACb,OAAO,CAAC,IAAI,CAQd,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.bindClientPhoneToFlow = exports.getPrimaryPhoneFlowId = exports.findClientByPhoneNumber = exports.createPurchasedPhoneNumber = exports.createPhoneNumberEntity = exports.getPhoneNumbersForFlows = exports.getClientPhoneData = exports.getClientPhoneNumber = exports.getClientPrimaryPhoneNumber = exports.getPhoneDataByPhoneNumber = exports.getPhoneNumbersCollection = void 0;
|
|
4
4
|
const index_1 = require("../index");
|
|
5
|
-
const phone_numbers_utils_1 = require("./phone_numbers.utils");
|
|
6
5
|
const getPhoneNumbersCollection = () => (0, index_1.getDb)().collection("phone_numbers");
|
|
7
6
|
exports.getPhoneNumbersCollection = getPhoneNumbersCollection;
|
|
8
7
|
const getPhoneDataByPhoneNumber = async (phoneNumber) => {
|
|
@@ -126,34 +125,4 @@ const bindClientPhoneToFlow = async (clientId, flowId) => {
|
|
|
126
125
|
}
|
|
127
126
|
};
|
|
128
127
|
exports.bindClientPhoneToFlow = bindClientPhoneToFlow;
|
|
129
|
-
const findPhoneNumbersByClientId = (clientId) => (0, exports.getPhoneNumbersCollection)().find({ client_id: clientId }).toArray();
|
|
130
|
-
exports.findPhoneNumbersByClientId = findPhoneNumbersByClientId;
|
|
131
|
-
const getOwnedPhoneNumber = (clientId, phoneNumber) => (0, exports.getPhoneNumbersCollection)().findOne({
|
|
132
|
-
client_id: clientId,
|
|
133
|
-
phone_number: phoneNumber,
|
|
134
|
-
});
|
|
135
|
-
exports.getOwnedPhoneNumber = getOwnedPhoneNumber;
|
|
136
|
-
const getPhoneNumberByClientAndFlow = (clientId, flowId) => (0, exports.getPhoneNumbersCollection)().findOne({
|
|
137
|
-
client_id: clientId,
|
|
138
|
-
$or: (0, phone_numbers_utils_1.flowIdAsObjectIdOrString)(flowId),
|
|
139
|
-
});
|
|
140
|
-
exports.getPhoneNumberByClientAndFlow = getPhoneNumberByClientAndFlow;
|
|
141
|
-
const clearPhoneNumberFlow = async (clientId, phoneNumber) => {
|
|
142
|
-
await (0, exports.getPhoneNumbersCollection)().updateOne({ client_id: clientId, phone_number: phoneNumber }, { $unset: { flow_id: "" }, $set: { updatedAt: new Date() } });
|
|
143
|
-
};
|
|
144
|
-
exports.clearPhoneNumberFlow = clearPhoneNumberFlow;
|
|
145
|
-
const assignExclusiveFlow = async (clientId, phoneNumber, flowId) => {
|
|
146
|
-
const collection = (0, exports.getPhoneNumbersCollection)();
|
|
147
|
-
await collection.updateMany({
|
|
148
|
-
client_id: clientId,
|
|
149
|
-
phone_number: { $ne: phoneNumber },
|
|
150
|
-
$or: (0, phone_numbers_utils_1.flowIdAsObjectIdOrString)(flowId),
|
|
151
|
-
}, { $unset: { flow_id: "" }, $set: { updatedAt: new Date() } });
|
|
152
|
-
await collection.updateOne({ client_id: clientId, phone_number: phoneNumber }, { $set: { flow_id: new index_1.ObjectId(flowId), updatedAt: new Date() } });
|
|
153
|
-
};
|
|
154
|
-
exports.assignExclusiveFlow = assignExclusiveFlow;
|
|
155
|
-
const unbindFlowFromClientNumbers = async (clientId, flowId) => {
|
|
156
|
-
await (0, exports.getPhoneNumbersCollection)().updateMany({ client_id: clientId, $or: (0, phone_numbers_utils_1.flowIdAsObjectIdOrString)(flowId) }, { $unset: { flow_id: "" }, $set: { updatedAt: new Date() } });
|
|
157
|
-
};
|
|
158
|
-
exports.unbindFlowFromClientNumbers = unbindFlowFromClientNumbers;
|
|
159
128
|
//# sourceMappingURL=phone_numbers.getter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone_numbers.getter.js","sourceRoot":"","sources":["../../../src/talkpilot/phone_numbers/phone_numbers.getter.ts"],"names":[],"mappings":";;;AACA,oCAOkB;
|
|
1
|
+
{"version":3,"file":"phone_numbers.getter.js","sourceRoot":"","sources":["../../../src/talkpilot/phone_numbers/phone_numbers.getter.ts"],"names":[],"mappings":";;;AACA,oCAOkB;AAQX,MAAM,yBAAyB,GAAG,GAA4B,EAAE,CACrE,IAAA,aAAK,GAAE,CAAC,UAAU,CAAc,eAAe,CAAC,CAAC;AADtC,QAAA,yBAAyB,6BACa;AAE5C,MAAM,yBAAyB,GAAG,KAAK,EAC5C,WAAmB,EACkB,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B,GAAE,CAAC,SAAS,CACxD,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,EACzC,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,gBAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,EAAE,CACnE,CAAC;IACF,IAAI,MAAM,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,6CAA6C,QAAQ,EAAE,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,qBAAqB,yBAWhC"}
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import { MODELS_COLLECTION } from "../models.constants";
|
|
|
3
3
|
import {
|
|
4
4
|
getModelsCollection,
|
|
5
5
|
getModelContextWindow,
|
|
6
|
+
getModelByModelId,
|
|
6
7
|
} from "../models.getters";
|
|
7
8
|
import type { RealtimeModelDoc } from "../models.types";
|
|
8
9
|
|
|
@@ -65,3 +66,21 @@ describe("models collection", () => {
|
|
|
65
66
|
expect(getModelsCollection().collectionName).toBe(MODELS_COLLECTION);
|
|
66
67
|
});
|
|
67
68
|
});
|
|
69
|
+
|
|
70
|
+
describe("RealtimeModelDoc.uiFields", () => {
|
|
71
|
+
it("round-trips include and exclude through getModelByModelId", async () => {
|
|
72
|
+
await getModelsCollection().insertOne(
|
|
73
|
+
realtimeModel({
|
|
74
|
+
modelId: "gemini-live",
|
|
75
|
+
provider: "gemini",
|
|
76
|
+
uiFields: { include: ["thinkingLevel"], exclude: ["speed"] },
|
|
77
|
+
}),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const doc = await getModelByModelId("gemini-live");
|
|
81
|
+
expect(doc && "uiFields" in doc ? doc.uiFields : undefined).toEqual({
|
|
82
|
+
include: ["thinkingLevel"],
|
|
83
|
+
exclude: ["speed"],
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
@@ -28,6 +28,14 @@ export type ServerVad = {
|
|
|
28
28
|
|
|
29
29
|
export type TurnDetection = SemanticVad | ServerVad;
|
|
30
30
|
|
|
31
|
+
/** Which provider-catalog keys this realtime model should show in the flow editor. */
|
|
32
|
+
export type ModelUiFields = {
|
|
33
|
+
/** If set, only these catalog paths are shown. */
|
|
34
|
+
include?: string[];
|
|
35
|
+
/** Drop these catalog paths even if they would otherwise show. */
|
|
36
|
+
exclude?: string[];
|
|
37
|
+
};
|
|
38
|
+
|
|
31
39
|
type BaseModelDoc = {
|
|
32
40
|
_id: ObjectId;
|
|
33
41
|
/** Public identifier used by the provider, not to be confused with mongo id */
|
|
@@ -49,6 +57,8 @@ export type RealtimeModelDoc = BaseModelDoc & {
|
|
|
49
57
|
supportsText?: boolean;
|
|
50
58
|
vad?: TurnDetection;
|
|
51
59
|
};
|
|
60
|
+
/** Flow-editor field selection for this model. Missing means the full provider catalog. */
|
|
61
|
+
uiFields?: ModelUiFields;
|
|
52
62
|
};
|
|
53
63
|
|
|
54
64
|
/** STT engine/preset (openai-stt, google-stt, deepgram-stt/-flux, elevenlabs-scribe, gladia-stt). */
|
|
@@ -75,6 +85,9 @@ export type SttModelDoc = BaseModelDoc & {
|
|
|
75
85
|
* budget) — shape varies per `provider`
|
|
76
86
|
* - `createdAt` / `updatedAt`
|
|
77
87
|
*
|
|
88
|
+
* Realtime-only:
|
|
89
|
+
* - `uiFields?` — `include` / `exclude` lists of provider-catalog paths for the flow editor
|
|
90
|
+
*
|
|
78
91
|
* Type-specific fields: see {@link RealtimeModelDoc}, {@link SttModelDoc}.
|
|
79
92
|
*/
|
|
80
93
|
export type ModelDoc = RealtimeModelDoc | SttModelDoc;
|
|
@@ -7,12 +7,6 @@ import {
|
|
|
7
7
|
createPhoneNumberEntity,
|
|
8
8
|
createPurchasedPhoneNumber,
|
|
9
9
|
getPrimaryPhoneFlowId,
|
|
10
|
-
findPhoneNumbersByClientId,
|
|
11
|
-
getOwnedPhoneNumber,
|
|
12
|
-
getPhoneNumberByClientAndFlow,
|
|
13
|
-
clearPhoneNumberFlow,
|
|
14
|
-
assignExclusiveFlow,
|
|
15
|
-
unbindFlowFromClientNumbers,
|
|
16
10
|
} from "../phone_numbers.getter";
|
|
17
11
|
import { getFlowsCollection } from "../../flows/flows.getter";
|
|
18
12
|
import { createFlow, createPhoneNumber } from "../../../test-utils/factories";
|
|
@@ -278,253 +272,11 @@ describe("db.phoneNumbers", () => {
|
|
|
278
272
|
|
|
279
273
|
it("returns null when primary phone has no flow_id", async () => {
|
|
280
274
|
const clientId = "phoneNoFlow";
|
|
281
|
-
const phone = createPhoneNumber({
|
|
282
|
-
client_id: clientId,
|
|
283
|
-
is_primary: true,
|
|
284
|
-
});
|
|
275
|
+
const phone = createPhoneNumber({ client_id: clientId, is_primary: true });
|
|
285
276
|
delete phone.flow_id;
|
|
286
277
|
await getPhoneNumbersCollection().insertOne(phone);
|
|
287
278
|
|
|
288
279
|
expect(await getPrimaryPhoneFlowId(clientId)).toBeNull();
|
|
289
280
|
});
|
|
290
281
|
});
|
|
291
|
-
|
|
292
|
-
describe("findPhoneNumbersByClientId", () => {
|
|
293
|
-
it("returns only that client's numbers", async () => {
|
|
294
|
-
const clientId = "list-client";
|
|
295
|
-
await getPhoneNumbersCollection().insertMany([
|
|
296
|
-
createPhoneNumber({ client_id: clientId, phone_number: "+100" }),
|
|
297
|
-
createPhoneNumber({ client_id: clientId, phone_number: "+200" }),
|
|
298
|
-
createPhoneNumber({
|
|
299
|
-
client_id: "other-list-client",
|
|
300
|
-
phone_number: "+300",
|
|
301
|
-
}),
|
|
302
|
-
]);
|
|
303
|
-
|
|
304
|
-
const docs = await findPhoneNumbersByClientId(clientId);
|
|
305
|
-
expect(docs.map((doc) => doc.phone_number).sort()).toEqual([
|
|
306
|
-
"+100",
|
|
307
|
-
"+200",
|
|
308
|
-
]);
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
describe("getOwnedPhoneNumber", () => {
|
|
313
|
-
it("returns the number when it belongs to the client", async () => {
|
|
314
|
-
await getPhoneNumbersCollection().insertOne(
|
|
315
|
-
createPhoneNumber({
|
|
316
|
-
client_id: "owned-client",
|
|
317
|
-
phone_number: "+111",
|
|
318
|
-
}),
|
|
319
|
-
);
|
|
320
|
-
|
|
321
|
-
const doc = await getOwnedPhoneNumber("owned-client", "+111");
|
|
322
|
-
expect(doc?.phone_number).toBe("+111");
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
it("returns null when the number belongs to another client", async () => {
|
|
326
|
-
await getPhoneNumbersCollection().insertOne(
|
|
327
|
-
createPhoneNumber({
|
|
328
|
-
client_id: "owned-other",
|
|
329
|
-
phone_number: "+111",
|
|
330
|
-
}),
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
expect(await getOwnedPhoneNumber("owned-client", "+111")).toBeNull();
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
describe("getPhoneNumberByClientAndFlow", () => {
|
|
338
|
-
it("finds a number bound with ObjectId flow_id", async () => {
|
|
339
|
-
const clientId = "flow-oid-client";
|
|
340
|
-
const flowId = new ObjectId();
|
|
341
|
-
await getPhoneNumbersCollection().insertOne(
|
|
342
|
-
createPhoneNumber({
|
|
343
|
-
client_id: clientId,
|
|
344
|
-
phone_number: "+oid",
|
|
345
|
-
flow_id: flowId,
|
|
346
|
-
}),
|
|
347
|
-
);
|
|
348
|
-
|
|
349
|
-
expect(
|
|
350
|
-
(await getPhoneNumberByClientAndFlow(clientId, flowId.toHexString()))
|
|
351
|
-
?.phone_number,
|
|
352
|
-
).toBe("+oid");
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
it("finds a number bound with string-stored flow_id", async () => {
|
|
356
|
-
const clientId = "flow-str-client";
|
|
357
|
-
const flowId = new ObjectId();
|
|
358
|
-
const doc = createPhoneNumber({
|
|
359
|
-
client_id: clientId,
|
|
360
|
-
phone_number: "+str",
|
|
361
|
-
});
|
|
362
|
-
delete doc.flow_id;
|
|
363
|
-
await getPhoneNumbersCollection().insertOne({
|
|
364
|
-
...doc,
|
|
365
|
-
flow_id: flowId.toHexString() as unknown as ObjectId,
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
expect(
|
|
369
|
-
(await getPhoneNumberByClientAndFlow(clientId, flowId.toHexString()))
|
|
370
|
-
?.phone_number,
|
|
371
|
-
).toBe("+str");
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
it("returns null for another client's bind", async () => {
|
|
375
|
-
const flowId = new ObjectId();
|
|
376
|
-
await getPhoneNumbersCollection().insertOne(
|
|
377
|
-
createPhoneNumber({
|
|
378
|
-
client_id: "flow-other-client",
|
|
379
|
-
flow_id: flowId,
|
|
380
|
-
}),
|
|
381
|
-
);
|
|
382
|
-
|
|
383
|
-
expect(
|
|
384
|
-
await getPhoneNumberByClientAndFlow(
|
|
385
|
-
"flow-lookup-client",
|
|
386
|
-
flowId.toHexString(),
|
|
387
|
-
),
|
|
388
|
-
).toBeNull();
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
describe("assignExclusiveFlow", () => {
|
|
393
|
-
it("binds the number and unsets the same client's previous bind", async () => {
|
|
394
|
-
const clientId = "exclusive-client";
|
|
395
|
-
const flowId = new ObjectId();
|
|
396
|
-
await getPhoneNumbersCollection().insertMany([
|
|
397
|
-
createPhoneNumber({
|
|
398
|
-
client_id: clientId,
|
|
399
|
-
phone_number: "+old",
|
|
400
|
-
flow_id: flowId,
|
|
401
|
-
}),
|
|
402
|
-
createPhoneNumber({
|
|
403
|
-
client_id: clientId,
|
|
404
|
-
phone_number: "+new",
|
|
405
|
-
}),
|
|
406
|
-
createPhoneNumber({
|
|
407
|
-
client_id: "exclusive-other",
|
|
408
|
-
phone_number: "+other",
|
|
409
|
-
flow_id: flowId,
|
|
410
|
-
}),
|
|
411
|
-
]);
|
|
412
|
-
|
|
413
|
-
await assignExclusiveFlow(clientId, "+new", flowId.toHexString());
|
|
414
|
-
|
|
415
|
-
const [oldDoc, newDoc, otherDoc] = await Promise.all([
|
|
416
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+old" }),
|
|
417
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+new" }),
|
|
418
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+other" }),
|
|
419
|
-
]);
|
|
420
|
-
expect(oldDoc?.flow_id).toBeUndefined();
|
|
421
|
-
expect(newDoc?.flow_id?.toString()).toBe(flowId.toHexString());
|
|
422
|
-
expect(otherDoc?.flow_id?.toString()).toBe(flowId.toHexString());
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
it("steals when the previous bind stored flow_id as a string", async () => {
|
|
426
|
-
const clientId = "exclusive-string-client";
|
|
427
|
-
const flowId = new ObjectId();
|
|
428
|
-
const previous = createPhoneNumber({
|
|
429
|
-
client_id: clientId,
|
|
430
|
-
phone_number: "+old-str",
|
|
431
|
-
});
|
|
432
|
-
delete previous.flow_id;
|
|
433
|
-
await getPhoneNumbersCollection().insertMany([
|
|
434
|
-
{
|
|
435
|
-
...previous,
|
|
436
|
-
flow_id: flowId.toHexString() as unknown as ObjectId,
|
|
437
|
-
},
|
|
438
|
-
createPhoneNumber({
|
|
439
|
-
client_id: clientId,
|
|
440
|
-
phone_number: "+new-str",
|
|
441
|
-
}),
|
|
442
|
-
]);
|
|
443
|
-
|
|
444
|
-
await assignExclusiveFlow(clientId, "+new-str", flowId.toHexString());
|
|
445
|
-
|
|
446
|
-
const [oldDoc, newDoc] = await Promise.all([
|
|
447
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+old-str" }),
|
|
448
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+new-str" }),
|
|
449
|
-
]);
|
|
450
|
-
expect(oldDoc?.flow_id).toBeUndefined();
|
|
451
|
-
expect(newDoc?.flow_id?.toString()).toBe(flowId.toHexString());
|
|
452
|
-
});
|
|
453
|
-
});
|
|
454
|
-
|
|
455
|
-
describe("clearPhoneNumberFlow", () => {
|
|
456
|
-
it("unsets flow_id on that number only", async () => {
|
|
457
|
-
const clientId = "clear-client";
|
|
458
|
-
const flowA = new ObjectId();
|
|
459
|
-
const flowB = new ObjectId();
|
|
460
|
-
await getPhoneNumbersCollection().insertMany([
|
|
461
|
-
createPhoneNumber({
|
|
462
|
-
client_id: clientId,
|
|
463
|
-
phone_number: "+a",
|
|
464
|
-
flow_id: flowA,
|
|
465
|
-
}),
|
|
466
|
-
createPhoneNumber({
|
|
467
|
-
client_id: clientId,
|
|
468
|
-
phone_number: "+b",
|
|
469
|
-
flow_id: flowB,
|
|
470
|
-
}),
|
|
471
|
-
]);
|
|
472
|
-
|
|
473
|
-
await clearPhoneNumberFlow(clientId, "+a");
|
|
474
|
-
|
|
475
|
-
const [a, b] = await Promise.all([
|
|
476
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+a" }),
|
|
477
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+b" }),
|
|
478
|
-
]);
|
|
479
|
-
expect(a?.flow_id).toBeUndefined();
|
|
480
|
-
expect(b?.flow_id?.toString()).toBe(flowB.toHexString());
|
|
481
|
-
});
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
describe("unbindFlowFromClientNumbers", () => {
|
|
485
|
-
it("clears ObjectId and string-stored flow_id for that client only", async () => {
|
|
486
|
-
const clientId = "unbind-client";
|
|
487
|
-
const flowId = new ObjectId();
|
|
488
|
-
const otherFlowId = new ObjectId();
|
|
489
|
-
const stringDoc = createPhoneNumber({
|
|
490
|
-
client_id: clientId,
|
|
491
|
-
phone_number: "+str-unbind",
|
|
492
|
-
});
|
|
493
|
-
delete stringDoc.flow_id;
|
|
494
|
-
await getPhoneNumbersCollection().insertMany([
|
|
495
|
-
createPhoneNumber({
|
|
496
|
-
client_id: clientId,
|
|
497
|
-
phone_number: "+oid-unbind",
|
|
498
|
-
flow_id: flowId,
|
|
499
|
-
}),
|
|
500
|
-
{
|
|
501
|
-
...stringDoc,
|
|
502
|
-
flow_id: flowId.toHexString() as unknown as ObjectId,
|
|
503
|
-
},
|
|
504
|
-
createPhoneNumber({
|
|
505
|
-
client_id: clientId,
|
|
506
|
-
phone_number: "+keep",
|
|
507
|
-
flow_id: otherFlowId,
|
|
508
|
-
}),
|
|
509
|
-
createPhoneNumber({
|
|
510
|
-
client_id: "unbind-other",
|
|
511
|
-
phone_number: "+other-keep",
|
|
512
|
-
flow_id: flowId,
|
|
513
|
-
}),
|
|
514
|
-
]);
|
|
515
|
-
|
|
516
|
-
await unbindFlowFromClientNumbers(clientId, flowId.toHexString());
|
|
517
|
-
|
|
518
|
-
const [oidDoc, strDoc, keep, other] = await Promise.all([
|
|
519
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+oid-unbind" }),
|
|
520
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+str-unbind" }),
|
|
521
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+keep" }),
|
|
522
|
-
getPhoneNumbersCollection().findOne({ phone_number: "+other-keep" }),
|
|
523
|
-
]);
|
|
524
|
-
expect(oidDoc?.flow_id).toBeUndefined();
|
|
525
|
-
expect(strDoc?.flow_id).toBeUndefined();
|
|
526
|
-
expect(keep?.flow_id?.toString()).toBe(otherFlowId.toHexString());
|
|
527
|
-
expect(other?.flow_id?.toString()).toBe(flowId.toHexString());
|
|
528
|
-
});
|
|
529
|
-
});
|
|
530
282
|
});
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
PhoneNumberWithFlow,
|
|
14
14
|
PurchasedPhoneProviderPayload,
|
|
15
15
|
} from "./phone_numbers.types";
|
|
16
|
-
import { flowIdAsObjectIdOrString } from "./phone_numbers.utils";
|
|
17
16
|
|
|
18
17
|
export const getPhoneNumbersCollection = (): Collection<PhoneNumber> =>
|
|
19
18
|
getDb().collection<PhoneNumber>("phone_numbers");
|
|
@@ -175,66 +174,3 @@ export const bindClientPhoneToFlow = async (
|
|
|
175
174
|
throw new Error(`No primary phone number found for client: ${clientId}`);
|
|
176
175
|
}
|
|
177
176
|
};
|
|
178
|
-
|
|
179
|
-
export const findPhoneNumbersByClientId = (
|
|
180
|
-
clientId: string,
|
|
181
|
-
): Promise<PhoneNumber[]> =>
|
|
182
|
-
getPhoneNumbersCollection().find({ client_id: clientId }).toArray();
|
|
183
|
-
|
|
184
|
-
export const getOwnedPhoneNumber = (
|
|
185
|
-
clientId: string,
|
|
186
|
-
phoneNumber: string,
|
|
187
|
-
): Promise<PhoneNumber | null> =>
|
|
188
|
-
getPhoneNumbersCollection().findOne({
|
|
189
|
-
client_id: clientId,
|
|
190
|
-
phone_number: phoneNumber,
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
export const getPhoneNumberByClientAndFlow = (
|
|
194
|
-
clientId: string,
|
|
195
|
-
flowId: string,
|
|
196
|
-
): Promise<PhoneNumber | null> =>
|
|
197
|
-
getPhoneNumbersCollection().findOne({
|
|
198
|
-
client_id: clientId,
|
|
199
|
-
$or: flowIdAsObjectIdOrString(flowId),
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
export const clearPhoneNumberFlow = async (
|
|
203
|
-
clientId: string,
|
|
204
|
-
phoneNumber: string,
|
|
205
|
-
): Promise<void> => {
|
|
206
|
-
await getPhoneNumbersCollection().updateOne(
|
|
207
|
-
{ client_id: clientId, phone_number: phoneNumber },
|
|
208
|
-
{ $unset: { flow_id: "" }, $set: { updatedAt: new Date() } },
|
|
209
|
-
);
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export const assignExclusiveFlow = async (
|
|
213
|
-
clientId: string,
|
|
214
|
-
phoneNumber: string,
|
|
215
|
-
flowId: string,
|
|
216
|
-
): Promise<void> => {
|
|
217
|
-
const collection = getPhoneNumbersCollection();
|
|
218
|
-
await collection.updateMany(
|
|
219
|
-
{
|
|
220
|
-
client_id: clientId,
|
|
221
|
-
phone_number: { $ne: phoneNumber },
|
|
222
|
-
$or: flowIdAsObjectIdOrString(flowId),
|
|
223
|
-
},
|
|
224
|
-
{ $unset: { flow_id: "" }, $set: { updatedAt: new Date() } },
|
|
225
|
-
);
|
|
226
|
-
await collection.updateOne(
|
|
227
|
-
{ client_id: clientId, phone_number: phoneNumber },
|
|
228
|
-
{ $set: { flow_id: new ObjectId(flowId), updatedAt: new Date() } },
|
|
229
|
-
);
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export const unbindFlowFromClientNumbers = async (
|
|
233
|
-
clientId: string,
|
|
234
|
-
flowId: string,
|
|
235
|
-
): Promise<void> => {
|
|
236
|
-
await getPhoneNumbersCollection().updateMany(
|
|
237
|
-
{ client_id: clientId, $or: flowIdAsObjectIdOrString(flowId) },
|
|
238
|
-
{ $unset: { flow_id: "" }, $set: { updatedAt: new Date() } },
|
|
239
|
-
);
|
|
240
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.seed.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/models.seed.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC;IACpD,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB,CAcA,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.seedRealtimeUiFields = void 0;
|
|
4
|
-
const models_getters_1 = require("./models.getters");
|
|
5
|
-
const realtimeUiFields_constants_1 = require("./realtimeUiFields.constants");
|
|
6
|
-
const seedRealtimeUiFields = async () => {
|
|
7
|
-
const now = new Date();
|
|
8
|
-
const openai = await (0, models_getters_1.getModelsCollection)().updateMany({ type: "realtime", provider: "openai" }, { $set: { uiFields: realtimeUiFields_constants_1.OPENAI_REALTIME_UI_FIELDS, updatedAt: now } });
|
|
9
|
-
const gemini = await (0, models_getters_1.getModelsCollection)().updateMany({ type: "realtime", provider: "gemini" }, { $set: { uiFields: realtimeUiFields_constants_1.GEMINI_REALTIME_UI_FIELDS, updatedAt: now } });
|
|
10
|
-
return {
|
|
11
|
-
openaiMatched: openai.matchedCount,
|
|
12
|
-
geminiMatched: gemini.matchedCount,
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
exports.seedRealtimeUiFields = seedRealtimeUiFields;
|
|
16
|
-
//# sourceMappingURL=models.seed.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.seed.js","sourceRoot":"","sources":["../../../src/configuration/models/models.seed.ts"],"names":[],"mappings":";;;AAEA,qDAAuD;AAEvD,6EAGsC;AAE/B,MAAM,oBAAoB,GAAG,KAAK,IAGtC,EAAE;IACH,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,MAAM,IAAA,oCAAmB,GAAE,CAAC,UAAU,CACnD,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAsB,EAC5D,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,sDAAyB,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,CAClE,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,IAAA,oCAAmB,GAAE,CAAC,UAAU,CACnD,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAsB,EAC5D,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,sDAAyB,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,CAClE,CAAC;IACF,OAAO;QACL,aAAa,EAAE,MAAM,CAAC,YAAY;QAClC,aAAa,EAAE,MAAM,CAAC,YAAY;KACnC,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,oBAAoB,wBAiB/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"realtimeUiFields.constants.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/realtimeUiFields.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AA0B3C,eAAO,MAAM,yBAAyB,EAAE,OAAO,EAyC9C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,OAAO,EAW9C,CAAC"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GEMINI_REALTIME_UI_FIELDS = exports.OPENAI_REALTIME_UI_FIELDS = void 0;
|
|
4
|
-
const DEFAULT_SERVER_VAD = {
|
|
5
|
-
type: "server_vad",
|
|
6
|
-
threshold: 0.7,
|
|
7
|
-
silence_duration_ms: 600,
|
|
8
|
-
prefix_padding_ms: 300,
|
|
9
|
-
};
|
|
10
|
-
const SHARED_REALTIME_UI_FIELDS = [
|
|
11
|
-
{
|
|
12
|
-
key: "disableInterrupt",
|
|
13
|
-
type: "switch",
|
|
14
|
-
label: "אפשר לקטוע את הבוט בזמן שהוא מדבר",
|
|
15
|
-
default: false,
|
|
16
|
-
invert: true,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
key: "ignoreUserAudioUntilFirstTurnDone",
|
|
20
|
-
type: "switch",
|
|
21
|
-
label: "התעלמות מדיבור המשתמש עד לסיום משפט הפתיחה של הבוט",
|
|
22
|
-
default: true,
|
|
23
|
-
visibleWhen: { key: "disableInterrupt", equals: false },
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
exports.OPENAI_REALTIME_UI_FIELDS = [
|
|
27
|
-
{
|
|
28
|
-
key: "reasoningEffort",
|
|
29
|
-
type: "select",
|
|
30
|
-
label: "רמת חשיבה (Reasoning)",
|
|
31
|
-
default: "",
|
|
32
|
-
options: [
|
|
33
|
-
{ value: "", label: "none" },
|
|
34
|
-
{ value: "minimal", label: "Minimal (לטנציה נמוכה)" },
|
|
35
|
-
{ value: "low", label: "Low (מומלץ)" },
|
|
36
|
-
{ value: "medium", label: "Medium" },
|
|
37
|
-
{ value: "high", label: "High" },
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
key: "speed",
|
|
42
|
-
type: "slider",
|
|
43
|
-
label: "מהירות דיבור",
|
|
44
|
-
default: 0.375,
|
|
45
|
-
min: 0,
|
|
46
|
-
max: 1,
|
|
47
|
-
step: 0.01,
|
|
48
|
-
marks: [
|
|
49
|
-
{ value: 0, label: "איטי" },
|
|
50
|
-
{ value: 1, label: "מהיר" },
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
key: "enableUserAudioBuckets",
|
|
55
|
-
type: "checkbox",
|
|
56
|
-
label: "שמירת אודיו של המשתמש במאגר",
|
|
57
|
-
default: false,
|
|
58
|
-
},
|
|
59
|
-
...SHARED_REALTIME_UI_FIELDS,
|
|
60
|
-
{
|
|
61
|
-
key: "turn_detection",
|
|
62
|
-
type: "turnDetection",
|
|
63
|
-
label: "הגדרות",
|
|
64
|
-
default: DEFAULT_SERVER_VAD,
|
|
65
|
-
visibleWhen: { key: "disableInterrupt", equals: false },
|
|
66
|
-
},
|
|
67
|
-
];
|
|
68
|
-
exports.GEMINI_REALTIME_UI_FIELDS = [
|
|
69
|
-
{
|
|
70
|
-
key: "temperature",
|
|
71
|
-
type: "number",
|
|
72
|
-
label: "Temperature",
|
|
73
|
-
default: 0.7,
|
|
74
|
-
min: 0,
|
|
75
|
-
max: 2,
|
|
76
|
-
step: 0.1,
|
|
77
|
-
},
|
|
78
|
-
...SHARED_REALTIME_UI_FIELDS,
|
|
79
|
-
];
|
|
80
|
-
//# sourceMappingURL=realtimeUiFields.constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"realtimeUiFields.constants.js","sourceRoot":"","sources":["../../../src/configuration/models/realtimeUiFields.constants.ts"],"names":[],"mappings":";;;AAEA,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,YAAY;IAClB,SAAS,EAAE,GAAG;IACd,mBAAmB,EAAE,GAAG;IACxB,iBAAiB,EAAE,GAAG;CACvB,CAAC;AAEF,MAAM,yBAAyB,GAAc;IAC3C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yBAAyB;IAC5B;QACE,GAAG,EAAE,gBAAgB;QACrB,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,kBAAkB;QAC3B,WAAW,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE;KACxD;CACF,CAAC;AAEW,QAAA,yBAAyB,GAAc;IAClD;QACE,GAAG,EAAE,aAAa;QAClB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,aAAa;QACpB,OAAO,EAAE,GAAG;QACZ,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,GAAG;KACV;IACD,GAAG,yBAAyB;CAC7B,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare const UI_FIELD_TYPES: readonly ["number", "slider", "select", "checkbox", "switch", "turnDetection"];
|
|
2
|
-
export type UiFieldType = (typeof UI_FIELD_TYPES)[number];
|
|
3
|
-
export type UiFieldOption = {
|
|
4
|
-
value: string;
|
|
5
|
-
label: string;
|
|
6
|
-
};
|
|
7
|
-
export type UiFieldVisibleWhen = {
|
|
8
|
-
key: string;
|
|
9
|
-
equals: unknown;
|
|
10
|
-
};
|
|
11
|
-
/** Recipe the dashboard uses to pick a widget for one saved `aiProvider` key. */
|
|
12
|
-
export type UiField = {
|
|
13
|
-
key: string;
|
|
14
|
-
type: UiFieldType;
|
|
15
|
-
label: string;
|
|
16
|
-
default?: unknown;
|
|
17
|
-
min?: number;
|
|
18
|
-
max?: number;
|
|
19
|
-
step?: number;
|
|
20
|
-
options?: UiFieldOption[];
|
|
21
|
-
marks?: {
|
|
22
|
-
value: number;
|
|
23
|
-
label: string;
|
|
24
|
-
}[];
|
|
25
|
-
/** When true, a switch/checkbox displays the inverse of the stored value. */
|
|
26
|
-
invert?: boolean;
|
|
27
|
-
visibleWhen?: UiFieldVisibleWhen;
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=uiFields.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uiFields.types.d.ts","sourceRoot":"","sources":["../../../src/configuration/models/uiFields.types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,gFAOjB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,6EAA6E;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UI_FIELD_TYPES = void 0;
|
|
4
|
-
exports.UI_FIELD_TYPES = [
|
|
5
|
-
"number",
|
|
6
|
-
"slider",
|
|
7
|
-
"select",
|
|
8
|
-
"checkbox",
|
|
9
|
-
"switch",
|
|
10
|
-
"turnDetection",
|
|
11
|
-
];
|
|
12
|
-
//# sourceMappingURL=uiFields.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uiFields.types.js","sourceRoot":"","sources":["../../../src/configuration/models/uiFields.types.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,eAAe;CACP,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"phone_numbers.utils.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/phone_numbers/phone_numbers.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,2DAA2D;AAC3D,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,KACb,KAAK,CAAC;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAG7B,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flowIdAsObjectIdOrString = void 0;
|
|
4
|
-
const mongodb_1 = require("mongodb");
|
|
5
|
-
/** Older phone_numbers rows stored flow_id as a string. */
|
|
6
|
-
const flowIdAsObjectIdOrString = (flowId) => [
|
|
7
|
-
{ flow_id: new mongodb_1.ObjectId(flowId) },
|
|
8
|
-
{ flow_id: flowId },
|
|
9
|
-
];
|
|
10
|
-
exports.flowIdAsObjectIdOrString = flowIdAsObjectIdOrString;
|
|
11
|
-
//# sourceMappingURL=phone_numbers.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"phone_numbers.utils.js","sourceRoot":"","sources":["../../../src/talkpilot/phone_numbers/phone_numbers.utils.ts"],"names":[],"mappings":";;;AAAA,qCAAmC;AAEnC,2DAA2D;AACpD,MAAM,wBAAwB,GAAG,CACtC,MAAc,EACgB,EAAE,CAAC;IACjC,EAAE,OAAO,EAAE,IAAI,kBAAQ,CAAC,MAAM,CAAC,EAAE;IACjC,EAAE,OAAO,EAAE,MAA6B,EAAE;CAC3C,CAAC;AALW,QAAA,wBAAwB,4BAKnC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ObjectId } from "mongodb";
|
|
2
|
-
|
|
3
|
-
/** Older phone_numbers rows stored flow_id as a string. */
|
|
4
|
-
export const flowIdAsObjectIdOrString = (
|
|
5
|
-
flowId: string,
|
|
6
|
-
): Array<{ flow_id: ObjectId }> => [
|
|
7
|
-
{ flow_id: new ObjectId(flowId) },
|
|
8
|
-
{ flow_id: flowId as unknown as ObjectId },
|
|
9
|
-
];
|