Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

# A/B Testing — FastEdge Example
Expand Down Expand Up @@ -190,7 +190,7 @@ Iterates each test in `testConfig`, maps `xid * 100` into the normalized variant
"build": "fastedge-build src/index.js dist/ab-testing.wasm"
},
"dependencies": {
"@gcoredev/fastedge-sdk-js": "^2.3.0"
"@gcoredev/fastedge-sdk-js": "^2.5.2"
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

# Authentication Patterns (JavaScript)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

# FastEdge Cache — JavaScript Examples

**Module**: `fastedge::cache`
**Import**: `import { Cache } from 'fastedge::cache';`
**SDK**: `@gcoredev/fastedge-sdk-js` `^2.3.0`
**SDK**: `@gcoredev/fastedge-sdk-js` `^2.5.2`
**App type**: HTTP
**Language**: TypeScript / JavaScript

Expand Down Expand Up @@ -305,7 +305,7 @@ Validation errors (e.g., conflicting `WriteOptions`) are thrown synchronously. H
{
"type": "module",
"scripts": { "build": "fastedge-build -c" },
"dependencies": { "@gcoredev/fastedge-sdk-js": "^2.3.0" }
"dependencies": { "@gcoredev/fastedge-sdk-js": "^2.5.2" }
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

## fetch — Outbound HTTP Requests
Expand Down Expand Up @@ -55,7 +55,7 @@ addEventListener('fetch', (event) => {

| Package | Version |
|---------|---------|
| `@gcoredev/fastedge-sdk-js` | `^2.2.2` |
| `@gcoredev/fastedge-sdk-js` | `^2.5.2` |

**Build command**: `fastedge-build src/index.js dist/outbound-fetch.wasm`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

## Example: Geo-Redirect
Expand All @@ -23,7 +23,7 @@ Redirects incoming requests to different origins based on the visitor's country,

| Package | Version |
|---|---|
| `@gcoredev/fastedge-sdk-js` | `^2.3.0` |
| `@gcoredev/fastedge-sdk-js` | `^2.5.2` |

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

## Headers Example — FastEdge JS
Expand Down Expand Up @@ -178,11 +178,11 @@ All method names are **case-insensitive** with respect to the header name argume
"build": "fastedge-build src/index.js dist/headers.wasm"
},
"dependencies": {
"@gcoredev/fastedge-sdk-js": "^2.3.0"
"@gcoredev/fastedge-sdk-js": "^2.5.2"
}
}
```

- `"type": "module"` — ES module syntax required (`import`/`export`).
- Build output: `dist/headers.wasm` — the binary uploaded to FastEdge.
- SDK version: `@gcoredev/fastedge-sdk-js ^2.3.0`.
- SDK version: `@gcoredev/fastedge-sdk-js ^2.5.2`.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

# Hono Patterns on FastEdge (JavaScript/TypeScript)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

## KV Store — Example Reference
Expand Down Expand Up @@ -291,7 +291,7 @@ export const stringifyValueScoreTuples = (tupleList: Array<[ArrayBuffer, number]
"description": "FastEdge JS example: KV Store operations via query params",
"type": "module",
"scripts": { "build": "fastedge-build -c" },
"dependencies": { "@gcoredev/fastedge-sdk-js": "^2.3.0" }
"dependencies": { "@gcoredev/fastedge-sdk-js": "^2.5.2" }
}
```

Expand Down Expand Up @@ -326,6 +326,6 @@ TypeScript types for FastEdge globals (`FetchEvent`, etc.) are provided by `@gco
- `bfExists` returning `true` is probabilistic (Bloom filter); `false` is definitive.
- `min` and `max` for `zrangeByScore` are parsed from query strings with `Number.parseFloat` — ensure numeric string inputs.
- `"type": "module"` must be set in `package.json` for ESM compatibility with `fastedge-build`.
- The SDK dependency version is `^2.3.0`.
- The SDK dependency version is `^2.5.2`.
- `tsconfig.json` `target` is `ES2023`; `moduleResolution` is `Bundler`; `lib` is `["ES2023"]`; `types` is `["@gcoredev/fastedge-sdk-js"]`.
- Empty string values for required query parameters are treated as missing — validation rejects them the same as absent params.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

# Proxy and Response Transform Patterns (JavaScript/TypeScript)
Expand Down Expand Up @@ -69,7 +69,7 @@ addEventListener("fetch", (event) => {
});
```

**Gotcha:** `.json()`, `.text()`, and `.arrayBuffer()` are one-shot body consumers — calling any of them exhausts the body stream. You cannot read the body a second time from the same `Response`. If you need the raw bytes and a parsed value, read with `.arrayBuffer()` once, then parse from that buffer.
**Gotcha:** `.json()`, `.text()`, and `.arrayBuffer()` are one-shot body consumers — calling any of them exhausts the body stream. You cannot read the body a second time from the same `Response`. If you need both the raw bytes and a parsed value, read with `.arrayBuffer()` once, then parse from that buffer.

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

# FastEdge JS Runtime — Constraints & Compatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

# FastEdge JavaScript Quickstart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

# JavaScript SDK Reference (`@gcoredev/fastedge-sdk-js`)
Expand Down
4 changes: 2 additions & 2 deletions plugins/gcore-fastedge/skills/scaffold/reference/build-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

## fastedge-build CLI Reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

---
Expand All @@ -29,7 +29,7 @@ No additional npm dependencies beyond the base skeleton. Uses the `fastedge::env
```json
{
"dependencies": {
"@gcoredev/fastedge-sdk-js": "^2.3.0"
"@gcoredev/fastedge-sdk-js": "^2.5.2"
}
}
```
Expand Down Expand Up @@ -366,7 +366,7 @@ const createAbTestHeaders = (reqHeaders, testConfig, xid) => {
"build": "fastedge-build src/index.js dist/ab-testing.wasm"
},
"dependencies": {
"@gcoredev/fastedge-sdk-js": "^2.3.0"
"@gcoredev/fastedge-sdk-js": "^2.5.2"
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

---
Expand All @@ -14,7 +14,7 @@ languages: [typescript, javascript]
template_origin: http-base
source_repo: https://github.com/G-Core/FastEdge-sdk-js
source_ref: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
---

# Base Skeleton: HTTP TypeScript/JavaScript
Expand Down Expand Up @@ -186,7 +186,7 @@ addEventListener("fetch", (event) => {
"build": "fastedge-build src/index.js dist/hello-world.wasm"
},
"dependencies": {
"@gcoredev/fastedge-sdk-js": "^2.3.0"
"@gcoredev/fastedge-sdk-js": "^2.5.2"
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
auto-updated: true
sources:
- id: fastedge-sdk-js
ref: main
ref: v2.5.2
commit: 9c8c7886f0d1ec5ac2296b4080805966a96ca817
updated: 2026-09-22
updated: 2026-10-02
-->

---
Expand Down Expand Up @@ -160,7 +160,7 @@ Entry point: `src/index.js`. Output: `dist/bloom-filter-denylist.wasm`. Build to
**Dependencies:**

```json
"@gcoredev/fastedge-sdk-js": "^2.2.2"
"@gcoredev/fastedge-sdk-js": "^2.5.2"
```

## False-Positive Trade-off
Expand All @@ -176,67 +176,3 @@ Bloom filters guarantee no false negatives (an IP absent from the set is never b
- fastedge::env reference
- fastedge-build CLI reference
- KV store setup and bloom-filter payload upload guide

## Source Material

### FILE: examples/bloom-filter-denylist/src/index.js

```js
import { getEnv } from 'fastedge::env';
import { KvStore } from 'fastedge::kv';

const BLOOM_KEY = 'blocked-ips';

function app(event) {
const storeName = getEnv('DENYLIST_STORE');
if (!storeName) {
return Response.json(
{ error: 'DENYLIST_STORE environment variable is not configured' },
{ status: 500 },
);
}

const ip = event.client.address;
if (!ip) {
return Response.json({ error: 'client address unavailable' }, { status: 500 });
}

let blocked;
try {
const store = KvStore.open(storeName);
blocked = store.bfExists(BLOOM_KEY, ip);
} catch (error) {
return Response.json({ error: `KV lookup failed: ${error.message}` }, { status: 500 });
}

if (blocked) {
// Bloom filter says "maybe in set" — a small fraction of hits will be false positives.
// Acceptable for a denylist (you over-block some legitimate users); not acceptable for
// allowlists or anything requiring exact membership — use KvStore.get() for that.
return Response.json({ allowed: false, ip }, { status: 403 });
}

return Response.json({ allowed: true, ip });
}

addEventListener('fetch', (event) => {
event.respondWith(app(event));
});
```

### FILE: examples/bloom-filter-denylist/package.json

```json
{
"name": "fastedge-example-bloom-filter-denylist",
"version": "1.0.0",
"description": "FastEdge JS example: IP denylist using a KV Store bloom filter",
"type": "module",
"scripts": {
"build": "fastedge-build src/index.js dist/bloom-filter-denylist.wasm"
},
"dependencies": {
"@gcoredev/fastedge-sdk-js": "^2.2.2"
}
}
```
Loading
Loading