@cofondateurauchomage/libs 1.1.49 → 1.1.51

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.
package/build/api.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IContact, INewsletter, IProject, IProspect, IReactionStatus, IUser, TPlan } from "./db.model";
2
- export type CloudFunctionNames = "createProject" | "updateProject" | "deleteProject" | "activeProject" | "createUser" | "updateUser" | "deleteUser" | "activeUser" | "addStripeId" | "updatePlan" | "addStatsAssociation" | "updateNewsletter" | "createProspect" | "createReaction";
2
+ export type CloudFunctionNames = "createProject" | "updateProject" | "deleteProject" | "activeProject" | "createUser" | "updateUser" | "deleteUser" | "activeUser" | "addStripeId" | "updatePlan" | "addStatsAssociation" | "updateNewsletter" | "createProspect" | "createReaction" | "deleteReaction";
3
3
  export type RouteNames = "checkout_session" | "delete_customer" | "portal_session" | "webhook";
4
4
  export type BodyForO<O extends CloudFunctionNames | RouteNames> = {
5
5
  createProject: Omit<IProject, "id" | "plan" | "active" | "clicks" | "creationDate" | "lastConnection" | "likes" | "stripeId"> & IContact & {
@@ -41,6 +41,9 @@ export type BodyForO<O extends CloudFunctionNames | RouteNames> = {
41
41
  toId: string;
42
42
  status: IReactionStatus;
43
43
  };
44
+ deleteReaction: {
45
+ toId: string;
46
+ };
44
47
  checkout_session: {
45
48
  stripeId?: string;
46
49
  email: string;
@@ -139,6 +139,9 @@ const validatorsForAllRoutes = {
139
139
  toId: (0, validate_1.isString)(),
140
140
  status: reactionStatus,
141
141
  },
142
+ deleteReaction: {
143
+ toId: (0, validate_1.isString)(),
144
+ },
142
145
  //////////
143
146
  // Routes
144
147
  checkout_session: {
@@ -6,3 +6,7 @@ export declare function includes<T extends string>(array: T[], value: string): v
6
6
  * Retourne un array sans valeurs null ou undefined
7
7
  */
8
8
  export declare const compact: <T>(array: (T | null | undefined)[]) => T[];
9
+ /**
10
+ * Divise un tableau en lots de taille maximale
11
+ */
12
+ export declare function chunkArray<T>(array: T[], size: number): T[][];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compact = exports.includes = void 0;
3
+ exports.chunkArray = exports.compact = exports.includes = void 0;
4
4
  /**
5
5
  * Includes typé
6
6
  */
@@ -13,3 +13,14 @@ exports.includes = includes;
13
13
  */
14
14
  const compact = (array) => array.filter(Boolean);
15
15
  exports.compact = compact;
16
+ /**
17
+ * Divise un tableau en lots de taille maximale
18
+ */
19
+ function chunkArray(array, size) {
20
+ const result = [];
21
+ for (let i = 0; i < array.length; i += size) {
22
+ result.push(array.slice(i, i + size));
23
+ }
24
+ return result;
25
+ }
26
+ exports.chunkArray = chunkArray;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofondateurauchomage/libs",
3
- "version": "1.1.49",
3
+ "version": "1.1.51",
4
4
  "description": "",
5
5
  "main": "build/index",
6
6
  "scripts": {