@prismicio/manager 0.0.1

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 (471) hide show
  1. package/dist/_node_modules/@amplitude/analytics-core/_node_modules/tslib/tslib.es6.js +168 -0
  2. package/dist/_node_modules/@amplitude/analytics-core/_node_modules/tslib/tslib.es6.js.map +1 -0
  3. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/config.js +91 -0
  4. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/config.js.map +1 -0
  5. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/constants.js +17 -0
  6. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/constants.js.map +1 -0
  7. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/core-client.js +187 -0
  8. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/core-client.js.map +1 -0
  9. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/identify.js +90 -0
  10. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/identify.js.map +1 -0
  11. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/logger.js +64 -0
  12. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/logger.js.map +1 -0
  13. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/messages.js +17 -0
  14. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/messages.js.map +1 -0
  15. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js +323 -0
  16. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/plugins/destination.js.map +1 -0
  17. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/revenue.js +55 -0
  18. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/revenue.js.map +1 -0
  19. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/timeline.js +245 -0
  20. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/timeline.js.map +1 -0
  21. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/transports/base.js +103 -0
  22. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/transports/base.js.map +1 -0
  23. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js +15 -0
  24. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/chunk.js.map +1 -0
  25. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js +119 -0
  26. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/debug.js.map +1 -0
  27. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js +34 -0
  28. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/event-builder.js.map +1 -0
  29. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js +14 -0
  30. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/result-builder.js.map +1 -0
  31. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js +9 -0
  32. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/return-wrapper.js.map +1 -0
  33. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js +25 -0
  34. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/uuid.js.map +1 -0
  35. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js +56 -0
  36. package/dist/_node_modules/@amplitude/analytics-core/lib/esm/utils/valid-properties.js.map +1 -0
  37. package/dist/_node_modules/@amplitude/analytics-node/_node_modules/tslib/tslib.es6.js +134 -0
  38. package/dist/_node_modules/@amplitude/analytics-node/_node_modules/tslib/tslib.es6.js.map +1 -0
  39. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/config.js +21 -0
  40. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/config.js.map +1 -0
  41. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/index.js +24 -0
  42. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/index.js.map +1 -0
  43. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/node-client.js +81 -0
  44. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/node-client.js.map +1 -0
  45. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js +37 -0
  46. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/plugins/context.js.map +1 -0
  47. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js +67 -0
  48. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/transports/http.js.map +1 -0
  49. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/version.js +5 -0
  50. package/dist/_node_modules/@amplitude/analytics-node/lib/esm/version.js.map +1 -0
  51. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/event.js +33 -0
  52. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/event.js.map +1 -0
  53. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/index.js +17 -0
  54. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/index.js.map +1 -0
  55. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/logger.js +12 -0
  56. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/logger.js.map +1 -0
  57. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/plugin.js +10 -0
  58. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/plugin.js.map +1 -0
  59. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/server-zone.js +10 -0
  60. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/server-zone.js.map +1 -0
  61. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/status.js +16 -0
  62. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/status.js.map +1 -0
  63. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/transport.js +10 -0
  64. package/dist/_node_modules/@amplitude/analytics-types/lib/esm/transport.js.map +1 -0
  65. package/dist/_node_modules/@amplitude/experiment-core/dist/experiment-core.esm.js +1234 -0
  66. package/dist/_node_modules/@amplitude/experiment-core/dist/experiment-core.esm.js.map +1 -0
  67. package/dist/_node_modules/@amplitude/experiment-node-server/dist/gen/version.js +14 -0
  68. package/dist/_node_modules/@amplitude/experiment-node-server/dist/gen/version.js.map +1 -0
  69. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-filter.js +34 -0
  70. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-filter.js.map +1 -0
  71. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-service.js +98 -0
  72. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment-service.js.map +1 -0
  73. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment.js +32 -0
  74. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/assignment/assignment.js.map +1 -0
  75. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/cookie.js +90 -0
  76. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/cookie.js.map +1 -0
  77. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/factory.js +46 -0
  78. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/factory.js.map +1 -0
  79. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/index.js +66 -0
  80. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/index.js.map +1 -0
  81. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cache.js +93 -0
  82. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cache.js.map +1 -0
  83. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js +278 -0
  84. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/client.js.map +1 -0
  85. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/cohort-api.js +89 -0
  86. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/cohort-api.js.map +1 -0
  87. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/fetcher.js +114 -0
  88. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/fetcher.js.map +1 -0
  89. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/poller.js +115 -0
  90. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/poller.js.map +1 -0
  91. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/storage.js +46 -0
  92. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/cohort/storage.js.map +1 -0
  93. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js +86 -0
  94. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/fetcher.js.map +1 -0
  95. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js +122 -0
  96. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/poller.js.map +1 -0
  97. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/stream-flag-api.js +195 -0
  98. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/stream-flag-api.js.map +1 -0
  99. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/streamer.js +149 -0
  100. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/streamer.js.map +1 -0
  101. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/updater.js +107 -0
  102. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/local/updater.js.map +1 -0
  103. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js +168 -0
  104. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/remote/client.js.map +1 -0
  105. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js +114 -0
  106. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/http.js.map +1 -0
  107. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/stream.js +164 -0
  108. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/transport/stream.js.map +1 -0
  109. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/cohort.js +14 -0
  110. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/cohort.js.map +1 -0
  111. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/config.js +75 -0
  112. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/config.js.map +1 -0
  113. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/loglevel.js +23 -0
  114. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/types/loglevel.js.map +1 -0
  115. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.js +73 -0
  116. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/backoff.js.map +1 -0
  117. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/cache.js +99 -0
  118. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/cache.js.map +1 -0
  119. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/cohort.js +85 -0
  120. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/cohort.js.map +1 -0
  121. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/config.js +47 -0
  122. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/config.js.map +1 -0
  123. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/hash.js +25 -0
  124. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/hash.js.map +1 -0
  125. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/logger.js +68 -0
  126. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/logger.js.map +1 -0
  127. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/threading.js +97 -0
  128. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/threading.js.map +1 -0
  129. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/time.js +20 -0
  130. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/time.js.map +1 -0
  131. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/user.js +57 -0
  132. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/user.js.map +1 -0
  133. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/variant.js +47 -0
  134. package/dist/_node_modules/@amplitude/experiment-node-server/dist/src/util/variant.js.map +1 -0
  135. package/dist/_node_modules/common-tags/es/TemplateTag/TemplateTag.js +133 -0
  136. package/dist/_node_modules/common-tags/es/TemplateTag/TemplateTag.js.map +1 -0
  137. package/dist/_node_modules/common-tags/es/commaLists/commaLists.js +6 -0
  138. package/dist/_node_modules/common-tags/es/commaLists/commaLists.js.map +1 -0
  139. package/dist/_node_modules/common-tags/es/commaListsAnd/commaListsAnd.js +6 -0
  140. package/dist/_node_modules/common-tags/es/commaListsAnd/commaListsAnd.js.map +1 -0
  141. package/dist/_node_modules/common-tags/es/commaListsOr/commaListsOr.js +6 -0
  142. package/dist/_node_modules/common-tags/es/commaListsOr/commaListsOr.js.map +1 -0
  143. package/dist/_node_modules/common-tags/es/html/html.js +8 -0
  144. package/dist/_node_modules/common-tags/es/html/html.js.map +1 -0
  145. package/dist/_node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.js +33 -0
  146. package/dist/_node_modules/common-tags/es/inlineArrayTransformer/inlineArrayTransformer.js.map +1 -0
  147. package/dist/_node_modules/common-tags/es/inlineLists/inlineLists.js +6 -0
  148. package/dist/_node_modules/common-tags/es/inlineLists/inlineLists.js.map +1 -0
  149. package/dist/_node_modules/common-tags/es/oneLine/oneLine.js +5 -0
  150. package/dist/_node_modules/common-tags/es/oneLine/oneLine.js.map +1 -0
  151. package/dist/_node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.js +6 -0
  152. package/dist/_node_modules/common-tags/es/oneLineCommaLists/oneLineCommaLists.js.map +1 -0
  153. package/dist/_node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.js +6 -0
  154. package/dist/_node_modules/common-tags/es/oneLineCommaListsAnd/oneLineCommaListsAnd.js.map +1 -0
  155. package/dist/_node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.js +6 -0
  156. package/dist/_node_modules/common-tags/es/oneLineCommaListsOr/oneLineCommaListsOr.js.map +1 -0
  157. package/dist/_node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.js +6 -0
  158. package/dist/_node_modules/common-tags/es/oneLineInlineLists/oneLineInlineLists.js.map +1 -0
  159. package/dist/_node_modules/common-tags/es/oneLineTrim/oneLineTrim.js +5 -0
  160. package/dist/_node_modules/common-tags/es/oneLineTrim/oneLineTrim.js.map +1 -0
  161. package/dist/_node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.js +20 -0
  162. package/dist/_node_modules/common-tags/es/removeNonPrintingValuesTransformer/removeNonPrintingValuesTransformer.js.map +1 -0
  163. package/dist/_node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.js +14 -0
  164. package/dist/_node_modules/common-tags/es/replaceResultTransformer/replaceResultTransformer.js.map +1 -0
  165. package/dist/_node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.js +18 -0
  166. package/dist/_node_modules/common-tags/es/replaceSubstitutionTransformer/replaceSubstitutionTransformer.js.map +1 -0
  167. package/dist/_node_modules/common-tags/es/safeHtml/safeHtml.js +8 -0
  168. package/dist/_node_modules/common-tags/es/safeHtml/safeHtml.js.map +1 -0
  169. package/dist/_node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.js +16 -0
  170. package/dist/_node_modules/common-tags/es/splitStringTransformer/splitStringTransformer.js.map +1 -0
  171. package/dist/_node_modules/common-tags/es/stripIndent/stripIndent.js +8 -0
  172. package/dist/_node_modules/common-tags/es/stripIndent/stripIndent.js.map +1 -0
  173. package/dist/_node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.js +36 -0
  174. package/dist/_node_modules/common-tags/es/stripIndentTransformer/stripIndentTransformer.js.map +1 -0
  175. package/dist/_node_modules/common-tags/es/stripIndents/stripIndents.js +5 -0
  176. package/dist/_node_modules/common-tags/es/stripIndents/stripIndents.js.map +1 -0
  177. package/dist/_node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.js +22 -0
  178. package/dist/_node_modules/common-tags/es/trimResultTransformer/trimResultTransformer.js.map +1 -0
  179. package/dist/_node_modules/data-uri-to-buffer/dist/index.js +41 -0
  180. package/dist/_node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
  181. package/dist/_node_modules/eventsource/lib/eventsource.js +384 -0
  182. package/dist/_node_modules/eventsource/lib/eventsource.js.map +1 -0
  183. package/dist/_node_modules/fetch-blob/file.js +41 -0
  184. package/dist/_node_modules/fetch-blob/file.js.map +1 -0
  185. package/dist/_node_modules/fetch-blob/from.js +9 -0
  186. package/dist/_node_modules/fetch-blob/from.js.map +1 -0
  187. package/dist/_node_modules/fetch-blob/index.js +201 -0
  188. package/dist/_node_modules/fetch-blob/index.js.map +1 -0
  189. package/dist/_node_modules/fetch-blob/streams.js +52 -0
  190. package/dist/_node_modules/fetch-blob/streams.js.map +1 -0
  191. package/dist/_node_modules/formdata-polyfill/esm.min.js +90 -0
  192. package/dist/_node_modules/formdata-polyfill/esm.min.js.map +1 -0
  193. package/dist/_node_modules/get-port/index.js +115 -0
  194. package/dist/_node_modules/get-port/index.js.map +1 -0
  195. package/dist/_node_modules/node-domexception/index.js +20 -0
  196. package/dist/_node_modules/node-domexception/index.js.map +1 -0
  197. package/dist/_node_modules/node-fetch/src/body.js +259 -0
  198. package/dist/_node_modules/node-fetch/src/body.js.map +1 -0
  199. package/dist/_node_modules/node-fetch/src/errors/abort-error.js +10 -0
  200. package/dist/_node_modules/node-fetch/src/errors/abort-error.js.map +1 -0
  201. package/dist/_node_modules/node-fetch/src/errors/base.js +17 -0
  202. package/dist/_node_modules/node-fetch/src/errors/base.js.map +1 -0
  203. package/dist/_node_modules/node-fetch/src/errors/fetch-error.js +19 -0
  204. package/dist/_node_modules/node-fetch/src/errors/fetch-error.js.map +1 -0
  205. package/dist/_node_modules/node-fetch/src/headers.js +189 -0
  206. package/dist/_node_modules/node-fetch/src/headers.js.map +1 -0
  207. package/dist/_node_modules/node-fetch/src/index.js +290 -0
  208. package/dist/_node_modules/node-fetch/src/index.js.map +1 -0
  209. package/dist/_node_modules/node-fetch/src/request.js +203 -0
  210. package/dist/_node_modules/node-fetch/src/request.js.map +1 -0
  211. package/dist/_node_modules/node-fetch/src/response.js +123 -0
  212. package/dist/_node_modules/node-fetch/src/response.js.map +1 -0
  213. package/dist/_node_modules/node-fetch/src/utils/get-search.js +12 -0
  214. package/dist/_node_modules/node-fetch/src/utils/get-search.js.map +1 -0
  215. package/dist/_node_modules/node-fetch/src/utils/is-redirect.js +8 -0
  216. package/dist/_node_modules/node-fetch/src/utils/is-redirect.js.map +1 -0
  217. package/dist/_node_modules/node-fetch/src/utils/is.js +28 -0
  218. package/dist/_node_modules/node-fetch/src/utils/is.js.map +1 -0
  219. package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js +356 -0
  220. package/dist/_node_modules/node-fetch/src/utils/multipart-parser.js.map +1 -0
  221. package/dist/_node_modules/node-fetch/src/utils/referrer.js +149 -0
  222. package/dist/_node_modules/node-fetch/src/utils/referrer.js.map +1 -0
  223. package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +3818 -0
  224. package/dist/_node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
  225. package/dist/_virtual/_commonjsHelpers.js +35 -0
  226. package/dist/_virtual/_commonjsHelpers.js.map +1 -0
  227. package/dist/_virtual/assignment-filter.js +5 -0
  228. package/dist/_virtual/assignment-filter.js.map +1 -0
  229. package/dist/_virtual/assignment-service.js +5 -0
  230. package/dist/_virtual/assignment-service.js.map +1 -0
  231. package/dist/_virtual/assignment.js +5 -0
  232. package/dist/_virtual/assignment.js.map +1 -0
  233. package/dist/_virtual/backoff.js +5 -0
  234. package/dist/_virtual/backoff.js.map +1 -0
  235. package/dist/_virtual/cache.js +5 -0
  236. package/dist/_virtual/cache.js.map +1 -0
  237. package/dist/_virtual/cache2.js +5 -0
  238. package/dist/_virtual/cache2.js.map +1 -0
  239. package/dist/_virtual/client.js +5 -0
  240. package/dist/_virtual/client.js.map +1 -0
  241. package/dist/_virtual/client2.js +5 -0
  242. package/dist/_virtual/client2.js.map +1 -0
  243. package/dist/_virtual/cohort-api.js +5 -0
  244. package/dist/_virtual/cohort-api.js.map +1 -0
  245. package/dist/_virtual/cohort.js +5 -0
  246. package/dist/_virtual/cohort.js.map +1 -0
  247. package/dist/_virtual/cohort2.js +5 -0
  248. package/dist/_virtual/cohort2.js.map +1 -0
  249. package/dist/_virtual/config.js +5 -0
  250. package/dist/_virtual/config.js.map +1 -0
  251. package/dist/_virtual/config2.js +5 -0
  252. package/dist/_virtual/config2.js.map +1 -0
  253. package/dist/_virtual/cookie.js +5 -0
  254. package/dist/_virtual/cookie.js.map +1 -0
  255. package/dist/_virtual/experiment-core.esm.js +7 -0
  256. package/dist/_virtual/experiment-core.esm.js.map +1 -0
  257. package/dist/_virtual/factory.js +5 -0
  258. package/dist/_virtual/factory.js.map +1 -0
  259. package/dist/_virtual/fetcher.js +5 -0
  260. package/dist/_virtual/fetcher.js.map +1 -0
  261. package/dist/_virtual/fetcher2.js +5 -0
  262. package/dist/_virtual/fetcher2.js.map +1 -0
  263. package/dist/_virtual/hash.js +5 -0
  264. package/dist/_virtual/hash.js.map +1 -0
  265. package/dist/_virtual/http.js +5 -0
  266. package/dist/_virtual/http.js.map +1 -0
  267. package/dist/_virtual/index.js +6 -0
  268. package/dist/_virtual/index.js.map +1 -0
  269. package/dist/_virtual/index2.js +5 -0
  270. package/dist/_virtual/index2.js.map +1 -0
  271. package/dist/_virtual/index3.js +3 -0
  272. package/dist/_virtual/index3.js.map +1 -0
  273. package/dist/_virtual/index4.js +7 -0
  274. package/dist/_virtual/index4.js.map +1 -0
  275. package/dist/_virtual/logger.js +5 -0
  276. package/dist/_virtual/logger.js.map +1 -0
  277. package/dist/_virtual/loglevel.js +5 -0
  278. package/dist/_virtual/loglevel.js.map +1 -0
  279. package/dist/_virtual/poller.js +5 -0
  280. package/dist/_virtual/poller.js.map +1 -0
  281. package/dist/_virtual/poller2.js +5 -0
  282. package/dist/_virtual/poller2.js.map +1 -0
  283. package/dist/_virtual/ponyfill.es2018.js +5 -0
  284. package/dist/_virtual/ponyfill.es2018.js.map +1 -0
  285. package/dist/_virtual/storage.js +5 -0
  286. package/dist/_virtual/storage.js.map +1 -0
  287. package/dist/_virtual/stream-flag-api.js +5 -0
  288. package/dist/_virtual/stream-flag-api.js.map +1 -0
  289. package/dist/_virtual/stream.js +5 -0
  290. package/dist/_virtual/stream.js.map +1 -0
  291. package/dist/_virtual/streamer.js +5 -0
  292. package/dist/_virtual/streamer.js.map +1 -0
  293. package/dist/_virtual/streams.js +3 -0
  294. package/dist/_virtual/streams.js.map +1 -0
  295. package/dist/_virtual/streams2.js +5 -0
  296. package/dist/_virtual/streams2.js.map +1 -0
  297. package/dist/_virtual/threading.js +5 -0
  298. package/dist/_virtual/threading.js.map +1 -0
  299. package/dist/_virtual/time.js +5 -0
  300. package/dist/_virtual/time.js.map +1 -0
  301. package/dist/_virtual/updater.js +5 -0
  302. package/dist/_virtual/updater.js.map +1 -0
  303. package/dist/_virtual/user.js +5 -0
  304. package/dist/_virtual/user.js.map +1 -0
  305. package/dist/_virtual/variant.js +5 -0
  306. package/dist/_virtual/variant.js.map +1 -0
  307. package/dist/_virtual/version.js +5 -0
  308. package/dist/_virtual/version.js.map +1 -0
  309. package/dist/auth/PrismicAuthManager.d.ts +47 -0
  310. package/dist/auth/PrismicAuthManager.js +214 -0
  311. package/dist/auth/PrismicAuthManager.js.map +1 -0
  312. package/dist/auth/createPrismicAuthManager.d.ts +4 -0
  313. package/dist/auth/createPrismicAuthManager.js +8 -0
  314. package/dist/auth/createPrismicAuthManager.js.map +1 -0
  315. package/dist/auth/createPrismicAuthManagerMiddleware.d.ts +13 -0
  316. package/dist/auth/createPrismicAuthManagerMiddleware.js +39 -0
  317. package/dist/auth/createPrismicAuthManagerMiddleware.js.map +1 -0
  318. package/dist/constants/API_ENDPOINTS.d.ts +9 -0
  319. package/dist/constants/API_ENDPOINTS.js +73 -0
  320. package/dist/constants/API_ENDPOINTS.js.map +1 -0
  321. package/dist/constants/API_TOKENS.d.ts +6 -0
  322. package/dist/constants/API_TOKENS.js +27 -0
  323. package/dist/constants/API_TOKENS.js.map +1 -0
  324. package/dist/constants/APPLICATION_MODE.d.ts +8 -0
  325. package/dist/constants/APPLICATION_MODE.js +12 -0
  326. package/dist/constants/APPLICATION_MODE.js.map +1 -0
  327. package/dist/constants/PRISMIC_CLI_NPM_PACKAGE_NAME.d.ts +1 -0
  328. package/dist/constants/PRISMIC_CLI_NPM_PACKAGE_NAME.js +5 -0
  329. package/dist/constants/PRISMIC_CLI_NPM_PACKAGE_NAME.js.map +1 -0
  330. package/dist/constants/PRISMIC_CLI_USER_AGENT.d.ts +1 -0
  331. package/dist/constants/PRISMIC_CLI_USER_AGENT.js +5 -0
  332. package/dist/constants/PRISMIC_CLI_USER_AGENT.js.map +1 -0
  333. package/dist/constants/PRISMIC_CONFIG_FILENAME.d.ts +1 -0
  334. package/dist/constants/PRISMIC_CONFIG_FILENAME.js +5 -0
  335. package/dist/constants/PRISMIC_CONFIG_FILENAME.js.map +1 -0
  336. package/dist/constants/SLICEMACHINE_CONFIG_FILENAME.d.ts +1 -0
  337. package/dist/constants/SLICEMACHINE_CONFIG_FILENAME.js +5 -0
  338. package/dist/constants/SLICEMACHINE_CONFIG_FILENAME.js.map +1 -0
  339. package/dist/constants/TS_CONFIG_FILENAME.d.ts +1 -0
  340. package/dist/constants/TS_CONFIG_FILENAME.js +5 -0
  341. package/dist/constants/TS_CONFIG_FILENAME.js.map +1 -0
  342. package/dist/errors.d.ts +43 -0
  343. package/dist/errors.js +20 -0
  344. package/dist/errors.js.map +1 -0
  345. package/dist/index.d.ts +4 -0
  346. package/dist/index.js +5 -0
  347. package/dist/index.js.map +1 -0
  348. package/dist/lib/DecodeError.d.ts +13 -0
  349. package/dist/lib/DecodeError.js +21 -0
  350. package/dist/lib/DecodeError.js.map +1 -0
  351. package/dist/lib/assertPluginsInitialized.d.ts +2 -0
  352. package/dist/lib/assertPluginsInitialized.js +9 -0
  353. package/dist/lib/assertPluginsInitialized.js.map +1 -0
  354. package/dist/lib/castArray.d.ts +1 -0
  355. package/dist/lib/castArray.js +7 -0
  356. package/dist/lib/castArray.js.map +1 -0
  357. package/dist/lib/decode.d.ts +10 -0
  358. package/dist/lib/decode.js +14 -0
  359. package/dist/lib/decode.js.map +1 -0
  360. package/dist/lib/decodeHookResult.d.ts +7 -0
  361. package/dist/lib/decodeHookResult.js +21 -0
  362. package/dist/lib/decodeHookResult.js.map +1 -0
  363. package/dist/lib/decodePackageJSON.d.ts +12 -0
  364. package/dist/lib/decodePrismicConfig.d.ts +3 -0
  365. package/dist/lib/decodePrismicConfig.js +22 -0
  366. package/dist/lib/decodePrismicConfig.js.map +1 -0
  367. package/dist/lib/fetchNPMPackageVersions.d.ts +5 -0
  368. package/dist/lib/fetchNPMPackageVersions.js +24 -0
  369. package/dist/lib/fetchNPMPackageVersions.js.map +1 -0
  370. package/dist/lib/format.d.ts +12 -0
  371. package/dist/lib/format.js +30 -0
  372. package/dist/lib/format.js.map +1 -0
  373. package/dist/lib/installDependencies.d.ts +13 -0
  374. package/dist/lib/installDependencies.js +45 -0
  375. package/dist/lib/installDependencies.js.map +1 -0
  376. package/dist/lib/locateFileUpward.d.ts +10 -0
  377. package/dist/lib/locateFileUpward.js +29 -0
  378. package/dist/lib/locateFileUpward.js.map +1 -0
  379. package/dist/lib/prismicrc.d.ts +8 -0
  380. package/dist/lib/prismicrc.js +29 -0
  381. package/dist/lib/prismicrc.js.map +1 -0
  382. package/dist/lib/trailingSlash.d.ts +1 -0
  383. package/dist/lib/trailingSlash.js +7 -0
  384. package/dist/lib/trailingSlash.js.map +1 -0
  385. package/dist/lib/typesInternalSchemas.d.ts +12 -0
  386. package/dist/lib/typesInternalSchemas.js +29 -0
  387. package/dist/lib/typesInternalSchemas.js.map +1 -0
  388. package/dist/managers/BaseManager.d.ts +27 -0
  389. package/dist/managers/BaseManager.js +48 -0
  390. package/dist/managers/BaseManager.js.map +1 -0
  391. package/dist/managers/PrismicManager.d.ts +33 -0
  392. package/dist/managers/PrismicManager.js +60 -0
  393. package/dist/managers/PrismicManager.js.map +1 -0
  394. package/dist/managers/createPrismicManager.d.ts +4 -0
  395. package/dist/managers/createPrismicManager.js +8 -0
  396. package/dist/managers/createPrismicManager.js.map +1 -0
  397. package/dist/managers/customTypes/CustomTypesManager.d.ts +44 -0
  398. package/dist/managers/customTypes/CustomTypesManager.js +111 -0
  399. package/dist/managers/customTypes/CustomTypesManager.js.map +1 -0
  400. package/dist/managers/customTypes/types.d.ts +2 -0
  401. package/dist/managers/plugins/PluginsManager.d.ts +13 -0
  402. package/dist/managers/plugins/PluginsManager.js +30 -0
  403. package/dist/managers/plugins/PluginsManager.js.map +1 -0
  404. package/dist/managers/prismicRepository/PrismicRepositoryManager.d.ts +12 -0
  405. package/dist/managers/prismicRepository/PrismicRepositoryManager.js +79 -0
  406. package/dist/managers/prismicRepository/PrismicRepositoryManager.js.map +1 -0
  407. package/dist/managers/prismicRepository/types.d.ts +17 -0
  408. package/dist/managers/prismicRepository/types.js +24 -0
  409. package/dist/managers/prismicRepository/types.js.map +1 -0
  410. package/dist/managers/project/ProjectManager.d.ts +51 -0
  411. package/dist/managers/project/ProjectManager.js +208 -0
  412. package/dist/managers/project/ProjectManager.js.map +1 -0
  413. package/dist/managers/slices/SlicesManager.d.ts +61 -0
  414. package/dist/managers/slices/SlicesManager.js +169 -0
  415. package/dist/managers/slices/SlicesManager.js.map +1 -0
  416. package/dist/managers/telemetry/TelemetryManager.d.ts +23 -0
  417. package/dist/managers/telemetry/TelemetryManager.js +133 -0
  418. package/dist/managers/telemetry/TelemetryManager.js.map +1 -0
  419. package/dist/managers/telemetry/types.d.ts +35 -0
  420. package/dist/managers/telemetry/types.js +15 -0
  421. package/dist/managers/telemetry/types.js.map +1 -0
  422. package/dist/managers/user/UserManager.d.ts +22 -0
  423. package/dist/managers/user/UserManager.js +22 -0
  424. package/dist/managers/user/UserManager.js.map +1 -0
  425. package/dist/managers/versions/VersionsManager.d.ts +21 -0
  426. package/dist/managers/versions/VersionsManager.js +39 -0
  427. package/dist/managers/versions/VersionsManager.js.map +1 -0
  428. package/dist/types.d.ts +32 -0
  429. package/package.json +100 -0
  430. package/src/auth/PrismicAuthManager.ts +346 -0
  431. package/src/auth/createPrismicAuthManager.ts +11 -0
  432. package/src/auth/createPrismicAuthManagerMiddleware.ts +79 -0
  433. package/src/constants/API_ENDPOINTS.ts +106 -0
  434. package/src/constants/API_TOKENS.ts +29 -0
  435. package/src/constants/APPLICATION_MODE.ts +8 -0
  436. package/src/constants/PRISMIC_CLI_NPM_PACKAGE_NAME.ts +1 -0
  437. package/src/constants/PRISMIC_CLI_USER_AGENT.ts +1 -0
  438. package/src/constants/PRISMIC_CONFIG_FILENAME.ts +1 -0
  439. package/src/constants/SLICEMACHINE_CONFIG_FILENAME.ts +1 -0
  440. package/src/constants/TS_CONFIG_FILENAME.ts +1 -0
  441. package/src/errors.ts +109 -0
  442. package/src/index.ts +5 -0
  443. package/src/lib/DecodeError.ts +31 -0
  444. package/src/lib/assertPluginsInitialized.ts +11 -0
  445. package/src/lib/castArray.ts +3 -0
  446. package/src/lib/decode.ts +28 -0
  447. package/src/lib/decodeHookResult.ts +36 -0
  448. package/src/lib/decodePackageJSON.ts +18 -0
  449. package/src/lib/decodePrismicConfig.ts +26 -0
  450. package/src/lib/fetchNPMPackageVersions.ts +45 -0
  451. package/src/lib/format.ts +34 -0
  452. package/src/lib/installDependencies.ts +74 -0
  453. package/src/lib/locateFileUpward.ts +53 -0
  454. package/src/lib/prismicrc.ts +41 -0
  455. package/src/lib/trailingSlash.ts +5 -0
  456. package/src/lib/typesInternalSchemas.ts +42 -0
  457. package/src/managers/BaseManager.ts +74 -0
  458. package/src/managers/PrismicManager.ts +81 -0
  459. package/src/managers/createPrismicManager.ts +9 -0
  460. package/src/managers/customTypes/CustomTypesManager.ts +221 -0
  461. package/src/managers/customTypes/types.ts +3 -0
  462. package/src/managers/plugins/PluginsManager.ts +44 -0
  463. package/src/managers/prismicRepository/PrismicRepositoryManager.ts +120 -0
  464. package/src/managers/prismicRepository/types.ts +23 -0
  465. package/src/managers/project/ProjectManager.ts +354 -0
  466. package/src/managers/slices/SlicesManager.ts +308 -0
  467. package/src/managers/telemetry/TelemetryManager.ts +227 -0
  468. package/src/managers/telemetry/types.ts +62 -0
  469. package/src/managers/user/UserManager.ts +35 -0
  470. package/src/managers/versions/VersionsManager.ts +53 -0
  471. package/src/types.ts +41 -0
@@ -0,0 +1,1234 @@
1
+ var extendStatics = function(d, b) {
2
+ extendStatics = Object.setPrototypeOf || {
3
+ __proto__: []
4
+ } instanceof Array && function(d2, b2) {
5
+ d2.__proto__ = b2;
6
+ } || function(d2, b2) {
7
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
8
+ };
9
+ return extendStatics(d, b);
10
+ };
11
+ function __extends(d, b) {
12
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
+ extendStatics(d, b);
14
+ function __() {
15
+ this.constructor = d;
16
+ }
17
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18
+ }
19
+ var __assign = function() {
20
+ __assign = Object.assign || function __assign2(t) {
21
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
22
+ s = arguments[i];
23
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
24
+ }
25
+ return t;
26
+ };
27
+ return __assign.apply(this, arguments);
28
+ };
29
+ function __awaiter(thisArg, _arguments, P, generator) {
30
+ function adopt(value) {
31
+ return value instanceof P ? value : new P(function(resolve) {
32
+ resolve(value);
33
+ });
34
+ }
35
+ return new (P || (P = Promise))(function(resolve, reject) {
36
+ function fulfilled(value) {
37
+ try {
38
+ step(generator.next(value));
39
+ } catch (e) {
40
+ reject(e);
41
+ }
42
+ }
43
+ function rejected(value) {
44
+ try {
45
+ step(generator["throw"](value));
46
+ } catch (e) {
47
+ reject(e);
48
+ }
49
+ }
50
+ function step(result) {
51
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
52
+ }
53
+ step((generator = generator.apply(thisArg, [])).next());
54
+ });
55
+ }
56
+ function __generator(thisArg, body) {
57
+ var _ = {
58
+ label: 0,
59
+ sent: function() {
60
+ if (t[0] & 1) throw t[1];
61
+ return t[1];
62
+ },
63
+ trys: [],
64
+ ops: []
65
+ }, f, y, t, g;
66
+ return g = {
67
+ next: verb(0),
68
+ "throw": verb(1),
69
+ "return": verb(2)
70
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
71
+ return this;
72
+ }), g;
73
+ function verb(n) {
74
+ return function(v) {
75
+ return step([n, v]);
76
+ };
77
+ }
78
+ function step(op) {
79
+ if (f) throw new TypeError("Generator is already executing.");
80
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
81
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
82
+ if (y = 0, t) op = [op[0] & 2, t.value];
83
+ switch (op[0]) {
84
+ case 0:
85
+ case 1:
86
+ t = op;
87
+ break;
88
+ case 4:
89
+ _.label++;
90
+ return {
91
+ value: op[1],
92
+ done: false
93
+ };
94
+ case 5:
95
+ _.label++;
96
+ y = op[1];
97
+ op = [0];
98
+ continue;
99
+ case 7:
100
+ op = _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ default:
104
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
105
+ _ = 0;
106
+ continue;
107
+ }
108
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
109
+ _.label = op[1];
110
+ break;
111
+ }
112
+ if (op[0] === 6 && _.label < t[1]) {
113
+ _.label = t[1];
114
+ t = op;
115
+ break;
116
+ }
117
+ if (t && _.label < t[2]) {
118
+ _.label = t[2];
119
+ _.ops.push(op);
120
+ break;
121
+ }
122
+ if (t[2]) _.ops.pop();
123
+ _.trys.pop();
124
+ continue;
125
+ }
126
+ op = body.call(thisArg, _);
127
+ } catch (e) {
128
+ op = [6, e];
129
+ y = 0;
130
+ } finally {
131
+ f = t = 0;
132
+ }
133
+ if (op[0] & 5) throw op[1];
134
+ return {
135
+ value: op[0] ? op[1] : void 0,
136
+ done: true
137
+ };
138
+ }
139
+ }
140
+ function __values(o) {
141
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
142
+ if (m) return m.call(o);
143
+ if (o && typeof o.length === "number") return {
144
+ next: function() {
145
+ if (o && i >= o.length) o = void 0;
146
+ return {
147
+ value: o && o[i++],
148
+ done: !o
149
+ };
150
+ }
151
+ };
152
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
153
+ }
154
+ function __read(o, n) {
155
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
156
+ if (!m) return o;
157
+ var i = m.call(o), r, ar = [], e;
158
+ try {
159
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
160
+ } catch (error) {
161
+ e = {
162
+ error
163
+ };
164
+ } finally {
165
+ try {
166
+ if (r && !r.done && (m = i["return"])) m.call(i);
167
+ } finally {
168
+ if (e) throw e.error;
169
+ }
170
+ }
171
+ return ar;
172
+ }
173
+ function __spreadArray(to, from, pack) {
174
+ if (arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
175
+ if (ar || !(i in from)) {
176
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
177
+ ar[i] = from[i];
178
+ }
179
+ }
180
+ return to.concat(ar || Array.prototype.slice.call(from));
181
+ }
182
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
183
+ var e = new Error(message);
184
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
185
+ };
186
+ var EvaluationOperator = {
187
+ IS: "is",
188
+ IS_NOT: "is not",
189
+ CONTAINS: "contains",
190
+ DOES_NOT_CONTAIN: "does not contain",
191
+ LESS_THAN: "less",
192
+ LESS_THAN_EQUALS: "less or equal",
193
+ GREATER_THAN: "greater",
194
+ GREATER_THAN_EQUALS: "greater or equal",
195
+ VERSION_LESS_THAN: "version less",
196
+ VERSION_LESS_THAN_EQUALS: "version less or equal",
197
+ VERSION_GREATER_THAN: "version greater",
198
+ VERSION_GREATER_THAN_EQUALS: "version greater or equal",
199
+ SET_IS: "set is",
200
+ SET_IS_NOT: "set is not",
201
+ SET_CONTAINS: "set contains",
202
+ SET_DOES_NOT_CONTAIN: "set does not contain",
203
+ SET_CONTAINS_ANY: "set contains any",
204
+ SET_DOES_NOT_CONTAIN_ANY: "set does not contain any",
205
+ REGEX_MATCH: "regex match",
206
+ REGEX_DOES_NOT_MATCH: "regex does not match"
207
+ };
208
+ var stringToUtf8ByteArray = function(str) {
209
+ var out = [];
210
+ var p = 0;
211
+ for (var i = 0; i < str.length; i++) {
212
+ var c = str.charCodeAt(i);
213
+ if (c < 128) {
214
+ out[p++] = c;
215
+ } else if (c < 2048) {
216
+ out[p++] = c >> 6 | 192;
217
+ out[p++] = c & 63 | 128;
218
+ } else if ((c & 64512) == 55296 && i + 1 < str.length && (str.charCodeAt(i + 1) & 64512) == 56320) {
219
+ c = 65536 + ((c & 1023) << 10) + (str.charCodeAt(++i) & 1023);
220
+ out[p++] = c >> 18 | 240;
221
+ out[p++] = c >> 12 & 63 | 128;
222
+ out[p++] = c >> 6 & 63 | 128;
223
+ out[p++] = c & 63 | 128;
224
+ } else {
225
+ out[p++] = c >> 12 | 224;
226
+ out[p++] = c >> 6 & 63 | 128;
227
+ out[p++] = c & 63 | 128;
228
+ }
229
+ }
230
+ return Uint8Array.from(out);
231
+ };
232
+ var C1_32 = -862048943;
233
+ var C2_32 = 461845907;
234
+ var R1_32 = 15;
235
+ var R2_32 = 13;
236
+ var M_32 = 5;
237
+ var N_32 = -430675100;
238
+ var hash32x86 = function(input, seed) {
239
+ if (seed === void 0) {
240
+ seed = 0;
241
+ }
242
+ var data = stringToUtf8ByteArray(input);
243
+ var length = data.length;
244
+ var nBlocks = length >> 2;
245
+ var hash = seed;
246
+ for (var i = 0; i < nBlocks; i++) {
247
+ var index_1 = i << 2;
248
+ var k = readIntLe(data, index_1);
249
+ hash = mix32(k, hash);
250
+ }
251
+ var index = nBlocks << 2;
252
+ var k1 = 0;
253
+ switch (length - index) {
254
+ case 3:
255
+ k1 ^= data[index + 2] << 16;
256
+ k1 ^= data[index + 1] << 8;
257
+ k1 ^= data[index];
258
+ k1 = Math.imul(k1, C1_32);
259
+ k1 = rotateLeft(k1, R1_32);
260
+ k1 = Math.imul(k1, C2_32);
261
+ hash ^= k1;
262
+ break;
263
+ case 2:
264
+ k1 ^= data[index + 1] << 8;
265
+ k1 ^= data[index];
266
+ k1 = Math.imul(k1, C1_32);
267
+ k1 = rotateLeft(k1, R1_32);
268
+ k1 = Math.imul(k1, C2_32);
269
+ hash ^= k1;
270
+ break;
271
+ case 1:
272
+ k1 ^= data[index];
273
+ k1 = Math.imul(k1, C1_32);
274
+ k1 = rotateLeft(k1, R1_32);
275
+ k1 = Math.imul(k1, C2_32);
276
+ hash ^= k1;
277
+ break;
278
+ }
279
+ hash ^= length;
280
+ return fmix32(hash) >>> 0;
281
+ };
282
+ var mix32 = function(k, hash) {
283
+ var kResult = k;
284
+ var hashResult = hash;
285
+ kResult = Math.imul(kResult, C1_32);
286
+ kResult = rotateLeft(kResult, R1_32);
287
+ kResult = Math.imul(kResult, C2_32);
288
+ hashResult ^= kResult;
289
+ hashResult = rotateLeft(hashResult, R2_32);
290
+ hashResult = Math.imul(hashResult, M_32);
291
+ return hashResult + N_32 | 0;
292
+ };
293
+ var fmix32 = function(hash) {
294
+ var hashResult = hash;
295
+ hashResult ^= hashResult >>> 16;
296
+ hashResult = Math.imul(hashResult, -2048144789);
297
+ hashResult ^= hashResult >>> 13;
298
+ hashResult = Math.imul(hashResult, -1028477387);
299
+ hashResult ^= hashResult >>> 16;
300
+ return hashResult;
301
+ };
302
+ var rotateLeft = function(x, n, width) {
303
+ if (width === void 0) {
304
+ width = 32;
305
+ }
306
+ if (n > width)
307
+ n = n % width;
308
+ var mask = 4294967295 << width - n >>> 0;
309
+ var r = (x & mask) >>> 0 >>> width - n >>> 0;
310
+ return (x << n | r) >>> 0;
311
+ };
312
+ var readIntLe = function(data, index) {
313
+ if (index === void 0) {
314
+ index = 0;
315
+ }
316
+ var n = data[index] << 24 | data[index + 1] << 16 | data[index + 2] << 8 | data[index + 3];
317
+ return reverseBytes(n);
318
+ };
319
+ var reverseBytes = function(n) {
320
+ return (n & -16777216) >>> 24 | (n & 16711680) >>> 8 | (n & 65280) << 8 | (n & 255) << 24;
321
+ };
322
+ var select = function(selectable, selector) {
323
+ var e_1, _a;
324
+ if (!selector || selector.length === 0) {
325
+ return void 0;
326
+ }
327
+ try {
328
+ for (var selector_1 = __values(selector), selector_1_1 = selector_1.next(); !selector_1_1.done; selector_1_1 = selector_1.next()) {
329
+ var selectorElement = selector_1_1.value;
330
+ if (!selectorElement || !selectable || typeof selectable !== "object") {
331
+ return void 0;
332
+ }
333
+ selectable = selectable[selectorElement];
334
+ }
335
+ } catch (e_1_1) {
336
+ e_1 = { error: e_1_1 };
337
+ } finally {
338
+ try {
339
+ if (selector_1_1 && !selector_1_1.done && (_a = selector_1.return)) _a.call(selector_1);
340
+ } finally {
341
+ if (e_1) throw e_1.error;
342
+ }
343
+ }
344
+ if (!selectable) {
345
+ return void 0;
346
+ } else {
347
+ return selectable;
348
+ }
349
+ };
350
+ var MAJOR_MINOR_REGEX = "(\\d+)\\.(\\d+)";
351
+ var PATCH_REGEX = "(\\d+)";
352
+ var PRERELEASE_REGEX = "(-(([-\\w]+\\.?)*))?";
353
+ var VERSION_PATTERN = "^".concat(MAJOR_MINOR_REGEX, "(\\.").concat(PATCH_REGEX).concat(PRERELEASE_REGEX, ")?$");
354
+ var SemanticVersion = (
355
+ /** @class */
356
+ function() {
357
+ function SemanticVersion2(major, minor, patch, preRelease) {
358
+ if (preRelease === void 0) {
359
+ preRelease = void 0;
360
+ }
361
+ this.major = major;
362
+ this.minor = minor;
363
+ this.patch = patch;
364
+ this.preRelease = preRelease;
365
+ }
366
+ SemanticVersion2.parse = function(version2) {
367
+ if (!version2) {
368
+ return void 0;
369
+ }
370
+ var matchGroup = new RegExp(VERSION_PATTERN).exec(version2);
371
+ if (!matchGroup) {
372
+ return void 0;
373
+ }
374
+ var major = Number(matchGroup[1]);
375
+ var minor = Number(matchGroup[2]);
376
+ if (isNaN(major) || isNaN(minor)) {
377
+ return void 0;
378
+ }
379
+ var patch = Number(matchGroup[4]) || 0;
380
+ var preRelease = matchGroup[5] || void 0;
381
+ return new SemanticVersion2(major, minor, patch, preRelease);
382
+ };
383
+ SemanticVersion2.prototype.compareTo = function(other) {
384
+ if (this.major > other.major)
385
+ return 1;
386
+ if (this.major < other.major)
387
+ return -1;
388
+ if (this.minor > other.minor)
389
+ return 1;
390
+ if (this.minor < other.minor)
391
+ return -1;
392
+ if (this.patch > other.patch)
393
+ return 1;
394
+ if (this.patch < other.patch)
395
+ return -1;
396
+ if (this.preRelease && !other.preRelease)
397
+ return -1;
398
+ if (!this.preRelease && other.preRelease)
399
+ return 1;
400
+ if (this.preRelease && other.preRelease) {
401
+ if (this.preRelease > other.preRelease)
402
+ return 1;
403
+ if (this.preRelease < other.preRelease)
404
+ return -1;
405
+ return 0;
406
+ }
407
+ return 0;
408
+ };
409
+ return SemanticVersion2;
410
+ }()
411
+ );
412
+ var EvaluationEngine = (
413
+ /** @class */
414
+ function() {
415
+ function EvaluationEngine2() {
416
+ }
417
+ EvaluationEngine2.prototype.evaluate = function(context, flags) {
418
+ var e_1, _a;
419
+ var results = {};
420
+ var target = {
421
+ context,
422
+ result: results
423
+ };
424
+ try {
425
+ for (var flags_1 = __values(flags), flags_1_1 = flags_1.next(); !flags_1_1.done; flags_1_1 = flags_1.next()) {
426
+ var flag = flags_1_1.value;
427
+ var variant = this.evaluateFlag(target, flag);
428
+ if (variant) {
429
+ results[flag.key] = variant;
430
+ }
431
+ }
432
+ } catch (e_1_1) {
433
+ e_1 = { error: e_1_1 };
434
+ } finally {
435
+ try {
436
+ if (flags_1_1 && !flags_1_1.done && (_a = flags_1.return)) _a.call(flags_1);
437
+ } finally {
438
+ if (e_1) throw e_1.error;
439
+ }
440
+ }
441
+ return results;
442
+ };
443
+ EvaluationEngine2.prototype.evaluateFlag = function(target, flag) {
444
+ var e_2, _a;
445
+ var result;
446
+ try {
447
+ for (var _b = __values(flag.segments), _c = _b.next(); !_c.done; _c = _b.next()) {
448
+ var segment = _c.value;
449
+ result = this.evaluateSegment(target, flag, segment);
450
+ if (result) {
451
+ var metadata = __assign(__assign(__assign({}, flag.metadata), segment.metadata), result.metadata);
452
+ result = __assign(__assign({}, result), { metadata });
453
+ break;
454
+ }
455
+ }
456
+ } catch (e_2_1) {
457
+ e_2 = { error: e_2_1 };
458
+ } finally {
459
+ try {
460
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
461
+ } finally {
462
+ if (e_2) throw e_2.error;
463
+ }
464
+ }
465
+ return result;
466
+ };
467
+ EvaluationEngine2.prototype.evaluateSegment = function(target, flag, segment) {
468
+ var e_3, _a, e_4, _b;
469
+ if (!segment.conditions) {
470
+ var variantKey = this.bucket(target, segment);
471
+ if (variantKey !== void 0) {
472
+ return flag.variants[variantKey];
473
+ } else {
474
+ return void 0;
475
+ }
476
+ }
477
+ try {
478
+ for (var _c = __values(segment.conditions), _d = _c.next(); !_d.done; _d = _c.next()) {
479
+ var conditions = _d.value;
480
+ var match = true;
481
+ try {
482
+ for (var conditions_1 = (e_4 = void 0, __values(conditions)), conditions_1_1 = conditions_1.next(); !conditions_1_1.done; conditions_1_1 = conditions_1.next()) {
483
+ var condition = conditions_1_1.value;
484
+ match = this.matchCondition(target, condition);
485
+ if (!match) {
486
+ break;
487
+ }
488
+ }
489
+ } catch (e_4_1) {
490
+ e_4 = { error: e_4_1 };
491
+ } finally {
492
+ try {
493
+ if (conditions_1_1 && !conditions_1_1.done && (_b = conditions_1.return)) _b.call(conditions_1);
494
+ } finally {
495
+ if (e_4) throw e_4.error;
496
+ }
497
+ }
498
+ if (match) {
499
+ var variantKey = this.bucket(target, segment);
500
+ if (variantKey !== void 0) {
501
+ return flag.variants[variantKey];
502
+ } else {
503
+ return void 0;
504
+ }
505
+ }
506
+ }
507
+ } catch (e_3_1) {
508
+ e_3 = { error: e_3_1 };
509
+ } finally {
510
+ try {
511
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
512
+ } finally {
513
+ if (e_3) throw e_3.error;
514
+ }
515
+ }
516
+ return void 0;
517
+ };
518
+ EvaluationEngine2.prototype.matchCondition = function(target, condition) {
519
+ var propValue = select(target, condition.selector);
520
+ if (!propValue) {
521
+ return this.matchNull(condition.op, condition.values);
522
+ } else if (this.isSetOperator(condition.op)) {
523
+ var propValueStringList = this.coerceStringArray(propValue);
524
+ if (!propValueStringList) {
525
+ return false;
526
+ }
527
+ return this.matchSet(propValueStringList, condition.op, condition.values);
528
+ } else {
529
+ var propValueString = this.coerceString(propValue);
530
+ if (propValueString !== void 0) {
531
+ return this.matchString(propValueString, condition.op, condition.values);
532
+ } else {
533
+ return false;
534
+ }
535
+ }
536
+ };
537
+ EvaluationEngine2.prototype.getHash = function(key) {
538
+ return hash32x86(key);
539
+ };
540
+ EvaluationEngine2.prototype.bucket = function(target, segment) {
541
+ var e_5, _a, e_6, _b;
542
+ if (!segment.bucket) {
543
+ return segment.variant;
544
+ }
545
+ var bucketingValue = this.coerceString(select(target, segment.bucket.selector));
546
+ if (!bucketingValue || bucketingValue.length === 0) {
547
+ return segment.variant;
548
+ }
549
+ var keyToHash = "".concat(segment.bucket.salt, "/").concat(bucketingValue);
550
+ var hash = this.getHash(keyToHash);
551
+ var allocationValue = hash % 100;
552
+ var distributionValue = Math.floor(hash / 100);
553
+ try {
554
+ for (var _c = __values(segment.bucket.allocations), _d = _c.next(); !_d.done; _d = _c.next()) {
555
+ var allocation = _d.value;
556
+ var allocationStart = allocation.range[0];
557
+ var allocationEnd = allocation.range[1];
558
+ if (allocationValue >= allocationStart && allocationValue < allocationEnd) {
559
+ try {
560
+ for (var _e = (e_6 = void 0, __values(allocation.distributions)), _f = _e.next(); !_f.done; _f = _e.next()) {
561
+ var distribution = _f.value;
562
+ var distributionStart = distribution.range[0];
563
+ var distributionEnd = distribution.range[1];
564
+ if (distributionValue >= distributionStart && distributionValue < distributionEnd) {
565
+ return distribution.variant;
566
+ }
567
+ }
568
+ } catch (e_6_1) {
569
+ e_6 = { error: e_6_1 };
570
+ } finally {
571
+ try {
572
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
573
+ } finally {
574
+ if (e_6) throw e_6.error;
575
+ }
576
+ }
577
+ }
578
+ }
579
+ } catch (e_5_1) {
580
+ e_5 = { error: e_5_1 };
581
+ } finally {
582
+ try {
583
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
584
+ } finally {
585
+ if (e_5) throw e_5.error;
586
+ }
587
+ }
588
+ return segment.variant;
589
+ };
590
+ EvaluationEngine2.prototype.matchNull = function(op, filterValues) {
591
+ var containsNone = this.containsNone(filterValues);
592
+ switch (op) {
593
+ case EvaluationOperator.IS:
594
+ case EvaluationOperator.CONTAINS:
595
+ case EvaluationOperator.LESS_THAN:
596
+ case EvaluationOperator.LESS_THAN_EQUALS:
597
+ case EvaluationOperator.GREATER_THAN:
598
+ case EvaluationOperator.GREATER_THAN_EQUALS:
599
+ case EvaluationOperator.VERSION_LESS_THAN:
600
+ case EvaluationOperator.VERSION_LESS_THAN_EQUALS:
601
+ case EvaluationOperator.VERSION_GREATER_THAN:
602
+ case EvaluationOperator.VERSION_GREATER_THAN_EQUALS:
603
+ case EvaluationOperator.SET_IS:
604
+ case EvaluationOperator.SET_CONTAINS:
605
+ case EvaluationOperator.SET_CONTAINS_ANY:
606
+ return containsNone;
607
+ case EvaluationOperator.IS_NOT:
608
+ case EvaluationOperator.DOES_NOT_CONTAIN:
609
+ case EvaluationOperator.SET_DOES_NOT_CONTAIN:
610
+ case EvaluationOperator.SET_DOES_NOT_CONTAIN_ANY:
611
+ return !containsNone;
612
+ default:
613
+ return false;
614
+ }
615
+ };
616
+ EvaluationEngine2.prototype.matchSet = function(propValues, op, filterValues) {
617
+ switch (op) {
618
+ case EvaluationOperator.SET_IS:
619
+ return this.setEquals(propValues, filterValues);
620
+ case EvaluationOperator.SET_IS_NOT:
621
+ return !this.setEquals(propValues, filterValues);
622
+ case EvaluationOperator.SET_CONTAINS:
623
+ return this.matchesSetContainsAll(propValues, filterValues);
624
+ case EvaluationOperator.SET_DOES_NOT_CONTAIN:
625
+ return !this.matchesSetContainsAll(propValues, filterValues);
626
+ case EvaluationOperator.SET_CONTAINS_ANY:
627
+ return this.matchesSetContainsAny(propValues, filterValues);
628
+ case EvaluationOperator.SET_DOES_NOT_CONTAIN_ANY:
629
+ return !this.matchesSetContainsAny(propValues, filterValues);
630
+ default:
631
+ return false;
632
+ }
633
+ };
634
+ EvaluationEngine2.prototype.matchString = function(propValue, op, filterValues) {
635
+ var _this = this;
636
+ switch (op) {
637
+ case EvaluationOperator.IS:
638
+ return this.matchesIs(propValue, filterValues);
639
+ case EvaluationOperator.IS_NOT:
640
+ return !this.matchesIs(propValue, filterValues);
641
+ case EvaluationOperator.CONTAINS:
642
+ return this.matchesContains(propValue, filterValues);
643
+ case EvaluationOperator.DOES_NOT_CONTAIN:
644
+ return !this.matchesContains(propValue, filterValues);
645
+ case EvaluationOperator.LESS_THAN:
646
+ case EvaluationOperator.LESS_THAN_EQUALS:
647
+ case EvaluationOperator.GREATER_THAN:
648
+ case EvaluationOperator.GREATER_THAN_EQUALS:
649
+ return this.matchesComparable(propValue, op, filterValues, function(value) {
650
+ return _this.parseNumber(value);
651
+ }, this.comparator);
652
+ case EvaluationOperator.VERSION_LESS_THAN:
653
+ case EvaluationOperator.VERSION_LESS_THAN_EQUALS:
654
+ case EvaluationOperator.VERSION_GREATER_THAN:
655
+ case EvaluationOperator.VERSION_GREATER_THAN_EQUALS:
656
+ return this.matchesComparable(propValue, op, filterValues, function(value) {
657
+ return SemanticVersion.parse(value);
658
+ }, this.versionComparator);
659
+ case EvaluationOperator.REGEX_MATCH:
660
+ return this.matchesRegex(propValue, filterValues);
661
+ case EvaluationOperator.REGEX_DOES_NOT_MATCH:
662
+ return !this.matchesRegex(propValue, filterValues);
663
+ default:
664
+ return false;
665
+ }
666
+ };
667
+ EvaluationEngine2.prototype.matchesIs = function(propValue, filterValues) {
668
+ if (this.containsBooleans(filterValues)) {
669
+ var lower_1 = propValue.toLowerCase();
670
+ if (lower_1 === "true" || lower_1 === "false") {
671
+ return filterValues.some(function(value) {
672
+ return value.toLowerCase() === lower_1;
673
+ });
674
+ }
675
+ }
676
+ return filterValues.some(function(value) {
677
+ return propValue === value;
678
+ });
679
+ };
680
+ EvaluationEngine2.prototype.matchesContains = function(propValue, filterValues) {
681
+ var e_7, _a;
682
+ try {
683
+ for (var filterValues_1 = __values(filterValues), filterValues_1_1 = filterValues_1.next(); !filterValues_1_1.done; filterValues_1_1 = filterValues_1.next()) {
684
+ var filterValue = filterValues_1_1.value;
685
+ if (propValue.toLowerCase().includes(filterValue.toLowerCase())) {
686
+ return true;
687
+ }
688
+ }
689
+ } catch (e_7_1) {
690
+ e_7 = { error: e_7_1 };
691
+ } finally {
692
+ try {
693
+ if (filterValues_1_1 && !filterValues_1_1.done && (_a = filterValues_1.return)) _a.call(filterValues_1);
694
+ } finally {
695
+ if (e_7) throw e_7.error;
696
+ }
697
+ }
698
+ return false;
699
+ };
700
+ EvaluationEngine2.prototype.matchesComparable = function(propValue, op, filterValues, typeTransformer, typeComparator) {
701
+ var _this = this;
702
+ var propValueTransformed = typeTransformer(propValue);
703
+ var filterValuesTransformed = filterValues.map(function(filterValue) {
704
+ return typeTransformer(filterValue);
705
+ }).filter(function(filterValue) {
706
+ return filterValue !== void 0;
707
+ });
708
+ if (propValueTransformed === void 0 || filterValuesTransformed.length === 0) {
709
+ return filterValues.some(function(filterValue) {
710
+ return _this.comparator(propValue, op, filterValue);
711
+ });
712
+ } else {
713
+ return filterValuesTransformed.some(function(filterValueTransformed) {
714
+ return typeComparator(propValueTransformed, op, filterValueTransformed);
715
+ });
716
+ }
717
+ };
718
+ EvaluationEngine2.prototype.comparator = function(propValue, op, filterValue) {
719
+ switch (op) {
720
+ case EvaluationOperator.LESS_THAN:
721
+ case EvaluationOperator.VERSION_LESS_THAN:
722
+ return propValue < filterValue;
723
+ case EvaluationOperator.LESS_THAN_EQUALS:
724
+ case EvaluationOperator.VERSION_LESS_THAN_EQUALS:
725
+ return propValue <= filterValue;
726
+ case EvaluationOperator.GREATER_THAN:
727
+ case EvaluationOperator.VERSION_GREATER_THAN:
728
+ return propValue > filterValue;
729
+ case EvaluationOperator.GREATER_THAN_EQUALS:
730
+ case EvaluationOperator.VERSION_GREATER_THAN_EQUALS:
731
+ return propValue >= filterValue;
732
+ default:
733
+ return false;
734
+ }
735
+ };
736
+ EvaluationEngine2.prototype.versionComparator = function(propValue, op, filterValue) {
737
+ var compareTo = propValue.compareTo(filterValue);
738
+ switch (op) {
739
+ case EvaluationOperator.LESS_THAN:
740
+ case EvaluationOperator.VERSION_LESS_THAN:
741
+ return compareTo < 0;
742
+ case EvaluationOperator.LESS_THAN_EQUALS:
743
+ case EvaluationOperator.VERSION_LESS_THAN_EQUALS:
744
+ return compareTo <= 0;
745
+ case EvaluationOperator.GREATER_THAN:
746
+ case EvaluationOperator.VERSION_GREATER_THAN:
747
+ return compareTo > 0;
748
+ case EvaluationOperator.GREATER_THAN_EQUALS:
749
+ case EvaluationOperator.VERSION_GREATER_THAN_EQUALS:
750
+ return compareTo >= 0;
751
+ default:
752
+ return false;
753
+ }
754
+ };
755
+ EvaluationEngine2.prototype.matchesRegex = function(propValue, filterValues) {
756
+ return filterValues.some(function(filterValue) {
757
+ return Boolean(new RegExp(filterValue).exec(propValue));
758
+ });
759
+ };
760
+ EvaluationEngine2.prototype.containsNone = function(filterValues) {
761
+ return filterValues.some(function(filterValue) {
762
+ return filterValue === "(none)";
763
+ });
764
+ };
765
+ EvaluationEngine2.prototype.containsBooleans = function(filterValues) {
766
+ return filterValues.some(function(filterValue) {
767
+ switch (filterValue.toLowerCase()) {
768
+ case "true":
769
+ case "false":
770
+ return true;
771
+ default:
772
+ return false;
773
+ }
774
+ });
775
+ };
776
+ EvaluationEngine2.prototype.parseNumber = function(value) {
777
+ var _a;
778
+ return (_a = Number(value)) !== null && _a !== void 0 ? _a : void 0;
779
+ };
780
+ EvaluationEngine2.prototype.coerceString = function(value) {
781
+ if (!value) {
782
+ return void 0;
783
+ }
784
+ if (typeof value === "object") {
785
+ return JSON.stringify(value);
786
+ }
787
+ return String(value);
788
+ };
789
+ EvaluationEngine2.prototype.coerceStringArray = function(value) {
790
+ var _this = this;
791
+ if (Array.isArray(value)) {
792
+ var anyArray = value;
793
+ return anyArray.map(function(e) {
794
+ return _this.coerceString(e);
795
+ }).filter(Boolean);
796
+ }
797
+ var stringValue = String(value);
798
+ try {
799
+ var parsedValue = JSON.parse(stringValue);
800
+ if (Array.isArray(parsedValue)) {
801
+ var anyArray = value;
802
+ return anyArray.map(function(e) {
803
+ return _this.coerceString(e);
804
+ }).filter(Boolean);
805
+ } else {
806
+ return void 0;
807
+ }
808
+ } catch (_a) {
809
+ return void 0;
810
+ }
811
+ };
812
+ EvaluationEngine2.prototype.isSetOperator = function(op) {
813
+ switch (op) {
814
+ case EvaluationOperator.SET_IS:
815
+ case EvaluationOperator.SET_IS_NOT:
816
+ case EvaluationOperator.SET_CONTAINS:
817
+ case EvaluationOperator.SET_DOES_NOT_CONTAIN:
818
+ case EvaluationOperator.SET_CONTAINS_ANY:
819
+ case EvaluationOperator.SET_DOES_NOT_CONTAIN_ANY:
820
+ return true;
821
+ default:
822
+ return false;
823
+ }
824
+ };
825
+ EvaluationEngine2.prototype.setEquals = function(xa, ya) {
826
+ var xs = new Set(xa);
827
+ var ys = new Set(ya);
828
+ return xs.size === ys.size && __spreadArray([], __read(ys), false).every(function(y) {
829
+ return xs.has(y);
830
+ });
831
+ };
832
+ EvaluationEngine2.prototype.matchesSetContainsAll = function(propValues, filterValues) {
833
+ var e_8, _a;
834
+ if (propValues.length < filterValues.length) {
835
+ return false;
836
+ }
837
+ try {
838
+ for (var filterValues_2 = __values(filterValues), filterValues_2_1 = filterValues_2.next(); !filterValues_2_1.done; filterValues_2_1 = filterValues_2.next()) {
839
+ var filterValue = filterValues_2_1.value;
840
+ if (!this.matchesIs(filterValue, propValues)) {
841
+ return false;
842
+ }
843
+ }
844
+ } catch (e_8_1) {
845
+ e_8 = { error: e_8_1 };
846
+ } finally {
847
+ try {
848
+ if (filterValues_2_1 && !filterValues_2_1.done && (_a = filterValues_2.return)) _a.call(filterValues_2);
849
+ } finally {
850
+ if (e_8) throw e_8.error;
851
+ }
852
+ }
853
+ return true;
854
+ };
855
+ EvaluationEngine2.prototype.matchesSetContainsAny = function(propValues, filterValues) {
856
+ var e_9, _a;
857
+ try {
858
+ for (var filterValues_3 = __values(filterValues), filterValues_3_1 = filterValues_3.next(); !filterValues_3_1.done; filterValues_3_1 = filterValues_3.next()) {
859
+ var filterValue = filterValues_3_1.value;
860
+ if (this.matchesIs(filterValue, propValues)) {
861
+ return true;
862
+ }
863
+ }
864
+ } catch (e_9_1) {
865
+ e_9 = { error: e_9_1 };
866
+ } finally {
867
+ try {
868
+ if (filterValues_3_1 && !filterValues_3_1.done && (_a = filterValues_3.return)) _a.call(filterValues_3);
869
+ } finally {
870
+ if (e_9) throw e_9.error;
871
+ }
872
+ }
873
+ return false;
874
+ };
875
+ return EvaluationEngine2;
876
+ }()
877
+ );
878
+ var topologicalSort = function(flags, flagKeys) {
879
+ var e_1, _a;
880
+ var available = __assign({}, flags);
881
+ var result = [];
882
+ var startingKeys = flagKeys || Object.keys(available);
883
+ try {
884
+ for (var startingKeys_1 = __values(startingKeys), startingKeys_1_1 = startingKeys_1.next(); !startingKeys_1_1.done; startingKeys_1_1 = startingKeys_1.next()) {
885
+ var flagKey = startingKeys_1_1.value;
886
+ var traversal = parentTraversal(flagKey, available);
887
+ if (traversal) {
888
+ result.push.apply(result, __spreadArray([], __read(traversal), false));
889
+ }
890
+ }
891
+ } catch (e_1_1) {
892
+ e_1 = { error: e_1_1 };
893
+ } finally {
894
+ try {
895
+ if (startingKeys_1_1 && !startingKeys_1_1.done && (_a = startingKeys_1.return)) _a.call(startingKeys_1);
896
+ } finally {
897
+ if (e_1) throw e_1.error;
898
+ }
899
+ }
900
+ return result;
901
+ };
902
+ var parentTraversal = function(flagKey, available, path) {
903
+ var e_2, _a;
904
+ if (path === void 0) {
905
+ path = [];
906
+ }
907
+ var flag = available[flagKey];
908
+ if (!flag) {
909
+ return void 0;
910
+ } else if (!flag.dependencies || flag.dependencies.length === 0) {
911
+ delete available[flag.key];
912
+ return [flag];
913
+ }
914
+ path.push(flag.key);
915
+ var result = [];
916
+ var _loop_1 = function(parentKey2) {
917
+ if (path.some(function(p) {
918
+ return p === parentKey2;
919
+ })) {
920
+ throw Error("Detected a cycle between flags ".concat(path));
921
+ }
922
+ var traversal = parentTraversal(parentKey2, available, path);
923
+ if (traversal) {
924
+ result.push.apply(result, __spreadArray([], __read(traversal), false));
925
+ }
926
+ };
927
+ try {
928
+ for (var _b = __values(flag.dependencies), _c = _b.next(); !_c.done; _c = _b.next()) {
929
+ var parentKey = _c.value;
930
+ _loop_1(parentKey);
931
+ }
932
+ } catch (e_2_1) {
933
+ e_2 = { error: e_2_1 };
934
+ } finally {
935
+ try {
936
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
937
+ } finally {
938
+ if (e_2) throw e_2.error;
939
+ }
940
+ }
941
+ result.push(flag);
942
+ path.pop();
943
+ delete available[flag.key];
944
+ return result;
945
+ };
946
+ const version = "3.7.5";
947
+ const VERSION = version;
948
+ const _hasatob = typeof atob === "function";
949
+ const _hasbtoa = typeof btoa === "function";
950
+ const _hasBuffer = typeof Buffer === "function";
951
+ const _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
952
+ const _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
953
+ const b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
954
+ const b64chs = Array.prototype.slice.call(b64ch);
955
+ const b64tab = ((a) => {
956
+ let tab = {};
957
+ a.forEach((c, i) => tab[c] = i);
958
+ return tab;
959
+ })(b64chs);
960
+ const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
961
+ const _fromCC = String.fromCharCode.bind(String);
962
+ const _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
963
+ const _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
964
+ const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
965
+ const btoaPolyfill = (bin) => {
966
+ let u32, c0, c1, c2, asc = "";
967
+ const pad = bin.length % 3;
968
+ for (let i = 0; i < bin.length; ) {
969
+ if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255) throw new TypeError("invalid character found");
970
+ u32 = c0 << 16 | c1 << 8 | c2;
971
+ asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
972
+ }
973
+ return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
974
+ };
975
+ const _btoa = _hasbtoa ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
976
+ const _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
977
+ const maxargs = 4096;
978
+ let strs = [];
979
+ for (let i = 0, l = u8a.length; i < l; i += maxargs) {
980
+ strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
981
+ }
982
+ return _btoa(strs.join(""));
983
+ };
984
+ const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
985
+ const cb_utob = (c) => {
986
+ if (c.length < 2) {
987
+ var cc = c.charCodeAt(0);
988
+ return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
989
+ } else {
990
+ var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
991
+ return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
992
+ }
993
+ };
994
+ const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
995
+ const utob = (u) => u.replace(re_utob, cb_utob);
996
+ const _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
997
+ const encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
998
+ const encodeURI = (src) => encode(src, true);
999
+ const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
1000
+ const cb_btou = (cccc) => {
1001
+ switch (cccc.length) {
1002
+ case 4:
1003
+ var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
1004
+ return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
1005
+ case 3:
1006
+ return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
1007
+ default:
1008
+ return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
1009
+ }
1010
+ };
1011
+ const btou = (b) => b.replace(re_btou, cb_btou);
1012
+ const atobPolyfill = (asc) => {
1013
+ asc = asc.replace(/\s+/g, "");
1014
+ if (!b64re.test(asc)) throw new TypeError("malformed base64.");
1015
+ asc += "==".slice(2 - (asc.length & 3));
1016
+ let u24, bin = "", r1, r2;
1017
+ for (let i = 0; i < asc.length; ) {
1018
+ u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
1019
+ bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
1020
+ }
1021
+ return bin;
1022
+ };
1023
+ const _atob = _hasatob ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
1024
+ const _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
1025
+ const toUint8Array = (a) => _toUint8Array(_unURI(a));
1026
+ const _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
1027
+ const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
1028
+ const decode = (src) => _decode(_unURI(src));
1029
+ const isValid = (src) => {
1030
+ if (typeof src !== "string") return false;
1031
+ const s = src.replace(/\s+/g, "").replace(/={0,2}$/, "");
1032
+ return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
1033
+ };
1034
+ const _noEnum = (v) => {
1035
+ return {
1036
+ value: v,
1037
+ enumerable: false,
1038
+ writable: true,
1039
+ configurable: true
1040
+ };
1041
+ };
1042
+ const extendString = function() {
1043
+ const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
1044
+ _add("fromBase64", function() {
1045
+ return decode(this);
1046
+ });
1047
+ _add("toBase64", function(urlsafe) {
1048
+ return encode(this, urlsafe);
1049
+ });
1050
+ _add("toBase64URI", function() {
1051
+ return encode(this, true);
1052
+ });
1053
+ _add("toBase64URL", function() {
1054
+ return encode(this, true);
1055
+ });
1056
+ _add("toUint8Array", function() {
1057
+ return toUint8Array(this);
1058
+ });
1059
+ };
1060
+ const extendUint8Array = function() {
1061
+ const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
1062
+ _add("toBase64", function(urlsafe) {
1063
+ return fromUint8Array(this, urlsafe);
1064
+ });
1065
+ _add("toBase64URI", function() {
1066
+ return fromUint8Array(this, true);
1067
+ });
1068
+ _add("toBase64URL", function() {
1069
+ return fromUint8Array(this, true);
1070
+ });
1071
+ };
1072
+ const extendBuiltins = () => {
1073
+ extendString();
1074
+ extendUint8Array();
1075
+ };
1076
+ const gBase64 = {
1077
+ version,
1078
+ VERSION,
1079
+ atob: _atob,
1080
+ atobPolyfill,
1081
+ btoa: _btoa,
1082
+ btoaPolyfill,
1083
+ fromBase64: decode,
1084
+ toBase64: encode,
1085
+ encode,
1086
+ encodeURI,
1087
+ encodeURL: encodeURI,
1088
+ utob,
1089
+ btou,
1090
+ decode,
1091
+ isValid,
1092
+ fromUint8Array,
1093
+ toUint8Array,
1094
+ extendString,
1095
+ extendUint8Array,
1096
+ extendBuiltins
1097
+ };
1098
+ var FetchError = (
1099
+ /** @class */
1100
+ function(_super) {
1101
+ __extends(FetchError2, _super);
1102
+ function FetchError2(statusCode, message) {
1103
+ var _this = _super.call(this, message) || this;
1104
+ _this.statusCode = statusCode;
1105
+ Object.setPrototypeOf(_this, FetchError2.prototype);
1106
+ return _this;
1107
+ }
1108
+ return FetchError2;
1109
+ }(Error)
1110
+ );
1111
+ var SdkEvaluationApi = (
1112
+ /** @class */
1113
+ function() {
1114
+ function SdkEvaluationApi2(deploymentKey, serverUrl, httpClient) {
1115
+ this.deploymentKey = deploymentKey;
1116
+ this.serverUrl = serverUrl;
1117
+ this.httpClient = httpClient;
1118
+ }
1119
+ SdkEvaluationApi2.prototype.getVariants = function(user, options) {
1120
+ return __awaiter(this, void 0, void 0, function() {
1121
+ var userJsonBase64, headers, response;
1122
+ return __generator(this, function(_a) {
1123
+ switch (_a.label) {
1124
+ case 0:
1125
+ userJsonBase64 = gBase64.encodeURL(JSON.stringify(user));
1126
+ headers = {
1127
+ Authorization: "Api-Key ".concat(this.deploymentKey),
1128
+ "X-Amp-Exp-User": userJsonBase64
1129
+ };
1130
+ if (options === null || options === void 0 ? void 0 : options.flagKeys) {
1131
+ headers["X-Amp-Exp-Flag-Keys"] = gBase64.encodeURL(JSON.stringify(options.flagKeys));
1132
+ }
1133
+ if (options === null || options === void 0 ? void 0 : options.trackingOption) {
1134
+ headers["X-Amp-Exp-Track"] = options.trackingOption;
1135
+ }
1136
+ return [4, this.httpClient.request({
1137
+ requestUrl: "".concat(this.serverUrl, "/sdk/v2/vardata?v=0"),
1138
+ method: "GET",
1139
+ headers,
1140
+ timeoutMillis: options === null || options === void 0 ? void 0 : options.timeoutMillis
1141
+ })];
1142
+ case 1:
1143
+ response = _a.sent();
1144
+ if (response.status != 200) {
1145
+ throw new FetchError(response.status, "Fetch error response: status=".concat(response.status));
1146
+ }
1147
+ return [2, JSON.parse(response.body)];
1148
+ }
1149
+ });
1150
+ });
1151
+ };
1152
+ return SdkEvaluationApi2;
1153
+ }()
1154
+ );
1155
+ var SdkFlagApi = (
1156
+ /** @class */
1157
+ function() {
1158
+ function SdkFlagApi2(deploymentKey, serverUrl, httpClient) {
1159
+ this.deploymentKey = deploymentKey;
1160
+ this.serverUrl = serverUrl;
1161
+ this.httpClient = httpClient;
1162
+ }
1163
+ SdkFlagApi2.prototype.getFlags = function(options) {
1164
+ return __awaiter(this, void 0, void 0, function() {
1165
+ var headers, response, flagsArray;
1166
+ return __generator(this, function(_a) {
1167
+ switch (_a.label) {
1168
+ case 0:
1169
+ headers = {
1170
+ Authorization: "Api-Key ".concat(this.deploymentKey)
1171
+ };
1172
+ if ((options === null || options === void 0 ? void 0 : options.libraryName) && (options === null || options === void 0 ? void 0 : options.libraryVersion)) {
1173
+ headers["X-Amp-Exp-Library"] = "".concat(options.libraryName, "/").concat(options.libraryVersion);
1174
+ }
1175
+ return [4, this.httpClient.request({
1176
+ requestUrl: "".concat(this.serverUrl, "/sdk/v2/flags"),
1177
+ method: "GET",
1178
+ headers,
1179
+ timeoutMillis: options === null || options === void 0 ? void 0 : options.timeoutMillis
1180
+ })];
1181
+ case 1:
1182
+ response = _a.sent();
1183
+ if (response.status != 200) {
1184
+ throw Error("Flags error response: status=".concat(response.status));
1185
+ }
1186
+ flagsArray = JSON.parse(response.body);
1187
+ return [2, flagsArray.reduce(function(map, flag) {
1188
+ map[flag.key] = flag;
1189
+ return map;
1190
+ }, {})];
1191
+ }
1192
+ });
1193
+ });
1194
+ };
1195
+ return SdkFlagApi2;
1196
+ }()
1197
+ );
1198
+ var safeGlobal = typeof globalThis !== "undefined" ? globalThis : global || self;
1199
+ var Poller = (
1200
+ /** @class */
1201
+ function() {
1202
+ function Poller2(action, ms) {
1203
+ this.poller = void 0;
1204
+ this.action = action;
1205
+ this.ms = ms;
1206
+ }
1207
+ Poller2.prototype.start = function() {
1208
+ if (this.poller) {
1209
+ return;
1210
+ }
1211
+ this.poller = safeGlobal.setInterval(this.action, this.ms);
1212
+ void this.action();
1213
+ };
1214
+ Poller2.prototype.stop = function() {
1215
+ if (!this.poller) {
1216
+ return;
1217
+ }
1218
+ safeGlobal.clearInterval(this.poller);
1219
+ this.poller = void 0;
1220
+ };
1221
+ return Poller2;
1222
+ }()
1223
+ );
1224
+ export {
1225
+ EvaluationEngine,
1226
+ EvaluationOperator,
1227
+ FetchError,
1228
+ Poller,
1229
+ SdkEvaluationApi,
1230
+ SdkFlagApi,
1231
+ safeGlobal,
1232
+ topologicalSort
1233
+ };
1234
+ //# sourceMappingURL=experiment-core.esm.js.map