diff --git a/dist/array_chunk.d.ts b/dist/array_chunk.d.ts deleted file mode 100644 index 68ba59c..0000000 --- a/dist/array_chunk.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function chunk(array: T[], size: number): T[][]; diff --git a/dist/array_chunk.js b/dist/array_chunk.js deleted file mode 100644 index 5906e1f..0000000 --- a/dist/array_chunk.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.chunk = void 0; -function chunk(array, size) { - const chunkedArray = []; - let index = 0; - while (index < array.length) { - chunkedArray.push(array.slice(index, index + size)); - index += size; - } - return chunkedArray; -} -exports.chunk = chunk; -//# sourceMappingURL=array_chunk.js.map \ No newline at end of file diff --git a/dist/array_chunk.js.map b/dist/array_chunk.js.map deleted file mode 100644 index ed93ad0..0000000 --- a/dist/array_chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"array_chunk.js","sourceRoot":"","sources":["../src/array_chunk.ts"],"names":[],"mappings":";;;AAAA,SAAgB,KAAK,CAAa,KAAS,EAAE,IAAY;IACrD,MAAM,YAAY,GAAS,EAAE,CAAC;IAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1B,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;QACpD,KAAK,IAAI,IAAI,CAAC;IAClB,CAAC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC;AAVD,sBAUC"} \ No newline at end of file diff --git a/dist/batcher.d.ts b/dist/batcher.d.ts deleted file mode 100644 index 5eeeef3..0000000 --- a/dist/batcher.d.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { BatchFallbackQuery, BatchFallbackSolver } from './batcher.fallback.query'; -export * as Decorators from './batcher.decorator'; -export type BatchJob = { - index: number; - value: string; - pending: number; - total: number; - complete: number; - percent: number; - start: string; - end: string; - duration: number; -}; -export type BatchProgressEvent = BatchJob[]; -export type onProgressCallback = (progress: BatchProgressEvent & any) => void; -export type onEndCallback = (err: any, results: any) => void; -export type Controller = { - id: number; - controller: Function; - description: string; - args: Record; - status: "pending" | "done" | "error"; - result?: ResultOnSuccess; -}; -export type FnControllers = Controller[]; -export interface IBatch { - fn: FnControllers; - events: { - progress: onProgressCallback | null; - end: onEndCallback | null; - }; - /** - * Définis le niveau de concurrence pour le traitement par lots. Il prend un seul paramètre « n » qui représente le nombre de tâches simultanées pouvant être exécutées en même temps. - * En définissant le niveau de simultanéité, vous pouvez contrôler le nombre de tâches traitées simultanément dans le travail par lots. - */ - concurrency(n: number): void; - /** - * La méthode `start()` est responsable du lancement du traitement par lots des contrôleurs en file d'attente. - * Il renvoie une promesse qui se résout lorsque tous les contrôleurs ont été traités. - */ - start(): Promise; - /** - * Définis une fonction qui vous permet de définir une fonction de rappel à exécuter lorsque le traitement par lots des contrôleurs est terminé. - * La méthode `end` prend un seul paramètre `callback` de type `onEndCallback`, qui est une fonction qui accepte une erreur et les résultats comme arguments. - */ - end(callback: onEndCallback): void; - /** - * Définit une fonction qui vous permet de définir une fonction de rappel à exécuter lorsqu'il y a une progression dans le traitement par lots des contrôleurs. - * Le type `onProgressCallback` représente une fonction qui accepte un tableau `BatchProgressEvent` comme argument. - * Ce tableau contient des informations sur la progression de chaque tâche par lots, y compris des détails tels que : - * - l'index - * - la valeur - * - les tâches en attente - * - le total des tâches - * - l'état d'avancement - * - le pourcentage d'achèvement - * - l'heure de début - * - l'heure de fin - * - la durée - */ - progress(callback: onProgressCallback): void; - /** Utilisée pour ajouter une nouvelle fonction de contrôleur à la file d'attente de traitement par lots. */ - push = {}>(controller: Function, arg?: Arguments): number; - createJob = {}>(description: string, controller: Function, arg?: Arguments): number; - /** Utilisée pour enregistrer les écouteurs d'événements pour les événements de progression et de fin dans le système de traitement par lots. */ - on(event: "progress" | "end", callback: onProgressCallback | onEndCallback): void; - /** - * La méthode `solver` dans l'extrait de code définit une fonction qui permet d'ajouter un solveur en tant que requête - * qui ne s'exécutera que si l'élément observé a été exécuté (passage de l'attente à l'état terminé ou état d'erreur) - * @param query - * - * ## Sample - * ```typescript - * - * batcher.push(( args ) => { - * - * let [ arg1 , arg2 ] = args; - * - * return batcher.solver({ - * find : { id : "Controller ID" }, - * args : args, - * on : { - * success : ( next , result ) => { - * - * // DO STUFF WITH RESULT - * - * next( myController( ... ) ) - * - * }, - * pending : ( wait ) => { - * - * // DO STUFF ON ERROR - * // NB : WAIT HAVE TO BE USED - * - * wait(); - * - * } - * error : ( reject ) => { - * - * // DO STUFF ON ERROR - * - * reject(); - * - * } - * } - * }) - * - * } , args) - * - * ``` - */ - solver(query: BatchFallbackQuery): BatchFallbackSolver; - find(id: number): Controller; - updateControllerStatus(controllerId: number, status: Controller["status"]): boolean; - status: "idle" | "running"; - summary: any; - pending: FnControllers; - complete: FnControllers; - error: FnControllers; -} -export declare class _batch implements IBatch { - #private; - get fn(): FnControllers; - get events(): { - progress: onProgressCallback; - end: onEndCallback; - }; - get status(): "idle" | "running"; - get summary(): { - pending: number; - total: number; - complete: number; - error: number; - percent: number; - start: number; - end: number; - duration: number; - concurrency: number; - }; - get pending(): any[]; - get complete(): any[]; - get error(): any[]; - constructor(); - concurrency(n: number): void; - start: () => Promise; - end(callback: onEndCallback): void; - progress(callback: onProgressCallback): void; - push = {}>(controller: Function, args?: Arguments): number; - createJob = {}>(description: string, controller: Function, args?: Arguments): number; - find: (id: number) => Controller; - on(event: "progress" | "end", callback: onProgressCallback | onEndCallback): void; - solver(query: BatchFallbackQuery): BatchFallbackSolver; - updateControllerStatus(controllerId: number, status: Controller["status"]): boolean; - updateControllerResult(controllerId: number, result: any): boolean; -} -export type Batch = IBatch | _batch; -export type BatchConfig = Partial<{ - concurrency: number; - end: onEndCallback; - progress: onProgressCallback; -}>; -export declare function createBatch(config?: BatchConfig): Batch; diff --git a/dist/batcher.decorator.d.ts b/dist/batcher.decorator.d.ts deleted file mode 100644 index f7f6094..0000000 --- a/dist/batcher.decorator.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare function Description(description: string): (target: any) => any; -interface SolverDefinition { -} -export declare function Solver(config?: SolverDefinition): () => void; -export {}; diff --git a/dist/batcher.decorator.js b/dist/batcher.decorator.js deleted file mode 100644 index 51e146b..0000000 --- a/dist/batcher.decorator.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Solver = exports.Description = void 0; -function Description(description) { - return function (target) { - target.prototype.description = description; - return target; - }; -} -exports.Description = Description; -function Solver(config) { - return function () { - }; -} -exports.Solver = Solver; -//# sourceMappingURL=batcher.decorator.js.map \ No newline at end of file diff --git a/dist/batcher.decorator.js.map b/dist/batcher.decorator.js.map deleted file mode 100644 index 0485866..0000000 --- a/dist/batcher.decorator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"batcher.decorator.js","sourceRoot":"","sources":["../src/batcher.decorator.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAE,WAAkB;IAC7C,OAAO,UAAU,MAAM;QAErB,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;QAE3C,OAAO,MAAM,CAAC;IAEhB,CAAC,CAAA;AACH,CAAC;AARD,kCAQC;AAMD,SAAgB,MAAM,CAAE,MAAwB;IAE9C,OAAO;IAEP,CAAC,CAAA;AAEH,CAAC;AAND,wBAMC"} \ No newline at end of file diff --git a/dist/batcher.fallback.query.d.ts b/dist/batcher.fallback.query.d.ts deleted file mode 100644 index 4eb3133..0000000 --- a/dist/batcher.fallback.query.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Batch, Controller } from "."; -export interface BatchFallbackQuery { - find: { - id: number[]; - }; - args: any; - on: { - success: (next: (fn: Promise) => void, reject: (value?: any) => void, result: ResultOnSuccess[]) => any; - pending: (wait: () => void) => any; - error: (reject: (error: any) => void) => any; - }; -} -export declare class _batchFallbackSolver { - batch: Batch; - query: BatchFallbackQuery; - get needs(): any[]; - get needsResult(): any; - get pending(): any; - get resolvable(): any; - constructor(batch: Batch, query: BatchFallbackQuery); - static init(batch: Batch, query: BatchFallbackQuery): BatchFallbackSolver; - _onsuccess: any; - _onerror: any; - _onwait: any; - onSucces: () => (nextController: Promise) => void; - onWait: (request: Controller[]) => () => void; - onError: (controllerId: number) => (value?: any) => void; - onReject: (controllerId: number) => (value?: any) => void; - execute: (controllerId: number) => any; - get find(): ((id: number) => Controller) | ((id: number) => Controller); -} -export interface BatchFallbackSolver extends _batchFallbackSolver { -} diff --git a/dist/batcher.fallback.query.js b/dist/batcher.fallback.query.js deleted file mode 100644 index 00d362a..0000000 --- a/dist/batcher.fallback.query.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports._batchFallbackSolver = void 0; -class _batchFallbackSolver { - get needs() { - return this.query.find.id.reduce((needs, idToFind) => { - let controller = this.batch.find(idToFind); - if (controller) - needs.push(controller); - return needs; - }, []); - } - get needsResult() { - return this.needs.reduce((results, request) => { - results.push(request.result); - return results; - }, []); - } - get pending() { - return this.needs.reduce((result, controller) => { - if (controller.status == 'pending') - result = true; - return result; - }, false); - } - get resolvable() { - return this.needs.reduce((result, controller) => { - if (controller.status == 'error') - result = false; - return result; - }, true); - } - constructor(batch, query) { - this.query = null; - this._onsuccess = null; - this._onerror = null; - this._onwait = null; - this.onSucces = () => { - return (nextController) => { - this._onsuccess = nextController; - }; - }; - this.onWait = (request) => { - return () => { - // console.log('onWait' , { length : this.batch.fn.length }) - // this.batch.push( () => { - // _batchFallbackSolver.init( this.batch , this.query ); - // } ); - // console.log('onWait after push' , { length : this.batch.fn.length }) - }; - }; - this.onError = (controllerId) => { - this.batch.updateControllerStatus(controllerId, 'error'); - return (value) => { - this._onerror = Promise.resolve(value || false); - }; - }; - this.onReject = (controllerId) => { - return (value) => { - this.batch.updateControllerStatus(controllerId, 'error'); - this._onsuccess = Promise.resolve(value || null); - }; - }; - this.execute = (controllerId) => { - var _a, _b, _c; - // Les jobs parents ( interdépendance ) - let needs = this.needs; - // Ce job est-il en attente ? ( dépendant des jobs parents ) - let isPending = this.pending; - // Ce job est-il resolvable ( dépendant des jobs parents ) - let isResolvable = this.resolvable; - // Les resultats actuel des jobs parents - let needsResult = this.needsResult; - if (isPending) { - return (_a = this.query.on) === null || _a === void 0 ? void 0 : _a.pending(this.onWait(needs)); - } - else if (isResolvable) { - (_b = this.query.on) === null || _b === void 0 ? void 0 : _b.success(this.onSucces(), this.onReject(controllerId), needsResult); - if (!this._onsuccess) - this._onsuccess = Promise.reject(console.warn(`REJECT : NO RETURN STATEMENT FOR CONTROLLER ID ${controllerId}`)); - if (this._onsuccess instanceof Promise == false) - this._onsuccess = Promise.resolve(this._onsuccess); - return this._onsuccess; - } - else { - (_c = this.query.on) === null || _c === void 0 ? void 0 : _c.error(this.onError(controllerId)); - if (!this._onerror) - this._onerror = Promise.reject(false); - if (this._onerror instanceof Promise == false) - this._onerror = Promise.reject(this._onerror); - return this._onerror; - } - }; - this.query = query; - Object.assign(this, { - get batch() { return batch; } - }); - } - static init(batch, query) { - return new _batchFallbackSolver(batch, query); - } - get find() { return this.batch.find; } -} -exports._batchFallbackSolver = _batchFallbackSolver; -; -//# sourceMappingURL=batcher.fallback.query.js.map \ No newline at end of file diff --git a/dist/batcher.fallback.query.js.map b/dist/batcher.fallback.query.js.map deleted file mode 100644 index d02e38c..0000000 --- a/dist/batcher.fallback.query.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"batcher.fallback.query.js","sourceRoot":"","sources":["../src/batcher.fallback.query.ts"],"names":[],"mappings":";;;AAYA,MAAa,oBAAoB;IAK/B,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAE,CAAE,KAAK,EAAG,QAAQ,EAAG,EAAE;YACvD,IAAI,UAAU,GAAG,IAA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0ED,IAAI,IAAI,KAAI,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA,CAAC,CAAC;CAErC;AA1HD,oDA0HC;AAE8G,CAAC"} \ No newline at end of file diff --git a/dist/batcher.flow.d.ts b/dist/batcher.flow.d.ts deleted file mode 100644 index af69c7a..0000000 --- a/dist/batcher.flow.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { BatchConfig, Batch, onProgressCallback } from './batcher'; -import { BatchFallbackSolver } from './batcher.fallback.query'; -import { BatcherJob } from './batcher.job'; -export declare class BatcherMergedStep { - flow: BatcherWorkflow; - get batch(): Batch; - jobs: ((BatcherWorkflowStep) | (BatcherWorkflowLinkStep))[]; - jobControllersId: number[]; - constructor(flow: BatcherWorkflow, steps: ((BatcherWorkflowStep) | (BatcherWorkflowLinkStep))[]); - static init(flow: BatcherWorkflow, steps: ((BatcherWorkflowStep) | (BatcherWorkflowLinkStep))[]): BatcherMergedStep; - next = {}, Result = any>(job: typeof BatcherJob, args: Arguments): void; -} -export declare class BatcherWorkflowStep = {}> { - args: Arguments; - flow: BatcherWorkflow; - get batch(): Batch; - job: typeof BatcherJob, any>; - jobController: (((args: Record) => Promise) | ((...args: []) => BatchFallbackSolver)); - jobControllerId: number; - linked: Map; - constructor(flow: BatcherWorkflow, job: typeof BatcherJob, any>, args: Arguments); - next = {}, Result = any>(job: typeof BatcherJob, args: Arguments): BatcherWorkflowLinkStep; -} -export declare class BatcherWorkflowLinkStep = {}, Result = any> extends BatcherWorkflowStep { - parent_step: BatcherWorkflowStep | BatcherWorkflowLinkStep; - needs: number[]; - constructor(step: BatcherWorkflowStep | BatcherWorkflowLinkStep, job: typeof BatcherJob, any>, args: Arguments); -} -export declare class BatcherWorkflowStepConsumer = {}, Result = any> extends BatcherWorkflowStep { -} -export interface IBatcherWorkflowConfig { - batch: Batch; -} -export declare class BatcherWorkflow { - batch: Batch; - entries: Map; - static init(config: BatchConfig): BatcherWorkflow; - constructor(config: IBatcherWorkflowConfig); - step = {}, Result = any>(job: typeof BatcherJob, args: Arguments): BatcherWorkflowStep; - start(callback?: onProgressCallback): Promise; - onProgress(callback: onProgressCallback): void; - useSteps(steps: ((BatcherWorkflowStep) | (BatcherWorkflowLinkStep))[]): BatcherMergedStep; -} diff --git a/dist/batcher.flow.js b/dist/batcher.flow.js deleted file mode 100644 index e470724..0000000 --- a/dist/batcher.flow.js +++ /dev/null @@ -1,101 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BatcherWorkflow = exports.BatcherWorkflowStepConsumer = exports.BatcherWorkflowLinkStep = exports.BatcherWorkflowStep = exports.BatcherMergedStep = void 0; -const batcher_1 = require("./batcher"); -class BatcherMergedStep { - // Getter du batcher responsable des jobs - get batch() { return this.flow.batch; } - constructor(flow, steps) { - // Context d'éxécution du Flow - this.flow = null; - this.jobControllersId = []; - this.flow = flow; - this.jobControllersId = steps.reduce((ids, step) => { - ids.push(step.jobControllerId); - return ids; - }, []); - } - static init(flow, steps) { - return new BatcherMergedStep(flow, steps); - } - next(job, args) { - let linked_step = new BatcherWorkflowLinkStep(this.jobs[0], job, args); - this.jobs.forEach((job) => { - job.linked.set(`${linked_step.jobControllerId}`, job); - }); - } -} -exports.BatcherMergedStep = BatcherMergedStep; -class BatcherWorkflowStep { - // Getter du batcher responsable des jobs - get batch() { return this.flow.batch; } - constructor(flow, job, args) { - // Argument de l'étape - this.args = null; - // Context d'éxécution du Flow - this.flow = null; - // Job de l'étpe - this.job = null; - // Controller exécutable du job - this.jobController = null; - // JobId au seins du batcher - this.jobControllerId = null; - // Jobs enfants de l'étape - this.linked = new Map(); - this.flow = flow; - this.args = args; - this.job = job; - if (this instanceof BatcherWorkflowStep) { - this.jobController = new job().execute; - this.jobControllerId = this.batch.push(this.jobController, args); - } - } - next(job, args) { - return new BatcherWorkflowLinkStep(this, job, args); - } -} -exports.BatcherWorkflowStep = BatcherWorkflowStep; -class BatcherWorkflowLinkStep extends BatcherWorkflowStep { - constructor(step, job, args) { - super(step.flow, job, args); - this.needs = []; - this.parent_step = step; - this.parent_step.linked.set(`${this.jobControllerId}`, this); - this.needs.push(this.parent_step.jobControllerId); - if (this instanceof BatcherWorkflowLinkStep) { - this.jobController = new job().solver(this.batch, this.needs); - } - } -} -exports.BatcherWorkflowLinkStep = BatcherWorkflowLinkStep; -class BatcherWorkflowStepConsumer extends BatcherWorkflowStep { -} -exports.BatcherWorkflowStepConsumer = BatcherWorkflowStepConsumer; -class BatcherWorkflow { - static init(config) { - return new BatcherWorkflow({ batch: (0, batcher_1.createBatch)(config) }); - } - constructor(config) { - this.batch = null; - this.entries = new Map(); - Object.assign(this, config); - } - step(job, args) { - let entryId = this.entries.size; - this.entries.set(`${entryId}`, new BatcherWorkflowStep(this, job, args)); - return this.entries.get(`${entryId}`); - } - start(callback) { - if (callback) - this.batch.on('progress', callback); - return this.batch.start(); - } - onProgress(callback) { - this.batch.on('progress', callback); - } - useSteps(steps) { - return BatcherMergedStep.init(this, steps); - } -} -exports.BatcherWorkflow = BatcherWorkflow; -//# sourceMappingURL=batcher.flow.js.map \ No newline at end of file diff --git a/dist/batcher.flow.js.map b/dist/batcher.flow.js.map deleted file mode 100644 index 0f334c6..0000000 --- a/dist/batcher.flow.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"batcher.flow.js","sourceRoot":"","sources":["../src/batcher.flow.ts"],"names":[],"mappings":";;;AAAA,uCAAkF;AAIlF,MAAa,iBAAiB;IAI5B,yCAAyC;IACzC,IAAI,KAAK,KAAI,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAItC,YAAa,IAAsB,EAAG,KAAiE;QAPvG,8BAA8B;QAC9B,SAAI,GAAmB,IAAI,CAAC;QAI5B,qBAAgB,GAAY,EAAE,CAAC;QAG7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC,CAAE,GAAG,EAAG,IAAI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IAEjE,CAAC;IAED,YAAa,MAA6B;QAV1C,UAAK,GAAS,IAAI,CAAC;QAEnB,YAAO,GAAuB,IAAI,GAAG,EAAE,CAAC;QAStC,MAAM,CAAC,MAAM,CAAE,IAAI,EAAG,MAAM,CAAE,CAAC;IACjC,CAAC;IAED,IAAI,CAAkE,GAA4C,EAAG,IAAc;QACjI,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAE,GAAG,OAAO,EAAE,EAAG,IAAI,mBAAmB,CAAe,IAAI,EAAG,GAAG,EAAG,IAAI,CAAE,CAAE,CAAC;QAC7F,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAE,GAAG,OAAO,EAAE,CAAE,CAAC;IAC1C,CAAC;IAED,KAAK,CAAE,QAA4B;QAEjC,IAAG,QAAQ;YAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,EAAG,QAAQ,CAAE,CAAC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAE5B,CAAC;IAED,UAAU,CAAE,QAA2B;QACrC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,EAAG,QAAQ,CAAE,CAAC;IACxC,CAAC;IAED,QAAQ,CAAE,KAAiE;QACzE,OAAO,iBAAiB,CAAC,IAAI,CAAE,IAAI,EAAG,KAAK,CAAE,CAAC;IAChD,CAAC;CAEF;AArCD,0CAqCC"} \ No newline at end of file diff --git a/dist/batcher.flow.v2.d.ts b/dist/batcher.flow.v2.d.ts deleted file mode 100644 index 9e56ab4..0000000 --- a/dist/batcher.flow.v2.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { BatchConfig, Batch, onProgressCallback } from './batcher'; -import { BatchFallbackSolver } from './batcher.fallback.query'; -import { BatcherJob } from './batcher.job'; -type BindedArguments = { - [Key in keyof Arguments]: (Arguments[Key]) | ((x: ConsumerResults) => Arguments[Key]); -}; -export declare class WorkflowJobStep = {}> { - stepArgs: Arguments; - workflow: BatcherWorkflow; - get batch(): Batch; - job: typeof BatcherJob, any>; - jobExecutor: ((args: Record) => Promise) | ((...args: []) => BatchFallbackSolver); - jobId: number; - constructor(workflow: BatcherWorkflow, job: typeof BatcherJob, any>, stepArgs: Arguments); -} -export declare class WorkflowJobConsumer = {}> { - consumerArgs: Arguments; - workflow: BatcherWorkflow; - get batch(): Batch; - targets: any; - job: typeof BatcherJob, any>; - jobSolver: ((...args: []) => BatchFallbackSolver); - jobId: number; - dependencyIds: number[]; - constructor(workflow: BatcherWorkflow, targets: (WorkflowJobStep | WorkflowJobConsumer)[], job: typeof BatcherJob, consumerArgs: Arguments); - static init = {}>(workflow: BatcherWorkflow, targets: (WorkflowJobStep | WorkflowJobConsumer)[], job: typeof BatcherJob, consumerArgs: Arguments): WorkflowJobConsumer; -} -export interface BatcherWorkflowConfig { - batch: Batch; -} -export declare class BatcherWorkflow { - batch: Batch; - steps: Map; - static init(config: BatchConfig): BatcherWorkflow; - constructor(config: BatcherWorkflowConfig); - step = {}, Result = any>(job: typeof BatcherJob, stepArgs: Arguments): WorkflowJobStep; - start(callback?: onProgressCallback): Promise; - onProgress(callback: onProgressCallback): void; - consumer = {}, Result = any>(steps: (WorkflowJobStep | WorkflowJobConsumer)[], job: typeof BatcherJob, consumerArgs: BindedArguments): WorkflowJobConsumer>; -} -export {}; diff --git a/dist/batcher.flow.v2.js b/dist/batcher.flow.v2.js deleted file mode 100644 index 4bee074..0000000 --- a/dist/batcher.flow.v2.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BatcherWorkflow = exports.WorkflowJobConsumer = exports.WorkflowJobStep = void 0; -const batcher_1 = require("./batcher"); -class WorkflowJobStep { - // Getter for the batcher responsible for jobs - get batch() { return this.workflow.batch; } - constructor(workflow, job, stepArgs) { - // Arguments of the step - this.stepArgs = null; - // Execution context of the Flow - this.workflow = null; - // Job of the step - this.job = null; - // Executable job controller - this.jobExecutor = null; - // Job ID within the batcher - this.jobId = null; - this.workflow = workflow; - this.stepArgs = stepArgs; - this.job = job; - if (this instanceof WorkflowJobStep) { - this.jobExecutor = new job().execute; - this.jobId = this.batch.push(this.jobExecutor, stepArgs); - } - } -} -exports.WorkflowJobStep = WorkflowJobStep; -class WorkflowJobConsumer { - get batch() { return this.workflow.batch; } - constructor(workflow, targets, job, consumerArgs) { - this.consumerArgs = null; - this.workflow = null; - this.job = null; - this.jobSolver = null; - this.jobId = null; - this.dependencyIds = []; - this.workflow = workflow; - this.targets = targets; - this.job = job; - this.consumerArgs = consumerArgs; - this.dependencyIds = targets.reduce((ids, target) => { - ids.push(target.jobId); - return ids; - }, []); - if (this instanceof WorkflowJobConsumer) { - this.jobSolver = new job().solver(this.batch, this.dependencyIds); - this.jobId = this.batch.push(this.jobSolver, consumerArgs); - } - } - static init(workflow, targets, job, consumerArgs) { - return new WorkflowJobConsumer(workflow, targets, job, consumerArgs); - } -} -exports.WorkflowJobConsumer = WorkflowJobConsumer; -class BatcherWorkflow { - static init(config) { - return new BatcherWorkflow({ batch: (0, batcher_1.createBatch)(config) }); - } - constructor(config) { - this.batch = null; - this.steps = new Map(); - Object.assign(this, config); - } - step(job, stepArgs) { - return new WorkflowJobStep(this, job, stepArgs); - } - start(callback) { - if (callback) - this.batch.on('progress', callback); - return this.batch.start(); - } - onProgress(callback) { - this.batch.on('progress', callback); - } - consumer(steps, job, consumerArgs) { - return WorkflowJobConsumer.init(this, steps, job, consumerArgs); - } -} -exports.BatcherWorkflow = BatcherWorkflow; -//# sourceMappingURL=batcher.flow.v2.js.map \ No newline at end of file diff --git a/dist/batcher.flow.v2.js.map b/dist/batcher.flow.v2.js.map deleted file mode 100644 index 7027d74..0000000 --- a/dist/batcher.flow.v2.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"batcher.flow.v2.js","sourceRoot":"","sources":["../src/batcher.flow.v2.ts"],"names":[],"mappings":";;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AAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,QAA6B;QACjC,IAAI,QAAQ;YAAE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED,UAAU,CAAC,QAA4B;QACrC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ,CAAmF,KAAgD,EAAE,GAAyC,EAAE,YAA0D;QAChP,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,CAAC;IAClE,CAAC;CAEF;AA9BD,0CA8BC"} \ No newline at end of file diff --git a/dist/batcher.job.d.ts b/dist/batcher.job.d.ts deleted file mode 100644 index 6f2c95d..0000000 --- a/dist/batcher.job.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { Batch } from "./batcher"; -import { BatchFallbackSolver } from "./batcher.fallback.query"; -export declare class BatcherJob = {}, Result = any> { - execute(args: Arguments): Promise; - solver(batch: Batch, needs: number[]): () => BatchFallbackSolver; -} diff --git a/dist/batcher.job.js b/dist/batcher.job.js deleted file mode 100644 index bfeadee..0000000 --- a/dist/batcher.job.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BatcherJob = void 0; -class BatcherJob { - execute(args) { - return Promise.resolve(null); - } - solver(batch, needs) { - return (...args) => { - return batch.solver({ - find: { id: needs }, - args: args, - on: { - success(next, reject, result) { - try { - next(this.execute); - } - catch (error) { - reject(error); - } - }, - error(reject) { - reject(false); - }, - pending(wait) { - wait(); - }, - } - }); - }; - } -} -exports.BatcherJob = BatcherJob; -//# sourceMappingURL=batcher.job.js.map \ No newline at end of file diff --git a/dist/batcher.job.js.map b/dist/batcher.job.js.map deleted file mode 100644 index 296393c..0000000 --- a/dist/batcher.job.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"batcher.job.js","sourceRoot":"","sources":["../src/batcher.job.ts"],"names":[],"mappings":";;;AAGA,MAAa,UAAU;IAErB,OAAO,CAAE,IAAc;QACrB,OAAO,OAAO,CAAC,OAAO,CAAE,IAAI,CAAE,CAAC;IACjC,CAAC;IAED,MAAM,CAAE,KAAW,EAAG,KAAc;QAClC,OAAO,CAAE,GAAG,IAAO,EAAG,EAAE;YACtB,OAAO,KAAK,CAAC,MAAM,CAAC;gBAClB,IAAI,EAAG,EAAE,EAAE,EAAG,KAAK,EAAE;gBACrB,IAAI,EAAG,IAAI;gBACX,EAAE,EAAG;oBACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM;wBAE1B,IAAG,CAAC;4BACF,IAAI,CAAE,IAAI,CAAC,OAAO,CAAE,CAAA;wBACtB,CAAC;wBAAA,OAAM,KAAK,EAAC,CAAC;4BACZ,MAAM,CAAC,KAAK,CAAC,CAAC;wBAChB,CAAC;oBAEH,CAAC;oBACD,KAAK,CAAC,MAAM;wBACV,MAAM,CAAC,KAAK,CAAC,CAAA;oBACf,CAAC;oBACD,OAAO,CAAC,IAAI;wBACV,IAAI,EAAE,CAAC;oBACT,CAAC;iBACF;aACF,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CAEF;AAhCD,gCAgCC"} \ No newline at end of file diff --git a/dist/batcher.js b/dist/batcher.js deleted file mode 100644 index e3c4562..0000000 --- a/dist/batcher.js +++ /dev/null @@ -1,264 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var __batch__fn, __batch__events, __batch__concurrency, __batch__status, __batch__running_jobStartEventTime, __batch__running_jobLastEventTime; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createBatch = exports._batch = exports.Decorators = void 0; -const array_chunk_1 = require("./array_chunk"); -const batcher_fallback_query_1 = require("./batcher.fallback.query"); -exports.Decorators = __importStar(require("./batcher.decorator")); -/* La classe `_batch` dans TypeScript implémente un système de traitement par lots avec contrôle de -concurrence, suivi de la progression et gestion des événements. */ -class _batch { - get fn() { return __classPrivateFieldGet(this, __batch__fn, "f"); } - ; - get events() { return __classPrivateFieldGet(this, __batch__events, "f"); } - ; - get status() { return __classPrivateFieldGet(this, __batch__status, "f"); } - ; - get summary() { - let pending = this.pending.length, total = this.fn.length, complete = this.complete.length, error = this.error.length; - return { - pending: pending, - total: total, - complete: complete, - error: error, - percent: Math.round(100 - ((pending / total) * 100)), - start: __classPrivateFieldGet(this, __batch__running_jobStartEventTime, "f"), - end: __classPrivateFieldGet(this, __batch__running_jobLastEventTime, "f"), - duration: __classPrivateFieldGet(this, __batch__running_jobLastEventTime, "f") - __classPrivateFieldGet(this, __batch__running_jobLastEventTime, "f"), - concurrency: __classPrivateFieldGet(this, __batch__concurrency, "f") - }; - } - get pending() { - return __classPrivateFieldGet(this, __batch__fn, "f").reduce((result, controller) => { - if (controller.status == "pending") - result.push(controller); - return result; - }, []); - } - get complete() { - return __classPrivateFieldGet(this, __batch__fn, "f").reduce((result, controller) => { - if (controller.status == "done") - result.push(controller); - return result; - }, []); - } - get error() { - return __classPrivateFieldGet(this, __batch__fn, "f").reduce((result, controller) => { - if (controller.status == "error") - result.push(controller); - return result; - }, []); - } - constructor() { - __batch__fn.set(this, []); - __batch__events.set(this, { - progress: null, - end: null - }); - __batch__concurrency.set(this, 4); - __batch__status.set(this, "idle"); - __batch__running_jobStartEventTime.set(this, null); - __batch__running_jobLastEventTime.set(this, null); - this.start = () => __awaiter(this, void 0, void 0, function* () { - if (__classPrivateFieldGet(this, __batch__status, "f") == "running") - return; - __classPrivateFieldSet(this, __batch__status, "running", "f"); - __classPrivateFieldSet(this, __batch__running_jobStartEventTime, Date.now(), "f"); - let chunks = (0, array_chunk_1.chunk)(__classPrivateFieldGet(this, __batch__fn, "f"), __classPrivateFieldGet(this, __batch__concurrency, "f")); - let results = []; - return new Promise((final) => { - return Promise.all(Array.from(chunks, (chunk, chunkId) => { - return new Promise((next, reject) => __awaiter(this, void 0, void 0, function* () { - Promise.all(chunk.reduce((result, controller) => { - let control = controller.controller(controller.args); - // Ne process pas ce controll qui et done - if (controller.status && (controller.status == "done" || controller.status == "error")) - control = Promise.resolve(controller.result); - // Recuperation du controller du solver pour l'attribuer à la pille des exécution à effectuer - if (control instanceof batcher_fallback_query_1._batchFallbackSolver) { - let result = control.execute(controller.id); - if (result instanceof Promise) { - control = result; - } - } - return [...result, control]; - }, [])) - .then((request_results) => { - // console.log({ request_results }) - results.push(request_results); - chunks[chunkId].forEach((controller, i) => { - let result = request_results[i]; - let status = __classPrivateFieldGet(this, __batch__fn, "f")[controller.id].status; - // Si le résultat est encore un solver , passage du status à 'pending'. - if (result instanceof batcher_fallback_query_1._batchFallbackSolver) { - status = 'pending'; - } - // Sinon si le status est `pending` ( pas `done` ou `error` ), passage à `done`. - else if (status == "pending") - status = 'done'; - this.updateControllerStatus(controller.id, status); - this.updateControllerResult(controller.id, request_results[i]); - // this.#_fn[ controller.id ] = { - // ...this.#_fn[ controller.id ], - // result : request_results[i], - // status : status, - // } - }); - }) - .catch((error) => { - // console.log({ error }); - results.push(error); - for (let controller of chunks[chunkId]) { - __classPrivateFieldGet(this, __batch__fn, "f")[controller.id] = Object.assign(Object.assign({}, __classPrivateFieldGet(this, __batch__fn, "f")[controller.id]), { status: "error" }); - } - }) - .finally(() => { - __classPrivateFieldSet(this, __batch__running_jobLastEventTime, Date.now(), "f"); - let progress = Object.assign(Object.assign({}, this.summary), { chunk: results.length, lastChunk: results[results.length - 1] }); - if (__classPrivateFieldGet(this, __batch__events, "f")["progress"]) { - __classPrivateFieldGet(this, __batch__events, "f")["progress"](progress); - } - next(progress); - }); - })); - })) - .finally(() => __awaiter(this, void 0, void 0, function* () { - let stillPending = __classPrivateFieldGet(this, __batch__fn, "f").reduce((result, request) => { - // console.log({ request }) - if (request.status == 'pending') - result.push(true); - return result; - }, []).includes(true); - console.log({ stillPending }); - if (stillPending) { - __classPrivateFieldSet(this, __batch__status, "idle", "f"); - final(this.start()); - } - else { - if (__classPrivateFieldGet(this, __batch__events, "f")["end"]) { - __classPrivateFieldGet(this, __batch__events, "f")["end"](results, null); - } - __classPrivateFieldSet(this, __batch__running_jobStartEventTime, null, "f"); - __classPrivateFieldSet(this, __batch__running_jobLastEventTime, null, "f"); - // this.#_fn = []; - __classPrivateFieldSet(this, __batch__status, "idle", "f"); - final(results); - } - })); - }); - }); - this.find = (id) => { - return __classPrivateFieldGet(this, __batch__fn, "f").find((controller, iterator) => { - if (controller.id == id) - return controller; - }); - }; - } - concurrency(n) { - __classPrivateFieldSet(this, __batch__concurrency, n, "f"); - } - end(callback) { - __classPrivateFieldGet(this, __batch__events, "f").end = callback; - } - progress(callback) { - __classPrivateFieldGet(this, __batch__events, "f").progress = callback; - } - push(controller, args) { - __classPrivateFieldGet(this, __batch__fn, "f").push({ - id: __classPrivateFieldGet(this, __batch__fn, "f").length, - controller: controller, - description: `job ${__classPrivateFieldGet(this, __batch__fn, "f").length}`, - args: args || null, - status: 'pending' - }); - return __classPrivateFieldGet(this, __batch__fn, "f")[__classPrivateFieldGet(this, __batch__fn, "f").length - 1].id; - } - createJob(description, controller, args) { - __classPrivateFieldGet(this, __batch__fn, "f").push({ - id: __classPrivateFieldGet(this, __batch__fn, "f").length, - controller: controller, - description: description, - args: args || null, - status: 'pending' - }); - return __classPrivateFieldGet(this, __batch__fn, "f")[__classPrivateFieldGet(this, __batch__fn, "f").length - 1].id; - } - on(event, callback) { - if (event in __classPrivateFieldGet(this, __batch__events, "f")) - __classPrivateFieldGet(this, __batch__events, "f")[event] = callback; - } - solver(query) { - return batcher_fallback_query_1._batchFallbackSolver.init(this, query); - } - updateControllerStatus(controllerId, status) { - if (__classPrivateFieldGet(this, __batch__fn, "f")[controllerId]) { - __classPrivateFieldGet(this, __batch__fn, "f")[controllerId].status = status; - return true; - } - return false; - } - updateControllerResult(controllerId, result) { - if (__classPrivateFieldGet(this, __batch__fn, "f")[controllerId]) { - __classPrivateFieldGet(this, __batch__fn, "f")[controllerId].result = result; - return true; - } - return false; - } -} -exports._batch = _batch; -__batch__fn = new WeakMap(), __batch__events = new WeakMap(), __batch__concurrency = new WeakMap(), __batch__status = new WeakMap(), __batch__running_jobStartEventTime = new WeakMap(), __batch__running_jobLastEventTime = new WeakMap(); -function createBatch(config) { - let batch = new _batch(); - if (config === null || config === void 0 ? void 0 : config.concurrency) - batch.concurrency(config.concurrency); - if (config === null || config === void 0 ? void 0 : config.end) - batch.end(config.end); - if (config === null || config === void 0 ? void 0 : config.progress) - batch.progress(config.progress); - return batch; -} -exports.createBatch = createBatch; -//# sourceMappingURL=batcher.js.map \ No newline at end of file diff --git a/dist/batcher.js.map b/dist/batcher.js.map deleted file mode 100644 index 4104c14..0000000 --- a/dist/batcher.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"batcher.js","sourceRoot":"","sources":["../src/batcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAsC;AACtC,qEAAyG;AAEzG,kEAAkD;AAmJlD;kEACkE;AAClE,MAAa,MAAM;IAajB,IAAI,EAAE,KAAI,OAAO,uBAAA,IAAI,mBAAK,CAAA,CAAC,CAAC;IAAA,CAAC;IAC7B,IAAI,MAAM,KAAI,OAAO,uBAAA,IAAI,uBAAS,CAAA,CAAC,CAAC;IAAA,CAAC;IACrC,IAAI,MAAM,KAAI,OAAO,uBAAA,IAAI,uBAAS,CAAA,CAAC,CAAC;IAAA,CAAC;IAErC,IAAI,OAAO;QAET,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EACjC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,EACtB,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAC/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,YAAmB,EAAG,MAAU;QACtD,IAAG,uBAAA,IAAI,mBAAK,CAAE,YAAY,CAAE,EAAC,CAAC;YAC5B,uBAAA,IAAI,mBAAK,CAAE,YAAY,CAAE,CAAC,MAAM,GAAG,MAAM,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CAEF;AAzQD,wBAyQC;;AAUD,SAAgB,WAAW,CAAE,MAAmB;IAE9C,IAAI,KAAK,GAAG,IAAI,MAAM,EAAE,CAAC;IAEzB,IAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW;QAAC,KAAK,CAAC,WAAW,CAAE,MAAM,CAAC,WAAW,CAAE,CAAC;IAC/D,IAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG;QAAC,KAAK,CAAC,GAAG,CAAE,MAAM,CAAC,GAAG,CAAE,CAAC;IACvC,IAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ;QAAC,KAAK,CAAC,QAAQ,CAAE,MAAM,CAAC,QAAQ,CAAE,CAAC;IAEtD,OAAO,KAAK,CAAC;AAEf,CAAC;AAVD,kCAUC"} \ No newline at end of file diff --git a/dist/config.d.ts b/dist/config.d.ts deleted file mode 100644 index 1a6724f..0000000 --- a/dist/config.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export interface IFactoryConfig { - /** Server portocol */ - protocol: "http:" | "https:"; - /** Server host */ - host: string; - /** Server port */ - port?: number; - /** Server url */ - url: string; - /** Return server url config with relative path */ - compose: (relativePath: string) => string; -} -export declare const FactoryConfig: IFactoryConfig; -export declare const getFactoryProtocol: () => "http:" | "https:"; -export declare const getFactoryHostname: () => string; -export declare const getFactoryPort: () => number; -export declare const getFactoryURL: () => string; -export declare const composeFromFactory: (relativePath: string) => string; diff --git a/dist/config.js b/dist/config.js deleted file mode 100644 index a130f4e..0000000 --- a/dist/config.js +++ /dev/null @@ -1,27 +0,0 @@ -"use strict"; -var _a; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.composeFromFactory = exports.getFactoryURL = exports.getFactoryPort = exports.getFactoryHostname = exports.getFactoryProtocol = exports.FactoryConfig = void 0; -let { protocol, hostname } = ((_a = globalThis === null || globalThis === void 0 ? void 0 : globalThis.window) === null || _a === void 0 ? void 0 : _a.location) || { protocol: 'https:', hostname: 'localhost' }; -exports.FactoryConfig = { - protocol: protocol, - host: hostname, - get port() { return (hostname == 'localhost' ? 8080 : null); }, - get url() { - return `${this.protocol}//${this.host}${this.port ? `:${this.port}` : ''}`; - }, - compose(relativePath) { - return `${this.url}${relativePath}`; - }, -}; -const getFactoryProtocol = () => { return exports.FactoryConfig.protocol; }; -exports.getFactoryProtocol = getFactoryProtocol; -const getFactoryHostname = () => { return exports.FactoryConfig.host; }; -exports.getFactoryHostname = getFactoryHostname; -const getFactoryPort = () => { return exports.FactoryConfig.port; }; -exports.getFactoryPort = getFactoryPort; -const getFactoryURL = () => { return exports.FactoryConfig.url; }; -exports.getFactoryURL = getFactoryURL; -const composeFromFactory = (relativePath) => { return exports.FactoryConfig.compose(relativePath); }; -exports.composeFromFactory = composeFromFactory; -//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/dist/config.js.map b/dist/config.js.map deleted file mode 100644 index 3f2effa..0000000 --- a/dist/config.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;AAaA,IAAI,EAAE,QAAQ,EAAG,QAAQ,EAAE,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,0CAAE,QAAQ,KAAI,EAAE,QAAQ,EAAG,QAAQ,EAAG,QAAQ,EAAG,WAAW,EAAE,CAAC;AAElG,QAAA,aAAa,GAAkB;IAC1C,QAAQ,EAAG,QAA8B;IACzC,IAAI,EAAC,QAAQ;IACb,IAAI,IAAI,KAAI,OAAO,CAAE,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC;IAC7D,IAAI,GAAG;QACL,OAAO,GAAG,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC7E,CAAC;IACD,OAAO,CAAC,YAAmB;QACzB,OAAO,GAAG,IAAI,CAAC,GAAG,GAAG,YAAY,EAAE,CAAC;IACtC,CAAC;CACF,CAAC;AAEK,MAAM,kBAAkB,GAAG,GAAG,EAAE,GAAG,OAAO,qBAAa,CAAC,QAAQ,CAAA,CAAC,CAAC,CAAC;AAA7D,QAAA,kBAAkB,sBAA2C;AACnE,MAAM,kBAAkB,GAAG,GAAG,EAAE,GAAG,OAAO,qBAAa,CAAC,IAAI,CAAA,CAAC,CAAC,CAAC;AAAzD,QAAA,kBAAkB,sBAAuC;AAC/D,MAAM,cAAc,GAAG,GAAG,EAAE,GAAG,OAAO,qBAAa,CAAC,IAAI,CAAA,CAAC,CAAC,CAAC;AAArD,QAAA,cAAc,kBAAuC;AAC3D,MAAM,aAAa,GAAG,GAAG,EAAE,GAAG,OAAO,qBAAa,CAAC,GAAG,CAAA,CAAC,CAAC,CAAC;AAAnD,QAAA,aAAa,iBAAsC;AACzD,MAAM,kBAAkB,GAAG,CAAC,YAAmB,EAAE,EAAE,GAAG,OAAO,qBAAa,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA,CAAC,CAAC,CAAC;AAA7F,QAAA,kBAAkB,sBAA2E"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 59e8e22..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export * from './config'; -export * from './request'; -export * from './batcher'; -/** - * Fonction de requête HTTP réutilisable créée par FetchFactory. - * @param endpoint - L'URL de l'endpoint à appeler. - * @param data - Les données à envoyer avec la requête (facultatif). - * @returns Une promesse qui résout avec les données de la réponse. -*/ -export type TFetchFactory = (optionalHeaders?: HeadersInit) => (endpoint: string, data?: any) => Promise; -/** - * Spécifie les propriétés attendues par la fonction FetchFactory pour configurer une requête HTTP. - */ -export interface IFetchFactory { - /** La fonction utilisée pour effectuer la requête HTTP. */ - caller: Function; - /** La méthode de la requête HTTP (GET, POST, PATCH ou DELETE). */ - method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; - /** Les en-têtes de la requête HTTP. */ - headers?: HeadersInit; - parser?: (response: any) => any; -} -/** - * Crée une fonction réutilisable pour effectuer des requêtes HTTP avec des options spécifiques. - * @param options - Les options de la requête HTTP, définies par l'interface IFetchFactory. - * @returns Une fonction qui renvoie une promesse contenant les données de la réponse. - */ -export declare const FetchFactory: = any>(options: IFetchFactory) => = any, OutputData = any>(optionalHeaders?: HeadersInit) => (endpoint: string, data?: InputData) => Promise; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6a44298..0000000 --- a/dist/index.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FetchFactory = void 0; -__exportStar(require("./config"), exports); -__exportStar(require("./request"), exports); -__exportStar(require("./batcher"), exports); -/** - * Crée une fonction réutilisable pour effectuer des requêtes HTTP avec des options spécifiques. - * @param options - Les options de la requête HTTP, définies par l'interface IFetchFactory. - * @returns Une fonction qui renvoie une promesse contenant les données de la réponse. - */ -const FetchFactory = (options) => { - if ('headers' in options == false) - options.headers = {}; - /** - * Fonction de requête HTTP réutilisable créée par FetchFactory. - * @param endpoint - L'URL de l'endpoint à appeler. - * @param data - Les données à envoyer avec la requête (facultatif). - * @returns Une promesse qui résout avec les données de la réponse. - */ - return function (optionalHeaders) { - return (endpoint, data) => { - return new Promise((next, reject) => { - options.caller(endpoint, Object.assign({ method: options.method, headers: Object.assign(Object.assign({}, options.headers || {}), optionalHeaders || {}) }, (data ? { - body: (typeof data == 'string' ? data : JSON.stringify(data)) - } : {}))) - .then((result) => __awaiter(this, void 0, void 0, function* () { - try { - if (options.parser) - Object.assign(result, { output_data: yield options.parser(result) }); - } - catch (error) { - console.error(error); - } - next(result); - })) - .catch(reject); - }); - }; - }; -}; -exports.FetchFactory = FetchFactory; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 2bb143e..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAE1B,4CAA0B;AAuB1B;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAwD,OAAqB,EAAE,EAAE;IAE3G,IAAG,SAAS,IAAI,OAAO,IAAI,KAAK;QAAC,OAAO,CAAC,OAAO,GAAG,EAAE,CAAC;IAEtD;;;;;OAKG;IACH,OAAO,UAA6E,eAA4B;QAE9G,OAAO,CAAE,QAAe,EAAG,IAAe,EAA4D,EAAE;YAEtG,OAAO,IAAI,OAAO,CAAC,CAAC,IAAI,EAAC,MAAM,EAAE,EAAE;gBACjC,OAAO,CAAC,MAAM,CAAE,QAAQ,kBACtB,MAAM,EAAG,OAAO,CAAC,MAAM,EACvB,OAAO,kCAAQ,OAAO,CAAC,OAAO,IAAI,EAAE,GAAM,eAAe,IAAI,EAAE,KAC5D,CAAE,IAAI,CAAC,CAAC,CAAC;oBACV,IAAI,EAAG,CAAE,OAAO,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAE;iBACjE,CAAC,CAAC,CAAC,EAAE,CAAE,EACP;qBACF,IAAI,CAAC,CAAO,MAAqB,EAAE,EAAE;oBAEpC,IAAG,CAAC;wBACF,IAAG,OAAO,CAAC,MAAM;4BAAC,MAAM,CAAC,MAAM,CAAE,MAAM,EAAG,EAAE,WAAW,EAAG,MAAM,OAAO,CAAC,MAAM,CAAE,MAAM,CAAE,EAAE,CAAE,CAAC;oBAC/F,CAAC;oBACD,OAAM,KAAK,EAAC,CAAC;wBACX,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACvB,CAAC;oBAED,IAAI,CAAE,MAAM,CAAE,CAAC;gBAEjB,CAAC,CAAA,CAAC;qBACD,KAAK,CAAC,MAAM,CAAC,CAAA;YAEhB,CAAC,CAAC,CAAA;QAEJ,CAAC,CAAA;IAEH,CAAC,CAAA;AAEH,CAAC,CAAA;AA1CY,QAAA,YAAY,gBA0CxB"} \ No newline at end of file diff --git a/dist/observable.d.ts b/dist/observable.d.ts deleted file mode 100644 index e69de29..0000000 diff --git a/dist/observable.js b/dist/observable.js deleted file mode 100644 index 677a1f9..0000000 --- a/dist/observable.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=observable.js.map \ No newline at end of file diff --git a/dist/observable.js.map b/dist/observable.js.map deleted file mode 100644 index 8a20e3f..0000000 --- a/dist/observable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observable.js","sourceRoot":"","sources":["../src/observable.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/request.d.ts b/dist/request.d.ts deleted file mode 100644 index 1fa8413..0000000 --- a/dist/request.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IFetchFactory } from './index'; -export declare const Get: (headers?: IFetchFactory['headers']) => = any, OutputData = any>(optionalHeaders?: HeadersInit) => (endpoint: string, data?: InputData) => Promise; -export declare const Post: (headers?: IFetchFactory['headers']) => = any, OutputData = any>(optionalHeaders?: HeadersInit) => (endpoint: string, data?: InputData) => Promise; -export declare const Put: (headers?: IFetchFactory['headers']) => = any, OutputData = any>(optionalHeaders?: HeadersInit) => (endpoint: string, data?: InputData) => Promise; -export declare const Patch: (headers?: IFetchFactory['headers']) => = any, OutputData = any>(optionalHeaders?: HeadersInit) => (endpoint: string, data?: InputData) => Promise; -export declare const Delete: (headers?: IFetchFactory['headers']) => = any, OutputData = any>(optionalHeaders?: HeadersInit) => (endpoint: string, data?: InputData) => Promise; diff --git a/dist/request.js b/dist/request.js deleted file mode 100644 index 0f74ee6..0000000 --- a/dist/request.js +++ /dev/null @@ -1,45 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void 0; -const index_1 = require("./index"); -const Get = (headers = {}) => { - return (0, index_1.FetchFactory)({ - caller: fetch.bind(window), - method: "GET", - headers: headers, - }); -}; -exports.Get = Get; -const Post = (headers = {}) => { - return (0, index_1.FetchFactory)({ - caller: fetch.bind(window), - method: "POST", - headers: headers - }); -}; -exports.Post = Post; -const Put = (headers = {}) => { - return (0, index_1.FetchFactory)({ - caller: fetch.bind(window), - method: "PUT", - headers: headers, - }); -}; -exports.Put = Put; -const Patch = (headers = {}) => { - return (0, index_1.FetchFactory)({ - caller: fetch.bind(window), - method: "PATCH", - headers: headers, - }); -}; -exports.Patch = Patch; -const Delete = (headers = {}) => { - return (0, index_1.FetchFactory)({ - caller: fetch.bind(window), - method: "DELETE", - headers: headers, - }); -}; -exports.Delete = Delete; -//# sourceMappingURL=request.js.map \ No newline at end of file diff --git a/dist/request.js.map b/dist/request.js.map deleted file mode 100644 index cc7a02e..0000000 --- a/dist/request.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"request.js","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":";;;AAAA,mCAAuD;AAEhD,MAAM,GAAG,GAAG,CAAE,UAAmC,EAAE,EAAG,EAAE;IAC7D,OAAO,IAAA,oBAAY,EAAM;QACvB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1B,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAA;AANY,QAAA,GAAG,OAMf;AAEM,MAAM,IAAI,GAAG,CAAE,UAAmC,EAAE,EAAG,EAAE;IAC9D,OAAO,IAAA,oBAAY,EAAM;QACvB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAA;AANY,QAAA,IAAI,QAMhB;AAEM,MAAM,GAAG,GAAG,CAAE,UAAmC,EAAE,EAAG,EAAE;IAC7D,OAAO,IAAA,oBAAY,EAAM;QACvB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAC1B,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAA;AANY,QAAA,GAAG,OAMf;AAEM,MAAM,KAAK,GAAG,CAAE,UAAmC,EAAE,EAAG,EAAE;IA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