@sincpro/client-framework 0.6.0 → 1.0.0
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/AGENTS.md +54 -25
- package/MANIFESTO.md +59 -39
- package/README.md +324 -345
- package/dist/client/{memory.d.ts → adapters/memory.d.ts} +1 -1
- package/dist/client/{memory.js → adapters/memory.js} +2 -2
- package/dist/{adapters → client/adapters}/parquet.d.ts +1 -1
- package/dist/client/{rest.d.ts → adapters/rest.d.ts} +1 -1
- package/dist/client/{rest.js → adapters/rest.js} +2 -2
- package/dist/client/{entity.d.ts → domain/entity.d.ts} +6 -10
- package/dist/client/index.d.ts +16 -0
- package/dist/client/index.js +16 -0
- package/dist/client/services/propagation.d.ts +32 -0
- package/dist/{services/execution.js → client/services/propagation.js} +5 -21
- package/dist/client/{retry.js → services/retry.js} +1 -1
- package/dist/codegen/{metamodel.d.ts → domain/metamodel.d.ts} +17 -2
- package/dist/codegen/{names.d.ts → domain/names.d.ts} +2 -2
- package/dist/codegen/{names.js → domain/names.js} +3 -3
- package/dist/codegen/{cli.js → entrypoint/cli.js} +9 -8
- package/dist/codegen/index.d.ts +7 -7
- package/dist/codegen/index.js +5 -10
- package/dist/codegen/{client.d.ts → services/client.d.ts} +3 -1
- package/dist/codegen/{client.js → services/client.js} +9 -1
- package/dist/codegen/services/domain.d.ts +20 -0
- package/dist/codegen/{domain.js → services/domain.js} +82 -25
- package/dist/codegen/{entities.d.ts → services/entities.d.ts} +4 -3
- package/dist/codegen/{entities.js → services/entities.js} +18 -4
- package/dist/codegen/{rest.d.ts → services/rest.d.ts} +1 -1
- package/dist/codegen/{scaffold.d.ts → services/scaffold.d.ts} +2 -2
- package/dist/codegen/{scaffold.js → services/scaffold.js} +31 -36
- package/dist/common/index.d.ts +10 -0
- package/dist/common/index.js +10 -0
- package/dist/context/adapters/memory.d.ts +6 -0
- package/dist/context/adapters/memory.js +34 -0
- package/dist/context/adapters/plain-codec.d.ts +3 -0
- package/dist/context/adapters/plain-codec.js +16 -0
- package/dist/context/{codec.d.ts → domain/codec.d.ts} +0 -1
- package/dist/context/{codec.js → domain/codec.js} +0 -14
- package/dist/context/domain/execution.d.ts +33 -0
- package/dist/context/domain/execution.js +11 -0
- package/dist/context/{store.d.ts → domain/store.d.ts} +0 -5
- package/dist/context/{store.js → domain/store.js} +1 -34
- package/dist/context/{context.d.ts → entrypoint/context.d.ts} +1 -1
- package/dist/context/index.d.ts +17 -0
- package/dist/context/index.js +15 -0
- package/dist/context/infrastructure/process.d.ts +13 -0
- package/dist/context/infrastructure/process.js +35 -0
- package/dist/core/domain/bus.d.ts +18 -0
- package/dist/core/domain/bus.js +18 -0
- package/dist/core/domain/dto.d.ts +32 -0
- package/dist/core/domain/dto.js +20 -0
- package/dist/core/domain/errors.d.ts +18 -0
- package/dist/core/domain/errors.js +1 -0
- package/dist/core/domain/services.d.ts +37 -0
- package/dist/core/domain/services.js +28 -0
- package/dist/core/entrypoint/bounded-context.d.ts +70 -0
- package/dist/core/entrypoint/bounded-context.js +252 -0
- package/dist/core/entrypoint/screens.d.ts +6 -0
- package/dist/core/entrypoint/screens.js +136 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +16 -0
- package/dist/core/infrastructure/process.d.ts +56 -0
- package/dist/core/infrastructure/process.js +35 -0
- package/dist/core/services/binding.d.ts +6 -0
- package/dist/core/services/binding.js +13 -0
- package/dist/core/services/error-handlers.d.ts +11 -0
- package/dist/core/services/error-handlers.js +21 -0
- package/dist/core/services/execution.d.ts +35 -0
- package/dist/core/services/execution.js +137 -0
- package/dist/index.d.ts +16 -38
- package/dist/index.js +16 -38
- package/dist/model/index.d.ts +10 -0
- package/dist/model/index.js +10 -0
- package/dist/model/{metas.d.ts → infrastructure/metas.d.ts} +1 -1
- package/dist/model/{schema.d.ts → services/schema.d.ts} +1 -1
- package/dist/model/{schema.js → services/schema.js} +1 -1
- package/dist/observability/adapters/console.d.ts +12 -0
- package/dist/observability/adapters/console.js +35 -0
- package/dist/observability/adapters/memory.d.ts +41 -0
- package/dist/observability/adapters/memory.js +49 -0
- package/dist/{adapters → observability/adapters}/opentelemetry.d.ts +1 -1
- package/dist/{adapters → observability/adapters}/sentry.d.ts +1 -1
- package/dist/observability/domain/errors.d.ts +23 -0
- package/dist/observability/domain/errors.js +8 -0
- package/dist/observability/domain/logging.d.ts +42 -0
- package/dist/observability/domain/logging.js +1 -0
- package/dist/observability/domain/tracing.d.ts +49 -0
- package/dist/observability/domain/tracing.js +20 -0
- package/dist/observability/index.d.ts +16 -0
- package/dist/observability/index.js +4 -0
- package/dist/observability/infrastructure/registry.d.ts +21 -0
- package/dist/observability/infrastructure/registry.js +18 -0
- package/dist/observability/services/logging.d.ts +27 -0
- package/dist/observability/services/logging.js +105 -0
- package/dist/observability/services/outcome.d.ts +12 -0
- package/dist/observability/services/outcome.js +20 -0
- package/dist/{services/report.js → observability/services/reporting.js} +4 -3
- package/dist/testing/index.d.ts +3 -33
- package/dist/testing/index.js +5 -37
- package/package.json +16 -8
- package/dist/codegen/domain.d.ts +0 -15
- package/dist/observability/ports.d.ts +0 -65
- package/dist/observability/ports.js +0 -21
- package/dist/services/bounded-context.d.ts +0 -79
- package/dist/services/bounded-context.js +0 -261
- package/dist/services/execution.d.ts +0 -63
- package/dist/services/feature.d.ts +0 -85
- package/dist/services/feature.js +0 -86
- package/dist/services/process.d.ts +0 -60
- package/dist/services/process.js +0 -57
- package/dist/services/screens.d.ts +0 -2
- package/dist/services/screens.js +0 -76
- /package/dist/{adapters → client/adapters}/parquet.js +0 -0
- /package/dist/client/{contract.d.ts → domain/contract.d.ts} +0 -0
- /package/dist/client/{contract.js → domain/contract.js} +0 -0
- /package/dist/client/{entity.js → domain/entity.js} +0 -0
- /package/dist/client/{transport.d.ts → domain/transport.d.ts} +0 -0
- /package/dist/client/{transport.js → domain/transport.js} +0 -0
- /package/dist/client/{discovery.d.ts → services/discovery.d.ts} +0 -0
- /package/dist/client/{discovery.js → services/discovery.js} +0 -0
- /package/dist/client/{retry.d.ts → services/retry.d.ts} +0 -0
- /package/dist/codegen/{metamodel.js → domain/metamodel.js} +0 -0
- /package/dist/codegen/{cli.d.ts → entrypoint/cli.d.ts} +0 -0
- /package/dist/codegen/{check.d.ts → services/check.d.ts} +0 -0
- /package/dist/codegen/{check.js → services/check.js} +0 -0
- /package/dist/codegen/{rest.js → services/rest.js} +0 -0
- /package/dist/context/{context.js → entrypoint/context.js} +0 -0
- /package/dist/model/{meta.d.ts → domain/meta.d.ts} +0 -0
- /package/dist/model/{meta.js → domain/meta.js} +0 -0
- /package/dist/model/{metas.js → infrastructure/metas.js} +0 -0
- /package/dist/{adapters → observability/adapters}/opentelemetry.js +0 -0
- /package/dist/{adapters → observability/adapters}/sentry.js +0 -0
- /package/dist/{services/report.d.ts → observability/services/reporting.d.ts} +0 -0
package/dist/services/screens.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { UseBoundedContext } from "./bounded-context.js";
|
|
2
|
-
import { Feature } from "./feature.js";
|
|
3
|
-
/**
|
|
4
|
-
* What a screen reads of an entity — a page, a record, a read of its own: sincpro_framework's
|
|
5
|
-
* built-in `EntityReads`, on the client.
|
|
6
|
-
*/
|
|
7
|
-
class EntityReads extends Feature {
|
|
8
|
-
list(route, criteria, signal, options) {
|
|
9
|
-
this.span.set({ "http.route": route });
|
|
10
|
-
return this.transport.list(route, criteria, signal, options);
|
|
11
|
-
}
|
|
12
|
-
one(route, signal, options) {
|
|
13
|
-
this.span.set({ "http.route": route });
|
|
14
|
-
return this.transport.one(route, signal, options);
|
|
15
|
-
}
|
|
16
|
-
read(route, signal, options) {
|
|
17
|
-
this.span.set({ "http.route": route });
|
|
18
|
-
const read = this.transport.read;
|
|
19
|
-
if (read === undefined)
|
|
20
|
-
return Promise.reject(new Error(`this transport cannot read ${route}: it has no read()`));
|
|
21
|
-
return read.call(this.transport, route, signal, options);
|
|
22
|
-
}
|
|
23
|
-
download(route, signal, options) {
|
|
24
|
-
this.span.set({ "http.route": route });
|
|
25
|
-
const download = this.transport.download;
|
|
26
|
-
if (download === undefined)
|
|
27
|
-
return Promise.reject(new Error(`this transport cannot download ${route}: it has no download()`));
|
|
28
|
-
return download.call(this.transport, route, signal, options);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/** What a screen writes — a save, a draft, a preview, a Command: each request a use case. */
|
|
32
|
-
class EntityWrites extends Feature {
|
|
33
|
-
send(method, route, body, signal, options) {
|
|
34
|
-
this.span.set({ "http.method": method, "http.route": route });
|
|
35
|
-
return this.transport.send(method, route, body, signal, options);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The transport, every call a use case of a bounded context of its own — `screens` unless named:
|
|
40
|
-
* what a platform hands the screens it draws.
|
|
41
|
-
*
|
|
42
|
-
* const screens = screensTransport(restTransport({ base: "/v1" }));
|
|
43
|
-
* await screens.list("/facturas", criteria); // span screens/EntityReads.list
|
|
44
|
-
*
|
|
45
|
-
* Context: a use case is traced, carries its context and reports what nobody expected; a list a
|
|
46
|
-
* screen reads through the transport was none of that — no span, no `traceparent` (the backend's
|
|
47
|
-
* trace started there, with no client in it), no company, and a 500 reported to nobody. Here
|
|
48
|
-
* each read and write runs as a use case of `screens` — `EntityReads.list`, `.one`, `.read`,
|
|
49
|
-
* `.download`, `EntityWrites.send` —, so it gets all three the way any other does: the span (its route said
|
|
50
|
-
* on it), the trace and the process's context on the request, and a report only when it failed
|
|
51
|
-
* (a 4xx the server explained is the screen's to show). A bounded context's own dependencies are
|
|
52
|
-
* never given this: there its use case is the one that runs.
|
|
53
|
-
*/
|
|
54
|
-
/** The transports this made: given one again, it is answered as it is — wrapped twice, each
|
|
55
|
-
* request would be two unrelated use cases, and the server would see only the outer's trace. */
|
|
56
|
-
const MADE = new WeakSet();
|
|
57
|
-
export function screensTransport(transport, name = "screens") {
|
|
58
|
-
if (MADE.has(transport))
|
|
59
|
-
return transport;
|
|
60
|
-
const screens = new UseBoundedContext(name)
|
|
61
|
-
.addDependency("transport", transport)
|
|
62
|
-
.register({ features: { EntityReads, EntityWrites } });
|
|
63
|
-
const reads = screens.EntityReads;
|
|
64
|
-
const writes = screens.EntityWrites;
|
|
65
|
-
const through = {
|
|
66
|
-
list: (route, criteria, signal, options) => reads.list(route, criteria, signal, options),
|
|
67
|
-
one: (route, signal, options) => reads.one(route, signal, options),
|
|
68
|
-
send: (method, route, body, signal, options) => writes.send(method, route, body, signal, options),
|
|
69
|
-
};
|
|
70
|
-
if (transport.read !== undefined)
|
|
71
|
-
through.read = (route, signal, options) => reads.read(route, signal, options);
|
|
72
|
-
if (transport.download !== undefined)
|
|
73
|
-
through.download = (route, signal, options) => reads.download(route, signal, options);
|
|
74
|
-
MADE.add(through);
|
|
75
|
-
return through;
|
|
76
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|