@entifix/next-shell 0.14.0 → 0.16.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 (35) hide show
  1. package/dist/lib/config/service-proxy-route.d.ts +4 -7
  2. package/dist/lib/config/service-proxy-route.d.ts.map +1 -1
  3. package/dist/lib/config/service-proxy-route.js +0 -24
  4. package/dist/lib/config/service-proxy-route.js.map +1 -1
  5. package/dist/lib/crud/index.d.ts +0 -1
  6. package/dist/lib/crud/index.d.ts.map +1 -1
  7. package/dist/lib/crud/index.js +0 -1
  8. package/dist/lib/crud/index.js.map +1 -1
  9. package/dist/lib/crud/make-entity-crud.d.ts +7 -12
  10. package/dist/lib/crud/make-entity-crud.d.ts.map +1 -1
  11. package/dist/lib/crud/make-entity-crud.js +33 -64
  12. package/dist/lib/crud/make-entity-crud.js.map +1 -1
  13. package/dist/lib/workspace/index.d.ts +0 -2
  14. package/dist/lib/workspace/index.d.ts.map +1 -1
  15. package/dist/lib/workspace/index.js +0 -2
  16. package/dist/lib/workspace/index.js.map +1 -1
  17. package/dist/lib/workspace/pending-flows.d.ts +2 -2
  18. package/dist/lib/workspace/pending-flows.js.map +1 -1
  19. package/package.json +9 -9
  20. package/dist/lib/crud/hand-off-write.d.ts +0 -35
  21. package/dist/lib/crud/hand-off-write.d.ts.map +0 -1
  22. package/dist/lib/crud/hand-off-write.js +0 -27
  23. package/dist/lib/crud/hand-off-write.js.map +0 -1
  24. package/dist/lib/crud/pending-notice.d.ts +0 -31
  25. package/dist/lib/crud/pending-notice.d.ts.map +0 -1
  26. package/dist/lib/crud/pending-notice.js +0 -72
  27. package/dist/lib/crud/pending-notice.js.map +0 -1
  28. package/dist/lib/workspace/pending-state.d.ts +0 -85
  29. package/dist/lib/workspace/pending-state.d.ts.map +0 -1
  30. package/dist/lib/workspace/pending-state.js +0 -155
  31. package/dist/lib/workspace/pending-state.js.map +0 -1
  32. package/dist/lib/workspace/pending-transactions.d.ts +0 -44
  33. package/dist/lib/workspace/pending-transactions.d.ts.map +0 -1
  34. package/dist/lib/workspace/pending-transactions.js +0 -114
  35. package/dist/lib/workspace/pending-transactions.js.map +0 -1
@@ -12,13 +12,10 @@ export interface ServiceProxyRouteOptions {
12
12
  * ⚠️ **Needed when the proxy's namespace *is* the upstream's route name.**
13
13
  * `/api/stock/stock-item` forwards to `/api/stock-item` because `stock` names
14
14
  * the service and `stock-item` names the entity — two different words. But
15
- * `/api/transaction/events` forwards to `/api/events`, which exists nowhere:
16
- * there the namespace and the route are the same word, and stripping it
17
- * strips half the address.
18
- *
19
- * Caught on the live lab rather than by any check, and the symptom is exactly
20
- * the one this proxy exists to prevent — the SSE stream 404s, a pending write
21
- * never settles, and every probe stays green.
15
+ * where the namespace and the route are the same word — `/api/realtime/flow`
16
+ * served by a service whose own route is `/api/realtime/flow` — stripping it
17
+ * strips half the address, and every probe stays green while the route
18
+ * 404s.
22
19
  */
23
20
  readonly pathPrefix?: string;
24
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"service-proxy-route.d.ts","sourceRoot":"","sources":["../../../src/lib/config/service-proxy-route.ts"],"names":[],"mappings":"AAMA,KAAK,MAAM,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAwFD,eAAO,MAAM,uBAAuB,GAAI,0BAGrC,wBAAwB,eAEd,OAAO,cACJ,MAAM,KACjB,OAAO,CAAC,QAAQ,CA6EpB,CAAC"}
1
+ {"version":3,"file":"service-proxy-route.d.ts","sourceRoot":"","sources":["../../../src/lib/config/service-proxy-route.ts"],"names":[],"mappings":"AAMA,KAAK,MAAM,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAEtD,MAAM,WAAW,wBAAwB;IACvC,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AA2ED,eAAO,MAAM,uBAAuB,GAAI,0BAGrC,wBAAwB,eAEd,OAAO,cACJ,MAAM,KACjB,OAAO,CAAC,QAAQ,CA+DpB,CAAC"}
@@ -62,18 +62,6 @@ import { problemResponse } from './problem-response.js';
62
62
  'traceparent',
63
63
  DEADLINE_HEADER
64
64
  ];
65
- /**
66
- * Whether the upstream answer must be piped rather than rebuilt.
67
- *
68
- * Reading a `text/event-stream` body to completion holds the request open
69
- * forever and delivers nothing — no error, no timeout, and the browser's
70
- * `EventSource` sits in `CONNECTING` while the service is happily emitting.
71
- * It is the most likely way to build the reactive stream, see silence, and go
72
- * looking in the wrong service.
73
- */ const isStreamed = (upstream)=>{
74
- var _upstream_headers_get;
75
- return ((_upstream_headers_get = upstream.headers.get('content-type')) == null ? void 0 : _upstream_headers_get.startsWith('text/event-stream')) === true;
76
- };
77
65
  const passThrough = (upstream)=>{
78
66
  const headers = {};
79
67
  for (const name of PASSED_RESPONSE_HEADERS){
@@ -127,18 +115,6 @@ export const createServiceProxyRoute = ({ baseUrl, pathPrefix })=>{
127
115
  headers: passed
128
116
  });
129
117
  }
130
- // Piped, never buffered, and never re-typed as JSON: the body is an open
131
- // stream of frames, and `no-store` is correctness rather than politeness —
132
- // this response is scoped to one principal.
133
- if (isStreamed(upstream)) {
134
- return new NextResponse(upstream.body, {
135
- status: upstream.status,
136
- headers: _extends({}, passed, {
137
- 'content-type': 'text/event-stream',
138
- 'cache-control': 'no-store'
139
- })
140
- });
141
- }
142
118
  // 204s and empty bodies must not be given a body. The upstream's content
143
119
  // type is kept, never re-typed: a problem body re-typed as plain JSON is
144
120
  // one the browser can no longer recognise as a failure it can decode.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/config/service-proxy-route.ts"],"sourcesContent":["import { DEADLINE_HEADER, UpstreamUnavailable } from '@entifix/core';\nimport { NextResponse } from 'next/server';\n\nimport { bearerHeader, sessionToken } from '../session/bearer.js';\nimport { problemResponse } from './problem-response.js';\n\ntype Params = { params: Promise<{ path: string[] }> };\n\nexport interface ServiceProxyRouteOptions {\n /** Where the service listens, without the `/api` suffix. */\n readonly baseUrl: string;\n /**\n * A segment to put back in front of the forwarded path.\n *\n * ⚠️ **Needed when the proxy's namespace *is* the upstream's route name.**\n * `/api/stock/stock-item` forwards to `/api/stock-item` because `stock` names\n * the service and `stock-item` names the entity — two different words. But\n * `/api/transaction/events` forwards to `/api/events`, which exists nowhere:\n * there the namespace and the route are the same word, and stripping it\n * strips half the address.\n *\n * Caught on the live lab rather than by any check, and the symptom is exactly\n * the one this proxy exists to prevent — the SSE stream 404s, a pending write\n * never settles, and every probe stays green.\n */\n readonly pathPrefix?: string;\n}\n\n/**\n * Builds a same-origin proxy for one backend service, mounted as a catch-all\n * route handler — e.g. `app/api/admin/[...path]/route.ts`.\n *\n * The browser can never call `:310N` directly: `entifix_at` is httpOnly and\n * same-origin, so a cross-origin request carries no cookie and a guarded route\n * answers `401`. Host-scoping the cookie does not help — that governs which host\n * *stores* it, not which cross-origin requests send it. Routing through the app's\n * own origin makes the cookie automatic and needs no CORS, which is the same\n * reason the credential routes are shaped this way.\n *\n * The cookie is forwarded upstream as a bearer token. **This proxy grants\n * nothing** — the service still verifies the token and applies its own\n * the endpoint's `guard`. It only carries.\n *\n * It also carries the **caching contract** in both directions, which it did not\n * always: rebuilding every response as a fresh body dropped `ETag`,\n * `Cache-Control` and `Vary`, and forwarded no `If-None-Match`. The effect was\n * invisible and entirely wasteful — `GET /api/<entity>/$metadata` computes and\n * hashes a permission-filtered document per request, and a validator that never\n * reaches the service means it can never answer `304`. Worse, `Vary` is a\n * *correctness* header here: the document differs per caller, and one stripped\n * of `Vary: Cookie, Authorization` may be cached and served to a different\n * principal.\n *\n * A factory, because a host mounts one of these per backend it talks to, and\n * back-office-app now talks to two: marketplace-admin-service for the catalog a\n * vendor authors, marketplace-service for the platform vocabulary it is\n * classified in.\n */\n/**\n * Response headers that must survive the rebuild.\n *\n * Deliberately a short allow-list rather than copying every header: the\n * upstream's `content-length` and `content-encoding` describe *its* body, and\n * carrying them onto a response this function reconstructs is how a proxy\n * serves a truncated payload. Beside the cache validators: `retry-after`,\n * which says when an overloaded service wants to be asked again; `location`,\n * which a `202` points its tracker at; and `traceparent`, so the browser's\n * failure toast can name the trace a service logged its side under.\n */\nconst PASSED_RESPONSE_HEADERS = [\n 'etag',\n 'cache-control',\n 'vary',\n 'retry-after',\n 'location',\n 'traceparent',\n] as const;\n\n/**\n * Request headers forwarded to the service, beside the bearer it gets from\n * the session: the validator, so `$metadata` can answer `304`; the\n * idempotency key, so a retried write is recognised; the trace, so one\n * request is one trace across the hop; and the caller's remaining budget\n * ([ADR 0014](../../../../../../docs/adr/0014-retry-once-at-the-layer-above-under-a-budget.md)).\n */\nconst FORWARDED_REQUEST_HEADERS = [\n 'if-none-match',\n 'idempotency-key',\n 'traceparent',\n DEADLINE_HEADER,\n] as const;\n\n/**\n * Whether the upstream answer must be piped rather than rebuilt.\n *\n * Reading a `text/event-stream` body to completion holds the request open\n * forever and delivers nothing — no error, no timeout, and the browser's\n * `EventSource` sits in `CONNECTING` while the service is happily emitting.\n * It is the most likely way to build the reactive stream, see silence, and go\n * looking in the wrong service.\n */\nconst isStreamed = (upstream: Response): boolean =>\n upstream.headers.get('content-type')?.startsWith('text/event-stream') ===\n true;\n\nconst passThrough = (upstream: Response): Record<string, string> => {\n const headers: Record<string, string> = {};\n for (const name of PASSED_RESPONSE_HEADERS) {\n const value = upstream.headers.get(name);\n if (value !== null) headers[name] = value;\n }\n return headers;\n};\n\nexport const createServiceProxyRoute = ({\n baseUrl,\n pathPrefix,\n}: ServiceProxyRouteOptions) => {\n const forward = async (\n request: Request,\n { params }: Params,\n ): Promise<Response> => {\n const { path } = await params;\n const search = new URL(request.url).search;\n\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n ...bearerHeader(await sessionToken()),\n };\n\n for (const name of FORWARDED_REQUEST_HEADERS) {\n const value = request.headers.get(name);\n if (value !== null) headers[name] = value;\n }\n\n const hasBody = request.method !== 'GET' && request.method !== 'DELETE';\n const body = hasBody ? await request.text() : undefined;\n // Only the connection is caught. A service that answers — with anything,\n // a `500` included — is passed through below exactly as it answered.\n const upstream = await fetch(\n `${baseUrl}/api/${[pathPrefix, ...path].filter(Boolean).join('/')}${search}`,\n { method: request.method, headers, body, cache: 'no-store' },\n ).catch(() => undefined);\n\n // `502`, never the `500` an unhandled rejection becomes: the host did\n // nothing wrong, and a `500` sends whoever reads it looking for a bug in\n // the app rather than for a process that is not running.\n if (upstream === undefined) {\n return problemResponse(\n new UpstreamUnavailable(\n pathPrefix === undefined ? {} : { upstream: pathPrefix },\n ),\n {\n status: 502,\n },\n );\n }\n\n const passed = passThrough(upstream);\n\n // A `304` carries no body by definition, and neither does a `204`. Running\n // either through a body read is not merely wasteful — a `304` reconstructed\n // with a body is no longer a `304`.\n if (upstream.status === 304) {\n return new NextResponse(null, { status: 304, headers: passed });\n }\n\n // Piped, never buffered, and never re-typed as JSON: the body is an open\n // stream of frames, and `no-store` is correctness rather than politeness —\n // this response is scoped to one principal.\n if (isStreamed(upstream)) {\n return new NextResponse(upstream.body, {\n status: upstream.status,\n headers: {\n ...passed,\n 'content-type': 'text/event-stream',\n 'cache-control': 'no-store',\n },\n });\n }\n\n // 204s and empty bodies must not be given a body. The upstream's content\n // type is kept, never re-typed: a problem body re-typed as plain JSON is\n // one the browser can no longer recognise as a failure it can decode.\n const text = await upstream.text();\n return text === ''\n ? new NextResponse(null, { status: upstream.status, headers: passed })\n : new NextResponse(text, {\n status: upstream.status,\n headers: {\n ...passed,\n 'content-type':\n upstream.headers.get('content-type') ?? 'application/json',\n },\n });\n };\n\n return forward;\n};\n"],"names":["DEADLINE_HEADER","UpstreamUnavailable","NextResponse","bearerHeader","sessionToken","problemResponse","PASSED_RESPONSE_HEADERS","FORWARDED_REQUEST_HEADERS","isStreamed","upstream","headers","get","startsWith","passThrough","name","value","createServiceProxyRoute","baseUrl","pathPrefix","forward","request","params","path","search","URL","url","hasBody","method","body","text","undefined","fetch","filter","Boolean","join","cache","catch","status","passed"],"mappings":";AAAA,SAASA,eAAe,EAAEC,mBAAmB,QAAQ,gBAAgB;AACrE,SAASC,YAAY,QAAQ,cAAc;AAE3C,SAASC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAClE,SAASC,eAAe,QAAQ,wBAAwB;AAwBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD;;;;;;;;;;CAUC,GACD,MAAMC,0BAA0B;IAC9B;IACA;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;CAMC,GACD,MAAMC,4BAA4B;IAChC;IACA;IACA;IACAP;CACD;AAED;;;;;;;;CAQC,GACD,MAAMQ,aAAa,CAACC;QAClBA;WAAAA,EAAAA,wBAAAA,SAASC,OAAO,CAACC,GAAG,CAAC,oCAArBF,sBAAsCG,UAAU,CAAC,0BACjD;;AAEF,MAAMC,cAAc,CAACJ;IACnB,MAAMC,UAAkC,CAAC;IACzC,KAAK,MAAMI,QAAQR,wBAAyB;QAC1C,MAAMS,QAAQN,SAASC,OAAO,CAACC,GAAG,CAACG;QACnC,IAAIC,UAAU,MAAML,OAAO,CAACI,KAAK,GAAGC;IACtC;IACA,OAAOL;AACT;AAEA,OAAO,MAAMM,0BAA0B,CAAC,EACtCC,OAAO,EACPC,UAAU,EACe;IACzB,MAAMC,UAAU,OACdC,SACA,EAAEC,MAAM,EAAU;YAwERZ;QAtEV,MAAM,EAAEa,IAAI,EAAE,GAAG,MAAMD;QACvB,MAAME,SAAS,IAAIC,IAAIJ,QAAQK,G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E;QACzE,sEAAsE;QACtE,MAAMT,OAAO,MAAMpB,SAASoB,IAAI;QAChC,OAAOA,SAAS,KACZ,IAAI3B,aAAa,MAAM;YAAEmC,QAAQ5B,SAAS4B,MAAM;YAAE3B,SAAS4B;QAAO,KAClE,IAAIpC,aAAa2B,MAAM;YACrBQ,QAAQ5B,SAAS4B,MAAM;YACvB3B,SAAS,aACJ4B;gBACH,cAAc,GACZ7B,wBAAAA,SAASC,OAAO,CAACC,GAAG,CAAC,2BAArBF,wBAAwC;;QAE9C;IACN;IAEA,OAAOU;AACT,EAAE"}
1
+ {"version":3,"sources":["../../../src/lib/config/service-proxy-route.ts"],"sourcesContent":["import { DEADLINE_HEADER, UpstreamUnavailable } from '@entifix/core';\nimport { NextResponse } from 'next/server';\n\nimport { bearerHeader, sessionToken } from '../session/bearer.js';\nimport { problemResponse } from './problem-response.js';\n\ntype Params = { params: Promise<{ path: string[] }> };\n\nexport interface ServiceProxyRouteOptions {\n /** Where the service listens, without the `/api` suffix. */\n readonly baseUrl: string;\n /**\n * A segment to put back in front of the forwarded path.\n *\n * ⚠️ **Needed when the proxy's namespace *is* the upstream's route name.**\n * `/api/stock/stock-item` forwards to `/api/stock-item` because `stock` names\n * the service and `stock-item` names the entity — two different words. But\n * where the namespace and the route are the same word — `/api/realtime/flow`\n * served by a service whose own route is `/api/realtime/flow` — stripping it\n * strips half the address, and every probe stays green while the route\n * 404s.\n */\n readonly pathPrefix?: string;\n}\n\n/**\n * Builds a same-origin proxy for one backend service, mounted as a catch-all\n * route handler — e.g. `app/api/admin/[...path]/route.ts`.\n *\n * The browser can never call `:310N` directly: `entifix_at` is httpOnly and\n * same-origin, so a cross-origin request carries no cookie and a guarded route\n * answers `401`. Host-scoping the cookie does not help — that governs which host\n * *stores* it, not which cross-origin requests send it. Routing through the app's\n * own origin makes the cookie automatic and needs no CORS, which is the same\n * reason the credential routes are shaped this way.\n *\n * The cookie is forwarded upstream as a bearer token. **This proxy grants\n * nothing** — the service still verifies the token and applies its own\n * the endpoint's `guard`. It only carries.\n *\n * It also carries the **caching contract** in both directions, which it did not\n * always: rebuilding every response as a fresh body dropped `ETag`,\n * `Cache-Control` and `Vary`, and forwarded no `If-None-Match`. The effect was\n * invisible and entirely wasteful — `GET /api/<entity>/$metadata` computes and\n * hashes a permission-filtered document per request, and a validator that never\n * reaches the service means it can never answer `304`. Worse, `Vary` is a\n * *correctness* header here: the document differs per caller, and one stripped\n * of `Vary: Cookie, Authorization` may be cached and served to a different\n * principal.\n *\n * A factory, because a host mounts one of these per backend it talks to, and\n * back-office-app now talks to two: marketplace-admin-service for the catalog a\n * vendor authors, marketplace-service for the platform vocabulary it is\n * classified in.\n */\n/**\n * Response headers that must survive the rebuild.\n *\n * Deliberately a short allow-list rather than copying every header: the\n * upstream's `content-length` and `content-encoding` describe *its* body, and\n * carrying them onto a response this function reconstructs is how a proxy\n * serves a truncated payload. Beside the cache validators: `retry-after`,\n * which says when an overloaded service wants to be asked again; `location`,\n * which a `202` points its tracker at; and `traceparent`, so the browser's\n * failure toast can name the trace a service logged its side under.\n */\nconst PASSED_RESPONSE_HEADERS = [\n 'etag',\n 'cache-control',\n 'vary',\n 'retry-after',\n 'location',\n 'traceparent',\n] as const;\n\n/**\n * Request headers forwarded to the service, beside the bearer it gets from\n * the session: the validator, so `$metadata` can answer `304`; the\n * idempotency key, so a retried write is recognised; the trace, so one\n * request is one trace across the hop; and the caller's remaining budget\n * ([ADR 0014](../../../../../../docs/adr/0014-retry-once-at-the-layer-above-under-a-budget.md)).\n */\nconst FORWARDED_REQUEST_HEADERS = [\n 'if-none-match',\n 'idempotency-key',\n 'traceparent',\n DEADLINE_HEADER,\n] as const;\n\nconst passThrough = (upstream: Response): Record<string, string> => {\n const headers: Record<string, string> = {};\n for (const name of PASSED_RESPONSE_HEADERS) {\n const value = upstream.headers.get(name);\n if (value !== null) headers[name] = value;\n }\n return headers;\n};\n\nexport const createServiceProxyRoute = ({\n baseUrl,\n pathPrefix,\n}: ServiceProxyRouteOptions) => {\n const forward = async (\n request: Request,\n { params }: Params,\n ): Promise<Response> => {\n const { path } = await params;\n const search = new URL(request.url).search;\n\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n ...bearerHeader(await sessionToken()),\n };\n\n for (const name of FORWARDED_REQUEST_HEADERS) {\n const value = request.headers.get(name);\n if (value !== null) headers[name] = value;\n }\n\n const hasBody = request.method !== 'GET' && request.method !== 'DELETE';\n const body = hasBody ? await request.text() : undefined;\n // Only the connection is caught. A service that answers — with anything,\n // a `500` included — is passed through below exactly as it answered.\n const upstream = await fetch(\n `${baseUrl}/api/${[pathPrefix, ...path].filter(Boolean).join('/')}${search}`,\n { method: request.method, headers, body, cache: 'no-store' },\n ).catch(() => undefined);\n\n // `502`, never the `500` an unhandled rejection becomes: the host did\n // nothing wrong, and a `500` sends whoever reads it looking for a bug in\n // the app rather than for a process that is not running.\n if (upstream === undefined) {\n return problemResponse(\n new UpstreamUnavailable(\n pathPrefix === undefined ? {} : { upstream: pathPrefix },\n ),\n {\n status: 502,\n },\n );\n }\n\n const passed = passThrough(upstream);\n\n // A `304` carries no body by definition, and neither does a `204`. Running\n // either through a body read is not merely wasteful — a `304` reconstructed\n // with a body is no longer a `304`.\n if (upstream.status === 304) {\n return new NextResponse(null, { status: 304, headers: passed });\n }\n\n // 204s and empty bodies must not be given a body. The upstream's content\n // type is kept, never re-typed: a problem body re-typed as plain JSON is\n // one the browser can no longer recognise as a failure it can decode.\n const text = await upstream.text();\n return text === ''\n ? new NextResponse(null, { status: upstream.status, headers: passed })\n : new NextResponse(text, {\n status: upstream.status,\n headers: {\n ...passed,\n 'content-type':\n upstream.headers.get('content-type') ?? 'application/json',\n },\n });\n };\n\n return forward;\n};\n"],"names":["DEADLINE_HEADER","UpstreamUnavailable","NextResponse","bearerHeader","sessionToken","problemResponse","PASSED_RESPONSE_HEADERS","FORWARDED_REQUEST_HEADERS","passThrough","upstream","headers","name","value","get","createServiceProxyRoute","baseUrl","pathPrefix","forward","request","params","path","search","URL","url","hasBody","method","body","text","undefined","fetch","filter","Boolean","join","cache","catch","status","passed"],"mappings":";AAAA,SAASA,eAAe,EAAEC,mBAAmB,QAAQ,gBAAgB;AACrE,SAASC,YAAY,QAAQ,cAAc;AAE3C,SAASC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAClE,SAASC,eAAe,QAAQ,wBAAwB;AAqBxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD;;;;;;;;;;CAUC,GACD,MAAMC,0BAA0B;IAC9B;IACA;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;CAMC,GACD,MAAMC,4BAA4B;IAChC;IACA;IACA;IACAP;CACD;AAED,MAAMQ,cAAc,CAACC;IACnB,MAAMC,UAAkC,CAAC;IACzC,KAAK,MAAMC,QAAQL,wBAAyB;QAC1C,MAAMM,QAAQH,SAASC,OAAO,CAACG,GAAG,CAACF;QACnC,IAAIC,UAAU,MAAMF,OAAO,CAACC,KAAK,GAAGC;IACtC;IACA,OAAOF;AACT;AAEA,OAAO,MAAMI,0BAA0B,CAAC,EACtCC,OAAO,EACPC,UAAU,EACe;IACzB,MAAMC,UAAU,OACdC,SACA,EAAEC,MAAM,EAAU;YA0DRV;QAxDV,MAAM,EAAEW,IAAI,EAAE,GAAG,MAAMD;QACvB,MAAME,SAAS,IAAIC,IAAIJ,QAAQK,GAAG,EAAEF,MAAM;QAE1C,MAAMX,UAAkC;YACtC,gBAAgB;WACbP,aAAa,MAAMC;QAGxB,KAAK,MAAMO,QAAQJ,0BAA2B;YAC5C,MAAMK,QAAQM,QAAQR,OAAO,CAACG,GAAG,CAACF;YAClC,IAAIC,UAAU,MAAMF,OAAO,CAACC,KAAK,GAAGC;QACtC;QAEA,MAAMY,UAAUN,QAAQO,MAAM,KAAK,SAASP,QAAQO,MAAM,KAAK;QAC/D,MAAMC,OAAOF,UAAU,MAAMN,QAAQS,IAAI,KAAKC;QAC9C,yEAAyE;QACzE,qEAAqE;QACrE,MAAMnB,WAAW,MAAMoB,MACrB,GAAGd,QAAQ,KAAK,EAAE;YAACC;eAAeI;SAAK,CAACU,MAAM,CAACC,SAASC,IAAI,CAAC,OAAOX,QAAQ,EAC5E;YAAEI,QAAQP,QAAQO,MAAM;YAAEf;YAASgB;YAAMO,OAAO;QAAW,GAC3DC,KAAK,CAAC,IAAMN;QAEd,sEAAsE;QACtE,yEAAyE;QACzE,yDAAyD;QACzD,IAAInB,aAAamB,WAAW;YAC1B,OAAOvB,gBACL,IAAIJ,oBACFe,eAAeY,YAAY,CAAC,IAAI;gBAAEnB,UAAUO;YAAW,IAEzD;gBACEmB,QAAQ;YACV;QAEJ;QAEA,MAAMC,SAAS5B,YAAYC;QAE3B,2EAA2E;QAC3E,4EAA4E;QAC5E,oCAAoC;QACpC,IAAIA,SAAS0B,MAAM,KAAK,KAAK;YAC3B,OAAO,IAAIjC,aAAa,MAAM;gBAAEiC,QAAQ;gBAAKzB,SAAS0B;YAAO;QAC/D;QAEA,yEAAyE;QACzE,yEAAyE;QACzE,sEAAsE;QACtE,MAAMT,OAAO,MAAMlB,SAASkB,IAAI;QAChC,OAAOA,SAAS,KACZ,IAAIzB,aAAa,MAAM;YAAEiC,QAAQ1B,SAAS0B,MAAM;YAAEzB,SAAS0B;QAAO,KAClE,IAAIlC,aAAayB,MAAM;YACrBQ,QAAQ1B,SAAS0B,MAAM;YACvBzB,SAAS,aACJ0B;gBACH,cAAc,GACZ3B,wBAAAA,SAASC,OAAO,CAACG,GAAG,CAAC,2BAArBJ,wBAAwC;;QAE9C;IACN;IAEA,OAAOQ;AACT,EAAE"}
@@ -1,5 +1,4 @@
1
1
  export * from './entity-crud-form.js';
2
- export * from './hand-off-write.js';
3
2
  export * from './make-entity-crud.js';
4
3
  export * from './make-entity-crud.types.js';
5
4
  export * from './slug.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export * from './entity-crud-form.js';
2
- export * from './hand-off-write.js';
3
2
  export * from './make-entity-crud.js';
4
3
  export * from './make-entity-crud.types.js';
5
4
  export * from './slug.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/crud/index.ts"],"sourcesContent":["export * from './entity-crud-form.js';\nexport * from './hand-off-write.js';\nexport * from './make-entity-crud.js';\nexport * from './make-entity-crud.types.js';\nexport * from './slug.js';\nexport * from './use-crud-render-link.js';\nexport * from './use-entity-affordances.js';\nexport * from './use-entity-bulk.js';\nexport * from './use-entity-link-sources.js';\n"],"names":[],"mappings":"AAAA,cAAc,wBAAwB;AACtC,cAAc,sBAAsB;AACpC,cAAc,wBAAwB;AACtC,cAAc,8BAA8B;AAC5C,cAAc,YAAY;AAC1B,cAAc,4BAA4B;AAC1C,cAAc,8BAA8B;AAC5C,cAAc,uBAAuB;AACrC,cAAc,+BAA+B"}
1
+ {"version":3,"sources":["../../../src/lib/crud/index.ts"],"sourcesContent":["export * from './entity-crud-form.js';\nexport * from './make-entity-crud.js';\nexport * from './make-entity-crud.types.js';\nexport * from './slug.js';\nexport * from './use-crud-render-link.js';\nexport * from './use-entity-affordances.js';\nexport * from './use-entity-bulk.js';\nexport * from './use-entity-link-sources.js';\n"],"names":[],"mappings":"AAAA,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC,cAAc,8BAA8B;AAC5C,cAAc,YAAY;AAC1B,cAAc,4BAA4B;AAC1C,cAAc,8BAA8B;AAC5C,cAAc,uBAAuB;AACrC,cAAc,+BAA+B"}
@@ -1,26 +1,21 @@
1
1
  import { type EntityRepositoryTag } from '@entifix/business';
2
2
  import { type Entity, type EntityConstructor } from '@entifix/core';
3
- import type { TransactionSink } from '@entifix/transactions';
4
- import { TransactionSinkTag } from '@entifix/transactions';
5
3
  import { Context } from 'effect';
6
4
  import type { EntityCrud, EntityCrudOptions } from './make-entity-crud.types.js';
7
5
  /**
8
- * What the generated pages' use-cases run against.
9
- *
10
- * Exported because a hand-built screen needs the same three: a wizard reads
11
- * records, resolves pickers and writes through exactly these ports, and
12
- * rebuilding the union at each such call site is how one of them ends up
13
- * missing `TransactionSinkTag` and quietly losing its optimistic treatment.
6
+ * What the generated pages' use-cases run against: one repository adapter.
7
+ * Exported because a hand-built screen — a wizard reading records and
8
+ * resolving pickers — runs against exactly the same.
14
9
  */
15
- export type CrudContext = EntityRepositoryTag | TransactionSinkTag;
10
+ export type CrudContext = EntityRepositoryTag;
16
11
  /**
17
- * Adds the pending-write sink to one repository adapter, giving the context the
18
- * use-cases run against.
12
+ * One repository adapter, by its key, as the context the use-cases run
13
+ * against.
19
14
  *
20
15
  * The cast is the price of naming adapters by key: `AdapterKey` narrows which
21
16
  * names may be *offered*, but TypeScript will not carry that narrowing through
22
17
  * an index access on a generic record.
23
18
  */
24
- export declare function mergeCrudContext<TAdapters>(adapters: TAdapters, repository: keyof TAdapters, sink: TransactionSink): Context.Context<CrudContext>;
19
+ export declare function crudContextOf<TAdapters>(adapters: TAdapters, repository: keyof TAdapters): Context.Context<CrudContext>;
25
20
  export declare function makeEntityCrud<TEntity extends Entity, TAdapters>(entityConstructor: EntityConstructor<TEntity>, options: EntityCrudOptions<TAdapters, TEntity>): EntityCrud<TEntity>;
26
21
  //# sourceMappingURL=make-entity-crud.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"make-entity-crud.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/make-entity-crud.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,mBAAmB,EAKzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,iBAAiB,EAavB,MAAM,eAAe,CAAC;AASvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAS,OAAO,EAAgB,MAAM,QAAQ,CAAC;AAatD,OAAO,KAAK,EAEV,UAAU,EAEV,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AAUrC;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAEnE;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EACxC,QAAQ,EAAE,SAAS,EACnB,UAAU,EAAE,MAAM,SAAS,EAC3B,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAM9B;AAsID,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,EAAE,SAAS,EAC9D,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC7C,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,GAC7C,UAAU,CAAC,OAAO,CAAC,CA2arB"}
1
+ {"version":3,"file":"make-entity-crud.d.ts","sourceRoot":"","sources":["../../../src/lib/crud/make-entity-crud.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,mBAAmB,EAKzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,iBAAiB,EAavB,MAAM,eAAe,CAAC;AAUvB,OAAO,EAAS,OAAO,EAAgB,MAAM,QAAQ,CAAC;AAOtD,OAAO,KAAK,EAEV,UAAU,EAEV,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AASrC;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAE9C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,SAAS,EACrC,QAAQ,EAAE,SAAS,EACnB,UAAU,EAAE,MAAM,SAAS,GAC1B,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAE9B;AAsID,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,EAAE,SAAS,EAC9D,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,EAC7C,OAAO,EAAE,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,GAC7C,UAAU,CAAC,OAAO,CAAC,CAqZrB"}
@@ -5,31 +5,27 @@ import { deleteUCFactory, EntityIdTag, EntityTag, getUCFactory, loadUCFactory, s
5
5
  import { describeEntityColumns, envelopeEntityName, extractMetaEntity, Internal, isFailure, settled } from '@entifix/core';
6
6
  import { EntityTable, useCasesForSurface } from '@entifix/react-controls';
7
7
  import { entityQueryScope, useDataLoading, useEntityRecord, useOptimisticMutation } from '@entifix/react-integration';
8
- import { TransactionSinkTag } from '@entifix/transactions';
9
8
  import { useQueryClient } from '@tanstack/react-query';
10
9
  import { Cause, Context, Effect, Exit } from 'effect';
11
10
  import { useParams, useRouter } from 'next/navigation';
12
11
  import { useEffect, useRef } from 'react';
13
12
  import { useLocaleHref } from '../i18n/index.js';
14
13
  import { useEntityNavHost } from '../workspace/entity-nav.js';
15
- import { pendingFor, pendingRecordsFor, usePendingTransactions } from '../workspace/pending-transactions.js';
16
14
  import { EntityCrudForm } from './entity-crud-form.js';
17
- import { handOffWrite } from './hand-off-write.js';
18
- import { PendingNotice } from './pending-notice.js';
19
15
  import { CATALOG_NEW_SLUG, slugToEntityId } from './slug.js';
20
16
  import { useCrudRenderLink } from './use-crud-render-link.js';
21
17
  import { useEntityAffordances } from './use-entity-affordances.js';
22
18
  import { useEntityBulk } from './use-entity-bulk.js';
23
19
  /** What a picker defaults to reading off its target. */ const TARGET_NAME_PROPERTY = 'name';
24
20
  /**
25
- * Adds the pending-write sink to one repository adapter, giving the context the
26
- * use-cases run against.
21
+ * One repository adapter, by its key, as the context the use-cases run
22
+ * against.
27
23
  *
28
24
  * The cast is the price of naming adapters by key: `AdapterKey` narrows which
29
25
  * names may be *offered*, but TypeScript will not carry that narrowing through
30
26
  * an index access on a generic record.
31
- */ export function mergeCrudContext(adapters, repository, sink) {
32
- return Context.add(adapters[repository], TransactionSinkTag, sink);
27
+ */ export function crudContextOf(adapters, repository) {
28
+ return adapters[repository];
33
29
  }
34
30
  /**
35
31
  * Builds the list page and the single-record page for one entity.
@@ -153,9 +149,9 @@ export function makeEntityCrud(entityConstructor, options) {
153
149
  // depends on the record being edited. `linkLabelProperty`/`linkSearchProperty`
154
150
  // are overridden here because a scalar foreign key's `@accessor()` cannot name
155
151
  // the target's members — it may not import the target at all.
156
- // The wire name, which is also what a pending entry records and what
157
- // `entityQueryScopeFor` keys on — one derivation, so a notice and an
158
- // invalidation can never disagree about which entity they mean.
152
+ // The wire name, which is also what a pending flow's intent records and what
153
+ // `entityQueryScopeFor` keys on — one derivation, so the two can never
154
+ // disagree about which entity they mean.
159
155
  const entityName = envelopeEntityName(entityConstructor);
160
156
  const descriptors = describeEntityColumns(entityConstructor);
161
157
  const linkPlans = links.map((link)=>{
@@ -175,9 +171,6 @@ export function makeEntityCrud(entityConstructor, options) {
175
171
  var _syncFailure;
176
172
  var _affordances_metadata, _affordances_metadata1, _affordances_metadata2;
177
173
  const adapters = useAdapters();
178
- // Outside a `PendingTransactionsProvider` this watches nothing, so a host
179
- // that has not mounted one behaves exactly as it did before.
180
- const pending = usePendingTransactions();
181
174
  // Every internal href carries the locale. An unprefixed one still resolves —
182
175
  // the middleware redirects it — but the visitor pays a round trip per click.
183
176
  const withLocale = useLocaleHref();
@@ -186,13 +179,9 @@ export function makeEntityCrud(entityConstructor, options) {
186
179
  const metadataSource = metadataSourceOf(adapters);
187
180
  const affordances = useEntityAffordances(entityConstructor, metadataSource);
188
181
  const renderLink = useCrudRenderLink(catalogKey);
189
- // Records this browser has created but the service has not finished
190
- // writing. Prepended below rather than patched into the cache, which a
191
- // refetch would undo.
192
- const optimistic = pendingRecordsFor(pending, entityName);
193
182
  const pager = useDataLoading(_extends({
194
183
  uc: loadUCFactory(),
195
- ctx: mergeCrudContext(adapters, repository, pending),
184
+ ctx: crudContextOf(adapters, repository),
196
185
  // Scoped rather than left to the per-instance fallback, which is correct
197
186
  // but unshared: with the entity's own scope one invalidation refreshes
198
187
  // every page and filter of it, which is what a bulk run needs — and it is
@@ -251,33 +240,24 @@ export function makeEntityCrud(entityConstructor, options) {
251
240
  if (item.id == null) return;
252
241
  rowVerb.run(key, item.id);
253
242
  } : undefined;
254
- return /*#__PURE__*/ _jsxs("div", {
243
+ return /*#__PURE__*/ _jsx("div", {
255
244
  className: "flex flex-col gap-s",
256
- children: [
257
- /*#__PURE__*/ _jsx(PendingNotice, {
258
- entries: pendingFor(pending, entityName),
259
- onDismiss: pending.dismiss
260
- }),
261
- /*#__PURE__*/ _jsxs(EntityTable, _extends({
262
- entityConstructor: entityConstructor
263
- }, pager, {
264
- items: [
265
- ...optimistic,
266
- ...pager.items
267
- ],
268
- totalItems: pager.totalItems + optimistic.length,
269
- hrefFor: (id)=>withLocale(`${basePath}/${String(id)}`),
270
- newHref: withLocale(`${basePath}/${CATALOG_NEW_SLUG}`),
271
- renderLink: renderLink
272
- }, affordances, bulk.tableProps, {
273
- onUseCase: handleRowUseCase,
274
- error: (_syncFailure = syncFailure(rowVerb.verb)) != null ? _syncFailure : pager.error,
275
- children: [
276
- columns,
277
- toolbar
278
- ]
279
- }))
280
- ]
245
+ children: /*#__PURE__*/ _jsxs(EntityTable, _extends({
246
+ entityConstructor: entityConstructor
247
+ }, pager, {
248
+ items: pager.items,
249
+ totalItems: pager.totalItems,
250
+ hrefFor: (id)=>withLocale(`${basePath}/${String(id)}`),
251
+ newHref: withLocale(`${basePath}/${CATALOG_NEW_SLUG}`),
252
+ renderLink: renderLink
253
+ }, affordances, bulk.tableProps, {
254
+ onUseCase: handleRowUseCase,
255
+ error: (_syncFailure = syncFailure(rowVerb.verb)) != null ? _syncFailure : pager.error,
256
+ children: [
257
+ columns,
258
+ toolbar
259
+ ]
260
+ }))
281
261
  });
282
262
  }
283
263
  /**
@@ -292,13 +272,12 @@ export function makeEntityCrud(entityConstructor, options) {
292
272
  // The same served document the form reads its buttons from, so a key the
293
273
  // form hands back always names a verb in it.
294
274
  const affordances = useEntityAffordances(entityConstructor, metadataSource);
295
- const pending = usePendingTransactions();
296
275
  const router = useRouter();
297
276
  const withLocale = useLocaleHref();
298
277
  const params = useParams();
299
278
  const mounted = useMounted();
300
279
  const id = slugToEntityId(slug != null ? slug : params.slug);
301
- const ctx = mergeCrudContext(adapters, repository, pending);
280
+ const ctx = crudContextOf(adapters, repository);
302
281
  const { entity, isLoading, error: loadError, reload } = useEntityRecord({
303
282
  uc: getUCFactory(),
304
283
  ctx,
@@ -317,7 +296,7 @@ export function makeEntityCrud(entityConstructor, options) {
317
296
  entityConstructor: plan.entityConstructor,
318
297
  loadUc: loadUCFactory(),
319
298
  getUc: getUCFactory(),
320
- ctx: mergeCrudContext(adapters, plan.repository, pending),
299
+ ctx: crudContextOf(adapters, plan.repository),
321
300
  // The config's target is erased to `Entity`, and the host's filter to
322
301
  // `any`; the two meet here, where neither type is the real target's.
323
302
  baseFiltering: linkFilters[index]
@@ -329,9 +308,8 @@ export function makeEntityCrud(entityConstructor, options) {
329
308
  const renderLink = useCrudRenderLink(catalogKey);
330
309
  const queryClient = useQueryClient();
331
310
  // The list this page returns to has its page cached, and it is no longer
332
- // true. Invalidated rather than patched, for the reason `handOffWrite`
333
- // gives: a transactional create is not in the service yet, and the pending
334
- // set, not the cache, is what keeps it visible until it is.
311
+ // true. Invalidated rather than patched: the service is the authority on
312
+ // the row it stored.
335
313
  //
336
314
  // ⚠️ Invisible while every Open was a document load, which threw the cache
337
315
  // away anyway (#20): the first client-side navigation back to the list
@@ -379,20 +357,11 @@ export function makeEntityCrud(entityConstructor, options) {
379
357
  });
380
358
  const handleSave = async (next)=>{
381
359
  const result = await saveMutation.mutate(next).catch(()=>undefined);
382
- // Failed, or pending: the form stays, and the mutation says which.
360
+ // Failed, or pending: the form stays, and the mutation says which. A
361
+ // pending write leaves through the mutation's `confirm`, once its flow
362
+ // completed.
383
363
  if ((result == null ? void 0 : result._tag) !== 'settled') return;
384
- const saved = result.value;
385
- // ⚠️ Deliberately *not* a `setQueriesData` patch. The list refetches on
386
- // mount — precisely when the operator arrives, having just been navigated
387
- // here — and the server legitimately does not hold the record yet, so the
388
- // refetch would replace the patched page and the row would vanish a
389
- // moment after appearing. The pending set outlives refetches.
390
- handOffWrite({
391
- id: String(saved.id),
392
- record: saved,
393
- pending,
394
- draft
395
- });
364
+ draft == null ? void 0 : draft.clear();
396
365
  void refreshList();
397
366
  afterSave();
398
367
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/crud/make-entity-crud.tsx"],"sourcesContent":["'use client';\n\nimport {\n deleteUCFactory,\n EntityIdTag,\n type EntityRepositoryTag,\n EntityTag,\n getUCFactory,\n loadUCFactory,\n saveUCFactory,\n} from '@entifix/business';\nimport {\n describeEntityColumns,\n type EntifixFailure,\n type Entity,\n type EntityConstructor,\n type EntityId,\n type EntityMetadataSource,\n type EntitySelection,\n type EntityUseCaseRunner,\n type EntityWriter,\n envelopeEntityName,\n extractMetaEntity,\n type FilterGroup,\n Internal,\n isFailure,\n settled,\n type UseCaseDescriptor,\n} from '@entifix/core';\nimport { EntityTable, useCasesForSurface } from '@entifix/react-controls';\nimport {\n entityQueryScope,\n type OptimisticMutation,\n useDataLoading,\n useEntityRecord,\n useOptimisticMutation,\n} from '@entifix/react-integration';\nimport type { TransactionSink } from '@entifix/transactions';\nimport { TransactionSinkTag } from '@entifix/transactions';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { Cause, Context, Effect, Exit } from 'effect';\nimport { useParams, useRouter } from 'next/navigation';\nimport { useEffect, useRef } from 'react';\n\nimport { useLocaleHref } from '../i18n/index.js';\nimport { useEntityNavHost } from '../workspace/entity-nav.js';\nimport {\n pendingFor,\n pendingRecordsFor,\n usePendingTransactions,\n} from '../workspace/pending-transactions.js';\nimport { EntityCrudForm } from './entity-crud-form.js';\nimport { handOffWrite } from './hand-off-write.js';\nimport type {\n AnyFilterGroup,\n EntityCrud,\n EntityCrudLinkSource,\n EntityCrudOptions,\n EntityCrudSingleViewProps,\n} from './make-entity-crud.types.js';\nimport { PendingNotice } from './pending-notice.js';\nimport { CATALOG_NEW_SLUG, slugToEntityId } from './slug.js';\nimport { useCrudRenderLink } from './use-crud-render-link.js';\nimport { useEntityAffordances } from './use-entity-affordances.js';\nimport { useEntityBulk } from './use-entity-bulk.js';\n\n/** What a picker defaults to reading off its target. */\nconst TARGET_NAME_PROPERTY = 'name';\n\n/**\n * What the generated pages' use-cases run against.\n *\n * Exported because a hand-built screen needs the same three: a wizard reads\n * records, resolves pickers and writes through exactly these ports, and\n * rebuilding the union at each such call site is how one of them ends up\n * missing `TransactionSinkTag` and quietly losing its optimistic treatment.\n */\nexport type CrudContext = EntityRepositoryTag | TransactionSinkTag;\n\n/**\n * Adds the pending-write sink to one repository adapter, giving the context the\n * use-cases run against.\n *\n * The cast is the price of naming adapters by key: `AdapterKey` narrows which\n * names may be *offered*, but TypeScript will not carry that narrowing through\n * an index access on a generic record.\n */\nexport function mergeCrudContext<TAdapters>(\n adapters: TAdapters,\n repository: keyof TAdapters,\n sink: TransactionSink,\n): Context.Context<CrudContext> {\n return Context.add(\n adapters[repository] as Context.Context<EntityRepositoryTag>,\n TransactionSinkTag,\n sink,\n );\n}\n\n/**\n * Builds the list page and the single-record page for one entity.\n *\n * Every catalog entity used to cost ~10 files and ~300 lines whose only variable\n * was a class name: two organisms with a `.types.ts` each, two client pages, two\n * route files. The route files stay (Next needs a module per path); everything\n * between them is derived from the entity's own metadata, so a new reference\n * entity is this call plus a nav entry.\n *\n * Two things are checked here rather than at the call site, because both fail\n * silently otherwise. The catalog key must be the entity's own `@entity({ key })`\n * — they are the same string by convention, and a drifted one titles the form\n * after a different entity in a way only a reader of both catalogs would catch.\n * And a `links` entry must name a real member — a picker aimed at nothing renders\n * identically to a read-only field.\n *\n * **Serves compile-time `@entity()` classes only.** Operator reference data ships\n * with the code, so making this spec-driven would trade type safety for nothing;\n * a vendor-authored `EntitySpecification` renders through a separate path.\n */\n/**\n * A rejected write, as something the form's error slot can render.\n *\n * A typed failure is kept as it is: `useErrorMessage` translates its own code,\n * a business refusal and an outage alike. Anything else is a bug that reached\n * the screen, and is shown as `Internal` — never with its own text, which\n * nobody wrote for a user.\n */\nfunction asFailure(failure: unknown): EntifixFailure {\n return isFailure(failure) ? failure : new Internal();\n}\n\n/**\n * What a write failed with *synchronously* — before any flow took it — or\n * `undefined`. A flow's own failure is toasted by the `PendingFlowsProvider`\n * that settles it, so showing it in the error slot too would tell the operator\n * twice.\n */\nfunction syncFailure(\n mutation: OptimisticMutation<never, unknown>,\n): EntifixFailure | undefined {\n return mutation.status === 'failed' && mutation.flowId === undefined\n ? asFailure(mutation.failure)\n : undefined;\n}\n\n/**\n * A runner's verbs, looked up by the key the served `$metadata` named. A\n * single verb answers either settle mode, so it is run through the optimistic\n * API; a bulk run reports per row and is awaited as a promise whose rejection\n * carries the failure itself.\n */\nfunction verbsOf(\n runner: EntityUseCaseRunner | undefined,\n served: readonly UseCaseDescriptor[] | undefined,\n) {\n if (runner === undefined) return undefined;\n // The key always comes from the served document, so it names a verb in it.\n const descriptor = (key: string) =>\n served?.find(candidate => candidate.key === key) as UseCaseDescriptor;\n return {\n run: (key: string, id: EntityId) => runner.run(descriptor(key), id),\n bulk: (key: string, selection: EntitySelection<Entity>) =>\n Effect.runPromiseExit(runner.bulk(descriptor(key), selection)).then(\n exit =>\n Exit.isSuccess(exit)\n ? exit.value\n : Promise.reject(Cause.squash(exit.cause)),\n ),\n };\n}\n\ntype Verbs = NonNullable<ReturnType<typeof verbsOf>>;\n\n/**\n * One verb on one record, through the optimistic API: `done` runs once the\n * verb took effect — at once when it settled, or when the flow it was handed\n * to completed.\n */\nfunction useVerb(verbs: Verbs | undefined, done: () => void) {\n const verb = useOptimisticMutation<\n { readonly key: string; readonly id: EntityId },\n unknown\n >({\n // Only ever sent from a handler that exists because `verbs` does.\n write: ({ key, id }) => (verbs as Verbs).run(key, id),\n confirm: done,\n });\n const run = (key: string, id: EntityId) => {\n void verb.mutate({ key, id }).then(\n result => {\n if (result._tag === 'settled') done();\n },\n // Shown through `syncFailure`, from the mutation's own state.\n () => undefined,\n );\n };\n return { verb, run };\n}\n\n/** Whether the component is still mounted: a flow can settle after it left. */\nfunction useMounted() {\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n return mounted;\n}\n\n/**\n * Runs each link's `useBaseFiltering` against the record being edited, in link\n * order, with `undefined` for a link that declares none.\n *\n * Legal for the reason `useEntityLinkSources` gives: the links are a\n * factory-time array, and whether a link carries a rule is fixed with it, so\n * the same hooks run in the same order on every render. The lint rule cannot\n * see a hook called through a member, so there is nothing for it to flag.\n */\nfunction useLinkFilters<TEntity extends Entity>(\n links: readonly {\n readonly useBaseFiltering?: (\n record: TEntity | undefined,\n ) => AnyFilterGroup | undefined;\n }[],\n record: TEntity | undefined,\n): (AnyFilterGroup | undefined)[] {\n return links.map(link => link.useBaseFiltering?.(record));\n}\n\nexport function makeEntityCrud<TEntity extends Entity, TAdapters>(\n entityConstructor: EntityConstructor<TEntity>,\n options: EntityCrudOptions<TAdapters, TEntity>,\n): EntityCrud<TEntity> {\n const {\n useAdapters,\n basePath,\n catalogKey,\n repository,\n hiddenFields = [],\n columns,\n toolbar,\n pageSize,\n links = [],\n metadataSource: givenMetadataSource,\n metadata,\n useCases,\n write,\n } = options;\n\n if (givenMetadataSource !== undefined && metadata !== undefined) {\n throw new Error(\n `${entityConstructor.name} was given both metadataSource and metadata; pass one`,\n );\n }\n // An adapter value, so it is resolved per render from the same `useAdapters()`\n // the records come from — the host's composition, never the caller's module.\n const metadataSourceOf = (adapters: TAdapters) =>\n metadata === undefined\n ? givenMetadataSource\n : (adapters[metadata] as EntityMetadataSource);\n\n const meta = extractMetaEntity(entityConstructor);\n if (meta.key !== catalogKey) {\n throw new Error(\n `${entityConstructor.name} declares key \"${String(meta.key)}\" but was given catalog key \"${catalogKey}\"`,\n );\n }\n // Read off `@entity()` rather than rebuilt from `catalogKey`. Both spellings\n // produce the same string today, and that is exactly the problem: a second\n // place that knows how an entity's catalog subtree is laid out is a second\n // place to fix when one moves. `MetaEntityOptions` makes them optional, so an\n // entity that never declared them fails here — where a screen is generated —\n // rather than on the render that first tries to title a tab with `undefined`.\n const { labelKey: entityLabelKey, pluralKey: entityPluralKey } = meta;\n if (entityLabelKey === undefined || entityPluralKey === undefined) {\n throw new Error(\n `${entityConstructor.name} must declare labelKey and pluralKey on @entity() to be generated`,\n );\n }\n\n // Computed once: a descriptor is a property of the class, so nothing about it\n // depends on the record being edited. `linkLabelProperty`/`linkSearchProperty`\n // are overridden here because a scalar foreign key's `@accessor()` cannot name\n // the target's members — it may not import the target at all.\n // The wire name, which is also what a pending entry records and what\n // `entityQueryScopeFor` keys on — one derivation, so a notice and an\n // invalidation can never disagree about which entity they mean.\n const entityName = envelopeEntityName(entityConstructor);\n const descriptors = describeEntityColumns(entityConstructor);\n const linkPlans = links.map(link => {\n const descriptor = descriptors.find(entry => entry.name === link.field);\n if (descriptor === undefined) {\n throw new Error(\n `${entityConstructor.name} has no member \"${link.field}\" for a link source`,\n );\n }\n return {\n ...link,\n descriptor: {\n ...descriptor,\n linkLabelProperty: link.labelProperty ?? TARGET_NAME_PROPERTY,\n linkSearchProperty: link.searchProperty ?? TARGET_NAME_PROPERTY,\n },\n };\n });\n\n function ListPage() {\n const adapters = useAdapters();\n // Outside a `PendingTransactionsProvider` this watches nothing, so a host\n // that has not mounted one behaves exactly as it did before.\n const pending = usePendingTransactions();\n // Every internal href carries the locale. An unprefixed one still resolves —\n // the middleware redirects it — but the visitor pays a round trip per click.\n const withLocale = useLocaleHref();\n\n const queryClient = useQueryClient();\n const scope = entityQueryScope(entityConstructor);\n const metadataSource = metadataSourceOf(adapters);\n const affordances = useEntityAffordances(entityConstructor, metadataSource);\n const renderLink = useCrudRenderLink(catalogKey);\n\n // Records this browser has created but the service has not finished\n // writing. Prepended below rather than patched into the cache, which a\n // refetch would undo.\n const optimistic = pendingRecordsFor<TEntity>(pending, entityName);\n\n const pager = useDataLoading<TEntity, CrudContext>({\n uc: loadUCFactory<TEntity>(),\n ctx: mergeCrudContext(adapters, repository, pending),\n // Scoped rather than left to the per-instance fallback, which is correct\n // but unshared: with the entity's own scope one invalidation refreshes\n // every page and filter of it, which is what a bulk run needs — and it is\n // the same prefix `useReactiveInvalidation`already targets, so a generated\n // list now also refreshes on a reactive change event.\n queryKey: scope,\n ...(pageSize === undefined ? {} : { initialPageSize: pageSize }),\n });\n\n // Only when this caller may actually run something over a selection.\n //\n // Measured live: an `admin` holds `catalog-reference:*:read` and no\n // `retire`, so the service filters the verb out of `$metadata` — but the\n // selection column still rendered, offering a set that no action could be\n // taken on. A checkbox that can lead nowhere is worse than no checkbox: it\n // reads as a permission the user does not have.\n //\n // Decided from the served document rather than from the runner, because\n // the runner is a property of the *shell* (it knows the route) and the\n // grant is a property of the *caller*. The column therefore appears when\n // the document lands, which is the asynchrony serving affordances accepts\n // for every action surface.\n const canRunBulk =\n useCasesForSurface('bulk-bar', affordances.metadata?.useCases).length > 0;\n\n const verbs = verbsOf(\n useCases === undefined\n ? undefined\n : (adapters[useCases] as EntityUseCaseRunner),\n affordances.metadata?.useCases,\n );\n\n const bulk = useEntityBulk<TEntity>({\n run:\n canRunBulk && verbs !== undefined\n ? (key, selection) =>\n verbs.bulk(key, selection as EntitySelection<Entity>)\n : undefined,\n // A bulk write changed the rows underneath the listing, so the page is\n // re-read; the selection deliberately survives it (\"the selection\n // is still there afterwards\"), because the operator's next act is usually\n // to retry the failures or run a second verb on the same rows.\n onCompleted: () => {\n void queryClient.invalidateQueries({ queryKey: scope });\n },\n });\n\n // What a row's overflow menu runs, and the one place the list reports a\n // verb that failed.\n //\n // ⚠️ **A row verb and the form's are the same runner with different\n // arguments.** `EntityTable` hands back the whole record, because that is\n // what it has; the runner takes an id, because that is what a route needs.\n // The list has no error slot of its own, so a failure lands in the\n // table's own error region — the same one a failed page read uses.\n const rowVerb = useVerb(verbs, () => {\n void queryClient.invalidateQueries({ queryKey: scope });\n });\n // Called unconditionally and the *result* gated, the way the surfaces are\n // read in `EntityForm`: the name begins with `use`, so short-circuiting it\n // reads to `react-hooks/rules-of-hooks` as a conditional hook.\n const rowUseCases = useCasesForSurface(\n 'row-menu',\n affordances.metadata?.useCases,\n );\n const canRunRowUseCase = verbs !== undefined && rowUseCases.length > 0;\n\n const handleRowUseCase = canRunRowUseCase\n ? (key: string, item: TEntity) => {\n if (item.id == null) return;\n rowVerb.run(key, item.id);\n }\n : undefined;\n\n return (\n <div className=\"flex flex-col gap-s\">\n {/* Above the table, because this is where `afterSave()` leaves the\n operator after a create — and a create is the only transactional\n write there is, so this is the surface the pending state has. */}\n <PendingNotice\n entries={pendingFor(pending, entityName)}\n onDismiss={pending.dismiss}\n />\n <EntityTable\n entityConstructor={entityConstructor}\n {...pager}\n items={[...optimistic, ...pager.items]}\n totalItems={pager.totalItems + optimistic.length}\n hrefFor={id => withLocale(`${basePath}/${String(id)}`)}\n newHref={withLocale(`${basePath}/${CATALOG_NEW_SLUG}`)}\n renderLink={renderLink}\n {...affordances}\n {...bulk.tableProps}\n onUseCase={handleRowUseCase}\n error={syncFailure(rowVerb.verb) ?? pager.error}\n >\n {columns}\n {toolbar}\n </EntityTable>\n </div>\n );\n }\n\n /**\n * Dual-host: as a route it reads its slug from the URL and returns to the list\n * on save; in a workspace tab it takes the slug and the post-save action as\n * props.\n */\n function SingleViewPage({\n slug,\n onSaved,\n onDeleted,\n draft,\n }: EntityCrudSingleViewProps = {}) {\n const adapters = useAdapters();\n const metadataSource = metadataSourceOf(adapters);\n // The same served document the form reads its buttons from, so a key the\n // form hands back always names a verb in it.\n const affordances = useEntityAffordances(entityConstructor, metadataSource);\n const pending = usePendingTransactions();\n const router = useRouter();\n const withLocale = useLocaleHref();\n const params = useParams<{ slug: string }>();\n const mounted = useMounted();\n const id = slugToEntityId(slug ?? params.slug);\n\n const ctx = mergeCrudContext(adapters, repository, pending);\n\n const {\n entity,\n isLoading,\n error: loadError,\n reload,\n } = useEntityRecord<TEntity, CrudContext>({\n uc: getUCFactory<TEntity>(),\n ctx,\n id,\n });\n\n // Against the record as loaded, not the draft: the rule is about which\n // record this is, not what the operator has typed into it.\n const linkFilters = useLinkFilters(linkPlans, entity);\n\n // Rebuilt inline on every render on purpose: `useEntityLinkSource` holds\n // these in a ref and keeps them out of its query keys, precisely so a caller\n // does not have to memoise them.\n const linkSources: EntityCrudLinkSource[] = linkPlans.map(\n (plan, index) => ({\n field: plan.field,\n descriptor: plan.descriptor,\n config: {\n entityConstructor: plan.entityConstructor,\n loadUc: loadUCFactory(),\n getUc: getUCFactory(),\n ctx: mergeCrudContext(adapters, plan.repository, pending),\n // The config's target is erased to `Entity`, and the host's filter to\n // `any`; the two meet here, where neither type is the real target's.\n baseFiltering: linkFilters[index] as FilterGroup<Entity> | undefined,\n },\n }),\n );\n\n // Inside a workspace tab, \"back to the list\" is the list's tab, not a URL\n // that would leave the workspace. A host's own callbacks still win.\n const host = useEntityNavHost();\n const renderLink = useCrudRenderLink(catalogKey);\n const queryClient = useQueryClient();\n // The list this page returns to has its page cached, and it is no longer\n // true. Invalidated rather than patched, for the reason `handOffWrite`\n // gives: a transactional create is not in the service yet, and the pending\n // set, not the cache, is what keeps it visible until it is.\n //\n // ⚠️ Invisible while every Open was a document load, which threw the cache\n // away anyway (#20): the first client-side navigation back to the list\n // showed the record as it was before the save.\n const refreshList = () =>\n queryClient.invalidateQueries({\n queryKey: entityQueryScope(entityConstructor),\n });\n const toList = () =>\n host === undefined\n ? router.push(withLocale(basePath))\n : host.toList(catalogKey);\n const afterSave = onSaved ?? toList;\n const afterDelete = onDeleted ?? toList;\n\n // Through the host's writer when it named one, which answers both settle\n // modes; otherwise through the repository, where every write settles.\n const writer =\n write === undefined ? undefined : (adapters[write] as EntityWriter);\n\n // The draft is spent once the write *commits*, and only here is that known:\n // `useEntityForm` neither fetches nor saves, so it cannot clear its own.\n // A failed write — or a failed flow — deliberately keeps the draft and the\n // form: the edit is still the user's only copy of what they typed.\n //\n // ⚠️ A flow can complete after the operator left this page, so leaving it\n // is guarded on still being here: a navigation from a form nobody is\n // looking at would pull them away from wherever they went.\n const saveMutation = useOptimisticMutation<TEntity, TEntity>({\n write: next =>\n writer === undefined\n ? Effect.map(\n Effect.provide(\n saveUCFactory<TEntity>(),\n ctx.pipe(Context.add(EntityTag, next)),\n ),\n settled,\n )\n : writer.save(next),\n intent: () => ({ entity: entityName, write: 'save' }),\n confirm: () => {\n draft?.clear();\n void refreshList();\n if (mounted.current) afterSave();\n },\n });\n const deleteMutation = useOptimisticMutation<EntityId, void>({\n write: target =>\n writer === undefined\n ? Effect.as(\n Effect.provide(\n deleteUCFactory<TEntity>(),\n ctx.pipe(Context.add(EntityIdTag, target)),\n ),\n settled(undefined),\n )\n : writer.delete(target),\n intent: () => ({ entity: entityName, write: 'delete' }),\n confirm: () => {\n draft?.clear();\n void refreshList();\n if (mounted.current) afterDelete();\n },\n });\n\n const handleSave = async (next: TEntity) => {\n const result = await saveMutation.mutate(next).catch(() => undefined);\n // Failed, or pending: the form stays, and the mutation says which.\n if (result?._tag !== 'settled') return;\n const saved = result.value;\n\n // ⚠️ Deliberately *not* a `setQueriesData` patch. The list refetches on\n // mount — precisely when the operator arrives, having just been navigated\n // here — and the server legitimately does not hold the record yet, so the\n // refetch would replace the patched page and the row would vanish a\n // moment after appearing. The pending set outlives refetches.\n handOffWrite({ id: String(saved.id), record: saved, pending, draft });\n void refreshList();\n afterSave();\n };\n\n const handleDelete = async () => {\n const result = await deleteMutation.mutate(id).catch(() => undefined);\n if (result?._tag !== 'settled') return;\n draft?.clear();\n void refreshList();\n afterDelete();\n };\n\n /**\n * An `entity`-bound verb, on the record being shown.\n *\n * It **reloads** — once the verb took effect, which for one the server\n * handed to a flow is when the flow completed — rather than patching what it has: the service decides the\n * resulting state — a `publish` may land on `published` from four different\n * places — and a client that assumed the new value would show the wrong one\n * the first time the rule changed. `id == null` means the create form,\n * where there is no record to act on and the form renders no verbs anyway.\n *\n * ⚠️ The rejection is **caught and shown**, never left to the promise.\n * `EntityForm`'s `onUseCase` returns `void`, so an uncaught rejection here\n * reaches the console and nothing else — measured on an offering refusing\n * `unpublish` from `draft`: the service answered `409` with a coded body,\n * the record correctly did not move, and the operator saw a button that\n * appeared to do nothing at all.\n */\n const verbs = verbsOf(\n useCases === undefined\n ? undefined\n : (adapters[useCases] as EntityUseCaseRunner),\n affordances.metadata?.useCases,\n );\n const recordVerb = useVerb(verbs, () => void reload());\n const handleUseCase =\n verbs === undefined || id == null\n ? undefined\n : (key: string) => recordVerb.run(key, id);\n\n return (\n <EntityCrudForm<TEntity>\n // Remounts (and reseeds the fields) once the record arrives.\n key={String(entity?.id ?? CATALOG_NEW_SLUG)}\n entityConstructor={entityConstructor}\n catalogKey={catalogKey}\n metadataSource={metadataSource}\n hiddenFields={hiddenFields}\n links={linkSources}\n entity={entity}\n isLoading={isLoading}\n isSaving={saveMutation.status === 'running'}\n isPending={[saveMutation, deleteMutation, recordVerb.verb].some(\n mutation => mutation.status === 'pending',\n )}\n isDeleting={deleteMutation.status === 'running'}\n error={\n loadError ??\n syncFailure(saveMutation) ??\n syncFailure(deleteMutation) ??\n syncFailure(recordVerb.verb)\n }\n onSave={handleSave}\n onDelete={id == null ? undefined : handleDelete}\n onUseCase={handleUseCase}\n backHref={withLocale(basePath)}\n renderLink={renderLink}\n draft={draft}\n />\n );\n }\n\n return {\n entityConstructor,\n entityKey: catalogKey,\n entityLabelKey,\n entityPluralKey,\n basePath,\n ListPage,\n SingleViewPage,\n };\n}\n"],"names":["deleteUCFactory","EntityIdTag","EntityTag","getUCFactory","loadUCFactory","saveUCFactory","describeEntityColumns","envelopeEntityName","extractMetaEntity","Internal","isFailure","settled","EntityTable","useCasesForSurface","entityQueryScope","useDataLoading","useEntityRecord","useOptimisticMutation","TransactionSinkTag","useQueryClient","Cause","Context","Effect","Exit","useParams","useRouter","useEffect","useRef","useLocaleHref","useEntityNavHost","pendingFor","pendingRecordsFor","usePendingTransactions","EntityCrudForm","handOffWrite","PendingNotice","CATALOG_NEW_SLUG","slugToEntityId","useCrudRenderLink","useEntityAffordances","useEntityBulk","TARGET_NAME_PROPERTY","mergeCrudContext","adapters","repository","sink","add","asFailure","failure","syncFailure","mutation","status","flowId","undefined","verbsOf","runner","served","descriptor","key","find","candidate","run","id","bulk","selection","runPromiseExit","then","exit","isSuccess","value","Promise","reject","squash","cause","useVerb","verbs","done","verb","write","confirm","mutate","result","_tag","useMounted","mounted","current","useLinkFilters","links","record","map","link","useBaseFiltering","makeEntityCrud","entityConstructor","options","useAdapters","basePath","catalogKey","hiddenFields","columns","toolbar","pageSize","metadataSource","givenMetadataSource","metadata","useCases","Error","name","metadataSourceOf","meta","String","labelKey","entityLabelKey","pluralKey","entityPluralKey","entityName","descriptors","linkPlans","entry","field","linkLabelProperty","labelProperty","linkSearchProperty","searchProperty","ListPage","affordances","pending","withLocale","queryClient","scope","renderLink","optimistic","pager","uc","ctx","queryKey","initialPageSize","canRunBulk","length","onCompleted","invalidateQueries","rowVerb","rowUseCases","canRunRowUseCase","handleRowUseCase","item","div","className","entries","onDismiss","dismiss","items","totalItems","hrefFor","newHref","tableProps","onUseCase","error","SingleViewPage","slug","onSaved","onDeleted","draft","loadError","router","params","entity","isLoading","reload","linkFilters","linkSources","plan","index","config","loadUc","getUc","baseFiltering","host","refreshList","toList","push","afterSave","afterDelete","writer","saveMutation","next","provide","pipe","save","intent","clear","deleteMutation","target","as","delete","handleSave","catch","saved","handleDelete","recordVerb","handleUseCase","isSaving","isPending","some","isDeleting","onSave","onDelete","backHref","entityKey"],"mappings":"AAAA;;;AAEA,SACEA,eAAe,EACfC,WAAW,EAEXC,SAAS,EACTC,YAAY,EACZC,aAAa,EACbC,aAAa,QACR,oBAAoB;AAC3B,SACEC,qBAAqB,EASrBC,kBAAkB,EAClBC,iBAAiB,EAEjBC,QAAQ,EACRC,SAAS,EACTC,OAAO,QAEF,gBAAgB;AACvB,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,0BAA0B;AAC1E,SACEC,gBAAgB,EAEhBC,cAAc,EACdC,eAAe,EACfC,qBAAqB,QAChB,6BAA6B;AAEpC,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAEC,IAAI,QAAQ,SAAS;AACtD,SAASC,SAAS,EAAEC,SAAS,QAAQ,kBAAkB;AACvD,SAASC,SAAS,EAAEC,MAAM,QAAQ,QAAQ;AAE1C,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SACEC,UAAU,EACVC,iBAAiB,EACjBC,sBAAsB,QACjB,uCAAuC;AAC9C,SAASC,cAAc,QAAQ,wBAAwB;AACvD,SAASC,YAAY,QAAQ,sBAAsB;AAQnD,SAASC,aAAa,QAAQ,sBAAsB;AACpD,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,YAAY;AAC7D,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,oBAAoB,QAAQ,8BAA8B;AACnE,SAASC,aAAa,QAAQ,uBAAuB;AAErD,sDAAsD,GACtD,MAAMC,uBAAuB;AAY7B;;;;;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AGAlH,YAAYsJ,WAAW1H,IAAI;YAE7BgI,QAAQV;YACRW,UAAUhJ,MAAM,OAAOT,YAAYiJ;YACnC1C,WAAW4C;YACXO,UAAUhF,WAAW/B;YACrBkC,YAAYA;YACZgC,OAAOA;WAxBFpD,gBAAOwD,0BAAAA,OAAQxG,EAAE,oBAAI1B;IA2BhC;IAEA,OAAO;QACLyD;QACAmH,WAAW/G;QACXe;QACAE;QACAlB;QACA4B;QACAkC;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/lib/crud/make-entity-crud.tsx"],"sourcesContent":["'use client';\n\nimport {\n deleteUCFactory,\n EntityIdTag,\n type EntityRepositoryTag,\n EntityTag,\n getUCFactory,\n loadUCFactory,\n saveUCFactory,\n} from '@entifix/business';\nimport {\n describeEntityColumns,\n type EntifixFailure,\n type Entity,\n type EntityConstructor,\n type EntityId,\n type EntityMetadataSource,\n type EntitySelection,\n type EntityUseCaseRunner,\n type EntityWriter,\n envelopeEntityName,\n extractMetaEntity,\n type FilterGroup,\n Internal,\n isFailure,\n settled,\n type UseCaseDescriptor,\n} from '@entifix/core';\nimport { EntityTable, useCasesForSurface } from '@entifix/react-controls';\nimport {\n entityQueryScope,\n type OptimisticMutation,\n useDataLoading,\n useEntityRecord,\n useOptimisticMutation,\n} from '@entifix/react-integration';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { Cause, Context, Effect, Exit } from 'effect';\nimport { useParams, useRouter } from 'next/navigation';\nimport { useEffect, useRef } from 'react';\n\nimport { useLocaleHref } from '../i18n/index.js';\nimport { useEntityNavHost } from '../workspace/entity-nav.js';\nimport { EntityCrudForm } from './entity-crud-form.js';\nimport type {\n AnyFilterGroup,\n EntityCrud,\n EntityCrudLinkSource,\n EntityCrudOptions,\n EntityCrudSingleViewProps,\n} from './make-entity-crud.types.js';\nimport { CATALOG_NEW_SLUG, slugToEntityId } from './slug.js';\nimport { useCrudRenderLink } from './use-crud-render-link.js';\nimport { useEntityAffordances } from './use-entity-affordances.js';\nimport { useEntityBulk } from './use-entity-bulk.js';\n\n/** What a picker defaults to reading off its target. */\nconst TARGET_NAME_PROPERTY = 'name';\n\n/**\n * What the generated pages' use-cases run against: one repository adapter.\n * Exported because a hand-built screen — a wizard reading records and\n * resolving pickers — runs against exactly the same.\n */\nexport type CrudContext = EntityRepositoryTag;\n\n/**\n * One repository adapter, by its key, as the context the use-cases run\n * against.\n *\n * The cast is the price of naming adapters by key: `AdapterKey` narrows which\n * names may be *offered*, but TypeScript will not carry that narrowing through\n * an index access on a generic record.\n */\nexport function crudContextOf<TAdapters>(\n adapters: TAdapters,\n repository: keyof TAdapters,\n): Context.Context<CrudContext> {\n return adapters[repository] as Context.Context<EntityRepositoryTag>;\n}\n\n/**\n * Builds the list page and the single-record page for one entity.\n *\n * Every catalog entity used to cost ~10 files and ~300 lines whose only variable\n * was a class name: two organisms with a `.types.ts` each, two client pages, two\n * route files. The route files stay (Next needs a module per path); everything\n * between them is derived from the entity's own metadata, so a new reference\n * entity is this call plus a nav entry.\n *\n * Two things are checked here rather than at the call site, because both fail\n * silently otherwise. The catalog key must be the entity's own `@entity({ key })`\n * — they are the same string by convention, and a drifted one titles the form\n * after a different entity in a way only a reader of both catalogs would catch.\n * And a `links` entry must name a real member — a picker aimed at nothing renders\n * identically to a read-only field.\n *\n * **Serves compile-time `@entity()` classes only.** Operator reference data ships\n * with the code, so making this spec-driven would trade type safety for nothing;\n * a vendor-authored `EntitySpecification` renders through a separate path.\n */\n/**\n * A rejected write, as something the form's error slot can render.\n *\n * A typed failure is kept as it is: `useErrorMessage` translates its own code,\n * a business refusal and an outage alike. Anything else is a bug that reached\n * the screen, and is shown as `Internal` — never with its own text, which\n * nobody wrote for a user.\n */\nfunction asFailure(failure: unknown): EntifixFailure {\n return isFailure(failure) ? failure : new Internal();\n}\n\n/**\n * What a write failed with *synchronously* — before any flow took it — or\n * `undefined`. A flow's own failure is toasted by the `PendingFlowsProvider`\n * that settles it, so showing it in the error slot too would tell the operator\n * twice.\n */\nfunction syncFailure(\n mutation: OptimisticMutation<never, unknown>,\n): EntifixFailure | undefined {\n return mutation.status === 'failed' && mutation.flowId === undefined\n ? asFailure(mutation.failure)\n : undefined;\n}\n\n/**\n * A runner's verbs, looked up by the key the served `$metadata` named. A\n * single verb answers either settle mode, so it is run through the optimistic\n * API; a bulk run reports per row and is awaited as a promise whose rejection\n * carries the failure itself.\n */\nfunction verbsOf(\n runner: EntityUseCaseRunner | undefined,\n served: readonly UseCaseDescriptor[] | undefined,\n) {\n if (runner === undefined) return undefined;\n // The key always comes from the served document, so it names a verb in it.\n const descriptor = (key: string) =>\n served?.find(candidate => candidate.key === key) as UseCaseDescriptor;\n return {\n run: (key: string, id: EntityId) => runner.run(descriptor(key), id),\n bulk: (key: string, selection: EntitySelection<Entity>) =>\n Effect.runPromiseExit(runner.bulk(descriptor(key), selection)).then(\n exit =>\n Exit.isSuccess(exit)\n ? exit.value\n : Promise.reject(Cause.squash(exit.cause)),\n ),\n };\n}\n\ntype Verbs = NonNullable<ReturnType<typeof verbsOf>>;\n\n/**\n * One verb on one record, through the optimistic API: `done` runs once the\n * verb took effect — at once when it settled, or when the flow it was handed\n * to completed.\n */\nfunction useVerb(verbs: Verbs | undefined, done: () => void) {\n const verb = useOptimisticMutation<\n { readonly key: string; readonly id: EntityId },\n unknown\n >({\n // Only ever sent from a handler that exists because `verbs` does.\n write: ({ key, id }) => (verbs as Verbs).run(key, id),\n confirm: done,\n });\n const run = (key: string, id: EntityId) => {\n void verb.mutate({ key, id }).then(\n result => {\n if (result._tag === 'settled') done();\n },\n // Shown through `syncFailure`, from the mutation's own state.\n () => undefined,\n );\n };\n return { verb, run };\n}\n\n/** Whether the component is still mounted: a flow can settle after it left. */\nfunction useMounted() {\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n return mounted;\n}\n\n/**\n * Runs each link's `useBaseFiltering` against the record being edited, in link\n * order, with `undefined` for a link that declares none.\n *\n * Legal for the reason `useEntityLinkSources` gives: the links are a\n * factory-time array, and whether a link carries a rule is fixed with it, so\n * the same hooks run in the same order on every render. The lint rule cannot\n * see a hook called through a member, so there is nothing for it to flag.\n */\nfunction useLinkFilters<TEntity extends Entity>(\n links: readonly {\n readonly useBaseFiltering?: (\n record: TEntity | undefined,\n ) => AnyFilterGroup | undefined;\n }[],\n record: TEntity | undefined,\n): (AnyFilterGroup | undefined)[] {\n return links.map(link => link.useBaseFiltering?.(record));\n}\n\nexport function makeEntityCrud<TEntity extends Entity, TAdapters>(\n entityConstructor: EntityConstructor<TEntity>,\n options: EntityCrudOptions<TAdapters, TEntity>,\n): EntityCrud<TEntity> {\n const {\n useAdapters,\n basePath,\n catalogKey,\n repository,\n hiddenFields = [],\n columns,\n toolbar,\n pageSize,\n links = [],\n metadataSource: givenMetadataSource,\n metadata,\n useCases,\n write,\n } = options;\n\n if (givenMetadataSource !== undefined && metadata !== undefined) {\n throw new Error(\n `${entityConstructor.name} was given both metadataSource and metadata; pass one`,\n );\n }\n // An adapter value, so it is resolved per render from the same `useAdapters()`\n // the records come from — the host's composition, never the caller's module.\n const metadataSourceOf = (adapters: TAdapters) =>\n metadata === undefined\n ? givenMetadataSource\n : (adapters[metadata] as EntityMetadataSource);\n\n const meta = extractMetaEntity(entityConstructor);\n if (meta.key !== catalogKey) {\n throw new Error(\n `${entityConstructor.name} declares key \"${String(meta.key)}\" but was given catalog key \"${catalogKey}\"`,\n );\n }\n // Read off `@entity()` rather than rebuilt from `catalogKey`. Both spellings\n // produce the same string today, and that is exactly the problem: a second\n // place that knows how an entity's catalog subtree is laid out is a second\n // place to fix when one moves. `MetaEntityOptions` makes them optional, so an\n // entity that never declared them fails here — where a screen is generated —\n // rather than on the render that first tries to title a tab with `undefined`.\n const { labelKey: entityLabelKey, pluralKey: entityPluralKey } = meta;\n if (entityLabelKey === undefined || entityPluralKey === undefined) {\n throw new Error(\n `${entityConstructor.name} must declare labelKey and pluralKey on @entity() to be generated`,\n );\n }\n\n // Computed once: a descriptor is a property of the class, so nothing about it\n // depends on the record being edited. `linkLabelProperty`/`linkSearchProperty`\n // are overridden here because a scalar foreign key's `@accessor()` cannot name\n // the target's members — it may not import the target at all.\n // The wire name, which is also what a pending flow's intent records and what\n // `entityQueryScopeFor` keys on — one derivation, so the two can never\n // disagree about which entity they mean.\n const entityName = envelopeEntityName(entityConstructor);\n const descriptors = describeEntityColumns(entityConstructor);\n const linkPlans = links.map(link => {\n const descriptor = descriptors.find(entry => entry.name === link.field);\n if (descriptor === undefined) {\n throw new Error(\n `${entityConstructor.name} has no member \"${link.field}\" for a link source`,\n );\n }\n return {\n ...link,\n descriptor: {\n ...descriptor,\n linkLabelProperty: link.labelProperty ?? TARGET_NAME_PROPERTY,\n linkSearchProperty: link.searchProperty ?? TARGET_NAME_PROPERTY,\n },\n };\n });\n\n function ListPage() {\n const adapters = useAdapters();\n // Every internal href carries the locale. An unprefixed one still resolves —\n // the middleware redirects it — but the visitor pays a round trip per click.\n const withLocale = useLocaleHref();\n\n const queryClient = useQueryClient();\n const scope = entityQueryScope(entityConstructor);\n const metadataSource = metadataSourceOf(adapters);\n const affordances = useEntityAffordances(entityConstructor, metadataSource);\n const renderLink = useCrudRenderLink(catalogKey);\n\n const pager = useDataLoading<TEntity, CrudContext>({\n uc: loadUCFactory<TEntity>(),\n ctx: crudContextOf(adapters, repository),\n // Scoped rather than left to the per-instance fallback, which is correct\n // but unshared: with the entity's own scope one invalidation refreshes\n // every page and filter of it, which is what a bulk run needs — and it is\n // the same prefix `useReactiveInvalidation`already targets, so a generated\n // list now also refreshes on a reactive change event.\n queryKey: scope,\n ...(pageSize === undefined ? {} : { initialPageSize: pageSize }),\n });\n\n // Only when this caller may actually run something over a selection.\n //\n // Measured live: an `admin` holds `catalog-reference:*:read` and no\n // `retire`, so the service filters the verb out of `$metadata` — but the\n // selection column still rendered, offering a set that no action could be\n // taken on. A checkbox that can lead nowhere is worse than no checkbox: it\n // reads as a permission the user does not have.\n //\n // Decided from the served document rather than from the runner, because\n // the runner is a property of the *shell* (it knows the route) and the\n // grant is a property of the *caller*. The column therefore appears when\n // the document lands, which is the asynchrony serving affordances accepts\n // for every action surface.\n const canRunBulk =\n useCasesForSurface('bulk-bar', affordances.metadata?.useCases).length > 0;\n\n const verbs = verbsOf(\n useCases === undefined\n ? undefined\n : (adapters[useCases] as EntityUseCaseRunner),\n affordances.metadata?.useCases,\n );\n\n const bulk = useEntityBulk<TEntity>({\n run:\n canRunBulk && verbs !== undefined\n ? (key, selection) =>\n verbs.bulk(key, selection as EntitySelection<Entity>)\n : undefined,\n // A bulk write changed the rows underneath the listing, so the page is\n // re-read; the selection deliberately survives it (\"the selection\n // is still there afterwards\"), because the operator's next act is usually\n // to retry the failures or run a second verb on the same rows.\n onCompleted: () => {\n void queryClient.invalidateQueries({ queryKey: scope });\n },\n });\n\n // What a row's overflow menu runs, and the one place the list reports a\n // verb that failed.\n //\n // ⚠️ **A row verb and the form's are the same runner with different\n // arguments.** `EntityTable` hands back the whole record, because that is\n // what it has; the runner takes an id, because that is what a route needs.\n // The list has no error slot of its own, so a failure lands in the\n // table's own error region — the same one a failed page read uses.\n const rowVerb = useVerb(verbs, () => {\n void queryClient.invalidateQueries({ queryKey: scope });\n });\n // Called unconditionally and the *result* gated, the way the surfaces are\n // read in `EntityForm`: the name begins with `use`, so short-circuiting it\n // reads to `react-hooks/rules-of-hooks` as a conditional hook.\n const rowUseCases = useCasesForSurface(\n 'row-menu',\n affordances.metadata?.useCases,\n );\n const canRunRowUseCase = verbs !== undefined && rowUseCases.length > 0;\n\n const handleRowUseCase = canRunRowUseCase\n ? (key: string, item: TEntity) => {\n if (item.id == null) return;\n rowVerb.run(key, item.id);\n }\n : undefined;\n\n return (\n <div className=\"flex flex-col gap-s\">\n <EntityTable\n entityConstructor={entityConstructor}\n {...pager}\n items={pager.items}\n totalItems={pager.totalItems}\n hrefFor={id => withLocale(`${basePath}/${String(id)}`)}\n newHref={withLocale(`${basePath}/${CATALOG_NEW_SLUG}`)}\n renderLink={renderLink}\n {...affordances}\n {...bulk.tableProps}\n onUseCase={handleRowUseCase}\n error={syncFailure(rowVerb.verb) ?? pager.error}\n >\n {columns}\n {toolbar}\n </EntityTable>\n </div>\n );\n }\n\n /**\n * Dual-host: as a route it reads its slug from the URL and returns to the list\n * on save; in a workspace tab it takes the slug and the post-save action as\n * props.\n */\n function SingleViewPage({\n slug,\n onSaved,\n onDeleted,\n draft,\n }: EntityCrudSingleViewProps = {}) {\n const adapters = useAdapters();\n const metadataSource = metadataSourceOf(adapters);\n // The same served document the form reads its buttons from, so a key the\n // form hands back always names a verb in it.\n const affordances = useEntityAffordances(entityConstructor, metadataSource);\n const router = useRouter();\n const withLocale = useLocaleHref();\n const params = useParams<{ slug: string }>();\n const mounted = useMounted();\n const id = slugToEntityId(slug ?? params.slug);\n\n const ctx = crudContextOf(adapters, repository);\n\n const {\n entity,\n isLoading,\n error: loadError,\n reload,\n } = useEntityRecord<TEntity, CrudContext>({\n uc: getUCFactory<TEntity>(),\n ctx,\n id,\n });\n\n // Against the record as loaded, not the draft: the rule is about which\n // record this is, not what the operator has typed into it.\n const linkFilters = useLinkFilters(linkPlans, entity);\n\n // Rebuilt inline on every render on purpose: `useEntityLinkSource` holds\n // these in a ref and keeps them out of its query keys, precisely so a caller\n // does not have to memoise them.\n const linkSources: EntityCrudLinkSource[] = linkPlans.map(\n (plan, index) => ({\n field: plan.field,\n descriptor: plan.descriptor,\n config: {\n entityConstructor: plan.entityConstructor,\n loadUc: loadUCFactory(),\n getUc: getUCFactory(),\n ctx: crudContextOf(adapters, plan.repository),\n // The config's target is erased to `Entity`, and the host's filter to\n // `any`; the two meet here, where neither type is the real target's.\n baseFiltering: linkFilters[index] as FilterGroup<Entity> | undefined,\n },\n }),\n );\n\n // Inside a workspace tab, \"back to the list\" is the list's tab, not a URL\n // that would leave the workspace. A host's own callbacks still win.\n const host = useEntityNavHost();\n const renderLink = useCrudRenderLink(catalogKey);\n const queryClient = useQueryClient();\n // The list this page returns to has its page cached, and it is no longer\n // true. Invalidated rather than patched: the service is the authority on\n // the row it stored.\n //\n // ⚠️ Invisible while every Open was a document load, which threw the cache\n // away anyway (#20): the first client-side navigation back to the list\n // showed the record as it was before the save.\n const refreshList = () =>\n queryClient.invalidateQueries({\n queryKey: entityQueryScope(entityConstructor),\n });\n const toList = () =>\n host === undefined\n ? router.push(withLocale(basePath))\n : host.toList(catalogKey);\n const afterSave = onSaved ?? toList;\n const afterDelete = onDeleted ?? toList;\n\n // Through the host's writer when it named one, which answers both settle\n // modes; otherwise through the repository, where every write settles.\n const writer =\n write === undefined ? undefined : (adapters[write] as EntityWriter);\n\n // The draft is spent once the write *commits*, and only here is that known:\n // `useEntityForm` neither fetches nor saves, so it cannot clear its own.\n // A failed write — or a failed flow — deliberately keeps the draft and the\n // form: the edit is still the user's only copy of what they typed.\n //\n // ⚠️ A flow can complete after the operator left this page, so leaving it\n // is guarded on still being here: a navigation from a form nobody is\n // looking at would pull them away from wherever they went.\n const saveMutation = useOptimisticMutation<TEntity, TEntity>({\n write: next =>\n writer === undefined\n ? Effect.map(\n Effect.provide(\n saveUCFactory<TEntity>(),\n ctx.pipe(Context.add(EntityTag, next)),\n ),\n settled,\n )\n : writer.save(next),\n intent: () => ({ entity: entityName, write: 'save' }),\n confirm: () => {\n draft?.clear();\n void refreshList();\n if (mounted.current) afterSave();\n },\n });\n const deleteMutation = useOptimisticMutation<EntityId, void>({\n write: target =>\n writer === undefined\n ? Effect.as(\n Effect.provide(\n deleteUCFactory<TEntity>(),\n ctx.pipe(Context.add(EntityIdTag, target)),\n ),\n settled(undefined),\n )\n : writer.delete(target),\n intent: () => ({ entity: entityName, write: 'delete' }),\n confirm: () => {\n draft?.clear();\n void refreshList();\n if (mounted.current) afterDelete();\n },\n });\n\n const handleSave = async (next: TEntity) => {\n const result = await saveMutation.mutate(next).catch(() => undefined);\n // Failed, or pending: the form stays, and the mutation says which. A\n // pending write leaves through the mutation's `confirm`, once its flow\n // completed.\n if (result?._tag !== 'settled') return;\n draft?.clear();\n void refreshList();\n afterSave();\n };\n\n const handleDelete = async () => {\n const result = await deleteMutation.mutate(id).catch(() => undefined);\n if (result?._tag !== 'settled') return;\n draft?.clear();\n void refreshList();\n afterDelete();\n };\n\n /**\n * An `entity`-bound verb, on the record being shown.\n *\n * It **reloads** — once the verb took effect, which for one the server\n * handed to a flow is when the flow completed — rather than patching what it has: the service decides the\n * resulting state — a `publish` may land on `published` from four different\n * places — and a client that assumed the new value would show the wrong one\n * the first time the rule changed. `id == null` means the create form,\n * where there is no record to act on and the form renders no verbs anyway.\n *\n * ⚠️ The rejection is **caught and shown**, never left to the promise.\n * `EntityForm`'s `onUseCase` returns `void`, so an uncaught rejection here\n * reaches the console and nothing else — measured on an offering refusing\n * `unpublish` from `draft`: the service answered `409` with a coded body,\n * the record correctly did not move, and the operator saw a button that\n * appeared to do nothing at all.\n */\n const verbs = verbsOf(\n useCases === undefined\n ? undefined\n : (adapters[useCases] as EntityUseCaseRunner),\n affordances.metadata?.useCases,\n );\n const recordVerb = useVerb(verbs, () => void reload());\n const handleUseCase =\n verbs === undefined || id == null\n ? undefined\n : (key: string) => recordVerb.run(key, id);\n\n return (\n <EntityCrudForm<TEntity>\n // Remounts (and reseeds the fields) once the record arrives.\n key={String(entity?.id ?? CATALOG_NEW_SLUG)}\n entityConstructor={entityConstructor}\n catalogKey={catalogKey}\n metadataSource={metadataSource}\n hiddenFields={hiddenFields}\n links={linkSources}\n entity={entity}\n isLoading={isLoading}\n isSaving={saveMutation.status === 'running'}\n isPending={[saveMutation, deleteMutation, recordVerb.verb].some(\n mutation => mutation.status === 'pending',\n )}\n isDeleting={deleteMutation.status === 'running'}\n error={\n loadError ??\n syncFailure(saveMutation) ??\n syncFailure(deleteMutation) ??\n syncFailure(recordVerb.verb)\n }\n onSave={handleSave}\n onDelete={id == null ? undefined : handleDelete}\n onUseCase={handleUseCase}\n backHref={withLocale(basePath)}\n renderLink={renderLink}\n draft={draft}\n />\n );\n }\n\n return {\n entityConstructor,\n entityKey: catalogKey,\n entityLabelKey,\n entityPluralKey,\n basePath,\n ListPage,\n SingleViewPage,\n };\n}\n"],"names":["deleteUCFactory","EntityIdTag","EntityTag","getUCFactory","loadUCFactory","saveUCFactory","describeEntityColumns","envelopeEntityName","extractMetaEntity","Internal","isFailure","settled","EntityTable","useCasesForSurface","entityQueryScope","useDataLoading","useEntityRecord","useOptimisticMutation","useQueryClient","Cause","Context","Effect","Exit","useParams","useRouter","useEffect","useRef","useLocaleHref","useEntityNavHost","EntityCrudForm","CATALOG_NEW_SLUG","slugToEntityId","useCrudRenderLink","useEntityAffordances","useEntityBulk","TARGET_NAME_PROPERTY","crudContextOf","adapters","repository","asFailure","failure","syncFailure","mutation","status","flowId","undefined","verbsOf","runner","served","descriptor","key","find","candidate","run","id","bulk","selection","runPromiseExit","then","exit","isSuccess","value","Promise","reject","squash","cause","useVerb","verbs","done","verb","write","confirm","mutate","result","_tag","useMounted","mounted","current","useLinkFilters","links","record","map","link","useBaseFiltering","makeEntityCrud","entityConstructor","options","useAdapters","basePath","catalogKey","hiddenFields","columns","toolbar","pageSize","metadataSource","givenMetadataSource","metadata","useCases","Error","name","metadataSourceOf","meta","String","labelKey","entityLabelKey","pluralKey","entityPluralKey","entityName","descriptors","linkPlans","entry","field","linkLabelProperty","labelProperty","linkSearchProperty","searchProperty","ListPage","affordances","withLocale","queryClient","scope","renderLink","pager","uc","ctx","queryKey","initialPageSize","canRunBulk","length","onCompleted","invalidateQueries","rowVerb","rowUseCases","canRunRowUseCase","handleRowUseCase","item","div","className","items","totalItems","hrefFor","newHref","tableProps","onUseCase","error","SingleViewPage","slug","onSaved","onDeleted","draft","loadError","router","params","entity","isLoading","reload","linkFilters","linkSources","plan","index","config","loadUc","getUc","baseFiltering","host","refreshList","toList","push","afterSave","afterDelete","writer","saveMutation","next","provide","pipe","add","save","intent","clear","deleteMutation","target","as","delete","handleSave","catch","handleDelete","recordVerb","handleUseCase","isSaving","isPending","some","isDele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dX,OAAO8E;YACPJ,QAAQA;YACRC,WAAWA;YACXkC,UAAUjB,aAAahI,MAAM,KAAK;YAClCkJ,WAAW;gBAAClB;gBAAcQ;gBAAgBO,WAAWrH,IAAI;aAAC,CAACyH,IAAI,CAC7DpJ,CAAAA,WAAYA,SAASC,MAAM,KAAK;YAElCoJ,YAAYZ,eAAexI,MAAM,KAAK;YACtCqG,KAAK,GACHM,QAAAA,QAAAA,oBAAAA,YACA7G,YAAYkI,yBADZrB,QAEA7G,YAAY0I,2BAFZ7B,OAGA7G,YAAYiJ,WAAWrH,IAAI;YAE7B2H,QAAQT;YACRU,UAAU3I,MAAM,OAAOT,YAAY4I;YACnC1C,WAAW4C;YACXO,UAAU5E,WAAW9B;YACrBiC,YAAYA;YACZ4B,OAAOA;WAxBF/C,gBAAOmD,0BAAAA,OAAQnG,EAAE,oBAAIxB;IA2BhC;IAEA,OAAO;QACLuD;QACA8G,WAAW1G;QACXe;QACAE;QACAlB;QACA4B;QACA6B;IACF;AACF"}
@@ -3,8 +3,6 @@ export * from './entity-nav.js';
3
3
  export * from './entity-tab-kind.js';
4
4
  export * from './idb-state-storage.js';
5
5
  export * from './pending-flows.js';
6
- export * from './pending-state.js';
7
- export * from './pending-transactions.js';
8
6
  export * from './tab-kind.js';
9
7
  export * from './tab-state.js';
10
8
  export * from './tabs-state.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/workspace/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/workspace/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC"}
@@ -3,8 +3,6 @@ export * from './entity-nav.js';
3
3
  export * from './entity-tab-kind.js';
4
4
  export * from './idb-state-storage.js';
5
5
  export * from './pending-flows.js';
6
- export * from './pending-state.js';
7
- export * from './pending-transactions.js';
8
6
  export * from './tab-kind.js';
9
7
  export * from './tab-state.js';
10
8
  export * from './tabs-state.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/workspace/index.ts"],"sourcesContent":["export * from './drafts-state.js';\nexport * from './entity-nav.js';\nexport * from './entity-tab-kind.js';\nexport * from './idb-state-storage.js';\nexport * from './pending-flows.js';\nexport * from './pending-state.js';\nexport * from './pending-transactions.js';\nexport * from './tab-kind.js';\nexport * from './tab-state.js';\nexport * from './tabs-state.js';\nexport * from './use-entity-draft.js';\nexport * from './workspace-scope.js';\nexport * from './workspace-shell.js';\n"],"names":[],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,4BAA4B;AAC1C,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,uBAAuB"}
1
+ {"version":3,"sources":["../../../src/lib/workspace/index.ts"],"sourcesContent":["export * from './drafts-state.js';\nexport * from './entity-nav.js';\nexport * from './entity-tab-kind.js';\nexport * from './idb-state-storage.js';\nexport * from './pending-flows.js';\nexport * from './tab-kind.js';\nexport * from './tab-state.js';\nexport * from './tabs-state.js';\nexport * from './use-entity-draft.js';\nexport * from './workspace-scope.js';\nexport * from './workspace-shell.js';\n"],"names":[],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,kBAAkB;AAChC,cAAc,uBAAuB;AACrC,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,iBAAiB;AAC/B,cAAc,kBAAkB;AAChC,cAAc,wBAAwB;AACtC,cAAc,uBAAuB;AACrC,cAAc,uBAAuB"}