@pgxsinkit/server 0.1.40 → 0.1.46
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/dist/cors-origin.d.ts +16 -0
- package/dist/cors-origin.d.ts.map +1 -0
- package/dist/electric-proxy.d.ts +4 -1
- package/dist/electric-proxy.d.ts.map +1 -1
- package/dist/index.js +229 -5849
- package/dist/index.js.map +8 -87
- package/dist/mutations/plpgsql-apply.d.ts.map +1 -1
- package/dist/router.d.ts +1 -0
- package/dist/router.d.ts.map +1 -1
- package/package.json +2 -2
- package/skills/deploying/SKILL.md +1 -1
- package/src/cors-origin.ts +21 -0
- package/src/electric-proxy.ts +7 -3
- package/src/mutations/plpgsql-apply.ts +10 -9
- package/src/router.ts +4 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve which origin (if any) a response's CORS headers should allow for this request.
|
|
3
|
+
*
|
|
4
|
+
* Entries are exact scheme+host[+port] strings (`https://app.example.com`, `http://localhost:5660`),
|
|
5
|
+
* plus one special form: a literal `"*"` entry allows EVERY origin by reflecting the request's
|
|
6
|
+
* `Origin` header back — never a literal `*` header value, which the Fetch spec rejects for
|
|
7
|
+
* credentialed requests (the toolkit's requests carry `Authorization`). Reflection is sound here
|
|
8
|
+
* because auth is a per-request bearer token, not ambient cookies: a hostile page cannot mint the
|
|
9
|
+
* header, so the origin list is deployment hygiene rather than the security boundary. Use `"*"` for
|
|
10
|
+
* dev/demo backends serving many local origins; enumerate exact origins for production.
|
|
11
|
+
*
|
|
12
|
+
* Returns `null` when the request has no `Origin` or it is not allowed — callers then omit CORS
|
|
13
|
+
* headers entirely, and the browser blocks the read.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveCorsOrigin(request: Request, origins: readonly string[]): string | null;
|
|
16
|
+
//# sourceMappingURL=cors-origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cors-origin.d.ts","sourceRoot":"","sources":["../src/cors-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAM7F"}
|
package/dist/electric-proxy.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type JwtClaims, type SyncTableRegistry } from "@pgxsinkit/contracts";
|
|
2
2
|
export interface ElectricProxyCors {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Browser origins allowed to read this shape: exact strings (e.g. a hosted SPA + localhost dev),
|
|
5
|
+
* or a `"*"` entry to allow every origin by reflection (see {@link resolveCorsOrigin}).
|
|
6
|
+
*/
|
|
4
7
|
origins: string[];
|
|
5
8
|
}
|
|
6
9
|
export interface ElectricProxyOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"electric-proxy.d.ts","sourceRoot":"","sources":["../src/electric-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAId,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"electric-proxy.d.ts","sourceRoot":"","sources":["../src/electric-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAId,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAI9B,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;OAQG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAeD;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,SAAS,GAAG,IAAI,EACxB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,QAAQ,CAAC,CAYnB"}
|