@sincpro/web-framework 1.1.0 → 2.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.
Files changed (121) hide show
  1. package/README.md +179 -78
  2. package/dist/core/cache.d.ts +1 -2
  3. package/dist/core/cache.js +8 -5
  4. package/dist/core/explain.d.ts +15 -0
  5. package/dist/core/{transport.js → explain.js} +4 -26
  6. package/dist/core/form.d.ts +1 -1
  7. package/dist/core/form.js +1 -0
  8. package/dist/core/index.d.ts +9 -15
  9. package/dist/core/index.js +8 -14
  10. package/dist/core/list.d.ts +5 -4
  11. package/dist/core/list.js +1 -0
  12. package/dist/core/lookup.d.ts +1 -1
  13. package/dist/core/lookup.js +1 -0
  14. package/dist/core/present.js +1 -1
  15. package/dist/core/relation.d.ts +1 -1
  16. package/dist/core/relation.js +1 -1
  17. package/dist/core/summary.d.ts +1 -6
  18. package/dist/core/trail.d.ts +1 -1
  19. package/dist/core/trail.js +1 -0
  20. package/dist/errors/index.d.ts +48 -0
  21. package/dist/errors/index.js +56 -0
  22. package/dist/react/context.d.ts +1 -3
  23. package/dist/react/context.js +1 -2
  24. package/dist/react/index.d.ts +2 -0
  25. package/dist/react/index.js +2 -0
  26. package/dist/react/scope.d.ts +1 -1
  27. package/dist/react/scope.js +1 -1
  28. package/dist/react/useCommand.d.ts +1 -1
  29. package/dist/react/useCommand.js +1 -2
  30. package/dist/react/useContextValues.d.ts +15 -0
  31. package/dist/react/useContextValues.js +19 -0
  32. package/dist/react/useHistory.d.ts +1 -1
  33. package/dist/react/useHistory.js +1 -0
  34. package/dist/react/useListing.d.ts +4 -4
  35. package/dist/react/useListing.js +6 -6
  36. package/dist/react/useLookup.d.ts +1 -1
  37. package/dist/react/useLookup.js +1 -0
  38. package/dist/react/useNameOf.d.ts +1 -1
  39. package/dist/react/useNameOf.js +1 -1
  40. package/dist/react/useRecord.d.ts +1 -2
  41. package/dist/react/useRecord.js +1 -4
  42. package/dist/react/useRelated.d.ts +1 -1
  43. package/dist/react/useRelated.js +1 -0
  44. package/dist/react/useService.d.ts +38 -0
  45. package/dist/react/useService.js +66 -0
  46. package/dist/react/useSummary.d.ts +1 -1
  47. package/dist/react/useSummary.js +1 -0
  48. package/dist/telemetry/index.d.ts +45 -0
  49. package/dist/telemetry/index.js +55 -0
  50. package/dist/web/Refused.js +1 -1
  51. package/dist/web/list/EntityList.d.ts +1 -1
  52. package/dist/web/list/EntityList.js +3 -3
  53. package/dist/web/list/EntitySearchBar.d.ts +2 -1
  54. package/dist/web/list/EntitySearchBar.js +17 -11
  55. package/dist/web/list/presentation.d.ts +1 -1
  56. package/dist/web/list/presentation.js +1 -0
  57. package/dist/web/list/rowCommands.d.ts +1 -1
  58. package/dist/web/list/rowCommands.js +1 -2
  59. package/dist/web/record/CommandButton.d.ts +1 -1
  60. package/dist/web/record/CommandButton.js +1 -0
  61. package/dist/web/record/EntityPicker.d.ts +1 -1
  62. package/dist/web/record/EntityPicker.js +1 -0
  63. package/dist/web/record/EntityTags.d.ts +1 -1
  64. package/dist/web/record/EntityTags.js +1 -0
  65. package/dist/web/record/RelatedList.d.ts +1 -1
  66. package/dist/web/record/RelatedList.js +1 -0
  67. package/dist/web/record/control.d.ts +1 -1
  68. package/dist/web/record/control.js +1 -1
  69. package/dist/web/record/edit.js +1 -0
  70. package/dist/web/record/opening.d.ts +1 -1
  71. package/dist/web/record/opening.js +1 -0
  72. package/dist/web/workspace/SincproApp.d.ts +1 -2
  73. package/dist/web/workspace/SincproApp.js +1 -0
  74. package/dist/web/workspace/composer.d.ts +1 -2
  75. package/dist/web/workspace/composer.js +2 -2
  76. package/dist/web/workspace/open.d.ts +1 -1
  77. package/dist/web/workspace/open.js +1 -0
  78. package/dist/web/workspace/record.d.ts +1 -1
  79. package/dist/web/workspace/record.js +1 -1
  80. package/dist/web/workspace/workspace.d.ts +1 -1
  81. package/dist/web/workspace/workspace.js +1 -0
  82. package/package.json +43 -13
  83. package/dist/codegen/cli.d.ts +0 -2
  84. package/dist/codegen/cli.js +0 -82
  85. package/dist/codegen/client.d.ts +0 -14
  86. package/dist/codegen/client.js +0 -178
  87. package/dist/codegen/domain.d.ts +0 -14
  88. package/dist/codegen/domain.js +0 -195
  89. package/dist/codegen/entities.d.ts +0 -14
  90. package/dist/codegen/entities.js +0 -158
  91. package/dist/codegen/index.d.ts +0 -11
  92. package/dist/codegen/index.js +0 -9
  93. package/dist/codegen/metamodel.d.ts +0 -89
  94. package/dist/codegen/metamodel.js +0 -1
  95. package/dist/codegen/names.d.ts +0 -40
  96. package/dist/codegen/names.js +0 -114
  97. package/dist/codegen/rest.d.ts +0 -31
  98. package/dist/codegen/rest.js +0 -27
  99. package/dist/core/contract.d.ts +0 -34
  100. package/dist/core/contract.js +0 -41
  101. package/dist/core/discovery.d.ts +0 -47
  102. package/dist/core/discovery.js +0 -68
  103. package/dist/core/entity.d.ts +0 -227
  104. package/dist/core/entity.js +0 -187
  105. package/dist/core/ids.d.ts +0 -17
  106. package/dist/core/ids.js +0 -52
  107. package/dist/core/memory.d.ts +0 -46
  108. package/dist/core/memory.js +0 -108
  109. package/dist/core/meta.d.ts +0 -121
  110. package/dist/core/meta.js +0 -130
  111. package/dist/core/metas.d.ts +0 -17
  112. package/dist/core/metas.js +0 -7
  113. package/dist/core/rest.d.ts +0 -49
  114. package/dist/core/rest.js +0 -143
  115. package/dist/core/retry.d.ts +0 -24
  116. package/dist/core/retry.js +0 -25
  117. package/dist/core/schema.d.ts +0 -39
  118. package/dist/core/schema.js +0 -128
  119. package/dist/core/transport.d.ts +0 -90
  120. package/dist/core/zone.d.ts +0 -27
  121. package/dist/core/zone.js +0 -75
@@ -0,0 +1,45 @@
1
+ import type { Attributes, Tracer } from "@sincpro/client-framework";
2
+ /**
3
+ * A `Tracer` for the browser, built from the application's own settings: OpenTelemetry's SDK
4
+ * exporting OTLP/HTTP to the endpoint the application names.
5
+ *
6
+ * // the application — domains/common/infrastructure/telemetry.ts
7
+ * import { browserTracer } from "./index.js";
8
+ * const tracer = browserTracer({ endpoint: settings.otlp, service: "forge-web", release });
9
+ * configureProcess({ tracer, reporter }); // entrypoints/main.tsx
10
+ *
11
+ * Context: optional on every count. It is an entry of its own that nothing else in this package
12
+ * imports, and its SDK (`@opentelemetry/sdk-trace`, `@opentelemetry/exporter-trace-otlp-http`,
13
+ * `@opentelemetry/resources`, `@opentelemetry/api`) is an optional peer: an application that
14
+ * does not import it installs nothing and ships nothing. It is also only a convenience — an
15
+ * application that wants its own provider builds it and wraps its tracer with
16
+ * `openTelemetryTracer` (`@sincpro/client-framework/opentelemetry`), or hands any object that
17
+ * fulfils the `Tracer` port.
18
+ *
19
+ * Like sincpro_framework's optional extras, it never breaks what it serves: the SDK loads after
20
+ * the first render (`import()`), and until it is there — or if it is not installed, or fails —
21
+ * use cases run untraced and send no `traceparent`; a failure to load is said once on the
22
+ * console. Nothing is registered globally: the provider is this tracer's own.
23
+ */
24
+ export type BrowserTracerOptions = {
25
+ /** The application's OTLP/HTTP traces endpoint (`https://collector.example.com/v1/traces`). */
26
+ endpoint: string;
27
+ /** `service.name`: what this application is called in the traces. */
28
+ service: string;
29
+ /** `service.version`: the release running. */
30
+ release?: string;
31
+ /** `deployment.environment.name`: `production`, `staging`… */
32
+ environment?: string;
33
+ /** Headers the endpoint asks for. Never a secret: whatever ships to a browser is public. */
34
+ headers?: Readonly<Record<string, string>>;
35
+ /** Fraction of traces kept, 0 to 1. Default 1 — a backoffice is low volume; sample in the
36
+ * Collector, where a trace is decided whole. */
37
+ sampling?: number;
38
+ /** More resource attributes (`tenant.group`, …). */
39
+ attributes?: Attributes;
40
+ };
41
+ export type BrowserTracer = Tracer & {
42
+ /** Sends what is buffered now. Called by itself when the page is hidden or left. */
43
+ flush: () => Promise<void>;
44
+ };
45
+ export declare function browserTracer(options: BrowserTracerOptions): BrowserTracer;
@@ -0,0 +1,55 @@
1
+ const SILENT = {
2
+ traceId: "",
3
+ spanId: "",
4
+ sampled: false,
5
+ set: () => undefined,
6
+ end: () => undefined,
7
+ };
8
+ export function browserTracer(options) {
9
+ let ready = null;
10
+ let flush = () => Promise.resolve();
11
+ void (async () => {
12
+ try {
13
+ const [{ TracerProvider, BatchSpanProcessor, TraceIdRatioBasedSampler, ParentBasedSampler }, { OTLPTraceExporter }, { resourceFromAttributes }, { openTelemetryTracer },] = await Promise.all([
14
+ import("@opentelemetry/sdk-trace"),
15
+ import("@opentelemetry/exporter-trace-otlp-http"),
16
+ import("@opentelemetry/resources"),
17
+ import("@sincpro/client-framework/opentelemetry"),
18
+ ]);
19
+ const exporter = new OTLPTraceExporter({
20
+ url: options.endpoint,
21
+ ...(options.headers ? { headers: { ...options.headers } } : {}),
22
+ });
23
+ const provider = new TracerProvider({
24
+ resource: resourceFromAttributes({
25
+ "service.name": options.service,
26
+ ...(options.release ? { "service.version": options.release } : {}),
27
+ ...(options.environment
28
+ ? { "deployment.environment.name": options.environment }
29
+ : {}),
30
+ ...options.attributes,
31
+ }),
32
+ sampler: new ParentBasedSampler({
33
+ root: new TraceIdRatioBasedSampler(options.sampling ?? 1),
34
+ }),
35
+ spanProcessors: [new BatchSpanProcessor({ exporter })],
36
+ });
37
+ ready = openTelemetryTracer(provider.getTracer(options.service));
38
+ flush = () => provider.forceFlush();
39
+ // A page that is hidden may never come back: what is buffered goes now.
40
+ const leave = () => void flush().catch(() => undefined);
41
+ globalThis.addEventListener?.("pagehide", leave);
42
+ globalThis.document?.addEventListener("visibilitychange", () => {
43
+ if (globalThis.document?.visibilityState === "hidden")
44
+ leave();
45
+ });
46
+ }
47
+ catch (error) {
48
+ console.warn("@sincpro/web-framework/telemetry: tracing is off — OpenTelemetry's SDK did not load", error);
49
+ }
50
+ })();
51
+ return {
52
+ start: (name, startOptions) => ready === null ? SILENT : ready.start(name, startOptions),
53
+ flush: () => flush(),
54
+ };
55
+ }
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { frameworkCopy } from "../core/copy.js";
4
- import { explain } from "../core/transport.js";
4
+ import { explain } from "../core/explain.js";
5
5
  import { Button, Failed } from "@sincpro/web-ui";
6
6
  /**
7
7
  * A failure, said the way the server said it: its title, what happened and what to do —
@@ -1,6 +1,6 @@
1
+ import { type CommandBodies } from "@sincpro/client-framework";
1
2
  import { type AnyRecord } from "@sincpro/criteria";
2
3
  import { type WorkspaceApi } from "@sincpro/web-composer";
3
- import { type CommandBodies } from "../../core/entity.js";
4
4
  import type { GroupLevel, NamedFilter } from "../../core/list.js";
5
5
  import type { Listing } from "../../react/useListing.js";
6
6
  import { type RowCommand } from "./rowCommands.js";
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { PICK_PARAM, QUERY_PARAM, TRAIL_PARAM, } from "@sincpro/client-framework";
3
4
  import { nameOf } from "@sincpro/criteria";
4
5
  import { RecordLink, useCrumbs } from "@sincpro/web-composer";
5
6
  import { frameworkCopy } from "../../core/copy.js";
6
- import { PICK_PARAM, QUERY_PARAM, TRAIL_PARAM, } from "../../core/entity.js";
7
+ import { explain } from "../../core/explain.js";
7
8
  import { textOf, viewOf } from "../../core/present.js";
8
- import { explain } from "../../core/transport.js";
9
9
  import { useFramework } from "../../react/context.js";
10
10
  import { useGroups } from "../../react/useGroups.js";
11
11
  import { usePivot } from "../../react/usePivot.js";
@@ -312,7 +312,7 @@ export function EntityList({ listing, api, columns: askedColumns, cells, views:
312
312
  error: failure === null
313
313
  ? null
314
314
  : [failure.heading, failure.sentence].filter(Boolean).join(". "),
315
- }, filtered: listing.where !== undefined || listing.text !== "", empty: {
315
+ }, filtered: listing.selection !== undefined || listing.text !== "", empty: {
316
316
  sentence: empty ?? copy.empty,
317
317
  whenFiltered: { sentence: copy.emptyFiltered },
318
318
  }, ...(selection === undefined ? {} : { selection }), ...(opening === undefined ? {} : { onOpen: opening }), ...(peeking === undefined ? {} : { onPeek: peeking, rowClick: "open" }), children: [_jsxs(List.Bar, { children: [trail === undefined || trail.length === 0 ? null : _jsx(List.Crumbs, { crumbs: trail }), embedded ? null : (_jsx(List.Identity, { title: title ?? nameOf(meta, locale), ...(description === undefined ? {} : { description }) })), search === "bar" ? (_jsx(List.Search, { children: _jsx(EntitySearchBar, { listing: listing, filters: filters, groups: groups, ...(asked === "" ? {} : { seed: asked }) }) })) : null, search === "box" && meta?.search != null ? (_jsx(List.Search, { children: _jsx(SearchField, { value: draft, onChange: (next) => {
@@ -15,7 +15,8 @@ import type { Listing } from "../../react/useListing.js";
15
15
  * - «search by name»: facets are the fields the entity's search template names first;
16
16
  * - a typed question («total > 5000») is checked against each field's operators;
17
17
  * - a named filter is one click; the builder writes what nobody foresaw (all/any/not);
18
- * - everything put becomes ONE `where` the SERVER answers (`listing.filter`);
18
+ * - everything put becomes ONE `selection` the SERVER answers (`listing.filter`) — web-ui
19
+ * writes it in criteria's own shape, a filter through a relation included;
19
20
  * - with `groups`, «Group by» offers the fields the model says may split the set, and the
20
21
  * SERVER counts the groups (`useGroups`).
21
22
  *
@@ -4,7 +4,7 @@ import { matching } from "@sincpro/criteria";
4
4
  import { frameworkCopy } from "../../core/copy.js";
5
5
  import { groupableOf } from "./groups.js";
6
6
  import { facetsOf, modelOf } from "./search.js";
7
- import { CriteriaBuilder, describeFilter, Dialog, fillCopy, filterCriteria, GroupingLevels, hasNamed, SearchBar, toggleNamed, useGroupingControl, useUiCopy, whereOf, } from "@sincpro/web-ui";
7
+ import { CriteriaBuilder, describeFilter, Dialog, fillCopy, filterCriteria, GroupingLevels, hasNamed, SearchBar, selectionOf, toggleNamed, useGroupingControl, useUiCopy, } from "@sincpro/web-ui";
8
8
  import { useEffect, useMemo, useRef, useState } from "react";
9
9
  /** No grouping: one constant, so the control is not handed a new array on every render. */
10
10
  const NO_LEVELS = [];
@@ -22,12 +22,12 @@ export function EntitySearchBar({ listing, filters = [], groups, seed, }) {
22
22
  if (seeded.current || seed === undefined || seed === "" || meta?.search == null)
23
23
  return;
24
24
  seeded.current = true;
25
- const where = matching(meta, seed).selection;
26
- if (where === undefined)
25
+ const literal = matching(meta, seed).selection;
26
+ if (literal === undefined)
27
27
  return;
28
- const chip = filterCriteria(where, fillCopy(ui.search.literalChip, { text: seed }));
28
+ const chip = filterCriteria(literal, fillCopy(ui.search.literalChip, { text: seed }));
29
29
  setPut([chip]);
30
- listing.filter(whereOf([chip]));
30
+ listing.filter(selectionOf([chip]));
31
31
  // Once the definition is known; what the person changes afterwards is theirs.
32
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
33
  }, [meta, seed]);
@@ -39,8 +39,10 @@ export function EntitySearchBar({ listing, filters = [], groups, seed, }) {
39
39
  return null;
40
40
  const place = (next) => {
41
41
  setPut(next);
42
- listing.filter(whereOf(next));
42
+ listing.filter(selectionOf(next));
43
43
  };
44
+ // What the bar holds, as one selection: what the builder opens on.
45
+ const current = selectionOf(put);
44
46
  return (_jsxs(_Fragment, { children: [_jsx(SearchBar, { facets: facets, model: model, criteria: put, onCriteriaChange: place, placeholder: copy.searchBar, ...(filters.length === 0
45
47
  ? {}
46
48
  : {
@@ -56,7 +58,11 @@ export function EntitySearchBar({ listing, filters = [], groups, seed, }) {
56
58
  onFilterSelect: (id) => {
57
59
  const named = filters.find((one) => one.id === id);
58
60
  if (named !== undefined)
59
- place(toggleNamed(put, { ...named, where: named.where }));
61
+ place(toggleNamed(put, {
62
+ id: named.id,
63
+ label: named.label,
64
+ selection: named.selection,
65
+ }));
60
66
  },
61
67
  }), ...(groups === undefined || groupable.length === 0
62
68
  ? {}
@@ -64,11 +70,11 @@ export function EntitySearchBar({ listing, filters = [], groups, seed, }) {
64
70
  ? {}
65
71
  : {
66
72
  literal: (text) => matching(meta, text).selection ?? null,
67
- }) }), building ? (_jsx(Dialog, { open: true, width: "lg", title: copy.builder, onClose: () => setBuilding(false), children: _jsx(CriteriaBuilder, { model: model, ...(whereOf(put) === undefined && listing.order.length === 0
73
+ }) }), building ? (_jsx(Dialog, { open: true, width: "lg", title: copy.builder, onClose: () => setBuilding(false), children: _jsx(CriteriaBuilder, { model: model, ...(current === undefined && listing.order.length === 0
68
74
  ? {}
69
75
  : {
70
76
  initial: {
71
- ...(whereOf(put) === undefined ? {} : { where: whereOf(put) }),
77
+ ...(current === undefined ? {} : { selection: current }),
72
78
  ...(listing.order.length === 0
73
79
  ? {}
74
80
  : {
@@ -79,9 +85,9 @@ export function EntitySearchBar({ listing, filters = [], groups, seed, }) {
79
85
  }),
80
86
  },
81
87
  }), onApply: (built) => {
82
- place(built?.where === undefined
88
+ place(built?.selection === undefined
83
89
  ? []
84
- : [filterCriteria(built.where, describeFilter(built.where, model))]);
90
+ : [filterCriteria(built.selection, describeFilter(built.selection, model))]);
85
91
  listing.orderBy((built?.order ?? []).map((one) => ({
86
92
  field: one.field,
87
93
  ...(one.descending === true ? { descending: true } : {}),
@@ -1,5 +1,5 @@
1
+ import { type CommandAnswers, type CommandBodies, type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord } from "@sincpro/criteria";
2
- import type { CommandAnswers, CommandBodies, Entity } from "../../core/entity.js";
3
3
  import { type ListDefinition } from "../../core/list.js";
4
4
  import type { PickerItem, RecordCard, RowOf } from "@sincpro/web-ui";
5
5
  import type { ComponentProps } from "react";
@@ -1,3 +1,4 @@
1
+ import {} from "@sincpro/client-framework";
1
2
  import { isList } from "../../core/list.js";
2
3
  /** The entity with how its records look: pass it wherever an entity goes. */
3
4
  export function presented(entity, presentation) {
@@ -1,5 +1,5 @@
1
+ import { type CommandBodies } from "@sincpro/client-framework";
1
2
  import { type AnyRecord, type Expression } from "@sincpro/criteria";
2
- import { type CommandBodies } from "../../core/entity.js";
3
3
  import type { Listing } from "../../react/useListing.js";
4
4
  import type { RowAction } from "@sincpro/web-ui";
5
5
  import type { LucideIcon } from "lucide-react";
@@ -1,7 +1,6 @@
1
1
  "use client";
2
+ import { bodyFor, pathFor, retryKeys } from "@sincpro/client-framework";
2
3
  import { matches } from "@sincpro/criteria";
3
- import { bodyFor, pathFor } from "../../core/entity.js";
4
- import { retryKeys } from "../../core/retry.js";
5
4
  import { useFramework } from "../../react/context.js";
6
5
  import { useCallback, useState } from "react";
7
6
  export function useRowCommands(listing, commands) {
@@ -1,5 +1,5 @@
1
+ import { type CommandAnswers, type CommandBodies, type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord } from "@sincpro/criteria";
2
- import type { CommandAnswers, CommandBodies, Entity } from "../../core/entity.js";
3
3
  import { type AnswerOf } from "../../react/useCommand.js";
4
4
  /**
5
5
  * An entity's Command as a button.
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { frameworkCopy } from "../../core/copy.js";
4
5
  import { useCommand } from "../../react/useCommand.js";
5
6
  import { Refused } from "../Refused.js";
@@ -1,5 +1,5 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord, Criteria } from "@sincpro/criteria";
2
- import type { Entity } from "../../core/entity.js";
3
3
  import { type ListDefinition } from "../../core/list.js";
4
4
  import { type OpenTarget } from "@sincpro/web-ui";
5
5
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { nameOf } from "@sincpro/criteria";
4
5
  import { frameworkCopy } from "../../core/copy.js";
5
6
  import { isList } from "../../core/list.js";
@@ -1,5 +1,5 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord, Criteria } from "@sincpro/criteria";
2
- import type { Entity } from "../../core/entity.js";
3
3
  import { type ListDefinition } from "../../core/list.js";
4
4
  import { type OpenTarget } from "@sincpro/web-ui";
5
5
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { isList } from "../../core/list.js";
4
5
  import { useFramework } from "../../react/context.js";
5
6
  import { excluding, useLookup } from "../../react/useLookup.js";
@@ -1,5 +1,5 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord } from "@sincpro/criteria";
2
- import type { Entity } from "../../core/entity.js";
3
3
  import type { RecordReading } from "../../react/useRecord.js";
4
4
  import { type EntityListProps } from "../list/EntityList.js";
5
5
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { frameworkCopy } from "../../core/copy.js";
4
5
  import { defaultFields } from "../../core/present.js";
5
6
  import { useRelated } from "../../react/useRelated.js";
@@ -1,5 +1,5 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord } from "@sincpro/criteria";
2
- import type { Entity } from "../../core/entity.js";
3
3
  import type { ReactNode } from "react";
4
4
  /** What a control of a field receives: its value, how to change it, and its state now. */
5
5
  export type FieldControl = {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { instantOf, timeZoneNow, wallTimeOf } from "../../core/zone.js";
3
+ import { instantOf, timeZoneNow, wallTimeOf } from "@sincpro/client-framework";
4
4
  import { EntityPicker } from "./EntityPicker.js";
5
5
  import { Checkbox, DatePicker, DateTimePicker, NumberInput, Select, TagsField, TextInput, } from "@sincpro/web-ui";
6
6
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { choicesOf } from "@sincpro/criteria";
4
5
  import { frameworkCopy } from "../../core/copy.js";
5
6
  import { errorAt } from "../../core/edit.js";
@@ -1,5 +1,5 @@
1
+ import { type Entity, type EntityRef } from "@sincpro/client-framework";
1
2
  import { type AnyRecord, type Criteria, type Expression } from "@sincpro/criteria";
2
- import type { Entity, EntityRef } from "../../core/entity.js";
3
3
  import { type ListDefinition } from "../../core/list.js";
4
4
  import type { OpenTarget } from "@sincpro/web-ui";
5
5
  import { type ReactNode } from "react";
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { merge } from "@sincpro/criteria";
4
5
  import { isList, scopeOf } from "../../core/list.js";
5
6
  import { createContext, useContext } from "react";
@@ -1,8 +1,7 @@
1
+ import { type Entity, type Transport } from "@sincpro/client-framework";
1
2
  import type { Meta } from "@sincpro/criteria";
2
3
  import { type ComposerSkin, type ResourceRef, type ViewSpec, type WorkspaceStore } from "@sincpro/web-composer";
3
4
  import { type CacheOptions } from "../../core/cache.js";
4
- import type { Entity } from "../../core/entity.js";
5
- import type { Transport } from "../../core/transport.js";
6
5
  import { type ReactNode } from "react";
7
6
  /**
8
7
  * The application context in one place: who answers (the transport), in which language, which
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { Composer, installComposerCopy, SPANISH_COMPOSER_COPY, useWorkspace, } from "@sincpro/web-composer";
4
5
  import { createRegistry } from "@sincpro/web-composer/domain";
5
6
  import { cachedTransport } from "../../core/cache.js";
@@ -1,8 +1,7 @@
1
+ import { type Entity, type Transport } from "@sincpro/client-framework";
1
2
  import { type AnyRecord, type Meta } from "@sincpro/criteria";
2
3
  import type { ViewProps, ViewSpec } from "@sincpro/web-composer";
3
- import { type Entity } from "../../core/entity.js";
4
4
  import type { ListDefinition } from "../../core/list.js";
5
- import type { Transport } from "../../core/transport.js";
6
5
  import { type ComponentType } from "react";
7
6
  /**
8
7
  * An entity as the composer's view: one `ViewSpec` for its list (a reference without an id)
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { listRoute, NEW_PARAM, scopeOfRef, } from "@sincpro/client-framework";
3
4
  import { matching } from "@sincpro/criteria";
4
- import { listRoute, NEW_PARAM, scopeOfRef, } from "../../core/entity.js";
5
5
  import { lookupOf } from "../../core/lookup.js";
6
6
  import { ListScopeProvider } from "../../react/scope.js";
7
7
  import { useListing } from "../../react/useListing.js";
@@ -57,7 +57,7 @@ export function entityView(entity, options) {
57
57
  // A chooser opened by a picker offers only what the picker may choose: its cut travels in
58
58
  // the reference, and the list — the application's own too — reads under it.
59
59
  const cut = record ? undefined : scopeOfRef(props.resource);
60
- const list = cut === undefined ? (_jsx(List, { ...props })) : (_jsx(ListScopeProvider, { value: { key: entity.key, where: cut }, children: _jsx(List, { ...props }) }));
60
+ const list = cut === undefined ? (_jsx(List, { ...props })) : (_jsx(ListScopeProvider, { value: { key: entity.key, selection: cut }, children: _jsx(List, { ...props }) }));
61
61
  return _jsx(InWorkspace, { api: props.api, children: record ? _jsx(One, { ...props }) : list });
62
62
  };
63
63
  }
@@ -1,6 +1,6 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord, Meta } from "@sincpro/criteria";
2
3
  import type { ResourceRef, WorkspaceApi } from "@sincpro/web-composer";
3
- import type { Entity } from "../../core/entity.js";
4
4
  import { type OpenTarget } from "@sincpro/web-ui";
5
5
  import type { ReactNode } from "react";
6
6
  /**
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
+ import {} from "@sincpro/client-framework";
3
4
  import { useSummaryOf } from "../../react/useSummary.js";
4
5
  import { openOptions, targetsFor } from "../list/openIn.js";
5
6
  import { relationOf } from "../record/summary.js";
@@ -1,6 +1,6 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import type { AnyRecord } from "@sincpro/criteria";
2
3
  import { type ViewProps } from "@sincpro/web-composer";
3
- import { type Entity } from "../../core/entity.js";
4
4
  import { type RecordReading } from "../../react/useRecord.js";
5
5
  import { type ReactNode } from "react";
6
6
  /**
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { TRAIL_PARAM } from "@sincpro/client-framework";
3
4
  import { labelOf, nameOf } from "@sincpro/criteria";
4
5
  import { useCrumbs } from "@sincpro/web-composer";
5
6
  import { frameworkCopy } from "../../core/copy.js";
6
- import { TRAIL_PARAM } from "../../core/entity.js";
7
7
  import { formOf } from "../../core/form.js";
8
8
  import { placeOf, stepIn } from "../../core/trail.js";
9
9
  import { useFramework } from "../../react/context.js";
@@ -1,6 +1,6 @@
1
+ import { type Entity } from "@sincpro/client-framework";
1
2
  import { type AnyRecord } from "@sincpro/criteria";
2
3
  import { type WorkspaceApi } from "@sincpro/web-composer";
3
- import type { Entity } from "../../core/entity.js";
4
4
  import type { RecordReading } from "../../react/useRecord.js";
5
5
  /**
6
6
  * A record told to the workspace it is open in: its real name and whether it holds unsaved work.
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import {} from "@sincpro/client-framework";
2
3
  import { nameOf } from "@sincpro/criteria";
3
4
  import { useWorkspaceContext, } from "@sincpro/web-composer";
4
5
  import { frameworkCopy } from "../../core/copy.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sincpro/web-framework",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "The web client of sincpro_framework: entities, lists and records bound to the metadata the server publishes, drawn with @sincpro/web-ui and arranged with @sincpro/web-composer.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,14 +14,15 @@
14
14
  "types": "./dist/core/index.d.ts",
15
15
  "default": "./dist/core/index.js"
16
16
  },
17
- "./codegen": {
18
- "types": "./dist/codegen/index.d.ts",
19
- "default": "./dist/codegen/index.js"
17
+ "./telemetry": {
18
+ "types": "./dist/telemetry/index.d.ts",
19
+ "default": "./dist/telemetry/index.js"
20
+ },
21
+ "./errors": {
22
+ "types": "./dist/errors/index.d.ts",
23
+ "default": "./dist/errors/index.js"
20
24
  }
21
25
  },
22
- "bin": {
23
- "sincpro-web": "./dist/codegen/cli.js"
24
- },
25
26
  "publishConfig": {
26
27
  "access": "public"
27
28
  },
@@ -34,19 +35,48 @@
34
35
  "printWidth": 94
35
36
  },
36
37
  "peerDependencies": {
37
- "@sincpro/criteria": "^1.1.0",
38
- "@sincpro/criteria-react": "^1.1.0",
38
+ "@opentelemetry/api": "^1.10.0",
39
+ "@opentelemetry/exporter-trace-otlp-http": "^0.301.0",
40
+ "@opentelemetry/resources": "^3.1.0",
41
+ "@opentelemetry/sdk-trace": "^3.1.0",
42
+ "@sentry/browser": "^11.11.0",
43
+ "@sincpro/client-framework": "^0.4.0",
44
+ "@sincpro/criteria": "^2.0.0",
45
+ "@sincpro/criteria-react": "^2.0.0",
39
46
  "@sincpro/web-composer": "^1.5.0",
40
- "@sincpro/web-ui": "^1.11.1",
47
+ "@sincpro/web-ui": "^2.0.0",
41
48
  "react": ">=19",
42
49
  "react-dom": ">=19"
43
50
  },
51
+ "peerDependenciesMeta": {
52
+ "@opentelemetry/api": {
53
+ "optional": true
54
+ },
55
+ "@opentelemetry/exporter-trace-otlp-http": {
56
+ "optional": true
57
+ },
58
+ "@opentelemetry/resources": {
59
+ "optional": true
60
+ },
61
+ "@opentelemetry/sdk-trace": {
62
+ "optional": true
63
+ },
64
+ "@sentry/browser": {
65
+ "optional": true
66
+ }
67
+ },
44
68
  "devDependencies": {
45
69
  "@eslint/js": "^10.0.1",
46
- "@sincpro/criteria": "^1.1.0",
47
- "@sincpro/criteria-react": "^1.1.0",
70
+ "@opentelemetry/api": "1.10.0",
71
+ "@opentelemetry/exporter-trace-otlp-http": "0.301.0",
72
+ "@opentelemetry/resources": "3.1.0",
73
+ "@opentelemetry/sdk-trace": "3.1.0",
74
+ "@sentry/browser": "11.11.0",
75
+ "@sincpro/client-framework": "^0.4.0",
76
+ "@sincpro/criteria": "^2.0.0",
77
+ "@sincpro/criteria-react": "^2.0.0",
48
78
  "@sincpro/web-composer": "^1.5.0",
49
- "@sincpro/web-ui": "^1.11.1",
79
+ "@sincpro/web-ui": "^2.0.0",
50
80
  "@storybook/addon-a11y": "10.6.5",
51
81
  "@storybook/addon-docs": "10.6.5",
52
82
  "@storybook/addon-mcp": "10.6.5",
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};