@kya-os/checkpoint-nextjs 1.10.0 → 1.12.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 +261 -0
- package/README.md +217 -35
- package/dist/{adapt.mjs → adapt-BvqYgrAk.mjs} +15 -4
- package/dist/adapt-BvqYgrAk.mjs.map +1 -0
- package/dist/{adapt.js → adapt-DUEIfZnx.js} +34 -13
- package/dist/api-client-JHOrRUA_.d.mts +222 -0
- package/dist/api-client-JHOrRUA_.d.mts.map +1 -0
- package/dist/api-client-JHOrRUA_.d.ts +222 -0
- package/dist/api-client-JHOrRUA_.d.ts.map +1 -0
- package/dist/api-client.d.mts +2 -204
- package/dist/api-client.d.ts +2 -204
- package/dist/api-client.js +19 -18
- package/dist/api-client.mjs +20 -16
- package/dist/api-client.mjs.map +1 -1
- package/dist/api-middleware-BtsYJU5u.d.mts +131 -0
- package/dist/api-middleware-BtsYJU5u.d.mts.map +1 -0
- package/dist/{api-middleware-CMDRoQik.mjs → api-middleware-DvmkJ_Li.mjs} +68 -38
- package/dist/api-middleware-DvmkJ_Li.mjs.map +1 -0
- package/dist/api-middleware-DyLDqOYF.d.ts +131 -0
- package/dist/api-middleware-DyLDqOYF.d.ts.map +1 -0
- package/dist/{api-middleware-CDSh3TSE.js → api-middleware-beNlXd5P.js} +75 -63
- package/dist/api-middleware.d.mts +2 -152
- package/dist/api-middleware.d.ts +2 -152
- package/dist/api-middleware.js +1 -5
- package/dist/api-middleware.mjs +2 -3
- package/dist/cedar-wasm.d.mts +20 -0
- package/dist/cedar-wasm.d.mts.map +1 -0
- package/dist/cedar-wasm.d.ts +19 -0
- package/dist/cedar-wasm.d.ts.map +1 -0
- package/dist/cedar-wasm.js +24 -0
- package/dist/cedar-wasm.mjs +23 -0
- package/dist/cedar-wasm.mjs.map +1 -0
- package/dist/config-D7h2w_it.d.mts +89 -0
- package/dist/config-D7h2w_it.d.mts.map +1 -0
- package/dist/config-DkXvl4nH.d.ts +89 -0
- package/dist/config-DkXvl4nH.d.ts.map +1 -0
- package/dist/engine-wasm.d.mts +20 -0
- package/dist/engine-wasm.d.mts.map +1 -0
- package/dist/engine-wasm.d.ts +19 -0
- package/dist/engine-wasm.d.ts.map +1 -0
- package/dist/engine-wasm.js +24 -0
- package/dist/engine-wasm.mjs +23 -0
- package/dist/engine-wasm.mjs.map +1 -0
- package/dist/index-edge.d.mts +8 -0
- package/dist/index-edge.d.ts +8 -0
- package/dist/index-edge.js +14 -0
- package/dist/index-edge.mjs +7 -0
- package/dist/index.d.mts +8 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.js +20 -49
- package/dist/index.mjs +21 -8
- package/dist/index.mjs.map +1 -1
- package/dist/middleware-bundler.d.mts +1 -1
- package/dist/middleware-bundler.d.mts.map +1 -1
- package/dist/middleware-bundler.d.ts +1 -1
- package/dist/middleware-bundler.d.ts.map +1 -1
- package/dist/middleware-bundler.js +5 -5
- package/dist/middleware-bundler.mjs +5 -5
- package/dist/middleware-bundler.mjs.map +1 -1
- package/dist/middleware-core-B1GuspOY.js +169 -0
- package/dist/middleware-core-BmW2kH8J.d.ts +14 -0
- package/dist/middleware-core-BmW2kH8J.d.ts.map +1 -0
- package/dist/middleware-core-CnPUoD2v.d.mts +14 -0
- package/dist/middleware-core-CnPUoD2v.d.mts.map +1 -0
- package/dist/middleware-core-WZeMSRqx.mjs +159 -0
- package/dist/middleware-core-WZeMSRqx.mjs.map +1 -0
- package/dist/middleware-edge.d.mts +11 -3
- package/dist/middleware-edge.d.mts.map +1 -1
- package/dist/middleware-edge.d.ts +11 -3
- package/dist/middleware-edge.d.ts.map +1 -1
- package/dist/middleware-edge.js +68 -29
- package/dist/middleware-edge.mjs +68 -31
- package/dist/middleware-edge.mjs.map +1 -1
- package/dist/middleware-node-context-BvqrL2Ra.mjs +16 -0
- package/dist/middleware-node-context-BvqrL2Ra.mjs.map +1 -0
- package/dist/middleware-node-context-TRMTgp3y.js +20 -0
- package/dist/middleware-node.d.mts +12 -3
- package/dist/middleware-node.d.mts.map +1 -0
- package/dist/middleware-node.d.ts +12 -3
- package/dist/middleware-node.d.ts.map +1 -0
- package/dist/middleware-node.js +14 -6
- package/dist/middleware-node.mjs +14 -6
- package/dist/middleware-node.mjs.map +1 -1
- package/dist/posture-outcome-Ccujx_9V.d.mts +14 -0
- package/dist/posture-outcome-Ccujx_9V.d.mts.map +1 -0
- package/dist/posture-outcome-Ccujx_9V.d.ts +14 -0
- package/dist/posture-outcome-Ccujx_9V.d.ts.map +1 -0
- package/dist/posture-outcome-DQ4fdMfq.mjs +21 -0
- package/dist/posture-outcome-DQ4fdMfq.mjs.map +1 -0
- package/dist/posture-outcome-DddsJtL8.js +25 -0
- package/dist/public-api-Cw7Zj290.d.ts +5 -0
- package/dist/public-api-DgCw1uo6.d.mts +5 -0
- package/dist/rolldown-runtime-C24Yb2bl.js +33 -0
- package/dist/utils-Cnwg0VrY.mjs +88 -0
- package/dist/utils-Cnwg0VrY.mjs.map +1 -0
- package/dist/utils-dyFxqlFI.js +104 -0
- package/package.json +27 -62
- package/EDGE_RUNTIME_WASM_SETUP.md +0 -342
- package/bin/setup-edge-wasm.js +0 -513
- package/dist/adapt.d.mts +0 -11
- package/dist/adapt.d.mts.map +0 -1
- package/dist/adapt.d.ts +0 -11
- package/dist/adapt.d.ts.map +0 -1
- package/dist/adapt.mjs.map +0 -1
- package/dist/api-client.d.mts.map +0 -1
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-middleware-CMDRoQik.mjs.map +0 -1
- package/dist/api-middleware.d.mts.map +0 -1
- package/dist/api-middleware.d.ts.map +0 -1
- package/dist/composed-policy-BCaNiVHv.d.mts +0 -98
- package/dist/composed-policy-BCaNiVHv.d.mts.map +0 -1
- package/dist/composed-policy-zzJYNFTb.d.ts +0 -98
- package/dist/composed-policy-zzJYNFTb.d.ts.map +0 -1
- package/dist/composed-policy.d.mts +0 -2
- package/dist/composed-policy.d.ts +0 -2
- package/dist/composed-policy.js +0 -136
- package/dist/composed-policy.mjs +0 -132
- package/dist/composed-policy.mjs.map +0 -1
- package/dist/config-CbAg2mze.d.ts +0 -255
- package/dist/config-CbAg2mze.d.ts.map +0 -1
- package/dist/config-Doe0Tn53.d.mts +0 -255
- package/dist/config-Doe0Tn53.d.mts.map +0 -1
- package/dist/create-middleware.d.mts +0 -11
- package/dist/create-middleware.d.mts.map +0 -1
- package/dist/create-middleware.d.ts +0 -11
- package/dist/create-middleware.d.ts.map +0 -1
- package/dist/create-middleware.js +0 -39
- package/dist/create-middleware.mjs +0 -38
- package/dist/create-middleware.mjs.map +0 -1
- package/dist/edge/index.d.mts +0 -88
- package/dist/edge/index.d.mts.map +0 -1
- package/dist/edge/index.d.ts +0 -88
- package/dist/edge/index.d.ts.map +0 -1
- package/dist/edge/index.js +0 -362
- package/dist/edge/index.mjs +0 -362
- package/dist/edge/index.mjs.map +0 -1
- package/dist/edge-runtime-loader.d.mts +0 -49
- package/dist/edge-runtime-loader.d.mts.map +0 -1
- package/dist/edge-runtime-loader.d.ts +0 -49
- package/dist/edge-runtime-loader.d.ts.map +0 -1
- package/dist/edge-runtime-loader.js +0 -297
- package/dist/edge-runtime-loader.mjs +0 -292
- package/dist/edge-runtime-loader.mjs.map +0 -1
- package/dist/edge-wasm-middleware.d.mts +0 -43
- package/dist/edge-wasm-middleware.d.mts.map +0 -1
- package/dist/edge-wasm-middleware.d.ts +0 -43
- package/dist/edge-wasm-middleware.d.ts.map +0 -1
- package/dist/edge-wasm-middleware.js +0 -37
- package/dist/edge-wasm-middleware.mjs +0 -35
- package/dist/edge-wasm-middleware.mjs.map +0 -1
- package/dist/middleware-core-BYQP9FND.mjs +0 -165
- package/dist/middleware-core-BYQP9FND.mjs.map +0 -1
- package/dist/middleware-core-D6TijE6P.js +0 -175
- package/dist/middleware-node-CE4GevYs.d.ts +0 -20
- package/dist/middleware-node-CE4GevYs.d.ts.map +0 -1
- package/dist/middleware-node-DtyOuPta.d.mts +0 -20
- package/dist/middleware-node-DtyOuPta.d.mts.map +0 -1
- package/dist/middleware-node-context-BqPbf-fI.mjs +0 -34
- package/dist/middleware-node-context-BqPbf-fI.mjs.map +0 -1
- package/dist/middleware-node-context-rgnc7UNR.js +0 -38
- package/dist/middleware.d.mts +0 -25
- package/dist/middleware.d.mts.map +0 -1
- package/dist/middleware.d.ts +0 -25
- package/dist/middleware.d.ts.map +0 -1
- package/dist/middleware.js +0 -53
- package/dist/middleware.mjs +0 -51
- package/dist/middleware.mjs.map +0 -1
- package/dist/nodejs-wasm-loader.d.mts +0 -42
- package/dist/nodejs-wasm-loader.d.mts.map +0 -1
- package/dist/nodejs-wasm-loader.d.ts +0 -42
- package/dist/nodejs-wasm-loader.d.ts.map +0 -1
- package/dist/nodejs-wasm-loader.js +0 -70
- package/dist/nodejs-wasm-loader.mjs +0 -66
- package/dist/nodejs-wasm-loader.mjs.map +0 -1
- package/dist/policy.d.mts +0 -138
- package/dist/policy.d.mts.map +0 -1
- package/dist/policy.d.ts +0 -138
- package/dist/policy.d.ts.map +0 -1
- package/dist/policy.js +0 -236
- package/dist/policy.mjs +0 -205
- package/dist/policy.mjs.map +0 -1
- package/dist/session-tracker.d.mts +0 -50
- package/dist/session-tracker.d.mts.map +0 -1
- package/dist/session-tracker.d.ts +0 -50
- package/dist/session-tracker.d.ts.map +0 -1
- package/dist/session-tracker.js +0 -148
- package/dist/session-tracker.mjs +0 -147
- package/dist/session-tracker.mjs.map +0 -1
- package/dist/translate.d.mts +0 -48
- package/dist/translate.d.mts.map +0 -1
- package/dist/translate.d.ts +0 -48
- package/dist/translate.d.ts.map +0 -1
- package/dist/translate.js +0 -79
- package/dist/translate.mjs +0 -79
- package/dist/translate.mjs.map +0 -1
- package/dist/types-C0SkqLMM.d.mts +0 -102
- package/dist/types-C0SkqLMM.d.mts.map +0 -1
- package/dist/types-C7DNSCTO.d.ts +0 -102
- package/dist/types-C7DNSCTO.d.ts.map +0 -1
- package/dist/utils-Cj4XNhIY.mjs +0 -35
- package/dist/utils-Cj4XNhIY.mjs.map +0 -1
- package/dist/utils-DAisnYnI.js +0 -45
- package/dist/wasm-setup.d.mts +0 -47
- package/dist/wasm-setup.d.mts.map +0 -1
- package/dist/wasm-setup.d.ts +0 -47
- package/dist/wasm-setup.d.ts.map +0 -1
- package/dist/wasm-setup.js +0 -91
- package/dist/wasm-setup.mjs +0 -95
- package/dist/wasm-setup.mjs.map +0 -1
- package/wasm/agentshield_wasm.d.ts +0 -479
- package/wasm/agentshield_wasm.js +0 -1536
- package/wasm/agentshield_wasm_bg.wasm +0 -0
- package/wasm/package.json +0 -30
- package/wasm.d.ts +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cedar-wasm.mjs","names":[],"sources":["../src/cedar-wasm.ts"],"sourcesContent":["/**\n * The Cedar build's compiled `WebAssembly.Module`: the engine plus the Cedar\n * policy evaluator. Pass it as `withCheckpoint`'s `engineWasmModule` on the\n * Edge runtime, in place of `./engine-wasm`, and one module runs detection and\n * the project's Cedar policy:\n *\n * ```ts\n * import engineWasmModule from '@kya-os/checkpoint-nextjs/cedar-wasm';\n * export default withCheckpoint({ projectId, engineWasmModule });\n * ```\n *\n * Opt-in because it is larger than the engine-only build; a project whose\n * Cedar policy is enforcing needs it on the Edge runtime. Imported through\n * this package, the binary always matches the glue this package loads.\n */\n\nimport compiled from '@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm?module';\n\n// Typed here so the published declaration names no `?module` specifier.\nconst cedarWasmModule: WebAssembly.Module = compiled;\nexport default cedarWasmModule;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,kBAAsC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CheckpointHostConfig } from "@kya-os/checkpoint-wasm-runtime/pipeline";
|
|
2
|
+
import { NextRequest } from "next/server.js";
|
|
3
|
+
import { ClientIpTrustPolicy } from "@kya-os/checkpoint-shared";
|
|
4
|
+
//#region src/config.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for `withCheckpoint`. Every field is optional; on the Edge
|
|
7
|
+
* runtime `withCheckpoint` also needs a compiled engine module
|
|
8
|
+
* (`CheckpointEdgeConfig`).
|
|
9
|
+
*/
|
|
10
|
+
interface CheckpointConfig extends CheckpointHostConfig<NextRequest> {
|
|
11
|
+
/**
|
|
12
|
+
* Selects the infrastructure allowed to vouch for observed client addresses.
|
|
13
|
+
* Vercel headers are honored only inside its managed runtime (`VERCEL=1`).
|
|
14
|
+
* NextRequest exposes no socket peer, so generic proxy and Cloudflare origin
|
|
15
|
+
* profiles cannot authenticate that boundary and return no address. Use a
|
|
16
|
+
* transport-aware ingress, such as the Express adapter, for those profiles.
|
|
17
|
+
*/
|
|
18
|
+
clientIpPolicy?: ClientIpTrustPolicy;
|
|
19
|
+
/**
|
|
20
|
+
* Read the request body when `content-type` is `application/json` so
|
|
21
|
+
* the orchestrator can extract a KYA-OS envelope from
|
|
22
|
+
* `_meta.proof.jws`. Default `true`.
|
|
23
|
+
*
|
|
24
|
+
* **When to disable** — streaming middlewares that can't tolerate
|
|
25
|
+
* the `req.clone()` memory overhead (one full-body copy is buffered
|
|
26
|
+
* during the read). For those, set `false` and route KYA-OS
|
|
27
|
+
* envelopes through the `KYA-Delegation` header transport instead
|
|
28
|
+
* (requires `legacyEnvelopeFallback: true`).
|
|
29
|
+
*
|
|
30
|
+
* The clone preserves `req.body` for downstream handlers — disabling
|
|
31
|
+
* is a performance optimization, not a correctness fix.
|
|
32
|
+
*
|
|
33
|
+
* SDK-Envelope-Plumbing-1 (#2594). Added in `@kya-os/checkpoint-nextjs@1.1.0`.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
drainJsonBody?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* EDGE runtime only. The Cedar build's `WebAssembly.Module`. Prefer passing
|
|
40
|
+
* it as `engineWasmModule` (see there); this field is kept so existing
|
|
41
|
+
* configs work. Passed alone it serves both roles, detection and policy, on
|
|
42
|
+
* one instance. Passed next to the engine-only build it runs as a second
|
|
43
|
+
* instance, and the Edge bundle carries the engine twice (`debug` logs a
|
|
44
|
+
* hint).
|
|
45
|
+
*
|
|
46
|
+
* Without a Cedar module the project's policy is still fetched and never
|
|
47
|
+
* skipped: with no Cedar policy nothing changes, a policy in shadow mode
|
|
48
|
+
* keeps the structured decision, and an enforcing policy answers every
|
|
49
|
+
* request 503 and logs which module is missing. The Node runtime ignores
|
|
50
|
+
* this field (it loads Cedar through `createPolicyEvaluator`).
|
|
51
|
+
*
|
|
52
|
+
* Added in `@kya-os/checkpoint-nextjs@1.5.0` (@Policy middleware-Cedar, #3076).
|
|
53
|
+
*/
|
|
54
|
+
cedarWasmModule?: WebAssembly.Module;
|
|
55
|
+
/**
|
|
56
|
+
* EDGE runtime only, and required there unless `cedarWasmModule` is set.
|
|
57
|
+
* The module the engine runs on, statically imported by the host:
|
|
58
|
+
*
|
|
59
|
+
* ```ts
|
|
60
|
+
* // Detection only:
|
|
61
|
+
* import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
|
|
62
|
+
* // Detection and the project's Cedar policy, on one module:
|
|
63
|
+
* import engineWasmModule from '@kya-os/checkpoint-nextjs/cedar-wasm';
|
|
64
|
+
*
|
|
65
|
+
* export default withCheckpoint({ projectId, engineWasmModule });
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* The Cedar build is the engine plus Cedar, so it replaces the engine-only
|
|
69
|
+
* build rather than adding to it; it is larger, which is why it is opt-in.
|
|
70
|
+
* A project whose Cedar policy is enforcing needs it on the Edge runtime.
|
|
71
|
+
*
|
|
72
|
+
* The Edge runtime does not let code compile WebAssembly from bytes, so the
|
|
73
|
+
* engine cannot fetch and compile its own binary there; the bundler has to
|
|
74
|
+
* hand it over as a compiled module. The Node runtime ignores this field.
|
|
75
|
+
*/
|
|
76
|
+
engineWasmModule?: WebAssembly.Module;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `withCheckpoint` configuration for the Edge runtime (`./edge`): the engine
|
|
80
|
+
* needs a module, `engineWasmModule` or, on its own, `cedarWasmModule`.
|
|
81
|
+
*/
|
|
82
|
+
type CheckpointEdgeConfig = CheckpointConfig & ({
|
|
83
|
+
engineWasmModule: WebAssembly.Module;
|
|
84
|
+
} | {
|
|
85
|
+
cedarWasmModule: WebAssembly.Module;
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
export { CheckpointEdgeConfig as n, CheckpointConfig as t };
|
|
89
|
+
//# sourceMappingURL=config-D7h2w_it.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-D7h2w_it.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;UAkBiB,yBAAyB,qBAAqB;;;;;;;;EAQ7D,iBAAiB;;;;;;;;;;;;;;;;;;;EAoBjB;;;;;;;;;;;;;;;;;EAkBA,kBAAkB,YAAY;;;;;;;;;;;;;;;;;;;;;;EAuB9B,mBAAmB,YAAY;;;;;;KAOrB,uBAAuB;EAC9B,kBAAkB,YAAY;;EAAa,iBAAiB,YAAY"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ClientIpTrustPolicy } from "@kya-os/checkpoint-shared";
|
|
2
|
+
import { NextRequest } from "next/server.js";
|
|
3
|
+
import { CheckpointHostConfig } from "@kya-os/checkpoint-wasm-runtime/pipeline";
|
|
4
|
+
//#region src/config.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for `withCheckpoint`. Every field is optional; on the Edge
|
|
7
|
+
* runtime `withCheckpoint` also needs a compiled engine module
|
|
8
|
+
* (`CheckpointEdgeConfig`).
|
|
9
|
+
*/
|
|
10
|
+
interface CheckpointConfig extends CheckpointHostConfig<NextRequest> {
|
|
11
|
+
/**
|
|
12
|
+
* Selects the infrastructure allowed to vouch for observed client addresses.
|
|
13
|
+
* Vercel headers are honored only inside its managed runtime (`VERCEL=1`).
|
|
14
|
+
* NextRequest exposes no socket peer, so generic proxy and Cloudflare origin
|
|
15
|
+
* profiles cannot authenticate that boundary and return no address. Use a
|
|
16
|
+
* transport-aware ingress, such as the Express adapter, for those profiles.
|
|
17
|
+
*/
|
|
18
|
+
clientIpPolicy?: ClientIpTrustPolicy;
|
|
19
|
+
/**
|
|
20
|
+
* Read the request body when `content-type` is `application/json` so
|
|
21
|
+
* the orchestrator can extract a KYA-OS envelope from
|
|
22
|
+
* `_meta.proof.jws`. Default `true`.
|
|
23
|
+
*
|
|
24
|
+
* **When to disable** — streaming middlewares that can't tolerate
|
|
25
|
+
* the `req.clone()` memory overhead (one full-body copy is buffered
|
|
26
|
+
* during the read). For those, set `false` and route KYA-OS
|
|
27
|
+
* envelopes through the `KYA-Delegation` header transport instead
|
|
28
|
+
* (requires `legacyEnvelopeFallback: true`).
|
|
29
|
+
*
|
|
30
|
+
* The clone preserves `req.body` for downstream handlers — disabling
|
|
31
|
+
* is a performance optimization, not a correctness fix.
|
|
32
|
+
*
|
|
33
|
+
* SDK-Envelope-Plumbing-1 (#2594). Added in `@kya-os/checkpoint-nextjs@1.1.0`.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
drainJsonBody?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* EDGE runtime only. The Cedar build's `WebAssembly.Module`. Prefer passing
|
|
40
|
+
* it as `engineWasmModule` (see there); this field is kept so existing
|
|
41
|
+
* configs work. Passed alone it serves both roles, detection and policy, on
|
|
42
|
+
* one instance. Passed next to the engine-only build it runs as a second
|
|
43
|
+
* instance, and the Edge bundle carries the engine twice (`debug` logs a
|
|
44
|
+
* hint).
|
|
45
|
+
*
|
|
46
|
+
* Without a Cedar module the project's policy is still fetched and never
|
|
47
|
+
* skipped: with no Cedar policy nothing changes, a policy in shadow mode
|
|
48
|
+
* keeps the structured decision, and an enforcing policy answers every
|
|
49
|
+
* request 503 and logs which module is missing. The Node runtime ignores
|
|
50
|
+
* this field (it loads Cedar through `createPolicyEvaluator`).
|
|
51
|
+
*
|
|
52
|
+
* Added in `@kya-os/checkpoint-nextjs@1.5.0` (@Policy middleware-Cedar, #3076).
|
|
53
|
+
*/
|
|
54
|
+
cedarWasmModule?: WebAssembly.Module;
|
|
55
|
+
/**
|
|
56
|
+
* EDGE runtime only, and required there unless `cedarWasmModule` is set.
|
|
57
|
+
* The module the engine runs on, statically imported by the host:
|
|
58
|
+
*
|
|
59
|
+
* ```ts
|
|
60
|
+
* // Detection only:
|
|
61
|
+
* import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
|
|
62
|
+
* // Detection and the project's Cedar policy, on one module:
|
|
63
|
+
* import engineWasmModule from '@kya-os/checkpoint-nextjs/cedar-wasm';
|
|
64
|
+
*
|
|
65
|
+
* export default withCheckpoint({ projectId, engineWasmModule });
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* The Cedar build is the engine plus Cedar, so it replaces the engine-only
|
|
69
|
+
* build rather than adding to it; it is larger, which is why it is opt-in.
|
|
70
|
+
* A project whose Cedar policy is enforcing needs it on the Edge runtime.
|
|
71
|
+
*
|
|
72
|
+
* The Edge runtime does not let code compile WebAssembly from bytes, so the
|
|
73
|
+
* engine cannot fetch and compile its own binary there; the bundler has to
|
|
74
|
+
* hand it over as a compiled module. The Node runtime ignores this field.
|
|
75
|
+
*/
|
|
76
|
+
engineWasmModule?: WebAssembly.Module;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `withCheckpoint` configuration for the Edge runtime (`./edge`): the engine
|
|
80
|
+
* needs a module, `engineWasmModule` or, on its own, `cedarWasmModule`.
|
|
81
|
+
*/
|
|
82
|
+
type CheckpointEdgeConfig = CheckpointConfig & ({
|
|
83
|
+
engineWasmModule: WebAssembly.Module;
|
|
84
|
+
} | {
|
|
85
|
+
cedarWasmModule: WebAssembly.Module;
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
export { CheckpointEdgeConfig as n, CheckpointConfig as t };
|
|
89
|
+
//# sourceMappingURL=config-DkXvl4nH.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-DkXvl4nH.d.ts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;UAkBiB,yBAAyB,qBAAqB;;;;;;;;EAQ7D,iBAAiB;;;;;;;;;;;;;;;;;;;EAoBjB;;;;;;;;;;;;;;;;;EAkBA,kBAAkB,YAAY;;;;;;;;;;;;;;;;;;;;;;EAuB9B,mBAAmB,YAAY;;;;;;KAOrB,uBAAuB;EAC9B,kBAAkB,YAAY;;EAAa,iBAAiB,YAAY"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/engine-wasm.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s
|
|
4
|
+
* `engineWasmModule` on the Edge runtime:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
|
|
8
|
+
* export default withCheckpoint({ engineWasmModule });
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* `?module` is how Next.js imports a `.wasm` file as a compiled module, which
|
|
12
|
+
* the Edge runtime needs because it does not let code compile WebAssembly from
|
|
13
|
+
* bytes. Importing it through this package keeps the binary the same version
|
|
14
|
+
* as the engine glue this package loads, and works without a direct
|
|
15
|
+
* dependency on `@kya-os/checkpoint-wasm-runtime`.
|
|
16
|
+
*/
|
|
17
|
+
declare const engineWasmModule: WebAssembly.Module;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { engineWasmModule as default };
|
|
20
|
+
//# sourceMappingURL=engine-wasm.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-wasm.d.mts","names":[],"sources":["../src/engine-wasm.ts"],"mappings":";;;;;;;;;;;;;;;;cAmBM,kBAAkB,YAAY"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/engine-wasm.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s
|
|
4
|
+
* `engineWasmModule` on the Edge runtime:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
|
|
8
|
+
* export default withCheckpoint({ engineWasmModule });
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* `?module` is how Next.js imports a `.wasm` file as a compiled module, which
|
|
12
|
+
* the Edge runtime needs because it does not let code compile WebAssembly from
|
|
13
|
+
* bytes. Importing it through this package keeps the binary the same version
|
|
14
|
+
* as the engine glue this package loads, and works without a direct
|
|
15
|
+
* dependency on `@kya-os/checkpoint-wasm-runtime`.
|
|
16
|
+
*/
|
|
17
|
+
declare const engineWasmModule: WebAssembly.Module;
|
|
18
|
+
export = engineWasmModule;
|
|
19
|
+
//# sourceMappingURL=engine-wasm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-wasm.d.ts","names":[],"sources":["../src/engine-wasm.ts"],"mappings":";;;;;;;;;;;;;;;;cAmBM,kBAAkB,YAAY"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('./rolldown-runtime-C24Yb2bl.js');
|
|
2
|
+
let _kya_os_checkpoint_wasm_runtime_wasm_kya_os_engine_web_kya_os_engine_bg_wasm_module = require("@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-web/kya_os_engine_bg.wasm?module");
|
|
3
|
+
_kya_os_checkpoint_wasm_runtime_wasm_kya_os_engine_web_kya_os_engine_bg_wasm_module = require_rolldown_runtime.__toESM(_kya_os_checkpoint_wasm_runtime_wasm_kya_os_engine_web_kya_os_engine_bg_wasm_module);
|
|
4
|
+
|
|
5
|
+
//#region src/engine-wasm.ts
|
|
6
|
+
/**
|
|
7
|
+
* The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s
|
|
8
|
+
* `engineWasmModule` on the Edge runtime:
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
|
|
12
|
+
* export default withCheckpoint({ engineWasmModule });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* `?module` is how Next.js imports a `.wasm` file as a compiled module, which
|
|
16
|
+
* the Edge runtime needs because it does not let code compile WebAssembly from
|
|
17
|
+
* bytes. Importing it through this package keeps the binary the same version
|
|
18
|
+
* as the engine glue this package loads, and works without a direct
|
|
19
|
+
* dependency on `@kya-os/checkpoint-wasm-runtime`.
|
|
20
|
+
*/
|
|
21
|
+
const engineWasmModule = _kya_os_checkpoint_wasm_runtime_wasm_kya_os_engine_web_kya_os_engine_bg_wasm_module.default;
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
module.exports = engineWasmModule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import compiled from "@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-web/kya_os_engine_bg.wasm?module";
|
|
2
|
+
|
|
3
|
+
//#region src/engine-wasm.ts
|
|
4
|
+
/**
|
|
5
|
+
* The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s
|
|
6
|
+
* `engineWasmModule` on the Edge runtime:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';
|
|
10
|
+
* export default withCheckpoint({ engineWasmModule });
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* `?module` is how Next.js imports a `.wasm` file as a compiled module, which
|
|
14
|
+
* the Edge runtime needs because it does not let code compile WebAssembly from
|
|
15
|
+
* bytes. Importing it through this package keeps the binary the same version
|
|
16
|
+
* as the engine glue this package loads, and works without a direct
|
|
17
|
+
* dependency on `@kya-os/checkpoint-wasm-runtime`.
|
|
18
|
+
*/
|
|
19
|
+
const engineWasmModule = compiled;
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { engineWasmModule as default };
|
|
23
|
+
//# sourceMappingURL=engine-wasm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine-wasm.mjs","names":[],"sources":["../src/engine-wasm.ts"],"sourcesContent":["/**\n * The engine's compiled `WebAssembly.Module`, for `withCheckpoint`'s\n * `engineWasmModule` on the Edge runtime:\n *\n * ```ts\n * import engineWasmModule from '@kya-os/checkpoint-nextjs/engine-wasm';\n * export default withCheckpoint({ engineWasmModule });\n * ```\n *\n * `?module` is how Next.js imports a `.wasm` file as a compiled module, which\n * the Edge runtime needs because it does not let code compile WebAssembly from\n * bytes. Importing it through this package keeps the binary the same version\n * as the engine glue this package loads, and works without a direct\n * dependency on `@kya-os/checkpoint-wasm-runtime`.\n */\n\nimport compiled from '@kya-os/checkpoint-wasm-runtime/wasm/kya-os-engine-web/kya_os_engine_bg.wasm?module';\n\n// Typed here so the published declaration names no `?module` specifier.\nconst engineWasmModule: WebAssembly.Module = compiled;\nexport default engineWasmModule;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAM,mBAAuC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { a as EnforceResponse, c as LogDetectionInput, i as EnforceInput, l as getCheckpointApiClient, n as CheckpointApiClient, o as EnforcementAction, r as CheckpointApiClientConfig, s as EnforcementDecision, u as resetCheckpointApiClient } from "./api-client-JHOrRUA_.mjs";
|
|
2
|
+
import { n as withCheckpointApi, t as CheckpointApiMiddlewareConfig } from "./api-middleware-BtsYJU5u.mjs";
|
|
3
|
+
import { t as CheckpointConfig } from "./config-D7h2w_it.mjs";
|
|
4
|
+
import { n as CheckpointPostureOutcome, r as getCheckpointPostureOutcome, t as CheckpointPostureOptions } from "./posture-outcome-Ccujx_9V.mjs";
|
|
5
|
+
import { withCheckpoint } from "./middleware-edge.mjs";
|
|
6
|
+
import { t as VERSION } from "./middleware-core-CnPUoD2v.mjs";
|
|
7
|
+
import "./public-api-DgCw1uo6.mjs";
|
|
8
|
+
export { CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, type CheckpointPostureOptions, type CheckpointPostureOutcome, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type LogDetectionInput, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { a as EnforceResponse, c as LogDetectionInput, i as EnforceInput, l as getCheckpointApiClient, n as CheckpointApiClient, o as EnforcementAction, r as CheckpointApiClientConfig, s as EnforcementDecision, u as resetCheckpointApiClient } from "./api-client-JHOrRUA_.js";
|
|
2
|
+
import { n as withCheckpointApi, t as CheckpointApiMiddlewareConfig } from "./api-middleware-DyLDqOYF.js";
|
|
3
|
+
import { t as CheckpointConfig } from "./config-DkXvl4nH.js";
|
|
4
|
+
import { n as CheckpointPostureOutcome, r as getCheckpointPostureOutcome, t as CheckpointPostureOptions } from "./posture-outcome-Ccujx_9V.js";
|
|
5
|
+
import { withCheckpoint } from "./middleware-edge.js";
|
|
6
|
+
import { t as VERSION } from "./middleware-core-BmW2kH8J.js";
|
|
7
|
+
import "./public-api-Cw7Zj290.js";
|
|
8
|
+
export { CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, type CheckpointPostureOptions, type CheckpointPostureOutcome, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type LogDetectionInput, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_middleware_core = require('./middleware-core-B1GuspOY.js');
|
|
3
|
+
const require_posture_outcome = require('./posture-outcome-DddsJtL8.js');
|
|
4
|
+
const require_api_client = require('./api-client.js');
|
|
5
|
+
const require_api_middleware = require('./api-middleware-beNlXd5P.js');
|
|
6
|
+
const require_middleware_edge = require('./middleware-edge.js');
|
|
7
|
+
|
|
8
|
+
exports.CheckpointApiClient = require_api_client.CheckpointApiClient;
|
|
9
|
+
exports.VERSION = require_middleware_core.VERSION;
|
|
10
|
+
exports.getCheckpointApiClient = require_api_client.getCheckpointApiClient;
|
|
11
|
+
exports.getCheckpointPostureOutcome = require_posture_outcome.getCheckpointPostureOutcome;
|
|
12
|
+
exports.resetCheckpointApiClient = require_api_client.resetCheckpointApiClient;
|
|
13
|
+
exports.withCheckpoint = require_middleware_edge.withCheckpoint;
|
|
14
|
+
exports.withCheckpointApi = require_api_middleware.withCheckpointApi;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { t as VERSION } from "./middleware-core-WZeMSRqx.mjs";
|
|
2
|
+
import { t as getCheckpointPostureOutcome } from "./posture-outcome-DQ4fdMfq.mjs";
|
|
3
|
+
import { CheckpointApiClient, getCheckpointApiClient, resetCheckpointApiClient } from "./api-client.mjs";
|
|
4
|
+
import { t as withCheckpointApi } from "./api-middleware-DvmkJ_Li.mjs";
|
|
5
|
+
import { withCheckpoint } from "./middleware-edge.mjs";
|
|
6
|
+
|
|
7
|
+
export { CheckpointApiClient, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { DEFAULT_POLICY, ENFORCEMENT_ACTIONS, NextJSPolicyMiddlewareConfig, PolicyConfig, PolicyEvaluationContext, PolicyEvaluationResult, PolicyMiddlewareConfig, applyPolicy, buildBlockedResponse, buildRedirectResponse, createContextFromDetection, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getPolicy, handlePolicyDecision } from "./policy.mjs";
|
|
10
|
-
export { type AgentDetectionEvent, type AgentSession, AgentShieldClient, type AgentShieldClientConfig, type AgentShieldMiddlewareConfig, AgentShieldRequest, CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, DEFAULT_POLICY, DetectionContext, ENFORCEMENT_ACTIONS, EdgeSessionTracker, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type EnhancedMiddlewareConfig, type LogDetectionInput, NextJSMiddlewareConfig, type NextJSPolicyMiddlewareConfig, type PolicyConfig, type PolicyEvaluationContext, type PolicyEvaluationResult, type PolicyMiddlewareConfig, type SessionData, type SessionTrackingConfig, StatelessSessionChecker, type StorageAdapter, type StorageConfig, VERSION, agentShieldMiddleware, applyPolicy, buildBlockedResponse as buildPolicyBlockedResponse, buildRedirectResponse as buildPolicyRedirectResponse, createAgentShieldMiddleware, createAgentShieldMiddleware as createMiddleware, createAgentShieldMiddleware$1 as createAgentShieldMiddlewareBase, createContextFromDetection, createEnhancedAgentShieldMiddleware, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getAgentShieldClient, getCheckpointApiClient, getPolicy, handlePolicyDecision, resetAgentShieldClient, resetCheckpointApiClient, withAgentShield, withCheckpoint, withCheckpointApi };
|
|
1
|
+
import { a as EnforceResponse, c as LogDetectionInput, i as EnforceInput, l as getCheckpointApiClient, n as CheckpointApiClient, o as EnforcementAction, r as CheckpointApiClientConfig, s as EnforcementDecision, u as resetCheckpointApiClient } from "./api-client-JHOrRUA_.mjs";
|
|
2
|
+
import { n as withCheckpointApi, t as CheckpointApiMiddlewareConfig } from "./api-middleware-BtsYJU5u.mjs";
|
|
3
|
+
import { t as CheckpointConfig } from "./config-D7h2w_it.mjs";
|
|
4
|
+
import { n as CheckpointPostureOutcome, r as getCheckpointPostureOutcome, t as CheckpointPostureOptions } from "./posture-outcome-Ccujx_9V.mjs";
|
|
5
|
+
import { t as VERSION } from "./middleware-core-CnPUoD2v.mjs";
|
|
6
|
+
import "./public-api-DgCw1uo6.mjs";
|
|
7
|
+
import { withCheckpoint } from "./middleware-node.mjs";
|
|
8
|
+
export { CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, type CheckpointPostureOptions, type CheckpointPostureOutcome, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type LogDetectionInput, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { DEFAULT_POLICY, ENFORCEMENT_ACTIONS, NextJSPolicyMiddlewareConfig, PolicyConfig, PolicyEvaluationContext, PolicyEvaluationResult, PolicyMiddlewareConfig, applyPolicy, buildBlockedResponse, buildRedirectResponse, createContextFromDetection, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getPolicy, handlePolicyDecision } from "./policy.js";
|
|
10
|
-
export { type AgentDetectionEvent, type AgentSession, AgentShieldClient, type AgentShieldClientConfig, type AgentShieldMiddlewareConfig, AgentShieldRequest, CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, DEFAULT_POLICY, DetectionContext, ENFORCEMENT_ACTIONS, EdgeSessionTracker, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type EnhancedMiddlewareConfig, type LogDetectionInput, NextJSMiddlewareConfig, type NextJSPolicyMiddlewareConfig, type PolicyConfig, type PolicyEvaluationContext, type PolicyEvaluationResult, type PolicyMiddlewareConfig, type SessionData, type SessionTrackingConfig, StatelessSessionChecker, type StorageAdapter, type StorageConfig, VERSION, agentShieldMiddleware, applyPolicy, buildBlockedResponse as buildPolicyBlockedResponse, buildRedirectResponse as buildPolicyRedirectResponse, createAgentShieldMiddleware, createAgentShieldMiddleware as createMiddleware, createAgentShieldMiddleware$1 as createAgentShieldMiddlewareBase, createContextFromDetection, createEnhancedAgentShieldMiddleware, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getAgentShieldClient, getCheckpointApiClient, getPolicy, handlePolicyDecision, resetAgentShieldClient, resetCheckpointApiClient, withAgentShield, withCheckpoint, withCheckpointApi };
|
|
1
|
+
import { a as EnforceResponse, c as LogDetectionInput, i as EnforceInput, l as getCheckpointApiClient, n as CheckpointApiClient, o as EnforcementAction, r as CheckpointApiClientConfig, s as EnforcementDecision, u as resetCheckpointApiClient } from "./api-client-JHOrRUA_.js";
|
|
2
|
+
import { n as withCheckpointApi, t as CheckpointApiMiddlewareConfig } from "./api-middleware-DyLDqOYF.js";
|
|
3
|
+
import { t as CheckpointConfig } from "./config-DkXvl4nH.js";
|
|
4
|
+
import { n as CheckpointPostureOutcome, r as getCheckpointPostureOutcome, t as CheckpointPostureOptions } from "./posture-outcome-Ccujx_9V.js";
|
|
5
|
+
import { t as VERSION } from "./middleware-core-BmW2kH8J.js";
|
|
6
|
+
import "./public-api-Cw7Zj290.js";
|
|
7
|
+
import { withCheckpoint } from "./middleware-node.js";
|
|
8
|
+
export { CheckpointApiClient, type CheckpointApiClientConfig, type CheckpointApiMiddlewareConfig, type CheckpointConfig, type CheckpointPostureOptions, type CheckpointPostureOutcome, type EnforceInput, type EnforceResponse, type EnforcementAction, type EnforcementDecision, type LogDetectionInput, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
|
package/dist/index.js
CHANGED
|
@@ -1,66 +1,37 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_middleware_core = require('./middleware-core-
|
|
2
|
+
const require_middleware_core = require('./middleware-core-B1GuspOY.js');
|
|
3
3
|
const require_middleware_node = require('./middleware-node.js');
|
|
4
|
-
const
|
|
5
|
-
const require_create_middleware = require('./create-middleware.js');
|
|
4
|
+
const require_posture_outcome = require('./posture-outcome-DddsJtL8.js');
|
|
6
5
|
const require_api_client = require('./api-client.js');
|
|
7
|
-
const require_api_middleware = require('./api-middleware-
|
|
8
|
-
const require_session_tracker = require('./session-tracker.js');
|
|
9
|
-
const require_policy = require('./policy.js');
|
|
10
|
-
let _kya_os_checkpoint_shared = require("@kya-os/checkpoint-shared");
|
|
6
|
+
const require_api_middleware = require('./api-middleware-beNlXd5P.js');
|
|
11
7
|
|
|
12
8
|
//#region src/index.ts
|
|
13
9
|
/**
|
|
14
10
|
* @fileoverview Checkpoint Next.js Integration
|
|
15
11
|
* @license MIT OR Apache-2.0
|
|
12
|
+
*
|
|
13
|
+
* Two deployment shapes ship from this package:
|
|
14
|
+
*
|
|
15
|
+
* 1. `withCheckpoint` runs `kya-os-engine` in-process through WebAssembly:
|
|
16
|
+
* no network round trip per request, and every verdict comes from the
|
|
17
|
+
* engine.
|
|
18
|
+
* 2. `withCheckpointApi` sends each request to the hosted gateway instead. It
|
|
19
|
+
* is opt-in, for runtimes that cannot run WebAssembly.
|
|
20
|
+
*
|
|
21
|
+
* This is the `.` entry outside the Edge runtime, the same as `./node`: the
|
|
22
|
+
* engine's Node build, which loads its `.wasm` through `new URL(...,
|
|
23
|
+
* import.meta.url)`, so it works unbundled and when Next.js bundles `proxy.ts`
|
|
24
|
+
* or `middleware.ts` (the bundler copies the file it names). `index-edge.ts` is
|
|
25
|
+
* the `.` entry on the Edge runtime.
|
|
26
|
+
*
|
|
27
|
+
* See `README.md` ("Two deployment shapes").
|
|
16
28
|
*/
|
|
17
29
|
|
|
18
30
|
//#endregion
|
|
19
|
-
exports.AgentShieldClient = require_api_client.AgentShieldClient;
|
|
20
31
|
exports.CheckpointApiClient = require_api_client.CheckpointApiClient;
|
|
21
|
-
Object.defineProperty(exports, 'DEFAULT_POLICY', {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () {
|
|
24
|
-
return _kya_os_checkpoint_shared.DEFAULT_POLICY;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
Object.defineProperty(exports, 'ENFORCEMENT_ACTIONS', {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () {
|
|
30
|
-
return _kya_os_checkpoint_shared.ENFORCEMENT_ACTIONS;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
exports.EdgeSessionTracker = require_session_tracker.EdgeSessionTracker;
|
|
34
|
-
exports.StatelessSessionChecker = require_session_tracker.StatelessSessionChecker;
|
|
35
32
|
exports.VERSION = require_middleware_core.VERSION;
|
|
36
|
-
exports.agentShieldMiddleware = require_api_middleware.agentShieldMiddleware;
|
|
37
|
-
exports.applyPolicy = require_policy.applyPolicy;
|
|
38
|
-
exports.buildPolicyBlockedResponse = require_policy.buildBlockedResponse;
|
|
39
|
-
exports.buildPolicyRedirectResponse = require_policy.buildRedirectResponse;
|
|
40
|
-
exports.createAgentShieldMiddleware = require_create_middleware.createAgentShieldMiddleware;
|
|
41
|
-
exports.createAgentShieldMiddlewareBase = require_middleware.createAgentShieldMiddleware;
|
|
42
|
-
exports.createContextFromDetection = require_policy.createContextFromDetection;
|
|
43
|
-
exports.createEnhancedAgentShieldMiddleware = require_api_middleware.createEnhancedAgentShieldMiddleware;
|
|
44
|
-
Object.defineProperty(exports, 'createEvaluationContext', {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () {
|
|
47
|
-
return _kya_os_checkpoint_shared.createEvaluationContext;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
exports.createMiddleware = require_create_middleware.createAgentShieldMiddleware;
|
|
51
|
-
Object.defineProperty(exports, 'evaluatePolicy', {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
get: function () {
|
|
54
|
-
return _kya_os_checkpoint_shared.evaluatePolicy;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
exports.evaluatePolicyForDetection = require_policy.evaluatePolicyForDetection;
|
|
58
|
-
exports.getAgentShieldClient = require_api_client.getAgentShieldClient;
|
|
59
33
|
exports.getCheckpointApiClient = require_api_client.getCheckpointApiClient;
|
|
60
|
-
exports.
|
|
61
|
-
exports.handlePolicyDecision = require_policy.handlePolicyDecision;
|
|
62
|
-
exports.resetAgentShieldClient = require_api_client.resetAgentShieldClient;
|
|
34
|
+
exports.getCheckpointPostureOutcome = require_posture_outcome.getCheckpointPostureOutcome;
|
|
63
35
|
exports.resetCheckpointApiClient = require_api_client.resetCheckpointApiClient;
|
|
64
|
-
exports.withAgentShield = require_api_middleware.withAgentShield;
|
|
65
36
|
exports.withCheckpoint = require_middleware_node.withCheckpoint;
|
|
66
37
|
exports.withCheckpointApi = require_api_middleware.withCheckpointApi;
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
import { t as VERSION } from "./middleware-core-
|
|
1
|
+
import { t as VERSION } from "./middleware-core-WZeMSRqx.mjs";
|
|
2
2
|
import { withCheckpoint } from "./middleware-node.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as withCheckpointApi, n as createEnhancedAgentShieldMiddleware, r as withAgentShield, t as agentShieldMiddleware } from "./api-middleware-CMDRoQik.mjs";
|
|
7
|
-
import { EdgeSessionTracker, StatelessSessionChecker } from "./session-tracker.mjs";
|
|
8
|
-
import { DEFAULT_POLICY, ENFORCEMENT_ACTIONS, applyPolicy, buildBlockedResponse, buildRedirectResponse, createContextFromDetection, createEvaluationContext, evaluatePolicy, evaluatePolicyForDetection, getPolicy, handlePolicyDecision } from "./policy.mjs";
|
|
3
|
+
import { t as getCheckpointPostureOutcome } from "./posture-outcome-DQ4fdMfq.mjs";
|
|
4
|
+
import { CheckpointApiClient, getCheckpointApiClient, resetCheckpointApiClient } from "./api-client.mjs";
|
|
5
|
+
import { t as withCheckpointApi } from "./api-middleware-DvmkJ_Li.mjs";
|
|
9
6
|
|
|
10
7
|
//#region src/index.ts
|
|
11
8
|
/**
|
|
12
9
|
* @fileoverview Checkpoint Next.js Integration
|
|
13
10
|
* @license MIT OR Apache-2.0
|
|
11
|
+
*
|
|
12
|
+
* Two deployment shapes ship from this package:
|
|
13
|
+
*
|
|
14
|
+
* 1. `withCheckpoint` runs `kya-os-engine` in-process through WebAssembly:
|
|
15
|
+
* no network round trip per request, and every verdict comes from the
|
|
16
|
+
* engine.
|
|
17
|
+
* 2. `withCheckpointApi` sends each request to the hosted gateway instead. It
|
|
18
|
+
* is opt-in, for runtimes that cannot run WebAssembly.
|
|
19
|
+
*
|
|
20
|
+
* This is the `.` entry outside the Edge runtime, the same as `./node`: the
|
|
21
|
+
* engine's Node build, which loads its `.wasm` through `new URL(...,
|
|
22
|
+
* import.meta.url)`, so it works unbundled and when Next.js bundles `proxy.ts`
|
|
23
|
+
* or `middleware.ts` (the bundler copies the file it names). `index-edge.ts` is
|
|
24
|
+
* the `.` entry on the Edge runtime.
|
|
25
|
+
*
|
|
26
|
+
* See `README.md` ("Two deployment shapes").
|
|
14
27
|
*/
|
|
15
28
|
|
|
16
29
|
//#endregion
|
|
17
|
-
export {
|
|
30
|
+
export { CheckpointApiClient, VERSION, getCheckpointApiClient, getCheckpointPostureOutcome, resetCheckpointApiClient, withCheckpoint, withCheckpointApi };
|
|
18
31
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @fileoverview Checkpoint Next.js Integration\n * @license MIT OR Apache-2.0\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @fileoverview Checkpoint Next.js Integration\n * @license MIT OR Apache-2.0\n *\n * Two deployment shapes ship from this package:\n *\n * 1. `withCheckpoint` runs `kya-os-engine` in-process through WebAssembly:\n * no network round trip per request, and every verdict comes from the\n * engine.\n * 2. `withCheckpointApi` sends each request to the hosted gateway instead. It\n * is opt-in, for runtimes that cannot run WebAssembly.\n *\n * This is the `.` entry outside the Edge runtime, the same as `./node`: the\n * engine's Node build, which loads its `.wasm` through `new URL(...,\n * import.meta.url)`, so it works unbundled and when Next.js bundles `proxy.ts`\n * or `middleware.ts` (the bundler copies the file it names). `index-edge.ts` is\n * the `.` entry on the Edge runtime.\n *\n * See `README.md` (\"Two deployment shapes\").\n */\n\nexport { withCheckpoint } from './middleware-node';\nexport * from './public-api';\n"],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CheckpointConfig } from "./config-
|
|
1
|
+
import { t as CheckpointConfig } from "./config-D7h2w_it.mjs";
|
|
2
2
|
//#region src/middleware-bundler.d.ts
|
|
3
3
|
/** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */
|
|
4
4
|
export declare function withCheckpoint(config: CheckpointConfig): (req: import("next/server").NextRequest, event?: Pick<import("next/server").NextFetchEvent, "waitUntil">) => Promise<import("next/server").NextResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-bundler.d.mts","names":[],"sources":["../src/middleware-bundler.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"middleware-bundler.d.mts","names":[],"sources":["../src/middleware-bundler.ts"],"mappings":";;;wBAMgB,eAAe,QAAQ,oBAAgB,2BAAA,aAAA,QAAA,2BAAA,iCAAA,8BAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CheckpointConfig } from "./config-
|
|
1
|
+
import { t as CheckpointConfig } from "./config-DkXvl4nH.js";
|
|
2
2
|
//#region src/middleware-bundler.d.ts
|
|
3
3
|
/** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */
|
|
4
4
|
export declare function withCheckpoint(config: CheckpointConfig): (req: import("next/server").NextRequest, event?: Pick<import("next/server").NextFetchEvent, "waitUntil">) => Promise<import("next/server").NextResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-bundler.d.ts","names":[],"sources":["../src/middleware-bundler.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"middleware-bundler.d.ts","names":[],"sources":["../src/middleware-bundler.ts"],"mappings":";;;wBAMgB,eAAe,QAAQ,oBAAgB,2BAAA,aAAA,QAAA,2BAAA,iCAAA,8BAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_middleware_core = require('./middleware-core-
|
|
3
|
-
const require_middleware_node_context = require('./middleware-node-context-
|
|
4
|
-
let _kya_os_checkpoint_wasm_runtime_orchestrator_bundler = require("@kya-os/checkpoint-wasm-runtime/orchestrator/bundler");
|
|
2
|
+
const require_middleware_core = require('./middleware-core-B1GuspOY.js');
|
|
3
|
+
const require_middleware_node_context = require('./middleware-node-context-TRMTgp3y.js');
|
|
5
4
|
|
|
6
5
|
//#region src/middleware-bundler.ts
|
|
7
6
|
/** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */
|
|
8
7
|
function withCheckpoint(config) {
|
|
9
|
-
return require_middleware_core.makeNextMiddleware(
|
|
8
|
+
return require_middleware_core.makeNextMiddleware(config, {
|
|
10
9
|
runtime: "node",
|
|
11
|
-
|
|
10
|
+
loadEngine: () => import("@kya-os/checkpoint-wasm-runtime/orchestrator/bundler"),
|
|
11
|
+
policyCompiler: require_middleware_node_context.nodePolicyCompiler
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { n as makeNextMiddleware } from "./middleware-core-
|
|
2
|
-
import { t as
|
|
3
|
-
import { renderDecisionAsResponse, verifyRequest } from "@kya-os/checkpoint-wasm-runtime/orchestrator/bundler";
|
|
1
|
+
import { n as makeNextMiddleware } from "./middleware-core-WZeMSRqx.mjs";
|
|
2
|
+
import { t as nodePolicyCompiler } from "./middleware-node-context-BvqrL2Ra.mjs";
|
|
4
3
|
|
|
5
4
|
//#region src/middleware-bundler.ts
|
|
6
5
|
/** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */
|
|
7
6
|
function withCheckpoint(config) {
|
|
8
|
-
return makeNextMiddleware(
|
|
7
|
+
return makeNextMiddleware(config, {
|
|
9
8
|
runtime: "node",
|
|
10
|
-
|
|
9
|
+
loadEngine: () => import("@kya-os/checkpoint-wasm-runtime/orchestrator/bundler"),
|
|
10
|
+
policyCompiler: nodePolicyCompiler
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-bundler.mjs","names":[],"sources":["../src/middleware-bundler.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"middleware-bundler.mjs","names":[],"sources":["../src/middleware-bundler.ts"],"sourcesContent":["import { makeNextMiddleware } from './middleware-core';\nimport { nodePolicyCompiler } from './middleware-node-context';\nimport type { CheckpointConfig } from './config';\nexport type { CheckpointConfig } from './config';\n\n/** Next.js server bundlers import the WASM asset rather than relocating a Node fs read. */\nexport function withCheckpoint(config: CheckpointConfig) {\n return makeNextMiddleware(config, {\n runtime: 'node',\n // Imported on first use: a failure to load the engine is then answered 503\n // per request instead of failing this module.\n loadEngine: () => import('@kya-os/checkpoint-wasm-runtime/orchestrator/bundler'),\n policyCompiler: nodePolicyCompiler,\n });\n}\n"],"mappings":";;;;;AAMA,SAAgB,eAAe,QAA0B;CACvD,OAAO,mBAAmB,QAAQ;EAChC,SAAS;EAGT,kBAAkB,OAAO;EACzB,gBAAgB;CAClB,CAAC;AACH"}
|