nexus-shared 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +704 -446
- package/LICENSE +21 -21
- package/README.md +44 -5
- package/dist/Client.Index.d.ts +3 -0
- package/dist/Client.Index.js +3 -0
- package/dist/Components/Forms/Crud.js +322 -161
- package/dist/Components/Forms/CrudHistory.d.ts +66 -0
- package/dist/Components/Forms/CrudHistory.js +140 -0
- package/dist/Components/Forms/CrudParts.js +2 -1
- package/dist/Components/Forms/Form.js +4 -1
- package/dist/Components/Inputs/CodeBox.d.ts +69 -0
- package/dist/Components/Inputs/CodeBox.js +316 -0
- package/dist/Components/Inputs/DatePicker.js +4 -1
- package/dist/Components/Inputs/DateRangePicker.js +4 -1
- package/dist/Components/Inputs/DateTimePicker.js +4 -1
- package/dist/Components/Inputs/Dropdown.js +4 -1
- package/dist/Components/Inputs/InputRenderer.js +3 -0
- package/dist/Components/Inputs/NumberBox.js +4 -2
- package/dist/Components/Inputs/TextArea.js +4 -1
- package/dist/Components/Inputs/TextBox.js +4 -1
- package/dist/Components/Inputs/TimePicker.js +4 -1
- package/dist/Components/Inputs/TreeView.d.ts +55 -5
- package/dist/Components/Inputs/TreeView.js +372 -23
- package/dist/Components/Layouts/ThemePicker.d.ts +3 -2
- package/dist/Components/Layouts/ThemePicker.js +16 -4
- package/dist/Components/Viewers/DataTable.js +63 -21
- package/dist/Components/Viewers/DataTableParts.d.ts +26 -8
- package/dist/Components/Viewers/DataTableParts.js +39 -10
- package/dist/Helpers/ApiModules.d.ts +3 -34
- package/dist/Helpers/ApiModules.js +3 -3
- package/dist/Helpers/ApiRoutes.d.ts +68 -26
- package/dist/Helpers/ApiRoutes.js +31 -27
- package/dist/Helpers/ArrayHelpers.d.ts +0 -0
- package/dist/Helpers/ArrayHelpers.js +2 -0
- package/dist/Helpers/CodeHelpers.d.ts +97 -0
- package/dist/Helpers/CodeHelpers.js +332 -0
- package/dist/Helpers/CrudBackend.d.ts +94 -4
- package/dist/Helpers/CrudBackend.js +168 -9
- package/dist/Helpers/CrudColumns.d.ts +51 -0
- package/dist/Helpers/CrudColumns.js +69 -0
- package/dist/Helpers/CrudHelpers.d.ts +50 -5
- package/dist/Helpers/CrudHelpers.js +109 -12
- package/dist/Helpers/InputParamsHelpers.js +8 -0
- package/dist/Helpers/MessageBuilder.js +2 -0
- package/dist/Helpers/NexusHelpers.d.ts +0 -0
- package/dist/Helpers/NexusHelpers.js +1 -0
- package/dist/Helpers/RequestCache.d.ts +35 -0
- package/dist/Helpers/RequestCache.js +113 -0
- package/dist/Helpers/TableExport.js +12 -12
- package/dist/Helpers/TableHelpers.d.ts +1 -1
- package/dist/Helpers/TableHelpers.js +7 -2
- package/dist/Helpers/TableJoins.d.ts +70 -0
- package/dist/Helpers/TableJoins.js +250 -0
- package/dist/Helpers/TableStore.d.ts +5 -0
- package/dist/Helpers/TableStore.js +9 -0
- package/dist/Helpers/TreeStore.d.ts +225 -11
- package/dist/Helpers/TreeStore.js +683 -90
- package/dist/Helpers/UserPreferences.d.ts +8 -0
- package/dist/Helpers/UserPreferences.js +17 -0
- package/dist/Interfaces/CrudInterfaces.d.ts +47 -9
- package/dist/Interfaces/FormInterfaces.d.ts +4 -1
- package/dist/Interfaces/InputInterfaces.d.ts +24 -0
- package/dist/Interfaces/MessageInterfaces.d.ts +1 -1
- package/dist/Interfaces/PreferenceInterfaces.d.ts +8 -0
- package/dist/Interfaces/PreferenceInterfaces.js +2 -5
- package/dist/Interfaces/TableInterfaces.d.ts +86 -4
- package/dist/Services/ApiProxy.d.ts +36 -1
- package/dist/Services/ApiProxy.js +182 -52
- package/dist/Services/ApiProxyRules.d.ts +203 -0
- package/dist/Services/ApiProxyRules.js +426 -0
- package/dist/Services/JoinSources.d.ts +48 -0
- package/dist/Services/JoinSources.js +74 -0
- package/dist/Services/ServerApi.d.ts +13 -2
- package/dist/Services/ServerApi.js +8 -3
- package/dist/Shared.Index.d.ts +4 -0
- package/dist/Shared.Index.js +4 -0
- package/package.json +87 -85
- package/src/Styles/Nexus.Avatar.css +79 -79
- package/src/Styles/Nexus.Base.css +117 -117
- package/src/Styles/Nexus.Button.css +180 -180
- package/src/Styles/Nexus.Calendar.css +273 -273
- package/src/Styles/Nexus.Chat.css +1443 -1443
- package/src/Styles/Nexus.Choice.css +343 -343
- package/src/Styles/Nexus.Crud.css +168 -168
- package/src/Styles/Nexus.DateTime.css +81 -81
- package/src/Styles/Nexus.Dropdown.css +725 -725
- package/src/Styles/Nexus.Editor.css +295 -295
- package/src/Styles/Nexus.Excel.css +389 -389
- package/src/Styles/Nexus.Form.css +279 -279
- package/src/Styles/Nexus.Index.css +37 -37
- package/src/Styles/Nexus.Input.css +196 -4
- package/src/Styles/Nexus.Markdown.css +237 -237
- package/src/Styles/Nexus.Menu.css +237 -237
- package/src/Styles/Nexus.Popup.css +724 -724
- package/src/Styles/Nexus.Rows.css +637 -637
- package/src/Styles/Nexus.Slider.css +276 -276
- package/src/Styles/Nexus.Tab.Buttons.css +432 -432
- package/src/Styles/Nexus.Table.css +31 -30
- package/src/Styles/Nexus.Theme.Picker.css +59 -3
- package/src/Styles/Nexus.Themes.css +194 -194
- package/src/Styles/Nexus.Time.css +144 -144
- package/src/Styles/Nexus.Toast.css +263 -263
- package/src/Styles/Nexus.Tokens.css +89 -89
- package/src/Styles/Nexus.Tree.css +500 -431
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Bijay Adhikari
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bijay Adhikari
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -834,10 +834,47 @@ export const { GET, HEAD, POST, PUT, PATCH, DELETE } = createApiProxy({ token: r
|
|
|
834
834
|
and CRUD then takes only those modules (`AppModule`), so `{ module: NexusModule.Reservation, … }` in an HR app is a
|
|
835
835
|
type error. Without it, the modules are `NexusModule`.
|
|
836
836
|
- **The proxy, on or off.** With `useProxy` (the default), the browser calls `/api/app/<module>/<path>` and the proxy
|
|
837
|
-
route sends it on to the module's root with the user's token, which never reaches the browser
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
837
|
+
route sends it on to the module's root with the user's token, which never reaches the browser. Off, the browser
|
|
838
|
+
calls each module's `browserRoot` (public) and the proxy serves none. `proxies(module)` mixes the two, such as
|
|
839
|
+
uploads straight to the Drive module and the rest through the proxy.
|
|
840
|
+
- **The proxy hides the backend.** To the browser the app is the backend, and nothing in an answer names the real one:
|
|
841
|
+
- **No redirect reaches the browser.** One that stays inside the module (the root's origin, or its host moved to
|
|
842
|
+
https by the backend's HTTPS redirection, under the root's path in any casing) is followed on the server as
|
|
843
|
+
`fetch` follows it: 307 and 308 keep the method and body, a 303 and a POST's 301 or 302 become a GET, up to
|
|
844
|
+
`maxRedirects` (3). Any other answers 502 `BACKEND_REDIRECT_REFUSED`: following it would carry the token elsewhere.
|
|
845
|
+
- **Response headers by an allowlist**, `DEFAULT_PROXY_RESPONSE_HEADERS` (Content-Type, Content-Disposition,
|
|
846
|
+
Content-Language, Content-Range, Accept-Ranges, Cache-Control, Expires, ETag, Last-Modified, Vary, Retry-After),
|
|
847
|
+
the Nexus backend's `X-Nexus-*`, and the names in `responseHeaders`. Server, X-Powered-By, X-AspNet-*,
|
|
848
|
+
X-SourceFiles, Via, Alt-Svc, Strict-Transport-Security, Report-To, NEL, CORS, Location, Link and WWW-Authenticate
|
|
849
|
+
never pass, even named; Set-Cookie only with `passCookies`. Every answer gets `X-Content-Type-Options: nosniff`,
|
|
850
|
+
and `Cache-Control: private, no-store` unless the backend said how to cache it.
|
|
851
|
+
- **Error pages replaced.** An error answer that is not JSON (an HTML or text page, a stack trace), JSON that is a
|
|
852
|
+
stack trace or repeats the user's token, or one over 1 MB, becomes the failure envelope with the backend's status
|
|
853
|
+
and plain words (`BACKEND_ERROR_PAGE`). JSON refusals (the Nexus envelope, problem details) and empty ones pass as
|
|
854
|
+
they came, so the backend's own words still reach the form.
|
|
855
|
+
- **The request.** The browser's own `X-Forwarded-*`, `Forwarded`, `X-Real-IP` and the like never go on, nor its
|
|
856
|
+
cookies, a method or path override (`X-HTTP-Method-Override`, `X-Original-URL`) or Next.js's own headers. The
|
|
857
|
+
proxy writes X-Forwarded-For (the last address the app received, which Next.js or the app's reverse proxy wrote;
|
|
858
|
+
`clientAddress` reads it elsewhere; an IPv4 or IPv6 address or nothing, never other text) and X-Forwarded-Host
|
|
859
|
+
and -Proto (the app's configured origin, else the request's). A module whose root is a path on the app (a pretend
|
|
860
|
+
backend) is called at this server's own host and port, over http: the request URL's, which Next.js builds from
|
|
861
|
+
where it listens. Never at the configured origin, so an app whose `origin` reads the Host header cannot let a client
|
|
862
|
+
choose another port on the machine; `serverApi`, which has no request, uses that `origin`, so build it from
|
|
863
|
+
configuration, or take the Host only when it names this server's own port. A body over `maxBodySize` (100 MB) is
|
|
864
|
+
refused with 413 before the backend sees it, and a page of another site cannot call through the proxy
|
|
865
|
+
(`Sec-Fetch-Site: cross-site`, other than a link followed) unless `allowCrossSite`.
|
|
866
|
+
- **A server call can say who the client is too.** `lastForwardedAddress` and `readIpAddress` (`nexus-shared/server`)
|
|
867
|
+
read the client's address as the proxy does, from anything with a `get` (Next.js's `headers()` included). The
|
|
868
|
+
template's `api-setup.ts` gives Identity calls, and only them, `X-Forwarded-For` and the browser's `User-Agent`
|
|
869
|
+
through `configureServerApi({ headers })`: sign-in leaves from the server, and Identity's rate limit counts per
|
|
870
|
+
address. Only Identity's, because reading the request makes a page render per request.
|
|
871
|
+
- **Refusals** are the Nexus envelope, `{ isSuccess: false, code, message, messageCode, errorCode, errorMessages }`
|
|
872
|
+
(`failure` builds another backend's; `PROXY_REFUSALS` lists the codes), and the real cause goes to the server's
|
|
873
|
+
log (`onProblem`, default `console.error`), never with the token or a query string.
|
|
874
|
+
- **Two things the proxy cannot do for an app.** Node.js does not trust a development certificate (ASP.NET Core's)
|
|
875
|
+
unless it starts with `NODE_USE_SYSTEM_CA=1`, so a module whose http root redirects to such an https port answers
|
|
876
|
+
502 until then, and the log says so. And Next.js keeps an X-Forwarded-For a client sent when nothing stands in
|
|
877
|
+
front of the app, so only behind a reverse proxy of its own is the client's address certain.
|
|
841
878
|
- **One engine, two clients.** `api` and `serverApi` are two settings of `createApiClient`: it fills `{id}` in the path
|
|
842
879
|
from `params` or the body, adds the query, headers, and token, waits up to `timeout` (60 s), tries a failed GET once
|
|
843
880
|
more (a save never twice), and reads every answer as an `ApiResult` (`ok`, `status`, `result`, `message`,
|
|
@@ -881,7 +918,9 @@ export const { GET, HEAD, POST, PUT, PATCH, DELETE } = createApiProxy({ token: r
|
|
|
881
918
|
active records' (`NormalListing`, `NormalPagination`), and `lists.flag`, `lists.trash`, `pages.trash`, … the others
|
|
882
919
|
(`FlagListing`, `TrashListing`, `TrashPagination`, …), for the CRUD component.
|
|
883
920
|
- `npm run test:api` checks the builder, routes, modules (another app's enum, the proxy on and off), the engine, the
|
|
884
|
-
server client, and the proxy; `
|
|
921
|
+
server client, and the proxy's routing; `npm run test:proxy` checks how the proxy hides the backend (redirects,
|
|
922
|
+
headers, error pages, forwarded headers, paths, the body limit, other sites, the log) against a fake backend;
|
|
923
|
+
`scripts/browser-checks/api-calls.cjs` in the template checks `/demo/api`.
|
|
885
924
|
|
|
886
925
|
### Data table
|
|
887
926
|
|
package/dist/Client.Index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./Components/Documents/SplitButton.tsx";
|
|
|
10
10
|
export * from "./Components/Documents/TabButtons.tsx";
|
|
11
11
|
export * from "./Components/Forms/ApiForm.tsx";
|
|
12
12
|
export * from "./Components/Forms/Crud.tsx";
|
|
13
|
+
export * from "./Components/Forms/CrudHistory.tsx";
|
|
13
14
|
export * from "./Components/Forms/CrudParts.tsx";
|
|
14
15
|
export * from "./Components/Forms/ExcelImport.tsx";
|
|
15
16
|
export * from "./Components/Forms/Form.tsx";
|
|
@@ -17,6 +18,7 @@ export * from "./Components/Forms/SubmitForm.tsx";
|
|
|
17
18
|
export * from "./Components/Inputs/Calendar.tsx";
|
|
18
19
|
export * from "./Components/Inputs/CheckBox.tsx";
|
|
19
20
|
export * from "./Components/Inputs/CheckBoxGroup.tsx";
|
|
21
|
+
export * from "./Components/Inputs/CodeBox.tsx";
|
|
20
22
|
export * from "./Components/Inputs/DatePicker.tsx";
|
|
21
23
|
export * from "./Components/Inputs/DateRangePicker.tsx";
|
|
22
24
|
export * from "./Components/Inputs/DateTimePicker.tsx";
|
|
@@ -55,4 +57,5 @@ export * from "./Helpers/UserPreferences.ts";
|
|
|
55
57
|
export * from "./Services/BrowserApi.ts";
|
|
56
58
|
export * from "./Services/ChatApi.ts";
|
|
57
59
|
export * from "./Services/ExcelApi.ts";
|
|
60
|
+
export * from "./Services/JoinSources.ts";
|
|
58
61
|
export * from "./Services/ThemeService.ts";
|
package/dist/Client.Index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./Components/Documents/SplitButton.js";
|
|
|
13
13
|
export * from "./Components/Documents/TabButtons.js";
|
|
14
14
|
export * from "./Components/Forms/ApiForm.js";
|
|
15
15
|
export * from "./Components/Forms/Crud.js";
|
|
16
|
+
export * from "./Components/Forms/CrudHistory.js";
|
|
16
17
|
export * from "./Components/Forms/CrudParts.js";
|
|
17
18
|
export * from "./Components/Forms/ExcelImport.js";
|
|
18
19
|
export * from "./Components/Forms/Form.js";
|
|
@@ -20,6 +21,7 @@ export * from "./Components/Forms/SubmitForm.js";
|
|
|
20
21
|
export * from "./Components/Inputs/Calendar.js";
|
|
21
22
|
export * from "./Components/Inputs/CheckBox.js";
|
|
22
23
|
export * from "./Components/Inputs/CheckBoxGroup.js";
|
|
24
|
+
export * from "./Components/Inputs/CodeBox.js";
|
|
23
25
|
export * from "./Components/Inputs/DatePicker.js";
|
|
24
26
|
export * from "./Components/Inputs/DateRangePicker.js";
|
|
25
27
|
export * from "./Components/Inputs/DateTimePicker.js";
|
|
@@ -60,4 +62,5 @@ export * from "./Helpers/UserPreferences.js";
|
|
|
60
62
|
export * from "./Services/BrowserApi.js";
|
|
61
63
|
export * from "./Services/ChatApi.js";
|
|
62
64
|
export * from "./Services/ExcelApi.js";
|
|
65
|
+
export * from "./Services/JoinSources.js";
|
|
63
66
|
export * from "./Services/ThemeService.js";
|