@jumoo/processing 18.2.0 → 19.0.0-beta01

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.
@@ -3,6 +3,10 @@ import { PipelineStatus } from '../api';
3
3
  export declare class PipelineSource {
4
4
  private readonly host;
5
5
  constructor(host: UmbControllerHost);
6
+ /**
7
+ * @description a 409 (another pipeline holds this one's concurrency key, so it can't resume)
8
+ * is returned as the error without a notification - see getPipelineConflict.
9
+ */
6
10
  process(id: string, clientId: string | null): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<({
7
11
  data: import("..").Pipeline;
8
12
  error: undefined;
@@ -29,6 +33,10 @@ export declare class PipelineSource {
29
33
  request?: Request;
30
34
  response?: Response;
31
35
  }>>;
36
+ /**
37
+ * @description a 409 (the new options' concurrency key is held) is returned as the error
38
+ * without a notification - see getPipelineConflict.
39
+ */
32
40
  update(id: string, body: any): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<({
33
41
  data: import("..").ProcessingOptionsResults;
34
42
  error: undefined;
@@ -67,7 +75,8 @@ export declare class PipelineSource {
67
75
  /**
68
76
  *
69
77
  * @param strategy alias of the strategy to use for the pipeline
70
- * @returns
78
+ * @returns the new pipeline's id. A 409 (another pipeline holds its concurrency key) is
79
+ * returned as the error without a notification - see getPipelineConflict.
71
80
  */
72
81
  create(processor: string, strategy: string, options: any): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<({
73
82
  data: string;
@@ -108,6 +117,20 @@ export declare class PipelineSource {
108
117
  request?: Request;
109
118
  response?: Response;
110
119
  }>>;
120
+ /**
121
+ * @param id guid id of the pipeline
122
+ * @returns its run status, or an error (without a notification) if the user can't see it.
123
+ */
124
+ getRunStatus(id: string): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<({
125
+ data: import("..").PipelineRunStatus;
126
+ error: undefined;
127
+ } | {
128
+ data: undefined;
129
+ error: unknown;
130
+ }) & {
131
+ request?: Request;
132
+ response?: Response;
133
+ }>>;
111
134
  listPiplelines(status: PipelineStatus): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<({
112
135
  data: import("..").Pipeline[];
113
136
  error: undefined;
@@ -1,11 +1,16 @@
1
1
  import { tryExecute } from '@umbraco-cms/backoffice/resources';
2
- import { getProcessingGetPipelineById, getProcessingGetProcessors, getProcessingGetResultsById, getProcessingListPipelinesByStatus, postProcessingClearPipelineById, postProcessingCreatePipeline, postProcessingProcessPipelineById, postProcessingReattachPipelineById, postProcessingUpdatePipelineById, } from '../api';
2
+ import { getProcessingGetPipelineById, getProcessingGetProcessors, getProcessingGetResultsById, getProcessingListPipelinesByStatus, getProcessingPipelineStatusById, postProcessingClearPipelineById, postProcessingCreatePipeline, postProcessingProcessPipelineById, postProcessingReattachPipelineById, postProcessingUpdatePipelineById, } from '../api';
3
+ import { tryExecuteAllowingConflict } from './pipeline-conflict.js';
3
4
  export class PipelineSource {
4
5
  constructor(host) {
5
6
  this.host = host;
6
7
  }
8
+ /**
9
+ * @description a 409 (another pipeline holds this one's concurrency key, so it can't resume)
10
+ * is returned as the error without a notification - see getPipelineConflict.
11
+ */
7
12
  async process(id, clientId) {
8
- const result = await tryExecute(this.host, postProcessingProcessPipelineById({
13
+ const result = await tryExecuteAllowingConflict(this.host, postProcessingProcessPipelineById({
9
14
  path: { id: id },
10
15
  query: { clientId: clientId ?? undefined },
11
16
  }));
@@ -24,8 +29,12 @@ export class PipelineSource {
24
29
  }));
25
30
  return result;
26
31
  }
32
+ /**
33
+ * @description a 409 (the new options' concurrency key is held) is returned as the error
34
+ * without a notification - see getPipelineConflict.
35
+ */
27
36
  async update(id, body) {
28
- return await tryExecute(this.host, postProcessingUpdatePipelineById({
37
+ return await tryExecuteAllowingConflict(this.host, postProcessingUpdatePipelineById({
29
38
  path: { id: id },
30
39
  body: body,
31
40
  }));
@@ -44,10 +53,11 @@ export class PipelineSource {
44
53
  /**
45
54
  *
46
55
  * @param strategy alias of the strategy to use for the pipeline
47
- * @returns
56
+ * @returns the new pipeline's id. A 409 (another pipeline holds its concurrency key) is
57
+ * returned as the error without a notification - see getPipelineConflict.
48
58
  */
49
59
  async create(processor, strategy, options) {
50
- return await tryExecute(this.host, postProcessingCreatePipeline({
60
+ return await tryExecuteAllowingConflict(this.host, postProcessingCreatePipeline({
51
61
  body: {
52
62
  alias: processor,
53
63
  strategy: strategy,
@@ -73,6 +83,15 @@ export class PipelineSource {
73
83
  path: { id: id },
74
84
  }));
75
85
  }
86
+ /**
87
+ * @param id guid id of the pipeline
88
+ * @returns its run status, or an error (without a notification) if the user can't see it.
89
+ */
90
+ async getRunStatus(id) {
91
+ return await tryExecute(this.host, getProcessingPipelineStatusById({ path: { id: id } }), {
92
+ disableNotifications: true,
93
+ });
94
+ }
76
95
  async listPiplelines(status) {
77
96
  return await tryExecute(this.host, getProcessingListPipelinesByStatus({ path: { status: status } }));
78
97
  }
@@ -9,6 +9,15 @@ export declare class ProcessingSignalRContext extends UmbControllerBase {
9
9
  readonly message: import("rxjs").Observable<ProcessingHubMessage[]>;
10
10
  readonly clientId: import("rxjs").Observable<string | null>;
11
11
  readonly connectionState: import("rxjs").Observable<ProcessingConnectionState>;
12
+ /**
13
+ * @description connects to the processing hub. From Umbraco 19 the backoffice session is a
14
+ * cookie, so the connection sends that rather than a token.
15
+ */
16
+ startHub(methods: string[]): void;
17
+ /**
18
+ * @deprecated there is no client-side token from Umbraco 19 - call `startHub(methods)`. The
19
+ * token is ignored. Will be removed in v21.
20
+ */
12
21
  startHub(token: string, methods: string[]): void;
13
22
  hostConnected(): void;
14
23
  hostDisconnected(): void;
@@ -28,8 +28,9 @@ export class ProcessingSignalRContext extends UmbControllerBase {
28
28
  this.connectionState = __classPrivateFieldGet(this, _ProcessingSignalRContext_connectionState, "f").asObservable();
29
29
  this.provideContext(JUMOO_PROCESSING_SIGNALR_CONTEXT, this);
30
30
  }
31
- startHub(token, methods) {
32
- __classPrivateFieldGet(this, _ProcessingSignalRContext_instances, "m", _ProcessingSignalRContext_setupConnection).call(this, JUMOO_PROCESSING_HUB_PATH, token, methods);
31
+ startHub(tokenOrMethods, methods) {
32
+ const hubMethods = Array.isArray(tokenOrMethods) ? tokenOrMethods : (methods ?? []);
33
+ __classPrivateFieldGet(this, _ProcessingSignalRContext_instances, "m", _ProcessingSignalRContext_setupConnection).call(this, JUMOO_PROCESSING_HUB_PATH, hubMethods);
33
34
  }
34
35
  hostConnected() {
35
36
  super.hostConnected();
@@ -53,9 +54,11 @@ export class ProcessingSignalRContext extends UmbControllerBase {
53
54
  return __classPrivateFieldGet(this, _ProcessingSignalRContext_connection, "f")?.connectionId ?? null;
54
55
  }
55
56
  }
56
- _ProcessingSignalRContext_connection = new WeakMap(), _ProcessingSignalRContext_messages = new WeakMap(), _ProcessingSignalRContext_clientId = new WeakMap(), _ProcessingSignalRContext_connectionState = new WeakMap(), _ProcessingSignalRContext_instances = new WeakSet(), _ProcessingSignalRContext_setupConnection = function _ProcessingSignalRContext_setupConnection(url, token, methods) {
57
+ _ProcessingSignalRContext_connection = new WeakMap(), _ProcessingSignalRContext_messages = new WeakMap(), _ProcessingSignalRContext_clientId = new WeakMap(), _ProcessingSignalRContext_connectionState = new WeakMap(), _ProcessingSignalRContext_instances = new WeakSet(), _ProcessingSignalRContext_setupConnection = function _ProcessingSignalRContext_setupConnection(url, methods) {
58
+ // no accessTokenFactory: the backoffice auth cookie goes with the negotiate request and
59
+ // the websocket upgrade, which is how Umbraco's own server-event hub connects.
57
60
  __classPrivateFieldSet(this, _ProcessingSignalRContext_connection, new signalR.HubConnectionBuilder()
58
- .withUrl(url, { accessTokenFactory: () => token })
61
+ .withUrl(url)
59
62
  .withAutomaticReconnect([0, 2000, 10000, 30000])
60
63
  .configureLogging(signalR.LogLevel.None)
61
64
  .build(), "f");
package/package.json CHANGED
@@ -1,52 +1,59 @@
1
- {
2
- "name": "@jumoo/processing",
3
- "licence": "custom",
4
- "version": "18.2.0",
5
- "type": "module",
6
- "description": "Jumoo processing library",
7
- "exports": {
8
- ".": "./dist/index.js",
9
- "./pipeline": "./dist/pipeline/index.js",
10
- "./signalr": "./dist/signalr/index.js",
11
- "./api": "./dist/api/index.js"
12
- },
13
- "files": [
14
- "./dist/**/*"
15
- ],
16
- "author": {
17
- "name": "Jumoo",
18
- "email": "info@jumoo.co.uk",
19
- "url": "https://jumoo.co.uk"
20
- },
21
- "publishConfig": {},
22
- "scripts": {
23
- "client:build": "tsc --project ./tsconfig.dist.json",
24
- "client:pack": "npm pack --pack-destination ./pack",
25
- "client:publish": "npm publish -tag next",
26
- "client:make": "npm run client:build && npm run client:pack && npm run client:publish",
27
- "client:link": "npm link",
28
- "generate-client": "node scripts/generate-openapi.js https://localhost:44348/umbraco/openapi/processing.json",
29
- "lint": "eslint .",
30
- "lint:fix": "eslint . --fix",
31
- "format:fix": "npm run format -- --write",
32
- "format": "prettier \"src/**/*.ts\" \"*.ts\" \"*.js\" \"*.json\" \"scripts/**/*.js\" --check",
33
- "build": "tsc && vite build",
34
- "watch": "vite build --watch",
35
- "make": "npm run build && npm run client:make"
36
- },
37
- "devDependencies": {
38
- "@eslint/js": "^10.0.1",
39
- "@hey-api/openapi-ts": "^0.99.0",
40
- "@microsoft/signalr": "^10.0.0",
41
- "@umbraco-cms/backoffice": "18.0.1",
42
- "chalk": "^5.6.2",
43
- "cross-env": "^10.1.0",
44
- "eslint": "^10.5.0",
45
- "globals": "^17.8.0",
46
- "node-fetch": "^3.3.2",
47
- "prettier": "^3.8.2",
48
- "typescript": "^6.0.3",
49
- "typescript-eslint": "^8.65.0",
50
- "vite": "^8.0.16"
51
- }
52
- }
1
+ {
2
+ "name": "@jumoo/processing",
3
+ "licence": "custom",
4
+ "version": "19.0.0-beta01",
5
+ "type": "module",
6
+ "description": "Jumoo processing library",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./pipeline": "./dist/pipeline/index.js",
10
+ "./signalr": "./dist/signalr/index.js",
11
+ "./api": "./dist/api/index.js"
12
+ },
13
+ "files": [
14
+ "./dist/**/*"
15
+ ],
16
+ "author": {
17
+ "name": "Jumoo",
18
+ "email": "info@jumoo.co.uk",
19
+ "url": "https://jumoo.co.uk"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "scripts": {
25
+ "client:build": "tsc --project ./tsconfig.dist.json",
26
+ "client:pack": "npm pack --pack-destination ./pack",
27
+ "client:publish": "npm publish -tag next",
28
+ "client:make": "npm run client:build && npm run client:pack && npm run client:publish",
29
+ "client:link": "npm link",
30
+ "generate-client": "node scripts/generate-openapi.js https://localhost:44348/umbraco/openapi/processing.json",
31
+ "lint": "eslint .",
32
+ "lint:fix": "eslint . --fix",
33
+ "format:fix": "npm run format -- --write",
34
+ "format": "prettier \"src/**/*.ts\" \"*.ts\" \"*.js\" \"*.json\" \"scripts/**/*.js\" --check",
35
+ "build": "tsc && vite build",
36
+ "watch": "vite build --watch",
37
+ "make": "npm run build && npm run client:make"
38
+ },
39
+ "devDependencies": {
40
+ "@eslint/js": "^10.0.1",
41
+ "@hey-api/openapi-ts": "^0.99.0",
42
+ "@microsoft/signalr": "^10.0.0",
43
+ "@umbraco-cms/backoffice": "19.0.0-beta1",
44
+ "chalk": "^5.6.2",
45
+ "cross-env": "^10.1.0",
46
+ "eslint": "^10.13.0",
47
+ "globals": "^17.13.0",
48
+ "node-fetch": "^3.3.2",
49
+ "prettier": "^3.9.10",
50
+ "typescript": "^6.0.3",
51
+ "typescript-eslint": "^8.71.2",
52
+ "vite": "^8.3.4"
53
+ },
54
+ "repository": {
55
+ "type": "git",
56
+ "url": "git+https://github.com/Jumoo/Jumoo.Processing.git",
57
+ "directory": "Jumoo.Processing.Client/jumoo-processing-assets"
58
+ }
59
+ }
package/dist/hey-api.d.ts DELETED
@@ -1,11 +0,0 @@
1
- import type { CreateClientConfig } from './api/client.gen';
2
- /**
3
- * Pre-configure the generated client by copying the Umbraco HTTP client's config.
4
- *
5
- * Called automatically by the generated client during initialization (via runtimeConfigPath).
6
- * Inherits baseUrl, credentials, auth, and headers from umbHttpClient — which is already
7
- * configured by the backoffice before extensions load.
8
- *
9
- * @see https://heyapi.dev/openapi-ts/clients/fetch#configuration
10
- */
11
- export declare const createClientConfig: CreateClientConfig;
package/dist/hey-api.js DELETED
@@ -1,14 +0,0 @@
1
- import { umbHttpClient } from '@umbraco-cms/backoffice/http-client';
2
- /**
3
- * Pre-configure the generated client by copying the Umbraco HTTP client's config.
4
- *
5
- * Called automatically by the generated client during initialization (via runtimeConfigPath).
6
- * Inherits baseUrl, credentials, auth, and headers from umbHttpClient — which is already
7
- * configured by the backoffice before extensions load.
8
- *
9
- * @see https://heyapi.dev/openapi-ts/clients/fetch#configuration
10
- */
11
- export const createClientConfig = (config) => ({
12
- ...config,
13
- ...umbHttpClient.getConfig(),
14
- });