singularity-core 0.6.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -3
- package/config/biome-app.json +53 -0
- package/dist/api/server.d.ts +1 -1
- package/dist/api/server.js +14 -7
- package/dist/api/v1.d.ts +232 -113
- package/dist/api/v1.js +2 -1
- package/dist/auth/roles.d.ts +12 -5
- package/dist/auth/roles.js +15 -12
- package/dist/auth/server.d.ts +16 -6
- package/dist/auth/server.js +97 -20
- package/dist/cookie-notice/server.d.ts +11 -0
- package/dist/cookie-notice/server.js +21 -0
- package/dist/format/index.d.ts +11 -4
- package/dist/format/index.js +52 -28
- package/dist/http/index.d.ts +2 -0
- package/dist/http/index.js +6 -0
- package/dist/images/index.d.ts +4 -3
- package/dist/images/index.js +26 -10
- package/dist/paging/index.d.ts +18 -3
- package/dist/paging/index.js +22 -6
- package/dist/paging/react.d.ts +3 -1
- package/dist/paging/react.js +15 -2
- package/dist/schema/index.js +2 -1
- package/dist/security/index.d.ts +9 -4
- package/dist/security/index.js +26 -14
- package/dist/seo/index.d.ts +6 -0
- package/dist/seo/index.js +21 -0
- package/dist/theme/index.d.ts +18 -1
- package/dist/theme/index.js +35 -2
- package/dist/theme/react.d.ts +20 -2
- package/dist/theme/react.js +77 -26
- package/dist/theme/server.d.ts +3 -1
- package/dist/theme/server.js +10 -4
- package/package.json +148 -136
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# singularity-core
|
|
2
2
|
|
|
3
|
-
Shared non-UI code for Singularity TanStack Start apps
|
|
4
|
-
sessions against the Singularity API,
|
|
5
|
-
helpers,
|
|
3
|
+
Shared non-UI code for the Singularity TanStack Start apps (filion blog,
|
|
4
|
+
admin, tools, games): cookie-based auth sessions against the Singularity API,
|
|
5
|
+
openapi-fetch middleware and API error helpers, API schema helpers, paging,
|
|
6
|
+
route static data, image URLs, formatting, HTTP helpers, theme preference,
|
|
7
|
+
the cookie notice, SEO, security headers and CSP, and telemetry.
|
|
6
8
|
|
|
7
9
|
```ts
|
|
8
10
|
// src/utils/auth/auth.server.ts
|
|
@@ -14,3 +16,72 @@ export const { login, logout, getValidSession, hasUserPermission } =
|
|
|
14
16
|
```
|
|
15
17
|
|
|
16
18
|
See [AGENTS.md](./AGENTS.md) for the subpaths and the rules for adding code.
|
|
19
|
+
|
|
20
|
+
## TODO
|
|
21
|
+
|
|
22
|
+
Fix on `main` and release as 0.9.0 (the `feature/fragments` tarballs already use
|
|
23
|
+
up to 0.8.7), then rebase `feature/fragments`.
|
|
24
|
+
|
|
25
|
+
### High value
|
|
26
|
+
|
|
27
|
+
- [x] Logout can end the user's sessions on every device. `endApiSession`
|
|
28
|
+
(`src/auth/server.ts:156`) sends `refreshToken: null` when the refresh cookie
|
|
29
|
+
is missing, and `?? refreshToken` (`:241`) keeps an `EMPTY_GUID` from a
|
|
30
|
+
refresh. Treat `EMPTY_GUID` as no token everywhere and skip the API logout
|
|
31
|
+
when there is no real refresh token.
|
|
32
|
+
- [x] Temporary API errors sign users out. A refresh that returns 429 or 5xx
|
|
33
|
+
clears the cookies (`src/auth/server.ts:232-235`), and the `catch` (`:243`)
|
|
34
|
+
returns null even while the access token is still valid. Clear only on
|
|
35
|
+
400/401/403 and keep the current token while `secondsUntilExpiry > 0`. Add
|
|
36
|
+
tests for both.
|
|
37
|
+
- [x] Cookie roles are decoded, not verified (`src/auth/server.ts:70-93`). Keep it
|
|
38
|
+
decode-only, but document here and in `docs/projects/core.md` that roles are
|
|
39
|
+
a UI hint and the API is the real gate. Audit that every admin and blog
|
|
40
|
+
server function behind `requirePermission` calls the API with the bearer
|
|
41
|
+
token.
|
|
42
|
+
- [x] CSP (`src/security/index.ts:59-76`) lacks `base-uri 'self'`,
|
|
43
|
+
`object-src 'none'` and `form-action 'self'`. Widen `CspDirective` to allow
|
|
44
|
+
`frame-src` and `worker-src`. In the dev policy, browsers ignore
|
|
45
|
+
`'unsafe-inline'` next to a nonce or `'strict-dynamic'`.
|
|
46
|
+
- [x] `useListSearch` (`src/paging/react.ts:14-26`) reapplies the old text after
|
|
47
|
+
Back or a link clears the search. Re-sync `text` when `current` changes from
|
|
48
|
+
outside (track the last applied value in a ref).
|
|
49
|
+
- [x] `build` doesn't clean `dist/`, so `dist/fragments` from the other branch
|
|
50
|
+
would ship in the next pack. Delete `dist` before `tsc`.
|
|
51
|
+
- [x] `formatDate` (`src/format/index.ts:1-14`) uses local getters, so server
|
|
52
|
+
(UTC) and browser (Stockholm) disagree near midnight, and invalid input gives
|
|
53
|
+
`NaN-NaN-NaN`. Use `Intl.DateTimeFormat` with a `timeZone` and return `""`
|
|
54
|
+
for invalid dates.
|
|
55
|
+
|
|
56
|
+
### Nice to have
|
|
57
|
+
|
|
58
|
+
- [x] `formatTimeSpan` drops days (`src/format/index.ts:32-34`), and the "days
|
|
59
|
+
included" test expects the wrong value.
|
|
60
|
+
- [x] The theme client hint `Sec-CH-Prefers-Color-Scheme` (`src/theme/server.ts:22`)
|
|
61
|
+
is never requested with `Accept-CH`. The server renders "system" as light
|
|
62
|
+
while `ThemeProvider` treats it as dark before mount
|
|
63
|
+
(`src/theme/react.tsx:89`). Make the two defaults agree.
|
|
64
|
+
- [x] `ThemeProvider` reads and writes `localStorage` without a guard
|
|
65
|
+
(`src/theme/react.tsx:98,128`). `buildThemeBootstrapScript`
|
|
66
|
+
(`src/theme/index.ts:63`) puts keys into a JS string and a RegExp unescaped;
|
|
67
|
+
use `JSON.stringify` and escape the regex.
|
|
68
|
+
- [x] `proxyEventStream` (`src/api/server.ts:89-94`) doesn't catch a failed fetch.
|
|
69
|
+
Return 502 with `failureMessage`.
|
|
70
|
+
- [x] Small fixes: `pageSearchSchema` throws on `?page=abc` (add
|
|
71
|
+
`.catch(undefined)`); `parsePage` accepts `take: 0` (use
|
|
72
|
+
`.int().positive()`); `na` returns one shared fallback array; `IMAGE_WIDTHS`
|
|
73
|
+
is mutable; `new URL(src)` throws on relative `/i/` URLs
|
|
74
|
+
(`src/images/index.ts:57,82`); `slugify` drops ø/æ/ß/ł.
|
|
75
|
+
- [x] `getValidSession` isn't cached per request, so beforeLoad, middleware and a
|
|
76
|
+
loader can each refresh. Make cookie `secure` an option instead of reading
|
|
77
|
+
`NODE_ENV`.
|
|
78
|
+
- [x] `engines` pins Node 25, which reached end of life in June 2026. Allow 24 LTS
|
|
79
|
+
and 26.
|
|
80
|
+
- [x] Add `.gitattributes` (`* text=auto eol=lf`). CRLF in `package.json` is why
|
|
81
|
+
`biome check` fails.
|
|
82
|
+
- [x] Add a `check` script that only reports and a `verify` script (typecheck,
|
|
83
|
+
check, test). Add `"./package.json"` to `exports`.
|
|
84
|
+
- [x] No tests for `http` or `router/react`.
|
|
85
|
+
- [x] Docs drift: `AGENTS.md` mentions `pnpm openapi-types`, which isn't in
|
|
86
|
+
`package.json`; it describes both tarballs and publishing without saying
|
|
87
|
+
which is current. This README names 5 of the 13 areas.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.5.15/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": true
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false
|
|
10
|
+
},
|
|
11
|
+
"formatter": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"indentStyle": "tab"
|
|
14
|
+
},
|
|
15
|
+
"linter": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"rules": {
|
|
18
|
+
"preset": "recommended"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"javascript": {
|
|
22
|
+
"formatter": {
|
|
23
|
+
"quoteStyle": "double"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"assist": {
|
|
27
|
+
"enabled": true,
|
|
28
|
+
"actions": {
|
|
29
|
+
"source": {
|
|
30
|
+
"organizeImports": "on"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"css": {
|
|
35
|
+
"parser": {
|
|
36
|
+
"tailwindDirectives": true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"overrides": [
|
|
40
|
+
{
|
|
41
|
+
"includes": ["**/src/lib/api/v*.d.ts", "**/routeTree.gen.ts"],
|
|
42
|
+
"formatter": {
|
|
43
|
+
"enabled": false
|
|
44
|
+
},
|
|
45
|
+
"linter": {
|
|
46
|
+
"enabled": false
|
|
47
|
+
},
|
|
48
|
+
"assist": {
|
|
49
|
+
"enabled": false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
package/dist/api/server.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const forwardVisitorIpMiddleware: Middleware;
|
|
|
14
14
|
* Forwards a browser POST to an API event-stream endpoint and streams the
|
|
15
15
|
* answer back, so the API key stays on the server. Passes the visitor's IP,
|
|
16
16
|
* since the API rate limits per visitor, and aborts upstream when the browser
|
|
17
|
-
* disconnects.
|
|
17
|
+
* disconnects. An API that cannot be reached is a 502 with `failureMessage`.
|
|
18
18
|
*/
|
|
19
19
|
export declare function proxyEventStream({ request, url, apiKey, failureMessage, }: {
|
|
20
20
|
request: Request;
|
package/dist/api/server.js
CHANGED
|
@@ -56,7 +56,7 @@ const eventStreamHeaders = {
|
|
|
56
56
|
* Forwards a browser POST to an API event-stream endpoint and streams the
|
|
57
57
|
* answer back, so the API key stays on the server. Passes the visitor's IP,
|
|
58
58
|
* since the API rate limits per visitor, and aborts upstream when the browser
|
|
59
|
-
* disconnects.
|
|
59
|
+
* disconnects. An API that cannot be reached is a 502 with `failureMessage`.
|
|
60
60
|
*/
|
|
61
61
|
export async function proxyEventStream({ request, url, apiKey, failureMessage = "Request failed. Try again.", }) {
|
|
62
62
|
const headers = {
|
|
@@ -68,12 +68,19 @@ export async function proxyEventStream({ request, url, apiKey, failureMessage =
|
|
|
68
68
|
if (visitorIp) {
|
|
69
69
|
headers["X-Forwarded-For"] = visitorIp;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
let upstream;
|
|
72
|
+
try {
|
|
73
|
+
upstream = await fetch(url, {
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers,
|
|
76
|
+
body: await request.text(),
|
|
77
|
+
signal: request.signal,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// API down, DNS or TLS failure, or the browser went away mid-request.
|
|
82
|
+
return new Response(failureMessage, { status: 502 });
|
|
83
|
+
}
|
|
77
84
|
if (!upstream.ok || !upstream.body) {
|
|
78
85
|
const error = await upstream.text().catch(() => "");
|
|
79
86
|
return new Response(error || failureMessage, {
|
package/dist/api/v1.d.ts
CHANGED
|
@@ -218,7 +218,9 @@ export interface paths {
|
|
|
218
218
|
};
|
|
219
219
|
get: {
|
|
220
220
|
parameters: {
|
|
221
|
-
query?:
|
|
221
|
+
query?: {
|
|
222
|
+
Category?: string;
|
|
223
|
+
};
|
|
222
224
|
header?: never;
|
|
223
225
|
path?: never;
|
|
224
226
|
cookie?: never;
|
|
@@ -253,7 +255,9 @@ export interface paths {
|
|
|
253
255
|
};
|
|
254
256
|
get: {
|
|
255
257
|
parameters: {
|
|
256
|
-
query?:
|
|
258
|
+
query?: {
|
|
259
|
+
Author?: string;
|
|
260
|
+
};
|
|
257
261
|
header?: never;
|
|
258
262
|
path?: never;
|
|
259
263
|
cookie?: never;
|
|
@@ -398,10 +402,13 @@ export interface paths {
|
|
|
398
402
|
get: {
|
|
399
403
|
parameters: {
|
|
400
404
|
query?: {
|
|
401
|
-
Author?: string;
|
|
402
|
-
Category?: string;
|
|
405
|
+
Author?: string[];
|
|
406
|
+
Category?: string[];
|
|
403
407
|
OnlyWithImages?: boolean;
|
|
404
408
|
Page?: number;
|
|
409
|
+
Search?: string;
|
|
410
|
+
/** @description Possible values: Newest, Oldest, TitleAsc, TitleDesc */
|
|
411
|
+
Sort?: components["schemas"]["PostSort"];
|
|
405
412
|
Take?: number;
|
|
406
413
|
};
|
|
407
414
|
header?: never;
|
|
@@ -416,7 +423,7 @@ export interface paths {
|
|
|
416
423
|
[name: string]: unknown;
|
|
417
424
|
};
|
|
418
425
|
content: {
|
|
419
|
-
"application/json": components["schemas"]["
|
|
426
|
+
"application/json": components["schemas"]["PostSummaryResponsePagedResponse"];
|
|
420
427
|
};
|
|
421
428
|
};
|
|
422
429
|
/** @description Internal Server Error */
|
|
@@ -436,6 +443,99 @@ export interface paths {
|
|
|
436
443
|
patch?: never;
|
|
437
444
|
trace?: never;
|
|
438
445
|
};
|
|
446
|
+
"/api/v1/blog/writer/posts": {
|
|
447
|
+
parameters: {
|
|
448
|
+
query?: never;
|
|
449
|
+
header?: never;
|
|
450
|
+
path?: never;
|
|
451
|
+
cookie?: never;
|
|
452
|
+
};
|
|
453
|
+
get: {
|
|
454
|
+
parameters: {
|
|
455
|
+
query?: {
|
|
456
|
+
Page?: number;
|
|
457
|
+
Take?: number;
|
|
458
|
+
};
|
|
459
|
+
header?: never;
|
|
460
|
+
path?: never;
|
|
461
|
+
cookie?: never;
|
|
462
|
+
};
|
|
463
|
+
requestBody?: never;
|
|
464
|
+
responses: {
|
|
465
|
+
/** @description OK */
|
|
466
|
+
200: {
|
|
467
|
+
headers: {
|
|
468
|
+
[name: string]: unknown;
|
|
469
|
+
};
|
|
470
|
+
content: {
|
|
471
|
+
"application/json": components["schemas"]["PostSummaryResponsePagedResponse"];
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
put?: never;
|
|
477
|
+
post?: never;
|
|
478
|
+
delete?: never;
|
|
479
|
+
options?: never;
|
|
480
|
+
head?: never;
|
|
481
|
+
patch?: never;
|
|
482
|
+
trace?: never;
|
|
483
|
+
};
|
|
484
|
+
"/api/v1/blog/writer/posts/{id}": {
|
|
485
|
+
parameters: {
|
|
486
|
+
query?: never;
|
|
487
|
+
header?: never;
|
|
488
|
+
path?: never;
|
|
489
|
+
cookie?: never;
|
|
490
|
+
};
|
|
491
|
+
get?: never;
|
|
492
|
+
put: {
|
|
493
|
+
parameters: {
|
|
494
|
+
query?: never;
|
|
495
|
+
header?: never;
|
|
496
|
+
path: {
|
|
497
|
+
id: number;
|
|
498
|
+
};
|
|
499
|
+
cookie?: never;
|
|
500
|
+
};
|
|
501
|
+
requestBody: {
|
|
502
|
+
content: {
|
|
503
|
+
"application/json": components["schemas"]["PostUpdateRequest"];
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
responses: {
|
|
507
|
+
/** @description OK */
|
|
508
|
+
200: {
|
|
509
|
+
headers: {
|
|
510
|
+
[name: string]: unknown;
|
|
511
|
+
};
|
|
512
|
+
content: {
|
|
513
|
+
"application/json": components["schemas"]["PostResponse"];
|
|
514
|
+
};
|
|
515
|
+
};
|
|
516
|
+
/** @description Bad Request */
|
|
517
|
+
400: {
|
|
518
|
+
headers: {
|
|
519
|
+
[name: string]: unknown;
|
|
520
|
+
};
|
|
521
|
+
content?: never;
|
|
522
|
+
};
|
|
523
|
+
/** @description Not Found */
|
|
524
|
+
404: {
|
|
525
|
+
headers: {
|
|
526
|
+
[name: string]: unknown;
|
|
527
|
+
};
|
|
528
|
+
content?: never;
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
};
|
|
532
|
+
post?: never;
|
|
533
|
+
delete?: never;
|
|
534
|
+
options?: never;
|
|
535
|
+
head?: never;
|
|
536
|
+
patch?: never;
|
|
537
|
+
trace?: never;
|
|
538
|
+
};
|
|
439
539
|
"/api/v1/codiv/demo/scenario": {
|
|
440
540
|
parameters: {
|
|
441
541
|
query?: never;
|
|
@@ -470,6 +570,13 @@ export interface paths {
|
|
|
470
570
|
};
|
|
471
571
|
content?: never;
|
|
472
572
|
};
|
|
573
|
+
/** @description Too Many Requests */
|
|
574
|
+
429: {
|
|
575
|
+
headers: {
|
|
576
|
+
[name: string]: unknown;
|
|
577
|
+
};
|
|
578
|
+
content?: never;
|
|
579
|
+
};
|
|
473
580
|
/** @description Internal Server Error */
|
|
474
581
|
500: {
|
|
475
582
|
headers: {
|
|
@@ -565,6 +672,13 @@ export interface paths {
|
|
|
565
672
|
};
|
|
566
673
|
content?: never;
|
|
567
674
|
};
|
|
675
|
+
/** @description Too Many Requests */
|
|
676
|
+
429: {
|
|
677
|
+
headers: {
|
|
678
|
+
[name: string]: unknown;
|
|
679
|
+
};
|
|
680
|
+
content?: never;
|
|
681
|
+
};
|
|
568
682
|
/** @description Internal Server Error */
|
|
569
683
|
500: {
|
|
570
684
|
headers: {
|
|
@@ -804,6 +918,64 @@ export interface paths {
|
|
|
804
918
|
patch?: never;
|
|
805
919
|
trace?: never;
|
|
806
920
|
};
|
|
921
|
+
"/api/v1/contact": {
|
|
922
|
+
parameters: {
|
|
923
|
+
query?: never;
|
|
924
|
+
header?: never;
|
|
925
|
+
path?: never;
|
|
926
|
+
cookie?: never;
|
|
927
|
+
};
|
|
928
|
+
get?: never;
|
|
929
|
+
put?: never;
|
|
930
|
+
post: {
|
|
931
|
+
parameters: {
|
|
932
|
+
query?: never;
|
|
933
|
+
header?: never;
|
|
934
|
+
path?: never;
|
|
935
|
+
cookie?: never;
|
|
936
|
+
};
|
|
937
|
+
requestBody: {
|
|
938
|
+
content: {
|
|
939
|
+
"application/json": components["schemas"]["SendContactMessageRequest"];
|
|
940
|
+
};
|
|
941
|
+
};
|
|
942
|
+
responses: {
|
|
943
|
+
/** @description No Content */
|
|
944
|
+
204: {
|
|
945
|
+
headers: {
|
|
946
|
+
[name: string]: unknown;
|
|
947
|
+
};
|
|
948
|
+
content?: never;
|
|
949
|
+
};
|
|
950
|
+
/** @description Bad Request */
|
|
951
|
+
400: {
|
|
952
|
+
headers: {
|
|
953
|
+
[name: string]: unknown;
|
|
954
|
+
};
|
|
955
|
+
content?: never;
|
|
956
|
+
};
|
|
957
|
+
/** @description Too Many Requests */
|
|
958
|
+
429: {
|
|
959
|
+
headers: {
|
|
960
|
+
[name: string]: unknown;
|
|
961
|
+
};
|
|
962
|
+
content?: never;
|
|
963
|
+
};
|
|
964
|
+
/** @description Service Unavailable */
|
|
965
|
+
503: {
|
|
966
|
+
headers: {
|
|
967
|
+
[name: string]: unknown;
|
|
968
|
+
};
|
|
969
|
+
content?: never;
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
};
|
|
973
|
+
delete?: never;
|
|
974
|
+
options?: never;
|
|
975
|
+
head?: never;
|
|
976
|
+
patch?: never;
|
|
977
|
+
trace?: never;
|
|
978
|
+
};
|
|
807
979
|
"/api/v1/image/{id}": {
|
|
808
980
|
parameters: {
|
|
809
981
|
query?: never;
|
|
@@ -1136,6 +1308,13 @@ export interface paths {
|
|
|
1136
1308
|
};
|
|
1137
1309
|
content?: never;
|
|
1138
1310
|
};
|
|
1311
|
+
/** @description Too Many Requests */
|
|
1312
|
+
429: {
|
|
1313
|
+
headers: {
|
|
1314
|
+
[name: string]: unknown;
|
|
1315
|
+
};
|
|
1316
|
+
content?: never;
|
|
1317
|
+
};
|
|
1139
1318
|
};
|
|
1140
1319
|
};
|
|
1141
1320
|
delete?: never;
|
|
@@ -1180,6 +1359,13 @@ export interface paths {
|
|
|
1180
1359
|
};
|
|
1181
1360
|
content?: never;
|
|
1182
1361
|
};
|
|
1362
|
+
/** @description Too Many Requests */
|
|
1363
|
+
429: {
|
|
1364
|
+
headers: {
|
|
1365
|
+
[name: string]: unknown;
|
|
1366
|
+
};
|
|
1367
|
+
content?: never;
|
|
1368
|
+
};
|
|
1183
1369
|
};
|
|
1184
1370
|
};
|
|
1185
1371
|
delete?: never;
|
|
@@ -1525,99 +1711,6 @@ export interface paths {
|
|
|
1525
1711
|
patch?: never;
|
|
1526
1712
|
trace?: never;
|
|
1527
1713
|
};
|
|
1528
|
-
"/api/v1/writer/posts": {
|
|
1529
|
-
parameters: {
|
|
1530
|
-
query?: never;
|
|
1531
|
-
header?: never;
|
|
1532
|
-
path?: never;
|
|
1533
|
-
cookie?: never;
|
|
1534
|
-
};
|
|
1535
|
-
get: {
|
|
1536
|
-
parameters: {
|
|
1537
|
-
query?: {
|
|
1538
|
-
Page?: number;
|
|
1539
|
-
Take?: number;
|
|
1540
|
-
};
|
|
1541
|
-
header?: never;
|
|
1542
|
-
path?: never;
|
|
1543
|
-
cookie?: never;
|
|
1544
|
-
};
|
|
1545
|
-
requestBody?: never;
|
|
1546
|
-
responses: {
|
|
1547
|
-
/** @description OK */
|
|
1548
|
-
200: {
|
|
1549
|
-
headers: {
|
|
1550
|
-
[name: string]: unknown;
|
|
1551
|
-
};
|
|
1552
|
-
content: {
|
|
1553
|
-
"application/json": components["schemas"]["PostResponsePagedResponse"];
|
|
1554
|
-
};
|
|
1555
|
-
};
|
|
1556
|
-
};
|
|
1557
|
-
};
|
|
1558
|
-
put?: never;
|
|
1559
|
-
post?: never;
|
|
1560
|
-
delete?: never;
|
|
1561
|
-
options?: never;
|
|
1562
|
-
head?: never;
|
|
1563
|
-
patch?: never;
|
|
1564
|
-
trace?: never;
|
|
1565
|
-
};
|
|
1566
|
-
"/api/v1/writer/posts/{id}": {
|
|
1567
|
-
parameters: {
|
|
1568
|
-
query?: never;
|
|
1569
|
-
header?: never;
|
|
1570
|
-
path?: never;
|
|
1571
|
-
cookie?: never;
|
|
1572
|
-
};
|
|
1573
|
-
get?: never;
|
|
1574
|
-
put: {
|
|
1575
|
-
parameters: {
|
|
1576
|
-
query?: never;
|
|
1577
|
-
header?: never;
|
|
1578
|
-
path: {
|
|
1579
|
-
id: number;
|
|
1580
|
-
};
|
|
1581
|
-
cookie?: never;
|
|
1582
|
-
};
|
|
1583
|
-
requestBody: {
|
|
1584
|
-
content: {
|
|
1585
|
-
"application/json": components["schemas"]["PostUpdateRequest"];
|
|
1586
|
-
};
|
|
1587
|
-
};
|
|
1588
|
-
responses: {
|
|
1589
|
-
/** @description OK */
|
|
1590
|
-
200: {
|
|
1591
|
-
headers: {
|
|
1592
|
-
[name: string]: unknown;
|
|
1593
|
-
};
|
|
1594
|
-
content: {
|
|
1595
|
-
"application/json": components["schemas"]["PostResponse"];
|
|
1596
|
-
};
|
|
1597
|
-
};
|
|
1598
|
-
/** @description Bad Request */
|
|
1599
|
-
400: {
|
|
1600
|
-
headers: {
|
|
1601
|
-
[name: string]: unknown;
|
|
1602
|
-
};
|
|
1603
|
-
content?: never;
|
|
1604
|
-
};
|
|
1605
|
-
/** @description Not Found */
|
|
1606
|
-
404: {
|
|
1607
|
-
headers: {
|
|
1608
|
-
[name: string]: unknown;
|
|
1609
|
-
};
|
|
1610
|
-
content?: never;
|
|
1611
|
-
};
|
|
1612
|
-
};
|
|
1613
|
-
};
|
|
1614
|
-
post?: never;
|
|
1615
|
-
delete?: never;
|
|
1616
|
-
options?: never;
|
|
1617
|
-
head?: never;
|
|
1618
|
-
patch?: never;
|
|
1619
|
-
trace?: never;
|
|
1620
|
-
};
|
|
1621
1714
|
}
|
|
1622
1715
|
export type webhooks = Record<string, never>;
|
|
1623
1716
|
export interface components {
|
|
@@ -1626,8 +1719,8 @@ export interface components {
|
|
|
1626
1719
|
/** Format: uuid */
|
|
1627
1720
|
parentCommentId?: string | null;
|
|
1628
1721
|
/** Format: int32 */
|
|
1629
|
-
postId
|
|
1630
|
-
text
|
|
1722
|
+
postId: number;
|
|
1723
|
+
text: string;
|
|
1631
1724
|
};
|
|
1632
1725
|
AuthedUserResponse: {
|
|
1633
1726
|
accessToken?: string | null;
|
|
@@ -1875,7 +1968,6 @@ export interface components {
|
|
|
1875
1968
|
/** Format: int32 */
|
|
1876
1969
|
id?: number;
|
|
1877
1970
|
};
|
|
1878
|
-
/** @description `IsDeleted`: removed by its author or an admin but kept for its replies; `Text` is empty. */
|
|
1879
1971
|
GetPostCommentsResponse: {
|
|
1880
1972
|
/** Format: date-time */
|
|
1881
1973
|
createdAt?: string;
|
|
@@ -1890,7 +1982,6 @@ export interface components {
|
|
|
1890
1982
|
userId?: string | null;
|
|
1891
1983
|
username?: string | null;
|
|
1892
1984
|
};
|
|
1893
|
-
/** @description One page of a list. `Page` is zero-based; `Total` counts every row. */
|
|
1894
1985
|
GetPostCommentsResponsePagedResponse: {
|
|
1895
1986
|
items?: components["schemas"]["GetPostCommentsResponse"][] | null;
|
|
1896
1987
|
/** Format: int32 */
|
|
@@ -1923,10 +2014,9 @@ export interface components {
|
|
|
1923
2014
|
shortName?: string | null;
|
|
1924
2015
|
};
|
|
1925
2016
|
LoginRequest: {
|
|
1926
|
-
password
|
|
1927
|
-
username
|
|
2017
|
+
password: string;
|
|
2018
|
+
username: string;
|
|
1928
2019
|
};
|
|
1929
|
-
/** @description The session to end. Without a token (body or cookie) every session of the user ends. */
|
|
1930
2020
|
LogoutRequest: {
|
|
1931
2021
|
/** Format: uuid */
|
|
1932
2022
|
refreshToken?: string | null;
|
|
@@ -1948,7 +2038,6 @@ export interface components {
|
|
|
1948
2038
|
count?: number;
|
|
1949
2039
|
name?: string | null;
|
|
1950
2040
|
};
|
|
1951
|
-
/** @description The post's picture. Add `w` and `h` to `Url` to get a size. */
|
|
1952
2041
|
PostImageResponse: {
|
|
1953
2042
|
/** Format: double */
|
|
1954
2043
|
focusX?: number;
|
|
@@ -1985,9 +2074,34 @@ export interface components {
|
|
|
1985
2074
|
/** Format: uuid */
|
|
1986
2075
|
writerUserId?: string | null;
|
|
1987
2076
|
};
|
|
1988
|
-
/**
|
|
1989
|
-
|
|
1990
|
-
|
|
2077
|
+
/**
|
|
2078
|
+
* @description Possible values: Newest, Oldest, TitleAsc, TitleDesc
|
|
2079
|
+
* @enum {string}
|
|
2080
|
+
*/
|
|
2081
|
+
PostSort: "Newest" | "Oldest" | "TitleAsc" | "TitleDesc";
|
|
2082
|
+
PostSummaryResponse: {
|
|
2083
|
+
author?: string | null;
|
|
2084
|
+
/** Format: int32 */
|
|
2085
|
+
authorId?: number | null;
|
|
2086
|
+
/** Format: date-time */
|
|
2087
|
+
date?: string | null;
|
|
2088
|
+
excerpt?: string | null;
|
|
2089
|
+
/** Format: date-span */
|
|
2090
|
+
expectedTimeToRead?: string;
|
|
2091
|
+
/** Format: int32 */
|
|
2092
|
+
id?: number;
|
|
2093
|
+
image?: components["schemas"]["PostImageResponse"];
|
|
2094
|
+
imageCategory?: string | null;
|
|
2095
|
+
/** Format: int32 */
|
|
2096
|
+
likeCount?: number;
|
|
2097
|
+
likedByMe?: boolean;
|
|
2098
|
+
title?: string | null;
|
|
2099
|
+
unsplashImage?: string | null;
|
|
2100
|
+
/** Format: uuid */
|
|
2101
|
+
writerUserId?: string | null;
|
|
2102
|
+
};
|
|
2103
|
+
PostSummaryResponsePagedResponse: {
|
|
2104
|
+
items?: components["schemas"]["PostSummaryResponse"][] | null;
|
|
1991
2105
|
/** Format: int32 */
|
|
1992
2106
|
page?: number;
|
|
1993
2107
|
/** Format: int32 */
|
|
@@ -1998,16 +2112,20 @@ export interface components {
|
|
|
1998
2112
|
PostUpdateRequest: {
|
|
1999
2113
|
content?: string | null;
|
|
2000
2114
|
excerpt?: string | null;
|
|
2001
|
-
title
|
|
2115
|
+
title: string;
|
|
2002
2116
|
unsplashImage?: string | null;
|
|
2003
2117
|
};
|
|
2004
|
-
/** @description `RefreshToken` may be empty when the refresh cookie carries it. */
|
|
2005
2118
|
RefreshRequest: {
|
|
2006
2119
|
/** Format: uuid */
|
|
2007
2120
|
refreshToken?: string;
|
|
2008
2121
|
/** Format: uuid */
|
|
2009
2122
|
userId?: string;
|
|
2010
2123
|
};
|
|
2124
|
+
SendContactMessageRequest: {
|
|
2125
|
+
email?: string | null;
|
|
2126
|
+
message?: string | null;
|
|
2127
|
+
name?: string | null;
|
|
2128
|
+
};
|
|
2011
2129
|
SendToolChatMessageRequest: {
|
|
2012
2130
|
messages?: components["schemas"]["ToolChatMessageRequest"][] | null;
|
|
2013
2131
|
};
|
|
@@ -2113,10 +2231,10 @@ export interface components {
|
|
|
2113
2231
|
signature?: string | null;
|
|
2114
2232
|
};
|
|
2115
2233
|
/**
|
|
2116
|
-
* @description Possible values: ADMIN,
|
|
2234
|
+
* @description Possible values: ADMIN, BLOG_WRITER, BLOG_USER
|
|
2117
2235
|
* @enum {string}
|
|
2118
2236
|
*/
|
|
2119
|
-
UserRole: "ADMIN" | "
|
|
2237
|
+
UserRole: "ADMIN" | "BLOG_WRITER" | "BLOG_USER";
|
|
2120
2238
|
};
|
|
2121
2239
|
responses: never;
|
|
2122
2240
|
parameters: never;
|
|
@@ -2176,5 +2294,6 @@ type ReadonlyArray<T> = [
|
|
|
2176
2294
|
] extends [
|
|
2177
2295
|
unknown[]
|
|
2178
2296
|
] ? Readonly<Exclude<T, undefined>> : Readonly<Exclude<T, undefined>[]>;
|
|
2297
|
+
export declare const postSortValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["PostSort"]>;
|
|
2179
2298
|
export declare const userRoleValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["UserRole"]>;
|
|
2180
2299
|
export {};
|
package/dist/api/v1.js
CHANGED
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
* This file was auto-generated by openapi-typescript.
|
|
3
3
|
* Do not make direct changes to the file.
|
|
4
4
|
*/
|
|
5
|
-
export const
|
|
5
|
+
export const postSortValues = ["Newest", "Oldest", "TitleAsc", "TitleDesc"];
|
|
6
|
+
export const userRoleValues = ["ADMIN", "BLOG_WRITER", "BLOG_USER"];
|