@8ms/helpers 2.3.11 → 2.3.13

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.
Binary file
@@ -1,6 +1,6 @@
1
1
  import "../../api-BlYy5Efh.mjs";
2
- import { get } from "../../axios/index.mjs";
3
2
  import { getLuxonDate, getToday, getYesterday, getYmdString } from "../../date/index.mjs";
3
+ import { get } from "../../axios/index.mjs";
4
4
 
5
5
  //#region src/adverity/server/getJobs.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import "../../api-BlYy5Efh.mjs";
2
- import { post } from "../../axios/index.mjs";
3
2
  import { ageGroups, devices, genders } from "../index.mjs";
3
+ import { post } from "../../axios/index.mjs";
4
4
 
5
5
  //#region src/eskimi/server/getAgeGroup.ts
6
6
  /**
@@ -1,3 +1,9 @@
1
+ //#region src/lodash/chunk.d.ts
2
+ declare const chunk: <T>(array: T[], size: number) => T[][];
3
+ //#endregion
4
+ //#region src/lodash/flatten.d.ts
5
+ declare const flatten: <T>(array: T[][]) => T[];
6
+ //#endregion
1
7
  //#region src/lodash/set.d.ts
2
8
  declare const set: <T extends object>(obj: T, path: string | string[], value: unknown) => T;
3
9
  //#endregion
@@ -33,4 +39,4 @@ declare const uniq: (arr: any[]) => any[];
33
39
  //#region src/lodash/uniqBy.d.ts
34
40
  declare const uniqBy: <T>(collection: T[], iteratee: ((item: T) => unknown) | string) => T[];
35
41
  //#endregion
36
- export { isDate, isEmpty, isEqual, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
42
+ export { chunk, flatten, isDate, isEmpty, isEqual, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
@@ -1,3 +1,15 @@
1
+ //#region src/lodash/chunk.ts
2
+ const chunk = (array, size) => {
3
+ const result = [];
4
+ for (let i = 0; i < array.length; i += size) result.push(array.slice(i, i + size));
5
+ return result;
6
+ };
7
+
8
+ //#endregion
9
+ //#region src/lodash/flatten.ts
10
+ const flatten = (array) => [].concat(...array);
11
+
12
+ //#endregion
1
13
  //#region src/lodash/set.ts
2
14
  const set = (obj, path, value) => {
3
15
  if (obj == null) return obj;
@@ -157,4 +169,4 @@ const uniqBy = (collection, iteratee) => {
157
169
  };
158
170
 
159
171
  //#endregion
160
- export { isDate, isEmpty, isEqual, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
172
+ export { chunk, flatten, isDate, isEmpty, isEqual, isObject, merge, orderBy, set, trim, unescape, uniq, uniqBy };
@@ -26,7 +26,7 @@ var PrismaNamespace = class extends BaseNamespace {
26
26
  } catch (e) {
27
27
  throw new Error(`MariaDB adapter not installed - ${getError(e)}`);
28
28
  }
29
- else try {
29
+ if (this.config.isPostgres) try {
30
30
  const { PrismaPg } = await import("@prisma/adapter-pg");
31
31
  adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL });
32
32
  } catch (e) {
@@ -39,7 +39,7 @@ declare const isUndefined: (instance: any, keys: any | any[]) => boolean;
39
39
  * Chunk a queue of promises into controlled chunks to prevent overloading.
40
40
  * https://stackoverflow.com/a/53964407
41
41
  */
42
- declare const promiseChunks: (promises: Promise<any>[], size: number, sleepSeconds?: number, callbackFunction?: Function) => Promise<any>;
42
+ declare const promiseChunks: (promises: Promise<any>[], size: number, sleepSeconds?: number, callbackFunction?: Function) => Promise<unknown[]>;
43
43
  //#endregion
44
44
  //#region src/util/sleep.d.ts
45
45
  declare const sleep: (seconds: number) => Promise<void>;
@@ -1,6 +1,5 @@
1
- import { isObject } from "../lodash/index.mjs";
1
+ import { chunk, flatten, isObject } from "../lodash/index.mjs";
2
2
  import { getArray } from "../array/index.mjs";
3
- import { chunk, flatten } from "lodash";
4
3
 
5
4
  //#region src/util/defaultTo.ts
6
5
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.3.11",
4
+ "version": "2.3.13",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"