@fonoster/common 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/{assistants → agents}/index.d.ts +1 -1
  2. package/dist/{assistants → agents}/index.js +1 -1
  3. package/dist/{assistants/sessionAssistantSchema.d.ts → agents/sessionAgentSchema.d.ts} +20 -6
  4. package/dist/{assistants/sessionAssistantSchema.js → agents/sessionAgentSchema.js} +16 -11
  5. package/dist/cellsecrets/index.d.ts +2 -2
  6. package/dist/cellsecrets/index.js +3 -3
  7. package/dist/config/cli/render.d.ts +1 -1
  8. package/dist/config/cli/render.js +3 -3
  9. package/dist/config/configHints.d.ts +1 -14
  10. package/dist/config/configHints.js +16 -30
  11. package/dist/config/index.d.ts +0 -1
  12. package/dist/config/index.js +0 -1
  13. package/dist/config/interpolateEnv.d.ts +1 -1
  14. package/dist/config/loadServiceConfig.d.ts +0 -5
  15. package/dist/config/loadServiceConfig.js +3 -12
  16. package/dist/constants.d.ts +1 -3
  17. package/dist/constants.js +3 -5
  18. package/dist/errors/handleZodError.js +3 -1
  19. package/dist/filters/index.d.ts +70 -0
  20. package/dist/filters/index.js +101 -0
  21. package/dist/identity/roles.js +11 -1
  22. package/dist/index.d.ts +4 -1
  23. package/dist/index.js +5 -2
  24. package/dist/protos/applications.proto +16 -2
  25. package/dist/protos/authz.proto +3 -0
  26. package/dist/protos/billing.proto +92 -0
  27. package/dist/protos/calls.proto +4 -0
  28. package/dist/protos/capabilities.proto +8 -0
  29. package/dist/protos/providers.proto +6 -2
  30. package/dist/protos/roomr.proto +146 -0
  31. package/dist/protos/session.proto +194 -0
  32. package/dist/protos/usage.proto +59 -0
  33. package/dist/registry/Registry.d.ts +13 -5
  34. package/dist/registry/Registry.js +49 -35
  35. package/dist/registry/cli.js +19 -7
  36. package/dist/registry/features.d.ts +2 -2
  37. package/dist/registry/features.js +7 -5
  38. package/dist/registry/prisma.d.ts +2 -2
  39. package/dist/registry/prisma.js +26 -18
  40. package/dist/registry/types.d.ts +17 -5
  41. package/dist/registry/types.js +2 -0
  42. package/dist/roomr/health.d.ts +9 -0
  43. package/dist/roomr/health.js +75 -0
  44. package/dist/roomr/index.d.ts +75 -0
  45. package/dist/roomr/index.js +146 -0
  46. package/dist/roomr/session.d.ts +133 -0
  47. package/dist/roomr/session.js +132 -0
  48. package/dist/session/schema.d.ts +196 -7
  49. package/dist/session/schema.js +59 -8
  50. package/dist/sessions/index.d.ts +15 -12
  51. package/dist/sessions/index.js +15 -12
  52. package/dist/telemetry.d.ts +1 -1
  53. package/dist/usage/CallUsage.d.ts +38 -0
  54. package/dist/usage/CallUsage.js +76 -0
  55. package/dist/{utils/types.d.ts → usage/index.d.ts} +4 -5
  56. package/dist/usage/index.js +38 -0
  57. package/dist/usage/meters.d.ts +113 -0
  58. package/dist/usage/meters.js +90 -0
  59. package/dist/usage/types.d.ts +159 -0
  60. package/dist/usage/types.js +84 -0
  61. package/dist/usage/usageId.d.ts +6 -0
  62. package/dist/usage/usageId.js +45 -0
  63. package/dist/utils/index.d.ts +0 -2
  64. package/dist/utils/index.js +0 -2
  65. package/dist/utils/withErrorHandling.js +1 -1
  66. package/dist/validators/calls.d.ts +5 -2
  67. package/dist/validators/calls.js +8 -1
  68. package/dist/validators/sip.d.ts +2 -2
  69. package/dist/validators/sip.js +3 -3
  70. package/dist/webhooks/bus.d.ts +29 -10
  71. package/dist/webhooks/bus.js +58 -50
  72. package/dist/webhooks/events.d.ts +1 -1
  73. package/dist/webhooks/events.js +1 -1
  74. package/package.json +9 -8
  75. package/schema/session.v1.json +82 -2
  76. package/dist/config/integrationsSchema.d.ts +0 -32
  77. package/dist/config/integrationsSchema.js +0 -56
  78. package/dist/utils/createFetchSingleCallByCallId.d.ts +0 -22
  79. package/dist/utils/createFetchSingleCallByCallId.js +0 -33
  80. package/dist/utils/types.js +0 -2
  81. /package/dist/{assistants → agents}/testCasesSchema.d.ts +0 -0
  82. /package/dist/{assistants → agents}/testCasesSchema.js +0 -0
  83. /package/dist/{assistants → agents}/tools/index.d.ts +0 -0
  84. /package/dist/{assistants → agents}/tools/index.js +0 -0
  85. /package/dist/{assistants → agents}/tools/propertySchema.d.ts +0 -0
  86. /package/dist/{assistants → agents}/tools/propertySchema.js +0 -0
  87. /package/dist/{assistants → agents}/tools/toolSchema.d.ts +0 -0
  88. /package/dist/{assistants → agents}/tools/toolSchema.js +0 -0
@@ -1,56 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.integrationsConfigSchema = void 0;
7
- exports.getIntegrationsFromFile = getIntegrationsFromFile;
8
- /**
9
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
10
- * http://github.com/fonoster/fonoster
11
- *
12
- * This file is part of Fonoster
13
- *
14
- * Licensed under the MIT License (the "License");
15
- * you may not use this file except in compliance with
16
- * the License. You may obtain a copy of the License at
17
- *
18
- * https://opensource.org/licenses/MIT
19
- *
20
- * Unless required by applicable law or agreed to in writing, software
21
- * distributed under the License is distributed on an "AS IS" BASIS,
22
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- * See the License for the specific language governing permissions and
24
- * limitations under the License.
25
- */
26
- const fs_1 = __importDefault(require("fs"));
27
- const zod_1 = require("zod");
28
- const zod_validation_error_1 = require("zod-validation-error");
29
- const parseConfigFile_1 = require("./parseConfigFile");
30
- const integrationsConfigSchema = zod_1.z.array(zod_1.z.object({
31
- name: zod_1.z.string(),
32
- productRef: zod_1.z.string(),
33
- type: zod_1.z.enum(["tts", "stt", "llm"]),
34
- credentials: zod_1.z.record(zod_1.z.unknown())
35
- }));
36
- exports.integrationsConfigSchema = integrationsConfigSchema;
37
- /**
38
- * Reads and validates the retired integrations file. Only `fonoster-migrate-legacy --integrations`
39
- * reads it now, to move its keys into operator config by credentialRef (add-provider-registry 5.3).
40
- * YAML (`.yaml`/`.yml`) or JSON with comments (`.json`/`.jsonc`). Throws with the
41
- * file path when the file can't be read or doesn't validate.
42
- */
43
- function getIntegrationsFromFile(pathToIntegrations) {
44
- let raw;
45
- try {
46
- raw = (0, parseConfigFile_1.parseConfigFile)(pathToIntegrations, fs_1.default.readFileSync(pathToIntegrations, "utf8"));
47
- }
48
- catch (e) {
49
- throw new Error(`unable to read integrations at ${pathToIntegrations}: ${e.message}`);
50
- }
51
- const result = integrationsConfigSchema.safeParse(raw);
52
- if (!result.success) {
53
- throw new Error(`invalid integrations at ${pathToIntegrations}: ${(0, zod_validation_error_1.fromError)(result.error, { prefix: null }).toString()}`);
54
- }
55
- return result.data;
56
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
3
- * http://github.com/fonoster/fonoster
4
- *
5
- * This file is part of Fonoster
6
- *
7
- * Licensed under the MIT License (the "License");
8
- * you may not use this file except in compliance with
9
- * the License. You may obtain a copy of the License at
10
- *
11
- * https://opensource.org/licenses/MIT
12
- *
13
- * Unless required by applicable law or agreed to in writing, software
14
- * distributed under the License is distributed on an "AS IS" BASIS,
15
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- */
19
- import { CallDetailRecord } from "@fonoster/types";
20
- import { InfluxDBClient } from "./types";
21
- declare function createFetchSingleCallByCallId(influxdb: InfluxDBClient): (callId: string) => Promise<CallDetailRecord>;
22
- export { createFetchSingleCallByCallId };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createFetchSingleCallByCallId = createFetchSingleCallByCallId;
13
- const influxdb_client_1 = require("@influxdata/influxdb-client");
14
- const constants_1 = require("../constants");
15
- function createFetchSingleCallByCallId(influxdb) {
16
- return function fetchSingleCallByCallId(callId) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const query = (0, influxdb_client_1.flux) `from(bucket: "${constants_1.INFLUXDB_CALLS_BUCKET}")
19
- |> range(start: -365d)
20
- |> pivot(rowKey: ["callId"], columnKey: ["_field"], valueColumn: "_value")
21
- |> map(fn: (r) => ({
22
- r with
23
- duration: int(v: r.endedAt) - int(v: r.startedAt)
24
- }))
25
- |> filter(fn: (r) => r._measurement == "${constants_1.CALL_DETAIL_RECORD_MEASUREMENT}")
26
- |> filter(fn: (r) => r.callId == ${callId})
27
- |> sort(columns: ["_time"], desc: true)
28
- |> limit(n: 1)`;
29
- const items = (yield influxdb.collectRows(query));
30
- return items.length > 0 ? items[0] : null;
31
- });
32
- };
33
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
File without changes
File without changes
File without changes
File without changes