@stopnetic/js 0.0.3-pilot → 0.0.5-pilot
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -18
- package/dist/client-guide.md +696 -30
- package/dist/setup.js +9 -4
- package/examples/frontend/angular/app/app.config.ts +8 -0
- package/examples/frontend/angular/app/app.routes.ts +20 -0
- package/examples/frontend/angular/app/app.ts +21 -0
- package/examples/frontend/angular/app/members.page.ts +21 -0
- package/examples/frontend/angular/app/stopnetic-access.service.ts +27 -0
- package/examples/frontend/angular/main.ts +4 -0
- package/examples/frontend/load-private-data.d.ts +1 -0
- package/examples/frontend/load-private-data.js +9 -0
- package/examples/frontend/react/App.tsx +48 -0
- package/examples/frontend/react/main.tsx +3 -0
- package/examples/frontend/solid/App.tsx +54 -0
- package/examples/frontend/solid/main.tsx +3 -0
- package/examples/frontend/svelte/App.svelte +56 -0
- package/examples/frontend/svelte/main.js +4 -0
- package/examples/frontend/vanilla/main.js +46 -0
- package/examples/frontend/vue/App.vue +17 -0
- package/examples/frontend/vue/Members.vue +14 -0
- package/examples/frontend/vue/main.js +4 -0
- package/examples/frontend/vue/router.js +40 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -6,15 +6,20 @@ frontend build. No React/Vue/Angular dependency or version upgrade is required.
|
|
|
6
6
|
The hosting server must run Node.js 22 or newer. This is an MIT-licensed pilot SDK;
|
|
7
7
|
hosted production/provider validation is still required before paid rollout.
|
|
8
8
|
|
|
9
|
-
Version **0.0.
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Version **0.0.5-pilot is prepared locally; it is not published yet**. The guide
|
|
10
|
+
offers two explicit rendering paths: preserve SSR or retain a static/CSR app.
|
|
11
|
+
Server document navigation is the default; leave startup/layout unchanged with
|
|
12
|
+
no global checking screen. Optional SPA demos for all six frontends explain
|
|
13
|
+
their asynchronous checks and use empty pending content. Unchanged
|
|
14
|
+
0.0.2/0.0.3/0.0.4 guides migrate safely; custom edits require merging.
|
|
12
15
|
Angular, React, Vue, Svelte, Solid and plain JavaScript share the browser/server
|
|
13
16
|
contracts; no React dependency is required. See the
|
|
14
|
-
[complete generated guide](
|
|
17
|
+
[complete generated guide](dist/client-guide.md) for SSR, static builds, frameworks,
|
|
15
18
|
client navigation, API protection and runtime restrictions.
|
|
16
19
|
|
|
17
|
-
The currently published **0.0.
|
|
20
|
+
The currently published **0.0.4-pilot** includes full frontend examples and the
|
|
21
|
+
framework-independent server/browser setup, complete Node application wrapper
|
|
22
|
+
and older-guide migration. Version 0.0.2 added the reusable browser/server setup for Netlify, Vercel
|
|
18
23
|
and Node/Express, a browser access check and optional React boundary. It also
|
|
19
24
|
normalizes public PEM formatting and rejects placeholder or reused installation
|
|
20
25
|
keys as cookie secrets. Install the published pilot with:
|
|
@@ -23,6 +28,41 @@ keys as cookie secrets. Install the published pilot with:
|
|
|
23
28
|
npm install @stopnetic/js@pilot
|
|
24
29
|
```
|
|
25
30
|
|
|
31
|
+
## Framework implementation examples
|
|
32
|
+
|
|
33
|
+
The guide and `examples/frontend` contain complete, locally tested OPTIONAL
|
|
34
|
+
browser-only SPA examples. The default document-navigation integration needs
|
|
35
|
+
the server guard and normal links, not these full-layout browser gates. Keep SSR
|
|
36
|
+
and hydration; do not apply the browser demos to an existing SSR root. A runtime
|
|
37
|
+
incompatibility needs a deployment decision, not an automatic conversion to CSR.
|
|
38
|
+
Dashboard policies decide which paths require verification; demo paths are not
|
|
39
|
+
instructions to protect every page. SPA checks still evaluate public targets
|
|
40
|
+
asynchronously and can show a brief empty pending state. The examples are:
|
|
41
|
+
|
|
42
|
+
| Frontend | Example |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| React | BrowserRouter, full-layout StopneticBoundary, Routes and effect-based API loading |
|
|
45
|
+
| Angular | Route guard/service, layout signals, RouterOutlet and HttpClient |
|
|
46
|
+
| Vue | Vue Router beforeEach/afterEach, gated App.vue and API loading |
|
|
47
|
+
| Svelte | onMount, History API/popstate navigation and abort cleanup |
|
|
48
|
+
| Solid | Router root, useLocation, reactive Show boundary and API loading |
|
|
49
|
+
| Plain JavaScript | DOM rendering, checked navigation and API loading |
|
|
50
|
+
|
|
51
|
+
Each example includes initial access, later navigation, verification redirect,
|
|
52
|
+
empty pending content, denied UI and cancellation. Backend page/API guards remain necessary.
|
|
53
|
+
No framework library is added as a required SDK dependency. The generated guide
|
|
54
|
+
embeds the source; use its file paths and helper instructions when copying it.
|
|
55
|
+
The dashboard's frontend selector shows the same files. For maintenance, run
|
|
56
|
+
`npm run build` in this SDK, then `npm run sync:guides` in dashboard.
|
|
57
|
+
|
|
58
|
+
To rerun the frontend compilation/browser fixtures, build the SDK and run
|
|
59
|
+
`node tests/prepare-framework-tests.mjs` in this directory. This packs the SDK
|
|
60
|
+
and installs pinned test-only libraries inside ignored test-results. Then run
|
|
61
|
+
`.venv/Scripts/python.exe integrations/javascript/tests/framework-browser-check.py`
|
|
62
|
+
from the repository root. The Angular fixture uses an existing Angular install:
|
|
63
|
+
`angular-guide-check.py <project-path>`; it copies source into the workspace,
|
|
64
|
+
compiles the examples and tests browser/Node SSR without changing that project.
|
|
65
|
+
|
|
26
66
|
For local testing, build and pack from this repository:
|
|
27
67
|
|
|
28
68
|
```sh
|
|
@@ -31,7 +71,7 @@ npm run build
|
|
|
31
71
|
npm pack
|
|
32
72
|
```
|
|
33
73
|
|
|
34
|
-
Install the resulting `stopnetic-js-0.0.
|
|
74
|
+
Install the resulting `stopnetic-js-0.0.5-pilot.tgz` into the website project using
|
|
35
75
|
`npm install <absolute-path-to-tarball>`. The installed package has no Next.js or
|
|
36
76
|
other runtime dependency. The build packages the same signed decision implementation
|
|
37
77
|
as the Next.js adapter. Keep `@stopnetic/next` for its Next.js 16 guided installer.
|
|
@@ -67,7 +107,8 @@ preserved. Vercel configuration is preserved. Put runtime settings in the hostin
|
|
|
67
107
|
provider's server/Functions environment; plain `netlify.toml` build env is not a
|
|
68
108
|
Functions secret store. Copy the generated cookie secret without committing it.
|
|
69
109
|
|
|
70
|
-
Wire
|
|
110
|
+
Wire the server page guard and EACH protected API following the generated guide.
|
|
111
|
+
Browser route checks are optional for retained SPA navigation.
|
|
71
112
|
Run `npm exec --no -- stopnetic-js check` after setting credentials (`--local-http`
|
|
72
113
|
for a loopback pilot). This check validates configuration and generated files
|
|
73
114
|
offline; it cannot prove deployment routing, API coverage or browser integration.
|
|
@@ -80,12 +121,11 @@ server environment loader. Production credentials belong in runtime settings.
|
|
|
80
121
|
|
|
81
122
|
### Shared browser startup and Node SSR
|
|
82
123
|
|
|
83
|
-
The generated [framework-independent guide](
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
or recheck target access in the client router. A browser-only check is UI behavior.
|
|
124
|
+
The generated [framework-independent guide](dist/client-guide.md) defaults to
|
|
125
|
+
server document navigation: leave browser startup/layout intact, use normal
|
|
126
|
+
links, and let the server apply dashboard policies. It also gives an OPTIONAL
|
|
127
|
+
browser startup gate and separate OPTIONAL SPA router demos. Do not combine
|
|
128
|
+
the alternatives or apply browser-only gates to an SSR hydration root.
|
|
89
129
|
|
|
90
130
|
For Node SSR use the generated Express helper before static files/rendering,
|
|
91
131
|
or `createStopneticAppHandler` around a Fetch-style application entry (0.0.3).
|
|
@@ -97,15 +137,17 @@ adapted; accepting Request/Response does not make an Edge runtime supported.
|
|
|
97
137
|
The guide includes Angular SSR/rendering and client router examples. Angular
|
|
98
138
|
SSR compiled with the installed Angular 22 dependencies and served real HTML
|
|
99
139
|
after verification in an isolated local fixture. That does not validate a live
|
|
100
|
-
provider deployment. Netlify's automatic Angular SSR uses Edge;
|
|
101
|
-
|
|
140
|
+
provider deployment. Netlify's automatic Angular SSR uses Edge; the Node SDK
|
|
141
|
+
has no drop-in integration for that runtime. Preserve SSR and obtain a supported
|
|
142
|
+
Node deployment/gateway decision instead of silently converting the app. Do not publish protected prerendered
|
|
102
143
|
HTML. For other frameworks use the same Node server entry and verify their
|
|
103
144
|
actual deployed runtime. React's boundary remains an optional convenience.
|
|
104
145
|
|
|
105
146
|
### Optional React Router boundary
|
|
106
147
|
|
|
107
148
|
The optional React entry uses Hooks. The core/browser modules need no React.
|
|
108
|
-
|
|
149
|
+
Use this only for explicitly retained browser SPA navigation, inside BrowserRouter,
|
|
150
|
+
around the full target layout. Server document navigation does not require it:
|
|
109
151
|
|
|
110
152
|
```jsx
|
|
111
153
|
import { useLocation } from 'react-router-dom';
|
|
@@ -113,11 +155,12 @@ import { StopneticBoundary } from '@stopnetic/js/react';
|
|
|
113
155
|
|
|
114
156
|
function RouteGuard({ children }) {
|
|
115
157
|
const location = useLocation();
|
|
116
|
-
return <StopneticBoundary path={location.pathname + location.search}>
|
|
158
|
+
return <StopneticBoundary path={location.pathname + location.search} pending={null}>
|
|
117
159
|
{children}
|
|
118
160
|
</StopneticBoundary>;
|
|
119
161
|
}
|
|
120
|
-
// <BrowserRouter><RouteGuard><
|
|
162
|
+
// <BrowserRouter><RouteGuard><Layout/></RouteGuard></BrowserRouter>
|
|
163
|
+
// Layout includes the target header, routes and footer.
|
|
121
164
|
```
|
|
122
165
|
|
|
123
166
|
The boundary hides children while checking, ignores canceled/stale checks and
|