@stacksjs/types 0.74.37 → 0.74.38

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.
@@ -1,5 +1,10 @@
1
1
  export declare interface NotificationOptions {
2
2
  default: 'email' | 'sms' | 'chat' | string
3
+ tracking: {
4
+ enabled: boolean
5
+ channels?: NotificationChannelName[]
6
+ body: boolean
7
+ }
3
8
  email: {
4
9
  default:
5
10
  | 'emailjs'
@@ -123,4 +128,6 @@ export declare interface NotificationOptions {
123
128
  }
124
129
  }
125
130
  }
131
+ /** A channel a notification can be delivered on. */
132
+ export type NotificationChannelName = 'email' | 'sms' | 'chat' | 'database' | 'push' | 'broadcast';
126
133
  export type NotificationConfig = Partial<NotificationOptions>;
package/dist/server.d.ts CHANGED
@@ -18,8 +18,26 @@ export declare interface ApiProxyOptions {
18
18
  export declare interface ServerConfig {
19
19
  proxy?: ApiProxyOptions
20
20
  redirects?: RedirectsOptions
21
+ rewrites?: RewritesOptions
22
+ cache?: ServerCacheOptions
21
23
  security?: ServerSecurityOptions
22
24
  }
25
+ /**
26
+ * How the views server caches what it renders.
27
+ *
28
+ * Off by default: a page whose content depends on who is asking must not be
29
+ * handed to the next visitor, and the server cannot know which pages those are
30
+ * without being told.
31
+ */
32
+ export declare interface ServerCacheOptions {
33
+ renders?: boolean
34
+ renderVary?: 'request' | 'source'
35
+ prewarm?: boolean
36
+ documents?: {
37
+ maxAge?: number
38
+ staleWhileRevalidate?: number
39
+ }
40
+ }
23
41
  /** Security headers the views server puts on rendered pages. */
24
42
  export declare interface ServerSecurityOptions {
25
43
  embeddable?: string[]
@@ -60,3 +78,32 @@ export type RedirectsOptions = Record<string, string | {
60
78
  /** Carry the incoming query string onto the target. Defaults to true. */
61
79
  preserveQuery?: boolean
62
80
  }>;
81
+ /**
82
+ * Paths the API process answers under a different path.
83
+ *
84
+ * `proxy.paths` forwards a path unchanged, which is enough when the API
85
+ * registered that same URL. It is not enough when the public path and the
86
+ * registered route differ — `routes/api.ts` carries an `/api` prefix, so a
87
+ * handler whose home is the site root is registered at `/api/...` and the root
88
+ * path 404s with nothing to say why.
89
+ *
90
+ * ```ts
91
+ * rewrites: {
92
+ * '/sitemap.xml': '/api/sitemap.xml',
93
+ * '/sitemap-trails-*': '/api/sitemap-trails-*',
94
+ * '/.well-known/': '/api/well-known/',
95
+ * }
96
+ * ```
97
+ *
98
+ * Unlike a redirect this is invisible to the client: the request is answered
99
+ * where it was made, so the URL a crawler indexes is the one it asked for. Use
100
+ * a redirect when the URL genuinely moved, and a rewrite when it did not.
101
+ *
102
+ * A rule ending in `*` claims every path starting with it and appends the
103
+ * remainder to the target — one rule for a chunked resource whose count
104
+ * changes. An exact rule beats a prefix one; the longest prefix wins among
105
+ * prefixes. Rules are answered before a page is looked for and before
106
+ * `public/` is searched, so one shadows a static file of the same name.
107
+ * A rewrite whose source is already under `/api/` is ignored.
108
+ */
109
+ export type RewritesOptions = Record<string, string>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/types",
3
3
  "type": "module",
4
- "version": "0.74.37",
4
+ "version": "0.74.38",
5
5
  "description": "The Stacks framework types.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -58,8 +58,8 @@
58
58
  "dependencies": {
59
59
  "@stacksjs/bunpress": "^0.2.8",
60
60
  "@stacksjs/clapp": "^0.2.12",
61
- "@stacksjs/events": "0.74.37",
62
- "@stacksjs/strings": "0.74.37",
61
+ "@stacksjs/events": "0.74.38",
62
+ "@stacksjs/strings": "0.74.38",
63
63
  "@stacksjs/stx": "^0.2.274",
64
64
  "@stacksjs/ts-validation": "^0.5.6",
65
65
  "bun-query-builder": "^0.2.69"
@@ -73,7 +73,7 @@
73
73
  }
74
74
  },
75
75
  "devDependencies": {
76
- "@stacksjs/validation": "0.74.37",
76
+ "@stacksjs/validation": "0.74.38",
77
77
  "better-dx": "^0.2.24",
78
78
  "meilisearch": "^0.59.0"
79
79
  },