@voiceflow/common 8.2.8 → 8.3.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 (206) hide show
  1. package/build/cjs/constants/environment.js +1 -1
  2. package/build/cjs/constants/regexp.d.ts +5 -5
  3. package/build/cjs/constants/regexp.d.ts.map +1 -1
  4. package/build/cjs/crypto/base64.js +4 -4
  5. package/build/cjs/crypto/hex2abc.d.ts.map +1 -1
  6. package/build/cjs/crypto/synchronous.d.ts +1 -1
  7. package/build/cjs/crypto/synchronous.d.ts.map +1 -1
  8. package/build/cjs/crypto/synchronous.js +2 -2
  9. package/build/cjs/types.d.ts +26 -26
  10. package/build/cjs/types.d.ts.map +1 -1
  11. package/build/cjs/utils/array.d.ts +3 -3
  12. package/build/cjs/utils/array.d.ts.map +1 -1
  13. package/build/cjs/utils/array.js +2 -3
  14. package/build/cjs/utils/emails.d.ts.map +1 -1
  15. package/build/cjs/utils/functional.d.ts +4 -4
  16. package/build/cjs/utils/functional.d.ts.map +1 -1
  17. package/build/cjs/utils/functional.js +0 -1
  18. package/build/cjs/utils/id.d.ts +1 -1
  19. package/build/cjs/utils/id.d.ts.map +1 -1
  20. package/build/cjs/utils/intent.d.ts +6 -6
  21. package/build/cjs/utils/intent.d.ts.map +1 -1
  22. package/build/cjs/utils/intent.js +5 -3
  23. package/build/cjs/utils/mathjs.js +1 -1
  24. package/build/cjs/utils/normalized.d.ts +5 -5
  25. package/build/cjs/utils/normalized.d.ts.map +1 -1
  26. package/build/cjs/utils/number.d.ts.map +1 -1
  27. package/build/cjs/utils/number.js +2 -2
  28. package/build/cjs/utils/object/common.d.ts +1 -1
  29. package/build/cjs/utils/object/common.d.ts.map +1 -1
  30. package/build/cjs/utils/object/common.js +2 -2
  31. package/build/cjs/utils/object/deepMap.d.ts +1 -1
  32. package/build/cjs/utils/object/deepMap.d.ts.map +1 -1
  33. package/build/cjs/utils/object/deepMap.js +0 -2
  34. package/build/cjs/utils/object/diff.d.ts +1 -1
  35. package/build/cjs/utils/object/diff.d.ts.map +1 -1
  36. package/build/cjs/utils/object/diff.js +2 -2
  37. package/build/cjs/utils/object/keys.d.ts +2 -1
  38. package/build/cjs/utils/object/keys.d.ts.map +1 -1
  39. package/build/cjs/utils/promise.d.ts.map +1 -1
  40. package/build/cjs/utils/protocol.d.ts +2 -2
  41. package/build/cjs/utils/protocol.d.ts.map +1 -1
  42. package/build/cjs/utils/slot.d.ts.map +1 -1
  43. package/build/cjs/utils/slot.js +2 -2
  44. package/build/cjs/utils/time.js +14 -14
  45. package/build/cjs/utils/typeguard.d.ts +2 -2
  46. package/build/cjs/utils/typeguard.d.ts.map +1 -1
  47. package/build/cjs/utils/variables.d.ts +2 -2
  48. package/build/cjs/utils/variables.d.ts.map +1 -1
  49. package/build/esm/constants/regexp.d.ts +5 -5
  50. package/build/esm/constants/regexp.d.ts.map +1 -1
  51. package/build/esm/crypto/base64.js +2 -2
  52. package/build/esm/crypto/hex2abc.d.ts.map +1 -1
  53. package/build/esm/crypto/synchronous.d.ts +1 -1
  54. package/build/esm/crypto/synchronous.d.ts.map +1 -1
  55. package/build/esm/crypto/synchronous.js +1 -1
  56. package/build/esm/types.d.ts +26 -26
  57. package/build/esm/types.d.ts.map +1 -1
  58. package/build/esm/utils/array.d.ts +3 -3
  59. package/build/esm/utils/array.d.ts.map +1 -1
  60. package/build/esm/utils/array.js +2 -3
  61. package/build/esm/utils/emails.d.ts.map +1 -1
  62. package/build/esm/utils/functional.d.ts +4 -4
  63. package/build/esm/utils/functional.d.ts.map +1 -1
  64. package/build/esm/utils/functional.js +0 -1
  65. package/build/esm/utils/id.d.ts +1 -1
  66. package/build/esm/utils/id.d.ts.map +1 -1
  67. package/build/esm/utils/intent.d.ts +6 -6
  68. package/build/esm/utils/intent.d.ts.map +1 -1
  69. package/build/esm/utils/intent.js +5 -3
  70. package/build/esm/utils/mathjs.js +1 -1
  71. package/build/esm/utils/normalized.d.ts +5 -5
  72. package/build/esm/utils/normalized.d.ts.map +1 -1
  73. package/build/esm/utils/number.d.ts.map +1 -1
  74. package/build/esm/utils/number.js +1 -1
  75. package/build/esm/utils/object/common.d.ts +1 -1
  76. package/build/esm/utils/object/common.d.ts.map +1 -1
  77. package/build/esm/utils/object/common.js +1 -1
  78. package/build/esm/utils/object/deepMap.d.ts +1 -1
  79. package/build/esm/utils/object/deepMap.d.ts.map +1 -1
  80. package/build/esm/utils/object/deepMap.js +0 -2
  81. package/build/esm/utils/object/diff.d.ts +1 -1
  82. package/build/esm/utils/object/diff.d.ts.map +1 -1
  83. package/build/esm/utils/object/diff.js +1 -1
  84. package/build/esm/utils/object/keys.d.ts +2 -1
  85. package/build/esm/utils/object/keys.d.ts.map +1 -1
  86. package/build/esm/utils/promise.d.ts.map +1 -1
  87. package/build/esm/utils/protocol.d.ts +2 -2
  88. package/build/esm/utils/protocol.d.ts.map +1 -1
  89. package/build/esm/utils/slot.d.ts.map +1 -1
  90. package/build/esm/utils/slot.js +1 -1
  91. package/build/esm/utils/time.js +7 -7
  92. package/build/esm/utils/typeguard.d.ts +2 -2
  93. package/build/esm/utils/typeguard.d.ts.map +1 -1
  94. package/build/esm/utils/variables.d.ts +2 -2
  95. package/build/esm/utils/variables.d.ts.map +1 -1
  96. package/package.json +46 -48
  97. package/build/cjs/crypto/hex2abc.test.d.ts +0 -2
  98. package/build/cjs/crypto/hex2abc.test.d.ts.map +0 -1
  99. package/build/cjs/crypto/hex2abc.test.js +0 -12
  100. package/build/cjs/crypto/murmurhash.test.d.ts +0 -2
  101. package/build/cjs/crypto/murmurhash.test.d.ts.map +0 -1
  102. package/build/cjs/crypto/murmurhash.test.js +0 -23
  103. package/build/cjs/utils/__fixtures__/name.json +0 -64
  104. package/build/cjs/utils/array.test.d.ts +0 -2
  105. package/build/cjs/utils/array.test.d.ts.map +0 -1
  106. package/build/cjs/utils/array.test.js +0 -237
  107. package/build/cjs/utils/email.test.d.ts +0 -2
  108. package/build/cjs/utils/email.test.d.ts.map +0 -1
  109. package/build/cjs/utils/email.test.js +0 -22
  110. package/build/cjs/utils/functional.test.d.ts +0 -2
  111. package/build/cjs/utils/functional.test.d.ts.map +0 -1
  112. package/build/cjs/utils/functional.test.js +0 -139
  113. package/build/cjs/utils/id.test.d.ts +0 -2
  114. package/build/cjs/utils/id.test.d.ts.map +0 -1
  115. package/build/cjs/utils/id.test.js +0 -66
  116. package/build/cjs/utils/intent.test.d.ts +0 -2
  117. package/build/cjs/utils/intent.test.d.ts.map +0 -1
  118. package/build/cjs/utils/intent.test.js +0 -100
  119. package/build/cjs/utils/map.test.d.ts +0 -2
  120. package/build/cjs/utils/map.test.d.ts.map +0 -1
  121. package/build/cjs/utils/map.test.js +0 -22
  122. package/build/cjs/utils/object/common.test.d.ts +0 -2
  123. package/build/cjs/utils/object/common.test.d.ts.map +0 -1
  124. package/build/cjs/utils/object/common.test.js +0 -175
  125. package/build/cjs/utils/object/deepMap.test.d.ts +0 -2
  126. package/build/cjs/utils/object/deepMap.test.d.ts.map +0 -1
  127. package/build/cjs/utils/object/deepMap.test.js +0 -114
  128. package/build/cjs/utils/object/diff.test.d.ts +0 -2
  129. package/build/cjs/utils/object/diff.test.d.ts.map +0 -1
  130. package/build/cjs/utils/object/diff.test.js +0 -19
  131. package/build/cjs/utils/object/keys.test.d.ts +0 -2
  132. package/build/cjs/utils/object/keys.test.d.ts.map +0 -1
  133. package/build/cjs/utils/object/keys.test.js +0 -15
  134. package/build/cjs/utils/promise.test.d.ts +0 -2
  135. package/build/cjs/utils/promise.test.d.ts.map +0 -1
  136. package/build/cjs/utils/promise.test.js +0 -25
  137. package/build/cjs/utils/protocol.test.d.ts +0 -2
  138. package/build/cjs/utils/protocol.test.d.ts.map +0 -1
  139. package/build/cjs/utils/protocol.test.js +0 -40
  140. package/build/cjs/utils/slot.test.d.ts +0 -2
  141. package/build/cjs/utils/slot.test.d.ts.map +0 -1
  142. package/build/cjs/utils/slot.test.js +0 -38
  143. package/build/cjs/utils/string.test.d.ts +0 -2
  144. package/build/cjs/utils/string.test.d.ts.map +0 -1
  145. package/build/cjs/utils/string.test.js +0 -53
  146. package/build/cjs/utils/timezones.test.d.ts +0 -2
  147. package/build/cjs/utils/timezones.test.d.ts.map +0 -1
  148. package/build/cjs/utils/timezones.test.js +0 -12
  149. package/build/cjs/utils/typeguard.test.d.ts +0 -2
  150. package/build/cjs/utils/typeguard.test.d.ts.map +0 -1
  151. package/build/cjs/utils/typeguard.test.js +0 -55
  152. package/build/esm/crypto/hex2abc.test.d.ts +0 -2
  153. package/build/esm/crypto/hex2abc.test.d.ts.map +0 -1
  154. package/build/esm/crypto/hex2abc.test.js +0 -10
  155. package/build/esm/crypto/murmurhash.test.d.ts +0 -2
  156. package/build/esm/crypto/murmurhash.test.d.ts.map +0 -1
  157. package/build/esm/crypto/murmurhash.test.js +0 -21
  158. package/build/esm/utils/__fixtures__/name.json +0 -64
  159. package/build/esm/utils/array.test.d.ts +0 -2
  160. package/build/esm/utils/array.test.d.ts.map +0 -1
  161. package/build/esm/utils/array.test.js +0 -235
  162. package/build/esm/utils/email.test.d.ts +0 -2
  163. package/build/esm/utils/email.test.d.ts.map +0 -1
  164. package/build/esm/utils/email.test.js +0 -20
  165. package/build/esm/utils/functional.test.d.ts +0 -2
  166. package/build/esm/utils/functional.test.d.ts.map +0 -1
  167. package/build/esm/utils/functional.test.js +0 -137
  168. package/build/esm/utils/id.test.d.ts +0 -2
  169. package/build/esm/utils/id.test.d.ts.map +0 -1
  170. package/build/esm/utils/id.test.js +0 -64
  171. package/build/esm/utils/intent.test.d.ts +0 -2
  172. package/build/esm/utils/intent.test.d.ts.map +0 -1
  173. package/build/esm/utils/intent.test.js +0 -75
  174. package/build/esm/utils/map.test.d.ts +0 -2
  175. package/build/esm/utils/map.test.d.ts.map +0 -1
  176. package/build/esm/utils/map.test.js +0 -20
  177. package/build/esm/utils/object/common.test.d.ts +0 -2
  178. package/build/esm/utils/object/common.test.d.ts.map +0 -1
  179. package/build/esm/utils/object/common.test.js +0 -173
  180. package/build/esm/utils/object/deepMap.test.d.ts +0 -2
  181. package/build/esm/utils/object/deepMap.test.d.ts.map +0 -1
  182. package/build/esm/utils/object/deepMap.test.js +0 -109
  183. package/build/esm/utils/object/diff.test.d.ts +0 -2
  184. package/build/esm/utils/object/diff.test.d.ts.map +0 -1
  185. package/build/esm/utils/object/diff.test.js +0 -17
  186. package/build/esm/utils/object/keys.test.d.ts +0 -2
  187. package/build/esm/utils/object/keys.test.d.ts.map +0 -1
  188. package/build/esm/utils/object/keys.test.js +0 -13
  189. package/build/esm/utils/promise.test.d.ts +0 -2
  190. package/build/esm/utils/promise.test.d.ts.map +0 -1
  191. package/build/esm/utils/promise.test.js +0 -23
  192. package/build/esm/utils/protocol.test.d.ts +0 -2
  193. package/build/esm/utils/protocol.test.d.ts.map +0 -1
  194. package/build/esm/utils/protocol.test.js +0 -38
  195. package/build/esm/utils/slot.test.d.ts +0 -2
  196. package/build/esm/utils/slot.test.d.ts.map +0 -1
  197. package/build/esm/utils/slot.test.js +0 -13
  198. package/build/esm/utils/string.test.d.ts +0 -2
  199. package/build/esm/utils/string.test.d.ts.map +0 -1
  200. package/build/esm/utils/string.test.js +0 -51
  201. package/build/esm/utils/timezones.test.d.ts +0 -2
  202. package/build/esm/utils/timezones.test.d.ts.map +0 -1
  203. package/build/esm/utils/timezones.test.js +0 -10
  204. package/build/esm/utils/typeguard.test.d.ts +0 -2
  205. package/build/esm/utils/typeguard.test.d.ts.map +0 -1
  206. package/build/esm/utils/typeguard.test.js +0 -53
@@ -1 +1 @@
1
- {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../src/utils/object/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK1C,eAAO,MAAM,eAAe,gFAFmB,OAAO,eAYrD,CAAC"}
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../src/utils/object/diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAK/C,eAAO,MAAM,eAAe,gCAAiC,CAAC,QAAQ,CAAC,sBAFtC,CAAC,SAAS,CAAC,KAAG,OAAO,KAE8C,QAAQ,CAAC,CAU5G,CAAC"}
@@ -1,4 +1,4 @@
1
- import _transform from 'lodash/transform';
1
+ import _transform from 'lodash/transform.js';
2
2
  const defaultCompare = (left, right) => left === right;
3
3
  export const getTopLevelDiff = (object, base, compare = defaultCompare) => {
4
4
  const changes = (object, base) => _transform(object, (result, value, key) => {
@@ -1,2 +1,3 @@
1
- export declare const getKeys: <T>(obj: T) => (keyof T)[];
1
+ import type { AnyRecord } from '../../types.js';
2
+ export declare const getKeys: <T extends AnyRecord>(obj: T) => (keyof T)[];
2
3
  //# sourceMappingURL=keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../../src/utils/object/keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,4BAA8D,CAAC"}
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../../src/utils/object/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,eAAO,MAAM,OAAO,6BAA8B,CAAC,KAAG,CAAC,MAAM,CAAC,CAAC,EAAqC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../src/utils/promise.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,yBAA0B,MAAM,0BAG9C,CAAC;AAEL,eAAO,MAAM,QAAQ,YAAa,MAAM,KAAG,QAAQ,KAAK,CAKpD,CAAC"}
1
+ {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../src/utils/promise.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,yBAA0B,MAAM,UAAS,CAAC,KAA0B,QAAQ,CAAC,CAG3F,CAAC;AAEL,eAAO,MAAM,QAAQ,YAAa,MAAM,KAAG,QAAQ,KAAK,CAKpD,CAAC"}
@@ -1,4 +1,4 @@
1
- import { AsyncActionCreators, Meta } from 'typescript-fsa';
1
+ import type { AsyncActionCreators, Meta } from 'typescript-fsa';
2
2
  export interface AsyncError<C extends number = never> {
3
3
  message: string;
4
4
  code?: C;
@@ -13,6 +13,6 @@ export declare class Channel<K extends string> {
13
13
  buildMatcher(): string;
14
14
  extend<L extends string>(variables: L[], build: (params: Record<L, string>) => string): Channel<K | L>;
15
15
  }
16
- export declare type ChannelParams<T extends Channel<string>> = T extends Channel<infer R> ? Record<R, string> : never;
16
+ export type ChannelParams<T extends Channel<string>> = T extends Channel<infer R> ? Record<R, string> : never;
17
17
  export declare const createChannel: <K extends string>(variables: K[], build: (params: Record<K, string>) => string) => Channel<K>;
18
18
  //# sourceMappingURL=protocol.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/utils/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,mBAAmB,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEjF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;AAED,eAAO,MAAM,YAAY,+CAAyB,CAAC;AAEnD,eAAO,MAAM,iBAAiB,iEAA2D,MAAM,eAAe,IAAI,iCAC5E,CAAC;AAEvC,eAAO,MAAM,WAAW,aACX,MAAM,EAAE,YACZ,MAAM,KAAG,MACY,CAAC;AAE/B,qBAAa,OAAO,CAAC,CAAC,SAAS,MAAM;IAChB,SAAS,EAAE,CAAC,EAAE;IAAS,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,MAAM;gBAAnE,SAAS,EAAE,CAAC,EAAE,EAAS,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,MAAM;IAEtF,YAAY;IAIZ,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,MAAM;CAGtF;AAED,oBAAY,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;AAE9G,eAAO,MAAM,aAAa,2EAA4E,MAAM,eAAkC,CAAC"}
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/utils/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGhE,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;AAED,eAAO,MAAM,YAAY,+CAAyB,CAAC;AAEnD,eAAO,MAAM,iBAAiB,iEACtB,MAAM,eACC,IAAI,KAChB,oBAAoB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAyC,CAAC;AAExE,eAAO,MAAM,WAAW,aACX,MAAM,EAAE,YACZ,MAAM,KAAG,MACY,CAAC;AAE/B,qBAAa,OAAO,CAAC,CAAC,SAAS,MAAM;IAE1B,SAAS,EAAE,CAAC,EAAE;IACd,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,MAAM;gBAD5C,SAAS,EAAE,CAAC,EAAE,EACd,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,MAAM;IAGrD,YAAY;IAMZ,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,MAAM;CAGtF;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;AAE9G,eAAO,MAAM,aAAa,gCAAiC,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,KAAK,MAAM,eAC7E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/utils/slot.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB;SAAqB,MAAM;YAAU,MAAM,EAAE;oCAAqC,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,QAStI,CAAC;AAEL,eAAO,MAAM,gBAAgB,UAAW,MAAM,aAAgE,CAAC;AAG/G,eAAO,MAAM,aAAa,YAAY,MAAM,EAAE,aAAyF,CAAC;AAExI;;GAEG;AACH,eAAO,MAAM,oBAAoB,UAAW,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAGrE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,UAAW,MAAM,qBAAqB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,MAAM,CAAA;CAAE,KAAK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,MAAM,CAAA;CAAE,WAKnI,CAAC"}
1
+ {"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/utils/slot.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB;SAAqB,MAAM;YAAU,MAAM,EAAE;aACjE,CAAC,EAAE,oBACK,OAAO,MAAM,EAAE,MAAM,EAAE,CAAC,KACzC,CAAC,EASA,CAAC;AAEL,eAAO,MAAM,gBAAgB,UAAW,MAAM,aAAgE,CAAC;AAG/G,eAAO,MAAM,aAAa,YAAY,MAAM,EAAE,aACmC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,oBAAoB,UAAW,MAAM,KAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAGrE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,UACtB,MAAM,cACD,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,WAMnF,CAAC"}
@@ -1,4 +1,4 @@
1
- import _uniqBy from 'lodash/uniqBy';
1
+ import _uniqBy from 'lodash/uniqBy.js';
2
2
  import { SLOT_REGEXP } from '../constants/index.js';
3
3
  export const addPrebuiltEntities = (entities, prebuiltEntities) => entities.map((entity) => {
4
4
  if (prebuiltEntities[entity.key]) {
@@ -1,11 +1,11 @@
1
1
  import dayjs from 'dayjs';
2
- import advancedFormat from 'dayjs/plugin/advancedFormat';
3
- import customParseFormat from 'dayjs/plugin/customParseFormat';
4
- import duration from 'dayjs/plugin/duration';
5
- import minMax from 'dayjs/plugin/minMax';
6
- import relativeTime from 'dayjs/plugin/relativeTime';
7
- import updateLocale from 'dayjs/plugin/updateLocale';
8
- import utc from 'dayjs/plugin/utc';
2
+ import advancedFormat from 'dayjs/plugin/advancedFormat.js';
3
+ import customParseFormat from 'dayjs/plugin/customParseFormat.js';
4
+ import duration from 'dayjs/plugin/duration.js';
5
+ import minMax from 'dayjs/plugin/minMax.js';
6
+ import relativeTime from 'dayjs/plugin/relativeTime.js';
7
+ import updateLocale from 'dayjs/plugin/updateLocale.js';
8
+ import utc from 'dayjs/plugin/utc.js';
9
9
  dayjs.extend(utc);
10
10
  dayjs.extend(duration);
11
11
  dayjs.extend(relativeTime);
@@ -1,7 +1,7 @@
1
- export declare const createTypeguardCreator: <T>() => <R extends T>(values: R | readonly R[] | R[]) => (value?: unknown) => value is R;
1
+ export declare const createTypeguardCreator: <T>() => <R extends T>(values: R | R[] | ReadonlyArray<R>) => (value?: unknown) => value is R;
2
2
  export declare const createTypedTypeguardCreator: <T extends {
3
3
  type: string;
4
4
  } = {
5
5
  type: string;
6
- }>() => <R extends T>(values: R["type"] | R["type"][]) => (value: T) => value is R;
6
+ }>() => <R extends T>(values: R['type'] | R['type'][]) => (value: T) => value is R;
7
7
  //# sourceMappingURL=typeguard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeguard.d.ts","sourceRoot":"","sources":["../../../src/utils/typeguard.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,qEAGxB,OAAO,eACqE,CAAC;AAExF,eAAO,MAAM,2BAA2B;UACnB,MAAM;;UAAa,MAAM;kFAGiC,CAAC"}
1
+ {"version":3,"file":"typeguard.d.ts","sourceRoot":"","sources":["../../../src/utils/typeguard.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,iCAEX,CAAC,GAAG,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,cACvC,OAAO,eACqE,CAAC;AAExF,eAAO,MAAM,2BAA2B;UACnB,MAAM;;UAAa,MAAM;8BACtB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,aACrC,CAAC,eACoE,CAAC"}
@@ -1,6 +1,6 @@
1
- export declare const variableReplacer: (match: string, inner: string, variables: Record<string, unknown>, modifier?: ((variable: unknown) => unknown) | undefined) => unknown;
1
+ export declare const variableReplacer: (match: string, inner: string, variables: Record<string, unknown>, modifier?: (variable: unknown) => unknown) => unknown;
2
2
  export declare const replaceVariables: (phrase: string | undefined | null, variables: Record<string, unknown>, modifier?: ((variable: unknown) => unknown) | undefined, { trim }?: {
3
- trim?: boolean | undefined;
3
+ trim?: boolean;
4
4
  }) => string;
5
5
  export declare const sanitizeVariables: (variables: Record<string, unknown>) => Record<string, unknown>;
6
6
  export declare const transformStringVariableToNumber: (str: string | number | null) => number | string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/utils/variables.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,UACpB,MAAM,SACN,MAAM,aACF,OAAO,MAAM,EAAE,OAAO,CAAC,yBACZ,OAAO,KAAK,OAAO,kBACxC,OAMF,CAAC;AAEF,eAAO,MAAM,gBAAgB,WACnB,MAAM,GAAG,SAAS,GAAG,IAAI,aACtB,OAAO,MAAM,EAAE,OAAO,CAAC,yBACZ,OAAO,KAAK,OAAO;;MAExC,MAMF,CAAC;AAGF,eAAO,MAAM,iBAAiB,cAAe,OAAO,MAAM,EAAE,OAAO,CAAC,KAAG,OAAO,MAAM,EAAE,OAAO,CASrF,CAAC;AAET,eAAO,MAAM,+BAA+B,QAAS,MAAM,GAAG,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,MAAM,GAAG,IAY/F,CAAC;AAEF,eAAO,MAAM,wBAAwB,gCAAiC,OAAO,MAAM,EAAE,OAAO,CAAC,MA2B5F,CAAC"}
1
+ {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../src/utils/variables.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,UACpB,MAAM,SACN,MAAM,aACF,OAAO,MAAM,EAAE,OAAO,CAAC,aACvB,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,KACxC,OAMF,CAAC;AAEF,eAAO,MAAM,gBAAgB,WACnB,MAAM,GAAG,SAAS,GAAG,IAAI,aACtB,OAAO,MAAM,EAAE,OAAO,CAAC,aACxB,CAAC,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,aACrC;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,KAClC,MAQF,CAAC;AAGF,eAAO,MAAM,iBAAiB,cAAe,OAAO,MAAM,EAAE,OAAO,CAAC,KAAG,OAAO,MAAM,EAAE,OAAO,CASrF,CAAC;AAET,eAAO,MAAM,+BAA+B,QAAS,MAAM,GAAG,MAAM,GAAG,IAAI,KAAG,MAAM,GAAG,MAAM,GAAG,IAY/F,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBAAiB,CAAC,eAAe,OAAO,MAAM,EAAE,OAAO,CAAC,KAAG,CA2B/F,CAAC"}
package/package.json CHANGED
@@ -1,66 +1,64 @@
1
1
  {
2
2
  "name": "@voiceflow/common",
3
+ "version": "8.3.1",
3
4
  "description": "Junk drawer of utility functions",
4
- "version": "8.2.8",
5
- "author": "Voiceflow",
6
- "bugs": {
7
- "url": "https://github.com/voiceflow/libs/issues"
8
- },
9
- "dependencies": {
10
- "@types/crypto-js": "^4.0.2",
11
- "@types/shallowequal": "^1.1.1",
12
- "bson-objectid": "^2.0.1",
13
- "crypto-js": "^4.2.0",
14
- "cuid": "^2.1.8",
15
- "dayjs": "1.10.7",
16
- "lodash": "^4.17.21",
17
- "murmurhash-wasm": "^1.3.0",
18
- "number-to-words": "^1.2.4",
19
- "shallowequal": "^1.1.0",
20
- "typescript-fsa": "3.0.0"
21
- },
22
- "devDependencies": {
23
- "@types/lodash": "^4.14.176",
24
- "@types/number-to-words": "1.2.0",
25
- "@voiceflow-meta/jest-config": "1.0.2",
26
- "@voiceflow-meta/typescript-config": "1.0.2"
27
- },
28
- "files": [
29
- "build"
30
- ],
31
- "homepage": "https://github.com/voiceflow/libs#readme",
32
5
  "keywords": [
33
6
  "voiceflow"
34
7
  ],
35
- "license": "ISC",
36
- "main": "build/cjs/index.js",
37
- "module": "build/esm/index.js",
38
- "publishConfig": {
39
- "access": "public"
8
+ "homepage": "https://github.com/voiceflow/libs#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/voiceflow/libs/issues"
40
11
  },
41
12
  "repository": {
42
13
  "type": "git",
43
14
  "url": "git+https://github.com/voiceflow/libs.git"
44
15
  },
16
+ "license": "ISC",
17
+ "author": "Voiceflow",
18
+ "main": "build/cjs/index.js",
19
+ "module": "build/esm/index.js",
20
+ "types": "build/cjs/index.d.ts",
21
+ "files": [
22
+ "build"
23
+ ],
45
24
  "scripts": {
46
- "build": "yarn clean && yarn build:cjs && yarn build:esm",
47
- "build:cjs": "yarn g:tsc -p tsconfig.build.cjs.json && yarn g:tsc-alias -p tsconfig.build.cjs.json && yarn postbuild:cjs",
48
- "build:esm": "yarn g:tsc -p tsconfig.build.esm.json && yarn g:tsc-alias -p tsconfig.build.esm.json && yarn postbuild:esm",
25
+ "build": "yarn g:turbo run build:cmd --filter=@voiceflow/common...",
26
+ "build:cjs": "yarn g:build:pkg cjs",
27
+ "build:cmd": "yarn g:run-p build:cjs build:esm",
28
+ "build:esm": "yarn g:build:pkg esm",
49
29
  "clean": "yarn g:rimraf build",
50
- "commit": "cz",
51
- "lint": "yarn g:eslint '**/*.{js,ts}'",
52
- "lint:fix": "yarn lint --fix",
53
- "lint:quiet": "yarn lint --quiet",
54
- "lint:report": "yarn g:eslint-output --quiet '**/*.{js,ts}'",
55
- "postbuild:cjs": "touch build/cjs/package.json && echo '{ \"type\": \"commonjs\" }' > build/cjs/package.json",
56
- "postbuild:esm": "touch build/esm/package.json && echo '{ \"type\": \"module\" }' > build/esm/package.json",
57
- "tdd": "yarn test:unit --watch",
58
- "test:dependencies": "yarn g:depcheck",
59
- "test:unit": "yarn g:jest"
30
+ "lint": "yarn g:run-p -c lint:eslint lint:prettier",
31
+ "lint:eslint": "yarn g:eslint",
32
+ "lint:fix": "yarn g:run-p -c \"lint:eslint --fix\" \"lint:prettier --write\"",
33
+ "lint:prettier": "yarn g:prettier --check",
34
+ "tdd": "yarn g:vitest",
35
+ "test": "yarn g:run-p -c test:dependencies test:types test:unit",
36
+ "test:dependencies": "yarn g:depcruise",
37
+ "test:types": "yarn g:tsc --noEmit",
38
+ "test:unit": "yarn g:vitest run --coverage"
39
+ },
40
+ "dependencies": {
41
+ "@types/crypto-js": "4.1.0",
42
+ "@types/shallowequal": "1.1.1",
43
+ "bson-objectid": "2.0.2",
44
+ "crypto-js": "4.2.0",
45
+ "cuid": "2.1.8",
46
+ "dayjs": "1.10.7",
47
+ "lodash": "4.17.21",
48
+ "murmurhash-wasm": "1.3.0",
49
+ "number-to-words": "1.2.4",
50
+ "shallowequal": "1.1.0",
51
+ "typescript-fsa": "3.0.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/lodash": "4.14.178",
55
+ "@types/number-to-words": "1.2.0"
60
56
  },
61
- "types": "build/cjs/index.d.ts",
62
57
  "volta": {
63
58
  "extends": "../../package.json"
64
59
  },
65
- "gitHead": "14334e394022769620436e607881f0e364ebd81f"
60
+ "publishConfig": {
61
+ "access": "public"
62
+ },
63
+ "gitHead": "9230c46040e3891d8bbed75b171dbc4f0ea07e3d"
66
64
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=hex2abc.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hex2abc.test.d.ts","sourceRoot":"","sources":["../../../src/crypto/hex2abc.test.ts"],"names":[],"mappings":""}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const hex2abc_1 = require("./hex2abc");
4
- describe('hex2abc()', () => {
5
- it('works', () => {
6
- expect((0, hex2abc_1.hex2abc)('abcdef')).toBe('abcdef');
7
- expect((0, hex2abc_1.hex2abc)('0123456789')).toBe('ghijklmnop');
8
- });
9
- it('works with 0x prefixes', () => {
10
- expect((0, hex2abc_1.hex2abc)('0xabc123')).toBe('gxabchij');
11
- });
12
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=murmurhash.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"murmurhash.test.d.ts","sourceRoot":"","sources":["../../../src/crypto/murmurhash.test.ts"],"names":[],"mappings":""}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const murmurhash_1 = require("./murmurhash");
4
- // for second test check (4 byte chunk)
5
- // const buf_left = Buffer.of(0xff, 0xff, 0xff, 0xff);
6
- // const buf_right = Buffer.of(0x76, 0x29, 0x3b, 0x50);
7
- // for third test check (correct endian order)
8
- // const buf_left_two = Buffer.of(0x21, 0x43, 0x65, 0x87);
9
- // const buf_right_two = Buffer.of(0xf5, 0x5b, 0x51, 0x6b);
10
- describe('hash()', () => {
11
- it('return a 32-bit hash resulting from the murmurhash3 algorithm', () => {
12
- expect(murmurhash_1.MurmurHash.hash('hello', 0)).toBe('lokkdakm');
13
- expect(murmurhash_1.MurmurHash.hash('hello world', 0)).toBe('kkehkpgl');
14
- expect(murmurhash_1.MurmurHash.hash('helloworld', 0)).toBe('holkilfm');
15
- expect(murmurhash_1.MurmurHash.hash('HELLOWORLD', 0)).toBe('dohkopda');
16
- expect(murmurhash_1.MurmurHash.hash('', 0)).toBe('g'); // not sure why '0000 0000' fails as a test
17
- expect(murmurhash_1.MurmurHash.hash('abc', 0)).toBe('bjddpjfa');
18
- expect(murmurhash_1.MurmurHash.hash('ABC', 0)).toBe('kjchcljl');
19
- // from https://github.com/jonahsnider/murmurhash-wasm/blob/main/test/murmur-hash3/hash-32.test.ts
20
- // expect(MurmurHash.hash(buf_left.toString('hex'), 0)).to.eql(buf_right.toString('hex'));
21
- // expect(MurmurHash.hash(buf_left_two.toString('hex'), 0)).to.eql(buf_right_two.toString('hex'));
22
- });
23
- });
@@ -1,64 +0,0 @@
1
- {
2
- "slots": [
3
- {
4
- "key": "4i3h3mmi",
5
- "name": "slotmans",
6
- "type": {
7
- "value": "custom"
8
- },
9
- "color": "#4F9ED1",
10
- "inputs": ["tyler", "john", "scott", "michael", "william", "andy", "peter", "frank", "igor", "steven", "jessica"]
11
- }
12
- ],
13
- "intents": [
14
- {
15
- "key": "3sb53sup",
16
- "name": "name_intent",
17
- "slots": [
18
- {
19
- "id": "4i3h3mmi",
20
- "dialog": {
21
- "prompt": [
22
- {
23
- "text": "",
24
- "slots": []
25
- }
26
- ],
27
- "confirm": [
28
- {
29
- "text": "",
30
- "slots": []
31
- }
32
- ],
33
- "utterances": [
34
- {
35
- "text": "{{[name].4i3h3mmi}} ",
36
- "slots": ["4i3h3mmi"]
37
- }
38
- ],
39
- "confirmEnabled": false
40
- },
41
- "required": false
42
- }
43
- ],
44
- "inputs": [
45
- {
46
- "text": "It's {{[slotmans].4i3h3mmi}}",
47
- "slots": ["4i3h3mmi"]
48
- },
49
- {
50
- "text": "I'm {{[slotmans].4i3h3mmi}}",
51
- "slots": ["4i3h3mmi"]
52
- },
53
- {
54
- "text": "{{[slotmans].4i3h3mmi}}",
55
- "slots": ["4i3h3mmi"]
56
- },
57
- {
58
- "text": "my name is {{[slotmans].4i3h3mmi}}",
59
- "slots": ["4i3h3mmi"]
60
- }
61
- ]
62
- }
63
- ]
64
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=array.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.test.d.ts","sourceRoot":"","sources":["../../../src/utils/array.test.ts"],"names":[],"mappings":""}
@@ -1,237 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const array_1 = require("./array");
4
- describe('Utils | array', () => {
5
- describe('unique()', () => {
6
- it('return an array containing one instance of each value from the array passed to it', () => {
7
- expect((0, array_1.unique)([1, 1, 2, 0, 1, 4, 3, 1, 9, 9, 2])).toEqual([1, 2, 0, 4, 3, 9]);
8
- });
9
- });
10
- describe('without()', () => {
11
- it('return an array containing every value from the array passed to it except for the value at the provided index', () => {
12
- expect((0, array_1.without)([], -1)).toEqual([]);
13
- expect((0, array_1.without)([], 0)).toEqual([]);
14
- expect((0, array_1.without)(['a', 'b', 'c', 'd'], -1)).toEqual(['a', 'b', 'c', 'd']);
15
- expect((0, array_1.without)(['a', 'b', 'c', 'd'], 0)).toEqual(['b', 'c', 'd']);
16
- expect((0, array_1.without)(['a', 'b', 'c', 'd'], 2)).toEqual(['a', 'b', 'd']);
17
- expect((0, array_1.without)(['a', 'b', 'c', 'd'], 4)).toEqual(['a', 'b', 'c', 'd']);
18
- });
19
- });
20
- describe('withoutValue()', () => {
21
- it('return an array containing every value from the array passed to it except for first value that is directly equal to the provided value', () => {
22
- expect((0, array_1.withoutValue)([], 'd')).toEqual([]);
23
- expect((0, array_1.withoutValue)(['a', 'b', 'c', 'd'], 'g')).toEqual(['a', 'b', 'c', 'd']);
24
- expect((0, array_1.withoutValue)(['a', 'b', 'c', 'd'], 'b')).toEqual(['a', 'c', 'd']);
25
- });
26
- });
27
- describe('withoutValues()', () => {
28
- it('return an array containing every value from the array passed to it except for values from a second provided array', () => {
29
- expect((0, array_1.withoutValues)(['a', 'b', 'c', 'd'], [])).toEqual(['a', 'b', 'c', 'd']);
30
- expect((0, array_1.withoutValues)([], ['g', 'c', 'b', 'e'])).toEqual([]);
31
- expect((0, array_1.withoutValues)(['a', 'b', 'c', 'd'], ['g', 'c', 'b', 5])).toEqual(['a', 'd']);
32
- expect((0, array_1.withoutValues)(['a', 'b', 'c', 'd'], ['g', 'e'])).toEqual(['a', 'b', 'c', 'd']);
33
- });
34
- });
35
- describe('replace()', () => {
36
- it('return an array where the value at the provided index has been replaced with the new value', () => {
37
- expect((0, array_1.insert)([], 8, 'f')).toEqual(['f']);
38
- expect((0, array_1.replace)(['a', 'b', 'c', 'd'], -1, 'f')).toEqual(['a', 'b', 'c', 'd']);
39
- expect((0, array_1.replace)(['a', 'b', 'c', 'd'], 8, 'f')).toEqual(['a', 'b', 'c', 'd', 'f']);
40
- expect((0, array_1.replace)(['a', 'b', 'c', 'd'], 2, 'f')).toEqual(['a', 'b', 'f', 'd']);
41
- });
42
- });
43
- describe('insert()', () => {
44
- it('return an array where the provided value has been inserted at the provided index', () => {
45
- expect((0, array_1.insert)([], 8, 'f')).toEqual(['f']);
46
- expect((0, array_1.insert)(['a', 'b', 'c', 'd'], -1, 'f')).toEqual(['f', 'a', 'b', 'c', 'd']);
47
- expect((0, array_1.insert)(['a', 'b', 'c', 'd'], 2, 'f')).toEqual(['a', 'b', 'f', 'c', 'd']);
48
- expect((0, array_1.insert)(['a', 'b', 'c', 'd'], 8, 'f')).toEqual(['a', 'b', 'c', 'd', 'f']);
49
- });
50
- });
51
- describe('insertAll()', () => {
52
- it('return an array where the provided array of values has been inserted at the provided index', () => {
53
- expect((0, array_1.insertAll)([], 8, ['f', 'g', 'h'])).toEqual(['f', 'g', 'h']);
54
- expect((0, array_1.insertAll)(['a', 'b', 'c', 'd'], -1, ['f', 'g', 'h'])).toEqual(['f', 'g', 'h', 'a', 'b', 'c', 'd']);
55
- expect((0, array_1.insertAll)(['a', 'b', 'c', 'd'], 2, ['f', 'g', 'h'])).toEqual(['a', 'b', 'f', 'g', 'h', 'c', 'd']);
56
- expect((0, array_1.insertAll)(['a', 'b', 'c', 'd'], 8, ['f', 'g', 'h'])).toEqual(['a', 'b', 'c', 'd', 'f', 'g', 'h']);
57
- });
58
- });
59
- describe('append()', () => {
60
- it('return an array with the provided value appended, does not add if already exists', () => {
61
- expect((0, array_1.append)([], 'f')).toEqual(['f']);
62
- expect((0, array_1.append)(['a', 'b', 'c', 'd'], 'f')).toEqual(['a', 'b', 'c', 'd', 'f']);
63
- expect((0, array_1.append)(['a', 'b', 'c'], 'c')).toEqual(['a', 'b', 'c']);
64
- });
65
- });
66
- describe('toggleMembership()', () => {
67
- it('return an array with the provided value included or excluded, the opposite of the current state', () => {
68
- expect((0, array_1.toggleMembership)(['a', 'b', 'c'], 'f')).toEqual(['a', 'b', 'c', 'f']);
69
- expect((0, array_1.toggleMembership)(['a', 'b', 'c', 'f'], 'f')).toEqual(['a', 'b', 'c']);
70
- });
71
- });
72
- describe('head()', () => {
73
- it('return the item at the head of the array and an array containing the remaining elements as a tuple pair', () => {
74
- expect((0, array_1.head)(['a', 'b', 'c', 'd'])).toEqual(['a', ['b', 'c', 'd']]);
75
- expect((0, array_1.head)(['a'])).toEqual(['a', []]);
76
- expect((0, array_1.head)([])).toEqual([undefined, []]);
77
- });
78
- });
79
- describe('tail()', () => {
80
- it('return the item at the end of the array and an array containing the remaining elements as a tuple pair', () => {
81
- expect((0, array_1.tail)(['a', 'b', 'c', 'd'])).toEqual([['a', 'b', 'c'], 'd']);
82
- expect((0, array_1.tail)(['a'])).toEqual([[], 'a']);
83
- expect((0, array_1.tail)([])).toEqual([[], undefined]);
84
- });
85
- });
86
- describe('filterOutNullish()', () => {
87
- it('filters nullish values', () => {
88
- expect((0, array_1.filterOutNullish)([undefined, 1, null])).toEqual([1]);
89
- expect((0, array_1.filterOutNullish)([undefined, null])).toEqual([]);
90
- expect((0, array_1.filterOutNullish)([1])).toEqual([1]);
91
- });
92
- });
93
- describe('isNullish()', () => {
94
- it('works', () => {
95
- expect((0, array_1.isNullish)(null)).toBe(true);
96
- expect((0, array_1.isNullish)(undefined)).toBe(true);
97
- expect((0, array_1.isNullish)(0)).toBe(false);
98
- });
99
- });
100
- describe('isNotNullish()', () => {
101
- it('works', () => {
102
- expect((0, array_1.isNotNullish)(null)).toBe(false);
103
- expect((0, array_1.isNotNullish)(undefined)).toBe(false);
104
- expect((0, array_1.isNotNullish)(0)).toBe(true);
105
- });
106
- });
107
- describe('toArray()', () => {
108
- it('works with arrays', () => {
109
- const value = [1];
110
- expect((0, array_1.toArray)(value)).toEqual([1]);
111
- });
112
- it('works with non-arrays', () => {
113
- const value = 1;
114
- expect((0, array_1.toArray)(value)).toEqual([1]);
115
- });
116
- });
117
- describe('reorder()', () => {
118
- it('should do nothing if from index goes outside array', () => {
119
- const array = [1, 2, 3];
120
- expect((0, array_1.reorder)(array, -1, 1)).toEqual(array);
121
- expect((0, array_1.reorder)(array, 3, 1)).toEqual(array);
122
- });
123
- it('should set as first item if toIndex is zero or lower than 0', () => {
124
- const array = [1, 2, 3];
125
- expect((0, array_1.reorder)(array, 2, -1)).toEqual([3, 1, 2]);
126
- expect((0, array_1.reorder)(array, 2, 0)).toEqual([3, 1, 2]);
127
- });
128
- it('should set as last item if toIndex is the last or greater than last', () => {
129
- const array = [1, 2, 3];
130
- expect((0, array_1.reorder)(array, 0, 2)).toEqual([2, 3, 1]);
131
- expect((0, array_1.reorder)(array, 0, 3)).toEqual([2, 3, 1]);
132
- });
133
- it('should reorder moving forward or backward', () => {
134
- const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
135
- expect((0, array_1.reorder)(array, 1, 2)).toEqual([1, 3, 2, 4, 5, 6, 7, 8, 9, 10]);
136
- expect((0, array_1.reorder)(array, 2, 3)).toEqual([1, 2, 4, 3, 5, 6, 7, 8, 9, 10]);
137
- expect((0, array_1.reorder)(array, 2, 8)).toEqual([1, 2, 4, 5, 6, 7, 8, 9, 3, 10]);
138
- expect((0, array_1.reorder)(array, 8, 1)).toEqual([1, 9, 2, 3, 4, 5, 6, 7, 8, 10]);
139
- expect((0, array_1.reorder)(array, 7, 2)).toEqual([1, 2, 8, 3, 4, 5, 6, 7, 9, 10]);
140
- });
141
- });
142
- describe('separate()', () => {
143
- it('separates items that pass and fail a predicate', () => {
144
- const [passes, fails] = (0, array_1.separate)([20, 1, -3, 15, 8, 23, 40, 3], (x) => x > 10);
145
- expect(passes).toEqual([20, 15, 23, 40]);
146
- expect(fails).toEqual([1, -3, 8, 3]);
147
- });
148
- });
149
- describe('createEntries()', () => {
150
- it('creates entries by extracting a key for each item in an array', () => {
151
- const entries = (0, array_1.createEntries)([{ index: 1 }, { index: 3 }, { index: 5 }], ({ index }) => String(index));
152
- expect(entries).toEqual([
153
- ['1', { index: 1 }],
154
- ['3', { index: 3 }],
155
- ['5', { index: 5 }],
156
- ]);
157
- });
158
- });
159
- describe('createMap()', () => {
160
- it('creates object by extracting a key for each item in an array', () => {
161
- const obj = (0, array_1.createMap)([{ index: 1 }, { index: 3 }, { index: 5 }], ({ index }) => String(index));
162
- expect(obj).toEqual({
163
- 1: { index: 1 },
164
- 3: { index: 3 },
165
- 5: { index: 5 },
166
- });
167
- });
168
- });
169
- describe('findUnion()', () => {
170
- it('finds the overlap between two lists', () => {
171
- const { lhsOnly, rhsOnly, union } = (0, array_1.findUnion)([20, 1, -3, 15], [1, 8, 23, -3, 40, 3]);
172
- expect(lhsOnly).toEqual([20, 15]);
173
- expect(rhsOnly).toEqual([8, 23, 40, 3]);
174
- expect(union).toEqual([1, -3]);
175
- });
176
- });
177
- describe('diff()', () => {
178
- it('finds items that only occur in one of two lists', () => {
179
- expect((0, array_1.diff)([20, 1, -3, 15], [1, 8, 23, -3, 40, 3])).toEqual([20, 15, 8, 23, 40, 3]);
180
- });
181
- });
182
- describe('hasIdenticalMembers()', () => {
183
- it('returns false if lists have different lengths', () => {
184
- expect((0, array_1.hasIdenticalMembers)([1, 2, 3], [3, 3, 2, 2, 1])).toBe(false);
185
- });
186
- it('returns false if either list has a unique member', () => {
187
- expect((0, array_1.hasIdenticalMembers)([1, 2, 3], [2, 3])).toBe(false);
188
- });
189
- it('returns true if both lists contain the same members', () => {
190
- expect((0, array_1.hasIdenticalMembers)([1, 2, 3], [3, 1, 2])).toBe(true);
191
- });
192
- it('returns true if both lists are empty', () => {
193
- expect((0, array_1.hasIdenticalMembers)([], [])).toBe(true);
194
- });
195
- });
196
- describe('filterAndGetLastRemovedValue()', () => {
197
- it('returns the last item which did not pass the filter predicate', () => {
198
- expect((0, array_1.filterAndGetLastRemovedValue)([1, 2, 3], () => true)).toEqual([[1, 2, 3], null]);
199
- expect((0, array_1.filterAndGetLastRemovedValue)([], () => false)).toEqual([[], null]);
200
- expect((0, array_1.filterAndGetLastRemovedValue)([1, 2, 3], (x) => x !== 2)).toEqual([[1, 3], 2]);
201
- });
202
- });
203
- describe('mergeByIdentifier()', () => {
204
- it('test', () => {
205
- const array1 = [
206
- {
207
- key: 1,
208
- value: [1, 2],
209
- },
210
- ];
211
- const array2 = [
212
- {
213
- key: 1,
214
- value: [3],
215
- },
216
- {
217
- key: 2,
218
- value: [4, 5],
219
- },
220
- ];
221
- const result = (0, array_1.mergeByIdentifier)(array1, array2, (x) => x.key.toString(), (a, b) => ({
222
- ...a,
223
- value: [...a.value, ...b.value],
224
- }));
225
- expect(result).toEqual([
226
- {
227
- key: 1,
228
- value: [1, 2, 3],
229
- },
230
- {
231
- key: 2,
232
- value: [4, 5],
233
- },
234
- ]);
235
- });
236
- });
237
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=email.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"email.test.d.ts","sourceRoot":"","sources":["../../../src/utils/email.test.ts"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const emails_1 = require("./emails");
4
- describe('Utils | email', () => {
5
- describe('isValid()', () => {
6
- it('should be valid', () => {
7
- const validEmails = ['joe.doe@test.com', 'john.-last@sub.domain.com', 'test+@voiceflow.com', 't-est+34@voice-flow.com'];
8
- validEmails.forEach((email) => expect((0, emails_1.isValidEmail)(email)).toBe(true));
9
- });
10
- it('should be invalid', () => {
11
- const invalidEmails = ['joe@.com', 'joe@', '@voiceflow.com', '', 'voiceflow.com'];
12
- invalidEmails.forEach((email) => expect((0, emails_1.isValidEmail)(email)).toBe(false));
13
- });
14
- });
15
- describe('getEmailDomain()', () => {
16
- it('works', () => {
17
- expect((0, emails_1.getEmailDomain)('test@voiceflow.com')).toBe('voiceflow.com');
18
- expect((0, emails_1.getEmailDomain)('')).toBe('');
19
- expect((0, emails_1.getEmailDomain)('totally@invalid@voiceflow.com')).toBe('voiceflow.com');
20
- });
21
- });
22
- });