rest-pipeline-js 1.2.1 → 1.2.6

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 (69) hide show
  1. package/README.md +40 -62
  2. package/dist/cjs/error-handler.js +12 -0
  3. package/dist/cjs/index.js +23 -0
  4. package/dist/cjs/pipeline-orchestrator.js +565 -0
  5. package/dist/cjs/progress-tracker.js +47 -0
  6. package/dist/cjs/react.js +29 -0
  7. package/dist/cjs/request-executor.js +33 -0
  8. package/dist/cjs/rest-client.js +201 -0
  9. package/dist/cjs/types.js +2 -0
  10. package/dist/cjs/usePipelineProgress-react.js +17 -0
  11. package/dist/cjs/usePipelineProgress-vue.js +17 -0
  12. package/dist/cjs/usePipelineRun-react.js +33 -0
  13. package/dist/cjs/usePipelineRun-vue.js +45 -0
  14. package/dist/cjs/usePipelineStepEvents-react.js +46 -0
  15. package/dist/cjs/usePipelineStepEvents-vue.js +45 -0
  16. package/dist/cjs/useRestClient-react.js +13 -0
  17. package/dist/cjs/useRestClient-vue.js +14 -0
  18. package/dist/cjs/vue.js +29 -0
  19. package/dist/esm/error-handler.d.ts +4 -0
  20. package/dist/esm/error-handler.js +8 -0
  21. package/dist/esm/index.d.ts +6 -0
  22. package/dist/esm/index.js +7 -0
  23. package/dist/esm/pipeline-orchestrator.d.ts +136 -0
  24. package/dist/esm/pipeline-orchestrator.js +561 -0
  25. package/dist/esm/progress-tracker.d.ts +22 -0
  26. package/dist/esm/progress-tracker.js +43 -0
  27. package/dist/esm/react.d.ts +5 -0
  28. package/dist/esm/react.js +6 -0
  29. package/dist/esm/request-executor.d.ts +9 -0
  30. package/dist/esm/request-executor.js +29 -0
  31. package/dist/esm/rest-client.d.ts +14 -0
  32. package/dist/esm/rest-client.js +160 -0
  33. package/dist/esm/types.d.ts +164 -0
  34. package/dist/esm/types.js +1 -0
  35. package/dist/esm/usePipelineProgress-react.d.ts +8 -0
  36. package/dist/esm/usePipelineProgress-react.js +14 -0
  37. package/dist/esm/usePipelineProgress-vue.d.ts +16 -0
  38. package/dist/esm/usePipelineProgress-vue.js +14 -0
  39. package/dist/esm/usePipelineRun-react.d.ts +12 -0
  40. package/dist/esm/usePipelineRun-react.js +30 -0
  41. package/dist/esm/usePipelineRun-vue.d.ts +21 -0
  42. package/dist/esm/usePipelineRun-vue.js +42 -0
  43. package/dist/esm/usePipelineStepEvents-react.d.ts +29 -0
  44. package/dist/esm/usePipelineStepEvents-react.js +41 -0
  45. package/dist/esm/usePipelineStepEvents-vue.d.ts +39 -0
  46. package/dist/esm/usePipelineStepEvents-vue.js +40 -0
  47. package/dist/esm/useRestClient-react.d.ts +15 -0
  48. package/dist/esm/useRestClient-react.js +10 -0
  49. package/dist/esm/useRestClient-vue.d.ts +15 -0
  50. package/dist/esm/useRestClient-vue.js +10 -0
  51. package/dist/esm/vue.d.ts +5 -0
  52. package/dist/esm/vue.js +6 -0
  53. package/dist/index.d.ts +0 -8
  54. package/dist/index.js +1 -11
  55. package/dist/react.d.ts +5 -0
  56. package/dist/react.js +6 -0
  57. package/dist/vue.d.ts +5 -0
  58. package/dist/vue.js +6 -0
  59. package/package.json +16 -48
  60. package/src/error-handler.ts +7 -3
  61. package/src/index.ts +1 -23
  62. package/src/react.ts +11 -0
  63. package/src/vue-demo/demo.vue +1 -1
  64. package/src/vue.ts +11 -0
  65. package/tests/pipeline-orchestrator.test.ts +6 -6
  66. package/tests/react-hooks.test.ts +1 -1
  67. package/tests/vue-hooks.test.ts +1 -1
  68. package/tsconfig.cjs.json +16 -0
  69. package/tsconfig.esm.json +16 -0
package/README.md CHANGED
@@ -314,8 +314,7 @@ console.log(error); // { type: 'unknown', error: [Error], stageKey: 'step1' }
314
314
  ```js
315
315
  <script setup>
316
316
  import { ref } from 'vue';
317
- import { PipelineOrchestrator } from 'rest-pipeline-js';
318
- import { usePipelineProgressVue, usePipelineRunVue } from 'rest-pipeline-js';
317
+ import { PipelineOrchestrator, usePipelineProgressVue, usePipelineRunVue } from 'rest-pipeline-js/vue';
319
318
  const pipelineConfig = { stages: [/* ... */] };
320
319
  const httpConfig = { baseURL: 'https://api.example.com' };
321
320
  const orchestrator = new PipelineOrchestrator(pipelineConfig, httpConfig);
@@ -334,7 +333,7 @@ const { run, running, result, error } = usePipelineRunVue(orchestrator);
334
333
 
335
334
  ---
336
335
 
337
- Composition functions for Vue 3 (import from 'rest-pipeline-js'):
336
+ Composition functions for Vue 3 (import from `rest-pipeline-js/vue`):
338
337
 
339
338
  - **usePipelineProgressVue(orchestrator)** — reactive pipeline progress (Ref<PipelineProgress>)
340
339
  - **usePipelineRunVue(orchestrator)** — run pipeline and get reactive status (run, running, result, error)
@@ -351,11 +350,11 @@ Composition functions for Vue 3 (import from 'rest-pipeline-js'):
351
350
 
352
351
  ```jsx
353
352
  import React from "react";
354
- import { PipelineOrchestrator } from "rest-pipeline-js";
355
353
  import {
354
+ PipelineOrchestrator,
356
355
  usePipelineProgressReact,
357
356
  usePipelineRunReact,
358
- } from "rest-pipeline-js";
357
+ } from "rest-pipeline-js/react";
359
358
  const pipelineConfig = {
360
359
  stages: [
361
360
  /* ... */
@@ -381,7 +380,7 @@ export function PipelineComponent() {
381
380
 
382
381
  ---
383
382
 
384
- Hooks for React (import from 'rest-pipeline-js'):
383
+ Hooks for React (import from `rest-pipeline-js/react`):
385
384
 
386
385
  - **usePipelineProgressReact(orchestrator)** — subscribe to pipeline progress (PipelineProgress)
387
386
  - **usePipelineRunReact(orchestrator)** — run pipeline and get status ([run, { running, result, error }])
@@ -399,37 +398,37 @@ Hooks for React (import from 'rest-pipeline-js'):
399
398
 
400
399
  ---
401
400
 
402
- ## Notes for bundlers (Vue / React projects)
401
+ ## Entry points and imports
402
+
403
+ The package has three entry points so that bundlers do not pull in React when you only use core or Vue.
403
404
 
404
- - The package provides framework-specific composition helpers for both Vue and React. To avoid forcing React into a Vue build, the package exposes framework helpers via explicit subpath exports. The package root (`rest-pipeline-js`) includes only core utilities and Vue helpers; React helpers are available via their subpath exports as well.
405
+ | Entry point | Use for | Contents |
406
+ |-------------|---------|----------|
407
+ | `rest-pipeline-js` | Core only | `PipelineOrchestrator`, `createRestClient`, types, `rest-client`, `request-executor`, `error-handler`, `progress-tracker`. No Vue/React. |
408
+ | `rest-pipeline-js/vue` | Vue projects | Everything from core + Vue hooks: `usePipelineProgressVue`, `usePipelineRunVue`, `useRestClientVue`, `usePipelineStepEventVue`, `usePipelineLogsVue`, `useRerunPipelineStepVue`. |
409
+ | `rest-pipeline-js/react` | React projects | Everything from core + React hooks: `usePipelineProgressReact`, `usePipelineRunReact`, `useRestClientReact`, `usePipelineStepEventReact`, `usePipelineLogsReact`, `useRerunPipelineStepReact`. |
405
410
 
406
- - Recommended imports:
407
- - Core utilities (framework-agnostic):
411
+ **Recommended imports:**
408
412
 
409
- ```js
410
- import { createRestClient, PipelineOrchestrator } from "rest-pipeline-js";
411
- ```
413
+ - **Core only** (no framework):
412
414
 
413
- - Vue composition helpers (preferred in Vue projects):
415
+ ```js
416
+ import { createRestClient, PipelineOrchestrator } from "rest-pipeline-js";
417
+ ```
414
418
 
415
- ```js
416
- import {
417
- usePipelineProgressVue,
418
- usePipelineRunVue,
419
- } from "rest-pipeline-js/usePipelineProgress-vue";
420
- // or
421
- import { useRestClientVue } from "rest-pipeline-js/useRestClient-vue";
422
- ```
419
+ - **Vue** (core + Vue hooks):
423
420
 
424
- - React hooks (preferred in React projects):
421
+ ```js
422
+ import { PipelineOrchestrator, usePipelineRunVue } from "rest-pipeline-js/vue";
423
+ ```
425
424
 
426
- ```js
427
- import { usePipelineProgressReact } from "rest-pipeline-js/usePipelineProgress-react";
428
- ```
425
+ - **React** (core + React hooks):
429
426
 
430
- - If you previously imported UI hooks from the package root (for example `import { useRestClient } from 'rest-pipeline-js'`), update your imports to use the subpath helpers above. This prevents bundlers from resolving `react` in projects that don't use React.
427
+ ```js
428
+ import { PipelineOrchestrator, usePipelineRunReact } from "rest-pipeline-js/react";
429
+ ```
431
430
 
432
- - The package sets `sideEffects: false` and declares `react`/`react-dom` as `peerDependencies`. React remains available for development via `devDependencies`, but consumers must install React themselves when using React helpers.
431
+ If you use only `rest-pipeline-js` or `rest-pipeline-js/vue`, the bundler will not resolve or include `react`. The package sets `sideEffects: false` and declares `react`/`react-dom` as `peerDependencies` for the React entry point.
433
432
 
434
433
  If you want, I can prepare a release (bump version and build) with these changes.
435
434
 
@@ -820,8 +819,7 @@ console.log(error); // { type: 'unknown', error: [Error], stageKey: 'step1' }
820
819
  ```js
821
820
  <script setup>
822
821
  import { ref } from 'vue';
823
- import { PipelineOrchestrator } from 'rest-pipeline-js';
824
- import { usePipelineProgressVue, usePipelineRunVue } from 'rest-pipeline-js';
822
+ import { PipelineOrchestrator, usePipelineProgressVue, usePipelineRunVue } from 'rest-pipeline-js/vue';
825
823
 
826
824
  const pipelineConfig = { stages: [/* ... */] };
827
825
  const httpConfig = { baseURL: 'https://api.example.com' };
@@ -843,7 +841,7 @@ const { run, running, result, error } = usePipelineRunVue(orchestrator);
843
841
 
844
842
  ---
845
843
 
846
- Экспортируются composition-функции для интеграции rest-pipeline-js с Vue 3 (импортировать из 'rest-pipeline-js'):
844
+ Экспортируются composition-функции для интеграции rest-pipeline-js с Vue 3 (импортировать из `rest-pipeline-js/vue`):
847
845
 
848
846
  - **usePipelineProgressVue(orchestrator)** — реактивный прогресс pipeline (Ref<PipelineProgress>)
849
847
  - **usePipelineRunVue(orchestrator)** — запуск pipeline и реактивные статусы (run, running, result, error)
@@ -860,11 +858,11 @@ const { run, running, result, error } = usePipelineRunVue(orchestrator);
860
858
 
861
859
  ```jsx
862
860
  import React from "react";
863
- import { PipelineOrchestrator } from "rest-pipeline-js";
864
861
  import {
862
+ PipelineOrchestrator,
865
863
  usePipelineProgressReact,
866
864
  usePipelineRunReact,
867
- } from "rest-pipeline-js";
865
+ } from "rest-pipeline-js/react";
868
866
 
869
867
  const pipelineConfig = {
870
868
  stages: [
@@ -893,7 +891,7 @@ export function PipelineComponent() {
893
891
 
894
892
  ---
895
893
 
896
- Экспортируются хуки для интеграции rest-pipeline-js с React (импортировать из 'rest-pipeline-js'):
894
+ Экспортируются хуки для интеграции rest-pipeline-js с React (импортировать из `rest-pipeline-js/react`):
897
895
 
898
896
  - **usePipelineProgressReact(orchestrator)** — подписка на прогресс pipeline (PipelineProgress)
899
897
  - **usePipelineRunReact(orchestrator)** — запуск pipeline и статусы ([run, { running, result, error }])
@@ -904,37 +902,17 @@ export function PipelineComponent() {
904
902
 
905
903
  ---
906
904
 
907
- ## Замечания для сборщиков (Vue / React) — русский
908
-
909
- - Пакет предоставляет хелперы для Vue и React отдельно. Чтобы избежать подтягивания `react` в проекты на Vue, используйте явные subpath-импорты для фреймворк‑специфичных модулей.
910
-
911
- - Рекомендуемые импорты:
912
- - Ядро (без привязки к фреймворку):
913
-
914
- ```js
915
- import { createRestClient, PipelineOrchestrator } from "rest-pipeline-js";
916
- ```
917
-
918
- - Vue (предпочтительно в проектах на Vue):
919
-
920
- ```js
921
- import {
922
- usePipelineProgressVue,
923
- usePipelineRunVue,
924
- } from "rest-pipeline-js/usePipelineProgress-vue";
925
- // или
926
- import { useRestClientVue } from "rest-pipeline-js/useRestClient-vue";
927
- ```
928
-
929
- - React (предпочтительно в проектах на React):
905
+ ## Точки входа и импорты (русский)
930
906
 
931
- ```js
932
- import { usePipelineProgressReact } from "rest-pipeline-js/usePipelineProgress-react";
933
- ```
907
+ В пакете три точки входа, чтобы при использовании только ядра или Vue сборщик не подтягивал React.
934
908
 
935
- - Если вы ранее импортировали UI-хелперы из корня пакета, обновите импорты на subpath-версии — это предотвратит попытки резолва `react` в проектах без React.
909
+ | Точка входа | Назначение | Содержимое |
910
+ |-------------|------------|------------|
911
+ | `rest-pipeline-js` | Только ядро | `PipelineOrchestrator`, `createRestClient`, типы, rest-client, request-executor, error-handler, progress-tracker. Без Vue/React. |
912
+ | `rest-pipeline-js/vue` | Проекты на Vue | Всё из ядра + Vue-хуки: usePipelineProgressVue, usePipelineRunVue, useRestClientVue, usePipelineStepEventVue, usePipelineLogsVue, useRerunPipelineStepVue. |
913
+ | `rest-pipeline-js/react` | Проекты на React | Всё из ядра + React-хуки: usePipelineProgressReact, usePipelineRunReact, useRestClientReact, usePipelineStepEventReact, usePipelineLogsReact, useRerunPipelineStepReact. |
936
914
 
937
- - Пакет помечен как `sideEffects: false` и объявляет `react`/`react-dom` в `peerDependencies`. При использовании React-хелперов потребитель должен установить `react` и `react-dom`.
915
+ Рекомендуемые импорты: ядро — `rest-pipeline-js`; Vue — `rest-pipeline-js/vue`; React — `rest-pipeline-js/react`. Пакет помечен как `sideEffects: false`; `react`/`react-dom` в `peerDependencies` для входа React.
938
916
 
939
917
  ---
940
918
 
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ErrorHandler = void 0;
4
+ class ErrorHandler {
5
+ handle(error, _stageKey) {
6
+ return {
7
+ message: error instanceof Error ? error.message : String(error !== null && error !== void 0 ? error : 'Unknown error'),
8
+ status: typeof (error === null || error === void 0 ? void 0 : error.status) === 'number' ? error.status : undefined,
9
+ };
10
+ }
11
+ }
12
+ exports.ErrorHandler = ErrorHandler;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // Barrel file for pipeline-js module (core only — no Vue/React)
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./rest-client"), exports);
19
+ __exportStar(require("./types"), exports);
20
+ __exportStar(require("./request-executor"), exports);
21
+ __exportStar(require("./error-handler"), exports);
22
+ __exportStar(require("./progress-tracker"), exports);
23
+ __exportStar(require("./pipeline-orchestrator"), exports);