@percepta/utils 0.1.10 → 0.1.11

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 (169) hide show
  1. package/dist/config/getEnvConfig.cjs +32 -0
  2. package/dist/config/getEnvConfig.cjs.map +1 -0
  3. package/dist/config/getEnvConfig.d.cts +72 -0
  4. package/dist/config/getEnvConfig.d.cts.map +1 -0
  5. package/dist/config/getEnvConfig.d.ts +72 -0
  6. package/dist/config/getEnvConfig.d.ts.map +1 -0
  7. package/dist/config/getEnvConfig.js +31 -0
  8. package/dist/config/getEnvConfig.js.map +1 -0
  9. package/dist/config/index.d.cts +1 -0
  10. package/dist/config/index.d.ts +1 -0
  11. package/dist/index.cjs +16 -0
  12. package/dist/index.d.cts +8 -0
  13. package/dist/index.d.ts +8 -0
  14. package/dist/index.js +8 -0
  15. package/dist/utils/assertNever.cjs +8 -0
  16. package/dist/utils/assertNever.cjs.map +1 -0
  17. package/dist/utils/assertNever.d.cts +5 -0
  18. package/dist/utils/assertNever.d.cts.map +1 -0
  19. package/dist/utils/assertNever.d.ts +5 -0
  20. package/dist/utils/assertNever.d.ts.map +1 -0
  21. package/dist/utils/assertNever.js +8 -0
  22. package/dist/utils/assertNever.js.map +1 -0
  23. package/dist/utils/batchAsync.cjs +16 -0
  24. package/dist/utils/batchAsync.cjs.map +1 -0
  25. package/dist/utils/batchAsync.d.cts +5 -0
  26. package/dist/utils/batchAsync.d.cts.map +1 -0
  27. package/dist/utils/batchAsync.d.ts +5 -0
  28. package/dist/utils/batchAsync.d.ts.map +1 -0
  29. package/dist/utils/batchAsync.js +16 -0
  30. package/dist/utils/batchAsync.js.map +1 -0
  31. package/dist/utils/index.d.cts +6 -0
  32. package/dist/utils/index.d.ts +6 -0
  33. package/dist/utils/logNever.cjs +9 -0
  34. package/dist/utils/logNever.cjs.map +1 -0
  35. package/dist/utils/logNever.d.cts +6 -0
  36. package/dist/utils/logNever.d.cts.map +1 -0
  37. package/dist/utils/logNever.d.ts +6 -0
  38. package/dist/utils/logNever.d.ts.map +1 -0
  39. package/dist/utils/logNever.js +9 -0
  40. package/dist/utils/logNever.js.map +1 -0
  41. package/dist/utils/promiseAllValues.cjs +9 -0
  42. package/dist/utils/promiseAllValues.cjs.map +1 -0
  43. package/dist/utils/promiseAllValues.d.cts +6 -0
  44. package/dist/utils/promiseAllValues.d.cts.map +1 -0
  45. package/dist/utils/promiseAllValues.d.ts +6 -0
  46. package/dist/utils/promiseAllValues.d.ts.map +1 -0
  47. package/dist/utils/promiseAllValues.js +9 -0
  48. package/dist/utils/promiseAllValues.js.map +1 -0
  49. package/dist/utils/replaceAt.cjs +18 -0
  50. package/dist/utils/replaceAt.cjs.map +1 -0
  51. package/dist/{esnext/src/utils/replaceAt.d.ts → utils/replaceAt.d.cts} +5 -2
  52. package/dist/utils/replaceAt.d.cts.map +1 -0
  53. package/dist/{cjs/src/utils → utils}/replaceAt.d.ts +4 -1
  54. package/dist/utils/replaceAt.d.ts.map +1 -0
  55. package/dist/utils/replaceAt.js +18 -0
  56. package/dist/utils/replaceAt.js.map +1 -0
  57. package/dist/utils/zodKeyedTypeUnion.cjs +16 -0
  58. package/dist/utils/zodKeyedTypeUnion.cjs.map +1 -0
  59. package/dist/utils/zodKeyedTypeUnion.d.cts +18 -0
  60. package/dist/utils/zodKeyedTypeUnion.d.cts.map +1 -0
  61. package/dist/utils/zodKeyedTypeUnion.d.ts +18 -0
  62. package/dist/utils/zodKeyedTypeUnion.d.ts.map +1 -0
  63. package/dist/utils/zodKeyedTypeUnion.js +16 -0
  64. package/dist/utils/zodKeyedTypeUnion.js.map +1 -0
  65. package/package.json +27 -17
  66. package/dist/cjs/src/config/getEnvConfig.d.ts +0 -164
  67. package/dist/cjs/src/config/getEnvConfig.d.ts.map +0 -1
  68. package/dist/cjs/src/config/getEnvConfig.js +0 -30
  69. package/dist/cjs/src/config/getEnvConfig.js.map +0 -1
  70. package/dist/cjs/src/config/index.d.ts +0 -2
  71. package/dist/cjs/src/config/index.d.ts.map +0 -1
  72. package/dist/cjs/src/config/index.js +0 -18
  73. package/dist/cjs/src/config/index.js.map +0 -1
  74. package/dist/cjs/src/index.d.ts +0 -3
  75. package/dist/cjs/src/index.d.ts.map +0 -1
  76. package/dist/cjs/src/index.js +0 -19
  77. package/dist/cjs/src/index.js.map +0 -1
  78. package/dist/cjs/src/utils/__tests__/assertNever.test.d.ts +0 -2
  79. package/dist/cjs/src/utils/__tests__/assertNever.test.d.ts.map +0 -1
  80. package/dist/cjs/src/utils/__tests__/assertNever.test.js +0 -22
  81. package/dist/cjs/src/utils/__tests__/assertNever.test.js.map +0 -1
  82. package/dist/cjs/src/utils/__tests__/batchAsync.test.d.ts +0 -2
  83. package/dist/cjs/src/utils/__tests__/batchAsync.test.d.ts.map +0 -1
  84. package/dist/cjs/src/utils/__tests__/batchAsync.test.js +0 -47
  85. package/dist/cjs/src/utils/__tests__/batchAsync.test.js.map +0 -1
  86. package/dist/cjs/src/utils/assertNever.d.ts +0 -2
  87. package/dist/cjs/src/utils/assertNever.d.ts.map +0 -1
  88. package/dist/cjs/src/utils/assertNever.js +0 -7
  89. package/dist/cjs/src/utils/assertNever.js.map +0 -1
  90. package/dist/cjs/src/utils/batchAsync.d.ts +0 -2
  91. package/dist/cjs/src/utils/batchAsync.d.ts.map +0 -1
  92. package/dist/cjs/src/utils/batchAsync.js +0 -18
  93. package/dist/cjs/src/utils/batchAsync.js.map +0 -1
  94. package/dist/cjs/src/utils/index.d.ts +0 -7
  95. package/dist/cjs/src/utils/index.d.ts.map +0 -1
  96. package/dist/cjs/src/utils/index.js +0 -23
  97. package/dist/cjs/src/utils/index.js.map +0 -1
  98. package/dist/cjs/src/utils/logNever.d.ts +0 -3
  99. package/dist/cjs/src/utils/logNever.d.ts.map +0 -1
  100. package/dist/cjs/src/utils/logNever.js +0 -8
  101. package/dist/cjs/src/utils/logNever.js.map +0 -1
  102. package/dist/cjs/src/utils/promiseAllValues.d.ts +0 -6
  103. package/dist/cjs/src/utils/promiseAllValues.d.ts.map +0 -1
  104. package/dist/cjs/src/utils/promiseAllValues.js +0 -12
  105. package/dist/cjs/src/utils/promiseAllValues.js.map +0 -1
  106. package/dist/cjs/src/utils/replaceAt.d.ts.map +0 -1
  107. package/dist/cjs/src/utils/replaceAt.js +0 -17
  108. package/dist/cjs/src/utils/replaceAt.js.map +0 -1
  109. package/dist/cjs/src/utils/zodKeyedTypeUnion.d.ts +0 -17
  110. package/dist/cjs/src/utils/zodKeyedTypeUnion.d.ts.map +0 -1
  111. package/dist/cjs/src/utils/zodKeyedTypeUnion.js +0 -15
  112. package/dist/cjs/src/utils/zodKeyedTypeUnion.js.map +0 -1
  113. package/dist/cjs/tsconfig.tsbuildinfo +0 -1
  114. package/dist/cjs/vitest.config.d.ts +0 -3
  115. package/dist/cjs/vitest.config.d.ts.map +0 -1
  116. package/dist/cjs/vitest.config.js +0 -5
  117. package/dist/cjs/vitest.config.js.map +0 -1
  118. package/dist/esnext/src/config/getEnvConfig.d.ts +0 -164
  119. package/dist/esnext/src/config/getEnvConfig.d.ts.map +0 -1
  120. package/dist/esnext/src/config/getEnvConfig.js +0 -26
  121. package/dist/esnext/src/config/getEnvConfig.js.map +0 -1
  122. package/dist/esnext/src/config/index.d.ts +0 -2
  123. package/dist/esnext/src/config/index.d.ts.map +0 -1
  124. package/dist/esnext/src/config/index.js +0 -2
  125. package/dist/esnext/src/config/index.js.map +0 -1
  126. package/dist/esnext/src/index.d.ts +0 -3
  127. package/dist/esnext/src/index.d.ts.map +0 -1
  128. package/dist/esnext/src/index.js +0 -3
  129. package/dist/esnext/src/index.js.map +0 -1
  130. package/dist/esnext/src/utils/__tests__/assertNever.test.d.ts +0 -2
  131. package/dist/esnext/src/utils/__tests__/assertNever.test.d.ts.map +0 -1
  132. package/dist/esnext/src/utils/__tests__/assertNever.test.js +0 -20
  133. package/dist/esnext/src/utils/__tests__/assertNever.test.js.map +0 -1
  134. package/dist/esnext/src/utils/__tests__/batchAsync.test.d.ts +0 -2
  135. package/dist/esnext/src/utils/__tests__/batchAsync.test.d.ts.map +0 -1
  136. package/dist/esnext/src/utils/__tests__/batchAsync.test.js +0 -45
  137. package/dist/esnext/src/utils/__tests__/batchAsync.test.js.map +0 -1
  138. package/dist/esnext/src/utils/assertNever.d.ts +0 -2
  139. package/dist/esnext/src/utils/assertNever.d.ts.map +0 -1
  140. package/dist/esnext/src/utils/assertNever.js +0 -4
  141. package/dist/esnext/src/utils/assertNever.js.map +0 -1
  142. package/dist/esnext/src/utils/batchAsync.d.ts +0 -2
  143. package/dist/esnext/src/utils/batchAsync.d.ts.map +0 -1
  144. package/dist/esnext/src/utils/batchAsync.js +0 -15
  145. package/dist/esnext/src/utils/batchAsync.js.map +0 -1
  146. package/dist/esnext/src/utils/index.d.ts +0 -7
  147. package/dist/esnext/src/utils/index.d.ts.map +0 -1
  148. package/dist/esnext/src/utils/index.js +0 -7
  149. package/dist/esnext/src/utils/index.js.map +0 -1
  150. package/dist/esnext/src/utils/logNever.d.ts +0 -3
  151. package/dist/esnext/src/utils/logNever.d.ts.map +0 -1
  152. package/dist/esnext/src/utils/logNever.js +0 -5
  153. package/dist/esnext/src/utils/logNever.js.map +0 -1
  154. package/dist/esnext/src/utils/promiseAllValues.d.ts +0 -6
  155. package/dist/esnext/src/utils/promiseAllValues.d.ts.map +0 -1
  156. package/dist/esnext/src/utils/promiseAllValues.js +0 -9
  157. package/dist/esnext/src/utils/promiseAllValues.js.map +0 -1
  158. package/dist/esnext/src/utils/replaceAt.d.ts.map +0 -1
  159. package/dist/esnext/src/utils/replaceAt.js +0 -14
  160. package/dist/esnext/src/utils/replaceAt.js.map +0 -1
  161. package/dist/esnext/src/utils/zodKeyedTypeUnion.d.ts +0 -17
  162. package/dist/esnext/src/utils/zodKeyedTypeUnion.d.ts.map +0 -1
  163. package/dist/esnext/src/utils/zodKeyedTypeUnion.js +0 -12
  164. package/dist/esnext/src/utils/zodKeyedTypeUnion.js.map +0 -1
  165. package/dist/esnext/tsconfig.tsbuildinfo +0 -1
  166. package/dist/esnext/vitest.config.d.ts +0 -3
  167. package/dist/esnext/vitest.config.d.ts.map +0 -1
  168. package/dist/esnext/vitest.config.js +0 -3
  169. package/dist/esnext/vitest.config.js.map +0 -1
@@ -0,0 +1,16 @@
1
+ let zod = require("zod");
2
+ //#region src/utils/zodKeyedTypeUnion.ts
3
+ function zodKeyedTypeUnion(schemasByType, typeKey = "type") {
4
+ /**
5
+ * There are a lot of casts here because of our fancy generics.
6
+ * We won't worry about them for now; we'll just use our tests to ensure runtime safety.
7
+ */
8
+ return zod.z.discriminatedUnion(typeKey, Object.entries(schemasByType).map(([type, schema]) => zod.z.object({
9
+ [typeKey]: zod.z.literal(type),
10
+ [type]: schema
11
+ })));
12
+ }
13
+ //#endregion
14
+ exports.zodKeyedTypeUnion = zodKeyedTypeUnion;
15
+
16
+ //# sourceMappingURL=zodKeyedTypeUnion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodKeyedTypeUnion.cjs","names":["z"],"sources":["../../src/utils/zodKeyedTypeUnion.ts"],"sourcesContent":["import { type KeyedTypeUnion, type ValueForTypeKey } from \"keyed-type-union\";\nimport { z } from \"zod\";\n\ntype SchemasByType<\n TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>,\n TTypeKey extends string = \"type\",\n> = {\n [TType in TTypeUnion[TTypeKey]]: z.ZodType<\n ValueForTypeKey<TTypeUnion, TType, TTypeKey>\n >;\n};\n\n/**\n * Creates a Zod schema for a discriminated union of type-union types.\n * We can use this util alongside keyed-type-union for stricter type union patterns.\n *\n * @param schemasByType A record of type keys to their corresponding Zod schemas.\n * @param typeKey The optional key used to discriminate between the different types in the union.\n * @returns A Zod schema for the discriminated union.\n */\nexport function zodKeyedTypeUnion<\n TTypeUnion extends KeyedTypeUnion<Record<string, unknown>>,\n>(schemasByType: SchemasByType<TTypeUnion>): z.ZodType<TTypeUnion>;\nexport function zodKeyedTypeUnion<\n TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>,\n TTypeKey extends string,\n>(\n schemasByType: SchemasByType<TTypeUnion, TTypeKey>,\n typeKey: TTypeKey,\n): z.ZodType<TTypeUnion>;\nexport function zodKeyedTypeUnion<\n TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>,\n TTypeKey extends string,\n>(\n schemasByType: SchemasByType<TTypeUnion, TTypeKey>,\n typeKey: TTypeKey = \"type\" as never,\n): z.ZodType<TTypeUnion> {\n /**\n * There are a lot of casts here because of our fancy generics.\n * We won't worry about them for now; we'll just use our tests to ensure runtime safety.\n */\n return z.discriminatedUnion(\n typeKey,\n Object.entries(schemasByType).map(([type, schema]) =>\n z.object({\n [typeKey]: z.literal(type),\n [type]: schema as never,\n }),\n ) as never,\n ) as never;\n}\n"],"mappings":";;AA8BA,SAAgB,kBAId,eACA,UAAoB,QACG;;;;;AAKvB,QAAOA,IAAAA,EAAE,mBACP,SACA,OAAO,QAAQ,cAAc,CAAC,KAAK,CAAC,MAAM,YACxCA,IAAAA,EAAE,OAAO;GACN,UAAUA,IAAAA,EAAE,QAAQ,KAAK;GACzB,OAAO;EACT,CAAC,CACH,CACF"}
@@ -0,0 +1,18 @@
1
+ import { KeyedTypeUnion, ValueForTypeKey } from "keyed-type-union";
2
+ import { z } from "zod";
3
+
4
+ //#region src/utils/zodKeyedTypeUnion.d.ts
5
+ type SchemasByType<TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>, TTypeKey extends string = "type"> = { [TType in TTypeUnion[TTypeKey]]: z.ZodType<ValueForTypeKey<TTypeUnion, TType, TTypeKey>> };
6
+ /**
7
+ * Creates a Zod schema for a discriminated union of type-union types.
8
+ * We can use this util alongside keyed-type-union for stricter type union patterns.
9
+ *
10
+ * @param schemasByType A record of type keys to their corresponding Zod schemas.
11
+ * @param typeKey The optional key used to discriminate between the different types in the union.
12
+ * @returns A Zod schema for the discriminated union.
13
+ */
14
+ declare function zodKeyedTypeUnion<TTypeUnion extends KeyedTypeUnion<Record<string, unknown>>>(schemasByType: SchemasByType<TTypeUnion>): z.ZodType<TTypeUnion>;
15
+ declare function zodKeyedTypeUnion<TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>, TTypeKey extends string>(schemasByType: SchemasByType<TTypeUnion, TTypeKey>, typeKey: TTypeKey): z.ZodType<TTypeUnion>;
16
+ //#endregion
17
+ export { zodKeyedTypeUnion };
18
+ //# sourceMappingURL=zodKeyedTypeUnion.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodKeyedTypeUnion.d.cts","names":[],"sources":["../../src/utils/zodKeyedTypeUnion.ts"],"mappings":";;;;KAGK,aAAA,oBACgB,cAAA,CAAe,MAAA,mBAAyB,QAAA,mDAGjD,UAAA,CAAW,QAAA,IAAY,CAAA,CAAE,OAAA,CACjC,eAAA,CAAgB,UAAA,EAAY,KAAA,EAAO,QAAA;;;;;;;;;iBAYvB,iBAAA,oBACK,cAAA,CAAe,MAAA,mBAAA,CAClC,aAAA,EAAe,aAAA,CAAc,UAAA,IAAc,CAAA,CAAE,OAAA,CAAQ,UAAA;AAAA,iBACvC,iBAAA,oBACK,cAAA,CAAe,MAAA,mBAAyB,QAAA,2BAAA,CAG3D,aAAA,EAAe,aAAA,CAAc,UAAA,EAAY,QAAA,GACzC,OAAA,EAAS,QAAA,GACR,CAAA,CAAE,OAAA,CAAQ,UAAA"}
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { KeyedTypeUnion, ValueForTypeKey } from "keyed-type-union";
3
+
4
+ //#region src/utils/zodKeyedTypeUnion.d.ts
5
+ type SchemasByType<TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>, TTypeKey extends string = "type"> = { [TType in TTypeUnion[TTypeKey]]: z.ZodType<ValueForTypeKey<TTypeUnion, TType, TTypeKey>> };
6
+ /**
7
+ * Creates a Zod schema for a discriminated union of type-union types.
8
+ * We can use this util alongside keyed-type-union for stricter type union patterns.
9
+ *
10
+ * @param schemasByType A record of type keys to their corresponding Zod schemas.
11
+ * @param typeKey The optional key used to discriminate between the different types in the union.
12
+ * @returns A Zod schema for the discriminated union.
13
+ */
14
+ declare function zodKeyedTypeUnion<TTypeUnion extends KeyedTypeUnion<Record<string, unknown>>>(schemasByType: SchemasByType<TTypeUnion>): z.ZodType<TTypeUnion>;
15
+ declare function zodKeyedTypeUnion<TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>, TTypeKey extends string>(schemasByType: SchemasByType<TTypeUnion, TTypeKey>, typeKey: TTypeKey): z.ZodType<TTypeUnion>;
16
+ //#endregion
17
+ export { zodKeyedTypeUnion };
18
+ //# sourceMappingURL=zodKeyedTypeUnion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodKeyedTypeUnion.d.ts","names":[],"sources":["../../src/utils/zodKeyedTypeUnion.ts"],"mappings":";;;;KAGK,aAAA,oBACgB,cAAA,CAAe,MAAA,mBAAyB,QAAA,mDAGjD,UAAA,CAAW,QAAA,IAAY,CAAA,CAAE,OAAA,CACjC,eAAA,CAAgB,UAAA,EAAY,KAAA,EAAO,QAAA;;;;;;;;;iBAYvB,iBAAA,oBACK,cAAA,CAAe,MAAA,mBAAA,CAClC,aAAA,EAAe,aAAA,CAAc,UAAA,IAAc,CAAA,CAAE,OAAA,CAAQ,UAAA;AAAA,iBACvC,iBAAA,oBACK,cAAA,CAAe,MAAA,mBAAyB,QAAA,2BAAA,CAG3D,aAAA,EAAe,aAAA,CAAc,UAAA,EAAY,QAAA,GACzC,OAAA,EAAS,QAAA,GACR,CAAA,CAAE,OAAA,CAAQ,UAAA"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ //#region src/utils/zodKeyedTypeUnion.ts
3
+ function zodKeyedTypeUnion(schemasByType, typeKey = "type") {
4
+ /**
5
+ * There are a lot of casts here because of our fancy generics.
6
+ * We won't worry about them for now; we'll just use our tests to ensure runtime safety.
7
+ */
8
+ return z.discriminatedUnion(typeKey, Object.entries(schemasByType).map(([type, schema]) => z.object({
9
+ [typeKey]: z.literal(type),
10
+ [type]: schema
11
+ })));
12
+ }
13
+ //#endregion
14
+ export { zodKeyedTypeUnion };
15
+
16
+ //# sourceMappingURL=zodKeyedTypeUnion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zodKeyedTypeUnion.js","names":[],"sources":["../../src/utils/zodKeyedTypeUnion.ts"],"sourcesContent":["import { type KeyedTypeUnion, type ValueForTypeKey } from \"keyed-type-union\";\nimport { z } from \"zod\";\n\ntype SchemasByType<\n TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>,\n TTypeKey extends string = \"type\",\n> = {\n [TType in TTypeUnion[TTypeKey]]: z.ZodType<\n ValueForTypeKey<TTypeUnion, TType, TTypeKey>\n >;\n};\n\n/**\n * Creates a Zod schema for a discriminated union of type-union types.\n * We can use this util alongside keyed-type-union for stricter type union patterns.\n *\n * @param schemasByType A record of type keys to their corresponding Zod schemas.\n * @param typeKey The optional key used to discriminate between the different types in the union.\n * @returns A Zod schema for the discriminated union.\n */\nexport function zodKeyedTypeUnion<\n TTypeUnion extends KeyedTypeUnion<Record<string, unknown>>,\n>(schemasByType: SchemasByType<TTypeUnion>): z.ZodType<TTypeUnion>;\nexport function zodKeyedTypeUnion<\n TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>,\n TTypeKey extends string,\n>(\n schemasByType: SchemasByType<TTypeUnion, TTypeKey>,\n typeKey: TTypeKey,\n): z.ZodType<TTypeUnion>;\nexport function zodKeyedTypeUnion<\n TTypeUnion extends KeyedTypeUnion<Record<string, unknown>, TTypeKey>,\n TTypeKey extends string,\n>(\n schemasByType: SchemasByType<TTypeUnion, TTypeKey>,\n typeKey: TTypeKey = \"type\" as never,\n): z.ZodType<TTypeUnion> {\n /**\n * There are a lot of casts here because of our fancy generics.\n * We won't worry about them for now; we'll just use our tests to ensure runtime safety.\n */\n return z.discriminatedUnion(\n typeKey,\n Object.entries(schemasByType).map(([type, schema]) =>\n z.object({\n [typeKey]: z.literal(type),\n [type]: schema as never,\n }),\n ) as never,\n ) as never;\n}\n"],"mappings":";;AA8BA,SAAgB,kBAId,eACA,UAAoB,QACG;;;;;AAKvB,QAAO,EAAE,mBACP,SACA,OAAO,QAAQ,cAAc,CAAC,KAAK,CAAC,MAAM,YACxC,EAAE,OAAO;GACN,UAAU,EAAE,QAAQ,KAAK;GACzB,OAAO;EACT,CAAC,CACH,CACF"}
package/package.json CHANGED
@@ -1,18 +1,32 @@
1
1
  {
2
2
  "name": "@percepta/utils",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "private": false,
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
5
  "description": "Shared utils for Mosaic",
9
- "sideEffects": false,
10
- "main": "dist/cjs/src/index.js",
11
- "module": "dist/esnext/src/index.js",
12
- "types": "dist/esnext/src/index.d.ts",
13
6
  "files": [
14
- "dist/**/*"
7
+ "dist"
15
8
  ],
9
+ "type": "module",
10
+ "sideEffects": false,
11
+ "main": "./dist/index.cjs",
12
+ "module": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.cts",
22
+ "default": "./dist/index.cjs"
23
+ }
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
16
30
  "dependencies": {
17
31
  "keyed-type-union": "^0.1.0",
18
32
  "lodash-es": "^4.17.21",
@@ -20,17 +34,13 @@
20
34
  },
21
35
  "devDependencies": {
22
36
  "@types/lodash-es": "^4.17.12",
23
- "@percepta/build": "0.4.0"
24
- },
25
- "lint-staged": {
26
- "**/*.ts": "eslint --fix"
37
+ "@percepta/build": "0.5.0"
27
38
  },
28
39
  "scripts": {
29
- "build": "build-ts --high-compat",
30
- "dev": "pnpm build --watch",
40
+ "build": "tsdown",
41
+ "dev": "tsdown --watch",
31
42
  "clean": "rimraf dist",
32
- "lint": "eslint .",
33
- "lint:fix": "eslint . --fix",
43
+ "typecheck": "tsc --noEmit",
34
44
  "test": "vitest run"
35
45
  }
36
46
  }
@@ -1,164 +0,0 @@
1
- import { z } from "zod";
2
- export declare const BASE_ENV_SCHEMA: z.ZodObject<{
3
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
4
- development: "development";
5
- production: "production";
6
- test: "test";
7
- }>>;
8
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
9
- debug: "debug";
10
- info: "info";
11
- warn: "warn";
12
- error: "error";
13
- }>>>;
14
- }, z.core.$strip>;
15
- export type BaseEnvConfig = z.infer<typeof BASE_ENV_SCHEMA>;
16
- export declare function createEnvConfig<TExtension extends z.ZodRawShape>(extensionSchema: z.ZodObject<TExtension>): {
17
- getEnvConfig: () => z.core.$InferObjectOutput<(("NODE_ENV" | "LOG_LEVEL") & keyof TExtension extends never ? {
18
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
19
- development: "development";
20
- production: "production";
21
- test: "test";
22
- }>>;
23
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
24
- debug: "debug";
25
- info: "info";
26
- warn: "warn";
27
- error: "error";
28
- }>>>;
29
- } & TExtension : ({
30
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
31
- development: "development";
32
- production: "production";
33
- test: "test";
34
- }>>;
35
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
36
- debug: "debug";
37
- info: "info";
38
- warn: "warn";
39
- error: "error";
40
- }>>>;
41
- } extends infer T_2 extends z.core.util.SomeObject ? { [K in keyof T_2 as K extends keyof TExtension ? never : K]: {
42
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
43
- development: "development";
44
- production: "production";
45
- test: "test";
46
- }>>;
47
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
48
- debug: "debug";
49
- info: "info";
50
- warn: "warn";
51
- error: "error";
52
- }>>>;
53
- }[K]; } : never) & { [K_1 in keyof TExtension]: TExtension[K_1]; }) extends infer T ? { [k in keyof T]: (("NODE_ENV" | "LOG_LEVEL") & keyof TExtension extends never ? {
54
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
55
- development: "development";
56
- production: "production";
57
- test: "test";
58
- }>>;
59
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
60
- debug: "debug";
61
- info: "info";
62
- warn: "warn";
63
- error: "error";
64
- }>>>;
65
- } & TExtension : ({
66
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
67
- development: "development";
68
- production: "production";
69
- test: "test";
70
- }>>;
71
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
72
- debug: "debug";
73
- info: "info";
74
- warn: "warn";
75
- error: "error";
76
- }>>>;
77
- } extends infer T_1 extends z.core.util.SomeObject ? { [K in keyof T_1 as K extends keyof TExtension ? never : K]: {
78
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
79
- development: "development";
80
- production: "production";
81
- test: "test";
82
- }>>;
83
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
84
- debug: "debug";
85
- info: "info";
86
- warn: "warn";
87
- error: "error";
88
- }>>>;
89
- }[K]; } : never) & { [K_1 in keyof TExtension]: TExtension[K_1]; })[k]; } : never, {}>;
90
- schema: z.ZodObject<(("NODE_ENV" | "LOG_LEVEL") & keyof TExtension extends never ? {
91
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
92
- development: "development";
93
- production: "production";
94
- test: "test";
95
- }>>;
96
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
97
- debug: "debug";
98
- info: "info";
99
- warn: "warn";
100
- error: "error";
101
- }>>>;
102
- } & TExtension : ({
103
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
104
- development: "development";
105
- production: "production";
106
- test: "test";
107
- }>>;
108
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
109
- debug: "debug";
110
- info: "info";
111
- warn: "warn";
112
- error: "error";
113
- }>>>;
114
- } extends infer T_2 extends z.core.util.SomeObject ? { [K in keyof T_2 as K extends keyof TExtension ? never : K]: {
115
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
116
- development: "development";
117
- production: "production";
118
- test: "test";
119
- }>>;
120
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
121
- debug: "debug";
122
- info: "info";
123
- warn: "warn";
124
- error: "error";
125
- }>>>;
126
- }[K]; } : never) & { [K_1 in keyof TExtension]: TExtension[K_1]; }) extends infer T ? { [k in keyof T]: (("NODE_ENV" | "LOG_LEVEL") & keyof TExtension extends never ? {
127
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
128
- development: "development";
129
- production: "production";
130
- test: "test";
131
- }>>;
132
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
133
- debug: "debug";
134
- info: "info";
135
- warn: "warn";
136
- error: "error";
137
- }>>>;
138
- } & TExtension : ({
139
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
140
- development: "development";
141
- production: "production";
142
- test: "test";
143
- }>>;
144
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
145
- debug: "debug";
146
- info: "info";
147
- warn: "warn";
148
- error: "error";
149
- }>>>;
150
- } extends infer T_1 extends z.core.util.SomeObject ? { [K in keyof T_1 as K extends keyof TExtension ? never : K]: {
151
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
152
- development: "development";
153
- production: "production";
154
- test: "test";
155
- }>>;
156
- LOG_LEVEL: z.ZodDefault<z.ZodPipe<z.ZodString, z.ZodEnum<{
157
- debug: "debug";
158
- info: "info";
159
- warn: "warn";
160
- error: "error";
161
- }>>>;
162
- }[K]; } : never) & { [K_1 in keyof TExtension]: TExtension[K_1]; })[k]; } : never, z.core.$strip>;
163
- };
164
- //# sourceMappingURL=getEnvConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getEnvConfig.d.ts","sourceRoot":"","sources":["../../../../src/config/getEnvConfig.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,eAAe;;;;;;;;;;;;iBAS1B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAG5D,wBAAgB,eAAe,CAAC,UAAU,SAAS,CAAC,CAAC,WAAW,EAC9D,eAAe,EAAE,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAezC"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BASE_ENV_SCHEMA = void 0;
4
- exports.createEnvConfig = createEnvConfig;
5
- // @percepta/config/src/createEnvConfig.ts
6
- const zod_1 = require("zod");
7
- // Base schema that all apps get
8
- exports.BASE_ENV_SCHEMA = zod_1.z.object({
9
- NODE_ENV: zod_1.z
10
- .enum(["development", "production", "test"])
11
- .default("development"),
12
- LOG_LEVEL: zod_1.z
13
- .string()
14
- .toLowerCase()
15
- .pipe(zod_1.z.enum(["debug", "info", "warn", "error"]))
16
- .default("info"),
17
- });
18
- // Factory that creates a configured getEnvConfig
19
- function createEnvConfig(extensionSchema) {
20
- const schema = exports.BASE_ENV_SCHEMA.extend(extensionSchema.shape);
21
- let _cached;
22
- function getEnvConfig() {
23
- if (_cached == null) {
24
- _cached = schema.parse(process.env);
25
- }
26
- return _cached;
27
- }
28
- return { getEnvConfig, schema };
29
- }
30
- //# sourceMappingURL=getEnvConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getEnvConfig.js","sourceRoot":"","sources":["../../../../src/config/getEnvConfig.ts"],"names":[],"mappings":";;;AAkBA,0CAgBC;AAlCD,0CAA0C;AAC1C,6BAAwB;AAExB,gCAAgC;AACnB,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,OAAC;SACR,IAAI,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;SAC3C,OAAO,CAAC,aAAa,CAAC;IACzB,SAAS,EAAE,OAAC;SACT,MAAM,EAAE;SACR,WAAW,EAAE;SACb,IAAI,CAAC,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;SAChD,OAAO,CAAC,MAAM,CAAC;CACnB,CAAC,CAAC;AAIH,iDAAiD;AACjD,SAAgB,eAAe,CAC7B,eAAwC;IAExC,MAAM,MAAM,GAAG,uBAAe,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAG7D,IAAI,OAA2B,CAAC;IAEhC,SAAS,YAAY;QACnB,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;AAClC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./getEnvConfig";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./getEnvConfig"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B"}
@@ -1,3 +0,0 @@
1
- export * from "./utils";
2
- export * from "./config";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./utils"), exports);
18
- __exportStar(require("./config"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=assertNever.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assertNever.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/__tests__/assertNever.test.ts"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
- const assertNever_1 = require("../assertNever");
5
- (0, vitest_1.describe)(assertNever_1.assertNever, () => {
6
- (0, vitest_1.it)("throws an error on unhandled types", () => {
7
- function getInvalidType() {
8
- return 0;
9
- }
10
- (0, vitest_1.expect)(() => {
11
- const invalidType = getInvalidType();
12
- switch (invalidType) {
13
- case 1:
14
- case 2:
15
- return;
16
- default:
17
- (0, assertNever_1.assertNever)(invalidType);
18
- }
19
- }).toThrow();
20
- });
21
- });
22
- //# sourceMappingURL=assertNever.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assertNever.test.js","sourceRoot":"","sources":["../../../../../src/utils/__tests__/assertNever.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,gDAA6C;AAE7C,IAAA,iBAAQ,EAAC,yBAAW,EAAE,GAAG,EAAE;IACzB,IAAA,WAAE,EAAC,oCAAoC,EAAE,GAAG,EAAE;QAG5C,SAAS,cAAc;YACrB,OAAO,CAAU,CAAC;QACpB,CAAC;QAED,IAAA,eAAM,EAAC,GAAG,EAAE;YACV,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;YACrC,QAAQ,WAAW,EAAE,CAAC;gBACpB,KAAK,CAAC,CAAC;gBACP,KAAK,CAAC;oBACJ,OAAO;gBACT;oBACE,IAAA,yBAAW,EAAC,WAAW,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=batchAsync.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batchAsync.test.d.ts","sourceRoot":"","sources":["../../../../../src/utils/__tests__/batchAsync.test.ts"],"names":[],"mappings":""}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
- const batchAsync_1 = require("../batchAsync");
5
- (0, vitest_1.describe)(batchAsync_1.batchAsync, () => {
6
- (0, vitest_1.it)("processes all items and returns results in order", async () => {
7
- const values = [1, 2, 3, 4, 5];
8
- const result = await (0, batchAsync_1.batchAsync)(values, 2, (v) => Promise.resolve(v * 10));
9
- (0, vitest_1.expect)(result).toEqual([10, 20, 30, 40, 50]);
10
- });
11
- (0, vitest_1.it)("passes the original index to the iteratee", async () => {
12
- const values = ["a", "b", "c"];
13
- const indices = [];
14
- await (0, batchAsync_1.batchAsync)(values, 2, (_v, index) => {
15
- indices.push(index);
16
- return Promise.resolve();
17
- });
18
- (0, vitest_1.expect)(indices).toEqual([0, 1, 2]);
19
- });
20
- (0, vitest_1.it)("processes items in batches of the given size", async () => {
21
- const concurrencyLog = [];
22
- let inFlight = 0;
23
- const values = [1, 2, 3, 4, 5];
24
- await (0, batchAsync_1.batchAsync)(values, 2, async (v) => {
25
- inFlight++;
26
- concurrencyLog.push(inFlight);
27
- await new Promise((resolve) => setTimeout(resolve, 10));
28
- inFlight--;
29
- return v;
30
- });
31
- // Each batch should have at most 2 in flight
32
- (0, vitest_1.expect)(Math.max(...concurrencyLog)).toBeLessThanOrEqual(2);
33
- });
34
- (0, vitest_1.it)("returns an empty array for empty input", async () => {
35
- const result = await (0, batchAsync_1.batchAsync)([], 5, (v) => Promise.resolve(v));
36
- (0, vitest_1.expect)(result).toEqual([]);
37
- });
38
- (0, vitest_1.it)("handles batch size larger than input", async () => {
39
- const result = await (0, batchAsync_1.batchAsync)([1, 2], 100, (v) => Promise.resolve(v * 2));
40
- (0, vitest_1.expect)(result).toEqual([2, 4]);
41
- });
42
- (0, vitest_1.it)("throws when batchSize is 0 or negative", async () => {
43
- await (0, vitest_1.expect)((0, batchAsync_1.batchAsync)([1], 0, (v) => Promise.resolve(v))).rejects.toThrow("batchSize must be greater than 0");
44
- await (0, vitest_1.expect)((0, batchAsync_1.batchAsync)([1], -1, (v) => Promise.resolve(v))).rejects.toThrow("batchSize must be greater than 0");
45
- });
46
- });
47
- //# sourceMappingURL=batchAsync.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batchAsync.test.js","sourceRoot":"","sources":["../../../../../src/utils/__tests__/batchAsync.test.ts"],"names":[],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- export declare function assertNever(value: never): never;
2
- //# sourceMappingURL=assertNever.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assertNever.d.ts","sourceRoot":"","sources":["../../../../src/utils/assertNever.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertNever = assertNever;
4
- function assertNever(value) {
5
- throw new Error("Unexpected value.", { cause: value });
6
- }
7
- //# sourceMappingURL=assertNever.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assertNever.js","sourceRoot":"","sources":["../../../../src/utils/assertNever.ts"],"names":[],"mappings":";;AAAA,kCAEC;AAFD,SAAgB,WAAW,CAAC,KAAY;IACtC,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AACzD,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function batchAsync<TValue, TReturn>(values: TValue[], batchSize: number, iteratee: (value: TValue, index: number) => Promise<TReturn>): Promise<TReturn[]>;
2
- //# sourceMappingURL=batchAsync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batchAsync.d.ts","sourceRoot":"","sources":["../../../../src/utils/batchAsync.ts"],"names":[],"mappings":"AAEA,wBAAsB,UAAU,CAAC,MAAM,EAAE,OAAO,EAC9C,MAAM,EAAE,MAAM,EAAE,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,GAC3D,OAAO,CAAC,OAAO,EAAE,CAAC,CAgBpB"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.batchAsync = batchAsync;
4
- const lodash_es_1 = require("lodash-es");
5
- async function batchAsync(values, batchSize, iteratee) {
6
- if (batchSize <= 0) {
7
- throw new Error("batchSize must be greater than 0");
8
- }
9
- const results = [];
10
- const valuesWithIndex = values.map((value, index) => [value, index]);
11
- const chunkedValues = (0, lodash_es_1.chunk)(valuesWithIndex, batchSize);
12
- for (const chunkGroup of chunkedValues) {
13
- const chunkResults = await Promise.all(chunkGroup.map(([value, index]) => iteratee(value, index)));
14
- results.push(chunkResults);
15
- }
16
- return (0, lodash_es_1.flatten)(results);
17
- }
18
- //# sourceMappingURL=batchAsync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batchAsync.js","sourceRoot":"","sources":["../../../../src/utils/batchAsync.ts"],"names":[],"mappings":";;AAEA,gCAoBC;AAtBD,yCAA2C;AAEpC,KAAK,UAAU,UAAU,CAC9B,MAAgB,EAChB,SAAiB,EACjB,QAA4D;IAE5D,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IACD,MAAM,OAAO,GAAgB,EAAE,CAAC;IAChC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAChC,CAAC,KAAK,EAAE,KAAK,EAAkC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CACjE,CAAC;IACF,MAAM,aAAa,GAAG,IAAA,iBAAK,EAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IACxD,KAAK,MAAM,UAAU,IAAI,aAAa,EAAE,CAAC;QACvC,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CACpC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAC3D,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,IAAA,mBAAO,EAAC,OAAO,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,7 +0,0 @@
1
- export * from "./assertNever";
2
- export * from "./batchAsync";
3
- export * from "./logNever";
4
- export * from "./promiseAllValues";
5
- export * from "./replaceAt";
6
- export * from "./zodKeyedTypeUnion";
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./assertNever"), exports);
18
- __exportStar(require("./batchAsync"), exports);
19
- __exportStar(require("./logNever"), exports);
20
- __exportStar(require("./promiseAllValues"), exports);
21
- __exportStar(require("./replaceAt"), exports);
22
- __exportStar(require("./zodKeyedTypeUnion"), exports);
23
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+CAA6B;AAC7B,6CAA2B;AAC3B,qDAAmC;AACnC,8CAA4B;AAC5B,sDAAoC"}
@@ -1,3 +0,0 @@
1
- export declare function logNever(value: never): void;
2
- export declare function logNever<TReturn>(value: never, returnValue: TReturn): TReturn;
3
- //# sourceMappingURL=logNever.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logNever.d.ts","sourceRoot":"","sources":["../../../../src/utils/logNever.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;AAC7C,wBAAgB,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,GAAG,OAAO,CAAC"}