@fonoster/apiserver 0.27.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.
- package/dist/applications/buildService.d.ts +5 -1
- package/dist/applications/buildService.js +10 -7
- package/dist/applications/createCreateApplication.d.ts +6 -2
- package/dist/applications/createCreateApplication.js +24 -16
- package/dist/applications/createCreateTestToken.d.ts +3 -1
- package/dist/applications/createCreateTestToken.js +18 -13
- package/dist/applications/createGetApplication.js +2 -2
- package/dist/applications/createGetFnUtil.d.ts +22 -18
- package/dist/applications/createGetFnUtil.js +3 -5
- package/dist/applications/createListApplications.js +3 -4
- package/dist/applications/createRotateSigningSecret.d.ts +9 -0
- package/dist/{calls/createFetchSingleCall.js → applications/createRotateSigningSecret.js} +23 -20
- package/dist/applications/createUpdateApplication.d.ts +6 -2
- package/dist/applications/createUpdateApplication.js +35 -36
- package/dist/applications/evalKeys.d.ts +9 -0
- package/dist/{voice/handlers/dial/recordChannel.js → applications/evalKeys.js} +17 -12
- package/dist/applications/session/appModel.d.ts +225 -0
- package/dist/applications/session/appModel.js +331 -0
- package/dist/applications/types.d.ts +1 -27
- package/dist/billing/buildService.d.ts +24 -0
- package/dist/billing/buildService.js +116 -0
- package/dist/bin/entrypoint.d.ts +1 -0
- package/dist/bin/entrypoint.js +180 -0
- package/dist/bin/healthcheck.d.ts +2 -0
- package/dist/{voice/utils/VoiceServiceClientConstructor.js → bin/healthcheck.js} +24 -9
- package/dist/bin/regionHubSetup.d.ts +2 -0
- package/dist/bin/regionHubSetup.js +67 -0
- package/dist/bin/usage.d.ts +2 -0
- package/dist/bin/usage.js +119 -0
- package/dist/calls/buildService.d.ts +1 -20
- package/dist/calls/buildService.js +59 -6
- package/dist/calls/createCall.d.ts +17 -2
- package/dist/calls/createCall.js +64 -11
- package/dist/calls/createCallPublisher.d.ts +40 -2
- package/dist/calls/createCallPublisher.js +43 -9
- package/dist/calls/createIsWorkspaceNumber.d.ts +41 -0
- package/dist/calls/createIsWorkspaceNumber.js +39 -0
- package/dist/calls/createTrackCall.d.ts +55 -2
- package/dist/calls/createTrackCall.js +230 -16
- package/dist/calls/getCall.d.ts +4 -2
- package/dist/calls/getCall.js +2 -3
- package/dist/calls/listCalls.d.ts +4 -2
- package/dist/calls/listCalls.js +2 -3
- package/dist/calls/types.d.ts +11 -2
- package/dist/calls/types.js +10 -0
- package/dist/{core/buildWelcomeDemoService.d.ts → capabilities/buildService.d.ts} +8 -8
- package/dist/capabilities/buildService.js +17 -0
- package/dist/capabilities/createGetCapabilities.d.ts +78 -0
- package/dist/capabilities/createGetCapabilities.js +98 -0
- package/dist/{voice/handlers/utils → capabilities}/index.d.ts +2 -3
- package/dist/{voice/handlers/utils → capabilities}/index.js +4 -3
- package/dist/config/index.d.ts +23 -0
- package/dist/config/index.js +102 -0
- package/dist/config/schema.d.ts +1919 -0
- package/dist/config/schema.js +357 -0
- package/dist/core/allowList.js +2 -1
- package/dist/core/applyCatalog.d.ts +10 -0
- package/dist/{voice/client/GrpcClientHandler.js → core/applyCatalog.js} +45 -51
- package/dist/core/db.d.ts +3 -1
- package/dist/core/db.js +2 -1
- package/dist/core/durableConsumer.d.ts +41 -0
- package/dist/core/durableConsumer.js +104 -0
- package/dist/core/httpBridge.d.ts +24 -6
- package/dist/core/httpBridge.js +3 -25
- package/dist/core/identityConfig.d.ts +2 -35
- package/dist/core/identityConfig.js +3 -36
- package/dist/core/regionHooks.d.ts +15 -0
- package/dist/{calls/influxdb.js → core/regionHooks.js} +4 -8
- package/dist/core/runServices.js +98 -15
- package/dist/core/services.d.ts +96 -6
- package/dist/core/services.js +49 -10
- package/dist/{voice/errors/index.d.ts → core/telemetry.d.ts} +2 -2
- package/dist/core/telemetry.js +42 -0
- package/dist/{applications/utils/convertToApplicationData.d.ts → core/telemetryInterceptor.d.ts} +10 -4
- package/dist/core/telemetryInterceptor.js +57 -0
- package/dist/core/testTokenConfig.js +4 -1
- package/dist/core/upsertRoomrPeer.d.ts +6 -0
- package/dist/core/{upsertDefaultPeer.js → upsertRoomrPeer.js} +31 -30
- package/dist/envs.d.ts +136 -23
- package/dist/envs.js +108 -143
- package/dist/index.js +39 -21
- package/dist/outbound/createNodeDirectory.d.ts +86 -0
- package/dist/outbound/createNodeDirectory.js +140 -0
- package/dist/{voice/integrations → outbound}/index.d.ts +4 -1
- package/dist/{voice/errors → outbound}/index.js +4 -2
- package/dist/outbound/placeOutboundCall.d.ts +96 -0
- package/dist/outbound/placeOutboundCall.js +172 -0
- package/dist/outbound/placementSweep.d.ts +56 -0
- package/dist/outbound/placementSweep.js +127 -0
- package/dist/outbound/runOutboundCalls.d.ts +52 -0
- package/dist/outbound/runOutboundCalls.js +171 -0
- package/dist/providers/createProvidersHandlers.d.ts +39 -0
- package/dist/providers/createProvidersHandlers.js +229 -0
- package/dist/providers/index.d.ts +47 -0
- package/dist/{voice/client → providers}/index.js +15 -6
- package/dist/providers/registryUsage.d.ts +48 -0
- package/dist/providers/registryUsage.js +236 -0
- package/dist/records/createIndexRecord.d.ts +42 -0
- package/dist/records/createIndexRecord.js +185 -0
- package/dist/records/createRecordsRouter.d.ts +61 -0
- package/dist/records/createRecordsRouter.js +330 -0
- package/dist/records/createSearchRecords.d.ts +51 -0
- package/dist/records/createSearchRecords.js +134 -0
- package/dist/{voice/filters → records}/index.d.ts +6 -6
- package/dist/{voice/filters → records}/index.js +6 -6
- package/dist/records/maintenance.d.ts +33 -0
- package/dist/records/maintenance.js +166 -0
- package/dist/records/runCallRecords.d.ts +48 -0
- package/dist/records/runCallRecords.js +49 -0
- package/dist/{events/createPerCallCache.d.ts → records/stores.d.ts} +4 -7
- package/dist/{voice/handlers/utils/isDtmf.js → records/stores.js} +9 -3
- package/dist/records/types.d.ts +104 -0
- package/dist/regions/configSync.d.ts +130 -0
- package/dist/regions/configSync.js +316 -0
- package/dist/regions/createRegionsRouter.d.ts +151 -0
- package/dist/regions/createRegionsRouter.js +391 -0
- package/dist/regions/endpoints.d.ts +41 -0
- package/dist/regions/endpoints.js +90 -0
- package/dist/regions/enrollmentToken.d.ts +41 -0
- package/dist/regions/enrollmentToken.js +94 -0
- package/dist/regions/httpAuth.d.ts +39 -0
- package/dist/regions/httpAuth.js +78 -0
- package/dist/regions/ids.d.ts +15 -0
- package/dist/regions/ids.js +81 -0
- package/dist/{voice/client → regions}/index.d.ts +17 -6
- package/dist/regions/index.js +51 -0
- package/dist/regions/link.d.ts +17 -0
- package/dist/regions/link.js +170 -0
- package/dist/regions/natsAuth.d.ts +41 -0
- package/dist/regions/natsAuth.js +64 -0
- package/dist/regions/natsJwt.d.ts +23 -0
- package/dist/regions/natsJwt.js +26 -0
- package/dist/regions/relay.d.ts +45 -0
- package/dist/regions/relay.js +203 -0
- package/dist/regions/relayHttp.d.ts +7 -0
- package/dist/regions/relayHttp.js +107 -0
- package/dist/regions/relaySlots.d.ts +18 -0
- package/dist/regions/relaySlots.js +118 -0
- package/dist/regions/runRegions.d.ts +111 -0
- package/dist/regions/runRegions.js +235 -0
- package/dist/regions/service.d.ts +129 -0
- package/dist/regions/service.js +558 -0
- package/dist/regions/sources.d.ts +20 -0
- package/dist/regions/sources.js +191 -0
- package/dist/regions/status.d.ts +35 -0
- package/dist/regions/status.js +63 -0
- package/dist/regions/types.d.ts +123 -0
- package/dist/regions/types.js +41 -0
- package/dist/{voice/integrations/getSttConfig.d.ts → regions/withConfigChangeHook.d.ts} +13 -7
- package/dist/regions/withConfigChangeHook.js +44 -0
- package/dist/secrets/createGetFnUtil.d.ts +2 -2
- package/dist/session/createSessionRouter.d.ts +49 -0
- package/dist/session/createSessionRouter.js +206 -0
- package/dist/{voice/handlers/dial → session}/index.d.ts +1 -1
- package/dist/{voice/handlers/dial → session}/index.js +1 -1
- package/dist/usage/buildService.d.ts +16 -0
- package/dist/{voice/integrations/getTtsConfig.js → usage/buildService.js} +13 -7
- package/dist/{voice/tts/utils/convertUlawToPCM16.d.ts → usage/createGetUsage.d.ts} +7 -6
- package/dist/usage/createGetUsage.js +118 -0
- package/dist/usage/ingestUsage.d.ts +7 -0
- package/dist/usage/ingestUsage.js +87 -0
- package/dist/usage/publishRecordedUsage.d.ts +52 -0
- package/dist/usage/publishRecordedUsage.js +103 -0
- package/dist/{utils/createHandleDialEventsWithNats.d.ts → usage/publishUsage.d.ts} +10 -4
- package/dist/usage/publishUsage.js +50 -0
- package/dist/usage/rebuildUsage.d.ts +48 -0
- package/dist/usage/rebuildUsage.js +104 -0
- package/dist/usage/runUsageConsumer.d.ts +22 -0
- package/dist/usage/runUsageConsumer.js +78 -0
- package/dist/usage/snapshotStorage.d.ts +14 -0
- package/dist/usage/snapshotStorage.js +95 -0
- package/dist/{voice/integrations/getTtsConfig.d.ts → usage/types.d.ts} +17 -6
- package/dist/utils/createCheckNumberPreconditions.js +4 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -2
- package/dist/voice/stt/Deepgram.d.ts +4 -57
- package/dist/voice/stt/Deepgram.js +15 -286
- package/dist/voice/stt/Google.d.ts +4 -15
- package/dist/voice/stt/Google.js +7 -103
- package/dist/voice/stt/types.d.ts +2 -38
- package/dist/voice/stt/types.js +25 -3
- package/dist/voice/tts/Azure.d.ts +4 -34
- package/dist/voice/tts/Azure.js +25 -105
- package/dist/voice/tts/Deepgram.d.ts +4 -38
- package/dist/voice/tts/Deepgram.js +25 -82
- package/dist/voice/tts/ElevenLabs.d.ts +4 -18
- package/dist/voice/tts/ElevenLabs.js +6 -97
- package/dist/voice/tts/Google.d.ts +4 -38
- package/dist/voice/tts/Google.js +25 -91
- package/dist/webhooks/createWebhooksHandlers.d.ts +37 -0
- package/dist/webhooks/createWebhooksHandlers.js +217 -0
- package/dist/webhooks/index.d.ts +37 -0
- package/dist/webhooks/index.js +51 -0
- package/dist/webhooks/lostCalls.d.ts +49 -0
- package/dist/webhooks/lostCalls.js +147 -0
- package/dist/webhooks/nodeCallEvents.d.ts +73 -0
- package/dist/webhooks/nodeCallEvents.js +177 -0
- package/dist/webhooks/runWebhookFanout.d.ts +44 -0
- package/dist/webhooks/runWebhookFanout.js +202 -0
- package/package.json +21 -31
- package/dist/applications/utils/applicationWithEncodedStruct.d.ts +0 -3
- package/dist/applications/utils/applicationWithEncodedStruct.js +0 -50
- package/dist/applications/utils/convertToApplicationData.js +0 -37
- package/dist/applications/validation/assistantWithoutApiKeySchema.d.ts +0 -786
- package/dist/applications/validation/assistantWithoutApiKeySchema.js +0 -35
- package/dist/applications/validation/createValidationSchema.d.ts +0 -1474
- package/dist/applications/validation/createValidationSchema.js +0 -67
- package/dist/applications/validation/prepareForValidation.d.ts +0 -21
- package/dist/applications/validation/prepareForValidation.js +0 -35
- package/dist/applications/validation/speechValidators.d.ts +0 -47
- package/dist/applications/validation/speechValidators.js +0 -50
- package/dist/applications/validation/validOrThrow.d.ts +0 -21
- package/dist/applications/validation/validOrThrow.js +0 -15
- package/dist/calls/createFetchCalls.d.ts +0 -22
- package/dist/calls/createFetchCalls.js +0 -88
- package/dist/calls/createFetchSingleCall.d.ts +0 -22
- package/dist/calls/influxdb.d.ts +0 -2
- package/dist/calls/runCallManager.d.ts +0 -8
- package/dist/calls/runCallManager.js +0 -75
- package/dist/core/buildWelcomeDemoService.js +0 -97
- package/dist/core/upsertDefaultPeer.d.ts +0 -2
- package/dist/events/amdResultCache.d.ts +0 -23
- package/dist/events/amdResultCache.js +0 -35
- package/dist/events/createInfluxDbPub.d.ts +0 -13
- package/dist/events/createInfluxDbPub.js +0 -89
- package/dist/events/createPerCallCache.js +0 -46
- package/dist/events/mapCallDirectionToEnum.d.ts +0 -21
- package/dist/events/mapCallDirectionToEnum.js +0 -37
- package/dist/events/nats.d.ts +0 -10
- package/dist/events/nats.js +0 -82
- package/dist/events/transformEvent.d.ts +0 -2
- package/dist/events/transformEvent.js +0 -87
- package/dist/events/types.d.ts +0 -26
- package/dist/utils/createHandleDialEventsWithNats.js +0 -24
- package/dist/utils/createHandleDialEventsWithVoiceClient.d.ts +0 -23
- package/dist/utils/createHandleDialEventsWithVoiceClient.js +0 -27
- package/dist/utils/getIntegrationsFromFile.d.ts +0 -2
- package/dist/utils/getIntegrationsFromFile.js +0 -49
- package/dist/utils/mapDialStatus.d.ts +0 -21
- package/dist/utils/mapDialStatus.js +0 -38
- package/dist/voice/VoiceDispatcher.d.ts +0 -21
- package/dist/voice/VoiceDispatcher.js +0 -122
- package/dist/voice/amd/mapAsteriskAmd.d.ts +0 -38
- package/dist/voice/amd/mapAsteriskAmd.js +0 -68
- package/dist/voice/client/AudioSocketHandler.d.ts +0 -38
- package/dist/voice/client/AudioSocketHandler.js +0 -70
- package/dist/voice/client/AuthorizationHandler.d.ts +0 -13
- package/dist/voice/client/AuthorizationHandler.js +0 -78
- package/dist/voice/client/ExternalMediaHandler.d.ts +0 -32
- package/dist/voice/client/ExternalMediaHandler.js +0 -59
- package/dist/voice/client/GrpcClientHandler.d.ts +0 -36
- package/dist/voice/client/SpeechHandler.d.ts +0 -60
- package/dist/voice/client/SpeechHandler.js +0 -120
- package/dist/voice/client/VoiceClientImpl.d.ts +0 -79
- package/dist/voice/client/VoiceClientImpl.js +0 -198
- package/dist/voice/connectToAri.d.ts +0 -2
- package/dist/voice/connectToAri.js +0 -81
- package/dist/voice/createCreateVoiceClient.d.ts +0 -9
- package/dist/voice/createCreateVoiceClient.js +0 -97
- package/dist/voice/errors/ChannelVarNotFoundError.d.ts +0 -23
- package/dist/voice/errors/ChannelVarNotFoundError.js +0 -10
- package/dist/voice/errors/MethodNotImplementedError.d.ts +0 -22
- package/dist/voice/errors/MethodNotImplementedError.js +0 -27
- package/dist/voice/filters/AudioFilterFactory.d.ts +0 -35
- package/dist/voice/filters/AudioFilterFactory.js +0 -94
- package/dist/voice/filters/aiCoustics/createAiCousticsFilter.d.ts +0 -64
- package/dist/voice/filters/aiCoustics/createAiCousticsFilter.js +0 -252
- package/dist/voice/filters/aiCoustics/types.d.ts +0 -45
- package/dist/voice/filters/aiCoustics/types.js +0 -29
- package/dist/voice/filters/createAudioFilterChain.d.ts +0 -9
- package/dist/voice/filters/createAudioFilterChain.js +0 -171
- package/dist/voice/filters/createAudioFilterSession.d.ts +0 -15
- package/dist/voice/filters/createAudioFilterSession.js +0 -114
- package/dist/voice/filters/pcm.d.ts +0 -21
- package/dist/voice/filters/pcm.js +0 -37
- package/dist/voice/filters/types.d.ts +0 -61
- package/dist/voice/filters/types.js +0 -26
- package/dist/voice/handlers/createAnswerHandler.d.ts +0 -23
- package/dist/voice/handlers/createAnswerHandler.js +0 -24
- package/dist/voice/handlers/createHangupHandler.d.ts +0 -23
- package/dist/voice/handlers/createHangupHandler.js +0 -28
- package/dist/voice/handlers/createMuteHandler.d.ts +0 -4
- package/dist/voice/handlers/createMuteHandler.js +0 -27
- package/dist/voice/handlers/createPlayDtmfHandler.d.ts +0 -4
- package/dist/voice/handlers/createPlayDtmfHandler.js +0 -27
- package/dist/voice/handlers/createPlayHandler.d.ts +0 -4
- package/dist/voice/handlers/createPlayHandler.js +0 -33
- package/dist/voice/handlers/createPlaybackControlHandler.d.ts +0 -4
- package/dist/voice/handlers/createPlaybackControlHandler.js +0 -62
- package/dist/voice/handlers/createRecordHandler.d.ts +0 -4
- package/dist/voice/handlers/createRecordHandler.js +0 -58
- package/dist/voice/handlers/createSayHandler.d.ts +0 -4
- package/dist/voice/handlers/createSayHandler.js +0 -31
- package/dist/voice/handlers/createSetAudioFiltersHandler.d.ts +0 -11
- package/dist/voice/handlers/createSetAudioFiltersHandler.js +0 -74
- package/dist/voice/handlers/createStopSayHandler.d.ts +0 -3
- package/dist/voice/handlers/createStopSayHandler.js +0 -34
- package/dist/voice/handlers/createStreamGatherHandler.d.ts +0 -3
- package/dist/voice/handlers/createStreamGatherHandler.js +0 -74
- package/dist/voice/handlers/createStreamHandler.d.ts +0 -3
- package/dist/voice/handlers/createStreamHandler.js +0 -70
- package/dist/voice/handlers/createUnmuteHandler.d.ts +0 -4
- package/dist/voice/handlers/createUnmuteHandler.js +0 -27
- package/dist/voice/handlers/dial/createDialHandler.d.ts +0 -23
- package/dist/voice/handlers/dial/createDialHandler.js +0 -78
- package/dist/voice/handlers/dial/handleChannelLeftBridge.d.ts +0 -24
- package/dist/voice/handlers/dial/handleChannelLeftBridge.js +0 -29
- package/dist/voice/handlers/dial/handleStasisEnd.d.ts +0 -21
- package/dist/voice/handlers/dial/handleStasisEnd.js +0 -19
- package/dist/voice/handlers/dial/handleStasisStart.d.ts +0 -27
- package/dist/voice/handlers/dial/handleStasisStart.js +0 -52
- package/dist/voice/handlers/dial/recordChannel.d.ts +0 -22
- package/dist/voice/handlers/gather/createGatherHandler.d.ts +0 -3
- package/dist/voice/handlers/gather/createGatherHandler.js +0 -86
- package/dist/voice/handlers/gather/getTimeoutPromise.d.ts +0 -26
- package/dist/voice/handlers/gather/getTimeoutPromise.js +0 -18
- package/dist/voice/handlers/index.d.ts +0 -33
- package/dist/voice/handlers/index.js +0 -49
- package/dist/voice/handlers/utils/awaitForPlaybackFinished.d.ts +0 -21
- package/dist/voice/handlers/utils/awaitForPlaybackFinished.js +0 -25
- package/dist/voice/handlers/utils/awaitForRecordingFinished.d.ts +0 -5
- package/dist/voice/handlers/utils/awaitForRecordingFinished.js +0 -53
- package/dist/voice/handlers/utils/isDtmf.d.ts +0 -20
- package/dist/voice/handlers/utils/textChunksByClause.d.ts +0 -2
- package/dist/voice/handlers/utils/textChunksByClause.js +0 -41
- package/dist/voice/handlers/utils/textChunksByFirstNaturalPause.d.ts +0 -2
- package/dist/voice/handlers/utils/textChunksByFirstNaturalPause.js +0 -34
- package/dist/voice/handlers/utils/withErrorHandling.d.ts +0 -22
- package/dist/voice/handlers/utils/withErrorHandling.js +0 -38
- package/dist/voice/integrations/ApplicationNotFoundError.d.ts +0 -22
- package/dist/voice/integrations/ApplicationNotFoundError.js +0 -28
- package/dist/voice/integrations/createCreateContainer.d.ts +0 -4
- package/dist/voice/integrations/createCreateContainer.js +0 -76
- package/dist/voice/integrations/getSttConfig.js +0 -30
- package/dist/voice/integrations/index.js +0 -35
- package/dist/voice/integrations/types.d.ts +0 -29
- package/dist/voice/stt/AbstractSpeechToText.d.ts +0 -33
- package/dist/voice/stt/AbstractSpeechToText.js +0 -19
- package/dist/voice/stt/SpeechToTextFactory.d.ts +0 -9
- package/dist/voice/stt/SpeechToTextFactory.js +0 -43
- package/dist/voice/transcribeOnConnection.d.ts +0 -35
- package/dist/voice/transcribeOnConnection.js +0 -91
- package/dist/voice/tts/AbstractTextToSpeech.d.ts +0 -40
- package/dist/voice/tts/AbstractTextToSpeech.js +0 -50
- package/dist/voice/tts/TextToSpeechFactory.d.ts +0 -8
- package/dist/voice/tts/TextToSpeechFactory.js +0 -47
- package/dist/voice/tts/types.d.ts +0 -48
- package/dist/voice/tts/types.js +0 -2
- package/dist/voice/tts/utils/convertUlawToPCM16.js +0 -40
- package/dist/voice/tts/utils/createChunkedSynthesisStream.d.ts +0 -28
- package/dist/voice/tts/utils/createChunkedSynthesisStream.js +0 -78
- package/dist/voice/tts/utils/createErrorStream.d.ts +0 -21
- package/dist/voice/tts/utils/createErrorStream.js +0 -28
- package/dist/voice/tts/utils/index.d.ts +0 -23
- package/dist/voice/tts/utils/index.js +0 -39
- package/dist/voice/tts/utils/isSsml.d.ts +0 -20
- package/dist/voice/tts/utils/isSsml.js +0 -25
- package/dist/voice/tts/utils/streamToBuffer.d.ts +0 -20
- package/dist/voice/tts/utils/streamToBuffer.js +0 -60
- package/dist/voice/types/ari.d.ts +0 -43
- package/dist/voice/types/ari.js +0 -48
- package/dist/voice/types/index.d.ts +0 -20
- package/dist/voice/types/index.js +0 -36
- package/dist/voice/types/voice.d.ts +0 -67
- package/dist/voice/types/voice.js +0 -2
- package/dist/voice/utils/VoiceServiceClientConstructor.d.ts +0 -3
- package/dist/voice/utils/createExternalMediaConfig.d.ts +0 -12
- package/dist/voice/utils/createExternalMediaConfig.js +0 -37
- package/dist/voice/utils/createGetChannelVar.d.ts +0 -22
- package/dist/voice/utils/createGetChannelVar.js +0 -27
- package/dist/voice/utils/createGetChannelVarWithoutThrow.d.ts +0 -22
- package/dist/voice/utils/createGetChannelVarWithoutThrow.js +0 -26
- package/dist/voice/utils/index.d.ts +0 -22
- package/dist/voice/utils/index.js +0 -38
- /package/dist/{events → records}/types.js +0 -0
- /package/dist/{voice/integrations → usage}/types.js +0 -0
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
|
|
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
|
+
*/
|
|
2
19
|
import { IdentityConfig } from "@fonoster/identity";
|
|
20
|
+
import { Router } from "express";
|
|
3
21
|
declare function httpBridge(identityConfig: IdentityConfig, params: {
|
|
4
22
|
port: number;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
23
|
+
routers?: {
|
|
24
|
+
path: string;
|
|
25
|
+
router: Router;
|
|
26
|
+
}[];
|
|
27
|
+
}): void;
|
|
10
28
|
export { httpBridge };
|
package/dist/core/httpBridge.js
CHANGED
|
@@ -31,17 +31,17 @@ exports.httpBridge = httpBridge;
|
|
|
31
31
|
* See the License for the specific language governing permissions and
|
|
32
32
|
* limitations under the License.
|
|
33
33
|
*/
|
|
34
|
-
const fs_1 = __importDefault(require("fs"));
|
|
35
|
-
const path_1 = __importDefault(require("path"));
|
|
36
34
|
const identity_1 = require("@fonoster/identity");
|
|
37
35
|
const logger_1 = require("@fonoster/logger");
|
|
38
36
|
const express_1 = __importDefault(require("express"));
|
|
39
37
|
const envs_1 = require("../envs");
|
|
40
38
|
const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
|
|
41
39
|
function httpBridge(identityConfig, params) {
|
|
40
|
+
var _a;
|
|
42
41
|
const { port } = params;
|
|
43
42
|
const app = (0, express_1.default)();
|
|
44
|
-
const
|
|
43
|
+
for (const r of (_a = params.routers) !== null && _a !== void 0 ? _a : [])
|
|
44
|
+
app.use(r.path, r.router);
|
|
45
45
|
app.get("/api/identity/accept-invite", (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
try {
|
|
47
47
|
yield (0, identity_1.createUpdateMembershipStatus)(identityConfig)(req.query.token);
|
|
@@ -52,29 +52,7 @@ function httpBridge(identityConfig, params) {
|
|
|
52
52
|
res.redirect(identityConfig.workspaceInviteFailUrl);
|
|
53
53
|
}
|
|
54
54
|
}));
|
|
55
|
-
app.get("/api/recordings/:id", (req, res) => {
|
|
56
|
-
const RECORDINGS_PATH = path_1.default.join("/opt/fonoster/recordings", req.params.id);
|
|
57
|
-
const wave = fs_1.default.readFileSync(RECORDINGS_PATH);
|
|
58
|
-
res.setHeader("content-type", "audio/wav");
|
|
59
|
-
res.send(wave);
|
|
60
|
-
});
|
|
61
55
|
app.listen(port, () => {
|
|
62
56
|
logger.info(`HTTP bridge is running on port ${port}`);
|
|
63
57
|
});
|
|
64
|
-
return {
|
|
65
|
-
addStream: (id, stream) => {
|
|
66
|
-
streamMap.set(id, stream);
|
|
67
|
-
},
|
|
68
|
-
removeStream: (id) => {
|
|
69
|
-
logger.verbose(`removing stream with id: ${id}`);
|
|
70
|
-
const stream = streamMap.get(id);
|
|
71
|
-
if (stream) {
|
|
72
|
-
stream.destroy();
|
|
73
|
-
}
|
|
74
|
-
streamMap.delete(id);
|
|
75
|
-
},
|
|
76
|
-
getStream: (id) => {
|
|
77
|
-
return streamMap.get(id);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
58
|
}
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
issuer: string;
|
|
4
|
-
audience: string;
|
|
5
|
-
privateKey: string;
|
|
6
|
-
publicKey: string;
|
|
7
|
-
encryptionKey: string;
|
|
8
|
-
accessTokenExpiresIn: string;
|
|
9
|
-
refreshTokenExpiresIn: string;
|
|
10
|
-
idTokenExpiresIn: string;
|
|
11
|
-
workspaceInviteExpiration: string;
|
|
12
|
-
workspaceInviteUrl: string;
|
|
13
|
-
workspaceInviteFailUrl: string;
|
|
14
|
-
contactVerificationRequired: boolean;
|
|
15
|
-
twoFactorAuthenticationRequired: boolean;
|
|
16
|
-
smtpConfig: {
|
|
17
|
-
host: string;
|
|
18
|
-
port: number;
|
|
19
|
-
secure: boolean;
|
|
20
|
-
sender: string;
|
|
21
|
-
auth: {
|
|
22
|
-
user: string;
|
|
23
|
-
pass: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
twilioSmsConfig: {
|
|
27
|
-
accountSid: string;
|
|
28
|
-
authToken: string;
|
|
29
|
-
sender: string;
|
|
30
|
-
};
|
|
31
|
-
githubOauth2Config: {
|
|
32
|
-
clientId: string;
|
|
33
|
-
clientSecret: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
1
|
+
/** Embedded Identity's runtime config, from fonoster.yaml's identity section. */
|
|
2
|
+
declare const identityConfig: import("@fonoster/identity").IdentityConfig;
|
|
36
3
|
export { identityConfig };
|
|
@@ -19,40 +19,7 @@ exports.identityConfig = void 0;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
issuer: envs_1.IDENTITY_ISSUER,
|
|
26
|
-
audience: envs_1.IDENTITY_AUDIENCE,
|
|
27
|
-
privateKey: envs_1.IDENTITY_PRIVATE_KEY,
|
|
28
|
-
publicKey: envs_1.IDENTITY_PUBLIC_KEY,
|
|
29
|
-
encryptionKey: envs_1.CLOAK_ENCRYPTION_KEY,
|
|
30
|
-
accessTokenExpiresIn: envs_1.IDENTITY_ACCESS_TOKEN_EXPIRES_IN,
|
|
31
|
-
refreshTokenExpiresIn: envs_1.IDENTITY_REFRESH_TOKEN_EXPIRES_IN,
|
|
32
|
-
idTokenExpiresIn: envs_1.IDENTITY_ID_TOKEN_EXPIRES_IN,
|
|
33
|
-
workspaceInviteExpiration: envs_1.IDENTITY_WORKSPACE_INVITE_EXPIRATION,
|
|
34
|
-
workspaceInviteUrl: envs_1.IDENTITY_WORKSPACE_INVITE_URL,
|
|
35
|
-
workspaceInviteFailUrl: envs_1.IDENTITY_WORKSPACE_INVITE_FAIL_URL,
|
|
36
|
-
contactVerificationRequired: envs_1.IDENTITY_CONTACT_VERIFICATION_REQUIRED,
|
|
37
|
-
twoFactorAuthenticationRequired: envs_1.IDENTITY_TWO_FACTOR_AUTHENTICATION_REQUIRED,
|
|
38
|
-
smtpConfig: {
|
|
39
|
-
host: envs_1.SMTP_HOST,
|
|
40
|
-
port: envs_1.SMTP_PORT,
|
|
41
|
-
secure: envs_1.SMTP_SECURE,
|
|
42
|
-
sender: envs_1.SMTP_SENDER,
|
|
43
|
-
auth: {
|
|
44
|
-
user: envs_1.SMTP_AUTH_USER,
|
|
45
|
-
pass: envs_1.SMTP_AUTH_PASS
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
twilioSmsConfig: {
|
|
49
|
-
accountSid: envs_1.TWILIO_ACCOUNT_SID,
|
|
50
|
-
authToken: envs_1.TWILIO_AUTH_TOKEN,
|
|
51
|
-
sender: envs_1.TWILIO_PHONE_NUMBER
|
|
52
|
-
},
|
|
53
|
-
githubOauth2Config: {
|
|
54
|
-
clientId: envs_1.IDENTITY_OAUTH2_GITHUB_CLIENT_ID,
|
|
55
|
-
clientSecret: envs_1.IDENTITY_OAUTH2_GITHUB_CLIENT_SECRET
|
|
56
|
-
}
|
|
57
|
-
};
|
|
22
|
+
const config_1 = require("../config");
|
|
23
|
+
/** Embedded Identity's runtime config, from fonoster.yaml's identity section. */
|
|
24
|
+
const identityConfig = (0, config_1.getIdentityConfig)();
|
|
58
25
|
exports.identityConfig = identityConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Identity's workspace ↔ region hooks; attached to the regions runtime in runServices. */
|
|
2
|
+
export declare const workspaceRegionHooks: {
|
|
3
|
+
publicRegions: string[];
|
|
4
|
+
defaultRegion: string;
|
|
5
|
+
attach(r: import("../regions/runRegions").RegionsRuntime): void;
|
|
6
|
+
attachDirectory(d: import("../regions/types").WorkspaceDirectory): void;
|
|
7
|
+
directory(): import("../regions/types").WorkspaceDirectory | undefined;
|
|
8
|
+
resolveRegion(ownerRef: string, requested?: string): Promise<{
|
|
9
|
+
region: any;
|
|
10
|
+
}>;
|
|
11
|
+
workspaceChanged(workspace: {
|
|
12
|
+
accessKeyId: string;
|
|
13
|
+
region: string;
|
|
14
|
+
}): void;
|
|
15
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.workspaceRegionHooks = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
@@ -19,11 +19,7 @@ exports.influxdb = void 0;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
const influxdb_client_1 = require("@influxdata/influxdb-client");
|
|
23
22
|
const envs_1 = require("../envs");
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
28
|
-
const influxdb = client.getQueryApi(envs_1.INFLUXDB_ORG);
|
|
29
|
-
exports.influxdb = influxdb;
|
|
23
|
+
const runRegions_1 = require("../regions/runRegions");
|
|
24
|
+
/** Identity's workspace ↔ region hooks; attached to the regions runtime in runServices. */
|
|
25
|
+
exports.workspaceRegionHooks = (0, runRegions_1.createWorkspaceRegionHooks)(envs_1.REGIONS.public);
|
package/dist/core/runServices.js
CHANGED
|
@@ -68,38 +68,121 @@ const common_1 = require("@fonoster/common");
|
|
|
68
68
|
const logger_1 = require("@fonoster/logger");
|
|
69
69
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
70
70
|
const grpc_health_check_1 = require("grpc-health-check");
|
|
71
|
-
const
|
|
71
|
+
const nats_1 = require("nats");
|
|
72
|
+
const config_1 = require("../config");
|
|
72
73
|
const envs_1 = require("../envs");
|
|
73
|
-
const
|
|
74
|
+
const outbound_1 = require("../outbound");
|
|
75
|
+
const providers_1 = require("../providers");
|
|
76
|
+
const records_1 = require("../records");
|
|
77
|
+
const regions_1 = require("../regions");
|
|
78
|
+
const session_1 = require("../session");
|
|
79
|
+
const publishRecordedUsage_1 = require("../usage/publishRecordedUsage");
|
|
80
|
+
const publishUsage_1 = require("../usage/publishUsage");
|
|
81
|
+
const runUsageConsumer_1 = require("../usage/runUsageConsumer");
|
|
82
|
+
const snapshotStorage_1 = require("../usage/snapshotStorage");
|
|
83
|
+
const runWebhookFanout_1 = require("../webhooks/runWebhookFanout");
|
|
74
84
|
const allowList_1 = require("./allowList");
|
|
85
|
+
const db_1 = require("./db");
|
|
75
86
|
const httpBridge_1 = require("./httpBridge");
|
|
76
87
|
const identityConfig_1 = require("./identityConfig");
|
|
77
88
|
const loadServices_1 = __importDefault(require("./loadServices"));
|
|
89
|
+
const regionHooks_1 = require("./regionHooks");
|
|
78
90
|
const services_1 = __importDefault(require("./services"));
|
|
91
|
+
const telemetry_1 = require("./telemetry");
|
|
92
|
+
const telemetryInterceptor_1 = require("./telemetryInterceptor");
|
|
79
93
|
const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
|
|
80
|
-
const authorization = (0, common_1.createAuthInterceptor)(envs_1.IDENTITY_PUBLIC_KEY, allowList_1.allowList
|
|
94
|
+
const authorization = (0, common_1.createAuthInterceptor)(envs_1.IDENTITY_PUBLIC_KEY, allowList_1.allowList, {
|
|
95
|
+
issuer: envs_1.IDENTITY_ISSUER,
|
|
96
|
+
audience: envs_1.IDENTITY_AUDIENCE
|
|
97
|
+
});
|
|
81
98
|
const checkMethodAuthorized = (0, authz_1.createCheckMethodAuthorized)(`${envs_1.AUTHZ_SERVICE_HOST}:${envs_1.AUTHZ_SERVICE_PORT}`, envs_1.AUTHZ_SERVICE_METHODS);
|
|
82
99
|
function runServices() {
|
|
83
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
var _a;
|
|
84
102
|
const healthImpl = new grpc_health_check_1.HealthImplementation(common_1.statusMap);
|
|
85
103
|
const credentials = yield (0, common_1.getServerCredentials)({});
|
|
104
|
+
// Telemetry first, so refused requests are measured too.
|
|
105
|
+
const telemetry = (0, telemetryInterceptor_1.createTelemetryInterceptor)((0, telemetry_1.apiserverTelemetry)());
|
|
86
106
|
const interceptors = envs_1.AUTHZ_SERVICE_ENABLED
|
|
87
|
-
? [authorization, checkMethodAuthorized]
|
|
88
|
-
: [authorization];
|
|
107
|
+
? [telemetry, authorization, checkMethodAuthorized]
|
|
108
|
+
: [telemetry, authorization];
|
|
89
109
|
const server = new grpc.Server({ interceptors });
|
|
90
110
|
// Add the health check service to the server
|
|
91
111
|
healthImpl.addToServer(server);
|
|
92
|
-
|
|
93
|
-
(
|
|
94
|
-
|
|
95
|
-
yield (0,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
112
|
+
const loaded = yield services_1.default;
|
|
113
|
+
// Private regions (add-private-regions): hub link, config sync, relay and /api/regions
|
|
114
|
+
const handlers = Object.assign({}, ...loaded.map((s) => s.handlers));
|
|
115
|
+
const regions = yield (0, regions_1.runRegions)(envs_1.REGIONS, {
|
|
116
|
+
db: db_1.prisma,
|
|
117
|
+
identityPublicKey: envs_1.IDENTITY_PUBLIC_KEY,
|
|
118
|
+
identityTokenOptions: {
|
|
119
|
+
issuer: envs_1.IDENTITY_ISSUER,
|
|
120
|
+
audience: envs_1.IDENTITY_AUDIENCE
|
|
121
|
+
},
|
|
122
|
+
issuer: (_a = envs_1.REGIONS.controlPlaneUrl) !== null && _a !== void 0 ? _a : envs_1.APP_URL,
|
|
123
|
+
defaultControlPlaneUrl: envs_1.APP_URL,
|
|
124
|
+
defaultLeafUrl: `tls://${envs_1.DOMAIN}:7422`,
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
126
|
+
currentVersion: require("../../package.json").version,
|
|
127
|
+
sources: (0, regions_1.createSnapshotSources)({
|
|
128
|
+
db: db_1.prisma,
|
|
129
|
+
handlers,
|
|
130
|
+
callFeatures: (0, config_1.getConfig)().features.calls
|
|
131
|
+
}),
|
|
132
|
+
// Workspace domains are <label>.sip.<domain>; a region rewrites them to its own.
|
|
133
|
+
rootDomain: () => envs_1.SIP_ROOT
|
|
134
|
+
});
|
|
135
|
+
regionHooks_1.workspaceRegionHooks.attach(regions);
|
|
136
|
+
// Load the remaining services; writes to synced resources notify the config sync
|
|
137
|
+
(0, loadServices_1.default)(server, (0, regions_1.withConfigChangeHook)(loaded, regions.onConfigChange));
|
|
138
|
+
// Call records (add-call-record): index consumer, retention and the /api/records routes
|
|
139
|
+
const records = yield (0, records_1.runCallRecords)(envs_1.CALL_RECORDS, {
|
|
140
|
+
natsUrl: envs_1.NATS_CONNECTION,
|
|
141
|
+
identityPublicKey: envs_1.IDENTITY_PUBLIC_KEY,
|
|
142
|
+
identityTokenOptions: {
|
|
143
|
+
issuer: envs_1.IDENTITY_ISSUER,
|
|
144
|
+
audience: envs_1.IDENTITY_AUDIENCE
|
|
145
|
+
},
|
|
146
|
+
db: db_1.prisma,
|
|
147
|
+
relay: { regionOf: regions.regionOf, client: regions.relay },
|
|
148
|
+
onConfigChange: regions.onConfigChange,
|
|
149
|
+
usage: { directory: () => regionHooks_1.workspaceRegionHooks.directory() }
|
|
150
|
+
});
|
|
151
|
+
// The dashboard's cookie session (M4): refresh token in an httpOnly cookie on its origin
|
|
152
|
+
const session = {
|
|
153
|
+
path: session_1.SESSION_PATH,
|
|
154
|
+
router: (0, session_1.createSessionRouter)({
|
|
155
|
+
identity: (0, session_1.identityFromHandlers)(handlers),
|
|
156
|
+
secureCookie: envs_1.APP_URL.startsWith("https:")
|
|
157
|
+
})
|
|
158
|
+
};
|
|
159
|
+
(0, httpBridge_1.httpBridge)(identityConfig_1.identityConfig, {
|
|
160
|
+
port: envs_1.HTTP_BRIDGE_PORT,
|
|
161
|
+
routers: [...records.routers, ...regions.routers, session]
|
|
162
|
+
});
|
|
163
|
+
// Bus consumers: webhook fan-out (LO-B1) and the AppBridge replicas' catalog use (LO-B11)
|
|
164
|
+
const bus = yield (0, nats_1.connect)(Object.assign(Object.assign({}, envs_1.NATS), { maxReconnectAttempts: -1 }));
|
|
165
|
+
(0, providers_1.subscribeRegistryUsage)(bus, db_1.prisma);
|
|
166
|
+
(0, publishUsage_1.attachUsagePublisher)(bus);
|
|
167
|
+
yield (0, runUsageConsumer_1.runUsageConsumer)({
|
|
168
|
+
nc: bus,
|
|
169
|
+
db: db_1.prisma,
|
|
170
|
+
directory: () => regionHooks_1.workspaceRegionHooks.directory()
|
|
171
|
+
});
|
|
172
|
+
if (envs_1.BILLING_ENABLED)
|
|
173
|
+
yield (0, publishRecordedUsage_1.runRecordedUsagePublisher)({
|
|
174
|
+
nc: bus,
|
|
175
|
+
db: db_1.prisma
|
|
176
|
+
});
|
|
177
|
+
(0, snapshotStorage_1.runStorageSnapshots)({
|
|
178
|
+
db: db_1.prisma,
|
|
179
|
+
directory: () => regionHooks_1.workspaceRegionHooks.directory()
|
|
102
180
|
});
|
|
181
|
+
if (envs_1.WEBHOOKS.fanout) {
|
|
182
|
+
yield (0, runWebhookFanout_1.runWebhookFanout)(Object.assign(Object.assign({}, envs_1.WEBHOOKS), { enabled: true, allowInsecureUrls: envs_1.SESSION_APPS.allowInsecureWebhooks }), { nc: bus, db: db_1.prisma });
|
|
183
|
+
}
|
|
184
|
+
// CreateCall: places API-originated calls on the Roomr nodes (cleanbreak CB-B2)
|
|
185
|
+
yield (0, outbound_1.runOutboundCalls)({ natsUrl: envs_1.NATS_CONNECTION });
|
|
103
186
|
server.bindAsync(envs_1.APISERVER_BIND_ADDR, credentials, () => __awaiter(this, void 0, void 0, function* () {
|
|
104
187
|
healthImpl.setStatus("", common_1.GRPC_SERVING_STATUS);
|
|
105
188
|
logger.info(`apiserver running at ${envs_1.APISERVER_BIND_ADDR}`);
|
package/dist/core/services.d.ts
CHANGED
|
@@ -21,6 +21,9 @@ declare const services: Promise<[{
|
|
|
21
21
|
updateApplication: (call: {
|
|
22
22
|
request: unknown;
|
|
23
23
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
24
|
+
rotateSigningSecret: (call: {
|
|
25
|
+
request: unknown;
|
|
26
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
24
27
|
evaluateIntelligence: (call: {
|
|
25
28
|
request: import("@fonoster/autopilot").EvaluateIntelligenceRequest;
|
|
26
29
|
write: (chunk: Record<string, unknown>) => void;
|
|
@@ -155,6 +158,12 @@ declare const services: Promise<[{
|
|
|
155
158
|
exchangeRefreshToken: (call: {
|
|
156
159
|
request: unknown;
|
|
157
160
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
161
|
+
exchangeVerificationCode: (call: {
|
|
162
|
+
request: unknown;
|
|
163
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
164
|
+
revokeToken: (call: {
|
|
165
|
+
request: unknown;
|
|
166
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
158
167
|
getPublicKey: (_: unknown, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
159
168
|
publicKey: string;
|
|
160
169
|
}) => void) => Promise<void>;
|
|
@@ -307,13 +316,94 @@ declare const services: Promise<[{
|
|
|
307
316
|
};
|
|
308
317
|
}, {
|
|
309
318
|
definition: {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
319
|
+
serviceName: string;
|
|
320
|
+
pckg: string;
|
|
321
|
+
version: string;
|
|
322
|
+
proto: string;
|
|
323
|
+
};
|
|
324
|
+
handlers: {
|
|
325
|
+
getCapabilities: (_call: unknown, callback: (error: null, response: import("../capabilities").GetCapabilitiesResponse) => void) => Promise<void>;
|
|
326
|
+
};
|
|
327
|
+
}, {
|
|
328
|
+
definition: {
|
|
329
|
+
serviceName: string;
|
|
330
|
+
pckg: string;
|
|
331
|
+
version: string;
|
|
332
|
+
proto: string;
|
|
333
|
+
};
|
|
334
|
+
handlers: {
|
|
335
|
+
createWebhook: (call: {
|
|
336
|
+
request: unknown;
|
|
337
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
338
|
+
listWebhooks: (call: {
|
|
339
|
+
request: unknown;
|
|
340
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
341
|
+
getWebhook: (call: {
|
|
342
|
+
request: unknown;
|
|
343
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
344
|
+
updateWebhook: (call: {
|
|
345
|
+
request: unknown;
|
|
346
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
347
|
+
deleteWebhook: (call: {
|
|
348
|
+
request: unknown;
|
|
349
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
350
|
+
rotateWebhookSecret: (call: {
|
|
351
|
+
request: unknown;
|
|
352
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
353
|
+
listWebhookDeliveries: (call: {
|
|
354
|
+
request: unknown;
|
|
355
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
356
|
+
resendWebhookDelivery: (call: {
|
|
357
|
+
request: unknown;
|
|
358
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
359
|
+
};
|
|
360
|
+
}, {
|
|
361
|
+
definition: {
|
|
362
|
+
serviceName: string;
|
|
363
|
+
pckg: string;
|
|
364
|
+
version: string;
|
|
365
|
+
proto: string;
|
|
366
|
+
};
|
|
367
|
+
handlers: {
|
|
368
|
+
listCatalog: (call: {
|
|
369
|
+
request: unknown;
|
|
370
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
371
|
+
listWarnings: (call: {
|
|
372
|
+
request: unknown;
|
|
373
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
374
|
+
setProviderKey: (call: {
|
|
375
|
+
request: unknown;
|
|
376
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
377
|
+
listProviderKeys: (call: {
|
|
378
|
+
request: unknown;
|
|
379
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
380
|
+
deleteProviderKey: (call: {
|
|
381
|
+
request: unknown;
|
|
382
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
383
|
+
};
|
|
384
|
+
}, {
|
|
385
|
+
definition: {
|
|
386
|
+
serviceName: string;
|
|
387
|
+
pckg: string;
|
|
388
|
+
version: string;
|
|
389
|
+
proto: string;
|
|
390
|
+
};
|
|
391
|
+
handlers: {
|
|
392
|
+
getUsage: (call: {
|
|
393
|
+
request: unknown;
|
|
394
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: unknown) => void) => Promise<void>;
|
|
395
|
+
};
|
|
396
|
+
}, ...{
|
|
397
|
+
definition: {
|
|
398
|
+
serviceName: string;
|
|
399
|
+
pckg: string;
|
|
400
|
+
version: string;
|
|
401
|
+
proto: string;
|
|
314
402
|
};
|
|
315
403
|
handlers: {
|
|
316
|
-
|
|
404
|
+
[k: string]: (call: {
|
|
405
|
+
request: Record<string, unknown>;
|
|
406
|
+
}, callback: (error: import("@grpc/grpc-js").ServiceError | null | Partial<import("@grpc/grpc-js").ServiceError>, response?: unknown) => void) => void;
|
|
317
407
|
};
|
|
318
|
-
}]>;
|
|
408
|
+
}[]]>;
|
|
319
409
|
export default services;
|
package/dist/core/services.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
/**
|
|
4
13
|
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
@@ -21,26 +30,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
30
|
const identity_1 = require("@fonoster/identity");
|
|
22
31
|
const sipnet_1 = require("@fonoster/sipnet");
|
|
23
32
|
const applications_1 = require("../applications");
|
|
33
|
+
const buildService_1 = require("../billing/buildService");
|
|
24
34
|
const calls_1 = require("../calls");
|
|
25
|
-
const
|
|
35
|
+
const capabilities_1 = require("../capabilities");
|
|
36
|
+
const config_1 = require("../config");
|
|
37
|
+
const envs_1 = require("../envs");
|
|
38
|
+
const providers_1 = require("../providers");
|
|
26
39
|
const secrets_1 = require("../secrets");
|
|
40
|
+
const buildService_2 = require("../usage/buildService");
|
|
27
41
|
const utils_1 = require("../utils");
|
|
28
|
-
const
|
|
42
|
+
const webhooks_1 = require("../webhooks");
|
|
29
43
|
const db_1 = require("./db");
|
|
30
44
|
const identityConfig_1 = require("./identityConfig");
|
|
45
|
+
const regionHooks_1 = require("./regionHooks");
|
|
31
46
|
const routrConfig_1 = require("./routrConfig");
|
|
32
47
|
const testTokenConfig_1 = require("./testTokenConfig");
|
|
33
|
-
|
|
48
|
+
// A browser test call records who placed it (#1060): the signed-in user's email.
|
|
49
|
+
const identityDb = (0, identity_1.createPrismaClient)(identityConfig_1.identityConfig.dbUrl, identityConfig_1.identityConfig.encryptionKey);
|
|
50
|
+
const applicationsService = (0, applications_1.buildApplicationsService)(db_1.prisma, testTokenConfig_1.testTokenConfig, undefined, (userRef) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_a = (yield identityDb.user.findUnique({
|
|
53
|
+
where: { ref: userRef },
|
|
54
|
+
select: { email: true }
|
|
55
|
+
}))) === null || _a === void 0 ? void 0 : _a.email;
|
|
56
|
+
}));
|
|
34
57
|
const secretsService = (0, secrets_1.buildSecretsService)(db_1.prisma);
|
|
35
|
-
const callsService = (0, calls_1.buildCallsService)(
|
|
36
|
-
const identityService = (0, identity_1.buildIdentityService)(identityConfig_1.identityConfig);
|
|
58
|
+
const callsService = (0, calls_1.buildCallsService)();
|
|
59
|
+
const identityService = (0, identity_1.buildIdentityService)(Object.assign(Object.assign({}, identityConfig_1.identityConfig), { regions: regionHooks_1.workspaceRegionHooks }));
|
|
37
60
|
const agentsService = (0, sipnet_1.buildAgentsService)(routrConfig_1.routrConfig);
|
|
38
|
-
const domainsService = (0, sipnet_1.buildDomainsService)(routrConfig_1.routrConfig
|
|
61
|
+
const domainsService = (0, sipnet_1.buildDomainsService)(routrConfig_1.routrConfig, {
|
|
62
|
+
namesRoot: envs_1.DOMAIN_NAMES_ROOT
|
|
63
|
+
});
|
|
39
64
|
const credentialsService = (0, sipnet_1.buildCredentialsService)(routrConfig_1.routrConfig);
|
|
40
|
-
const trunksService = (0, sipnet_1.buildTrunksService)(routrConfig_1.routrConfig
|
|
41
|
-
|
|
65
|
+
const trunksService = (0, sipnet_1.buildTrunksService)(routrConfig_1.routrConfig, {
|
|
66
|
+
namesRoot: envs_1.TRUNK_NAMES_ROOT
|
|
67
|
+
});
|
|
68
|
+
// App-linked numbers point at the roomr peer (Asterisk is retired, cleanbreak CB-B3).
|
|
69
|
+
const numberRouting = (0, sipnet_1.createNumberRouting)({
|
|
70
|
+
roomrNodeAor: envs_1.ROUTR_ROOMR_PEER.aor
|
|
71
|
+
});
|
|
72
|
+
const numbersService = (0, sipnet_1.buildNumbersService)(routrConfig_1.routrConfig, (0, utils_1.createCheckNumberPreconditions)(db_1.prisma), numberRouting);
|
|
42
73
|
const aclsService = (0, sipnet_1.buildAclsService)(routrConfig_1.routrConfig);
|
|
43
|
-
const
|
|
74
|
+
const capabilitiesService = (0, capabilities_1.buildCapabilitiesService)((0, config_1.getConfig)());
|
|
75
|
+
const webhooksService = (0, webhooks_1.buildWebhooksService)(db_1.prisma);
|
|
76
|
+
const providersService = (0, providers_1.buildProvidersService)(db_1.prisma);
|
|
77
|
+
const usageService = (0, buildService_2.buildService)(db_1.prisma);
|
|
44
78
|
const services = Promise.all([
|
|
45
79
|
applicationsService,
|
|
46
80
|
secretsService,
|
|
@@ -52,6 +86,11 @@ const services = Promise.all([
|
|
|
52
86
|
numbersService,
|
|
53
87
|
trunksService,
|
|
54
88
|
domainsService,
|
|
55
|
-
|
|
89
|
+
capabilitiesService,
|
|
90
|
+
webhooksService,
|
|
91
|
+
providersService,
|
|
92
|
+
usageService,
|
|
93
|
+
// Billing (Fonoster Cloud): only when it is on (add-billing-service 6.1).
|
|
94
|
+
...(envs_1.BILLING_ENABLED ? [(0, buildService_1.buildService)(envs_1.BILLING_ADDRESS)] : [])
|
|
56
95
|
]);
|
|
57
96
|
exports.default = services;
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
export
|
|
19
|
+
import { Telemetry } from "@fonoster/common";
|
|
20
|
+
export declare function apiserverTelemetry(): Telemetry;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.apiserverTelemetry = apiserverTelemetry;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const common_1 = require("@fonoster/common");
|
|
23
|
+
const config_1 = require("../config");
|
|
24
|
+
let telemetry;
|
|
25
|
+
/**
|
|
26
|
+
* The apiserver's telemetry (add-platform 2.5): off unless an OTLP endpoint is configured
|
|
27
|
+
* (`telemetry.otlpEndpoint` in fonoster.yaml, else OTEL_EXPORTER_OTLP_ENDPOINT), then traces, logs and metrics over
|
|
28
|
+
* OTLP/HTTP like the other services.
|
|
29
|
+
*/
|
|
30
|
+
function configuredTelemetry() {
|
|
31
|
+
try {
|
|
32
|
+
return (0, config_1.getConfig)().telemetry;
|
|
33
|
+
}
|
|
34
|
+
catch (_a) {
|
|
35
|
+
// No loadable config (tests, tools): the environment alone decides.
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function apiserverTelemetry() {
|
|
40
|
+
telemetry !== null && telemetry !== void 0 ? telemetry : (telemetry = (0, common_1.initTelemetry)("fonoster-apiserver", undefined, (0, common_1.telemetryEnv)(configuredTelemetry())));
|
|
41
|
+
return telemetry;
|
|
42
|
+
}
|
package/dist/{applications/utils/convertToApplicationData.d.ts → core/telemetryInterceptor.d.ts}
RENAMED
|
@@ -16,7 +16,13 @@
|
|
|
16
16
|
* See the License for the specific language governing permissions and
|
|
17
17
|
* limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
import { Telemetry } from "@fonoster/common";
|
|
20
|
+
import { ServerInterceptingCall } from "@grpc/grpc-js";
|
|
21
|
+
/**
|
|
22
|
+
* Every gRPC request as a span (`apiserver.grpc`, with rpc.method and rpc.grpc.status_code) and a
|
|
23
|
+
* count (`fonoster.apiserver.grpc.requests` by method and code), add-platform 2.5. A `traceparent`
|
|
24
|
+
* metadata entry from the caller joins its trace. Free when telemetry is disabled.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createTelemetryInterceptor(telemetry: Telemetry): (methodDefinition: {
|
|
27
|
+
path: string;
|
|
28
|
+
}, call: ServerInterceptingCall) => ServerInterceptingCall;
|