@t4h.framework/dev 0.0.0-experimental-20260911032651 → 0.0.0-experimental-20260911032832

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/CHANGELOG.md CHANGED
@@ -1,19 +1,30 @@
1
1
  # @t4h.framework/dev
2
2
 
3
- ## 0.0.0-experimental-20260911032651
3
+ ## 0.0.0-experimental-20260911032832
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [#173](https://github.com/tech4humans-brasil/framework/pull/173) [`fb800a8`](https://github.com/tech4humans-brasil/framework/commit/fb800a85e7e1c094cf2944644f79d44117038435) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Caps how many workflow runs the dev server advances at the same time.
7
+ - [#175](https://github.com/tech4humans-brasil/framework/pull/175) [`2a3b9b4`](https://github.com/tech4humans-brasil/framework/commit/2a3b9b4c11639c7ef7b47d7b9e672ded81bd4297) Thanks [@gusteycamargo](https://github.com/gusteycamargo)! - Adds `HttpBodyRef`, a value in a JSON body resolved when the request is made,
8
+ and a raw `{ binary }` request body.
8
9
 
9
- Every child run was scheduled on its own, so a `split` over thousands of blocks
10
- started every child at once and exhausted the heap before any of them finished
11
- — a workflow that fans out over a large file could not be tried locally at all.
10
+ The body of a request is the activity's input, and inputs are persisted. That
11
+ makes two common attachment shapes traps. An encoded file writes the whole file
12
+ into the history, once per request. And a pre-signed URL expires: between
13
+ persisting the input and the request going out there is a queue with no bound
14
+ on how long it holds a message, so a URL minted beforehand can arrive expired.
12
15
 
13
- Runs now go through a FIFO queue bounded by
14
- `WORKFLOW_RUN_NEXT_TICK_CONCURRENCY`. Children still run in parallel, just not
15
- all at once, which also makes local behaviour closer to what a bounded worker
16
- pool does when the project is published.
16
+ `HttpBodyRef` keeps both out of the history — what is persisted is what the
17
+ subclass serializes, the recipe rather than the result. It is the body
18
+ counterpart of `HttpAuth`, which for the same reason stores how to get a token
19
+ and never the token. `HttpBodyUpload` is the ready-made case: it asks an
20
+ endpoint for a signed destination, uploads the `Binary`, and resolves to the
21
+ URL, configured by data so one class covers any mint-then-upload flow.
22
+
23
+ A `{ binary }` body streams from storage to the wire instead of being buffered.
24
+
25
+ - Updated dependencies [[`2a3b9b4`](https://github.com/tech4humans-brasil/framework/commit/2a3b9b4c11639c7ef7b47d7b9e672ded81bd4297)]:
26
+ - @t4h.framework/http@0.0.0-experimental-20260911032832
27
+ - @t4h.framework/webhook@0.0.0-experimental-20260911032832
17
28
 
18
29
  ## 0.20.1
19
30
 
@@ -9,4 +9,3 @@ export declare const PROJECTS_ROUTES_PREFIX = "/projects";
9
9
  export declare const DEV_ROUTES_PREFIX = "/_dev";
10
10
  export declare const SERVER_URL_ARG = "--server-url=";
11
11
  export declare const WORKFLOW_RUN_EVENTS: readonly ["run:created", "run:updated"];
12
- export declare const WORKFLOW_RUN_NEXT_TICK_CONCURRENCY = 10;
@@ -9,5 +9,4 @@ export const PROJECTS_ROUTES_PREFIX = '/projects';
9
9
  export const DEV_ROUTES_PREFIX = '/_dev';
10
10
  export const SERVER_URL_ARG = '--server-url=';
11
11
  export const WORKFLOW_RUN_EVENTS = ['run:created', 'run:updated'];
12
- export const WORKFLOW_RUN_NEXT_TICK_CONCURRENCY = 10;
13
12
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/constants/server.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAA;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAA;AAEvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,GAAG,IAAI,CAAA;AAElD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAA;AAE7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAA;AAE3C,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAA;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAA;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAA;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,aAAa,CAAU,CAAA;AAE1E,MAAM,CAAC,MAAM,kCAAkC,GAAG,EAAE,CAAA"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/constants/server.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAA;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAA;AAEvC,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,GAAG,IAAI,CAAA;AAElD,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,GAAG,IAAI,CAAA;AAEvD,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAA;AAE7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAA;AAE3C,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAA;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAA;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAA;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAA;AAE7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,aAAa,EAAE,aAAa,CAAU,CAAA"}
@@ -5,4 +5,4 @@ export declare const claims: {
5
5
  provide: typeof HttpClientRequestClaim;
6
6
  value: DevHttpClientRequestClaim;
7
7
  }[];
8
- export declare const kinds: (Kind<"http:body", import("@t4h.framework/core").SerializableClass> | Kind<"oauth2:client-credentials-grant", import("@t4h.framework/core").SerializableClass> | Kind<"oauth2:grant-resource-owner-password", import("@t4h.framework/core").SerializableClass>)[];
8
+ export declare const kinds: (Kind<"http:body", import("@t4h.framework/core").SerializableClass> | Kind<"http:body-upload", import("@t4h.framework/core").SerializableClass> | Kind<"oauth2:client-credentials-grant", import("@t4h.framework/core").SerializableClass> | Kind<"oauth2:grant-resource-owner-password", import("@t4h.framework/core").SerializableClass>)[];
@@ -1,4 +1,4 @@
1
- import { Body, HttpClientRequestClaim, OAuth2ClientCredentials, OAuth2GrantResourceOwnerPassword, } from '@t4h.framework/http';
1
+ import { Body, HttpBodyUpload, HttpClientRequestClaim, OAuth2ClientCredentials, OAuth2GrantResourceOwnerPassword, } from '@t4h.framework/http';
2
2
  import { DevHttpClientRequestClaim } from '../models/claims/DevHttpClientRequestClaim.js';
3
3
  import { JSONCodecKindFrameworkSerializableClass as Kind } from '../models/JSONCodecKindFrameworkSerializableClass.js';
4
4
  export const claims = [
@@ -6,6 +6,7 @@ export const claims = [
6
6
  ];
7
7
  export const kinds = [
8
8
  new Kind('http:body', Body),
9
+ new Kind('http:body-upload', HttpBodyUpload),
9
10
  new Kind('oauth2:client-credentials-grant', OAuth2ClientCredentials),
10
11
  new Kind('oauth2:grant-resource-owner-password', OAuth2GrantResourceOwnerPassword),
11
12
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/integrations/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAA;AACzF,OAAO,EAAE,uCAAuC,IAAI,IAAI,EAAE,MAAM,sDAAsD,CAAA;AAEtH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,EAAE,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,IAAI,yBAAyB,EAAE,EAAE;CAC5E,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;IAC3B,IAAI,IAAI,CAAC,iCAAiC,EAAE,uBAAuB,CAAC;IACpE,IAAI,IAAI,CACN,sCAAsC,EACtC,gCAAgC,CACjC;CACF,CAAA"}
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/integrations/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,cAAc,EACd,sBAAsB,EACtB,uBAAuB,EACvB,gCAAgC,GACjC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAA;AACzF,OAAO,EAAE,uCAAuC,IAAI,IAAI,EAAE,MAAM,sDAAsD,CAAA;AAEtH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,EAAE,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,IAAI,yBAAyB,EAAE,EAAE;CAC5E,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC;IAC3B,IAAI,IAAI,CAAC,kBAAkB,EAAE,cAAc,CAAC;IAC5C,IAAI,IAAI,CAAC,iCAAiC,EAAE,uBAAuB,CAAC;IACpE,IAAI,IAAI,CACN,sCAAsC,EACtC,gCAAgC,CACjC;CACF,CAAA"}
@@ -3,11 +3,7 @@ import { WorkflowRunLockService } from '../services/WorkflowRunLock.service.js';
3
3
  export declare class EnqueueWorkflowRunNextTick {
4
4
  private readonly workflowRun;
5
5
  private readonly lock;
6
- private readonly pending;
7
- private running;
8
6
  constructor(workflowRun: WorkflowRunFacade, lock: WorkflowRunLockService);
9
7
  enqueue(runId: string): void;
10
8
  enqueueMany(runIds: readonly string[]): void;
11
- private drain;
12
- private run;
13
9
  }
@@ -9,48 +9,29 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
9
  };
10
10
  import { styleText } from 'node:util';
11
11
  import { Inject, Injectable } from 'pleroma';
12
- import { WORKFLOW_RUN_NEXT_TICK_CONCURRENCY } from '../constants/server.js';
13
12
  import { WorkflowRunFacade } from '../services/WorkflowRunFacade.service.js';
14
13
  import { WorkflowRunLockService } from '../services/WorkflowRunLock.service.js';
15
14
  let EnqueueWorkflowRunNextTick = class EnqueueWorkflowRunNextTick {
16
15
  workflowRun;
17
16
  lock;
18
- pending = [];
19
- running = 0;
20
17
  constructor(workflowRun, lock) {
21
18
  this.workflowRun = workflowRun;
22
19
  this.lock = lock;
23
20
  }
24
21
  enqueue(runId) {
25
- this.pending.push(runId);
26
- this.drain();
22
+ setImmediate(() => {
23
+ this.lock
24
+ .detach(() => this.workflowRun.nextTick(runId))
25
+ .catch(error => {
26
+ console.error(styleText('red', `[Runtime] next tick failed for run ${runId}:`, {
27
+ stream: process.stderr,
28
+ }), error);
29
+ });
30
+ });
27
31
  }
28
32
  enqueueMany(runIds) {
29
33
  for (const runId of runIds)
30
- this.pending.push(runId);
31
- this.drain();
32
- }
33
- drain() {
34
- while (this.running < WORKFLOW_RUN_NEXT_TICK_CONCURRENCY &&
35
- this.pending.length > 0) {
36
- const runId = this.pending.shift();
37
- this.running += 1;
38
- setImmediate(() => void this.run(runId));
39
- }
40
- }
41
- async run(runId) {
42
- try {
43
- await this.lock.detach(() => this.workflowRun.nextTick(runId));
44
- }
45
- catch (error) {
46
- console.error(styleText('red', `[Runtime] next tick failed for run ${runId}:`, {
47
- stream: process.stderr,
48
- }), error);
49
- }
50
- finally {
51
- this.running -= 1;
52
- this.drain();
53
- }
34
+ this.enqueue(runId);
54
35
  }
55
36
  };
56
37
  EnqueueWorkflowRunNextTick = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"EnqueueWorkflowRunNextTick.usecase.js","sourceRoot":"","sources":["../../src/use-cases/EnqueueWorkflowRunNextTick.usecase.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE5C,OAAO,EAAE,kCAAkC,EAA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KAAK,EAAE,sCAAsC,KAAK,GAAG,EAAE;oBAC/D,MAAM,EAAE,OAAO,CAAC,MAAM;iBACvB,CAAC,EACF,KAAK,CACN,CAAA;YACH,CAAC,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACJ,CAAC;IAEM,WAAW,CAAC,MAAyB;QAC1C,KAAK,MAAM,KAAK,IAAI,MAAM;YAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IACjD,CAAC;CACF,CAAA;AA3BY,0BAA0B;IADtC,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,CAAA;IAG/B,WAAA,MAAM,CAAC,GAAG,EAAE,CAAC,sBAAsB,CAAC,CAAA;GAL5B,0BAA0B,CA2BtC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t4h.framework/dev",
3
- "version": "0.0.0-experimental-20260911032651",
3
+ "version": "0.0.0-experimental-20260911032832",
4
4
  "description": "Dev server for the T4H Framework",
5
5
  "homepage": "https://github.com/tech4humans-brasil/framework/tree/main/packages/dev",
6
6
  "bugs": "https://github.com/tech4humans-brasil/framework/issues",
@@ -63,14 +63,14 @@
63
63
  "@t4h.framework/core": "^0.14.0",
64
64
  "@t4h.framework/fs": "^0.9.4",
65
65
  "@t4h.framework/hmac": "^0.3.1",
66
- "@t4h.framework/http": "^0.6.3",
66
+ "@t4h.framework/http": "^0.0.0-experimental-20260911032832",
67
67
  "@t4h.framework/jwks": "^0.7.0",
68
68
  "@t4h.framework/oidc": "^0.6.4",
69
69
  "@t4h.framework/orm": "^0.7.5",
70
70
  "@t4h.framework/runtime-claims": "^0.1.0",
71
71
  "@t4h.framework/sftp": "^0.7.4",
72
72
  "@t4h.framework/smtp": "^0.6.4",
73
- "@t4h.framework/webhook": "^0.2.1",
73
+ "@t4h.framework/webhook": "^0.0.0-experimental-20260911032832",
74
74
  "@types/dot-object": "^2.1.6",
75
75
  "@types/json-schema": "^7.0.15",
76
76
  "@types/mime-types": "^3",
@@ -85,14 +85,14 @@
85
85
  "@t4h.framework/core": "^0.14.0",
86
86
  "@t4h.framework/fs": "^0.9.4",
87
87
  "@t4h.framework/hmac": "^0.3.1",
88
- "@t4h.framework/http": "^0.6.3",
88
+ "@t4h.framework/http": "^0.0.0-experimental-20260911032832",
89
89
  "@t4h.framework/jwks": "^0.7.0",
90
90
  "@t4h.framework/oidc": "^0.6.4",
91
91
  "@t4h.framework/orm": "^0.7.5",
92
92
  "@t4h.framework/runtime-claims": "^0.1.0",
93
93
  "@t4h.framework/sftp": "^0.7.4",
94
94
  "@t4h.framework/smtp": "^0.6.4",
95
- "@t4h.framework/webhook": "^0.2.1",
95
+ "@t4h.framework/webhook": "^0.0.0-experimental-20260911032832",
96
96
  "typescript": "^5.9.3"
97
97
  },
98
98
  "peerDependenciesMeta": {