@snap/camera-kit 1.13.0 → 1.15.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/README.md +1 -1
- package/dist/CameraKit.d.ts +2 -2
- package/dist/CameraKit.d.ts.map +1 -1
- package/dist/CameraKit.js +4 -0
- package/dist/CameraKit.js.map +1 -1
- package/dist/RootServices.d.ts +5 -2
- package/dist/RootServices.d.ts.map +1 -1
- package/dist/RootServices.js.map +1 -1
- package/dist/bootstrapCameraKit.d.ts.map +1 -1
- package/dist/bootstrapCameraKit.js +5 -2
- package/dist/bootstrapCameraKit.js.map +1 -1
- package/dist/clients/metricsClient.d.ts +16 -3
- package/dist/clients/metricsClient.d.ts.map +1 -1
- package/dist/clients/metricsClient.js +14 -6
- package/dist/clients/metricsClient.js.map +1 -1
- package/dist/configuration.d.ts +52 -2
- package/dist/configuration.d.ts.map +1 -1
- package/dist/configuration.js +1 -0
- package/dist/configuration.js.map +1 -1
- package/dist/environment.js +1 -1
- package/dist/environment.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lens/analytics/lensAnalyticEventsHandler.d.ts +9 -0
- package/dist/lens/analytics/lensAnalyticEventsHandler.d.ts.map +1 -0
- package/dist/lens/analytics/lensAnalyticEventsHandler.js +5 -0
- package/dist/lens/analytics/lensAnalyticEventsHandler.js.map +1 -0
- package/dist/lens/analytics/registerLensAnalyticEventsHandler.d.ts +35 -0
- package/dist/lens/analytics/registerLensAnalyticEventsHandler.d.ts.map +1 -0
- package/dist/lens/analytics/registerLensAnalyticEventsHandler.js +13 -0
- package/dist/lens/analytics/registerLensAnalyticEventsHandler.js.map +1 -0
- package/dist/lens-client-interface/filePicker.d.ts +5 -1
- package/dist/lens-client-interface/filePicker.d.ts.map +1 -1
- package/dist/lens-client-interface/filePicker.js.map +1 -1
- package/dist/lensCoreWasmVersions.js +3 -3
- package/dist/lensCoreWasmVersions.js.map +1 -1
- package/dist/remote-configuration/configurationProvider.d.ts +15 -0
- package/dist/remote-configuration/configurationProvider.d.ts.map +1 -0
- package/dist/remote-configuration/configurationProvider.js +32 -0
- package/dist/remote-configuration/configurationProvider.js.map +1 -0
- package/dist/remote-configuration/preloadConfiguration.d.ts.map +1 -1
- package/dist/remote-configuration/preloadConfiguration.js +18 -6
- package/dist/remote-configuration/preloadConfiguration.js.map +1 -1
- package/dist/remote-configuration/util.d.ts +4 -0
- package/dist/remote-configuration/util.d.ts.map +1 -0
- package/dist/remote-configuration/util.js +17 -0
- package/dist/remote-configuration/util.js.map +1 -0
- package/dist/uri-handlers/internal-handlers/httpUriHandler.d.ts +7 -5
- package/dist/uri-handlers/internal-handlers/httpUriHandler.d.ts.map +1 -1
- package/dist/uri-handlers/internal-handlers/httpUriHandler.js +4 -4
- package/dist/uri-handlers/internal-handlers/httpUriHandler.js.map +1 -1
- package/dist/uri-handlers/internal-handlers/httpValidators.d.ts +2 -1
- package/dist/uri-handlers/internal-handlers/httpValidators.d.ts.map +1 -1
- package/dist/uri-handlers/internal-handlers/httpValidators.js +13 -1
- package/dist/uri-handlers/internal-handlers/httpValidators.js.map +1 -1
- package/dist/uri-handlers/uriHandlersRegister.d.ts.map +1 -1
- package/dist/uri-handlers/uriHandlersRegister.js +1 -1
- package/dist/uri-handlers/uriHandlersRegister.js.map +1 -1
- package/docs/html/assets/hierarchy.js +1 -1
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/CameraKit.html +2 -2
- package/docs/html/classes/CameraKitSession.html +2 -2
- package/docs/html/classes/CameraKitSource.html +2 -2
- package/docs/html/classes/LensPerformanceMeasurement.html +2 -2
- package/docs/html/classes/LensPerformanceMetrics.html +2 -2
- package/docs/html/classes/LensRepository.html +2 -2
- package/docs/html/classes/Transform2D.html +2 -2
- package/docs/html/classes/TypedCustomEvent.html +3 -3
- package/docs/html/classes/TypedEventTarget.html +2 -2
- package/docs/html/enums/Lens_CameraFacing.html +2 -2
- package/docs/html/functions/bootstrapCameraKit.html +2 -2
- package/docs/html/functions/createExtension.html +2 -2
- package/docs/html/functions/createImageSource.html +2 -2
- package/docs/html/functions/createMediaStreamSource.html +2 -2
- package/docs/html/functions/createVideoSource.html +2 -2
- package/docs/html/functions/estimateLensPerformance.html +2 -2
- package/docs/html/functions/filePickerFactory.html +2 -2
- package/docs/html/functions/getExtensionRequestContext.html +2 -2
- package/docs/html/functions/lensSourcesFactory.html +2 -2
- package/docs/html/functions/remoteApiServicesFactory.html +1 -1
- package/docs/html/hierarchy.html +1 -1
- package/docs/html/index.html +3 -3
- package/docs/html/interfaces/BitmojiUserInfo.html +2 -2
- package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +24 -5
- package/docs/html/interfaces/CameraKitDeviceOptions.html +3 -3
- package/docs/html/interfaces/CameraKitSourceInfo.html +2 -2
- package/docs/html/interfaces/CameraKitSourceSubscriber.html +2 -2
- package/docs/html/interfaces/ComputedFrameMetrics.html +2 -2
- package/docs/html/interfaces/CreateSessionOptions.html +2 -2
- package/docs/html/interfaces/EstimatedLensPerformance.html +2 -2
- package/docs/html/interfaces/Font.html +2 -2
- package/docs/html/interfaces/FriendUserInfo.html +2 -2
- package/docs/html/interfaces/FunctionSourceOptions.html +2 -2
- package/docs/html/interfaces/Keyboard.html +2 -2
- package/docs/html/interfaces/KeyboardActiveEvent.html +2 -2
- package/docs/html/interfaces/Lens.html +2 -2
- package/docs/html/interfaces/LensCreator.html +2 -2
- package/docs/html/interfaces/LensHttpRequest.html +2 -2
- package/docs/html/interfaces/LensLaunchData.html +2 -2
- package/docs/html/interfaces/LensSource.html +2 -2
- package/docs/html/interfaces/LensUserData.html +2 -2
- package/docs/html/interfaces/LoadAssetRequest.html +2 -2
- package/docs/html/interfaces/MediaStreamSourceOptions.html +3 -3
- package/docs/html/interfaces/Preview.html +2 -2
- package/docs/html/interfaces/RemoteApiRequest.html +2 -2
- package/docs/html/interfaces/RemoteApiResponse.html +2 -2
- package/docs/html/interfaces/RemoteApiService.html +2 -2
- package/docs/html/interfaces/ScreenRegion.html +2 -2
- package/docs/html/interfaces/Snapcode.html +2 -2
- package/docs/html/interfaces/UriCancelRequest.html +2 -2
- package/docs/html/interfaces/UriRequest.html +2 -2
- package/docs/html/interfaces/UriResponse.html +2 -2
- package/docs/html/interfaces/VideoSourceOptions.html +3 -3
- package/docs/html/modules.html +1 -1
- package/docs/html/types/ArgumentValidationError.html +2 -2
- package/docs/html/types/AssetLoader.html +2 -2
- package/docs/html/types/AssetResponse.html +1 -1
- package/docs/html/types/AssetTiming.html +2 -2
- package/docs/html/types/BenchmarkError.html +1 -1
- package/docs/html/types/BootstrapError.html +2 -2
- package/docs/html/types/CacheKeyNotFoundError.html +1 -1
- package/docs/html/types/CameraKitSessionEventListener.html +2 -2
- package/docs/html/types/CameraKitSessionEvents.html +2 -2
- package/docs/html/types/CameraKitSourceError.html +1 -1
- package/docs/html/types/ConfigurationError.html +2 -2
- package/docs/html/types/FetchHandler.html +1 -1
- package/docs/html/types/FilePicker.html +4 -4
- package/docs/html/types/FilePickerOptions.html +2 -2
- package/docs/html/types/FilePickerResult.html +2 -2
- package/docs/html/types/KeyboardEventListener.html +2 -2
- package/docs/html/types/KeyboardEvents.html +2 -2
- package/docs/html/types/LegalError.html +1 -1
- package/docs/html/types/LensAbortError.html +2 -2
- package/docs/html/types/LensAssetError.html +2 -2
- package/docs/html/types/LensContentValidationError.html +1 -1
- package/docs/html/types/LensError.html +1 -1
- package/docs/html/types/LensExecutionError.html +2 -2
- package/docs/html/types/LensHttpHandler.html +2 -2
- package/docs/html/types/LensImagePickerError.html +2 -2
- package/docs/html/types/LensLaunchParams.html +2 -2
- package/docs/html/types/LensMetricsEvents.html +2 -2
- package/docs/html/types/LensPerformanceCluster.html +1 -1
- package/docs/html/types/LensView.html +2 -2
- package/docs/html/types/LensWait.html +2 -2
- package/docs/html/types/LogLevel.html +2 -2
- package/docs/html/types/Logger.html +2 -2
- package/docs/html/types/Matrix.html +2 -2
- package/docs/html/types/OpenDefaultFilePicker.html +2 -0
- package/docs/html/types/PersistentStoreError.html +2 -2
- package/docs/html/types/PickedFile.html +2 -0
- package/docs/html/types/PlatformNotSupportedError.html +2 -2
- package/docs/html/types/PublicContainer.html +2 -2
- package/docs/html/types/PublicServices.html +2 -2
- package/docs/html/types/RemoteApiCancelRequestHandler.html +2 -2
- package/docs/html/types/RemoteApiRequestHandler.html +2 -2
- package/docs/html/types/RemoteApiServices.html +1 -1
- package/docs/html/types/RemoteApiStatus.html +2 -2
- package/docs/html/types/RenderTarget.html +2 -2
- package/docs/html/types/ScreenRegionType.html +2 -2
- package/docs/html/types/ScreenRegions.html +2 -2
- package/docs/html/types/Uri.html +1 -1
- package/docs/html/types/ValidationStrategy.html +11 -0
- package/docs/html/types/WebGLError.html +1 -1
- package/docs/html/types/Zodiac.html +1 -1
- package/docs/html/variables/extensionRequestContext.html +2 -2
- package/docs/md/README.md +2 -2
- package/docs/md/classes/CameraKit.md +1 -1
- package/docs/md/classes/CameraKitSession.md +1 -1
- package/docs/md/classes/CameraKitSource.md +1 -1
- package/docs/md/classes/LensPerformanceMeasurement.md +1 -1
- package/docs/md/classes/LensPerformanceMetrics.md +1 -1
- package/docs/md/classes/LensRepository.md +1 -1
- package/docs/md/classes/Transform2D.md +1 -1
- package/docs/md/classes/TypedCustomEvent.md +1 -1
- package/docs/md/classes/TypedEventTarget.md +1 -1
- package/docs/md/enumerations/Lens_CameraFacing.md +1 -1
- package/docs/md/functions/bootstrapCameraKit.md +1 -1
- package/docs/md/functions/createExtension.md +1 -1
- package/docs/md/functions/createImageSource.md +1 -1
- package/docs/md/functions/createMediaStreamSource.md +1 -1
- package/docs/md/functions/createVideoSource.md +1 -1
- package/docs/md/functions/estimateLensPerformance.md +1 -1
- package/docs/md/functions/filePickerFactory.md +1 -1
- package/docs/md/functions/getExtensionRequestContext.md +1 -1
- package/docs/md/functions/lensSourcesFactory.md +1 -1
- package/docs/md/functions/remoteApiServicesFactory.md +1 -1
- package/docs/md/globals.md +5 -2
- package/docs/md/interfaces/BitmojiUserInfo.md +1 -1
- package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +43 -3
- package/docs/md/interfaces/CameraKitDeviceOptions.md +1 -1
- package/docs/md/interfaces/CameraKitSourceInfo.md +1 -1
- package/docs/md/interfaces/CameraKitSourceSubscriber.md +1 -1
- 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/Font.md +1 -1
- package/docs/md/interfaces/FriendUserInfo.md +1 -1
- package/docs/md/interfaces/FunctionSourceOptions.md +1 -1
- package/docs/md/interfaces/Keyboard.md +1 -1
- package/docs/md/interfaces/KeyboardActiveEvent.md +1 -1
- package/docs/md/interfaces/Lens.md +1 -1
- package/docs/md/interfaces/LensCreator.md +1 -1
- package/docs/md/interfaces/LensHttpRequest.md +1 -1
- package/docs/md/interfaces/LensLaunchData.md +1 -1
- package/docs/md/interfaces/LensSource.md +1 -1
- package/docs/md/interfaces/LensUserData.md +1 -1
- package/docs/md/interfaces/LoadAssetRequest.md +1 -1
- package/docs/md/interfaces/MediaStreamSourceOptions.md +1 -1
- package/docs/md/interfaces/Preview.md +1 -1
- package/docs/md/interfaces/RemoteApiRequest.md +1 -1
- package/docs/md/interfaces/RemoteApiResponse.md +1 -1
- package/docs/md/interfaces/RemoteApiService.md +1 -1
- package/docs/md/interfaces/ScreenRegion.md +1 -1
- package/docs/md/interfaces/Snapcode.md +1 -1
- package/docs/md/interfaces/UriCancelRequest.md +1 -1
- package/docs/md/interfaces/UriRequest.md +1 -1
- package/docs/md/interfaces/UriResponse.md +1 -1
- package/docs/md/interfaces/VideoSourceOptions.md +1 -1
- package/docs/md/type-aliases/ArgumentValidationError.md +1 -1
- package/docs/md/type-aliases/AssetLoader.md +1 -1
- package/docs/md/type-aliases/AssetResponse.md +1 -1
- package/docs/md/type-aliases/AssetTiming.md +1 -1
- package/docs/md/type-aliases/BenchmarkError.md +1 -1
- package/docs/md/type-aliases/BootstrapError.md +1 -1
- package/docs/md/type-aliases/CacheKeyNotFoundError.md +1 -1
- package/docs/md/type-aliases/CameraKitSessionEventListener.md +1 -1
- package/docs/md/type-aliases/CameraKitSessionEvents.md +1 -1
- package/docs/md/type-aliases/CameraKitSourceError.md +1 -1
- package/docs/md/type-aliases/ConfigurationError.md +1 -1
- package/docs/md/type-aliases/FetchHandler.md +1 -1
- package/docs/md/type-aliases/FilePicker.md +2 -2
- package/docs/md/type-aliases/FilePickerOptions.md +2 -2
- package/docs/md/type-aliases/FilePickerResult.md +2 -2
- package/docs/md/type-aliases/KeyboardEventListener.md +1 -1
- package/docs/md/type-aliases/KeyboardEvents.md +1 -1
- package/docs/md/type-aliases/LegalError.md +1 -1
- package/docs/md/type-aliases/LensAbortError.md +1 -1
- package/docs/md/type-aliases/LensAssetError.md +1 -1
- package/docs/md/type-aliases/LensContentValidationError.md +1 -1
- package/docs/md/type-aliases/LensError.md +1 -1
- package/docs/md/type-aliases/LensExecutionError.md +1 -1
- package/docs/md/type-aliases/LensHttpHandler.md +1 -1
- package/docs/md/type-aliases/LensImagePickerError.md +1 -1
- package/docs/md/type-aliases/LensLaunchParams.md +1 -1
- package/docs/md/type-aliases/LensMetricsEvents.md +1 -1
- package/docs/md/type-aliases/LensPerformanceCluster.md +1 -1
- package/docs/md/type-aliases/LensView.md +1 -1
- package/docs/md/type-aliases/LensWait.md +1 -1
- package/docs/md/type-aliases/LogLevel.md +1 -1
- package/docs/md/type-aliases/Logger.md +1 -1
- package/docs/md/type-aliases/Matrix.md +1 -1
- package/docs/md/type-aliases/OpenDefaultFilePicker.md +11 -0
- package/docs/md/type-aliases/PersistentStoreError.md +1 -1
- package/docs/md/type-aliases/PickedFile.md +11 -0
- package/docs/md/type-aliases/PlatformNotSupportedError.md +1 -1
- package/docs/md/type-aliases/PublicContainer.md +1 -1
- package/docs/md/type-aliases/PublicServices.md +2 -2
- package/docs/md/type-aliases/RemoteApiCancelRequestHandler.md +1 -1
- package/docs/md/type-aliases/RemoteApiRequestHandler.md +1 -1
- package/docs/md/type-aliases/RemoteApiServices.md +1 -1
- package/docs/md/type-aliases/RemoteApiStatus.md +1 -1
- package/docs/md/type-aliases/RenderTarget.md +1 -1
- package/docs/md/type-aliases/ScreenRegionType.md +1 -1
- package/docs/md/type-aliases/ScreenRegions.md +1 -1
- package/docs/md/type-aliases/Uri.md +1 -1
- package/docs/md/type-aliases/ValidationStrategy.md +22 -0
- package/docs/md/type-aliases/WebGLError.md +1 -1
- package/docs/md/type-aliases/Zodiac.md +1 -1
- package/docs/md/variables/extensionRequestContext.md +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,UAAU,EAA8B,MAAM,iBAAiB,CAAC;AAapF,MAAM,oBAAoB,GAAmF;IAIzG,eAAe,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE;IAC7E,MAAM,EAAE,UAAU;IAClB,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,IAAI;IACrB,WAAW,EAAE,2BAA2B;IACxC,eAAe,EAAE,SAAS;IAC1B,KAAK,EAAE,EAAE;IACT,sBAAsB,EAAE,iBAAiB;CAC5C,CAAC;AAwOF,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAKlD,SAAS,oBAAoB;IAIzB,OAAO,CACH,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QAC3C,CAAC,SAAS,CAAC,QAAQ,KAAK,UAAU,IAAI,SAAS,CAAC,cAAc,GAAG,CAAC,CAAC,CACtE,CAAC;AACN,CAAC;AAGD,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,aAA8C,EAAE,EAAE;IAElG,MAAM,SAAS,GAAG,yBAAyB,EAAE,CAAC;IAC9C,IAAI,SAAS,EAAE;QACX,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,SAAS,CAAC,CAAC;KAC9D;IACD,OAAO,UAAU,CAAC,kBAAkB,EAAE,GAA2B,EAAE;;QAG/D,MAAM,UAAU,mCACT,aAAa,KAChB,eAAe,EACX,aAAa,CAAC,eAAe,YAAY,OAAO;gBAC5C,CAAC;oBACC,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,eAAgB,CAAC;gBAClF,CAAC,CAAC,aAAa,CAAC,eAAe,GAC1C,CAAC;QACF,iFACO,oBAAoB,KAGvB,eAAe,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,eAAe,KACnF,qBAAqB,CAAC,UAAU,CAAC,GACjC,qBAAqB,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,KACzC,MAAM,EAAE,SAAS,CAAC,MAAA,UAAU,CAAC,MAAM,mCAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAC,IAC3D;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport type { EstimatedLensPerformance } from \"./benchmark/estimateLensPerformanceCluster\";\nimport { copyDefinedProperties } from \"./common/copyDefinedProperties\";\nimport { getConfigurationOverrides } from \"./configurationOverrides\";\nimport type { Lens } from \"./lens/Lens\";\nimport { mapLogger, noopLogger, type Logger, type LogLevel } from \"./logger/logger\";\n\n/**\n * From T, pick the set of properties whose values are optional. Create a new type containing only those properties.\n */\ntype PickOptionals<T> = {\n [K in keyof T as T[K] extends Exclude<T[K], undefined> ? never : K]: T[K];\n};\n\n/**\n * Defaults are provided for runtime configuration and any optional bootstrap configuration properties which require\n * defaults.\n */\nconst defaultConfiguration: CameraKitRuntimeConfiguration & PickOptionals<CameraKitBootstrapConfiguration> = {\n // If the applications doesn't provide performance data (e.g. via estimateLensPerformance), we'll use 0 to indicate\n // no performance estimation occurred. This is indicative of typical performance-targeting logic, which often\n // defaults to the lowest-tier experience in the absence of performance cluster data.\n lensPerformance: { cluster: 0, benchmarks: [], webglRendererInfo: \"unknown\" },\n logger: noopLogger,\n logLevel: \"info\",\n shouldUseWorker: true,\n apiHostname: \"camera-kit-api.snapar.com\",\n userAgentFlavor: \"release\",\n fonts: [],\n trustedTypesPolicyName: \"snap-camera-kit\",\n};\n\ninterface CameraKitRuntimeConfiguration {\n lensPerformance: EstimatedLensPerformance | Promise<EstimatedLensPerformance>;\n logger: Logger;\n logLevel: LogLevel;\n shouldUseWorker: boolean;\n apiHostname: CameraKitApiHostname;\n userAgentFlavor: \"release\" | \"debug\";\n fonts: Font[];\n lensHttpHandler?: LensHttpHandler;\n trustedTypesPolicyName: string;\n}\n\nexport type CameraKitApiHostname = \"camera-kit-api.snapar.com\" | \"api-kit.snapchat.com\";\n\n/**\n * Represents a font to be used by Camera Kit for text rendering.\n */\nexport interface Font {\n /**\n * A unique name for the font.\n */\n name: string;\n\n /**\n * A buffer containing the font data (e.g., the contents of a `.ttf` file).\n */\n data: ArrayBuffer;\n}\n\n/**\n * Represents context for an HTTP request made by a Lens.\n *\n * This interface provides detailed information about the request, such as its identifier,\n * method, data payload, headers, and associated Lens object.\n */\nexport interface LensHttpRequest {\n /**\n * The URL of the HTTP request.\n */\n url: string;\n\n /**\n * A unique identifier for the HTTP request.\n */\n identifier: string;\n\n /**\n * The HTTP method of the request (e.g., GET, POST, PUT, DELETE).\n */\n method: string;\n\n /**\n * The raw data payload for the HTTP request, represented as an `ArrayBuffer`.\n */\n data: ArrayBuffer;\n\n /**\n * The headers included in the HTTP request.\n */\n headers: Record<string, string>;\n\n /**\n * The {@link Lens} that initiated this request.\n */\n lens: Lens;\n}\n\n/**\n * A handler function for customizing HTTP requests made by a Lens.\n *\n * This function is called whenever a Lens makes an HTTP request.\n * It allows you to modify the request or response, integrate custom HTTP libraries,\n * add authentication, or log request details.\n *\n * @param url - The URL for the HTTP request.\n * @param init - The initial configuration for the HTTP request, following the Fetch API's `RequestInit`.\n * @param lensRequest - Additional context about the Lens-specific request.\n * @returns A Promise resolving to the HTTP response (`Response`).\n */\nexport type LensHttpHandler = (url: string, init: RequestInit, lensRequest: LensHttpRequest) => Promise<Response>;\n\n/**\n * Configuration which must be provided when calling {@link bootstrapCameraKit}. These values are used to create various\n * CameraKit components.\n *\n * @category Bootstrapping and Configuration\n */\nexport interface CameraKitBootstrapConfiguration {\n /**\n * Long-lived token granting your application access to CameraKit APIs. This is found in the SnapKit Dev Portal,\n * where it's called the API Token.\n */\n apiToken: string;\n\n /**\n * Determine where to print CameraKit log messages. By default no logs will be printed.\n *\n * CameraKit emits log messages to help diagnose and root cause issues that may occur during the development of a\n * host application. The printing of these can be controlled via the following options:\n * - `\"noop\"`: log messages are ignored.\n * - `\"console\"`: log messages are printed to console.\n * - A custom {@link Logger} instance can be provided to integrate with an existing logging system.\n */\n logger?: \"noop\" | \"console\" | Logger;\n\n /**\n * Log only if a logged entry level is greater than or equal to this level. Here is the order of levels:\n * error > warn > log = info > debug. Default value is \"info\".\n */\n logLevel?: LogLevel;\n\n /**\n * Some lenses may decide to modify their behavior based on the performance of the current environment. If you are\n * using such lenses, providing an estimation of lens performance may lead to better user experience (especially on\n * low-performance devices).\n *\n * Running the {@link estimateLensPerformance} function will run benchmarks and estimate an appropriate lens\n * performance cluster (i.e. a performance rating) based on the current environment.\n *\n * Lower cluster = worse expected performance capability.\n *\n * @example\n * ```ts\n * import { bootstrapCameraKit, estimateLensPerformance } from '@snap/camera-kit`\n *\n * const cameraKit = await bootstrapCameraKit({\n * apiToken: '...',\n * lensPerformance: estimateLensPerformance(),\n * })\n * ```\n */\n lensPerformance?: EstimatedLensPerformance | Promise<EstimatedLensPerformance>;\n\n /**\n * In recommended production deployments, the WebAssembly assets required by CameraKit will be downloaded from an\n * optimized CDN. But sometimes (e.g. during development or within a CI pipeline), it may be necessary to download\n * these assets from somewhere else.\n *\n * This configuration option allows the application to specify URLs to be used for both the WebAssembly and JS glue\n * file that are used to run and interact with CameraKit's rendering engine.\n */\n lensCoreOverrideUrls?: { wasm: string; js: string };\n\n /**\n * In recommended production deployments, the WebAssembly assets required by CameraKit will be downloaded from an\n * optimized CDN. But sometimes during development or within a CI pipeline, it may be necessary to download these\n * assets from somewhere else. With a provided `wasmEndpointOverride`, asset URLs will be automatically generated\n * based on this root endpoint.\n */\n wasmEndpointOverride?: string;\n\n /**\n * Applications may optionally provide a unique identifier called analyticsId. This ID would enable Camera Kit to\n * improve data reporting and accuracy and to better support potential needs related to an application's lens and\n * user analytics.\n */\n analyticsId?: string;\n\n /**\n * An array of fonts to be used by Camera Kit for text rendering.\n *\n * Lenses usually have their own font assets, but emojis are often not embedded.\n * As a result, you may need to provide additional fonts (e.g., an emoji font) to ensure all glyphs render\n * correctly.\n *\n * @example\n * fonts: [\n * {\n * name: 'EmojiFont',\n * data: emojiFontArrayBuffer, // Your emoji font data goes here\n * },\n * ]\n */\n fonts?: Font[];\n\n /**\n * An optional custom HTTP handler for requests made by a Lens.\n *\n * This handler allows you to intercept and customize the behavior of HTTP requests,\n * such as adding authentication headers, logging request details, or replacing the default\n * HTTP library used by the Lens system.\n *\n * If not specified, the Lens system will use a default HTTP implementation.\n *\n * @example\n * Here is an example of how to configure a custom `LensHttpHandler` to add an authentication token:\n *\n * ```typescript\n * const customLensHttpHandler: LensHttpHandler = async (url, init, lensRequest) => {\n * // Add an authentication token to the headers\n * const sessionToken = await getAuthToken();\n * const updatedInit = {\n * ...init,\n * headers: {\n * ...init.headers,\n * 'Authorization': `Bearer ${sessionToken}`,\n * },\n * };\n *\n * // Log the request details for debugging\n * console.log(`Requesting ${lensRequest.url} from lens: ${lensRequest.lens.name}`);\n *\n * // Use fetch to perform the HTTP request\n * return fetch(url, updatedInit);\n * };\n *\n * const cameraKit = bootstrapCameraKit({\n * apiToken,\n * lensHttpHandler: customLensHttpHandler,\n * });\n * ```\n */\n lensHttpHandler?: LensHttpHandler;\n\n /**\n * The name of the Trusted Types policy to use when loading scripts.\n * Defaults to \"snap-camera-kit\".\n */\n trustedTypesPolicyName?: string;\n}\n\n/**\n * This type represents the result of merging user-supplied config with default config -- as such, it has no nullable\n * fields, making it a more convenient type for other components to use.\n *\n * @internal\n */\nexport type CameraKitConfiguration = CameraKitRuntimeConfiguration & CameraKitBootstrapConfiguration;\n\n/** @internal */\nexport const configurationToken = \"configuration\";\n\n/**\n * Returns true if given browser is iPhone, iPad or iPod.\n */\nfunction isHandledAppleDevice() {\n // We use the same approach LC uses:\n // eslint-disable-next-line max-len\n // https://github.sc-corp.net/Snapchat/LensCore/blob/285ac47cad7fe5268f38d1bab82d51b7b19d6b48/Src/PlatformSpecific/WebAssembly/WebEnvironmentInfo.cpp#L81\n return (\n /iPad|iPhone|iPod/.test(navigator.platform) ||\n (navigator.platform === \"MacIntel\" && navigator.maxTouchPoints > 2)\n );\n}\n\n/** @internal */\nexport const createCameraKitConfigurationFactory = (configuration: CameraKitBootstrapConfiguration) => {\n // always leave debug mode warning about overrides in console\n const overrides = getConfigurationOverrides();\n if (overrides) {\n console.warn(\"Configuration overrides applied\", overrides);\n }\n return Injectable(configurationToken, (): CameraKitConfiguration => {\n // We'll ensure that we handle errors on any Promises passed as config values, otherwise we either must\n // handle them separately wherever they're used, or rejections would go unhandled.\n const safeConfig: CameraKitBootstrapConfiguration = {\n ...configuration,\n lensPerformance:\n configuration.lensPerformance instanceof Promise\n ? // Safety: defaultConfiguration.lensPerformance is defined (it's hardcoded above).\n configuration.lensPerformance.catch(() => defaultConfiguration.lensPerformance!)\n : configuration.lensPerformance,\n };\n return {\n ...defaultConfiguration,\n // TODO: Safari 17 has an issue with offscreen canvas which results in stuttering effect on iOS.\n // Once Safari has that fixed, we should remove this check, see https://jira.sc-corp.net/browse/CAMKIT-5985\n shouldUseWorker: isHandledAppleDevice() ? false : defaultConfiguration.shouldUseWorker,\n ...copyDefinedProperties(safeConfig),\n ...copyDefinedProperties(overrides ?? {}),\n logger: mapLogger(safeConfig.logger ?? overrides?.logger),\n };\n });\n};\n"]}
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../src/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,UAAU,EAA8B,MAAM,iBAAiB,CAAC;AAapF,MAAM,oBAAoB,GAAmF;IAIzG,eAAe,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE;IAC7E,MAAM,EAAE,UAAU;IAClB,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,IAAI;IACrB,WAAW,EAAE,2BAA2B;IACxC,eAAe,EAAE,SAAS;IAC1B,KAAK,EAAE,EAAE;IACT,0BAA0B,EAAE,QAAQ;IACpC,sBAAsB,EAAE,iBAAiB;CAC5C,CAAC;AA4RF,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAKlD,SAAS,oBAAoB;IAIzB,OAAO,CACH,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QAC3C,CAAC,SAAS,CAAC,QAAQ,KAAK,UAAU,IAAI,SAAS,CAAC,cAAc,GAAG,CAAC,CAAC,CACtE,CAAC;AACN,CAAC;AAGD,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,aAA8C,EAAE,EAAE;IAElG,MAAM,SAAS,GAAG,yBAAyB,EAAE,CAAC;IAC9C,IAAI,SAAS,EAAE;QACX,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,SAAS,CAAC,CAAC;KAC9D;IACD,OAAO,UAAU,CAAC,kBAAkB,EAAE,GAA2B,EAAE;;QAG/D,MAAM,UAAU,mCACT,aAAa,KAChB,eAAe,EACX,aAAa,CAAC,eAAe,YAAY,OAAO;gBAC5C,CAAC;oBACC,aAAa,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,eAAgB,CAAC;gBAClF,CAAC,CAAC,aAAa,CAAC,eAAe,GAC1C,CAAC;QAEF,iFACO,oBAAoB,KAGvB,eAAe,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,eAAe,KACnF,qBAAqB,CAAC,UAAU,CAAC,GACjC,qBAAqB,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,KACzC,MAAM,EAAE,SAAS,CAAC,MAAA,UAAU,CAAC,MAAM,mCAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAC,IAC3D;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport type { EstimatedLensPerformance } from \"./benchmark/estimateLensPerformanceCluster\";\nimport { copyDefinedProperties } from \"./common/copyDefinedProperties\";\nimport { getConfigurationOverrides } from \"./configurationOverrides\";\nimport type { Lens } from \"./lens/Lens\";\nimport { mapLogger, noopLogger, type Logger, type LogLevel } from \"./logger/logger\";\n\n/**\n * From T, pick the set of properties whose values are optional. Create a new type containing only those properties.\n */\ntype PickOptionals<T> = {\n [K in keyof T as T[K] extends Exclude<T[K], undefined> ? never : K]: T[K];\n};\n\n/**\n * Defaults are provided for runtime configuration and any optional bootstrap configuration properties which require\n * defaults.\n */\nconst defaultConfiguration: CameraKitRuntimeConfiguration & PickOptionals<CameraKitBootstrapConfiguration> = {\n // If the applications doesn't provide performance data (e.g. via estimateLensPerformance), we'll use 0 to indicate\n // no performance estimation occurred. This is indicative of typical performance-targeting logic, which often\n // defaults to the lowest-tier experience in the absence of performance cluster data.\n lensPerformance: { cluster: 0, benchmarks: [], webglRendererInfo: \"unknown\" },\n logger: noopLogger,\n logLevel: \"info\",\n shouldUseWorker: true,\n apiHostname: \"camera-kit-api.snapar.com\",\n userAgentFlavor: \"release\",\n fonts: [],\n lensHttpValidationStrategy: \"strict\",\n trustedTypesPolicyName: \"snap-camera-kit\",\n};\n\ninterface CameraKitRuntimeConfiguration {\n lensPerformance: EstimatedLensPerformance | Promise<EstimatedLensPerformance>;\n logger: Logger;\n logLevel: LogLevel;\n shouldUseWorker: boolean;\n apiHostname: CameraKitApiHostname;\n userAgentFlavor: \"release\" | \"debug\";\n fonts: Font[];\n lensHttpHandler?: LensHttpHandler;\n lensHttpValidationStrategy: ValidationStrategy;\n trustedTypesPolicyName: string;\n}\n\nexport type CameraKitApiHostname = \"camera-kit-api.snapar.com\" | \"api-kit.snapchat.com\";\n\n/**\n * Defines how Camera Kit handles lens HTTP requests against Remote API specs in the My Lenses portal.\n *\n * - `\"deny\"`: Rejects all lens HTTP requests.\n * - `\"strict\"`: Full validation: host + path + method + path parameters + query parameters + headers. Default.\n * - `\"route\"`: Validates host + path + method + path parameters (skips query parameters and headers).\n * - `\"host\"`: Validates host only.\n * - `\"unrestricted\"`: No validation.\n *\n * @remarks\n * Use `\"unrestricted\"` only if you fully trust your lens developers. Lenses will be able to make\n * HTTP requests to any endpoint without validation against the allowlist.\n */\nexport type ValidationStrategy = \"deny\" | \"strict\" | \"route\" | \"host\" | \"unrestricted\";\n\n/**\n * Represents a font to be used by Camera Kit for text rendering.\n */\nexport interface Font {\n /**\n * A unique name for the font.\n */\n name: string;\n\n /**\n * A buffer containing the font data (e.g., the contents of a `.ttf` file).\n */\n data: ArrayBuffer;\n}\n\n/**\n * Represents context for an HTTP request made by a Lens.\n *\n * This interface provides detailed information about the request, such as its identifier,\n * method, data payload, headers, and associated Lens object.\n */\nexport interface LensHttpRequest {\n /**\n * The URL of the HTTP request.\n */\n url: string;\n\n /**\n * A unique identifier for the HTTP request.\n */\n identifier: string;\n\n /**\n * The HTTP method of the request (e.g., GET, POST, PUT, DELETE).\n */\n method: string;\n\n /**\n * The raw data payload for the HTTP request, represented as an `ArrayBuffer`.\n */\n data: ArrayBuffer;\n\n /**\n * The headers included in the HTTP request.\n */\n headers: Record<string, string>;\n\n /**\n * The {@link Lens} that initiated this request.\n */\n lens: Lens;\n}\n\n/**\n * A handler function for customizing HTTP requests made by a Lens.\n *\n * This function is called whenever a Lens makes an HTTP request.\n * It allows you to modify the request or response, integrate custom HTTP libraries,\n * add authentication, or log request details.\n *\n * @param url - The URL for the HTTP request.\n * @param init - The initial configuration for the HTTP request, following the Fetch API's `RequestInit`.\n * @param lensRequest - Additional context about the Lens-specific request.\n * @returns A Promise resolving to the HTTP response (`Response`).\n */\nexport type LensHttpHandler = (url: string, init: RequestInit, lensRequest: LensHttpRequest) => Promise<Response>;\n\n/**\n * Configuration which must be provided when calling {@link bootstrapCameraKit}. These values are used to create various\n * CameraKit components.\n *\n * @category Bootstrapping and Configuration\n */\nexport interface CameraKitBootstrapConfiguration {\n /**\n * Long-lived token granting your application access to CameraKit APIs. This is found in the SnapKit Dev Portal,\n * where it's called the API Token.\n */\n apiToken: string;\n\n /**\n * Determine where to print CameraKit log messages. By default no logs will be printed.\n *\n * CameraKit emits log messages to help diagnose and root cause issues that may occur during the development of a\n * host application. The printing of these can be controlled via the following options:\n * - `\"noop\"`: log messages are ignored.\n * - `\"console\"`: log messages are printed to console.\n * - A custom {@link Logger} instance can be provided to integrate with an existing logging system.\n */\n logger?: \"noop\" | \"console\" | Logger;\n\n /**\n * Log only if a logged entry level is greater than or equal to this level. Here is the order of levels:\n * error > warn > log = info > debug. Default value is \"info\".\n */\n logLevel?: LogLevel;\n\n /**\n * Some lenses may decide to modify their behavior based on the performance of the current environment. If you are\n * using such lenses, providing an estimation of lens performance may lead to better user experience (especially on\n * low-performance devices).\n *\n * Running the {@link estimateLensPerformance} function will run benchmarks and estimate an appropriate lens\n * performance cluster (i.e. a performance rating) based on the current environment.\n *\n * Lower cluster = worse expected performance capability.\n *\n * @example\n * ```ts\n * import { bootstrapCameraKit, estimateLensPerformance } from '@snap/camera-kit`\n *\n * const cameraKit = await bootstrapCameraKit({\n * apiToken: '...',\n * lensPerformance: estimateLensPerformance(),\n * })\n * ```\n */\n lensPerformance?: EstimatedLensPerformance | Promise<EstimatedLensPerformance>;\n\n /**\n * In recommended production deployments, the WebAssembly assets required by CameraKit will be downloaded from an\n * optimized CDN. But sometimes (e.g. during development or within a CI pipeline), it may be necessary to download\n * these assets from somewhere else.\n *\n * This configuration option allows the application to specify URLs to be used for both the WebAssembly and JS glue\n * file that are used to run and interact with CameraKit's rendering engine.\n */\n lensCoreOverrideUrls?: { wasm: string; js: string };\n\n /**\n * In recommended production deployments, the WebAssembly assets required by CameraKit will be downloaded from an\n * optimized CDN. But sometimes during development or within a CI pipeline, it may be necessary to download these\n * assets from somewhere else. With a provided `wasmEndpointOverride`, asset URLs will be automatically generated\n * based on this root endpoint.\n */\n wasmEndpointOverride?: string;\n\n /**\n * Applications may optionally provide a unique identifier called analyticsId. This ID would enable Camera Kit to\n * improve data reporting and accuracy and to better support potential needs related to an application's lens and\n * user analytics.\n */\n analyticsId?: string;\n\n /**\n * An array of fonts to be used by Camera Kit for text rendering.\n *\n * Lenses usually have their own font assets, but emojis are often not embedded.\n * As a result, you may need to provide additional fonts (e.g., an emoji font) to ensure all glyphs render\n * correctly.\n *\n * @example\n * fonts: [\n * {\n * name: 'EmojiFont',\n * data: emojiFontArrayBuffer, // Your emoji font data goes here\n * },\n * ]\n */\n fonts?: Font[];\n\n /**\n * An optional custom HTTP handler for requests made by a Lens.\n *\n * This handler allows you to intercept and customize the behavior of HTTP requests,\n * such as adding authentication headers, logging request details, or replacing the default\n * HTTP library used by the Lens system.\n *\n * If not specified, the Lens system will use a default HTTP implementation.\n *\n * @example\n * ```typescript\n * const customLensHttpHandler: LensHttpHandler = async (url, init, lensRequest) => {\n * // Add an authentication token to the headers\n * const sessionToken = await getAuthToken();\n * const updatedInit = {\n * ...init,\n * headers: {\n * ...init.headers,\n * 'Authorization': `Bearer ${sessionToken}`,\n * },\n * };\n *\n * // Log the request details for debugging\n * console.log(`Requesting ${lensRequest.url} from lens: ${lensRequest.lens.name}`);\n *\n * // Use fetch to perform the HTTP request\n * return fetch(url, updatedInit);\n * };\n *\n * const cameraKit = bootstrapCameraKit({\n * apiToken,\n * lensHttpHandler: customLensHttpHandler,\n * });\n * ```\n */\n lensHttpHandler?: LensHttpHandler;\n\n /**\n * Configures how Camera Kit validates lens HTTP requests against Remote API specs.\n *\n * Available strategies:\n * - `\"deny\"`: Rejects all lens HTTP requests.\n * - `\"strict\"` (default): Full validation of host, path, method, and parameters.\n * - `\"route\"`: Validates host, path (including path parameters), and method.\n * Skips validation of query parameters and headers.\n * - `\"host\"`: Only validates the host.\n * - `\"unrestricted\"`: No validation.\n *\n * @remarks\n * Use `\"unrestricted\"` only if you fully trust your lens developers, as lenses will be able to make\n * HTTP requests to any endpoint without validation.\n *\n * @example\n * ```typescript\n * const cameraKit = bootstrapCameraKit({\n * apiToken,\n * lensHttpValidationStrategy: \"host\",\n * });\n * ```\n *\n * @example\n * Combine with custom handler:\n * ```typescript\n * const cameraKit = bootstrapCameraKit({\n * apiToken,\n * lensHttpValidationStrategy: \"unrestricted\",\n * lensHttpHandler: async (url, init, lensRequest) => {\n * // Custom logic here\n * return fetch(url, init);\n * },\n * });\n * ```\n */\n lensHttpValidationStrategy?: ValidationStrategy;\n\n /**\n * The name of the Trusted Types policy to use when loading scripts.\n * Defaults to \"snap-camera-kit\".\n */\n trustedTypesPolicyName?: string;\n}\n\n/**\n * This type represents the result of merging user-supplied config with default config -- as such, it has no nullable\n * fields, making it a more convenient type for other components to use.\n *\n * @internal\n */\nexport type CameraKitConfiguration = CameraKitRuntimeConfiguration & CameraKitBootstrapConfiguration;\n\n/** @internal */\nexport const configurationToken = \"configuration\";\n\n/**\n * Returns true if given browser is iPhone, iPad or iPod.\n */\nfunction isHandledAppleDevice() {\n // We use the same approach LC uses:\n // eslint-disable-next-line max-len\n // https://github.sc-corp.net/Snapchat/LensCore/blob/285ac47cad7fe5268f38d1bab82d51b7b19d6b48/Src/PlatformSpecific/WebAssembly/WebEnvironmentInfo.cpp#L81\n return (\n /iPad|iPhone|iPod/.test(navigator.platform) ||\n (navigator.platform === \"MacIntel\" && navigator.maxTouchPoints > 2)\n );\n}\n\n/** @internal */\nexport const createCameraKitConfigurationFactory = (configuration: CameraKitBootstrapConfiguration) => {\n // always leave debug mode warning about overrides in console\n const overrides = getConfigurationOverrides();\n if (overrides) {\n console.warn(\"Configuration overrides applied\", overrides);\n }\n return Injectable(configurationToken, (): CameraKitConfiguration => {\n // We'll ensure that we handle errors on any Promises passed as config values, otherwise we either must\n // handle them separately wherever they're used, or rejections would go unhandled.\n const safeConfig: CameraKitBootstrapConfiguration = {\n ...configuration,\n lensPerformance:\n configuration.lensPerformance instanceof Promise\n ? // Safety: defaultConfiguration.lensPerformance is defined (it's hardcoded above).\n configuration.lensPerformance.catch(() => defaultConfiguration.lensPerformance!)\n : configuration.lensPerformance,\n };\n\n return {\n ...defaultConfiguration,\n // TODO: Safari 17 has an issue with offscreen canvas which results in stuttering effect on iOS.\n // Once Safari has that fixed, we should remove this check, see https://jira.sc-corp.net/browse/CAMKIT-5985\n shouldUseWorker: isHandledAppleDevice() ? false : defaultConfiguration.shouldUseWorker,\n ...copyDefinedProperties(safeConfig),\n ...copyDefinedProperties(overrides ?? {}),\n logger: mapLogger(safeConfig.logger ?? overrides?.logger),\n };\n });\n};\n"]}
|
package/dist/environment.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default { PACKAGE_VERSION: "1.
|
|
1
|
+
export default { PACKAGE_VERSION: "1.15.0" };
|
|
2
2
|
//# sourceMappingURL=environment.js.map
|
package/dist/environment.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["export default { PACKAGE_VERSION: \"1.
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["export default { PACKAGE_VERSION: \"1.15.0\" };\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Container, Injectable, InjectableCompat, ConcatInjectable, PartialContainer } from "@snap/ts-inject";
|
|
2
2
|
export { Keyboard, KeyboardEvents, KeyboardActiveEvent, KeyboardEventListener } from "./session/LensKeyboard";
|
|
3
|
-
export { CameraKitConfiguration, CameraKitBootstrapConfiguration, configurationToken, Font, LensHttpRequest, LensHttpHandler, } from "./configuration";
|
|
3
|
+
export { CameraKitConfiguration, CameraKitBootstrapConfiguration, configurationToken, Font, LensHttpRequest, LensHttpHandler, ValidationStrategy, } from "./configuration";
|
|
4
4
|
export { estimateLensPerformance, EstimatedLensPerformance, LensPerformanceCluster, } from "./benchmark/estimateLensPerformanceCluster";
|
|
5
5
|
export { createExtension, bootstrapCameraKit, PublicContainer } from "./bootstrapCameraKit";
|
|
6
6
|
export { PublicServices } from "./RootServices";
|
|
@@ -9,7 +9,7 @@ export { LensSource, lensSourcesFactory } from "./lens/LensSource";
|
|
|
9
9
|
export { Uri, UriRequest, UriResponse, UriCancelRequest, UriHandler, UriHandlers, uriHandlersFactory, } from "./uri-handlers/UriHandlers";
|
|
10
10
|
export { RemoteApiCancelRequestHandler, RemoteApiRequest, RemoteApiRequestHandler, RemoteApiResponse, RemoteApiService, RemoteApiServices, RemoteApiStatus, remoteApiServicesFactory, } from "./uri-handlers/internal-handlers/remoteApiUriHandler";
|
|
11
11
|
export { CameraKit, CreateSessionOptions, LensMetricsEvents } from "./CameraKit";
|
|
12
|
-
export { externalMetricsSubjectFactory } from "./clients/metricsClient";
|
|
12
|
+
export { externalMetricsSubjectFactory, externalMetricsFactory } from "./clients/metricsClient";
|
|
13
13
|
export { Count } from "./metrics/operational/Count";
|
|
14
14
|
export { Histogram } from "./metrics/operational/Histogram";
|
|
15
15
|
export { Metric } from "./metrics/operational/Metric";
|
|
@@ -39,8 +39,10 @@ export { TypedEventTarget } from "./events/TypedEventTarget";
|
|
|
39
39
|
export { namedError } from "./namedErrors";
|
|
40
40
|
export { Any } from "./generated-proto/pb_schema/google/protobuf/any";
|
|
41
41
|
export { LensCore } from "./lens-core-module/lensCore";
|
|
42
|
-
export { FilePickerOptions, FilePickerResult,
|
|
42
|
+
export { filePickerFactory, FilePicker, FilePickerOptions, FilePickerResult, OpenDefaultFilePicker, PickedFile, } from "./lens-client-interface/filePicker";
|
|
43
43
|
export { userDataAccessResolverFactory, UserDataAccessResolver } from "./lens/userDataAccessResolver";
|
|
44
44
|
export { geoDataProviderFactory, GeoDataProvider, GeoData, WeatherData, HourlyWeatherForecast, } from "./geo/geoDataProvider";
|
|
45
45
|
export { Logger, LogLevel } from "./logger/logger";
|
|
46
|
+
export { lensAnalyticEventsHandlerFactory } from "./lens/analytics/lensAnalyticEventsHandler";
|
|
47
|
+
export type { AnalyticsEventsHandler, LensAnalytics, LensAnalyticsEvent, CreatorAnalyticsEvent, CameraType, } from "./lens/analytics/registerLensAnalyticEventsHandler";
|
|
46
48
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"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O,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AAC9F,YAAY,EACR,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,UAAU,GACb,MAAM,oDAAoD,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { lensSourcesFactory } from "./lens/LensSource";
|
|
|
7
7
|
export { uriHandlersFactory, } from "./uri-handlers/UriHandlers";
|
|
8
8
|
export { remoteApiServicesFactory, } from "./uri-handlers/internal-handlers/remoteApiUriHandler";
|
|
9
9
|
export { CameraKit } from "./CameraKit";
|
|
10
|
-
export { externalMetricsSubjectFactory } from "./clients/metricsClient";
|
|
10
|
+
export { externalMetricsSubjectFactory, externalMetricsFactory } from "./clients/metricsClient";
|
|
11
11
|
export { Count } from "./metrics/operational/Count";
|
|
12
12
|
export { Histogram } from "./metrics/operational/Histogram";
|
|
13
13
|
export { Metric } from "./metrics/operational/Metric";
|
|
@@ -30,7 +30,8 @@ export { TypedCustomEvent } from "./events/TypedCustomEvent";
|
|
|
30
30
|
export { TypedEventTarget } from "./events/TypedEventTarget";
|
|
31
31
|
export { namedError } from "./namedErrors";
|
|
32
32
|
export { Any } from "./generated-proto/pb_schema/google/protobuf/any";
|
|
33
|
-
export { filePickerFactory } from "./lens-client-interface/filePicker";
|
|
33
|
+
export { filePickerFactory, } from "./lens-client-interface/filePicker";
|
|
34
34
|
export { userDataAccessResolverFactory } from "./lens/userDataAccessResolver";
|
|
35
35
|
export { geoDataProviderFactory, } from "./geo/geoDataProvider";
|
|
36
|
+
export { lensAnalyticEventsHandlerFactory } from "./lens/analytics/lensAnalyticEventsHandler";
|
|
36
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB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M,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAA4B,MAAM,mCAAmC,CAAC;AACtG,OAAO,EACH,oBAAoB,GAMvB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAsB,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAgB,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG5E,OAAO,EAAE,WAAW,EAAU,MAAM,0BAA0B,CAAC;AAC/D,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,0BAA0B,EAAwB,MAAM,sCAAsC,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,iDAAiD,CAAC;AAGtE,OAAO,EACH,iBAAiB,GAMpB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,6BAA6B,EAA0B,MAAM,+BAA+B,CAAC;AAEtG,OAAO,EACH,sBAAsB,GAKzB,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC","sourcesContent":["export { Container, Injectable, InjectableCompat, ConcatInjectable, PartialContainer } from \"@snap/ts-inject\";\n\nexport { Keyboard, KeyboardEvents, KeyboardActiveEvent, KeyboardEventListener } from \"./session/LensKeyboard\";\nexport {\n CameraKitConfiguration,\n CameraKitBootstrapConfiguration,\n configurationToken,\n Font,\n LensHttpRequest,\n LensHttpHandler,\n ValidationStrategy,\n} from \"./configuration\";\nexport {\n estimateLensPerformance,\n EstimatedLensPerformance,\n LensPerformanceCluster,\n} from \"./benchmark/estimateLensPerformanceCluster\";\nexport { createExtension, bootstrapCameraKit, PublicContainer } from \"./bootstrapCameraKit\";\nexport { PublicServices } from \"./RootServices\";\nexport { extensionRequestContext, getExtensionRequestContext } from \"./extensions/extensionRequestContext\";\nexport { LensSource, lensSourcesFactory } from \"./lens/LensSource\";\nexport {\n Uri,\n UriRequest,\n UriResponse,\n UriCancelRequest,\n UriHandler,\n UriHandlers,\n uriHandlersFactory,\n} from \"./uri-handlers/UriHandlers\";\nexport {\n RemoteApiCancelRequestHandler,\n RemoteApiRequest,\n RemoteApiRequestHandler,\n RemoteApiResponse,\n RemoteApiService,\n RemoteApiServices,\n RemoteApiStatus,\n remoteApiServicesFactory,\n} from \"./uri-handlers/internal-handlers/remoteApiUriHandler\";\nexport { CameraKit, CreateSessionOptions, LensMetricsEvents } from \"./CameraKit\";\nexport { externalMetricsSubjectFactory, externalMetricsFactory } from \"./clients/metricsClient\";\nexport { Count } from \"./metrics/operational/Count\";\nexport { Histogram } from \"./metrics/operational/Histogram\";\nexport { Metric } from \"./metrics/operational/Metric\";\nexport { Timer } from \"./metrics/operational/Timer\";\nexport { LensView } from \"./metrics/reporters/reportLensView\";\nexport { LensWait } from \"./metrics/reporters/reportLensWait\";\nexport { Lens, toPublicLens, Snapcode, Preview, Lens_CameraFacing, LensCreator } from \"./lens/Lens\";\nexport { AssetTiming, LensRepository } from \"./lens/LensRepository\";\nexport {\n LensLaunchData,\n LensUserData,\n BitmojiUserInfo,\n FriendUserInfo,\n LensLaunchParams,\n Zodiac,\n} from \"./lens/LensLaunchData\";\nexport { AssetLoader, LoadAssetRequest, AssetResponse } from \"./lens/assets/LensAssetRepository\";\nexport { defaultFetchHandlerFactory, FetchHandler } from \"./handlers/defaultFetchHandler\";\nexport { remoteMediaAssetLoaderFactory } from \"./lens/assets/remoteMediaAssetLoaderFactory\";\nexport {\n CameraKitSource,\n CameraKitSourceInfo,\n CameraKitDeviceOptions,\n CameraKitSourceSubscriber,\n} from \"./media-sources/CameraKitSource\";\nexport { createMediaStreamSource, MediaStreamSourceOptions } from \"./media-sources/MediaStreamSource\";\nexport {\n createFunctionSource,\n FrameFormat,\n FrameInput,\n FrameOutput,\n FunctionSourceOptions,\n MediaSourceFunction,\n} from \"./media-sources/FunctionSource\";\nexport { createVideoSource, VideoSourceOptions } from \"./media-sources/VideoSource\";\nexport { createImageSource } from \"./media-sources/ImageSource\";\nexport { RenderTarget, CameraKitSession } from \"./session/CameraKitSession\";\nexport { ScreenRegionType, ScreenRegion, ScreenRegions } from \"./session/screenRegions\";\nexport { CameraKitSessionEvents, CameraKitSessionEventListener } from \"./session/CameraKitSessionEvents\";\nexport { Transform2D, Matrix } from \"./transforms/Transform2D\";\nexport * from \"./namedErrors\";\nexport { LensPerformanceMeasurement, ComputedFrameMetrics } from \"./session/LensPerformanceMeasurement\";\nexport { LensPerformanceMetrics } from \"./session/LensPerformanceMetrics\";\nexport { TypedCustomEvent } from \"./events/TypedCustomEvent\";\nexport { TypedEventTarget } from \"./events/TypedEventTarget\";\nexport { namedError } from \"./namedErrors\";\nexport { Any } from \"./generated-proto/pb_schema/google/protobuf/any\";\nexport { LensCore } from \"./lens-core-module/lensCore\";\n\nexport {\n filePickerFactory,\n FilePicker,\n FilePickerOptions,\n FilePickerResult,\n OpenDefaultFilePicker,\n PickedFile,\n} from \"./lens-client-interface/filePicker\";\n\nexport { userDataAccessResolverFactory, UserDataAccessResolver } from \"./lens/userDataAccessResolver\";\n\nexport {\n geoDataProviderFactory,\n GeoDataProvider,\n GeoData,\n WeatherData,\n HourlyWeatherForecast,\n} from \"./geo/geoDataProvider\";\n\nexport { Logger, LogLevel } from \"./logger/logger\";\n\nexport { lensAnalyticEventsHandlerFactory } from \"./lens/analytics/lensAnalyticEventsHandler\";\nexport type {\n AnalyticsEventsHandler,\n LensAnalytics,\n LensAnalyticsEvent,\n CreatorAnalyticsEvent,\n CameraType,\n} from \"./lens/analytics/registerLensAnalyticEventsHandler\";\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export declare const lensAnalyticEventsHandlerFactory: {
|
|
5
|
+
(): import("../../lens-core-module/generated-types").AnalyticsEventsHandler;
|
|
6
|
+
token: "LensAnalyticEventsHandler";
|
|
7
|
+
dependencies: [];
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=lensAnalyticEventsHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lensAnalyticEventsHandler.d.ts","sourceRoot":"","sources":["../../../src/lens/analytics/lensAnalyticEventsHandler.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,gCAAgC;;;;CAE3C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lensAnalyticEventsHandler.js","sourceRoot":"","sources":["../../../src/lens/analytics/lensAnalyticEventsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAM7C,MAAM,CAAC,MAAM,gCAAgC,GAAG,UAAU,CAAC,2BAA2B,EAAE,GAA2B,EAAE;IACjH,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport type { AnalyticsEventsHandler } from \"./registerLensAnalyticEventsHandler\";\n\n/**\n * @internal\n */\nexport const lensAnalyticEventsHandlerFactory = Injectable(\"LensAnalyticEventsHandler\", (): AnalyticsEventsHandler => {\n return () => {};\n});\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LensCore } from "../../lens-core-module/lensCore";
|
|
2
|
+
import type { AnalyticsEventsHandler as LensCoreAnalyticsEventsHandler, LensAnalytics as LensCoreLensAnalytics, LensAnalyticsEvent as LensCoreLensAnalyticsEvent, CreatorAnalyticsEvent as LensCoreCreatorAnalyticsEvent, CameraType as LensCoreCameraType } from "../../lens-core-module/generated-types";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export type AnalyticsEventsHandler = LensCoreAnalyticsEventsHandler;
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type LensAnalytics = LensCoreLensAnalytics;
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export type LensAnalyticsEvent = LensCoreLensAnalyticsEvent;
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export type CreatorAnalyticsEvent = LensCoreCreatorAnalyticsEvent;
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export type CameraType = LensCoreCameraType;
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*
|
|
26
|
+
* Hooks to the LensCore analytics events. See Built-In.AnalyticsSystem JS API.
|
|
27
|
+
*
|
|
28
|
+
* This allows consumers to send Lens analytics events to external metrics systems.
|
|
29
|
+
*/
|
|
30
|
+
export declare const registerLensAnalyticEventsHandler: {
|
|
31
|
+
(args_0: LensCore, args_1: LensCoreAnalyticsEventsHandler): void;
|
|
32
|
+
token: "registerLensAnalyticsHandler";
|
|
33
|
+
dependencies: readonly ["lensCore", "LensAnalyticEventsHandler"];
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=registerLensAnalyticEventsHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerLensAnalyticEventsHandler.d.ts","sourceRoot":"","sources":["../../../src/lens/analytics/registerLensAnalyticEventsHandler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,KAAK,EACR,sBAAsB,IAAI,8BAA8B,EACxD,aAAa,IAAI,qBAAqB,EACtC,kBAAkB,IAAI,0BAA0B,EAChD,qBAAqB,IAAI,6BAA6B,EACtD,UAAU,IAAI,kBAAkB,EACnC,MAAM,wCAAwC,CAAC;AAKhD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,8BAA8B,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,6BAA6B,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,iCAAiC;;;;CAW7C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Injectable } from "@snap/ts-inject";
|
|
2
|
+
import { lensCoreFactory } from "../../lens-core-module/loader/lensCoreFactory";
|
|
3
|
+
import { getLogger } from "../../logger/logger";
|
|
4
|
+
import { lensAnalyticEventsHandlerFactory } from "./lensAnalyticEventsHandler";
|
|
5
|
+
const logger = getLogger("registerLensAnalyticEventsHandler");
|
|
6
|
+
export const registerLensAnalyticEventsHandler = Injectable("registerLensAnalyticsHandler", [lensCoreFactory.token, lensAnalyticEventsHandlerFactory.token], (lensCore, lensAnalyticsHandler) => {
|
|
7
|
+
if (!lensCore.setAnalyticsEventsHandler) {
|
|
8
|
+
logger.warn("Current LensCore version doesn't support lens analytics events.");
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
lensCore.setAnalyticsEventsHandler(lensAnalyticsHandler);
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=registerLensAnalyticEventsHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerLensAnalyticEventsHandler.js","sourceRoot":"","sources":["../../../src/lens/analytics/registerLensAnalyticEventsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAEhF,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQhD,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAE/E,MAAM,MAAM,GAAG,SAAS,CAAC,mCAAmC,CAAC,CAAC;AAkC9D,MAAM,CAAC,MAAM,iCAAiC,GAAG,UAAU,CACvD,8BAA8B,EAC9B,CAAC,eAAe,CAAC,KAAK,EAAE,gCAAgC,CAAC,KAAK,CAAC,EAC/D,CAAC,QAAkB,EAAE,oBAA4C,EAAE,EAAE;IAEjE,IAAI,CAAC,QAAQ,CAAC,yBAAyB,EAAE;QACrC,MAAM,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC;QAC/E,OAAO;KACV;IACD,QAAQ,CAAC,yBAAyB,CAAC,oBAAoB,CAAC,CAAC;AAC7D,CAAC,CACJ,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport { lensCoreFactory } from \"../../lens-core-module/loader/lensCoreFactory\";\nimport type { LensCore } from \"../../lens-core-module/lensCore\";\nimport { getLogger } from \"../../logger/logger\";\nimport type {\n AnalyticsEventsHandler as LensCoreAnalyticsEventsHandler,\n LensAnalytics as LensCoreLensAnalytics,\n LensAnalyticsEvent as LensCoreLensAnalyticsEvent,\n CreatorAnalyticsEvent as LensCoreCreatorAnalyticsEvent,\n CameraType as LensCoreCameraType,\n} from \"../../lens-core-module/generated-types\";\nimport { lensAnalyticEventsHandlerFactory } from \"./lensAnalyticEventsHandler\";\n\nconst logger = getLogger(\"registerLensAnalyticEventsHandler\");\n\n/**\n * @internal\n */\nexport type AnalyticsEventsHandler = LensCoreAnalyticsEventsHandler;\n\n/**\n * @internal\n */\nexport type LensAnalytics = LensCoreLensAnalytics;\n\n/**\n * @internal\n */\nexport type LensAnalyticsEvent = LensCoreLensAnalyticsEvent;\n\n/**\n * @internal\n */\nexport type CreatorAnalyticsEvent = LensCoreCreatorAnalyticsEvent;\n\n/**\n * @internal\n */\nexport type CameraType = LensCoreCameraType;\n\n/**\n * @internal\n *\n * Hooks to the LensCore analytics events. See Built-In.AnalyticsSystem JS API.\n *\n * This allows consumers to send Lens analytics events to external metrics systems.\n */\nexport const registerLensAnalyticEventsHandler = Injectable(\n \"registerLensAnalyticsHandler\",\n [lensCoreFactory.token, lensAnalyticEventsHandlerFactory.token],\n (lensCore: LensCore, lensAnalyticsHandler: AnalyticsEventsHandler) => {\n // Make sure we are compatible with previous LensCore versions\n if (!lensCore.setAnalyticsEventsHandler) {\n logger.warn(\"Current LensCore version doesn't support lens analytics events.\");\n return;\n }\n lensCore.setAnalyticsEventsHandler(lensAnalyticsHandler);\n }\n);\n"]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { FileWithHandle, fileOpen } from "browser-fs-access";
|
|
2
|
+
/**
|
|
3
|
+
* A picked file with its handle.
|
|
4
|
+
*/
|
|
5
|
+
export type PickedFile = FileWithHandle;
|
|
2
6
|
/**
|
|
3
7
|
* Default file picker dialog type.
|
|
4
8
|
*/
|
|
@@ -10,7 +14,7 @@ export type FilePickerOptions = Parameters<OpenDefaultFilePicker>[0];
|
|
|
10
14
|
/**
|
|
11
15
|
* File picker dialog result object, which is a Promise that resolves to a file or an array of files with handles.
|
|
12
16
|
*/
|
|
13
|
-
export type FilePickerResult = Promise<
|
|
17
|
+
export type FilePickerResult = Promise<PickedFile | PickedFile[]>;
|
|
14
18
|
/**
|
|
15
19
|
* A callback to show a file picker dialog.
|
|
16
20
|
* @param options - Options for the file picker dialog.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filePicker.d.ts","sourceRoot":"","sources":["../../src/lens-client-interface/filePicker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,QAAQ,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"filePicker.d.ts","sourceRoot":"","sources":["../../src/lens-client-interface/filePicker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,QAAQ,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,GAAG,UAAU,EAAE,CAAC,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,qBAAqB,KAAK,gBAAgB,CAAC;AAEpH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;CAG7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filePicker.js","sourceRoot":"","sources":["../../src/lens-client-interface/filePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"filePicker.js","sourceRoot":"","sources":["../../src/lens-client-interface/filePicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAoC7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CACvC,YAAY,EACZ,GAAe,EAAE,CAAC,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAC/E,CAAC","sourcesContent":["import { Injectable } from \"@snap/ts-inject\";\nimport type { FileWithHandle, fileOpen } from \"browser-fs-access\";\n\n/**\n * A picked file with its handle.\n */\nexport type PickedFile = FileWithHandle;\n\n/**\n * Default file picker dialog type.\n */\nexport type OpenDefaultFilePicker = typeof fileOpen;\n\n/**\n * File picker options. For example, it indicates which MIME types of files are expected to be picked.\n */\nexport type FilePickerOptions = Parameters<OpenDefaultFilePicker>[0];\n\n/**\n * File picker dialog result object, which is a Promise that resolves to a file or an array of files with handles.\n */\nexport type FilePickerResult = Promise<PickedFile | PickedFile[]>;\n\n/**\n * A callback to show a file picker dialog.\n * @param options - Options for the file picker dialog.\n * @param openDefaultPicker - The default file picker function. The client app may choose to use\n * the default file picker.\n * @returns A promise that resolves to the result of the file picker dialog.\n */\nexport type FilePicker = (options: FilePickerOptions, openDefaultPicker: OpenDefaultFilePicker) => FilePickerResult;\n\n/**\n * Default file picker factory function. The file picker is triggered when a lens issues a file request.\n * Client applications can override this factory function to provide their custom file picker.\n */\nexport const filePickerFactory = Injectable(\n \"filePicker\",\n (): FilePicker => (options, openDefaultPicker) => openDefaultPicker(options)\n);\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
version: "
|
|
3
|
-
buildNumber: "
|
|
4
|
-
baseUrl: "https://cf-st.sc-cdn.net/d/
|
|
2
|
+
version: "352",
|
|
3
|
+
buildNumber: "79abe4b",
|
|
4
|
+
baseUrl: "https://cf-st.sc-cdn.net/d/mEmSkXfS1qUOSde61X7KE?go=IgsKCTIBBEgBUFxgAQ%3D%3D&uc=92",
|
|
5
5
|
};
|
|
6
6
|
//# sourceMappingURL=lensCoreWasmVersions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lensCoreWasmVersions.js","sourceRoot":"","sources":["../src/lensCoreWasmVersions.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,oFAAoF;CAChG,CAAC","sourcesContent":["export default {\n version: \"
|
|
1
|
+
{"version":3,"file":"lensCoreWasmVersions.js","sourceRoot":"","sources":["../src/lensCoreWasmVersions.ts"],"names":[],"mappings":"AAAA,eAAe;IACX,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,oFAAoF;CAChG,CAAC","sourcesContent":["export default {\n version: \"352\",\n buildNumber: \"79abe4b\",\n baseUrl: \"https://cf-st.sc-cdn.net/d/mEmSkXfS1qUOSde61X7KE?go=IgsKCTIBBEgBUFxgAQ%3D%3D&uc=92\",\n};\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LensCore } from "../lens-core-module/lensCore";
|
|
2
|
+
import type { RemoteConfiguration } from "./remoteConfiguration";
|
|
3
|
+
/**
|
|
4
|
+
* Registers an on-demand configuration provider with LensCore.
|
|
5
|
+
*
|
|
6
|
+
* When LensCore needs a config that was not preloaded, it calls this provider.
|
|
7
|
+
* The provider looks up the config by ID from the RemoteConfiguration cache
|
|
8
|
+
* (already in JS memory from the COF fetch), so no additional network requests are made.
|
|
9
|
+
*/
|
|
10
|
+
export declare const registerConfigurationProvider: {
|
|
11
|
+
(args_0: LensCore, args_1: RemoteConfiguration): void;
|
|
12
|
+
token: "registerConfigurationProvider";
|
|
13
|
+
dependencies: readonly ["lensCore", "remoteConfiguration"];
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=configurationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configurationProvider.d.ts","sourceRoot":"","sources":["../../src/remote-configuration/configurationProvider.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAMjE;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B;;;;CA0BzC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
2
|
+
import { firstValueFrom } from "rxjs";
|
|
3
|
+
import { Injectable } from "@snap/ts-inject";
|
|
4
|
+
import { lensCoreFactory } from "../lens-core-module/loader/lensCoreFactory";
|
|
5
|
+
import { getLogger } from "../logger/logger";
|
|
6
|
+
import { remoteConfigurationFactory } from "./remoteConfiguration";
|
|
7
|
+
import { toLensCoreConfigValue } from "./util";
|
|
8
|
+
const logger = getLogger("registerConfigurationProvider");
|
|
9
|
+
export const registerConfigurationProvider = Injectable("registerConfigurationProvider", [lensCoreFactory.token, remoteConfigurationFactory.token], (lensCore, remoteConfiguration) => {
|
|
10
|
+
if (!lensCore.setConfigurationProvider) {
|
|
11
|
+
return logger.warn("LensCore version does not support on-demand configuration.");
|
|
12
|
+
}
|
|
13
|
+
lensCore.setConfigurationProvider(({ configId }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const configs = yield firstValueFrom(remoteConfiguration.get(configId));
|
|
16
|
+
if (configs.length === 0)
|
|
17
|
+
return undefined;
|
|
18
|
+
const { configId: id, value } = configs[0];
|
|
19
|
+
if (!value)
|
|
20
|
+
return undefined;
|
|
21
|
+
const convertedValue = toLensCoreConfigValue(value);
|
|
22
|
+
if (!convertedValue)
|
|
23
|
+
return undefined;
|
|
24
|
+
return { configId: id, value: convertedValue };
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
logger.error(new Error(`Failed to resolve config "${configId}" on demand.`, { cause: error }));
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=configurationProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configurationProvider.js","sourceRoot":"","sources":["../../src/remote-configuration/configurationProvider.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,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AA6B,QAAQ,cAAc,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAC/F,OAAO,SAAS,CAAC;SACpB;IACL,CAAC,CAAA,CAAC,CAAC;AACP,CAAC,CACJ,CAAC","sourcesContent":["import { firstValueFrom } from \"rxjs\";\nimport { Injectable } from \"@snap/ts-inject\";\nimport { lensCoreFactory } from \"../lens-core-module/loader/lensCoreFactory\";\nimport type { LensCore } from \"../lens-core-module/lensCore\";\nimport { getLogger } from \"../logger/logger\";\nimport type { RemoteConfiguration } from \"./remoteConfiguration\";\nimport { remoteConfigurationFactory } from \"./remoteConfiguration\";\nimport { toLensCoreConfigValue } from \"./util\";\n\nconst logger = getLogger(\"registerConfigurationProvider\");\n\n/**\n * Registers an on-demand configuration provider with LensCore.\n *\n * When LensCore needs a config that was not preloaded, it calls this provider.\n * The provider looks up the config by ID from the RemoteConfiguration cache\n * (already in JS memory from the COF fetch), so no additional network requests are made.\n */\nexport const registerConfigurationProvider = Injectable(\n \"registerConfigurationProvider\",\n [lensCoreFactory.token, remoteConfigurationFactory.token] as const,\n (lensCore: LensCore, remoteConfiguration: RemoteConfiguration) => {\n if (!lensCore.setConfigurationProvider) {\n return logger.warn(\"LensCore version does not support on-demand configuration.\");\n }\n\n lensCore.setConfigurationProvider(async ({ configId }) => {\n try {\n const configs = await firstValueFrom(remoteConfiguration.get(configId));\n if (configs.length === 0) return undefined;\n\n const { configId: id, value } = configs[0];\n if (!value) return undefined;\n\n const convertedValue = toLensCoreConfigValue(value);\n if (!convertedValue) return undefined;\n\n return { configId: id, value: convertedValue };\n } catch (error) {\n logger.error(new Error(`Failed to resolve config \"${configId}\" on demand.`, { cause: error }));\n return undefined;\n }\n });\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preloadConfiguration.d.ts","sourceRoot":"","sources":["../../src/remote-configuration/preloadConfiguration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preloadConfiguration.d.ts","sourceRoot":"","sources":["../../src/remote-configuration/preloadConfiguration.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAcjE,eAAO,MAAM,yBAAyB;;;;CA0BrC,CAAC"}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import { take } from "rxjs";
|
|
1
|
+
import { combineLatest, take } from "rxjs";
|
|
2
2
|
import { Injectable } from "@snap/ts-inject";
|
|
3
|
-
import { Namespace } from "../generated-proto/pb_schema/cdp/cof/namespace";
|
|
4
3
|
import { lensCoreFactory } from "../lens-core-module/loader/lensCoreFactory";
|
|
5
4
|
import { getLogger } from "../logger/logger";
|
|
6
5
|
import { remoteConfigurationFactory } from "./remoteConfiguration";
|
|
6
|
+
import { toLensCoreConfigValue } from "./util";
|
|
7
7
|
const logger = getLogger("setPreloadedConfiguration");
|
|
8
|
+
const SYNC_REQUIRED_CONFIG_IDS = [];
|
|
8
9
|
export const setPreloadedConfiguration = Injectable("setPreloadedConfiguration", [lensCoreFactory.token, remoteConfigurationFactory.token], (lensCore, remoteConfiguration) => {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
if (SYNC_REQUIRED_CONFIG_IDS.length === 0) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
combineLatest(SYNC_REQUIRED_CONFIG_IDS.map((id) => remoteConfiguration.get(id)))
|
|
11
14
|
.pipe(take(1))
|
|
12
15
|
.subscribe({
|
|
13
|
-
next: (
|
|
14
|
-
const inputs =
|
|
16
|
+
next: (configArrays) => {
|
|
17
|
+
const inputs = configArrays
|
|
18
|
+
.flat()
|
|
19
|
+
.flatMap(({ configId, value }) => {
|
|
20
|
+
if (!value)
|
|
21
|
+
return [];
|
|
22
|
+
const convertedValue = toLensCoreConfigValue(value);
|
|
23
|
+
if (!convertedValue)
|
|
24
|
+
return [];
|
|
25
|
+
return [{ configId, value: convertedValue }];
|
|
26
|
+
});
|
|
15
27
|
lensCore.setPreloadedConfiguration(inputs);
|
|
16
28
|
},
|
|
17
29
|
error: logger.error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preloadConfiguration.js","sourceRoot":"","sources":["../../src/remote-configuration/preloadConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"preloadConfiguration.js","sourceRoot":"","sources":["../../src/remote-configuration/preloadConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAG7E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAE/C,MAAM,MAAM,GAAG,SAAS,CAAC,2BAA2B,CAAC,CAAC;AAQtD,MAAM,wBAAwB,GAAa,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAC/C,2BAA2B,EAC3B,CAAC,eAAe,CAAC,KAAK,EAAE,0BAA0B,CAAC,KAAK,CAAU,EAClE,CAAC,QAAkB,EAAE,mBAAwC,EAAE,EAAE;IAC7D,IAAI,wBAAwB,CAAC,MAAM,KAAK,CAAC,EAAE;QACvC,OAAO;KACV;IAED,aAAa,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;SAC3E,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACb,SAAS,CAAC;QACP,IAAI,EAAE,CAAC,YAAY,EAAE,EAAE;YACnB,MAAM,MAAM,GAAmC,YAAY;iBACtD,IAAI,EAAE;iBACN,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;gBAC7B,IAAI,CAAC,KAAK;oBAAE,OAAO,EAAE,CAAC;gBACtB,MAAM,cAAc,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBACpD,IAAI,CAAC,cAAc;oBAAE,OAAO,EAAE,CAAC;gBAC/B,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC;YACjD,CAAC,CAAC,CAAC;YAEP,QAAQ,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC;QACD,KAAK,EAAE,MAAM,CAAC,KAAK;KACtB,CAAC,CAAC;AACX,CAAC,CACJ,CAAC","sourcesContent":["import { combineLatest, take } from \"rxjs\";\nimport { Injectable } from \"@snap/ts-inject\";\nimport { lensCoreFactory } from \"../lens-core-module/loader/lensCoreFactory\";\nimport type { LensCore } from \"../lens-core-module/lensCore\";\nimport type { SetPreloadedConfigurationInput } from \"../lens-core-module/generated-types\";\nimport { getLogger } from \"../logger/logger\";\nimport type { RemoteConfiguration } from \"./remoteConfiguration\";\nimport { remoteConfigurationFactory } from \"./remoteConfiguration\";\nimport { toLensCoreConfigValue } from \"./util\";\n\nconst logger = getLogger(\"setPreloadedConfiguration\");\n\n/**\n * Config IDs LensCore needs synchronously at startup.\n * Everything else is served on demand (see configurationProvider.ts).\n *\n * Currently empty to avoid unnecessary preloading, but may be populated later with sync config requests.\n */\nconst SYNC_REQUIRED_CONFIG_IDS: string[] = [];\n\nexport const setPreloadedConfiguration = Injectable(\n \"setPreloadedConfiguration\",\n [lensCoreFactory.token, remoteConfigurationFactory.token] as const,\n (lensCore: LensCore, remoteConfiguration: RemoteConfiguration) => {\n if (SYNC_REQUIRED_CONFIG_IDS.length === 0) {\n return;\n }\n\n combineLatest(SYNC_REQUIRED_CONFIG_IDS.map((id) => remoteConfiguration.get(id)))\n .pipe(take(1))\n .subscribe({\n next: (configArrays) => {\n const inputs: SetPreloadedConfigurationInput = configArrays\n .flat()\n .flatMap(({ configId, value }) => {\n if (!value) return [];\n const convertedValue = toLensCoreConfigValue(value);\n if (!convertedValue) return [];\n return [{ configId, value: convertedValue }];\n });\n\n lensCore.setPreloadedConfiguration(inputs);\n },\n error: logger.error,\n });\n }\n);\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Value } from "../generated-proto/pb_schema/common/value";
|
|
2
|
+
import type { LensCoreConfig } from "../lens-core-module/generated-types";
|
|
3
|
+
export declare function toLensCoreConfigValue(value: Value): LensCoreConfig["value"] | undefined;
|
|
4
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/remote-configuration/util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,GAAG,SAAS,CAUvF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function toLensCoreConfigValue(value) {
|
|
2
|
+
if (value.stringValue)
|
|
3
|
+
return { stringValue: value.stringValue };
|
|
4
|
+
if (value.boolValue)
|
|
5
|
+
return { boolValue: value.boolValue };
|
|
6
|
+
if (value.intValue)
|
|
7
|
+
return { intValue: value.intValue };
|
|
8
|
+
if (value.longValue)
|
|
9
|
+
return { longValue: Number(value.longValue) };
|
|
10
|
+
if (value.floatValue)
|
|
11
|
+
return { floatValue: value.floatValue };
|
|
12
|
+
if (value.anyValue) {
|
|
13
|
+
return { anyValue: { typeUrl: value.anyValue.typeUrl, value: value.anyValue.value } };
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/remote-configuration/util.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,qBAAqB,CAAC,KAAY;IAC9C,IAAI,KAAK,CAAC,WAAW;QAAE,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;IACjE,IAAI,KAAK,CAAC,SAAS;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3D,IAAI,KAAK,CAAC,QAAQ;QAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IACxD,IAAI,KAAK,CAAC,SAAS;QAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;IACnE,IAAI,KAAK,CAAC,UAAU;QAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;IAC9D,IAAI,KAAK,CAAC,QAAQ,EAAE;QAChB,OAAO,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;KACzF;IACD,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import type { Value } from \"../generated-proto/pb_schema/common/value\";\nimport type { LensCoreConfig } from \"../lens-core-module/generated-types\";\n\nexport function toLensCoreConfigValue(value: Value): LensCoreConfig[\"value\"] | undefined {\n if (value.stringValue) return { stringValue: value.stringValue };\n if (value.boolValue) return { boolValue: value.boolValue };\n if (value.intValue) return { intValue: value.intValue };\n if (value.longValue) return { longValue: Number(value.longValue) };\n if (value.floatValue) return { floatValue: value.floatValue };\n if (value.anyValue) {\n return { anyValue: { typeUrl: value.anyValue.typeUrl, value: value.anyValue.value } };\n }\n return undefined;\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import type { RemoteApiSpecsClient } from "../../clients/remoteApiSpecsClient";
|
|
|
2
2
|
import type { Lens } from "../../lens/Lens";
|
|
3
3
|
import type { LensState } from "../../session/lensState";
|
|
4
4
|
import type { SessionState } from "../../session/sessionState";
|
|
5
|
-
import type { LensHttpHandler } from "../../configuration";
|
|
5
|
+
import type { LensHttpHandler, ValidationStrategy } from "../../configuration";
|
|
6
6
|
import type { UriHandler, UriRequest, UriResponse } from "../UriHandlers";
|
|
7
7
|
import type { RemoteApiSpec } from "../../generated-proto/pb_schema/camera_kit/v3/remote_api_spec";
|
|
8
8
|
/**
|
|
@@ -12,10 +12,11 @@ import type { RemoteApiSpec } from "../../generated-proto/pb_schema/camera_kit/v
|
|
|
12
12
|
* @param lensState
|
|
13
13
|
* @param sessionState
|
|
14
14
|
* @param remoteApiSpecsClient
|
|
15
|
-
* @param
|
|
15
|
+
* @param customLentFetchHandler
|
|
16
|
+
* @param validationStrategy
|
|
16
17
|
* @returns
|
|
17
18
|
*/
|
|
18
|
-
export declare function createHttpUriHandler(lensState: LensState, sessionState: SessionState, remoteApiSpecsClient: RemoteApiSpecsClient, customLentFetchHandler: LensHttpHandler | undefined): UriHandler;
|
|
19
|
+
export declare function createHttpUriHandler(lensState: LensState, sessionState: SessionState, remoteApiSpecsClient: RemoteApiSpecsClient, customLentFetchHandler: LensHttpHandler | undefined, validationStrategy?: ValidationStrategy): UriHandler;
|
|
19
20
|
/**
|
|
20
21
|
*
|
|
21
22
|
* @internal
|
|
@@ -25,9 +26,10 @@ export declare function createHttpUriHandler(lensState: LensState, sessionState:
|
|
|
25
26
|
* @param reply
|
|
26
27
|
* @param setCancellationHandler
|
|
27
28
|
* @param allowlist
|
|
28
|
-
* @param
|
|
29
|
+
* @param customLensHttpHandler
|
|
30
|
+
* @param validationStrategy
|
|
29
31
|
*/
|
|
30
|
-
export declare function handleHttpUriRequest(request: UriRequest, lens: Lens, reply: (response: UriResponse) => void, setCancellationHandler: (fn: () => void) => void, allowlist: RemoteApiSpec[], customLensHttpHandler: LensHttpHandler | undefined): Promise<void>;
|
|
32
|
+
export declare function handleHttpUriRequest(request: UriRequest, lens: Lens, reply: (response: UriResponse) => void, setCancellationHandler: (fn: () => void) => void, allowlist: RemoteApiSpec[], customLensHttpHandler: LensHttpHandler | undefined, validationStrategy?: ValidationStrategy): Promise<void>;
|
|
31
33
|
/**
|
|
32
34
|
* @internal
|
|
33
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpUriHandler.d.ts","sourceRoot":"","sources":["../../../src/uri-handlers/internal-handlers/httpUriHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAmC,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"httpUriHandler.d.ts","sourceRoot":"","sources":["../../../src/uri-handlers/internal-handlers/httpUriHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAmC,eAAe,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAChH,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+DAA+D,CAAC;AA2BnG;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,oBAAoB,EAC1C,sBAAsB,EAAE,eAAe,GAAG,SAAS,EACnD,kBAAkB,GAAE,kBAA6B,GAClD,UAAU,CA2BZ;AAQD;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACtC,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,EACtC,sBAAsB,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,EAChD,SAAS,EAAE,aAAa,EAAE,EAC1B,qBAAqB,EAAE,eAAe,GAAG,SAAS,EAClD,kBAAkB,GAAE,kBAA6B,iBAgFpD;AAcD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,UAAU,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAcrH;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAmBrF"}
|
|
@@ -20,7 +20,7 @@ const allowedResponseHeaders = [
|
|
|
20
20
|
"Location",
|
|
21
21
|
];
|
|
22
22
|
const requestHeadersToExclude = ["x-sc-lenses-remote-api-spec-id"];
|
|
23
|
-
export function createHttpUriHandler(lensState, sessionState, remoteApiSpecsClient, customLentFetchHandler) {
|
|
23
|
+
export function createHttpUriHandler(lensState, sessionState, remoteApiSpecsClient, customLentFetchHandler, validationStrategy = "strict") {
|
|
24
24
|
let allowlistPromise = undefined;
|
|
25
25
|
return createUriRequestProcessor({
|
|
26
26
|
uri: ["http://", "https://"],
|
|
@@ -30,7 +30,7 @@ export function createHttpUriHandler(lensState, sessionState, remoteApiSpecsClie
|
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
allowlistPromise = allowlistPromise !== null && allowlistPromise !== void 0 ? allowlistPromise : getAllowlist(remoteApiSpecsClient);
|
|
32
32
|
const allowlist = yield allowlistPromise;
|
|
33
|
-
handleHttpUriRequest(request, lens, reply, setCancellationHandler, allowlist, customLentFetchHandler);
|
|
33
|
+
handleHttpUriRequest(request, lens, reply, setCancellationHandler, allowlist, customLentFetchHandler, validationStrategy);
|
|
34
34
|
});
|
|
35
35
|
},
|
|
36
36
|
processInternalError(error) {
|
|
@@ -47,10 +47,10 @@ function getAllowlist(remoteApiSpecsClient) {
|
|
|
47
47
|
return (_b = (_a = result.unwrap().message) === null || _a === void 0 ? void 0 : _a.remoteApiSpecs) !== null && _b !== void 0 ? _b : [];
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
export function handleHttpUriRequest(request, lens, reply, setCancellationHandler, allowlist, customLensHttpHandler) {
|
|
50
|
+
export function handleHttpUriRequest(request, lens, reply, setCancellationHandler, allowlist, customLensHttpHandler, validationStrategy = "strict") {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
52
|
try {
|
|
53
|
-
validateRequest(request, allowlist);
|
|
53
|
+
validateRequest(request, allowlist, validationStrategy);
|
|
54
54
|
const { url, init } = mapLensToFetchRequest(request);
|
|
55
55
|
const abortController = new AbortController();
|
|
56
56
|
init.signal = abortController.signal;
|