@snap/camera-kit 0.15.0 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/docs/html/assets/main.js +4 -3
- package/docs/html/assets/navigation.js +1 -0
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +72 -25
- package/docs/html/classes/CameraKit.html +11 -196
- package/docs/html/classes/CameraKitSession.html +43 -366
- package/docs/html/classes/CameraKitSource.html +14 -223
- package/docs/html/classes/LensPerformanceMeasurement.html +9 -184
- package/docs/html/classes/LensPerformanceMetrics.html +7 -148
- package/docs/html/classes/LensRepository.html +17 -234
- package/docs/html/classes/Transform2D.html +7 -176
- package/docs/html/classes/TypedCustomEvent.html +4 -178
- package/docs/html/classes/TypedEventTarget.html +4 -209
- package/docs/html/enums/Lens_CameraFacing.html +5 -0
- package/docs/html/enums/UserData_Zodiac.html +15 -0
- package/docs/html/functions/ConcatInjectable.html +10 -193
- package/docs/html/functions/Injectable.html +9 -192
- package/docs/html/functions/bootstrapCameraKit.html +6 -147
- package/docs/html/functions/createExtension.html +6 -123
- package/docs/html/functions/createImageSource.html +4 -130
- package/docs/html/functions/createMediaStreamSource.html +4 -130
- package/docs/html/functions/createVideoSource.html +4 -130
- package/docs/html/functions/estimateLensPerformance.html +3 -120
- package/docs/html/functions/lensSourcesFactory.html +6 -127
- package/docs/html/functions/remoteApiServicesFactory.html +3 -121
- package/docs/html/hierarchy.html +1 -0
- package/docs/html/index.html +8 -165
- package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +11 -192
- package/docs/html/interfaces/CameraKitDeviceOptions.html +11 -0
- package/docs/html/interfaces/CameraKitSourceInfo.html +9 -0
- package/docs/html/interfaces/CameraKitSourceSubscriber.html +3 -194
- package/docs/html/interfaces/ComputedFrameMetrics.html +2 -150
- package/docs/html/interfaces/CreateSessionOptions.html +5 -148
- package/docs/html/interfaces/EstimatedLensPerformance.html +3 -146
- package/docs/html/interfaces/FunctionSourceOptions.html +7 -0
- package/docs/html/interfaces/Lens.html +12 -205
- package/docs/html/interfaces/LensCreator.html +3 -0
- package/docs/html/interfaces/LensLaunchData.html +3 -179
- package/docs/html/interfaces/LensSource.html +3 -172
- package/docs/html/interfaces/LoadAssetRequest.html +13 -0
- package/docs/html/interfaces/MediaStreamSourceOptions.html +16 -138
- package/docs/html/interfaces/Preview.html +4 -141
- package/docs/html/interfaces/RemoteApiRequest.html +7 -162
- package/docs/html/interfaces/RemoteApiResponse.html +6 -155
- package/docs/html/interfaces/RemoteApiService.html +9 -171
- package/docs/html/interfaces/Snapcode.html +5 -148
- package/docs/html/interfaces/UriCancelRequest.html +2 -138
- package/docs/html/interfaces/UriRequest.html +2 -154
- package/docs/html/interfaces/UriResponse.html +2 -150
- package/docs/html/interfaces/VideoSourceOptions.html +15 -134
- package/docs/html/modules.html +57 -175
- package/docs/html/types/AssetLoader.html +5 -132
- package/docs/html/types/AssetResponse.html +1 -0
- package/docs/html/types/AssetTiming.html +2 -115
- package/docs/html/types/BenchmarkError.html +1 -112
- package/docs/html/types/BootstrapError.html +2 -115
- package/docs/html/types/CacheKeyNotFoundError.html +1 -112
- package/docs/html/types/CameraKitSessionEventListener.html +2 -115
- package/docs/html/types/CameraKitSessionEvents.html +2 -122
- package/docs/html/types/CameraKitSourceError.html +1 -112
- package/docs/html/types/ConfigurationError.html +2 -115
- package/docs/html/types/FetchHandler.html +1 -0
- package/docs/html/types/Keyboard.html +14 -194
- package/docs/html/types/KeyboardEvents.html +2 -124
- package/docs/html/types/LegalError.html +1 -112
- package/docs/html/types/LensAbortError.html +2 -115
- package/docs/html/types/LensAssetError.html +2 -115
- package/docs/html/types/LensContentValidationError.html +1 -112
- package/docs/html/types/LensError.html +1 -112
- package/docs/html/types/LensExecutionError.html +2 -115
- package/docs/html/types/LensImagePickerError.html +2 -115
- package/docs/html/types/LensLaunchParams.html +2 -0
- package/docs/html/types/LensMetricsEvents.html +2 -115
- package/docs/html/types/LensPerformanceCluster.html +1 -113
- package/docs/html/types/LensView.html +2 -115
- package/docs/html/types/LensWait.html +2 -115
- package/docs/html/types/Matrix.html +3 -0
- package/docs/html/types/PersistentStoreError.html +2 -115
- package/docs/html/types/PlatformNotSupportedError.html +2 -115
- package/docs/html/types/PublicContainer.html +2 -115
- package/docs/html/types/PublicServices.html +2 -0
- package/docs/html/types/RemoteApiCancelRequestHandler.html +2 -0
- package/docs/html/types/RemoteApiRequestHandler.html +2 -139
- package/docs/html/types/RemoteApiServices.html +1 -112
- package/docs/html/types/RemoteApiStatus.html +2 -115
- package/docs/html/types/RenderTarget.html +2 -115
- package/docs/html/types/Uri.html +1 -112
- package/docs/html/types/WebGLError.html +1 -112
- package/docs/html/variables/extensionRequestContext.html +2 -115
- package/docs/md/README.md +3 -3
- package/docs/md/classes/CameraKit.md +15 -15
- package/docs/md/classes/CameraKitSession.md +38 -38
- package/docs/md/classes/CameraKitSource.md +22 -30
- package/docs/md/classes/LensPerformanceMeasurement.md +10 -6
- package/docs/md/classes/LensPerformanceMetrics.md +2 -2
- package/docs/md/classes/LensRepository.md +18 -18
- package/docs/md/classes/Transform2D.md +7 -3
- package/docs/md/classes/TypedCustomEvent.md +10 -6
- package/docs/md/classes/TypedEventTarget.md +12 -8
- package/docs/md/enums/Lens_CameraFacing.md +36 -0
- package/docs/md/enums/UserData_Zodiac.md +106 -0
- package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +2 -2
- package/docs/md/interfaces/CameraKitDeviceOptions.md +41 -0
- package/docs/md/interfaces/CameraKitSourceInfo.md +43 -0
- package/docs/md/interfaces/CameraKitSourceSubscriber.md +7 -7
- package/docs/md/interfaces/ComputedFrameMetrics.md +1 -1
- package/docs/md/interfaces/CreateSessionOptions.md +1 -1
- package/docs/md/interfaces/EstimatedLensPerformance.md +1 -1
- package/docs/md/interfaces/FunctionSourceOptions.md +22 -0
- package/docs/md/interfaces/Lens.md +4 -4
- package/docs/md/interfaces/LensCreator.md +17 -0
- package/docs/md/interfaces/LensLaunchData.md +6 -6
- package/docs/md/interfaces/LensSource.md +5 -5
- package/docs/md/interfaces/LoadAssetRequest.md +49 -0
- package/docs/md/interfaces/MediaStreamSourceOptions.md +46 -1
- package/docs/md/interfaces/Preview.md +1 -1
- package/docs/md/interfaces/RemoteApiRequest.md +2 -2
- package/docs/md/interfaces/RemoteApiResponse.md +2 -2
- package/docs/md/interfaces/RemoteApiService.md +1 -1
- package/docs/md/interfaces/Snapcode.md +1 -1
- package/docs/md/interfaces/UriCancelRequest.md +2 -2
- package/docs/md/interfaces/UriRequest.md +3 -3
- package/docs/md/interfaces/UriResponse.md +2 -2
- package/docs/md/interfaces/VideoSourceOptions.md +44 -1
- package/docs/md/modules.md +183 -201
- package/lib/CameraKit.d.ts +108 -108
- package/lib/CameraKit.js +1 -1
- package/lib/CameraKit.js.map +1 -1
- package/lib/bootstrapCameraKit.d.ts +4 -4
- package/lib/bootstrapCameraKit.js +18 -19
- package/lib/bootstrapCameraKit.js.map +1 -1
- package/lib/clients/createTsProtoClient.d.ts +5 -12
- package/lib/clients/createTsProtoClient.js +1 -2
- package/lib/clients/createTsProtoClient.js.map +1 -1
- package/lib/clients/grpcHandler.d.ts +7 -4
- package/lib/clients/grpcHandler.js +8 -5
- package/lib/clients/grpcHandler.js.map +1 -1
- package/lib/clients/lensesClient.d.ts +3 -3
- package/lib/clients/lensesClient.js +2 -2
- package/lib/clients/lensesClient.js.map +1 -1
- package/lib/clients/metricsClient.d.ts +26 -0
- package/lib/clients/metricsClient.js +120 -0
- package/lib/clients/metricsClient.js.map +1 -0
- package/lib/configuration.js +1 -1
- package/lib/configuration.js.map +1 -1
- package/lib/dependency-injection/Container.d.ts +1 -1
- package/lib/dependency-injection/Container.js +1 -1
- package/lib/dependency-injection/Container.js.map +1 -1
- package/lib/dependency-injection/Injectable.d.ts +6 -6
- package/lib/dependency-injection/Injectable.js.map +1 -1
- package/lib/dependency-injection/RootServices.d.ts +7 -8
- package/lib/dependency-injection/RootServices.js.map +1 -1
- package/lib/environment.d.ts +4 -0
- package/lib/environment.js +2 -0
- package/lib/environment.js.map +1 -0
- package/lib/extensions/RemoteApiServices.d.ts +2 -2
- package/lib/extensions/RemoteApiServices.js +11 -6
- package/lib/extensions/RemoteApiServices.js.map +1 -1
- package/lib/extensions/uriHandlersRegister.d.ts +4 -4
- package/lib/extensions/uriHandlersRegister.js +6 -6
- package/lib/extensions/uriHandlersRegister.js.map +1 -1
- package/lib/generated-proto/blizzard/cameraKitEvents.d.ts +4330 -678
- package/lib/generated-proto/blizzard/cameraKitEvents.js +515 -72
- package/lib/generated-proto/blizzard/cameraKitEvents.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts +3 -11
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js +6 -156
- package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.d.ts +19 -19
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.js +13 -27
- package/lib/generated-proto/pb_schema/camera_kit/v3/export.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.d.ts +0 -6
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js +2 -83
- package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.d.ts +0 -22
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js +0 -263
- package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.d.ts +30 -34
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js +7 -73
- package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.d.ts +0 -6
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.js +0 -110
- package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.js.map +1 -1
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.d.ts +48 -114
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.js +0 -225
- package/lib/generated-proto/pb_schema/camera_kit/v3/service.js.map +1 -1
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark.d.ts +6 -6
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark.js +5 -19
- package/lib/generated-proto/pb_schema/cdp/cof/benchmark.js.map +1 -1
- package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts +1422 -1422
- package/lib/generated-proto/pb_schema/cdp/cof/config_request.d.ts +12 -12
- package/lib/generated-proto/pb_schema/cdp/cof/config_request.js +10 -24
- package/lib/generated-proto/pb_schema/cdp/cof/config_request.js.map +1 -1
- package/lib/generated-proto/pb_schema/cdp/cof/config_response.d.ts +207 -207
- package/lib/generated-proto/pb_schema/cdp/cof/config_result.d.ts +530 -530
- package/lib/generated-proto/pb_schema/cdp/cof/config_result.js +10 -24
- package/lib/generated-proto/pb_schema/cdp/cof/config_result.js.map +1 -1
- package/lib/generated-proto/pb_schema/common/value.d.ts +6 -6
- package/lib/generated-proto/pb_schema/common/value.js +4 -18
- package/lib/generated-proto/pb_schema/common/value.js.map +1 -1
- package/lib/generated-proto/pb_schema/google/api/http.d.ts +0 -6
- package/lib/generated-proto/pb_schema/google/api/http.js +0 -77
- package/lib/generated-proto/pb_schema/google/api/http.js.map +1 -1
- package/lib/generated-proto/pb_schema/google/protobuf/any.d.ts +0 -2
- package/lib/generated-proto/pb_schema/google/protobuf/any.js +0 -44
- package/lib/generated-proto/pb_schema/google/protobuf/any.js.map +1 -1
- package/lib/generated-proto/pb_schema/google/protobuf/descriptor.d.ts +4830 -4896
- package/lib/generated-proto/pb_schema/google/protobuf/descriptor.js +10 -997
- package/lib/generated-proto/pb_schema/google/protobuf/descriptor.js.map +1 -1
- package/lib/generated-proto/pb_schema/google/protobuf/timestamp.d.ts +3 -5
- package/lib/generated-proto/pb_schema/google/protobuf/timestamp.js +6 -35
- package/lib/generated-proto/pb_schema/google/protobuf/timestamp.js.map +1 -1
- package/lib/generated-proto/pb_schema/google/protobuf/wrappers.d.ts +6 -6
- package/lib/generated-proto/pb_schema/google/protobuf/wrappers.js +10 -24
- package/lib/generated-proto/pb_schema/google/protobuf/wrappers.js.map +1 -1
- package/lib/generated-proto/pb_schema/lenses/launchdata.d.ts +9 -9
- package/lib/generated-proto/pb_schema/lenses/remote_api/remote_api_service.d.ts +11 -11
- package/lib/generated-proto/pb_schema/lenses/remote_api/remote_api_service.js +6 -20
- package/lib/generated-proto/pb_schema/lenses/remote_api/remote_api_service.js.map +1 -1
- package/lib/generated-proto/pb_schema/lenses/snappable.d.ts +42 -42
- package/lib/generated-proto/pb_schema/lenses/snappable.js +14 -28
- package/lib/generated-proto/pb_schema/lenses/snappable.js.map +1 -1
- package/lib/generated-proto/pb_schema/lenses/user_data.d.ts +8 -8
- package/lib/generated-proto/pb_schema/lenses/user_data.js +8 -22
- package/lib/generated-proto/pb_schema/lenses/user_data.js.map +1 -1
- package/lib/handlers/defaultFetchHandler.d.ts +1 -1
- package/lib/handlers/defaultFetchHandler.js.map +1 -1
- package/lib/handlers/requestStateEmittingHandler.d.ts +5 -6
- package/lib/handlers/requestStateEmittingHandler.js +6 -8
- package/lib/handlers/requestStateEmittingHandler.js.map +1 -1
- package/lib/handlers/responseCachingHandler.d.ts +9 -10
- package/lib/handlers/responseCachingHandler.js +9 -3
- package/lib/handlers/responseCachingHandler.js.map +1 -1
- package/lib/handlers/utils.d.ts +12 -0
- package/lib/handlers/utils.js +19 -0
- package/lib/handlers/utils.js.map +1 -0
- package/lib/index.d.ts +21 -15
- package/lib/index.js +17 -12
- package/lib/index.js.map +1 -1
- package/lib/lens/Lens.d.ts +12 -2
- package/lib/lens/Lens.js +5 -0
- package/lib/lens/Lens.js.map +1 -1
- package/lib/lens/LensLaunchData.d.ts +6 -3
- package/lib/lens/LensLaunchData.js +2 -0
- package/lib/lens/LensLaunchData.js.map +1 -1
- package/lib/lens/LensPersistenceStore.d.ts +1 -1
- package/lib/lens/LensPersistenceStore.js +1 -1
- package/lib/lens/LensPersistenceStore.js.map +1 -1
- package/lib/lens/LensRepository.d.ts +5 -1
- package/lib/lens/LensRepository.js +9 -5
- package/lib/lens/LensRepository.js.map +1 -1
- package/lib/lens/LensSource.d.ts +2 -2
- package/lib/lens/LensSource.js +2 -2
- package/lib/lens/LensSource.js.map +1 -1
- package/lib/lens/assets/LensAssetRepository.d.ts +35 -4
- package/lib/lens/assets/LensAssetRepository.js +9 -9
- package/lib/lens/assets/LensAssetRepository.js.map +1 -1
- package/lib/lens/assets/LensAssetsProvider.d.ts +1 -1
- package/lib/lens/assets/LensAssetsProvider.js +9 -4
- package/lib/lens/assets/LensAssetsProvider.js.map +1 -1
- package/lib/lens/assets/deviceDependentAssetLoader.js +3 -2
- package/lib/lens/assets/deviceDependentAssetLoader.js.map +1 -1
- package/lib/lens/assets/remoteMediaAssetLoaderFactory.js +4 -3
- package/lib/lens/assets/remoteMediaAssetLoaderFactory.js.map +1 -1
- package/lib/lens/assets/staticAssetLoader.js +5 -4
- package/lib/lens/assets/staticAssetLoader.js.map +1 -1
- package/lib/lens/cameraKitLensSource.js.map +1 -1
- package/lib/lens-client-interface/imagePicker.d.ts +2 -1
- package/lib/lens-client-interface/imagePicker.js.map +1 -1
- package/lib/lens-client-interface/lensClientInterface.d.ts +1 -1
- package/lib/lens-client-interface/lensClientInterface.js +1 -1
- package/lib/lens-client-interface/lensClientInterface.js.map +1 -1
- package/lib/lens-core-module/lensCore.d.ts +2 -1
- package/lib/lens-core-module/lensCore.js.map +1 -1
- package/lib/lens-core-module/loader/bootstrapURLs.d.ts +12 -0
- package/lib/lens-core-module/loader/bootstrapURLs.js +48 -0
- package/lib/lens-core-module/loader/bootstrapURLs.js.map +1 -0
- package/lib/lens-core-module/loader/lensCoreFactory.d.ts +0 -12
- package/lib/lens-core-module/loader/lensCoreFactory.js +4 -49
- package/lib/lens-core-module/loader/lensCoreFactory.js.map +1 -1
- package/lib/lensCoreWasmVersions.d.ts +6 -0
- package/lib/lensCoreWasmVersions.js +6 -0
- package/lib/lensCoreWasmVersions.js.map +1 -0
- package/lib/media-sources/CameraKitSource.d.ts +39 -17
- package/lib/media-sources/CameraKitSource.js +8 -2
- package/lib/media-sources/CameraKitSource.js.map +1 -1
- package/lib/media-sources/FunctionSource.d.ts +15 -4
- package/lib/media-sources/FunctionSource.js +1 -2
- package/lib/media-sources/FunctionSource.js.map +1 -1
- package/lib/media-sources/ImageSource.d.ts +3 -5
- package/lib/media-sources/ImageSource.js +1 -3
- package/lib/media-sources/ImageSource.js.map +1 -1
- package/lib/media-sources/MediaStreamSource.d.ts +17 -33
- package/lib/media-sources/MediaStreamSource.js +6 -41
- package/lib/media-sources/MediaStreamSource.js.map +1 -1
- package/lib/media-sources/VideoSource.d.ts +14 -10
- package/lib/media-sources/VideoSource.js +5 -11
- package/lib/media-sources/VideoSource.js.map +1 -1
- package/lib/metrics/businessEventsReporter.d.ts +3 -4
- package/lib/metrics/businessEventsReporter.js +11 -55
- package/lib/metrics/businessEventsReporter.js.map +1 -1
- package/lib/metrics/operational/Count.d.ts +2 -0
- package/lib/metrics/operational/Count.js +6 -1
- package/lib/metrics/operational/Count.js.map +1 -1
- package/lib/metrics/operational/Histogram.d.ts +1 -1
- package/lib/metrics/operational/Histogram.js +7 -3
- package/lib/metrics/operational/Histogram.js.map +1 -1
- package/lib/metrics/operational/Metric.js +2 -0
- package/lib/metrics/operational/Metric.js.map +1 -1
- package/lib/metrics/operational/Timer.d.ts +9 -6
- package/lib/metrics/operational/Timer.js +12 -26
- package/lib/metrics/operational/Timer.js.map +1 -1
- package/lib/metrics/reporters/reportBenchmarks.d.ts +3 -3
- package/lib/metrics/reporters/reportBenchmarks.js +6 -5
- package/lib/metrics/reporters/reportBenchmarks.js.map +1 -1
- package/lib/metrics/reporters/reportGlobalException.d.ts +4 -4
- package/lib/metrics/reporters/reportGlobalException.js +13 -11
- package/lib/metrics/reporters/reportGlobalException.js.map +1 -1
- package/lib/metrics/reporters/reportHttpMetrics.d.ts +3 -3
- package/lib/metrics/reporters/reportHttpMetrics.js +19 -16
- package/lib/metrics/reporters/reportHttpMetrics.js.map +1 -1
- package/lib/metrics/reporters/reportLegalState.d.ts +3 -3
- package/lib/metrics/reporters/reportLegalState.js +7 -9
- package/lib/metrics/reporters/reportLegalState.js.map +1 -1
- package/lib/metrics/reporters/reportLensAndAssetDownload.d.ts +3 -3
- package/lib/metrics/reporters/reportLensAndAssetDownload.js +12 -12
- package/lib/metrics/reporters/reportLensAndAssetDownload.js.map +1 -1
- package/lib/metrics/reporters/reportLensView.d.ts +3 -3
- package/lib/metrics/reporters/reportLensView.js +6 -6
- package/lib/metrics/reporters/reportLensView.js.map +1 -1
- package/lib/metrics/reporters/reportLensWait.d.ts +2 -3
- package/lib/metrics/reporters/reportLensWait.js +1 -3
- package/lib/metrics/reporters/reportLensWait.js.map +1 -1
- package/lib/metrics/reporters/reportPlatformCapabilities.d.ts +3 -3
- package/lib/metrics/reporters/reportPlatformCapabilities.js +6 -5
- package/lib/metrics/reporters/reportPlatformCapabilities.js.map +1 -1
- package/lib/metrics/reporters/reportUserSession.js +3 -3
- package/lib/metrics/reporters/reportUserSession.js.map +1 -1
- package/lib/metrics/reporters/reporters.d.ts +2 -2
- package/lib/namedErrors.d.ts +1 -1
- package/lib/namedErrors.js +1 -1
- package/lib/namedErrors.js.map +1 -1
- package/lib/observable-operators/unsubscribed.d.ts +1 -1
- package/lib/observable-operators/unsubscribed.js +1 -1
- package/lib/observable-operators/unsubscribed.js.map +1 -1
- package/lib/platform/platformCapabilities.d.ts +1 -1
- package/lib/platform/platformCapabilities.js +9 -3
- package/lib/platform/platformCapabilities.js.map +1 -1
- package/lib/platform/platformInfo.d.ts +1 -0
- package/lib/platform/platformInfo.js +3 -3
- package/lib/platform/platformInfo.js.map +1 -1
- package/lib/remote-configuration/cofHandler.d.ts +3 -3
- package/lib/remote-configuration/cofHandler.js +6 -4
- package/lib/remote-configuration/cofHandler.js.map +1 -1
- package/lib/remote-configuration/preloadConfiguration.d.ts +1 -1
- package/lib/remote-configuration/preloadConfiguration.js +1 -1
- package/lib/remote-configuration/preloadConfiguration.js.map +1 -1
- package/lib/remote-configuration/remoteConfiguration.d.ts +7 -6
- package/lib/remote-configuration/remoteConfiguration.js +18 -15
- package/lib/remote-configuration/remoteConfiguration.js.map +1 -1
- package/lib/session/CameraKitSession.d.ts +8 -8
- package/lib/session/CameraKitSession.js +11 -9
- package/lib/session/CameraKitSession.js.map +1 -1
- package/lib/session/LensKeyboard.d.ts +2 -3
- package/lib/session/LensKeyboard.js.map +1 -1
- package/lib/session/LensPerformanceMeasurement.d.ts +1 -1
- package/lib/session/LensPerformanceMeasurement.js +3 -3
- package/lib/session/LensPerformanceMeasurement.js.map +1 -1
- package/lib/session/LensPerformanceMetrics.d.ts +1 -1
- package/lib/session/LensPerformanceMetrics.js.map +1 -1
- package/lib/session/lensState.d.ts +4 -4
- package/lib/session/lensState.js +10 -10
- package/lib/session/lensState.js.map +1 -1
- package/lib/transforms/Transform2D.d.ts +8 -3
- package/lib/transforms/Transform2D.js +1 -1
- package/lib/transforms/Transform2D.js.map +1 -1
- package/lib/utils.d.ts +3 -0
- package/lib/utils.js +4 -0
- package/lib/utils.js.map +1 -0
- package/package.json +27 -6
- package/docs/html/functions/createUserMediaSource.html +0 -138
- package/docs/html/functions/getRequiredBootstrapURLs.html +0 -130
- package/docs/html/types/CameraKitDeviceInfo.html +0 -125
- package/docs/html/types/CameraKitDeviceOptions.html +0 -120
- package/docs/html/types/CameraKitSourceInfo.html +0 -112
- package/docs/html/types/CameraKitSourceOptions.html +0 -118
- package/lib/common/index.d.ts +0 -2
- package/lib/common/index.js +0 -3
- package/lib/common/index.js.map +0 -1
- package/lib/environment.json +0 -1
- package/lib/handlers/index.d.ts +0 -2
- package/lib/handlers/index.js +0 -3
- package/lib/handlers/index.js.map +0 -1
- package/lib/lens-core-module/index.d.ts +0 -3
- package/lib/lens-core-module/index.js +0 -4
- package/lib/lens-core-module/index.js.map +0 -1
- package/lib/lens-core-module/loader/index.d.ts +0 -1
- package/lib/lens-core-module/loader/index.js +0 -2
- package/lib/lens-core-module/loader/index.js.map +0 -1
- package/lib/lensCoreWasmVersions.json +0 -5
- package/lib/metrics/metricsHandler.d.ts +0 -10
- package/lib/metrics/metricsHandler.js +0 -13
- package/lib/metrics/metricsHandler.js.map +0 -1
- package/lib/metrics/operational/operationalMetricsReporter.d.ts +0 -64
- package/lib/metrics/operational/operationalMetricsReporter.js +0 -144
- package/lib/metrics/operational/operationalMetricsReporter.js.map +0 -1
- package/lib/session/index.d.ts +0 -1
- package/lib/session/index.js +0 -2
- package/lib/session/index.js.map +0 -1
- package/lib/transforms/index.d.ts +0 -1
- package/lib/transforms/index.js +0 -2
- package/lib/transforms/index.js.map +0 -1
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
|
-
import { Injectable } from "../../dependency-injection/Injectable";
|
|
3
|
-
import { HandlerChainBuilder } from "../../handlers/HandlerChainBuilder";
|
|
4
|
-
import { createBatchingHandler } from "../../handlers/batchingHandler";
|
|
5
|
-
import { SetOperationalMetricsRequest } from "../../generated-proto/pb_schema/camera_kit/v3/service";
|
|
6
|
-
import { createMappingHandler } from "../../handlers/mappingHandler";
|
|
7
|
-
import { pageVisibilityFactory } from "../../common/pageVisibility";
|
|
8
|
-
import { metricsHandlerFactory } from "../metricsHandler";
|
|
9
|
-
import { configurationToken } from "../../configuration";
|
|
10
|
-
// CameraKit's prod metrics endpoint.
|
|
11
|
-
// See: https://github.sc-corp.net/Snapchat/pb_schema/blob/c390b9c/proto/camera_kit/v3/service.proto#L126
|
|
12
|
-
const DIMENSION_DELIMITER = ".";
|
|
13
|
-
// These values are (currently) arbitrarily selected.
|
|
14
|
-
// TODO: Once we have gathered a sufficient quantity of metrics data, we should tune these numbers to ensure we're
|
|
15
|
-
// operating with the right cost vs. alarming SLA vs. IDB storage size tradeoffs.
|
|
16
|
-
const METRIC_BATCH_MAX_SIZE = 100;
|
|
17
|
-
const METRIC_BATCH_MAX_AGE_MS = 5000;
|
|
18
|
-
/**
|
|
19
|
-
* Use this class to report operational metrics – these are metrics that describe aspects of the SDK's performance,
|
|
20
|
-
* which may be used to assess and investigate operational issues.
|
|
21
|
-
*/
|
|
22
|
-
/** @internal */
|
|
23
|
-
export class OperationalMetricsReporter {
|
|
24
|
-
constructor(metricsHandler) {
|
|
25
|
-
this.metricsHandler = metricsHandler;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Record a count.
|
|
29
|
-
*
|
|
30
|
-
* @param name
|
|
31
|
-
* @param count
|
|
32
|
-
* @param dimensions An optional Map containing dimensions which describe the metric.
|
|
33
|
-
* For example: `new Map([['status', '200']])`
|
|
34
|
-
* @returns Promise which resolves when the metric has been handled.
|
|
35
|
-
*/
|
|
36
|
-
count(name, count, dimensions) {
|
|
37
|
-
return this.record(name, { $case: "count", count }, dimensions);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Record a duration in milliseconds.
|
|
41
|
-
*
|
|
42
|
-
* @param name
|
|
43
|
-
* @param latencyMillis
|
|
44
|
-
* @param dimensions An optional Map containing dimensions which describe the metric.
|
|
45
|
-
* For example: `new Map([['status', '200']])`
|
|
46
|
-
* @returns Promise which resolves when the metric has been handled.
|
|
47
|
-
*/
|
|
48
|
-
timer(name, latencyMillis, dimensions) {
|
|
49
|
-
return this.record(name, { $case: "latencyMillis", latencyMillis }, dimensions);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Record a histogram.
|
|
53
|
-
*
|
|
54
|
-
* @param name
|
|
55
|
-
* @param histogram
|
|
56
|
-
* @param dimensions An optional Map containing dimensions which describe the metric.
|
|
57
|
-
* For example: `new Map([['status', '200']])`
|
|
58
|
-
* @returns Promise which resolves when the metric has been handled.
|
|
59
|
-
*/
|
|
60
|
-
histogram(name, histogram, dimensions) {
|
|
61
|
-
return this.record(name, { $case: "histogram", histogram }, dimensions);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* TODO: This entire class in no longer necessary, since the new Timer/Count/Histogram classes offer a cleaner API
|
|
65
|
-
* for recording metrics. Once we migrate all operational metrics to use those new APIs, this class can be removed
|
|
66
|
-
* and call sites will just call the metrics handler directly.
|
|
67
|
-
*
|
|
68
|
-
* @param metric Any concrete Metric (e.g. Count, Timer, Histogram)
|
|
69
|
-
* @returns
|
|
70
|
-
*/
|
|
71
|
-
report(metric) {
|
|
72
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
yield Promise.all(metric.toOperationalMetric().map((metric) => this.metricsHandler(metric)));
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
record(name, metric, dimensions) {
|
|
77
|
-
// The naming convention (metricName.dimensionName.dimensionValue.dimensionName.dimensionValue...) is mentioned
|
|
78
|
-
// the Graphene docs here https://wiki.sc-corp.net/display/METRICS/Graphene
|
|
79
|
-
// TODO: find explicit documentation of the API, if it exists.
|
|
80
|
-
const serializedDimensions = dimensions
|
|
81
|
-
? `.${Array.from(dimensions.entries())
|
|
82
|
-
.map((d) => d.join(DIMENSION_DELIMITER))
|
|
83
|
-
.join(DIMENSION_DELIMITER)}`
|
|
84
|
-
: "";
|
|
85
|
-
return this.metricsHandler({
|
|
86
|
-
name: `${name}${serializedDimensions}`,
|
|
87
|
-
timestamp: new Date(),
|
|
88
|
-
metric,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
export const operationalMetricReporterFactory = Injectable("operationalMetricsReporter", [metricsHandlerFactory.token, pageVisibilityFactory.token, configurationToken], (metricsHandler, pageVisibility, configuration) => {
|
|
96
|
-
const handler = new HandlerChainBuilder(metricsHandler)
|
|
97
|
-
.map(createMappingHandler((metrics) => {
|
|
98
|
-
const request = { metrics };
|
|
99
|
-
return new Request(
|
|
100
|
-
// eslint-disable-next-line max-len
|
|
101
|
-
`https://${configuration.apiHostname}/com.snap.camerakit.v3.Metrics/metrics/operational_metrics`, {
|
|
102
|
-
method: "POST",
|
|
103
|
-
body: JSON.stringify(SetOperationalMetricsRequest.toJSON(request)),
|
|
104
|
-
credentials: "include",
|
|
105
|
-
// When this is true it makes fetch behave like `Navigator.sendBeacon` – that is, the
|
|
106
|
-
// request will still be made even if the page terminates.
|
|
107
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/fetch
|
|
108
|
-
keepalive: pageVisibility.isDuringVisibilityTransition("hidden"),
|
|
109
|
-
});
|
|
110
|
-
}, pageVisibility))
|
|
111
|
-
.map(createBatchingHandler({
|
|
112
|
-
// The batching logic here is very simple – it could be improved by e.g.
|
|
113
|
-
// computing statistics to reduce overall data sent, etc. Right now this is
|
|
114
|
-
// premature optimization, but could become a good idea in the future.
|
|
115
|
-
batchReduce: (previousBundle, metric) => {
|
|
116
|
-
var _a, _b;
|
|
117
|
-
let metrics = [...((_a = previousBundle === null || previousBundle === void 0 ? void 0 : previousBundle.metrics) !== null && _a !== void 0 ? _a : [])];
|
|
118
|
-
// For "count" metrics, it's straightforward to merge them into
|
|
119
|
-
// a single metric with the same name.
|
|
120
|
-
const existingCountIndex = ((_b = metric.metric) === null || _b === void 0 ? void 0 : _b.$case) === "count"
|
|
121
|
-
? metrics.findIndex((m) => { var _a; return metric.name === m.name && ((_a = m.metric) === null || _a === void 0 ? void 0 : _a.$case) === "count"; })
|
|
122
|
-
: -1;
|
|
123
|
-
if (existingCountIndex >= 0) {
|
|
124
|
-
// Safety: Given the condition above, we can be sure that both the existing and new metrics
|
|
125
|
-
// are of the "count" type.
|
|
126
|
-
const existingValue = metrics[existingCountIndex].metric;
|
|
127
|
-
const newValue = metric.metric;
|
|
128
|
-
metrics.splice(existingCountIndex, 1, Object.assign(Object.assign({}, metric), { metric: {
|
|
129
|
-
$case: "count",
|
|
130
|
-
count: existingValue.count + newValue.count,
|
|
131
|
-
} }));
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
metrics.push(metric);
|
|
135
|
-
}
|
|
136
|
-
return { metrics };
|
|
137
|
-
},
|
|
138
|
-
isBatchComplete: (bundle) => bundle.metrics.length >= METRIC_BATCH_MAX_SIZE,
|
|
139
|
-
maxBatchAge: METRIC_BATCH_MAX_AGE_MS,
|
|
140
|
-
pageVisibility,
|
|
141
|
-
})).handler;
|
|
142
|
-
return new OperationalMetricsReporter(handler);
|
|
143
|
-
});
|
|
144
|
-
//# sourceMappingURL=operationalMetricsReporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operationalMetricsReporter.js","sourceRoot":"","sources":["../../../src/metrics/operational/operationalMetricsReporter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAKvE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAkB,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAA0B,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAMjF,qCAAqC;AACrC,yGAAyG;AAEzG,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,qDAAqD;AACrD,kHAAkH;AAClH,iFAAiF;AACjF,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC;;;GAGG;AACH,gBAAgB;AAChB,MAAM,OAAO,0BAA0B;IACnC,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAE/D;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAY,EAAE,KAAa,EAAE,UAAgC;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,UAAU,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAY,EAAE,aAAqB,EAAE,UAAgC;QACvE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,EAAE,UAAU,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,IAAY,EAAE,SAAiB,EAAE,UAAgC;QACvE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,UAAU,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;;;OAOG;IACG,MAAM,CAAC,MAAc;;YACvB,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACjG,CAAC;KAAA;IAEO,MAAM,CACV,IAAY,EACZ,MAA6C,EAC7C,UAAyC;QAEzC,+GAA+G;QAC/G,2EAA2E;QAC3E,8DAA8D;QAC9D,MAAM,oBAAoB,GAAG,UAAU;YACnC,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;iBAC/B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;iBACvC,IAAI,CAAC,mBAAmB,CAAC,EAAE;YAClC,CAAC,CAAC,EAAE,CAAC;QAET,OAAO,IAAI,CAAC,cAAc,CAAC;YACvB,IAAI,EAAE,GAAG,IAAI,GAAG,oBAAoB,EAAE;YACtC,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,MAAM;SACT,CAAC,CAAC;IACP,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,UAAU,CACtD,4BAA4B,EAC5B,CAAC,qBAAqB,CAAC,KAAK,EAAE,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,CAAU,EACvF,CAAC,cAA4B,EAAE,cAA8B,EAAE,aAAqC,EAAE,EAAE;IACpG,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC,cAAc,CAAC;SAClD,GAAG,CACA,oBAAoB,CAAC,CAAC,OAAiC,EAAE,EAAE;QACvD,MAAM,OAAO,GAAiC,EAAE,OAAO,EAAE,CAAC;QAC1D,OAAO,IAAI,OAAO;QACd,mCAAmC;QACnC,WAAW,aAAa,CAAC,WAAW,4DAA4D,EAChG;YACI,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAClE,WAAW,EAAE,SAAS;YAEtB,qFAAqF;YACrF,0DAA0D;YAC1D,yDAAyD;YACzD,SAAS,EAAE,cAAc,CAAC,4BAA4B,CAAC,QAAQ,CAAC;SACnE,CACJ,CAAC;IACN,CAAC,EAAE,cAAc,CAAC,CACrB;SACA,GAAG,CACA,qBAAqB,CAAC;QAClB,wEAAwE;QACxE,2EAA2E;QAC3E,sEAAsE;QACtE,WAAW,EAAE,CAAC,cAAoD,EAAE,MAAyB,EAAE,EAAE;;YAC7F,IAAI,OAAO,GAAG,CAAC,GAAG,CAAC,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,OAAO,mCAAI,EAAE,CAAC,CAAC,CAAC;YAEnD,+DAA+D;YAC/D,sCAAsC;YACtC,MAAM,kBAAkB,GACpB,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,KAAK,MAAK,OAAO;gBAC5B,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,WAAC,OAAA,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAA,MAAA,CAAC,CAAC,MAAM,0CAAE,KAAK,MAAK,OAAO,CAAA,EAAA,CAAC;gBACjF,CAAC,CAAC,CAAC,CAAC,CAAC;YACb,IAAI,kBAAkB,IAAI,CAAC,EAAE;gBACzB,2FAA2F;gBAC3F,2BAA2B;gBAC3B,MAAM,aAAa,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAA0B,CAAC;gBAC7E,MAAM,QAAQ,GAAG,MAAM,CAAC,MAA0B,CAAC;gBACnD,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,kCAC7B,MAAM,KACT,MAAM,EAAE;wBACJ,KAAK,EAAE,OAAO;wBACd,KAAK,EAAE,aAAa,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK;qBAC9C,IACH,CAAC;aACN;iBAAM;gBACH,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACxB;YAED,OAAO,EAAE,OAAO,EAAE,CAAC;QACvB,CAAC;QACD,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,qBAAqB;QAC3E,WAAW,EAAE,uBAAuB;QACpC,cAAc;KACjB,CAAC,CACL,CAAC,OAAO,CAAC;IAEd,OAAO,IAAI,0BAA0B,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"../../dependency-injection/Injectable\";\nimport { FetchHandler } from \"../../handlers/defaultFetchHandler\";\nimport { HandlerChainBuilder } from \"../../handlers/HandlerChainBuilder\";\nimport { createBatchingHandler } from \"../../handlers/batchingHandler\";\nimport {\n OperationalMetric,\n OperationalMetricsBundle,\n} from \"../../generated-proto/pb_schema/camera_kit/v3/operational_metrics\";\nimport { SetOperationalMetricsRequest } from \"../../generated-proto/pb_schema/camera_kit/v3/service\";\nimport { createMappingHandler } from \"../../handlers/mappingHandler\";\nimport { PageVisibility, pageVisibilityFactory } from \"../../common/pageVisibility\";\nimport { metricsHandlerFactory } from \"../metricsHandler\";\nimport { CameraKitConfiguration, configurationToken } from \"../../configuration\";\nimport { Metric } from \"./Metric\";\n\ntype MetricsHandler = (metric: OperationalMetric) => Promise<void>;\ntype CountMetricValue = Extract<OperationalMetric[\"metric\"], { $case: \"count\" }>;\n\n// CameraKit's prod metrics endpoint.\n// See: https://github.sc-corp.net/Snapchat/pb_schema/blob/c390b9c/proto/camera_kit/v3/service.proto#L126\n\nconst DIMENSION_DELIMITER = \".\";\n\n// These values are (currently) arbitrarily selected.\n// TODO: Once we have gathered a sufficient quantity of metrics data, we should tune these numbers to ensure we're\n// operating with the right cost vs. alarming SLA vs. IDB storage size tradeoffs.\nconst METRIC_BATCH_MAX_SIZE = 100;\nconst METRIC_BATCH_MAX_AGE_MS = 5000;\n\n/**\n * Use this class to report operational metrics – these are metrics that describe aspects of the SDK's performance,\n * which may be used to assess and investigate operational issues.\n */\n/** @internal */\nexport class OperationalMetricsReporter {\n constructor(private readonly metricsHandler: MetricsHandler) {}\n\n /**\n * Record a count.\n *\n * @param name\n * @param count\n * @param dimensions An optional Map containing dimensions which describe the metric.\n * For example: `new Map([['status', '200']])`\n * @returns Promise which resolves when the metric has been handled.\n */\n count(name: string, count: number, dimensions?: Map<string, string>): Promise<void> {\n return this.record(name, { $case: \"count\", count }, dimensions);\n }\n\n /**\n * Record a duration in milliseconds.\n *\n * @param name\n * @param latencyMillis\n * @param dimensions An optional Map containing dimensions which describe the metric.\n * For example: `new Map([['status', '200']])`\n * @returns Promise which resolves when the metric has been handled.\n */\n timer(name: string, latencyMillis: number, dimensions?: Map<string, string>): Promise<void> {\n return this.record(name, { $case: \"latencyMillis\", latencyMillis }, dimensions);\n }\n\n /**\n * Record a histogram.\n *\n * @param name\n * @param histogram\n * @param dimensions An optional Map containing dimensions which describe the metric.\n * For example: `new Map([['status', '200']])`\n * @returns Promise which resolves when the metric has been handled.\n */\n histogram(name: string, histogram: number, dimensions?: Map<string, string>): Promise<void> {\n return this.record(name, { $case: \"histogram\", histogram }, dimensions);\n }\n\n /**\n * TODO: This entire class in no longer necessary, since the new Timer/Count/Histogram classes offer a cleaner API\n * for recording metrics. Once we migrate all operational metrics to use those new APIs, this class can be removed\n * and call sites will just call the metrics handler directly.\n *\n * @param metric Any concrete Metric (e.g. Count, Timer, Histogram)\n * @returns\n */\n async report(metric: Metric): Promise<void> {\n await Promise.all(metric.toOperationalMetric().map((metric) => this.metricsHandler(metric)));\n }\n\n private record(\n name: string,\n metric: Required<OperationalMetric>[\"metric\"],\n dimensions?: Map<string, string | number>\n ): Promise<void> {\n // The naming convention (metricName.dimensionName.dimensionValue.dimensionName.dimensionValue...) is mentioned\n // the Graphene docs here https://wiki.sc-corp.net/display/METRICS/Graphene\n // TODO: find explicit documentation of the API, if it exists.\n const serializedDimensions = dimensions\n ? `.${Array.from(dimensions.entries())\n .map((d) => d.join(DIMENSION_DELIMITER))\n .join(DIMENSION_DELIMITER)}`\n : \"\";\n\n return this.metricsHandler({\n name: `${name}${serializedDimensions}`,\n timestamp: new Date(),\n metric,\n });\n }\n}\n\n/**\n * @internal\n */\nexport const operationalMetricReporterFactory = Injectable(\n \"operationalMetricsReporter\",\n [metricsHandlerFactory.token, pageVisibilityFactory.token, configurationToken] as const,\n (metricsHandler: FetchHandler, pageVisibility: PageVisibility, configuration: CameraKitConfiguration) => {\n const handler = new HandlerChainBuilder(metricsHandler)\n .map(\n createMappingHandler((metrics: OperationalMetricsBundle) => {\n const request: SetOperationalMetricsRequest = { metrics };\n return new Request(\n // eslint-disable-next-line max-len\n `https://${configuration.apiHostname}/com.snap.camerakit.v3.Metrics/metrics/operational_metrics`,\n {\n method: \"POST\",\n body: JSON.stringify(SetOperationalMetricsRequest.toJSON(request)),\n credentials: \"include\",\n\n // When this is true it makes fetch behave like `Navigator.sendBeacon` – that is, the\n // request will still be made even if the page terminates.\n // https://developer.mozilla.org/en-US/docs/Web/API/fetch\n keepalive: pageVisibility.isDuringVisibilityTransition(\"hidden\"),\n }\n );\n }, pageVisibility)\n )\n .map(\n createBatchingHandler({\n // The batching logic here is very simple – it could be improved by e.g.\n // computing statistics to reduce overall data sent, etc. Right now this is\n // premature optimization, but could become a good idea in the future.\n batchReduce: (previousBundle: OperationalMetricsBundle | undefined, metric: OperationalMetric) => {\n let metrics = [...(previousBundle?.metrics ?? [])];\n\n // For \"count\" metrics, it's straightforward to merge them into\n // a single metric with the same name.\n const existingCountIndex =\n metric.metric?.$case === \"count\"\n ? metrics.findIndex((m) => metric.name === m.name && m.metric?.$case === \"count\")\n : -1;\n if (existingCountIndex >= 0) {\n // Safety: Given the condition above, we can be sure that both the existing and new metrics\n // are of the \"count\" type.\n const existingValue = metrics[existingCountIndex].metric as CountMetricValue;\n const newValue = metric.metric as CountMetricValue;\n metrics.splice(existingCountIndex, 1, {\n ...metric,\n metric: {\n $case: \"count\",\n count: existingValue.count + newValue.count,\n },\n });\n } else {\n metrics.push(metric);\n }\n\n return { metrics };\n },\n isBatchComplete: (bundle) => bundle.metrics.length >= METRIC_BATCH_MAX_SIZE,\n maxBatchAge: METRIC_BATCH_MAX_AGE_MS,\n pageVisibility,\n })\n ).handler;\n\n return new OperationalMetricsReporter(handler);\n }\n);\n"]}
|
package/lib/session/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Keyboard } from "./LensKeyboard";
|
package/lib/session/index.js
DELETED
package/lib/session/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"","sourcesContent":["export { Keyboard } from \"./LensKeyboard\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Transform2D";
|
package/lib/transforms/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transforms/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC","sourcesContent":["export * from \"./Transform2D\";\n"]}
|