@sincpro/client-framework 1.10.0 → 1.11.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/README.md +27 -1
- package/dist/client/domain/transport.d.ts +13 -0
- package/dist/client/domain/transport.js +27 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/services/guarded.d.ts +1 -1
- package/dist/client/services/guarded.js +2 -1
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +1 -1
- package/dist/common/time.d.ts +28 -0
- package/dist/common/time.js +49 -0
- package/dist/core/entrypoint/screens.d.ts +1 -1
- package/dist/core/entrypoint/screens.js +3 -3
- package/dist/core/infrastructure/process.d.ts +9 -0
- package/dist/core/infrastructure/process.js +2 -0
- package/dist/model/domain/meta.d.ts +2 -2
- package/dist/model/domain/meta.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -509,6 +509,7 @@ import { sentryReporter } from "@sincpro/client-framework/sentry";
|
|
|
509
509
|
|
|
510
510
|
configureProcess({
|
|
511
511
|
identity: { release: "forge-web:1.4.0" }, // + tenant, when the deployment serves one
|
|
512
|
+
timeZone: { keys: ["timezone"] }, // where a run's zone is read from — the backend's key, the default
|
|
512
513
|
tracer: openTelemetryTracer(provider.getTracer("forge-web")), // the app's provider
|
|
513
514
|
reporter: sentryReporter(client), // the app's Sentry or GlitchTip client
|
|
514
515
|
logger: { mode: production ? "production" : "development" },
|
|
@@ -625,6 +626,26 @@ optional `watch`. `memoryContexts()` is the default; a browser, a phone or a ser
|
|
|
625
626
|
its own. `values` is the same object until it changes, so a screen can hand it to React's
|
|
626
627
|
`useSyncExternalStore`.
|
|
627
628
|
|
|
629
|
+
### The time zone of a run
|
|
630
|
+
|
|
631
|
+
A run reads days and times in the zone its context says, not in the device's: a user in La Paz
|
|
632
|
+
looking at a company in Madrid sees «today» as Madrid's. The zone is the context's `timezone` —
|
|
633
|
+
the key sincpro_framework reads to cut `today` and `period` —; with none, the process's zone
|
|
634
|
+
(`installTimeZone`, else the platform's).
|
|
635
|
+
|
|
636
|
+
```ts
|
|
637
|
+
await salesBoundedContext.scoped({ timezone: "Europe/Madrid" }).execute(new CommandQuote(1));
|
|
638
|
+
|
|
639
|
+
const zone = timeZoneOf(this.execution); // or timeZoneOf(context)
|
|
640
|
+
dayOf(instant, zone); // «today» for that company
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
The context travels to the server in `sincpro-context`, so under `timezone` the backend cuts days
|
|
644
|
+
the same way. An application that keeps the zone under another key names it —
|
|
645
|
+
`configureProcess({ timeZone: { keys: ["company_zone", "timezone"] } })`, the first found wins —,
|
|
646
|
+
but the backend reads only `timezone`: a zone under another key is the client's alone, and the
|
|
647
|
+
server cuts in UTC.
|
|
648
|
+
|
|
628
649
|
## Talking to a server
|
|
629
650
|
|
|
630
651
|
A remote service is reached through a port. The generated client never names a wire: it says
|
|
@@ -653,6 +674,7 @@ await forge.sendIssue({ issue_id: "acme-3", message: "hola" }); // ResponseSendI
|
|
|
653
674
|
| `retryKeys()` | one `Idempotency-Key` per gesture, kept while a retry may repeat it |
|
|
654
675
|
| `guardedTransport(t, breaker)` | every call of a transport through a circuit breaker |
|
|
655
676
|
| `screensTransport(transport)` | screen reads and writes run as use cases of `screens`: traced and reported |
|
|
677
|
+
| `markedAs(wrapper, inner)` | a wrapper of a screens transport keeps its mark: one `screens` context, not two |
|
|
656
678
|
| `parquetDecoder` (`./parquet`) | large pages read as Parquet through the same transport |
|
|
657
679
|
|
|
658
680
|
Inside a Feature, inject the generated client as it is: the run binds it, so every call carries
|
|
@@ -660,6 +682,10 @@ its trace (`traceparent`), its context (`sincpro-context`) and its signal — as
|
|
|
660
682
|
as metadata where a platform's adapter puts them. `screensTransport` and `entity()` stay on the
|
|
661
683
|
REST `Transport`: they are how a screen reads pages of an entity, with its model and its drafts.
|
|
662
684
|
|
|
685
|
+
A wrapper over a screens transport — a cache, a guard — keeps its mark, so the screens are not made
|
|
686
|
+
twice: `guardedTransport` does it, and a platform's own wrapper calls `markedAs(wrapper, inner)`.
|
|
687
|
+
One span then answers each screen read, whether the wrapper answered it from its own memory or not.
|
|
688
|
+
|
|
663
689
|
### What a write changed
|
|
664
690
|
|
|
665
691
|
A client keeps what it read — a cache, a list on screen, a record — and every one of them goes
|
|
@@ -806,7 +832,7 @@ needs them.
|
|
|
806
832
|
| Decimal | exact text, `"10.50"` | `Decimal` |
|
|
807
833
|
| Money | `{ amount: "10.50", currency: "BOB" }` | `Money` |
|
|
808
834
|
| Day | `"2026-10-02"`, never an instant | `isDay`, `dayOf` |
|
|
809
|
-
| Instant | ISO text | `wallTimeOf`, `instantOf`
|
|
835
|
+
| Instant | ISO text | `wallTimeOf`, `instantOf`, `timeZoneOf` |
|
|
810
836
|
| ID | UUID v7 as 32 hex | `newEntityId`, `isEntityId`, `momentOf` |
|
|
811
837
|
| Bytes | `{ "$bytes": "<base64>" }` | `valuesOf`, `readValues` |
|
|
812
838
|
| Collection | items, count and cursor | `collectionOf`, `isPartial`, `relatedCriteria` |
|
|
@@ -11,7 +11,18 @@ import type { AnyRecord, Criteria, Dropped, Envelope, Meta, Page, Problem } from
|
|
|
11
11
|
* Every adapter throws `TransportError` for a refusal, so a screen explains a failure once
|
|
12
12
|
* whichever wire it came over.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* The mark of a screens transport: `screensTransport` answers one it already made, and a wrapper
|
|
16
|
+
* over one (`cachedTransport`, `guardedTransport`) copies the mark, so the screens are not made
|
|
17
|
+
* twice — one span per screen read, however many wrappers stand between.
|
|
18
|
+
*
|
|
19
|
+
* Context: a mark, not a remembered object — a wrapper is a new object, and the screens context
|
|
20
|
+
* it sits on is the one that answers. A platform's wrapper copies it with `markedAs`.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SCREENS: unique symbol;
|
|
14
23
|
export interface Transport {
|
|
24
|
+
/** Set on a screens transport and on what wraps one (`SCREENS`). */
|
|
25
|
+
[SCREENS]?: true;
|
|
15
26
|
/** A page of records under the criteria. */
|
|
16
27
|
list<T>(route: string, criteria: Criteria<T>, signal?: AbortSignal, options?: CallOptions): Promise<Page<T>>;
|
|
17
28
|
/** One record, with the definition of its model. */
|
|
@@ -123,3 +134,5 @@ export declare class TransportError extends Error {
|
|
|
123
134
|
readonly problem: Problem | null;
|
|
124
135
|
constructor(route: string, status: number | null, problem: Problem | null, message?: string);
|
|
125
136
|
}
|
|
137
|
+
/** Carries the screens mark from `from` onto `to`, a wrapper of it; `to` is answered. */
|
|
138
|
+
export declare function markedAs<T extends Transport>(to: T, from: Transport): T;
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one seam between this package and a server.
|
|
3
|
+
*
|
|
4
|
+
* Context: a list and a record are the same two questions whatever the wire is — «a page of
|
|
5
|
+
* these, under this criteria» and «this one». REST today; JSON-RPC and gRPC are the other
|
|
6
|
+
* wires sincpro_framework serves. Each of those is
|
|
7
|
+
* one adapter implementing this, and nothing above it changes. A route is a string the adapter
|
|
8
|
+
* understands: a path for REST, a method for RPC.
|
|
9
|
+
*
|
|
10
|
+
* Every adapter throws `TransportError` for a refusal, so a screen explains a failure once
|
|
11
|
+
* whichever wire it came over.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The mark of a screens transport: `screensTransport` answers one it already made, and a wrapper
|
|
15
|
+
* over one (`cachedTransport`, `guardedTransport`) copies the mark, so the screens are not made
|
|
16
|
+
* twice — one span per screen read, however many wrappers stand between.
|
|
17
|
+
*
|
|
18
|
+
* Context: a mark, not a remembered object — a wrapper is a new object, and the screens context
|
|
19
|
+
* it sits on is the one that answers. A platform's wrapper copies it with `markedAs`.
|
|
20
|
+
*/
|
|
21
|
+
export const SCREENS = Symbol.for("sincpro.client-framework.screens");
|
|
1
22
|
/** A download through `transport.download`, or the reason it cannot be, by name. */
|
|
2
23
|
export function downloadRoute(transport, route, signal, options) {
|
|
3
24
|
if (transport.download === undefined)
|
|
@@ -30,3 +51,9 @@ export class TransportError extends Error {
|
|
|
30
51
|
this.name = "TransportError";
|
|
31
52
|
}
|
|
32
53
|
}
|
|
54
|
+
/** Carries the screens mark from `from` onto `to`, a wrapper of it; `to` is answered. */
|
|
55
|
+
export function markedAs(to, from) {
|
|
56
|
+
if (from[SCREENS] === true)
|
|
57
|
+
to[SCREENS] = true;
|
|
58
|
+
return to;
|
|
59
|
+
}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { type Change, type ChangeFeed, changeOf, } from "./domain/changes.js";
|
|
|
16
16
|
export { type ClientContract, entityKeyOf, kindOf, metasOf, versionsOf, } from "./domain/contract.js";
|
|
17
17
|
export { bodyFor, type CommandAnswers, type CommandBodies, type CommandRoute, type Entity, entity, type EntityRef, type EntityRoutes, type ExportFormat, exportRoute, listRoute, NEW_PARAM, pathFor, PICK_PARAM, QUERY_PARAM, SCOPE_PARAM, scopeOfRef, startingValuesOf, type SummaryFields, type SummaryPart, TRAIL_PARAM, WITH_PARAM, type WriteRoute, writeRoute, } from "./domain/entity.js";
|
|
18
18
|
export { OperationNotPublished, type OperationOptions, type OperationTransport, type RemoteOperation, } from "./domain/operation.js";
|
|
19
|
-
export { type CallOptions, type Decoder, type Download, downloadRoute, type Draft, type Method, type One, readRoute, type SendOptions, type Transport, TransportError, } from "./domain/transport.js";
|
|
19
|
+
export { type CallOptions, type Decoder, type Download, downloadRoute, type Draft, markedAs, type Method, type One, readRoute, SCREENS, type SendOptions, type Transport, TransportError, } from "./domain/transport.js";
|
|
20
20
|
export { announced, changeFeed, processChanges, } from "./services/changes.js";
|
|
21
21
|
export { guardedTransport } from "./services/guarded.js";
|
|
22
22
|
export { bindable, bindableOperations, bindableTransport, bindOperations, bindTransport, headersOf, } from "./services/propagation.js";
|
package/dist/client/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export { changeOf, } from "./domain/changes.js";
|
|
|
16
16
|
export { entityKeyOf, kindOf, metasOf, versionsOf, } from "./domain/contract.js";
|
|
17
17
|
export { bodyFor, entity, exportRoute, listRoute, NEW_PARAM, pathFor, PICK_PARAM, QUERY_PARAM, SCOPE_PARAM, scopeOfRef, startingValuesOf, TRAIL_PARAM, WITH_PARAM, writeRoute, } from "./domain/entity.js";
|
|
18
18
|
export { OperationNotPublished, } from "./domain/operation.js";
|
|
19
|
-
export { downloadRoute, readRoute, TransportError, } from "./domain/transport.js";
|
|
19
|
+
export { downloadRoute, markedAs, readRoute, SCREENS, TransportError, } from "./domain/transport.js";
|
|
20
20
|
export { announced, changeFeed, processChanges, } from "./services/changes.js";
|
|
21
21
|
export { guardedTransport } from "./services/guarded.js";
|
|
22
22
|
export { bindable, bindableOperations, bindableTransport, bindOperations, bindTransport, headersOf, } from "./services/propagation.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CircuitBreaker } from "../../circuit_breaker/entrypoint/circuit-breaker.js";
|
|
2
2
|
import { type OperationTransport } from "../domain/operation.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type Transport } from "../domain/transport.js";
|
|
4
4
|
/**
|
|
5
5
|
* `transport`, every call through `breaker` — an `OperationTransport` of any wire, or REST's
|
|
6
6
|
* `Transport`:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isOperationTransport, } from "../domain/operation.js";
|
|
2
|
+
import { markedAs, } from "../domain/transport.js";
|
|
2
3
|
import { bindableOperations, bindableTransport, } from "./propagation.js";
|
|
3
4
|
export function guardedTransport(transport, breaker) {
|
|
4
5
|
if (isOperationTransport(transport))
|
|
@@ -16,5 +17,5 @@ export function guardedTransport(transport, breaker) {
|
|
|
16
17
|
const download = transport.download;
|
|
17
18
|
if (download !== undefined)
|
|
18
19
|
guarded.download = (route, signal, options) => breaker.call(() => download.call(transport, route, signal, options));
|
|
19
|
-
return bindableTransport(guarded);
|
|
20
|
+
return bindableTransport(markedAs(guarded, transport));
|
|
20
21
|
}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export { type DeclaredFailure, type Failure, failureOf, kindOfGrpcCode, kindOfHt
|
|
|
8
8
|
export { isEntityId, momentOf, newEntityId } from "./ids.js";
|
|
9
9
|
export { Money } from "./money.js";
|
|
10
10
|
export { BYTES, type JsonValue, pack, readValues, type Rebuild, rebuilt, unpack, valuesOf, } from "./serialization.js";
|
|
11
|
-
export { dayOf, installTimeZone, instantOf, isDay, timeZoneNow, wallTimeOf, } from "./time.js";
|
|
11
|
+
export { dayOf, installTimeZone, instantOf, isDay, timeZoneNow, timeZoneOf, wallTimeOf, } from "./time.js";
|
package/dist/common/index.js
CHANGED
|
@@ -8,4 +8,4 @@ export { failureOf, kindOfGrpcCode, kindOfHttpStatus, kindOfJsonRpcCode, PERMANE
|
|
|
8
8
|
export { isEntityId, momentOf, newEntityId } from "./ids.js";
|
|
9
9
|
export { Money } from "./money.js";
|
|
10
10
|
export { BYTES, pack, readValues, rebuilt, unpack, valuesOf, } from "./serialization.js";
|
|
11
|
-
export { dayOf, installTimeZone, instantOf, isDay, timeZoneNow, wallTimeOf, } from "./time.js";
|
|
11
|
+
export { dayOf, installTimeZone, instantOf, isDay, timeZoneNow, timeZoneOf, wallTimeOf, } from "./time.js";
|
package/dist/common/time.d.ts
CHANGED
|
@@ -22,6 +22,33 @@
|
|
|
22
22
|
export declare function installTimeZone(timeZone: string | undefined): void;
|
|
23
23
|
/** The time zone in use. */
|
|
24
24
|
export declare function timeZoneNow(): string;
|
|
25
|
+
/**
|
|
26
|
+
* The context keys a run's time zone is read from, first found wins. `undefined` goes back to
|
|
27
|
+
* `timezone`. Set by `configureProcess({ timeZone: { keys } })`, as the identity's keys are.
|
|
28
|
+
*/
|
|
29
|
+
export declare function installTimeZoneKeys(keys: string | readonly string[] | undefined): void;
|
|
30
|
+
/** The context of a run, or any context: what `timeZoneOf` reads. */
|
|
31
|
+
type ZoneContext = Readonly<Record<string, unknown>>;
|
|
32
|
+
type ZoneRun = {
|
|
33
|
+
readonly useCase: string;
|
|
34
|
+
readonly context: ZoneContext;
|
|
35
|
+
};
|
|
36
|
+
type ZoneSource = ZoneContext | ZoneRun;
|
|
37
|
+
/**
|
|
38
|
+
* The time zone a run reads dates in: its context's, under the key the application named
|
|
39
|
+
* (`timezone` by default, the backend's), else the process's (`timeZoneNow`). Takes an execution
|
|
40
|
+
* or a context.
|
|
41
|
+
*
|
|
42
|
+
* timeZoneOf(execution) → the company's zone, when the run carries one
|
|
43
|
+
* dayOf(instant, timeZoneOf(execution)) → «today» for that company
|
|
44
|
+
*
|
|
45
|
+
* Context: the process's zone is the device's, or the one a platform installed for the company in
|
|
46
|
+
* use; a run whose context says another belongs to another company (a user in La Paz looking at
|
|
47
|
+
* Madrid). Read on every call, never kept, so a run's zone is its own. The context travels in
|
|
48
|
+
* `sincpro-context`, and the backend reads only `timezone`: a zone kept under another key is this
|
|
49
|
+
* client's alone, and the server cuts its days in UTC.
|
|
50
|
+
*/
|
|
51
|
+
export declare function timeZoneOf(source: ZoneSource): string;
|
|
25
52
|
/** `"2026-03-12T14:30:00Z"` → `"2026-03-12T10:30"` in `America/La_Paz`: the wall clock there,
|
|
26
53
|
* as a date-and-time control reads it. `null` when it is not an instant. */
|
|
27
54
|
export declare function wallTimeOf(instant: string, timeZone: string): string | null;
|
|
@@ -39,3 +66,4 @@ export declare function isDay(text: string): boolean;
|
|
|
39
66
|
/** The day it is at `instant` on the wall clock of `timeZone`: what «today» means for a company.
|
|
40
67
|
* `null` when it is not an instant. */
|
|
41
68
|
export declare function dayOf(instant: string, timeZone: string): string | null;
|
|
69
|
+
export {};
|
package/dist/common/time.js
CHANGED
|
@@ -27,6 +27,55 @@ export function installTimeZone(timeZone) {
|
|
|
27
27
|
export function timeZoneNow() {
|
|
28
28
|
return installed ?? Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The context key a run's time zone is read from, unless the application names another: the
|
|
32
|
+
* backend's own (`ambient_resolution`, `context.get("timezone")`), so the zone a client reads in
|
|
33
|
+
* is the one the server cuts `today` and `period` with.
|
|
34
|
+
*/
|
|
35
|
+
const DEFAULT_TIME_ZONE_KEYS = ["timezone"];
|
|
36
|
+
let zoneKeys = DEFAULT_TIME_ZONE_KEYS;
|
|
37
|
+
/**
|
|
38
|
+
* The context keys a run's time zone is read from, first found wins. `undefined` goes back to
|
|
39
|
+
* `timezone`. Set by `configureProcess({ timeZone: { keys } })`, as the identity's keys are.
|
|
40
|
+
*/
|
|
41
|
+
export function installTimeZoneKeys(keys) {
|
|
42
|
+
zoneKeys =
|
|
43
|
+
keys === undefined
|
|
44
|
+
? DEFAULT_TIME_ZONE_KEYS
|
|
45
|
+
: typeof keys === "string"
|
|
46
|
+
? [keys]
|
|
47
|
+
: [...keys];
|
|
48
|
+
}
|
|
49
|
+
/** An execution, not a context that happens to have a `useCase` key. */
|
|
50
|
+
function isRun(source) {
|
|
51
|
+
const context = source.context;
|
|
52
|
+
return (typeof source.useCase === "string" &&
|
|
53
|
+
typeof context === "object" &&
|
|
54
|
+
context !== null);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The time zone a run reads dates in: its context's, under the key the application named
|
|
58
|
+
* (`timezone` by default, the backend's), else the process's (`timeZoneNow`). Takes an execution
|
|
59
|
+
* or a context.
|
|
60
|
+
*
|
|
61
|
+
* timeZoneOf(execution) → the company's zone, when the run carries one
|
|
62
|
+
* dayOf(instant, timeZoneOf(execution)) → «today» for that company
|
|
63
|
+
*
|
|
64
|
+
* Context: the process's zone is the device's, or the one a platform installed for the company in
|
|
65
|
+
* use; a run whose context says another belongs to another company (a user in La Paz looking at
|
|
66
|
+
* Madrid). Read on every call, never kept, so a run's zone is its own. The context travels in
|
|
67
|
+
* `sincpro-context`, and the backend reads only `timezone`: a zone kept under another key is this
|
|
68
|
+
* client's alone, and the server cuts its days in UTC.
|
|
69
|
+
*/
|
|
70
|
+
export function timeZoneOf(source) {
|
|
71
|
+
const context = isRun(source) ? source.context : source;
|
|
72
|
+
for (const key of zoneKeys) {
|
|
73
|
+
const value = context[key];
|
|
74
|
+
if (typeof value === "string" && value.trim() !== "")
|
|
75
|
+
return value.trim();
|
|
76
|
+
}
|
|
77
|
+
return timeZoneNow();
|
|
78
|
+
}
|
|
30
79
|
const clocks = new Map();
|
|
31
80
|
/** One formatter per zone, kept: building one costs far more than using it. */
|
|
32
81
|
function clockOf(timeZone) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Transport } from "../../client/domain/transport.js";
|
|
2
2
|
/**
|
|
3
3
|
* Screen requests enter the same command pipeline as application services. A generated
|
|
4
4
|
* client injected into a Feature uses its raw transport instead, continuing that execution.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SCREENS, } from "../../client/domain/transport.js";
|
|
1
2
|
import { bindableTransport } from "../../client/services/propagation.js";
|
|
2
3
|
import { Command } from "../domain/dto.js";
|
|
3
4
|
import { Feature } from "../domain/services.js";
|
|
@@ -101,13 +102,12 @@ class EntitySend extends Feature {
|
|
|
101
102
|
return this.transport.send(dto.method, dto.route, dto.body, dto.signal, dto.options);
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
const MADE = new WeakSet();
|
|
105
105
|
/**
|
|
106
106
|
* Screen requests enter the same command pipeline as application services. A generated
|
|
107
107
|
* client injected into a Feature uses its raw transport instead, continuing that execution.
|
|
108
108
|
*/
|
|
109
109
|
export function screensTransport(transport, name = "screens") {
|
|
110
|
-
if (
|
|
110
|
+
if (transport[SCREENS] === true)
|
|
111
111
|
return transport;
|
|
112
112
|
const screens = new BoundedContext(name);
|
|
113
113
|
screens.addDependency("transport", transport);
|
|
@@ -127,6 +127,6 @@ export function screensTransport(transport, name = "screens") {
|
|
|
127
127
|
if (transport.download) {
|
|
128
128
|
through.download = (route, signal, options) => screens.execute(new Export(route, signal, options));
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
through[SCREENS] = true;
|
|
131
131
|
return bindableTransport(through);
|
|
132
132
|
}
|
|
@@ -55,6 +55,15 @@ export type ProcessOptions = {
|
|
|
55
55
|
tenant?: string;
|
|
56
56
|
keys?: IdentityKeys;
|
|
57
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* The context key a run's time zone is read from (`timezone` by default — the backend's, see
|
|
60
|
+
* `timeZoneOf`). Another key is read only here: the backend reads `timezone` alone.
|
|
61
|
+
* An application that keeps its company's zone under another name says `keys: "company_zone"`
|
|
62
|
+
* — or a list, the first found wins.
|
|
63
|
+
*/
|
|
64
|
+
timeZone?: {
|
|
65
|
+
keys?: string | readonly string[];
|
|
66
|
+
};
|
|
58
67
|
/** The platform's (OpenTelemetry in a browser, a queue on a phone, memory in a test). */
|
|
59
68
|
tracer?: Tracer;
|
|
60
69
|
/** The platform's (GlitchTip, Sentry, memory in a test). Only what nobody expected reaches it. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { installTimeZoneKeys } from "../../common/time.js";
|
|
1
2
|
import { memoryContexts } from "../../context/adapters/memory.js";
|
|
2
3
|
import { replaceProcessStore } from "../../context/infrastructure/process.js";
|
|
3
4
|
import { consoleLogger, } from "../../observability/adapters/console.js";
|
|
@@ -31,6 +32,7 @@ export function configureProcess(options = {}) {
|
|
|
31
32
|
logger,
|
|
32
33
|
outcomeOf: options.outcomeOf ?? outcomeOf,
|
|
33
34
|
});
|
|
35
|
+
installTimeZoneKeys(options.timeZone?.keys);
|
|
34
36
|
replaceProcessStore(options.context ?? memoryContexts());
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
@@ -27,8 +27,8 @@ export type FieldOptions = {
|
|
|
27
27
|
help?: Words;
|
|
28
28
|
required?: boolean;
|
|
29
29
|
readonly?: boolean;
|
|
30
|
-
/** Holds no value sometimes.
|
|
31
|
-
*
|
|
30
|
+
/** Holds no value sometimes. It still orders, as sincpro_framework orders it: NULL first
|
|
31
|
+
* ascending and last descending, and the keyset walks past it. */
|
|
32
32
|
nullable?: boolean;
|
|
33
33
|
default?: unknown;
|
|
34
34
|
/** Form hints over the record, as sincpro_framework's `Presentation` publishes them. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sincpro/client-framework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "The client side of sincpro_framework, for every platform: Feature and ApplicationService traced and reported by default, applications made of domains, and the typed client generated from a service's contract. No React, no DOM.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|