@snap/camera-kit 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/docs/html/assets/main.js +57 -53
  2. package/docs/html/assets/search.js +1 -1
  3. package/docs/html/assets/style.css +504 -362
  4. package/docs/html/classes/CameraKit.html +113 -47
  5. package/docs/html/classes/CameraKitSession.html +202 -142
  6. package/docs/html/classes/CameraKitSource.html +124 -60
  7. package/docs/html/classes/LensPerformanceMeasurement.html +112 -46
  8. package/docs/html/classes/LensPerformanceMetrics.html +97 -32
  9. package/docs/html/classes/LensRepository.html +130 -66
  10. package/docs/html/classes/LensSources.html +98 -32
  11. package/docs/html/classes/Transform2D.html +111 -43
  12. package/docs/html/classes/TypedCustomEvent.html +109 -47
  13. package/docs/html/classes/TypedEventTarget.html +125 -65
  14. package/docs/html/functions/Injectable.html +113 -120
  15. package/docs/html/functions/bootstrapCameraKit.html +100 -104
  16. package/docs/html/functions/createExtension.html +90 -94
  17. package/docs/html/functions/createImageSource.html +90 -93
  18. package/docs/html/functions/createMediaStreamSource.html +90 -93
  19. package/docs/html/functions/createUserMediaSource.html +92 -96
  20. package/docs/html/functions/createVideoSource.html +90 -93
  21. package/docs/html/functions/estimateLensPerformance.html +88 -92
  22. package/docs/html/functions/getRequiredBootstrapURLs.html +90 -94
  23. package/docs/html/functions/lensSourcesFactory.html +88 -91
  24. package/docs/html/functions/uriHandlersFactory.html +88 -91
  25. package/docs/html/index.html +134 -170
  26. package/docs/html/interfaces/CameraKitBootstrapConfiguration.html +115 -49
  27. package/docs/html/interfaces/CameraKitSourceSubscriber.html +111 -45
  28. package/docs/html/interfaces/ComputedFrameMetrics.html +98 -32
  29. package/docs/html/interfaces/CreateSessionOptions.html +95 -29
  30. package/docs/html/interfaces/EstimatedLensPerformance.html +98 -32
  31. package/docs/html/interfaces/Lens.html +115 -49
  32. package/docs/html/interfaces/LensSource.html +107 -41
  33. package/docs/html/interfaces/MediaStreamSourceOptions.html +94 -28
  34. package/docs/html/interfaces/UriCancelRequest.html +94 -28
  35. package/docs/html/interfaces/UriHandler.html +108 -42
  36. package/docs/html/interfaces/UriRequest.html +106 -40
  37. package/docs/html/interfaces/UriResponse.html +106 -40
  38. package/docs/html/interfaces/VideoSourceOptions.html +90 -24
  39. package/docs/html/modules.html +161 -164
  40. package/docs/html/types/AssetLoader.html +91 -94
  41. package/docs/html/types/AssetTiming.html +85 -88
  42. package/docs/html/types/BenchmarkError.html +85 -88
  43. package/docs/html/types/BootstrapError.html +86 -89
  44. package/docs/html/types/CacheKeyNotFoundError.html +85 -88
  45. package/docs/html/types/CameraKitDeviceInfo.html +87 -90
  46. package/docs/html/types/CameraKitSessionEventListener.html +86 -89
  47. package/docs/html/types/CameraKitSessionEvents.html +88 -91
  48. package/docs/html/types/CameraKitSourceError.html +85 -88
  49. package/docs/html/types/CameraKitSourceInfo.html +85 -88
  50. package/docs/html/types/CameraKitSourceOptions.html +88 -92
  51. package/docs/html/types/ConfigurationError.html +86 -89
  52. package/docs/html/types/Keyboard.html +108 -111
  53. package/docs/html/types/KeyboardEvents.html +86 -89
  54. package/docs/html/types/LegalError.html +85 -88
  55. package/docs/html/types/LensAssetError.html +85 -88
  56. package/docs/html/types/LensContentValidationError.html +85 -88
  57. package/docs/html/types/LensError.html +85 -88
  58. package/docs/html/types/LensExecutionError.html +86 -89
  59. package/docs/html/types/LensImagePickerError.html +85 -88
  60. package/docs/html/types/LensLaunchParams.html +85 -88
  61. package/docs/html/types/LensMetricsEvents.html +86 -89
  62. package/docs/html/types/LensPerformanceCluster.html +85 -88
  63. package/docs/html/types/LensView.html +85 -88
  64. package/docs/html/types/LensWait.html +85 -88
  65. package/docs/html/types/PersistentStoreError.html +85 -88
  66. package/docs/html/types/PlatformNotSupportedError.html +86 -89
  67. package/docs/html/types/PublicContainer.html +85 -88
  68. package/docs/html/types/RenderTarget.html +85 -88
  69. package/docs/html/types/Uri.html +85 -88
  70. package/docs/html/types/UriHandlers.html +86 -89
  71. package/docs/html/types/WebGLError.html +85 -88
  72. package/docs/html/variables/extensionRequestContext.html +85 -88
  73. package/docs/md/README.md +1 -1
  74. package/docs/md/classes/CameraKit.md +1 -1
  75. package/docs/md/classes/CameraKitSession.md +1 -1
  76. package/docs/md/classes/CameraKitSource.md +1 -1
  77. package/docs/md/classes/LensPerformanceMeasurement.md +1 -1
  78. package/docs/md/classes/LensPerformanceMetrics.md +1 -1
  79. package/docs/md/classes/LensRepository.md +3 -3
  80. package/docs/md/classes/LensSources.md +1 -1
  81. package/docs/md/classes/Transform2D.md +3 -1
  82. package/docs/md/classes/TypedCustomEvent.md +1 -1
  83. package/docs/md/classes/TypedEventTarget.md +3 -3
  84. package/docs/md/interfaces/CameraKitBootstrapConfiguration.md +1 -1
  85. package/docs/md/interfaces/CameraKitSourceSubscriber.md +1 -1
  86. package/docs/md/interfaces/ComputedFrameMetrics.md +1 -1
  87. package/docs/md/interfaces/CreateSessionOptions.md +1 -1
  88. package/docs/md/interfaces/EstimatedLensPerformance.md +1 -1
  89. package/docs/md/interfaces/Lens.md +1 -1
  90. package/docs/md/interfaces/LensSource.md +1 -1
  91. package/docs/md/interfaces/MediaStreamSourceOptions.md +1 -1
  92. package/docs/md/interfaces/UriCancelRequest.md +1 -1
  93. package/docs/md/interfaces/UriHandler.md +1 -1
  94. package/docs/md/interfaces/UriRequest.md +1 -1
  95. package/docs/md/interfaces/UriResponse.md +1 -1
  96. package/docs/md/interfaces/VideoSourceOptions.md +1 -1
  97. package/docs/md/modules.md +3 -3
  98. package/lib/CameraKit.d.ts +7 -7
  99. package/lib/__tests__/data.d.ts +1 -1
  100. package/lib/__tests__/deferred.d.ts +1 -1
  101. package/lib/__tests__/jest.matchers.d.ts +1 -1
  102. package/lib/benchmark/estimateLensPerformanceCluster.d.ts +2 -2
  103. package/lib/bootstrapCameraKit.d.ts +1 -1
  104. package/lib/common/cameraKitUserAgent.d.ts +1 -1
  105. package/lib/common/cameraKitUserAgent.js +5 -3
  106. package/lib/common/cameraKitUserAgent.js.map +1 -1
  107. package/lib/common/localization.d.ts +8 -4
  108. package/lib/common/localization.js.map +1 -1
  109. package/lib/common/memoize.d.ts +2 -2
  110. package/lib/common/pageVisibility.js +1 -1
  111. package/lib/common/pageVisibility.js.map +1 -1
  112. package/lib/common/typeguards.d.ts +2 -2
  113. package/lib/common/types.d.ts +2 -2
  114. package/lib/common/validate.js +20 -12
  115. package/lib/common/validate.js.map +1 -1
  116. package/lib/configuration.d.ts +1 -1
  117. package/lib/configuration.js.map +1 -1
  118. package/lib/configurationOverrides.d.ts +1 -1
  119. package/lib/dependency-injection/Container.d.ts +5 -6
  120. package/lib/dependency-injection/Container.js +1 -1
  121. package/lib/dependency-injection/Container.js.map +1 -1
  122. package/lib/dependency-injection/PartialContainer.d.ts +10 -6
  123. package/lib/dependency-injection/PartialContainer.js.map +1 -1
  124. package/lib/dependency-injection/RootServices.d.ts +2 -2
  125. package/lib/dependency-injection/types.d.ts +9 -9
  126. package/lib/dependency-injection/types.js.map +1 -1
  127. package/lib/environment.json +1 -1
  128. package/lib/events/TypedCustomEvent.d.ts +1 -1
  129. package/lib/events/TypedEventTarget.d.ts +2 -2
  130. package/lib/events/scan.d.ts +1 -1
  131. package/lib/events/scan.js +3 -3
  132. package/lib/events/scan.js.map +1 -1
  133. package/lib/extensions/UriHandlers.d.ts +1 -1
  134. package/lib/generated-proto/blizzard/cameraKitEvents.d.ts +4 -4
  135. package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.d.ts +4 -4
  136. package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js +3 -3
  137. package/lib/generated-proto/pb_schema/camera_kit/v3/business_events.js.map +1 -1
  138. package/lib/generated-proto/pb_schema/camera_kit/v3/export.d.ts +4 -4
  139. package/lib/generated-proto/pb_schema/camera_kit/v3/export.js +9 -9
  140. package/lib/generated-proto/pb_schema/camera_kit/v3/export.js.map +1 -1
  141. package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.d.ts +4 -4
  142. package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js +2 -2
  143. package/lib/generated-proto/pb_schema/camera_kit/v3/legal_prompt.js.map +1 -1
  144. package/lib/generated-proto/pb_schema/camera_kit/v3/lens.d.ts +4 -4
  145. package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js +17 -17
  146. package/lib/generated-proto/pb_schema/camera_kit/v3/lens.js.map +1 -1
  147. package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.d.ts +4 -4
  148. package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js +4 -4
  149. package/lib/generated-proto/pb_schema/camera_kit/v3/operational_metrics.js.map +1 -1
  150. package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.d.ts +4 -4
  151. package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.js +3 -3
  152. package/lib/generated-proto/pb_schema/camera_kit/v3/ranking.js.map +1 -1
  153. package/lib/generated-proto/pb_schema/camera_kit/v3/service.d.ts +4 -4
  154. package/lib/generated-proto/pb_schema/camera_kit/v3/service.js +25 -25
  155. package/lib/generated-proto/pb_schema/camera_kit/v3/service.js.map +1 -1
  156. package/lib/generated-proto/pb_schema/cdp/cof/benchmark.d.ts +4 -4
  157. package/lib/generated-proto/pb_schema/cdp/cof/circumstance_service.d.ts +4533 -333
  158. package/lib/generated-proto/pb_schema/cdp/cof/config_request.d.ts +4 -4
  159. package/lib/generated-proto/pb_schema/cdp/cof/config_response.d.ts +572 -32
  160. package/lib/generated-proto/pb_schema/cdp/cof/config_result.d.ts +4 -4
  161. package/lib/generated-proto/pb_schema/cdp/cof/debug_info.d.ts +4 -4
  162. package/lib/generated-proto/pb_schema/common/ruid.d.ts +4 -4
  163. package/lib/generated-proto/pb_schema/common/value.d.ts +4 -4
  164. package/lib/generated-proto/pb_schema/google/api/http.d.ts +4 -4
  165. package/lib/generated-proto/pb_schema/google/protobuf/any.d.ts +4 -4
  166. package/lib/generated-proto/pb_schema/google/protobuf/descriptor.d.ts +4 -4
  167. package/lib/generated-proto/pb_schema/google/protobuf/timestamp.d.ts +4 -4
  168. package/lib/generated-proto/pb_schema/google/protobuf/wrappers.d.ts +4 -4
  169. package/lib/generated-proto/pb_schema/lenses/geocircle.d.ts +4 -4
  170. package/lib/generated-proto/pb_schema/lenses/geopoint.d.ts +4 -4
  171. package/lib/generated-proto/pb_schema/lenses/launch_params.d.ts +4 -4
  172. package/lib/generated-proto/pb_schema/lenses/launchdata.d.ts +4 -4
  173. package/lib/generated-proto/pb_schema/lenses/lures.d.ts +4 -4
  174. package/lib/generated-proto/pb_schema/lenses/persistent_store.d.ts +4 -4
  175. package/lib/generated-proto/pb_schema/lenses/snappable.d.ts +4 -4
  176. package/lib/generated-proto/pb_schema/lenses/user_data.d.ts +4 -4
  177. package/lib/handlers/HandlerChainBuilder.d.ts +3 -3
  178. package/lib/handlers/arrayBufferParsingHandler.d.ts +2 -2
  179. package/lib/handlers/arrayBufferParsingHandler.js.map +1 -1
  180. package/lib/handlers/cameraKitServiceFetchHandlerFactory.d.ts +1 -1
  181. package/lib/handlers/defaultFetchHandler.d.ts +1 -1
  182. package/lib/handlers/headersModifyingFetchHandler.js +5 -1
  183. package/lib/handlers/headersModifyingFetchHandler.js.map +1 -1
  184. package/lib/handlers/noCorsRetryingFetchHandler.js +4 -3
  185. package/lib/handlers/noCorsRetryingFetchHandler.js.map +1 -1
  186. package/lib/handlers/requestStateEmittingHandler.d.ts +2 -2
  187. package/lib/handlers/requestStateEmittingHandler.js.map +1 -1
  188. package/lib/handlers/responseCachingHandler.d.ts +1 -1
  189. package/lib/handlers/responseCachingHandler.js.map +1 -1
  190. package/lib/handlers/retryingHandler.d.ts +7 -0
  191. package/lib/handlers/retryingHandler.js +14 -5
  192. package/lib/handlers/retryingHandler.js.map +1 -1
  193. package/lib/legal/legalPrompt.d.ts +1 -1
  194. package/lib/legal/legalPrompt.js.map +1 -1
  195. package/lib/legal/legalState.d.ts +1 -1
  196. package/lib/legal/legalState.js.map +1 -1
  197. package/lib/lens/Lens.d.ts +1 -1
  198. package/lib/lens/LensLaunchParams.d.ts +2 -2
  199. package/lib/lens/LensRepository.d.ts +7 -8
  200. package/lib/lens/LensRepository.js.map +1 -1
  201. package/lib/lens/assets/LensAssetRepository.d.ts +2 -2
  202. package/lib/lens/assets/LensAssetsProvider.d.ts +1 -1
  203. package/lib/lens/assets/deviceDependentAssetLoader.d.ts +1 -1
  204. package/lib/lens/assets/remoteMediaAssetLoaderFactory.d.ts +1 -1
  205. package/lib/lens/assets/staticAssetLoader.d.ts +1 -1
  206. package/lib/lens-core-module/generated-types.d.ts +29 -29
  207. package/lib/lens-core-module/generated-types.js.map +1 -1
  208. package/lib/lens-core-module/loader/lensCoreFactory.d.ts +1 -1
  209. package/lib/lensCoreWasmVersions.json +3 -3
  210. package/lib/logger/logger.d.ts +2 -2
  211. package/lib/media-sources/CameraKitSource.d.ts +3 -3
  212. package/lib/media-sources/CameraKitSource.js.map +1 -1
  213. package/lib/media-sources/FunctionSource.d.ts +1 -1
  214. package/lib/metrics/businessEventsReporter.d.ts +4 -4
  215. package/lib/metrics/businessEventsReporter.js.map +1 -1
  216. package/lib/metrics/metricsEventTarget.d.ts +5 -5
  217. package/lib/metrics/metricsHandler.d.ts +1 -1
  218. package/lib/metrics/operationalMetricsReporter.d.ts +2 -2
  219. package/lib/metrics/reporters/reportBenchmarks.d.ts +1 -1
  220. package/lib/metrics/reporters/reportLegalState.d.ts +1 -1
  221. package/lib/metrics/reporters/reportLensAndAssetDownload.d.ts +4 -4
  222. package/lib/metrics/reporters/reportLensValidationFailed.d.ts +1 -1
  223. package/lib/metrics/reporters/reportLensView.d.ts +1 -1
  224. package/lib/metrics/reporters/reportLensView.js +1 -1
  225. package/lib/metrics/reporters/reportLensView.js.map +1 -1
  226. package/lib/metrics/reporters/reportLensWait.d.ts +1 -1
  227. package/lib/metrics/reporters/reportUserSession.d.ts +1 -1
  228. package/lib/namedErrors.d.ts +17 -17
  229. package/lib/persistence/Persistence.d.ts +1 -1
  230. package/lib/remote-configuration/cofHandler.d.ts +1 -1
  231. package/lib/remote-configuration/cofHandler.js +18 -5
  232. package/lib/remote-configuration/cofHandler.js.map +1 -1
  233. package/lib/session/CameraKitSession.d.ts +1 -1
  234. package/lib/session/CameraKitSession.js.map +1 -1
  235. package/lib/session/CameraKitSessionEvents.d.ts +3 -3
  236. package/lib/session/LensKeyboard.d.ts +2 -2
  237. package/lib/session/LensPerformanceMetrics.js.map +1 -1
  238. package/lib/session/lensState.d.ts +2 -2
  239. package/lib/session/lensState.js.map +1 -1
  240. package/lib/session/sessionState.d.ts +1 -1
  241. package/lib/transforms/Transform2D.js +2 -1
  242. package/lib/transforms/Transform2D.js.map +1 -1
  243. package/package.json +14 -14
  244. package/docs/html/assets/widgets.png +0 -0
  245. package/docs/html/assets/widgets@2x.png +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Container.js","sourceRoot":"","sources":["../../src/dependency-injection/Container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAoBtD,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,gBAAgB;AAChB,MAAM,OAAO,SAAS;IAGlB,YAAY,SAA2C;QACnD,IAAI,CAAC,SAAS,GAAG,EAAyB,CAAC;QAC3C,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE;YACvB,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,UAAU,CAAC,EAAE,CAAC;gBAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;;gBACtC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,EAAE,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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACxD,CAAC,CAAS,CACb,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,oGAAoG;QACpG,2GAA2G;QAC3G,qGAAqG;QACrG,MAAM,SAAS,mCAAQ,IAAI,CAAC,SAAS,KAAE,CAAC,KAAK,CAAC,EAAE,OAAO,GAAE,CAAC;QAC1D,OAAO,IAAI,SAAS,CAAE,SAAqF,CAAC,CAAC;IACjH,CAAC;CACJ","sourcesContent":["import { isMemoized, memoize, Memoized } from \"../common/memoize\";\nimport { PartialContainer } from \"./PartialContainer\";\nimport { AddService, InjectableFunction, ValidTokens } from \"./types\";\n\n// This is un-safe. In practice, Containers should always be created by calling `Container::provides` on some other\n// Container (except for some \"root\" Container which is instantiated with no Services) – `Container::provides\" is safely\n// type-checked, so this doesn't introduce much risk. But a more accurate solution would be for the `Factories` and\n// `MaybeMemoizedFactories` types to keep track of which specific Services must be present in the Container\n// corresponding to each Service. But this is much more complex to implement.\ntype UnsafePartialContainer<Services> = Container<Partial<Services>>;\n\ntype MaybeMemoizedFactories<Services> = {\n [K in keyof Services]:\n | ((c: UnsafePartialContainer<Services>) => Services[K])\n | Memoized<(c: UnsafePartialContainer<Services>) => Services[K]>;\n};\n\nexport type Factories<Services> = {\n [K in keyof Services]: Memoized<(c: UnsafePartialContainer<Services>) => Services[K]>;\n};\n\nexport const CONTAINER = \"$container\";\nexport type ContainerToken = typeof CONTAINER;\n\n/**\n * A Container of values, indexed each by a unique token, which can be used throughout CameraKit. This is how CameraKit\n * implements simple dependency injection.\n *\n * Dependency injection is a way to decouple the *use* of a dependency from the *creation* of that dependency. This\n * improves modularity and re-usability, since components only care about the *interfaces* of dependencies (since that\n * determines their use) and not about their concrete creation. New implementations of a particular dependency may be\n * provided without the need to change any of the consumers of that dependency.\n *\n * There are a few commonly-used terms used when talking about dependency injection:\n *\n * - Container (or Injector): Maintains a registry of all available Services and understands how to create them.\n * - Service: Anything that can be provided by the Container is called a Service – this can be a value of any type.\n * - Token: Each Service is associated with a unique name, or Token. In order to obtain a Service from the Container,\n * the consumer must provide the Token corresponding to that Service.\n * - InjectableFunction: Services are created by InjectableFunctions. When adding a Service to a Container, the\n * Service provider gives the Container a InjectableFunction which, when called will return the Service. These\n * InjectableFunctions may themselves use other Services, which will be passed to them as arguments.\n *\n * Services are, by default, singletons – that is, each call to `get()` a particular Service will return a reference\n * to the same value. In other words, InjectableFunctions are only invoked once. If multiple instances of a Service are\n * desired, a new Container can be created using the `copy([Token])` method – passing a Token to this method forces the\n * new Container to recreate the corresponding Service (the InjectableFunction will be invoked again). We say that the\n * Service is then \"scoped\" to the new Container.\n *\n *\n * One common downside of many dependency injection implementations is that the dependency graph formed by the various\n * Services can only be validated at runtime. That is, if a dependency is missing or a circular dependency is found, the\n * developer must wait until runtime to discover the error. These errors can often be confusing and hard to debug.\n *\n * This implementation eliminates this issue by moving these sorts of errors to compile time. If an unknown dependency\n * is used in a InjectableFunction, for example, the code simply won't compile.\n *\n * To achieve this, we do lose the ability to implicitly define the dependency graph, as is common with many dependency\n * injection frameworks that employ decorators to define Services and their dependencies. Instead, the dependency graph\n * must be constructed explicitly, step-by-step, via successive calls to the `provide()` method. This is a suitable\n * trade-off for CameraKit, as there are a relatively small number of Services.\n *\n * Here's a simple example of Container usage:\n * ```ts\n * const fooFactory = Injectable('Foo', () => new Foo())\n * const barFactory = Injectable('Bar', ['Foo'] as const, (foo: Foo) => new Bar(foo))\n * const container = Container.empy()\n * .provide(fooFactory)\n * .provide(barFactory)\n *\n * const bar: Bar = container.get('Bar')\n * ```\n */\n/** @internal */\nexport class Container<Services = {}> {\n private readonly factories: Factories<Services>;\n\n constructor(factories: MaybeMemoizedFactories<Services>) {\n this.factories = {} as Factories<Services>;\n for (const k in factories) {\n const fn = factories[k];\n if (isMemoized(fn)) this.factories[k] = fn;\n else this.factories[k] = memoize(fn);\n }\n }\n\n /**\n * Create a new [Container] by providing a [PartialContainer] that has no dependencies.\n */\n static provides<Services>(container: PartialContainer<Services, {}> | Container<Services>): Container<Services>;\n\n /**\n * Create a new [Container] by providing a Service that has no dependencies.\n */\n static provides<Token extends string, Service>(\n fn: InjectableFunction<{}, [], Token, Service>\n ): Container<AddService<{}, Token, Service>>;\n\n static provides(\n fnOrContainer: InjectableFunction<{}, [], string, any> | PartialContainer<any, {}> | Container<any>\n ): Container<any> {\n // Although the `provides` method has overloads that match both members of the union type separately, it does\n // not match the union type itself, so the compiler forces us to branch and handle each type within the union\n // separately. (Maybe in the future the compiler will decide to infer this, but for now this is necessary.)\n if (fnOrContainer instanceof PartialContainer) return new Container({}).provides(fnOrContainer);\n if (fnOrContainer instanceof Container) return new Container({}).provides(fnOrContainer);\n return new Container({}).provides(fnOrContainer);\n }\n\n /**\n * Create a copy of this Container, optionally providing a list of Services which will be scoped to the copy.\n *\n * This can be useful, for example, if different parts of an application wish to use the same Service interface, but\n * do not want to share a reference to same Service instance.\n *\n * Say we have a Service which manages a list of Users. Our application wishes to display two lists of Users, which\n * may be edited independently. In this case it may be desirable to create a Container for each list component, with\n * the UserList Service scoped to those Containers – that way, each list component gets a unique copy of the\n * UserList Service that can be edited independently of the other.\n *\n * @param scopedServices A list of Tokens identifying Services which will be scoped to the new Container – that is,\n * if those Services had already been created by the source Container, they will be re-created by their Factory\n * functions when provided by the new Container.\n * @returns A new copy of this Container, sharing all of this Container's Services. Services corresponding to any\n * Tokens passed to this method will be re-created by the new Container (i.e. they become \"scoped\" to the new\n * Container).\n */\n copy<Tokens extends readonly (keyof Services)[]>(scopedServices?: Tokens): Container<Services> {\n const factories: MaybeMemoizedFactories<Services> = { ...this.factories };\n\n // We \"un-memoize\" scoped Service InjectableFunctions so they will create a new copy of their Service when\n // provided by the new Container – we re-memoize them so the new Container will itself only create one Service\n // instance.\n (scopedServices || []).forEach((token: keyof Services) => {\n factories[token] = this.factories[token].delegate;\n });\n return new Container(factories);\n }\n\n /**\n * Gets a reference to this Container.\n *\n * @param token The CONTAINER token.\n * @returns This Container.\n */\n get(token: ContainerToken): this;\n\n /**\n * Get a specific Service provided by this Container.\n *\n * @param token A unique string corresponding to a Service\n * @returns A Service corresponding to the given Token.\n */\n get<Token extends keyof Services>(token: Token): Services[Token];\n\n get(token: string): this | Services[keyof Services] {\n if (token === CONTAINER) return this;\n const factory = this.factories[token];\n if (!factory) {\n throw new Error(\n `[Container::get] Could not find Service for Token \"${token}\". This should've caused a ` +\n \"compile-time error. If the Token is 'undefined', check all your calls to the Injectable \" +\n \"function. Make sure you define dependencies using string literals or string constants that are \" +\n \"definitely initialized before the call to Injectable.\"\n );\n }\n return factory(this);\n }\n\n /**\n * Run the services in this [PartialContainer]. \"Run\" simply means that [Container::get] will be called for each\n * Service, which invokes that Service's factory function, creating the Service.\n *\n * This may be useful e.g. if services need to initialize themselves, since generally a Service factory is only\n * invoked when the Service is needed.\n *\n * Note this method cannot be used to add services to a Container. – that is, calling this method does not provide\n * the services in a new Container.\n *\n * @param container Optionally provide a [PartialContainer], which will be used as a filter – the only services\n * from *this* container that will run are those with a token that is also present in this PartialContainer.\n * @returns No mutation is done to the Container, it is returned as-is (convenient for chaining).\n */\n run<AdditionalServices, Dependencies, FulfilledDependencies extends Dependencies>(\n // FullfilledDependencies is assignable to Dependencies -- by specifying Container<FulfilledDependencies> as the\n // `this` type, we ensure this Container can provide all the Dependencies required by the PartialContainer.\n this: Container<FulfilledDependencies>,\n container: PartialContainer<AdditionalServices, Dependencies>\n ): this;\n\n /**\n * Run the given Service. \"Run\" simply means that [Container::get] will be called for this Service, which invokes\n * the Service's factory function, creating the Service.\n *\n * This may be useful e.g. if services need to initialize themselves, since generally a Service factory is only\n * invoked when the Service is needed.\n *\n * Note this method cannot be used to add services to a Container. – that is, calling this method does not provide\n * the services in a new Container.\n *\n * @param fn Optionally provide an [InjectableFunction], which will be used as a filter – the only services\n * from *this* container that will run are those with a token that is also present in this PartialContainer.\n * @returns No mutation is done to the Container, it is returned as-is (convenient for chaining).\n */\n run<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service>(\n fn: InjectableFunction<Services, Tokens, Token, Service>\n ): this;\n\n run<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service, AdditionalServices>(\n fnOrContainer:\n | InjectableFunction<Services, Tokens, Token, Service>\n | PartialContainer<AdditionalServices, Services>\n ): this {\n if (fnOrContainer instanceof PartialContainer) {\n const runnableContainer = this.provides(fnOrContainer);\n for (const token of fnOrContainer.getTokens()) {\n runnableContainer.get(token);\n }\n } else {\n this.provides(fnOrContainer).get(fnOrContainer.token);\n }\n return this;\n }\n\n /**\n * Create a new Container from this Container with additional services from a given [PartialContainer].\n *\n * Services in the provided PartialContainer take precedence if there are service token conflicts.\n *\n * Services from the provided PartialContainer become scoped to the new Container – that is, if PartialContainer A\n * is provided to Container X and Container Y, each resultant Container will contain its own copy of the services\n * from PartialContainer A.\n *\n * @param container A [PartialContainer] providing additional services.\n */\n provides<AdditionalServices, Dependencies, FulfilledDependencies extends Dependencies>(\n // FullfilledDependencies is assignable to Dependencies -- by specifying Container<FulfilledDependencies> as the\n // `this` type, we ensure this Container can provide all the Dependencies required by the PartialContainer.\n this: Container<FulfilledDependencies>,\n container: PartialContainer<AdditionalServices, Dependencies>\n ): Container<Services & AdditionalServices>;\n\n /**\n * Creates a new Container from this Container with additional services from another Container.\n *\n * Services in the provided PartialContainer take precedence if there are service token conflicts.\n *\n * Services from the provided Container become scoped to both Containers (the one from which they were provided\n * and the new Container returned by this method) - that is, if Container A is provided to Container B,\n * they will share the same instances of any Services provided by Container A.\n * If Container B should re-create new instances of the Services from Container A,\n * Container A must first be copied before providing it here.\n *\n * @param container A [Container] providing additional services.\n */\n provides<AdditionalServices>(container: Container<AdditionalServices>): Container<Services & AdditionalServices>;\n\n /**\n * Create a new Container which provides a Service created by the given [InjectableFunction].\n *\n * The InjectableFunction contains metadata specifying the Token by which the created Service will be known, as well\n * as an ordered list of Tokens to be resolved and provided to the InjectableFunction as arguments.\n *\n * If any of these required dependencies are missing from the Container (or if there is a mismatch between the types\n * of those dependencies and the arguments of the InjectableFunction), a compiler error will be raised.\n *\n * @param fn A factory function, taking dependencies as arguments, which returns the Service.\n */\n provides<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service>(\n fn: InjectableFunction<Services, Tokens, Token, Service>\n ): Container<AddService<Services, Token, Service>>;\n\n provides<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service, AdditionalServices>(\n fnOrContainer:\n | InjectableFunction<Services, Tokens, Token, Service>\n | PartialContainer<AdditionalServices, Services>\n | Container<AdditionalServices>\n ): Container<any> {\n if (fnOrContainer instanceof PartialContainer || fnOrContainer instanceof Container) {\n const factories =\n fnOrContainer instanceof PartialContainer ? fnOrContainer.getFactories(this) : fnOrContainer.factories;\n // Safety: `this.factories` and `factories` are both properly type checked, so merging them produces\n // a Factories object with keys from both Services and AdditionalServices. The compiler is unable to\n // infer that Factories<A> & Factories<B> == Factories<A & B>, so the cast is required.\n return new Container(({\n ...this.factories,\n ...factories,\n } as unknown) as MaybeMemoizedFactories<Services & AdditionalServices>);\n }\n return this.providesService(fnOrContainer);\n }\n\n private providesService<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service>(\n fn: InjectableFunction<Services, Tokens, Token, Service>\n ): Container<AddService<Services, Token, Service>> {\n const token = fn.token;\n const dependencies: readonly any[] = fn.dependencies;\n\n const factory = memoize((container: Container<Services>) => {\n return fn(\n ...(dependencies.map((t) => {\n // To support overwriting an already-existing service with a new implementation, it should be\n // possibleto do `provide(A, [A], a => createNewServiceFromOld(a))` – that is, inject a dependency\n // with the same token as this service's token.\n //\n // To avoid a circular dependency (in which the factory for service A depends on itself), we always\n // use the service defined in the *parent* container (i.e. this) when injecting a dependency with\n // the same token as the service we're providing. If we did not do this, calling `container.get(t)`\n // would result in an infinite loop.\n return t === token ? this.get(t) : container.get(t);\n }) as any)\n );\n });\n\n // Safety: `token` and `factory` are property type checked, so extending `this.factories` produces a\n // MaybeMemoizedFactories object with the expected set of services – but when using the spread operation to\n // merge two objects, the compiler widens the Token type to string. So we must re-narrow via casting.\n const factories = { ...this.factories, [token]: factory };\n return new Container((factories as unknown) as MaybeMemoizedFactories<AddService<Services, Token, Service>>);\n }\n}\n"]}
1
+ {"version":3,"file":"Container.js","sourceRoot":"","sources":["../../src/dependency-injection/Container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAatD,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,gBAAgB;AAChB,MAAM,OAAO,SAAS;IAGlB,YAAY,SAA2C;QACnD,IAAI,CAAC,SAAS,GAAG,EAAyB,CAAC;QAC3C,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE;YACvB,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACxB,IAAI,UAAU,CAAC,EAAE,CAAC;gBAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;;gBACtC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;SACxC;IACL,CAAC;IAcD,MAAM,CAAC,QAAQ,CACX,aAAmG;QAEnG,6GAA6G;QAC7G,6GAA6G;QAC7G,2GAA2G;QAC3G,IAAI,aAAa,YAAY,gBAAgB;YAAE,OAAO,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QAChG,IAAI,aAAa,YAAY,SAAS;YAAE,OAAO,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;QACzF,OAAO,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,aAAa,CA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import { PartialContainer } from \"./PartialContainer\";\nimport { AddService, InjectableFunction, ValidTokens } from \"./types\";\n\ntype MaybeMemoizedFactories<Services> = {\n [K in keyof Services]:\n | ((c: Container<Services>) => Services[K])\n | Memoized<(c: Container<Services>) => Services[K]>;\n};\n\nexport type Factories<Services> = {\n [K in keyof Services]: Memoized<(c: Container<Services>) => Services[K]>;\n};\n\nexport const CONTAINER = \"$container\";\nexport type ContainerToken = typeof CONTAINER;\n\n/**\n * A Container of values, indexed each by a unique token, which can be used throughout CameraKit. This is how CameraKit\n * implements simple dependency injection.\n *\n * Dependency injection is a way to decouple the *use* of a dependency from the *creation* of that dependency. This\n * improves modularity and re-usability, since components only care about the *interfaces* of dependencies (since that\n * determines their use) and not about their concrete creation. New implementations of a particular dependency may be\n * provided without the need to change any of the consumers of that dependency.\n *\n * There are a few commonly-used terms used when talking about dependency injection:\n *\n * - Container (or Injector): Maintains a registry of all available Services and understands how to create them.\n * - Service: Anything that can be provided by the Container is called a Service – this can be a value of any type.\n * - Token: Each Service is associated with a unique name, or Token. In order to obtain a Service from the Container,\n * the consumer must provide the Token corresponding to that Service.\n * - InjectableFunction: Services are created by InjectableFunctions. When adding a Service to a Container, the\n * Service provider gives the Container a InjectableFunction which, when called will return the Service. These\n * InjectableFunctions may themselves use other Services, which will be passed to them as arguments.\n *\n * Services are, by default, singletons – that is, each call to `get()` a particular Service will return a reference\n * to the same value. In other words, InjectableFunctions are only invoked once. If multiple instances of a Service are\n * desired, a new Container can be created using the `copy([Token])` method – passing a Token to this method forces the\n * new Container to recreate the corresponding Service (the InjectableFunction will be invoked again). We say that the\n * Service is then \"scoped\" to the new Container.\n *\n *\n * One common downside of many dependency injection implementations is that the dependency graph formed by the various\n * Services can only be validated at runtime. That is, if a dependency is missing or a circular dependency is found, the\n * developer must wait until runtime to discover the error. These errors can often be confusing and hard to debug.\n *\n * This implementation eliminates this issue by moving these sorts of errors to compile time. If an unknown dependency\n * is used in a InjectableFunction, for example, the code simply won't compile.\n *\n * To achieve this, we do lose the ability to implicitly define the dependency graph, as is common with many dependency\n * injection frameworks that employ decorators to define Services and their dependencies. Instead, the dependency graph\n * must be constructed explicitly, step-by-step, via successive calls to the `provide()` method. This is a suitable\n * trade-off for CameraKit, as there are a relatively small number of Services.\n *\n * Here's a simple example of Container usage:\n * ```ts\n * const fooFactory = Injectable('Foo', () => new Foo())\n * const barFactory = Injectable('Bar', ['Foo'] as const, (foo: Foo) => new Bar(foo))\n * const container = Container.empy()\n * .provide(fooFactory)\n * .provide(barFactory)\n *\n * const bar: Bar = container.get('Bar')\n * ```\n */\n/** @internal */\nexport class Container<Services = {}> {\n private readonly factories: Factories<Services>;\n\n constructor(factories: MaybeMemoizedFactories<Services>) {\n this.factories = {} as Factories<Services>;\n for (const k in factories) {\n const fn = factories[k];\n if (isMemoized(fn)) this.factories[k] = fn;\n else this.factories[k] = memoize(fn);\n }\n }\n\n /**\n * Create a new [Container] by providing a [PartialContainer] that has no dependencies.\n */\n static provides<Services>(container: PartialContainer<Services, {}> | Container<Services>): Container<Services>;\n\n /**\n * Create a new [Container] by providing a Service that has no dependencies.\n */\n static provides<Token extends string, Service>(\n fn: InjectableFunction<{}, [], Token, Service>\n ): Container<AddService<{}, Token, Service>>;\n\n static provides(\n fnOrContainer: InjectableFunction<{}, [], string, any> | PartialContainer<any, {}> | Container<any>\n ): Container<any> {\n // Although the `provides` method has overloads that match both members of the union type separately, it does\n // not match the union type itself, so the compiler forces us to branch and handle each type within the union\n // separately. (Maybe in the future the compiler will decide to infer this, but for now this is necessary.)\n if (fnOrContainer instanceof PartialContainer) return new Container({}).provides(fnOrContainer);\n if (fnOrContainer instanceof Container) return new Container({}).provides(fnOrContainer);\n return new Container({}).provides(fnOrContainer);\n }\n\n /**\n * Create a copy of this Container, optionally providing a list of Services which will be scoped to the copy.\n *\n * This can be useful, for example, if different parts of an application wish to use the same Service interface, but\n * do not want to share a reference to same Service instance.\n *\n * Say we have a Service which manages a list of Users. Our application wishes to display two lists of Users, which\n * may be edited independently. In this case it may be desirable to create a Container for each list component, with\n * the UserList Service scoped to those Containers – that way, each list component gets a unique copy of the\n * UserList Service that can be edited independently of the other.\n *\n * @param scopedServices A list of Tokens identifying Services which will be scoped to the new Container – that is,\n * if those Services had already been created by the source Container, they will be re-created by their Factory\n * functions when provided by the new Container.\n * @returns A new copy of this Container, sharing all of this Container's Services. Services corresponding to any\n * Tokens passed to this method will be re-created by the new Container (i.e. they become \"scoped\" to the new\n * Container).\n */\n copy<Tokens extends readonly (keyof Services)[]>(scopedServices?: Tokens): Container<Services> {\n const factories: MaybeMemoizedFactories<Services> = { ...this.factories };\n\n // We \"un-memoize\" scoped Service InjectableFunctions so they will create a new copy of their Service when\n // provided by the new Container – we re-memoize them so the new Container will itself only create one Service\n // instance.\n (scopedServices || []).forEach((token: keyof Services) => {\n factories[token] = this.factories[token].delegate;\n });\n return new Container(factories);\n }\n\n /**\n * Gets a reference to this Container.\n *\n * @param token The CONTAINER token.\n * @returns This Container.\n */\n get(token: ContainerToken): this;\n\n /**\n * Get a specific Service provided by this Container.\n *\n * @param token A unique string corresponding to a Service\n * @returns A Service corresponding to the given Token.\n */\n get<Token extends keyof Services>(token: Token): Services[Token];\n\n get(token: ContainerToken | keyof Services): this | Services[keyof Services] {\n if (token === CONTAINER) return this;\n const factory = this.factories[token];\n if (!factory) {\n throw new Error(\n `[Container::get] Could not find Service for Token \"${String(token)}\". This should've caused a ` +\n \"compile-time error. If the Token is 'undefined', check all your calls to the Injectable \" +\n \"function. Make sure you define dependencies using string literals or string constants that are \" +\n \"definitely initialized before the call to Injectable.\"\n );\n }\n return factory(this);\n }\n\n /**\n * Run the services in this [PartialContainer]. \"Run\" simply means that [Container::get] will be called for each\n * Service, which invokes that Service's factory function, creating the Service.\n *\n * This may be useful e.g. if services need to initialize themselves, since generally a Service factory is only\n * invoked when the Service is needed.\n *\n * Note this method cannot be used to add services to a Container. – that is, calling this method does not provide\n * the services in a new Container.\n *\n * @param container Optionally provide a [PartialContainer], which will be used as a filter – the only services\n * from *this* container that will run are those with a token that is also present in this PartialContainer.\n * @returns No mutation is done to the Container, it is returned as-is (convenient for chaining).\n */\n run<AdditionalServices, Dependencies, FulfilledDependencies extends Dependencies>(\n // FullfilledDependencies is assignable to Dependencies -- by specifying Container<FulfilledDependencies> as the\n // `this` type, we ensure this Container can provide all the Dependencies required by the PartialContainer.\n this: Container<FulfilledDependencies>,\n container: PartialContainer<AdditionalServices, Dependencies>\n ): this;\n\n /**\n * Run the given Service. \"Run\" simply means that [Container::get] will be called for this Service, which invokes\n * the Service's factory function, creating the Service.\n *\n * This may be useful e.g. if services need to initialize themselves, since generally a Service factory is only\n * invoked when the Service is needed.\n *\n * Note this method cannot be used to add services to a Container. – that is, calling this method does not provide\n * the services in a new Container.\n *\n * @param fn Optionally provide an [InjectableFunction], which will be used as a filter – the only services\n * from *this* container that will run are those with a token that is also present in this PartialContainer.\n * @returns No mutation is done to the Container, it is returned as-is (convenient for chaining).\n */\n run<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service>(\n fn: InjectableFunction<Services, Tokens, Token, Service>\n ): this;\n\n run<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service, AdditionalServices>(\n fnOrContainer:\n | InjectableFunction<Services, Tokens, Token, Service>\n | PartialContainer<AdditionalServices, Services>\n ): this {\n if (fnOrContainer instanceof PartialContainer) {\n const runnableContainer = this.provides(fnOrContainer);\n for (const token of fnOrContainer.getTokens()) {\n runnableContainer.get(token);\n }\n } else {\n this.provides(fnOrContainer).get(fnOrContainer.token);\n }\n return this;\n }\n\n /**\n * Create a new Container from this Container with additional services from a given [PartialContainer].\n *\n * Services in the provided PartialContainer take precedence if there are service token conflicts.\n *\n * Services from the provided PartialContainer become scoped to the new Container – that is, if PartialContainer A\n * is provided to Container X and Container Y, each resultant Container will contain its own copy of the services\n * from PartialContainer A.\n *\n * @param container A [PartialContainer] providing additional services.\n */\n provides<AdditionalServices, Dependencies, FulfilledDependencies extends Dependencies>(\n // FullfilledDependencies is assignable to Dependencies -- by specifying Container<FulfilledDependencies> as the\n // `this` type, we ensure this Container can provide all the Dependencies required by the PartialContainer.\n this: Container<FulfilledDependencies>,\n container: PartialContainer<AdditionalServices, Dependencies>\n ): Container<Services & AdditionalServices>;\n\n /**\n * Creates a new Container from this Container with additional services from another Container.\n *\n * Services in the provided PartialContainer take precedence if there are service token conflicts.\n *\n * Services from the provided Container become scoped to both Containers (the one from which they were provided\n * and the new Container returned by this method) - that is, if Container A is provided to Container B,\n * they will share the same instances of any Services provided by Container A.\n * If Container B should re-create new instances of the Services from Container A,\n * Container A must first be copied before providing it here.\n *\n * @param container A [Container] providing additional services.\n */\n provides<AdditionalServices>(container: Container<AdditionalServices>): Container<Services & AdditionalServices>;\n\n /**\n * Create a new Container which provides a Service created by the given [InjectableFunction].\n *\n * The InjectableFunction contains metadata specifying the Token by which the created Service will be known, as well\n * as an ordered list of Tokens to be resolved and provided to the InjectableFunction as arguments.\n *\n * If any of these required dependencies are missing from the Container (or if there is a mismatch between the types\n * of those dependencies and the arguments of the InjectableFunction), a compiler error will be raised.\n *\n * @param fn A factory function, taking dependencies as arguments, which returns the Service.\n */\n provides<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service>(\n fn: InjectableFunction<Services, Tokens, Token, Service>\n ): Container<AddService<Services, Token, Service>>;\n\n provides<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service, AdditionalServices>(\n fnOrContainer:\n | InjectableFunction<Services, Tokens, Token, Service>\n | PartialContainer<AdditionalServices, Services>\n | Container<AdditionalServices>\n ): Container<any> {\n if (fnOrContainer instanceof PartialContainer || fnOrContainer instanceof Container) {\n const factories =\n fnOrContainer instanceof PartialContainer ? fnOrContainer.getFactories(this) : fnOrContainer.factories;\n // Safety: `this.factories` and `factories` are both properly type checked, so merging them produces\n // a Factories object with keys from both Services and AdditionalServices. The compiler is unable to\n // infer that Factories<A> & Factories<B> == Factories<A & B>, so the cast is required.\n return new Container({\n ...this.factories,\n ...factories,\n } as unknown as MaybeMemoizedFactories<Services & AdditionalServices>);\n }\n return this.providesService(fnOrContainer);\n }\n\n private providesService<Token extends string, Tokens extends readonly ValidTokens<Services>[], Service>(\n fn: InjectableFunction<Services, Tokens, Token, Service>\n ): Container<AddService<Services, Token, Service>> {\n const token = fn.token;\n const dependencies: readonly any[] = fn.dependencies;\n\n const factory = memoize((container: Container<Services>) => {\n return fn(\n ...(dependencies.map((t) => {\n // To support overwriting an already-existing service with a new implementation, it should be\n // possibleto do `provide(A, [A], a => createNewServiceFromOld(a))` – that is, inject a dependency\n // with the same token as this service's token.\n //\n // To avoid a circular dependency (in which the factory for service A depends on itself), we always\n // use the service defined in the *parent* container (i.e. this) when injecting a dependency with\n // the same token as the service we're providing. If we did not do this, calling `container.get(t)`\n // would result in an infinite loop.\n return t === token ? this.get(t) : container.get(t);\n }) as any)\n );\n });\n\n // Safety: `token` and `factory` are property type checked, so extending `this.factories` produces a\n // MaybeMemoizedFactories object with the expected set of services – but when using the spread operation to\n // merge two objects, the compiler widens the Token type to string. So we must re-narrow via casting.\n const factories = { ...this.factories, [token]: factory };\n return new Container(factories as unknown as MaybeMemoizedFactories<AddService<Services, Token, Service>>);\n }\n}\n"]}
@@ -1,19 +1,23 @@
1
- import { Container, Factories } from "./Container";
1
+ import { Memoized } from "../common/memoize";
2
+ import { Container } from "./Container";
2
3
  import { AddService, InjectableFunction, ServicesFromTokenizedParams, ValidTokens } from "./types";
3
- declare type AddDependencies<ParentDependencies, Dependencies> = ParentDependencies extends any ? {
4
+ type AddDependencies<ParentDependencies, Dependencies> = ParentDependencies extends any ? {
4
5
  [K in keyof ParentDependencies | keyof Dependencies]: K extends keyof ParentDependencies ? ParentDependencies[K] : K extends keyof Dependencies ? Dependencies[K] : never;
5
6
  } : never;
6
- declare type ExcludeKey<T, U> = T extends any ? {
7
+ type ExcludeKey<T, U> = T extends any ? {
7
8
  [K in Exclude<keyof T, U>]: T[K];
8
9
  } : never;
9
- declare type PartialInjectableFunction<Params extends readonly any[], Tokens extends readonly string[], Token extends string, Service> = {
10
+ type PartialInjectableFunction<Params extends readonly any[], Tokens extends readonly string[], Token extends string, Service> = {
10
11
  (...args: Params): Service;
11
12
  token: Token;
12
13
  dependencies: Tokens;
13
14
  };
14
- declare type Injectables<Services, Dependencies> = {
15
+ type Injectables<Services, Dependencies> = {
15
16
  [K in keyof Services]: K extends string ? InjectableFunction<Services & Dependencies, readonly ValidTokens<Services & Dependencies>[], K, Services[K]> : never;
16
17
  };
18
+ type PartialContainerFactories<Services, Dependecies> = {
19
+ [K in keyof Services]: Memoized<(c: Container<Partial<Services> & Dependecies>) => Services[K]>;
20
+ };
17
21
  /**
18
22
  * Similar to [Container], with the exception that Services may be provided to a PartialContainer which *does not*
19
23
  * contain all of that Services dependencies.
@@ -75,7 +79,7 @@ export declare class PartialContainer<Services = {}, Dependencies = {}> {
75
79
  *
76
80
  * @param parent A [Container] which provides all the required Dependencies of this PartialContainer.
77
81
  */
78
- getFactories(parent: Container<Dependencies>): Factories<Services>;
82
+ getFactories(parent: Container<Dependencies>): PartialContainerFactories<Services, Dependencies>;
79
83
  getTokens(): Array<keyof Services>;
80
84
  }
81
85
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"PartialContainer.js","sourceRoot":"","sources":["../../src/dependency-injection/PartialContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAoC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,gBAAgB;AAChB,MAAM,OAAO,gBAAgB;IACzB,YAA6B,WAAgD;QAAhD,gBAAW,GAAX,WAAW,CAAqC;IAAG,CAAC;IAEjF;;;;;;;;;;;OAWG;IACH,QAAQ,CAMJ,EAA6E;QAc7E,OAAO,IAAI,gBAAgB,CAAC,gCAAK,IAAI,CAAC,WAAW,KAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,GAAS,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,MAA+B;QACxC,OAAO,MAAM,CAAC,WAAW,CACrB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;YAC1C,OAAO;gBACH,KAAK;gBACL,OAAO,CAAC,CAAC,CAAqC,EAAE,EAAE;oBAC9C,OAAO,EAAE,CACL,GAAI,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBAC1B,OAAO,CAAC,KAAK,KAAK;4BACd,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAuB,CAAC;4BACrC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAkC,CAAC,CAAC;oBACpD,CAAC,CAAS,CACb,CAAC;gBACN,CAAC,CAAC;aACL,CAAC;QACN,CAAC,CAAC,CACkB,CAAC;IAC7B,CAAC;IAED,SAAS;QACL,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAA0B,CAAC;IAClE,CAAC;CACJ","sourcesContent":["import { entries } from \"../common/entries\";\nimport { memoize } from \"../common/memoize\";\nimport { Container, Factories } from \"./Container\";\nimport { AddService, InjectableFunction, ServicesFromTokenizedParams, ValidTokens } from \"./types\";\n\n// Using a conditional type forces TS language services to evaluate the type -- so when showing e.g. type hints, we\n// will see the mapped type instead of the AddDependencies type alias. This produces better hints.\ntype AddDependencies<ParentDependencies, Dependencies> = ParentDependencies extends any\n ? // A mapped type produces better, more concise type hints than an intersection type.\n {\n [K in keyof ParentDependencies | keyof Dependencies]: K extends keyof ParentDependencies\n ? ParentDependencies[K]\n : K extends keyof Dependencies\n ? Dependencies[K]\n : never;\n }\n : never;\n\ntype ExcludeKey<T, U> = T extends any ? { [K in Exclude<keyof T, U>]: T[K] } : never;\n\ntype PartialInjectableFunction<\n Params extends readonly any[],\n Tokens extends readonly string[],\n Token extends string,\n Service\n> = {\n (...args: Params): Service;\n token: Token;\n dependencies: Tokens;\n};\n\ntype Injectables<Services, Dependencies> = {\n [K in keyof Services]: K extends string\n ? InjectableFunction<Services & Dependencies, readonly ValidTokens<Services & Dependencies>[], K, Services[K]>\n : never;\n};\n\n/**\n * Similar to [Container], with the exception that Services may be provided to a PartialContainer which *does not*\n * contain all of that Services dependencies.\n *\n * For this to remain safe, Services can not be resolved by PartialContainer – it has no `get` method.\n *\n * Instead, the PartialContainer must be provided to a [Container] which *does* contain all the dependencies required\n * by all the Service in the PartialContainer. The resulting [Container] can then resolve these Services.\n *\n * PartialContainers are used to create a collection of Services which can then be provided via a simple one-line syntax\n * to an existing Container (which fulfills the collection's dependencies). It is an organizational tool, allowing\n * coherent groupings of Services to be defined in one place, then combined elsewhere to form a complete [Container].\n *\n * Here's an example of PartialContainer usage:\n * ```ts\n * // We can provide fooFactory, even though the PartialContainer doesn't fulfill the Bar dependency.\n * const fooFactory = Injectable('Foo', ['Bar'] as const, (bar: Bar) => new Foo(bar))\n * const partialContainer = new PartialContainer({}).provide(fooFactory)\n *\n * const barFactory = Injectable('Bar', () => new Bar())\n * const dependenciesContainer = Container.provides(barFactory)\n *\n * const combinedContainer = dependenciesContainer.provides(partialContainer)\n *\n * // We can resolve Foo, because the combined container includes Bar, so all of Foo's dependencies are now met.\n * const foo = combinedContainer.get('Foo')\n * ```\n */\n/** @internal */\nexport class PartialContainer<Services = {}, Dependencies = {}> {\n constructor(private readonly injectables: Injectables<Services, Dependencies>) {}\n\n /**\n * Create a new PartialContainer which provides a Service created by the given InjectableFunction.\n *\n * The InjectableFunction contains metadata specifying the Token by which the created Service will be known, as well\n * as an ordered list of Tokens to be resolved and provided to the InjectableFunction as arguments.\n *\n * This dependencies are allowed to be missing from the PartialContainer, but these dependencies are maintained as a\n * parameter of the returned PartialContainer. This allows `[Container.provides]` to type check the dependencies and\n * ensure they can be provided by the Container.\n *\n * @param fn A InjectableFunction, taking dependencies as arguments, which returns the Service.\n */\n provides<\n AdditionalDependencies extends readonly any[],\n Tokens extends readonly string[],\n Token extends string,\n Service\n >(\n fn: PartialInjectableFunction<AdditionalDependencies, Tokens, Token, Service>\n ): PartialContainer<\n AddService<Services, Token, Service>,\n // The dependencies of the new PartialContainer are the combined dependencies of this container and the\n // PartialInjectableFunction -- but we exclude any dependencies already provided by this container (i.e. this\n // container's Services) as well as the new Service being provided.\n ExcludeKey<\n AddDependencies<\n ExcludeKey<Dependencies, Token>,\n ServicesFromTokenizedParams<Tokens, AdditionalDependencies>\n >,\n keyof Services\n >\n > {\n return new PartialContainer({ ...this.injectables, [fn.token]: fn } as any);\n }\n\n /**\n * In order to create a [Container], the InjectableFunctions maintained by the PartialContainer must be memoized\n * into Factories that can resolve their dependencies and return the correct Service.\n *\n * In particular, this requires access to a \"parent\" Container to avoid infinite looping in cases where Service A\n * depends on Service A – this is allowed (as long as the parent container provides Service A), but requires access\n * to the parent Container to provide the parent implementation of Service A.\n *\n * This also means that Services provided by a PartialContainer to a Container via this function will always be\n * scoped to the Container. In other words, if a PartialContainer containing Service A is provided to both\n * Container X and Container Y, when Service A is resolved by Container X the InjectableFunction used to create\n * Service A will be invoked – and when Service A is resolved by Container Y, the InjectableFunction will be invoked\n * again.\n *\n * @param parent A [Container] which provides all the required Dependencies of this PartialContainer.\n */\n getFactories(parent: Container<Dependencies>): Factories<Services> {\n return Object.fromEntries(\n entries(this.injectables).map(([token, fn]) => {\n return [\n token,\n memoize((c: Container<Services & Dependencies>) => {\n return fn(\n ...(fn.dependencies.map((t) => {\n return t === token\n ? parent.get(t as keyof Dependencies)\n : c.get(t as keyof Services & Dependencies);\n }) as any)\n );\n }),\n ];\n })\n ) as Factories<Services>;\n }\n\n getTokens(): Array<keyof Services> {\n return Object.keys(this.injectables) as Array<keyof Services>;\n }\n}\n"]}
1
+ {"version":3,"file":"PartialContainer.js","sourceRoot":"","sources":["../../src/dependency-injection/PartialContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AAwCtD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,gBAAgB;AAChB,MAAM,OAAO,gBAAgB;IACzB,YAA6B,WAAgD;QAAhD,gBAAW,GAAX,WAAW,CAAqC;IAAG,CAAC;IAEjF;;;;;;;;;;;OAWG;IACH,QAAQ,CAMJ,EAA6E;QAc7E,OAAO,IAAI,gBAAgB,CAAC,gCAAK,IAAI,CAAC,WAAW,KAAE,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,GAAS,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,YAAY,CAAC,MAA+B;QACxC,OAAO,MAAM,CAAC,WAAW,CACrB,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE;YAC1C,OAAO;gBACH,KAAK;gBACL,OAAO,CAAC,CAAC,CAAqC,EAAE,EAAE;oBAC9C,OAAO,EAAE,CACL,GAAI,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;wBAC1B,OAAO,CAAC,KAAK,KAAK;4BACd,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAuB,CAAC;4BACrC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAkC,CAAC,CAAC;oBACpD,CAAC,CAAS,CACb,CAAC;gBACN,CAAC,CAAC;aACL,CAAC;QACN,CAAC,CAAC,CACgD,CAAC;IAC3D,CAAC;IAED,SAAS;QACL,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAA0B,CAAC;IAClE,CAAC;CACJ","sourcesContent":["import { entries } from \"../common/entries\";\nimport { memoize, Memoized } from \"../common/memoize\";\nimport { Container } from \"./Container\";\nimport { AddService, InjectableFunction, ServicesFromTokenizedParams, ValidTokens } from \"./types\";\n\n// Using a conditional type forces TS language services to evaluate the type -- so when showing e.g. type hints, we\n// will see the mapped type instead of the AddDependencies type alias. This produces better hints.\ntype AddDependencies<ParentDependencies, Dependencies> = ParentDependencies extends any\n ? // A mapped type produces better, more concise type hints than an intersection type.\n {\n [K in keyof ParentDependencies | keyof Dependencies]: K extends keyof ParentDependencies\n ? ParentDependencies[K]\n : K extends keyof Dependencies\n ? Dependencies[K]\n : never;\n }\n : never;\n\ntype ExcludeKey<T, U> = T extends any ? { [K in Exclude<keyof T, U>]: T[K] } : never;\n\ntype PartialInjectableFunction<\n Params extends readonly any[],\n Tokens extends readonly string[],\n Token extends string,\n Service\n> = {\n (...args: Params): Service;\n token: Token;\n dependencies: Tokens;\n};\n\ntype Injectables<Services, Dependencies> = {\n [K in keyof Services]: K extends string\n ? InjectableFunction<Services & Dependencies, readonly ValidTokens<Services & Dependencies>[], K, Services[K]>\n : never;\n};\n\ntype PartialContainerFactories<Services, Dependecies> = {\n [K in keyof Services]: Memoized<(c: Container<Partial<Services> & Dependecies>) => Services[K]>;\n};\n\n/**\n * Similar to [Container], with the exception that Services may be provided to a PartialContainer which *does not*\n * contain all of that Services dependencies.\n *\n * For this to remain safe, Services can not be resolved by PartialContainer – it has no `get` method.\n *\n * Instead, the PartialContainer must be provided to a [Container] which *does* contain all the dependencies required\n * by all the Service in the PartialContainer. The resulting [Container] can then resolve these Services.\n *\n * PartialContainers are used to create a collection of Services which can then be provided via a simple one-line syntax\n * to an existing Container (which fulfills the collection's dependencies). It is an organizational tool, allowing\n * coherent groupings of Services to be defined in one place, then combined elsewhere to form a complete [Container].\n *\n * Here's an example of PartialContainer usage:\n * ```ts\n * // We can provide fooFactory, even though the PartialContainer doesn't fulfill the Bar dependency.\n * const fooFactory = Injectable('Foo', ['Bar'] as const, (bar: Bar) => new Foo(bar))\n * const partialContainer = new PartialContainer({}).provide(fooFactory)\n *\n * const barFactory = Injectable('Bar', () => new Bar())\n * const dependenciesContainer = Container.provides(barFactory)\n *\n * const combinedContainer = dependenciesContainer.provides(partialContainer)\n *\n * // We can resolve Foo, because the combined container includes Bar, so all of Foo's dependencies are now met.\n * const foo = combinedContainer.get('Foo')\n * ```\n */\n/** @internal */\nexport class PartialContainer<Services = {}, Dependencies = {}> {\n constructor(private readonly injectables: Injectables<Services, Dependencies>) {}\n\n /**\n * Create a new PartialContainer which provides a Service created by the given InjectableFunction.\n *\n * The InjectableFunction contains metadata specifying the Token by which the created Service will be known, as well\n * as an ordered list of Tokens to be resolved and provided to the InjectableFunction as arguments.\n *\n * This dependencies are allowed to be missing from the PartialContainer, but these dependencies are maintained as a\n * parameter of the returned PartialContainer. This allows `[Container.provides]` to type check the dependencies and\n * ensure they can be provided by the Container.\n *\n * @param fn A InjectableFunction, taking dependencies as arguments, which returns the Service.\n */\n provides<\n AdditionalDependencies extends readonly any[],\n Tokens extends readonly string[],\n Token extends string,\n Service\n >(\n fn: PartialInjectableFunction<AdditionalDependencies, Tokens, Token, Service>\n ): PartialContainer<\n AddService<Services, Token, Service>,\n // The dependencies of the new PartialContainer are the combined dependencies of this container and the\n // PartialInjectableFunction -- but we exclude any dependencies already provided by this container (i.e. this\n // container's Services) as well as the new Service being provided.\n ExcludeKey<\n AddDependencies<\n ExcludeKey<Dependencies, Token>,\n ServicesFromTokenizedParams<Tokens, AdditionalDependencies>\n >,\n keyof Services\n >\n > {\n return new PartialContainer({ ...this.injectables, [fn.token]: fn } as any);\n }\n\n /**\n * In order to create a [Container], the InjectableFunctions maintained by the PartialContainer must be memoized\n * into Factories that can resolve their dependencies and return the correct Service.\n *\n * In particular, this requires access to a \"parent\" Container to avoid infinite looping in cases where Service A\n * depends on Service A – this is allowed (as long as the parent container provides Service A), but requires access\n * to the parent Container to provide the parent implementation of Service A.\n *\n * This also means that Services provided by a PartialContainer to a Container via this function will always be\n * scoped to the Container. In other words, if a PartialContainer containing Service A is provided to both\n * Container X and Container Y, when Service A is resolved by Container X the InjectableFunction used to create\n * Service A will be invoked – and when Service A is resolved by Container Y, the InjectableFunction will be invoked\n * again.\n *\n * @param parent A [Container] which provides all the required Dependencies of this PartialContainer.\n */\n getFactories(parent: Container<Dependencies>): PartialContainerFactories<Services, Dependencies> {\n return Object.fromEntries(\n entries(this.injectables).map(([token, fn]) => {\n return [\n token,\n memoize((c: Container<Services & Dependencies>) => {\n return fn(\n ...(fn.dependencies.map((t) => {\n return t === token\n ? parent.get(t as keyof Dependencies)\n : c.get(t as keyof Services & Dependencies);\n }) as any)\n );\n }),\n ];\n })\n ) as PartialContainerFactories<Services, Dependencies>;\n }\n\n getTokens(): Array<keyof Services> {\n return Object.keys(this.injectables) as Array<keyof Services>;\n }\n}\n"]}
@@ -23,7 +23,7 @@ import { ServicesFromInjectables } from "./types";
23
23
  /**
24
24
  * All services available to be customized by client app.
25
25
  */
26
- export declare type PublicServices = ServicesFromInjectables<[
26
+ export type PublicServices = ServicesFromInjectables<[
27
27
  ReturnType<typeof createCameraKitConfigurationFactory>,
28
28
  typeof defaultFetchHandlerFactory,
29
29
  typeof remoteMediaAssetLoaderFactory,
@@ -42,7 +42,7 @@ export declare type PublicServices = ServicesFromInjectables<[
42
42
  * There may be a way to eliminate this extra boilerplate, but for now it's required in order to present a cleaner
43
43
  * `bootstrapCameraKit` API to applications.
44
44
  */
45
- export declare type RootServices = {
45
+ export type RootServices = {
46
46
  [lensCoreFactory.token]: LensCoreModule;
47
47
  } & PublicServices & ServicesFromInjectables<[
48
48
  typeof metricsEventTargetFactory,
@@ -1,14 +1,14 @@
1
1
  import { Container, ContainerToken } from "./Container";
2
- declare type AsTuple<T> = T extends readonly any[] ? T : never;
3
- declare type CorrespondingService<Services, Token extends ValidTokens<Services>> = Token extends ContainerToken ? Container<Services> : Token extends keyof Services ? Services[Token] : never;
2
+ type AsTuple<T> = T extends readonly any[] ? T : never;
3
+ type CorrespondingService<Services, Token extends ValidTokens<Services>> = Token extends ContainerToken ? Container<Services> : Token extends keyof Services ? Services[Token] : never;
4
4
  /**
5
5
  * Given a Services object, the valid Tokens are simply the keys of that object or the special Container Token.
6
6
  */
7
- export declare type ValidTokens<Services> = ContainerToken | keyof Services;
7
+ export type ValidTokens<Services> = ContainerToken | keyof Services;
8
8
  /**
9
9
  * Given Services, map from a list of Tokens to a list of Service types.
10
10
  */
11
- export declare type CorrespondingServices<Services, Tokens extends readonly ValidTokens<Services>[]> = {
11
+ export type CorrespondingServices<Services, Tokens extends readonly ValidTokens<Services>[]> = {
12
12
  [K in keyof Tokens]: Tokens[K] extends ValidTokens<Services> ? CorrespondingService<Services, Tokens[K]> : never;
13
13
  };
14
14
  /**
@@ -22,13 +22,13 @@ export declare type CorrespondingServices<Services, Tokens extends readonly Vali
22
22
  * A InjectableFunction also includes its own key Token and dependency Tokens as metadata, so it may be resolved by
23
23
  * Container<Services> later.
24
24
  */
25
- export declare type InjectableFunction<Services, Tokens, Token extends string, Service> = Tokens extends readonly ValidTokens<Services>[] ? {
25
+ export type InjectableFunction<Services, Tokens, Token extends string, Service> = Tokens extends readonly ValidTokens<Services>[] ? {
26
26
  (...args: AsTuple<CorrespondingServices<Services, Tokens>>): Service;
27
27
  token: Token;
28
28
  dependencies: Tokens;
29
29
  } : never;
30
- export declare type AnyInjectable = InjectableFunction<any, readonly string[], string, any>;
31
- export declare type ServicesFromInjectables<Injectables extends readonly AnyInjectable[]> = {
30
+ export type AnyInjectable = InjectableFunction<any, readonly string[], string, any>;
31
+ export type ServicesFromInjectables<Injectables extends readonly AnyInjectable[]> = {
32
32
  [Name in Injectables[number]["token"]]: ReturnType<Extract<Injectables[number], {
33
33
  token: Name;
34
34
  }>>;
@@ -36,7 +36,7 @@ export declare type ServicesFromInjectables<Injectables extends readonly AnyInje
36
36
  /**
37
37
  * Add a Service with a Token to an existing set of Services.
38
38
  */
39
- export declare type AddService<ParentServices, Token extends string, Service> = ParentServices extends any ? {
39
+ export type AddService<ParentServices, Token extends string, Service> = ParentServices extends any ? {
40
40
  [K in keyof ParentServices | Token]: K extends keyof ParentServices ? ParentServices[K] : Service;
41
41
  } : never;
42
42
  /**
@@ -50,7 +50,7 @@ export declare type AddService<ParentServices, Token extends string, Service> =
50
50
  * const badfoobar: FooBar = {foo: 1, bar: 'bar'} // any extra, missing, or mis-typed properties raise an error.
51
51
  * ```
52
52
  */
53
- export declare type ServicesFromTokenizedParams<Tokens, Params> = Tokens extends readonly [] ? Params extends readonly [] ? {} : never : Tokens extends readonly [infer Token, ...infer RemainingTokens] ? Params extends readonly [infer Param, ...infer RemainingParams] ? Tokens["length"] extends Params["length"] ? Token extends ContainerToken ? Param extends Container<infer S> ? S & ServicesFromTokenizedParams<RemainingTokens, RemainingParams> : never : Token extends string ? {
53
+ export type ServicesFromTokenizedParams<Tokens, Params> = Tokens extends readonly [] ? Params extends readonly [] ? {} : never : Tokens extends readonly [infer Token, ...infer RemainingTokens] ? Params extends readonly [infer Param, ...infer RemainingParams] ? Tokens["length"] extends Params["length"] ? Token extends ContainerToken ? Param extends Container<infer S> ? S & ServicesFromTokenizedParams<RemainingTokens, RemainingParams> : never : Token extends string ? {
54
54
  [K in Token]: Param extends Container<infer S> ? S : Param;
55
55
  } & ServicesFromTokenizedParams<RemainingTokens, RemainingParams> : never : never : never : never;
56
56
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/dependency-injection/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable import/exports-last */\nimport { Container, ContainerToken } from \"./Container\";\n\ntype AsTuple<T> = T extends readonly any[] ? T : never;\n\ntype CorrespondingService<Services, Token extends ValidTokens<Services>> = Token extends ContainerToken\n ? Container<Services>\n : Token extends keyof Services\n ? Services[Token]\n : never;\n\n/**\n * Given a Services object, the valid Tokens are simply the keys of that object or the special Container Token.\n */\nexport type ValidTokens<Services> = ContainerToken | keyof Services;\n\n/**\n * Given Services, map from a list of Tokens to a list of Service types.\n */\nexport type CorrespondingServices<Services, Tokens extends readonly ValidTokens<Services>[]> = {\n [K in keyof Tokens]: Tokens[K] extends ValidTokens<Services> ? CorrespondingService<Services, Tokens[K]> : never;\n};\n\n/**\n * A valid InjectableFunction is one that can be successfully called, given some Services, to return a new Service. That\n * is, it must satisfy two conditions:\n *\n * 1. All the Tokens it specifies as dependencies are valid given the Services (i.e. they are either the Container\n * Token or keys of the Services type).\n * 2. The function argument types correspond to the Services specified by the dependency Tokens.\n *\n * A InjectableFunction also includes its own key Token and dependency Tokens as metadata, so it may be resolved by\n * Container<Services> later.\n */\nexport type InjectableFunction<\n Services,\n Tokens,\n Token extends string,\n Service\n> = Tokens extends readonly ValidTokens<Services>[]\n ? {\n (...args: AsTuple<CorrespondingServices<Services, Tokens>>): Service;\n token: Token;\n dependencies: Tokens;\n }\n : never;\n\nexport type AnyInjectable = InjectableFunction<any, readonly string[], string, any>;\n\nexport type ServicesFromInjectables<Injectables extends readonly AnyInjectable[]> = {\n [Name in Injectables[number][\"token\"]]: ReturnType<Extract<Injectables[number], { token: Name }>>;\n};\n\n/**\n * Add a Service with a Token to an existing set of Services.\n */\n// Using a conditional type forces TS language services to evaluate the type -- so when showing e.g. type hints, we\n// will see the mapped type instead of the AddService type alias. This produces better hints.\nexport type AddService<ParentServices, Token extends string, Service> = ParentServices extends any\n ? // A mapped type produces better, more concise type hints than an intersection type.\n { [K in keyof ParentServices | Token]: K extends keyof ParentServices ? ParentServices[K] : Service }\n : never;\n\n/**\n * Create an object type from two tuples of the same length. The first tuple contains the object keys (strings) and the\n * second contains the value types corresponding to those keys.\n *\n * Ex:\n * ```ts\n * type FooBar = ServicesFromTokenizedParams<['foo', 'bar'], [string, number]>\n * const foobar: FooBar = {foo: 'foo', bar: 1}\n * const badfoobar: FooBar = {foo: 1, bar: 'bar'} // any extra, missing, or mis-typed properties raise an error.\n * ```\n */\nexport type ServicesFromTokenizedParams<Tokens, Params> = Tokens extends readonly []\n ? Params extends readonly []\n ? {}\n : never\n : Tokens extends readonly [infer Token, ...infer RemainingTokens]\n ? Params extends readonly [infer Param, ...infer RemainingParams]\n ? Tokens[\"length\"] extends Params[\"length\"]\n ? Token extends ContainerToken\n ? Param extends Container<infer S>\n ? S & ServicesFromTokenizedParams<RemainingTokens, RemainingParams>\n : never\n : Token extends string\n ? { [K in Token]: Param extends Container<infer S> ? S : Param } &\n ServicesFromTokenizedParams<RemainingTokens, RemainingParams>\n : never\n : never\n : never\n : never;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/dependency-injection/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable import/exports-last */\nimport { Container, ContainerToken } from \"./Container\";\n\ntype AsTuple<T> = T extends readonly any[] ? T : never;\n\ntype CorrespondingService<Services, Token extends ValidTokens<Services>> = Token extends ContainerToken\n ? Container<Services>\n : Token extends keyof Services\n ? Services[Token]\n : never;\n\n/**\n * Given a Services object, the valid Tokens are simply the keys of that object or the special Container Token.\n */\nexport type ValidTokens<Services> = ContainerToken | keyof Services;\n\n/**\n * Given Services, map from a list of Tokens to a list of Service types.\n */\nexport type CorrespondingServices<Services, Tokens extends readonly ValidTokens<Services>[]> = {\n [K in keyof Tokens]: Tokens[K] extends ValidTokens<Services> ? CorrespondingService<Services, Tokens[K]> : never;\n};\n\n/**\n * A valid InjectableFunction is one that can be successfully called, given some Services, to return a new Service. That\n * is, it must satisfy two conditions:\n *\n * 1. All the Tokens it specifies as dependencies are valid given the Services (i.e. they are either the Container\n * Token or keys of the Services type).\n * 2. The function argument types correspond to the Services specified by the dependency Tokens.\n *\n * A InjectableFunction also includes its own key Token and dependency Tokens as metadata, so it may be resolved by\n * Container<Services> later.\n */\nexport type InjectableFunction<\n Services,\n Tokens,\n Token extends string,\n Service\n> = Tokens extends readonly ValidTokens<Services>[]\n ? {\n (...args: AsTuple<CorrespondingServices<Services, Tokens>>): Service;\n token: Token;\n dependencies: Tokens;\n }\n : never;\n\nexport type AnyInjectable = InjectableFunction<any, readonly string[], string, any>;\n\nexport type ServicesFromInjectables<Injectables extends readonly AnyInjectable[]> = {\n [Name in Injectables[number][\"token\"]]: ReturnType<Extract<Injectables[number], { token: Name }>>;\n};\n\n/**\n * Add a Service with a Token to an existing set of Services.\n */\n// Using a conditional type forces TS language services to evaluate the type -- so when showing e.g. type hints, we\n// will see the mapped type instead of the AddService type alias. This produces better hints.\nexport type AddService<ParentServices, Token extends string, Service> = ParentServices extends any\n ? // A mapped type produces better, more concise type hints than an intersection type.\n { [K in keyof ParentServices | Token]: K extends keyof ParentServices ? ParentServices[K] : Service }\n : never;\n\n/**\n * Create an object type from two tuples of the same length. The first tuple contains the object keys (strings) and the\n * second contains the value types corresponding to those keys.\n *\n * Ex:\n * ```ts\n * type FooBar = ServicesFromTokenizedParams<['foo', 'bar'], [string, number]>\n * const foobar: FooBar = {foo: 'foo', bar: 1}\n * const badfoobar: FooBar = {foo: 1, bar: 'bar'} // any extra, missing, or mis-typed properties raise an error.\n * ```\n */\nexport type ServicesFromTokenizedParams<Tokens, Params> = Tokens extends readonly []\n ? Params extends readonly []\n ? {}\n : never\n : Tokens extends readonly [infer Token, ...infer RemainingTokens]\n ? Params extends readonly [infer Param, ...infer RemainingParams]\n ? Tokens[\"length\"] extends Params[\"length\"]\n ? Token extends ContainerToken\n ? Param extends Container<infer S>\n ? S & ServicesFromTokenizedParams<RemainingTokens, RemainingParams>\n : never\n : Token extends string\n ? { [K in Token]: Param extends Container<infer S> ? S : Param } & ServicesFromTokenizedParams<\n RemainingTokens,\n RemainingParams\n >\n : never\n : never\n : never\n : never;\n"]}
@@ -1 +1 @@
1
- { "PACKAGE_VERSION": "0.7.0-alpha.1" }
1
+ { "PACKAGE_VERSION": "0.9.0-alpha.1" }
@@ -1,4 +1,4 @@
1
- export declare type EventOfType<K extends string, Event extends TypedCustomEvent> = Extract<Event, TypedCustomEvent<K, any>>;
1
+ export type EventOfType<K extends string, Event extends TypedCustomEvent> = Extract<Event, TypedCustomEvent<K, any>>;
2
2
  /**
3
3
  * This wrapper around CustomEvent provides more descriptive type information. By using this class, the `type` property
4
4
  * of the CustomEvent will be typed as a string literal – this allows [TypedEventTarget] to provide more useful type
@@ -1,12 +1,12 @@
1
1
  import { EventOfType, TypedCustomEvent } from "./TypedCustomEvent";
2
- export declare type TypedEventListener<Event extends TypedCustomEvent> = (evt: Event) => void;
2
+ export type TypedEventListener<Event extends TypedCustomEvent> = (evt: Event) => void;
3
3
  export interface TypedEventListenerOptions {
4
4
  once?: boolean;
5
5
  }
6
6
  /**
7
7
  * Extract the generic Events type (which must extend {@link TypedCustomEvent}) from a {@link TypedEventTarget}
8
8
  */
9
- export declare type EventsFromTarget<Target extends TypedEventTarget> = Target extends TypedEventTarget<infer Events> ? Events : never;
9
+ export type EventsFromTarget<Target extends TypedEventTarget> = Target extends TypedEventTarget<infer Events> ? Events : never;
10
10
  /**
11
11
  * This wrapper around EventTarget provides more descriptive type information. By using this class, calls to EventTarget
12
12
  * methods are correctly type checked to ensure only allowed event types are used, and that events and their type
@@ -12,4 +12,4 @@ import { EventsFromTarget, TypedEventTarget } from "./TypedEventTarget";
12
12
  * which to listen, and the accumulator function. The accumulator is called each time an event of the given type(s) is
13
13
  * emitted on the source. It is passed the current state and the event, and must return a new state.
14
14
  */
15
- export declare const scan: <S>(seedState: S) => <Target extends TypedEventTarget<TypedCustomEvent<string, any>>, Events extends EventsFromTarget<Target>, EventType extends Events["type"]>(source: Target, eventTypes: EventType[], accumulator: (state: S, event: Extract<Events, TypedCustomEvent<EventType, any>>) => S) => TypedEventTarget<TypedCustomEvent<"state", S>>;
15
+ export declare const scan: <S>(seedState: S) => <Target extends TypedEventTarget<TypedCustomEvent<string, any>>, Events extends EventsFromTarget<Target>, EventType extends Events["type"]>(source: Target, eventTypes: EventType[], accumulator: (state: S, event: EventOfType<EventType, Events>) => S) => TypedEventTarget<TypedCustomEvent<"state", S>>;
@@ -19,9 +19,9 @@ export const scan = (seedState) => (source, eventTypes, accumulator) => {
19
19
  state = accumulator(state, event);
20
20
  sink.dispatchEvent(new TypedCustomEvent("state", state));
21
21
  };
22
- // We'll use Proxies to make sure that event listeners are added/removed at the appropriate time. Callers can then
23
- // control when to clean up the listeners we add here in a transparent way – by just removing the listener on the
24
- // returned event target.
22
+ // We'll use Proxies to make sure that event listeners are added/removed at the appropriate time.
23
+ // Callers can then control when to clean up the listeners we add here in a transparent way –
24
+ // by just removing the listener on the returned event target.
25
25
  //
26
26
  // We also prevent multiple listeners on the sink, as a simplification.
27
27
  let hasListener = false;
@@ -1 +1 @@
1
- {"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/events/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAoB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAI,SAAY,EAAE,EAAE,CAAC,CAKrC,MAAc,EACd,UAAuB,EACvB,WAAmE,EACrB,EAAE;IAChD,IAAI,KAAK,GAAG,SAAS,CAAC;IACtB,MAAM,IAAI,GAAG,IAAI,gBAAgB,EAAgC,CAAC;IAClE,MAAM,QAAQ,GAAG,CAAC,KAAuB,EAAE,EAAE;QACzC,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE,KAAuC,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC;IAEF,kHAAkH;IAClH,iHAAiH;IACjH,yBAAyB;IACzB,EAAE;IACF,uEAAuE;IACvE,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,CAAC,gBAAgB,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE;QACrD,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAiD,EAAE,EAAE;YAC1E,IAAI,WAAW;gBACX,MAAM,IAAI,KAAK,CACX,sEAAsE;oBAClE,6DAA6D,CACpE,CAAC;YACN,WAAW,GAAG,IAAI,CAAC;YACnB,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;YAChF,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChC,CAAC;KACJ,CAAC,CAAC;IACH,IAAI,CAAC,mBAAmB,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE;QAC3D,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAoD,EAAE,EAAE;YAC7E,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnF,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { EventOfType, TypedCustomEvent } from \"./TypedCustomEvent\";\nimport { EventsFromTarget, TypedEventTarget } from \"./TypedEventTarget\";\n\n/**\n * Each time an event is emitted, call a given accumulator function with two arguments: some state of type S and the\n * event. The accumulator returns a new state. `scan` returns a new event emitter which emits an event each time a new\n * state is produced by the accumulator.\n *\n * This can be used to implement a Redux-style state management architecture.\n *\n * @param seedState Some initial state, passed to the accumulator when the first event is emitted.\n * @returns A function which takes a source {@link TypedEventTarget}, a list of event types emitted by that target to\n * which to listen, and the accumulator function. The accumulator is called each time an event of the given type(s) is\n * emitted on the source. It is passed the current state and the event, and must return a new state.\n */\nexport const scan = <S>(seedState: S) => <\n Target extends TypedEventTarget,\n Events extends EventsFromTarget<Target>,\n EventType extends Events[\"type\"]\n>(\n source: Target,\n eventTypes: EventType[],\n accumulator: (state: S, event: EventOfType<EventType, Events>) => S\n): TypedEventTarget<TypedCustomEvent<\"state\", S>> => {\n let state = seedState;\n const sink = new TypedEventTarget<TypedCustomEvent<\"state\", S>>();\n const listener = (event: TypedCustomEvent) => {\n state = accumulator(state, event as EventOfType<EventType, Events>);\n sink.dispatchEvent(new TypedCustomEvent(\"state\", state));\n };\n\n // We'll use Proxies to make sure that event listeners are added/removed at the appropriate time. Callers can then\n // control when to clean up the listeners we add here in a transparent way by just removing the listener on the\n // returned event target.\n //\n // We also prevent multiple listeners on the sink, as a simplification.\n let hasListener = false;\n sink.addEventListener = new Proxy(sink.addEventListener, {\n apply: (target, thisArg, args: Parameters<typeof sink[\"addEventListener\"]>) => {\n if (hasListener)\n throw new Error(\n \"Cannot addEventListener. The TypedEventTarget returned by scan only \" +\n \"supports a single listener, and one has already been added.\"\n );\n hasListener = true;\n eventTypes.forEach((eventType) => source.addEventListener(eventType, listener));\n target.apply(thisArg, args);\n },\n });\n sink.removeEventListener = new Proxy(sink.removeEventListener, {\n apply: (target, thisArg, args: Parameters<typeof sink[\"removeEventListener\"]>) => {\n eventTypes.forEach((eventType) => source.removeEventListener(eventType, listener));\n target.apply(thisArg, args);\n },\n });\n\n return sink;\n};\n"]}
1
+ {"version":3,"file":"scan.js","sourceRoot":"","sources":["../../src/events/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAoB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,IAAI,GACb,CAAI,SAAY,EAAE,EAAE,CACpB,CACI,MAAc,EACd,UAAuB,EACvB,WAAmE,EACrB,EAAE;IAChD,IAAI,KAAK,GAAG,SAAS,CAAC;IACtB,MAAM,IAAI,GAAG,IAAI,gBAAgB,EAAgC,CAAC;IAClE,MAAM,QAAQ,GAAG,CAAC,KAAuB,EAAE,EAAE;QACzC,KAAK,GAAG,WAAW,CAAC,KAAK,EAAE,KAAuC,CAAC,CAAC;QACpE,IAAI,CAAC,aAAa,CAAC,IAAI,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC,CAAC;IAEF,iGAAiG;IACjG,6FAA6F;IAC7F,8DAA8D;IAC9D,EAAE;IACF,uEAAuE;IACvE,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,CAAC,gBAAgB,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE;QACrD,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAmD,EAAE,EAAE;YAC5E,IAAI,WAAW;gBACX,MAAM,IAAI,KAAK,CACX,sEAAsE;oBAClE,6DAA6D,CACpE,CAAC;YACN,WAAW,GAAG,IAAI,CAAC;YACnB,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;YAChF,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChC,CAAC;KACJ,CAAC,CAAC;IACH,IAAI,CAAC,mBAAmB,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE;QAC3D,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAsD,EAAE,EAAE;YAC/E,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnF,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAChC,CAAC;KACJ,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { EventOfType, TypedCustomEvent } from \"./TypedCustomEvent\";\nimport { EventsFromTarget, TypedEventTarget } from \"./TypedEventTarget\";\n\n/**\n * Each time an event is emitted, call a given accumulator function with two arguments: some state of type S and the\n * event. The accumulator returns a new state. `scan` returns a new event emitter which emits an event each time a new\n * state is produced by the accumulator.\n *\n * This can be used to implement a Redux-style state management architecture.\n *\n * @param seedState Some initial state, passed to the accumulator when the first event is emitted.\n * @returns A function which takes a source {@link TypedEventTarget}, a list of event types emitted by that target to\n * which to listen, and the accumulator function. The accumulator is called each time an event of the given type(s) is\n * emitted on the source. It is passed the current state and the event, and must return a new state.\n */\nexport const scan =\n <S>(seedState: S) =>\n <Target extends TypedEventTarget, Events extends EventsFromTarget<Target>, EventType extends Events[\"type\"]>(\n source: Target,\n eventTypes: EventType[],\n accumulator: (state: S, event: EventOfType<EventType, Events>) => S\n ): TypedEventTarget<TypedCustomEvent<\"state\", S>> => {\n let state = seedState;\n const sink = new TypedEventTarget<TypedCustomEvent<\"state\", S>>();\n const listener = (event: TypedCustomEvent) => {\n state = accumulator(state, event as EventOfType<EventType, Events>);\n sink.dispatchEvent(new TypedCustomEvent(\"state\", state));\n };\n\n // We'll use Proxies to make sure that event listeners are added/removed at the appropriate time.\n // Callers can then control when to clean up the listeners we add here in a transparent way –\n // by just removing the listener on the returned event target.\n //\n // We also prevent multiple listeners on the sink, as a simplification.\n let hasListener = false;\n sink.addEventListener = new Proxy(sink.addEventListener, {\n apply: (target, thisArg, args: Parameters<(typeof sink)[\"addEventListener\"]>) => {\n if (hasListener)\n throw new Error(\n \"Cannot addEventListener. The TypedEventTarget returned by scan only \" +\n \"supports a single listener, and one has already been added.\"\n );\n hasListener = true;\n eventTypes.forEach((eventType) => source.addEventListener(eventType, listener));\n target.apply(thisArg, args);\n },\n });\n sink.removeEventListener = new Proxy(sink.removeEventListener, {\n apply: (target, thisArg, args: Parameters<(typeof sink)[\"removeEventListener\"]>) => {\n eventTypes.forEach((eventType) => source.removeEventListener(eventType, listener));\n target.apply(thisArg, args);\n },\n });\n\n return sink;\n };\n"]}
@@ -27,7 +27,7 @@ export interface UriHandler {
27
27
  /**
28
28
  * Array of {@link UriHandler} objects.
29
29
  */
30
- export declare type UriHandlers = UriHandler[];
30
+ export type UriHandlers = UriHandler[];
31
31
  /**
32
32
  * An extension point for client URI handlers.
33
33
  */
@@ -5592,12 +5592,12 @@ export declare enum KitType {
5592
5592
  CAMERA_KIT_WEB = 10,
5593
5593
  UNRECOGNIZED = -1
5594
5594
  }
5595
- export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
5595
+ export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
5596
5596
  [K in keyof T]?: DeepPartial<T[K]>;
5597
5597
  } : Partial<T>;
5598
- export declare type Exact<P, I extends P> = P extends Builtin ? P : P & {
5598
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
5599
5599
  [K in keyof P]: Exact<P[K], I[K]>;
5600
5600
  } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
5601
- declare type KeysOfUnion<T> = T extends T ? keyof T : never;
5602
- declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
5601
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
5602
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
5603
5603
  export {};
@@ -81,8 +81,8 @@ export declare const ExtensionEventBase: {
81
81
  sessionId?: string | undefined;
82
82
  } & Record<Exclude<keyof I, keyof ExtensionEventBase>, never>>(object: I): ExtensionEventBase;
83
83
  };
84
- declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
85
- export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
84
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
85
+ export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
86
86
  $case: string;
87
87
  } ? {
88
88
  [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
@@ -91,8 +91,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
91
91
  } : T extends {} ? {
92
92
  [K in keyof T]?: DeepPartial<T[K]>;
93
93
  } : Partial<T>;
94
- declare type KeysOfUnion<T> = T extends T ? keyof T : never;
95
- export declare type Exact<P, I extends P> = P extends Builtin ? P : P & {
94
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
95
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
96
96
  [K in keyof P]: Exact<P[K], I[K]>;
97
97
  } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
98
98
  export {};
@@ -135,7 +135,7 @@ function createBaseExtensionEventBase() {
135
135
  cameraKitFlavor: CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET,
136
136
  appId: "",
137
137
  deviceConnectivity: CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET,
138
- sessionId: ""
138
+ sessionId: "",
139
139
  };
140
140
  }
141
141
  export const ExtensionEventBase = {
@@ -198,7 +198,7 @@ export const ExtensionEventBase = {
198
198
  deviceConnectivity: isSet(object.deviceConnectivity)
199
199
  ? cameraKitConnectivityTypeFromJSON(object.deviceConnectivity)
200
200
  : CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET,
201
- sessionId: isSet(object.sessionId) ? String(object.sessionId) : ""
201
+ sessionId: isSet(object.sessionId) ? String(object.sessionId) : "",
202
202
  };
203
203
  },
204
204
  toJSON(message) {
@@ -231,7 +231,7 @@ export const ExtensionEventBase = {
231
231
  (_j = object.deviceConnectivity) !== null && _j !== void 0 ? _j : CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET;
232
232
  message.sessionId = (_k = object.sessionId) !== null && _k !== void 0 ? _k : "";
233
233
  return message;
234
- }
234
+ },
235
235
  };
236
236
  var globalThis = (() => {
237
237
  if (typeof globalThis !== "undefined")
@@ -1 +1 @@
1
- {"version":3,"file":"business_events.js","sourceRoot":"","sources":["../../../../../src/generated-proto/pb_schema/camera_kit/v3/business_events.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAAC;AACvD,wDAAwD;AACxD,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACvB,wDAAwD;IACxD,sEAAmD,CAAA;IACnD,6CAA6C;IAC7C,sEAAmD,CAAA;IACnD,iDAAiD;IACjD,0EAAuD,CAAA;IACvD,gDAA6B,CAAA;AACjC,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AACD,MAAM,UAAU,uBAAuB,CAAC,MAAW;IAC/C,QAAQ,MAAM,EAAE;QACZ,KAAK,CAAC,CAAC;QACP,KAAK,yBAAyB;YAC1B,OAAO,eAAe,CAAC,uBAAuB,CAAC;QACnD,KAAK,CAAC,CAAC;QACP,KAAK,yBAAyB;YAC1B,OAAO,eAAe,CAAC,uBAAuB,CAAC;QACnD,KAAK,CAAC,CAAC;QACP,KAAK,2BAA2B;YAC5B,OAAO,eAAe,CAAC,yBAAyB,CAAC;QACrD,KAAK,CAAC,CAAC,CAAC;QACR,KAAK,cAAc,CAAC;QACpB;YACI,OAAO,eAAe,CAAC,YAAY,CAAC;KAC3C;AACL,CAAC;AACD,MAAM,UAAU,qBAAqB,CAAC,MAAuB;IACzD,QAAQ,MAAM,EAAE;QACZ,KAAK,eAAe,CAAC,uBAAuB;YACxC,OAAO,yBAAyB,CAAC;QACrC,KAAK,eAAe,CAAC,uBAAuB;YACxC,OAAO,yBAAyB,CAAC;QACrC,KAAK,eAAe,CAAC,yBAAyB;YAC1C,OAAO,2BAA2B,CAAC;QACvC;YACI,OAAO,SAAS,CAA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C,kBAAkB;YACtB,MAAA,MAAM,CAAC,kBAAkB,mCAAI,yBAAyB,CAAC,kCAAkC,CAAC;QAC9F,OAAO,CAAC,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,EAAE,CAAC;QAC3C,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAC;AAIF,IAAI,UAAU,GAAQ,CAAC,GAAG,EAAE;IACxB,IAAI,OAAO,UAAU,KAAK,WAAW;QACjC,OAAO,UAAU,CAAC;IACtB,IAAI,OAAO,IAAI,KAAK,WAAW;QAC3B,OAAO,IAAI,CAAC;IAChB,IAAI,OAAO,MAAM,KAAK,WAAW;QAC7B,OAAO,MAAM,CAAC;IAClB,IAAI,OAAO,MAAM,KAAK,WAAW;QAC7B,OAAO,MAAM,CAAC;IAClB,MAAM,gCAAgC,CAAC;AAC3C,CAAC,CAAC,EAAE,CAAC;AAeL,SAAS,YAAY,CAAC,IAAU;IAC5B,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;QAClC,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;KAC9E;IACD,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AACD,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;IACxB,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAW,CAAC;IAC5B,GAAG,CAAC,SAAS,EAAE,CAAC;CACnB;AACD,SAAS,KAAK,CAAC,KAAU;IACrB,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AACjD,CAAC","sourcesContent":["/* eslint-disable */\nimport Long from \"long\";\nimport _m0 from \"protobufjs/minimal\";\nexport const protobufPackage = \"com.snap.camerakit.v3\";\n/** Camera kit flavor to be used in to Blizzard event */\nexport enum CameraKitFlavor {\n /** CAMERA_KIT_FLAVOR_UNSET - Unset or unknown flavor */\n CAMERA_KIT_FLAVOR_UNSET = \"CAMERA_KIT_FLAVOR_UNSET\",\n /** CAMERA_KIT_FLAVOR_DEBUG - Debug flavor */\n CAMERA_KIT_FLAVOR_DEBUG = \"CAMERA_KIT_FLAVOR_DEBUG\",\n /** CAMERA_KIT_FLAVOR_RELEASE - Release flavor */\n CAMERA_KIT_FLAVOR_RELEASE = \"CAMERA_KIT_FLAVOR_RELEASE\",\n UNRECOGNIZED = \"UNRECOGNIZED\"\n}\nexport function cameraKitFlavorFromJSON(object: any): CameraKitFlavor {\n switch (object) {\n case 0:\n case \"CAMERA_KIT_FLAVOR_UNSET\":\n return CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET;\n case 1:\n case \"CAMERA_KIT_FLAVOR_DEBUG\":\n return CameraKitFlavor.CAMERA_KIT_FLAVOR_DEBUG;\n case 2:\n case \"CAMERA_KIT_FLAVOR_RELEASE\":\n return CameraKitFlavor.CAMERA_KIT_FLAVOR_RELEASE;\n case -1:\n case \"UNRECOGNIZED\":\n default:\n return CameraKitFlavor.UNRECOGNIZED;\n }\n}\nexport function cameraKitFlavorToJSON(object: CameraKitFlavor): string {\n switch (object) {\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET:\n return \"CAMERA_KIT_FLAVOR_UNSET\";\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_DEBUG:\n return \"CAMERA_KIT_FLAVOR_DEBUG\";\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_RELEASE:\n return \"CAMERA_KIT_FLAVOR_RELEASE\";\n default:\n return \"UNKNOWN\";\n }\n}\nexport function cameraKitFlavorToNumber(object: CameraKitFlavor): number {\n switch (object) {\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET:\n return 0;\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_DEBUG:\n return 1;\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_RELEASE:\n return 2;\n default:\n return 0;\n }\n}\n/** Camera kit connectivity type to be used in Blizzard event */\nexport enum CameraKitConnectivityType {\n /** CAMERA_KIT_CONNECTIVITY_TYPE_UNSET - Unset or unknown connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_UNSET = \"CAMERA_KIT_CONNECTIVITY_TYPE_UNSET\",\n /** CAMERA_KIT_CONNECTIVITY_TYPE_WIFI - Wifi connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_WIFI = \"CAMERA_KIT_CONNECTIVITY_TYPE_WIFI\",\n /** CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE - Mobile connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE = \"CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE\",\n /** CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE - Unreachable connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE = \"CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE\",\n /** CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH - Bluetooth connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH = \"CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH\",\n UNRECOGNIZED = \"UNRECOGNIZED\"\n}\nexport function cameraKitConnectivityTypeFromJSON(object: any): CameraKitConnectivityType {\n switch (object) {\n case 0:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_UNSET\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET;\n case 1:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_WIFI\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_WIFI;\n case 2:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE;\n case 3:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE;\n case 4:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH;\n case -1:\n case \"UNRECOGNIZED\":\n default:\n return CameraKitConnectivityType.UNRECOGNIZED;\n }\n}\nexport function cameraKitConnectivityTypeToJSON(object: CameraKitConnectivityType): string {\n switch (object) {\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_UNSET\";\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_WIFI:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_WIFI\";\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE\";\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE\";\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH\";\n default:\n return \"UNKNOWN\";\n }\n}\nexport function cameraKitConnectivityTypeToNumber(object: CameraKitConnectivityType): number {\n switch (object) {\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET:\n return 0;\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_WIFI:\n return 1;\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE:\n return 2;\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE:\n return 3;\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH:\n return 4;\n default:\n return 0;\n }\n}\n/** Extension base data */\nexport interface ExtensionEventBase {\n /** CameraKit Extension name */\n extensionName: string;\n /** Full CameraKit Extension version */\n extensionVersion: string;\n /** Device cluster value. Android clients will receive it from COF/Configs endpoint. iOS will use manual mapping */\n deviceCluster: number;\n /** Full CameraKit SDK version (e.g. 0.2.0-12adb50.38) Major, Minor, Patch, Build version metadata */\n cameraKitVersion: string;\n /** Version of LensCore (e.g. 77) */\n lensCoreVersion: string;\n /** Model of the device (e.g. SM 955U) */\n deviceModel: string;\n /** Flavor of CameraKit: debug or release */\n cameraKitFlavor: CameraKitFlavor;\n /** BundleID/package of the app */\n appId: string;\n /** Device connectivity: wifi, mobile, unreachable, bluetooth */\n deviceConnectivity: CameraKitConnectivityType;\n /** Random UUID generated each time session created */\n sessionId: string;\n}\nfunction createBaseExtensionEventBase(): ExtensionEventBase {\n return {\n extensionName: \"\",\n extensionVersion: \"\",\n deviceCluster: 0,\n cameraKitVersion: \"\",\n lensCoreVersion: \"\",\n deviceModel: \"\",\n cameraKitFlavor: CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET,\n appId: \"\",\n deviceConnectivity: CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET,\n sessionId: \"\"\n };\n}\nexport const ExtensionEventBase = {\n decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionEventBase {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseExtensionEventBase();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.extensionName = reader.string();\n break;\n case 2:\n message.extensionVersion = reader.string();\n break;\n case 3:\n message.deviceCluster = longToNumber(reader.int64() as Long);\n break;\n case 4:\n message.cameraKitVersion = reader.string();\n break;\n case 5:\n message.lensCoreVersion = reader.string();\n break;\n case 6:\n message.deviceModel = reader.string();\n break;\n case 7:\n message.cameraKitFlavor = cameraKitFlavorFromJSON(reader.int32());\n break;\n case 8:\n message.appId = reader.string();\n break;\n case 9:\n message.deviceConnectivity = cameraKitConnectivityTypeFromJSON(reader.int32());\n break;\n case 10:\n message.sessionId = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n fromJSON(object: any): ExtensionEventBase {\n return {\n extensionName: isSet(object.extensionName) ? String(object.extensionName) : \"\",\n extensionVersion: isSet(object.extensionVersion) ? String(object.extensionVersion) : \"\",\n deviceCluster: isSet(object.deviceCluster) ? Number(object.deviceCluster) : 0,\n cameraKitVersion: isSet(object.cameraKitVersion) ? String(object.cameraKitVersion) : \"\",\n lensCoreVersion: isSet(object.lensCoreVersion) ? String(object.lensCoreVersion) : \"\",\n deviceModel: isSet(object.deviceModel) ? String(object.deviceModel) : \"\",\n cameraKitFlavor: isSet(object.cameraKitFlavor)\n ? cameraKitFlavorFromJSON(object.cameraKitFlavor)\n : CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET,\n appId: isSet(object.appId) ? String(object.appId) : \"\",\n deviceConnectivity: isSet(object.deviceConnectivity)\n ? cameraKitConnectivityTypeFromJSON(object.deviceConnectivity)\n : CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET,\n sessionId: isSet(object.sessionId) ? String(object.sessionId) : \"\"\n };\n },\n toJSON(message: ExtensionEventBase): unknown {\n const obj: any = {};\n message.extensionName !== undefined && (obj.extensionName = message.extensionName);\n message.extensionVersion !== undefined && (obj.extensionVersion = message.extensionVersion);\n message.deviceCluster !== undefined && (obj.deviceCluster = Math.round(message.deviceCluster));\n message.cameraKitVersion !== undefined && (obj.cameraKitVersion = message.cameraKitVersion);\n message.lensCoreVersion !== undefined && (obj.lensCoreVersion = message.lensCoreVersion);\n message.deviceModel !== undefined && (obj.deviceModel = message.deviceModel);\n message.cameraKitFlavor !== undefined && (obj.cameraKitFlavor = cameraKitFlavorToJSON(message.cameraKitFlavor));\n message.appId !== undefined && (obj.appId = message.appId);\n message.deviceConnectivity !== undefined &&\n (obj.deviceConnectivity = cameraKitConnectivityTypeToJSON(message.deviceConnectivity));\n message.sessionId !== undefined && (obj.sessionId = message.sessionId);\n return obj;\n },\n fromPartial<I extends Exact<DeepPartial<ExtensionEventBase>, I>>(object: I): ExtensionEventBase {\n const message = createBaseExtensionEventBase();\n message.extensionName = object.extensionName ?? \"\";\n message.extensionVersion = object.extensionVersion ?? \"\";\n message.deviceCluster = object.deviceCluster ?? 0;\n message.cameraKitVersion = object.cameraKitVersion ?? \"\";\n message.lensCoreVersion = object.lensCoreVersion ?? \"\";\n message.deviceModel = object.deviceModel ?? \"\";\n message.cameraKitFlavor = object.cameraKitFlavor ?? CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET;\n message.appId = object.appId ?? \"\";\n message.deviceConnectivity =\n object.deviceConnectivity ?? CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET;\n message.sessionId = object.sessionId ?? \"\";\n return message;\n }\n};\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== \"undefined\")\n return globalThis;\n if (typeof self !== \"undefined\")\n return self;\n if (typeof window !== \"undefined\")\n return window;\n if (typeof global !== \"undefined\")\n return global;\n throw \"Unable to locate global object\";\n})();\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\nexport type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {\n $case: string;\n} ? {\n [K in keyof Omit<T, \"$case\">]?: DeepPartial<T[K]>;\n} & {\n $case: T[\"$case\"];\n} : T extends {} ? {\n [K in keyof T]?: DeepPartial<T[K]>;\n} : Partial<T>;\ntype KeysOfUnion<T> = T extends T ? keyof T : never;\nexport type Exact<P, I extends P> = P extends Builtin ? P : P & {\n [K in keyof P]: Exact<P[K], I[K]>;\n} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;\nfunction longToNumber(long: Long): number {\n if (long.gt(Number.MAX_SAFE_INTEGER)) {\n throw new globalThis.Error(\"Value is larger than Number.MAX_SAFE_INTEGER\");\n }\n return long.toNumber();\n}\nif (_m0.util.Long !== Long) {\n _m0.util.Long = Long as any;\n _m0.configure();\n}\nfunction isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n"]}
1
+ {"version":3,"file":"business_events.js","sourceRoot":"","sources":["../../../../../src/generated-proto/pb_schema/camera_kit/v3/business_events.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,oBAAoB,CAAC;AACrC,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAAC;AACvD,wDAAwD;AACxD,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACvB,wDAAwD;IACxD,sEAAmD,CAAA;IACnD,6CAA6C;IAC7C,sEAAmD,CAAA;IACnD,iDAAiD;IACjD,0EAAuD,CAAA;IACvD,gDAA6B,CAAA;AACjC,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B;AACD,MAAM,UAAU,uBAAuB,CAAC,MAAW;IAC/C,QAAQ,MAAM,EAAE;QACZ,KAAK,CAAC,CAAC;QACP,KAAK,yBAAyB;YAC1B,OAAO,eAAe,CAAC,uBAAuB,CAAC;QACnD,KAAK,CAAC,CAAC;QACP,KAAK,yBAAyB;YAC1B,OAAO,eAAe,CAAC,uBAAuB,CAAC;QACnD,KAAK,CAAC,CAAC;QACP,KAAK,2BAA2B;YAC5B,OAAO,eAAe,CAAC,yBAAyB,CAAC;QACrD,KAAK,CAAC,CAAC,CAAC;QACR,KAAK,cAAc,CAAC;QACpB;YACI,OAAO,eAAe,CAAC,YAAY,CAAC;KAC3C;AACL,CAAC;AACD,MAAM,UAAU,qBAAqB,CAAC,MAAuB;IACzD,QAAQ,MAAM,EAAE;QACZ,KAAK,eAAe,CAAC,uBAAuB;YACxC,OAAO,yBAAyB,CAAC;QACrC,KAAK,eAAe,CAAC,uBAAuB;YACxC,OAAO,yBAAyB,CA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QAC5F,OAAO,CAAC,KAAK,GAAG,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC;QACnC,OAAO,CAAC,kBAAkB;YACtB,MAAA,MAAM,CAAC,kBAAkB,mCAAI,yBAAyB,CAAC,kCAAkC,CAAC;QAC9F,OAAO,CAAC,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,EAAE,CAAC;QAC3C,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAC;AAIF,IAAI,UAAU,GAAQ,CAAC,GAAG,EAAE;IACxB,IAAI,OAAO,UAAU,KAAK,WAAW;QACjC,OAAO,UAAU,CAAC;IACtB,IAAI,OAAO,IAAI,KAAK,WAAW;QAC3B,OAAO,IAAI,CAAC;IAChB,IAAI,OAAO,MAAM,KAAK,WAAW;QAC7B,OAAO,MAAM,CAAC;IAClB,IAAI,OAAO,MAAM,KAAK,WAAW;QAC7B,OAAO,MAAM,CAAC;IAClB,MAAM,gCAAgC,CAAC;AAC3C,CAAC,CAAC,EAAE,CAAC;AAeL,SAAS,YAAY,CAAC,IAAU;IAC5B,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;QAClC,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;KAC9E;IACD,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC3B,CAAC;AACD,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;IACxB,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAW,CAAC;IAC5B,GAAG,CAAC,SAAS,EAAE,CAAC;CACnB;AACD,SAAS,KAAK,CAAC,KAAU;IACrB,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AACjD,CAAC","sourcesContent":["/* eslint-disable */\nimport Long from \"long\";\nimport _m0 from \"protobufjs/minimal\";\nexport const protobufPackage = \"com.snap.camerakit.v3\";\n/** Camera kit flavor to be used in to Blizzard event */\nexport enum CameraKitFlavor {\n /** CAMERA_KIT_FLAVOR_UNSET - Unset or unknown flavor */\n CAMERA_KIT_FLAVOR_UNSET = \"CAMERA_KIT_FLAVOR_UNSET\",\n /** CAMERA_KIT_FLAVOR_DEBUG - Debug flavor */\n CAMERA_KIT_FLAVOR_DEBUG = \"CAMERA_KIT_FLAVOR_DEBUG\",\n /** CAMERA_KIT_FLAVOR_RELEASE - Release flavor */\n CAMERA_KIT_FLAVOR_RELEASE = \"CAMERA_KIT_FLAVOR_RELEASE\",\n UNRECOGNIZED = \"UNRECOGNIZED\"\n}\nexport function cameraKitFlavorFromJSON(object: any): CameraKitFlavor {\n switch (object) {\n case 0:\n case \"CAMERA_KIT_FLAVOR_UNSET\":\n return CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET;\n case 1:\n case \"CAMERA_KIT_FLAVOR_DEBUG\":\n return CameraKitFlavor.CAMERA_KIT_FLAVOR_DEBUG;\n case 2:\n case \"CAMERA_KIT_FLAVOR_RELEASE\":\n return CameraKitFlavor.CAMERA_KIT_FLAVOR_RELEASE;\n case -1:\n case \"UNRECOGNIZED\":\n default:\n return CameraKitFlavor.UNRECOGNIZED;\n }\n}\nexport function cameraKitFlavorToJSON(object: CameraKitFlavor): string {\n switch (object) {\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET:\n return \"CAMERA_KIT_FLAVOR_UNSET\";\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_DEBUG:\n return \"CAMERA_KIT_FLAVOR_DEBUG\";\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_RELEASE:\n return \"CAMERA_KIT_FLAVOR_RELEASE\";\n default:\n return \"UNKNOWN\";\n }\n}\nexport function cameraKitFlavorToNumber(object: CameraKitFlavor): number {\n switch (object) {\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET:\n return 0;\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_DEBUG:\n return 1;\n case CameraKitFlavor.CAMERA_KIT_FLAVOR_RELEASE:\n return 2;\n default:\n return 0;\n }\n}\n/** Camera kit connectivity type to be used in Blizzard event */\nexport enum CameraKitConnectivityType {\n /** CAMERA_KIT_CONNECTIVITY_TYPE_UNSET - Unset or unknown connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_UNSET = \"CAMERA_KIT_CONNECTIVITY_TYPE_UNSET\",\n /** CAMERA_KIT_CONNECTIVITY_TYPE_WIFI - Wifi connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_WIFI = \"CAMERA_KIT_CONNECTIVITY_TYPE_WIFI\",\n /** CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE - Mobile connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE = \"CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE\",\n /** CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE - Unreachable connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE = \"CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE\",\n /** CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH - Bluetooth connectivity type */\n CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH = \"CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH\",\n UNRECOGNIZED = \"UNRECOGNIZED\"\n}\nexport function cameraKitConnectivityTypeFromJSON(object: any): CameraKitConnectivityType {\n switch (object) {\n case 0:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_UNSET\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET;\n case 1:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_WIFI\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_WIFI;\n case 2:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE;\n case 3:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE;\n case 4:\n case \"CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH\":\n return CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH;\n case -1:\n case \"UNRECOGNIZED\":\n default:\n return CameraKitConnectivityType.UNRECOGNIZED;\n }\n}\nexport function cameraKitConnectivityTypeToJSON(object: CameraKitConnectivityType): string {\n switch (object) {\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_UNSET\";\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_WIFI:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_WIFI\";\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE\";\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE\";\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH:\n return \"CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH\";\n default:\n return \"UNKNOWN\";\n }\n}\nexport function cameraKitConnectivityTypeToNumber(object: CameraKitConnectivityType): number {\n switch (object) {\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET:\n return 0;\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_WIFI:\n return 1;\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_MOBILE:\n return 2;\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNREACHABLE:\n return 3;\n case CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_BLUETOOTH:\n return 4;\n default:\n return 0;\n }\n}\n/** Extension base data */\nexport interface ExtensionEventBase {\n /** CameraKit Extension name */\n extensionName: string;\n /** Full CameraKit Extension version */\n extensionVersion: string;\n /** Device cluster value. Android clients will receive it from COF/Configs endpoint. iOS will use manual mapping */\n deviceCluster: number;\n /** Full CameraKit SDK version (e.g. 0.2.0-12adb50.38) Major, Minor, Patch, Build version metadata */\n cameraKitVersion: string;\n /** Version of LensCore (e.g. 77) */\n lensCoreVersion: string;\n /** Model of the device (e.g. SM 955U) */\n deviceModel: string;\n /** Flavor of CameraKit: debug or release */\n cameraKitFlavor: CameraKitFlavor;\n /** BundleID/package of the app */\n appId: string;\n /** Device connectivity: wifi, mobile, unreachable, bluetooth */\n deviceConnectivity: CameraKitConnectivityType;\n /** Random UUID generated each time session created */\n sessionId: string;\n}\nfunction createBaseExtensionEventBase(): ExtensionEventBase {\n return {\n extensionName: \"\",\n extensionVersion: \"\",\n deviceCluster: 0,\n cameraKitVersion: \"\",\n lensCoreVersion: \"\",\n deviceModel: \"\",\n cameraKitFlavor: CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET,\n appId: \"\",\n deviceConnectivity: CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET,\n sessionId: \"\",\n };\n}\nexport const ExtensionEventBase = {\n decode(input: _m0.Reader | Uint8Array, length?: number): ExtensionEventBase {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseExtensionEventBase();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.extensionName = reader.string();\n break;\n case 2:\n message.extensionVersion = reader.string();\n break;\n case 3:\n message.deviceCluster = longToNumber(reader.int64() as Long);\n break;\n case 4:\n message.cameraKitVersion = reader.string();\n break;\n case 5:\n message.lensCoreVersion = reader.string();\n break;\n case 6:\n message.deviceModel = reader.string();\n break;\n case 7:\n message.cameraKitFlavor = cameraKitFlavorFromJSON(reader.int32());\n break;\n case 8:\n message.appId = reader.string();\n break;\n case 9:\n message.deviceConnectivity = cameraKitConnectivityTypeFromJSON(reader.int32());\n break;\n case 10:\n message.sessionId = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n fromJSON(object: any): ExtensionEventBase {\n return {\n extensionName: isSet(object.extensionName) ? String(object.extensionName) : \"\",\n extensionVersion: isSet(object.extensionVersion) ? String(object.extensionVersion) : \"\",\n deviceCluster: isSet(object.deviceCluster) ? Number(object.deviceCluster) : 0,\n cameraKitVersion: isSet(object.cameraKitVersion) ? String(object.cameraKitVersion) : \"\",\n lensCoreVersion: isSet(object.lensCoreVersion) ? String(object.lensCoreVersion) : \"\",\n deviceModel: isSet(object.deviceModel) ? String(object.deviceModel) : \"\",\n cameraKitFlavor: isSet(object.cameraKitFlavor)\n ? cameraKitFlavorFromJSON(object.cameraKitFlavor)\n : CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET,\n appId: isSet(object.appId) ? String(object.appId) : \"\",\n deviceConnectivity: isSet(object.deviceConnectivity)\n ? cameraKitConnectivityTypeFromJSON(object.deviceConnectivity)\n : CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET,\n sessionId: isSet(object.sessionId) ? String(object.sessionId) : \"\",\n };\n },\n toJSON(message: ExtensionEventBase): unknown {\n const obj: any = {};\n message.extensionName !== undefined && (obj.extensionName = message.extensionName);\n message.extensionVersion !== undefined && (obj.extensionVersion = message.extensionVersion);\n message.deviceCluster !== undefined && (obj.deviceCluster = Math.round(message.deviceCluster));\n message.cameraKitVersion !== undefined && (obj.cameraKitVersion = message.cameraKitVersion);\n message.lensCoreVersion !== undefined && (obj.lensCoreVersion = message.lensCoreVersion);\n message.deviceModel !== undefined && (obj.deviceModel = message.deviceModel);\n message.cameraKitFlavor !== undefined && (obj.cameraKitFlavor = cameraKitFlavorToJSON(message.cameraKitFlavor));\n message.appId !== undefined && (obj.appId = message.appId);\n message.deviceConnectivity !== undefined &&\n (obj.deviceConnectivity = cameraKitConnectivityTypeToJSON(message.deviceConnectivity));\n message.sessionId !== undefined && (obj.sessionId = message.sessionId);\n return obj;\n },\n fromPartial<I extends Exact<DeepPartial<ExtensionEventBase>, I>>(object: I): ExtensionEventBase {\n const message = createBaseExtensionEventBase();\n message.extensionName = object.extensionName ?? \"\";\n message.extensionVersion = object.extensionVersion ?? \"\";\n message.deviceCluster = object.deviceCluster ?? 0;\n message.cameraKitVersion = object.cameraKitVersion ?? \"\";\n message.lensCoreVersion = object.lensCoreVersion ?? \"\";\n message.deviceModel = object.deviceModel ?? \"\";\n message.cameraKitFlavor = object.cameraKitFlavor ?? CameraKitFlavor.CAMERA_KIT_FLAVOR_UNSET;\n message.appId = object.appId ?? \"\";\n message.deviceConnectivity =\n object.deviceConnectivity ?? CameraKitConnectivityType.CAMERA_KIT_CONNECTIVITY_TYPE_UNSET;\n message.sessionId = object.sessionId ?? \"\";\n return message;\n },\n};\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== \"undefined\")\n return globalThis;\n if (typeof self !== \"undefined\")\n return self;\n if (typeof window !== \"undefined\")\n return window;\n if (typeof global !== \"undefined\")\n return global;\n throw \"Unable to locate global object\";\n})();\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\nexport type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {\n $case: string;\n} ? {\n [K in keyof Omit<T, \"$case\">]?: DeepPartial<T[K]>;\n} & {\n $case: T[\"$case\"];\n} : T extends {} ? {\n [K in keyof T]?: DeepPartial<T[K]>;\n} : Partial<T>;\ntype KeysOfUnion<T> = T extends T ? keyof T : never;\nexport type Exact<P, I extends P> = P extends Builtin ? P : P & {\n [K in keyof P]: Exact<P[K], I[K]>;\n} & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;\nfunction longToNumber(long: Long): number {\n if (long.gt(Number.MAX_SAFE_INTEGER)) {\n throw new globalThis.Error(\"Value is larger than Number.MAX_SAFE_INTEGER\");\n }\n return long.toNumber();\n}\nif (_m0.util.Long !== Long) {\n _m0.util.Long = Long as any;\n _m0.configure();\n}\nfunction isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n"]}
@@ -526,8 +526,8 @@ export interface Export {
526
526
  */
527
527
  ExportLensesById(request: ExportLensesByIdRequest): Promise<ExportLensesByIdResponse>;
528
528
  }
529
- declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
530
- export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
529
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
530
+ export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
531
531
  $case: string;
532
532
  } ? {
533
533
  [K in keyof Omit<T, "$case">]?: DeepPartial<T[K]>;
@@ -536,8 +536,8 @@ export declare type DeepPartial<T> = T extends Builtin ? T : T extends Array<inf
536
536
  } : T extends {} ? {
537
537
  [K in keyof T]?: DeepPartial<T[K]>;
538
538
  } : Partial<T>;
539
- declare type KeysOfUnion<T> = T extends T ? keyof T : never;
540
- export declare type Exact<P, I extends P> = P extends Builtin ? P : P & {
539
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
540
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
541
541
  [K in keyof P]: Exact<P[K], I[K]>;
542
542
  } & Record<Exclude<keyof I, KeysOfUnion<P>>, never>;
543
543
  export {};