@pulse-compute/cli 0.0.0 → 1.0.0-beta.1
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/API.md +539 -0
- package/CHANGELOG.md +47 -0
- package/README.md +70 -1
- package/bin/pulse.js +15 -0
- package/bin/pulsewasm-extract.js +22 -0
- package/cli-spec.json +575 -0
- package/completions/_pulse +106 -0
- package/completions/pulse.bash +31 -0
- package/completions/pulse.fish +76 -0
- package/docs/README.md +77 -0
- package/docs/architecture/current-contracts.md +381 -0
- package/docs/architecture/overview.md +93 -0
- package/docs/architecture/vision.md +515 -0
- package/docs/concepts/bodies.md +186 -0
- package/docs/concepts/compilation-and-lowering.md +496 -0
- package/docs/concepts/contracts-and-providers.md +158 -0
- package/docs/concepts/effects-and-continuations.md +243 -0
- package/docs/concepts/entities-and-adapters.md +71 -0
- package/docs/concepts/package-owned-lowering.md +175 -0
- package/docs/concepts/targets-and-hosts.md +62 -0
- package/docs/contributing/README.md +38 -0
- package/docs/contributing/adding-core-provider.md +315 -0
- package/docs/contributing/adding-first-party-lowerer.md +327 -0
- package/docs/contributing/entities-lowering.md +91 -0
- package/docs/contributing/package-lowerer-contract.md +383 -0
- package/docs/contributing/pulse-aware-packages.md +149 -0
- package/docs/examples.md +112 -0
- package/docs/fixtures/inspect-fetch-composition.selected.json +181 -0
- package/docs/getting-started.md +128 -0
- package/docs/guides/compatibility-imports.md +60 -0
- package/docs/guides/deploying-fastly.md +188 -0
- package/docs/guides/deploying-node.md +143 -0
- package/docs/guides/events.md +233 -0
- package/docs/guides/fastly-capabilities.md +153 -0
- package/docs/guides/fetching-and-composition.md +101 -0
- package/docs/guides/grip.md +94 -0
- package/docs/guides/json-schemas.md +233 -0
- package/docs/guides/migrating-from-express.md +192 -0
- package/docs/guides/project-lifecycle.md +143 -0
- package/docs/guides/routing.md +184 -0
- package/docs/guides/troubleshooting.md +47 -0
- package/docs/maintainers/README.md +60 -0
- package/docs/maintainers/codex-maintainer.md +71 -0
- package/docs/maintainers/documentation-deployment.md +147 -0
- package/docs/maintainers/documentation-system.md +58 -0
- package/docs/maintainers/documentation-versioning.md +65 -0
- package/docs/maintainers/maintainer-charter.md +84 -0
- package/docs/maintainers/maintenance-policy.json +778 -0
- package/docs/maintainers/maintenance-policy.md +124 -0
- package/docs/maintainers/npm-publishing.md +154 -0
- package/docs/maintainers/plugin-readiness.json +19 -0
- package/docs/maintainers/plugin-readiness.md +31 -0
- package/docs/maintainers/public-site.md +158 -0
- package/docs/maintainers/release-acceptance.md +250 -0
- package/docs/maintainers/release-manifest.md +88 -0
- package/docs/maintainers/repository-setup.md +145 -0
- package/docs/maintainers/scope-policy.md +93 -0
- package/docs/maintainers/support-and-triage.md +74 -0
- package/docs/maintainers/testing.md +288 -0
- package/docs/packages/README.md +59 -0
- package/docs/packages/assets.md +85 -0
- package/docs/packages/cli.md +190 -0
- package/docs/packages/crypto.md +71 -0
- package/docs/packages/entities.md +129 -0
- package/docs/packages/grip.md +82 -0
- package/docs/packages/implementation-packages.md +113 -0
- package/docs/packages/jwt.md +55 -0
- package/docs/packages/provider-fastly.md +217 -0
- package/docs/packages/pulse.md +159 -0
- package/docs/packages/runtime.md +256 -0
- package/docs/preview-scope.md +142 -0
- package/docs/reference/README.md +33 -0
- package/docs/reference/cli-spec.json +575 -0
- package/docs/reference/cli.md +457 -0
- package/docs/reference/compatibility-matrix.md +169 -0
- package/docs/reference/diagnostics.md +1872 -0
- package/docs/reference/documentation-versions.json +14 -0
- package/docs/reference/environment.md +347 -0
- package/docs/reference/handler-authoring.md +264 -0
- package/docs/reference/project-config.md +554 -0
- package/docs/reference/project-config.schema.json +918 -0
- package/docs/reference/release-manifest.json +427 -0
- package/docs/reference/shell-completion.md +23 -0
- package/documentation-site.json +661 -0
- package/documentation-versions.json +14 -0
- package/examples/01-hello-json/.pulse/.gitignore +3 -0
- package/examples/01-hello-json/.pulse/config.ts +16 -0
- package/examples/01-hello-json/README.md +119 -0
- package/examples/01-hello-json/package.json +20 -0
- package/examples/01-hello-json/src/index.ts +9 -0
- package/examples/01-hello-json/tests/pulse.harness.ts +22 -0
- package/examples/01-hello-json/tsconfig.json +14 -0
- package/examples/02-request-schema/.pulse/.gitignore +3 -0
- package/examples/02-request-schema/.pulse/config.ts +17 -0
- package/examples/02-request-schema/README.md +145 -0
- package/examples/02-request-schema/package.json +20 -0
- package/examples/02-request-schema/src/index.ts +18 -0
- package/examples/02-request-schema/src/schemas.ts +20 -0
- package/examples/02-request-schema/tests/pulse.harness.ts +37 -0
- package/examples/02-request-schema/tsconfig.json +14 -0
- package/examples/03-fetch-composition/.pulse/.gitignore +3 -0
- package/examples/03-fetch-composition/.pulse/config.ts +31 -0
- package/examples/03-fetch-composition/README.md +210 -0
- package/examples/03-fetch-composition/package.json +20 -0
- package/examples/03-fetch-composition/src/index.ts +60 -0
- package/examples/03-fetch-composition/tests/pulse.harness.ts +47 -0
- package/examples/03-fetch-composition/tsconfig.json +14 -0
- package/examples/05-fastly-capabilities/.pulse/.gitignore +3 -0
- package/examples/05-fastly-capabilities/.pulse/config.ts +57 -0
- package/examples/05-fastly-capabilities/README.md +257 -0
- package/examples/05-fastly-capabilities/package.json +22 -0
- package/examples/05-fastly-capabilities/src/index.ts +55 -0
- package/examples/05-fastly-capabilities/tests/pulse.harness.ts +66 -0
- package/examples/05-fastly-capabilities/tsconfig.json +14 -0
- package/examples/07-opaque-proxy/.pulse/.gitignore +3 -0
- package/examples/07-opaque-proxy/.pulse/config.ts +38 -0
- package/examples/07-opaque-proxy/README.md +150 -0
- package/examples/07-opaque-proxy/package.json +21 -0
- package/examples/07-opaque-proxy/src/index.ts +9 -0
- package/examples/07-opaque-proxy/tests/pulse.harness.ts +25 -0
- package/examples/07-opaque-proxy/tsconfig.json +14 -0
- package/examples/09-router-lowering/.pulse/.gitignore +3 -0
- package/examples/09-router-lowering/.pulse/config.ts +22 -0
- package/examples/09-router-lowering/README.md +287 -0
- package/examples/09-router-lowering/package.json +22 -0
- package/examples/09-router-lowering/src/index.ts +65 -0
- package/examples/09-router-lowering/tests/pulse.harness.ts +91 -0
- package/examples/09-router-lowering/tsconfig.json +14 -0
- package/examples/10-entities-tools/.pulse/.gitignore +4 -0
- package/examples/10-entities-tools/.pulse/config.ts +23 -0
- package/examples/10-entities-tools/README.md +165 -0
- package/examples/10-entities-tools/package.json +21 -0
- package/examples/10-entities-tools/src/handlers.ts +15 -0
- package/examples/10-entities-tools/src/index.ts +31 -0
- package/examples/10-entities-tools/src/schemas.ts +18 -0
- package/examples/10-entities-tools/tests/pulse.harness.ts +40 -0
- package/examples/10-entities-tools/tools-facade.cjs +158 -0
- package/examples/10-entities-tools/tsconfig.json +14 -0
- package/examples/11-events/.pulse/.gitignore +4 -0
- package/examples/11-events/.pulse/config.ts +24 -0
- package/examples/11-events/README.md +194 -0
- package/examples/11-events/package.json +20 -0
- package/examples/11-events/src/index.ts +27 -0
- package/examples/11-events/src/schemas.ts +19 -0
- package/examples/11-events/tests/pulse.harness.ts +34 -0
- package/examples/11-events/tsconfig.json +15 -0
- package/examples/12-mcp-proxy/.pulse/.gitignore +3 -0
- package/examples/12-mcp-proxy/.pulse/config.ts +25 -0
- package/examples/12-mcp-proxy/README.md +149 -0
- package/examples/12-mcp-proxy/package.json +20 -0
- package/examples/12-mcp-proxy/src/index.ts +17 -0
- package/examples/12-mcp-proxy/tests/pulse.harness.ts +29 -0
- package/examples/12-mcp-proxy/tsconfig.json +14 -0
- package/examples/13-jwt-es256/.pulse/config.ts +19 -0
- package/examples/13-jwt-es256/README.md +195 -0
- package/examples/13-jwt-es256/package.json +21 -0
- package/examples/13-jwt-es256/src/index.ts +21 -0
- package/examples/13-jwt-es256/tests/pulse.harness.ts +54 -0
- package/examples/13-jwt-es256/tsconfig.json +14 -0
- package/examples/README.md +36 -0
- package/package.json +66 -6
- package/project-config.schema.json +918 -0
- package/release-manifest.json +427 -0
- package/src/command-spec.js +279 -0
- package/src/completion.js +113 -0
- package/src/diagnostics.js +350 -0
- package/src/documentation.js +45 -0
- package/src/index.d.ts +133 -0
- package/src/index.js +15 -0
- package/src/internal/command-executor.d.ts +29 -0
- package/src/internal/command-executor.js +143 -0
- package/src/internal/command-plan.d.ts +9 -0
- package/src/internal/command-plan.js +73 -0
- package/src/internal/command-reporter.d.ts +15 -0
- package/src/internal/command-reporter.js +133 -0
- package/src/internal/command-request.d.ts +35 -0
- package/src/internal/command-request.js +154 -0
- package/src/internal/node-http.js +54 -0
- package/src/internal/project-context.d.ts +66 -0
- package/src/internal/project-context.js +175 -0
- package/src/project-config-reference.js +4 -0
- package/src/project-config-schema.d.ts +23 -0
- package/src/project-config-schema.js +271 -0
- package/src/project-config.js +724 -0
- package/src/project-execution.js +2930 -0
- package/src/provider-drivers.js +3 -0
- package/src/target-support.js +3 -0
- package/src/typescript-module-loader.js +269 -0
- package/src/workflow.js +78 -0
- package/src/workspace.js +82 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { grip } from '@pulse-compute/grip'
|
|
2
|
+
import { Pulse } from '@pulse-compute/pulse'
|
|
3
|
+
|
|
4
|
+
interface User {
|
|
5
|
+
id: number
|
|
6
|
+
name: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface Session {
|
|
10
|
+
userId: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const app = new Pulse({ auto: true })
|
|
14
|
+
|
|
15
|
+
// Config, secret, and a named Fastly backend.
|
|
16
|
+
app.get('/users/7', async (ctx) => {
|
|
17
|
+
const base = await ctx.config.get('API_BASE')
|
|
18
|
+
const token = await ctx.secret.get('API_TOKEN')
|
|
19
|
+
const user = await ctx
|
|
20
|
+
.fetch('https://api.example.com/users/7', {
|
|
21
|
+
headers: {
|
|
22
|
+
authorization: `Bearer ${token}`,
|
|
23
|
+
accept: 'application/json',
|
|
24
|
+
'x-api-base': base,
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
.json<User>()
|
|
28
|
+
return ctx.json({ user })
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Named Fastly KV storage.
|
|
32
|
+
app.get('/session', async (ctx) => {
|
|
33
|
+
const current = await ctx.kv<Session>('sessions').get('session:123')
|
|
34
|
+
if (current === undefined) {
|
|
35
|
+
return ctx.json({ error: 'not_found' }, { status: 404 })
|
|
36
|
+
}
|
|
37
|
+
await ctx.kv<Session>('sessions').put('session:last', current)
|
|
38
|
+
return ctx.json({ session: current })
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
// Request-bound GRIP broadcast through the supported package root.
|
|
42
|
+
app.post('/publish', async (ctx) => {
|
|
43
|
+
const acknowledgement = await grip.broadcast(ctx, {
|
|
44
|
+
channel: 'events:demo',
|
|
45
|
+
event: 'pulse.message',
|
|
46
|
+
id: 'message-1',
|
|
47
|
+
data: { message: 'hello from Pulse' },
|
|
48
|
+
})
|
|
49
|
+
return ctx.json(
|
|
50
|
+
{ accepted: acknowledgement.accepted },
|
|
51
|
+
{ status: 202 },
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
export default app
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const config = { API_BASE: 'https://api.example.com' }
|
|
2
|
+
const secrets = {
|
|
3
|
+
API_TOKEN: 'test-example-secret',
|
|
4
|
+
GRIP_TOKEN: 'test-grip-secret',
|
|
5
|
+
}
|
|
6
|
+
const grip = {
|
|
7
|
+
publishEndpoint: 'https://publisher.example.com/publish',
|
|
8
|
+
authentication: {
|
|
9
|
+
scheme: 'bearer',
|
|
10
|
+
secretRef: 'GRIP_TOKEN',
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
cases: [
|
|
16
|
+
{
|
|
17
|
+
name: 'configured-fetch',
|
|
18
|
+
request: { path: '/users/7' },
|
|
19
|
+
config,
|
|
20
|
+
secrets,
|
|
21
|
+
fetches: {
|
|
22
|
+
'https://api.example.com/users/7': {
|
|
23
|
+
value: { id: 7, name: 'Ada' },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
expect: {
|
|
27
|
+
status: 200,
|
|
28
|
+
json: { user: { id: 7, name: 'Ada' } },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'session-hit',
|
|
33
|
+
request: { path: '/session' },
|
|
34
|
+
kv: { sessions: { 'session:123': { userId: 123 } } },
|
|
35
|
+
expect: {
|
|
36
|
+
status: 200,
|
|
37
|
+
json: { session: { userId: 123 } },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'session-miss',
|
|
42
|
+
request: { path: '/session' },
|
|
43
|
+
kv: { sessions: {} },
|
|
44
|
+
expect: {
|
|
45
|
+
status: 404,
|
|
46
|
+
json: { error: 'not_found' },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'grip-broadcast',
|
|
51
|
+
request: { method: 'POST', path: '/publish' },
|
|
52
|
+
secrets,
|
|
53
|
+
grip,
|
|
54
|
+
fetches: {
|
|
55
|
+
'POST https://publisher.example.com/publish': {
|
|
56
|
+
status: 202,
|
|
57
|
+
value: { accepted: true, messageId: 'message-1' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
expect: {
|
|
61
|
+
status: 202,
|
|
62
|
+
json: { accepted: true },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineConfig } from '@pulse-compute/pulse'
|
|
2
|
+
|
|
3
|
+
export default defineConfig((_scope) => ({
|
|
4
|
+
pulse: {
|
|
5
|
+
entry: 'src/index.ts',
|
|
6
|
+
tests: 'tests/pulse.harness.ts',
|
|
7
|
+
defaultProfile: 'local',
|
|
8
|
+
strict: true,
|
|
9
|
+
},
|
|
10
|
+
local: {
|
|
11
|
+
host: 'fastly',
|
|
12
|
+
target: 'native',
|
|
13
|
+
outDir: 'dist',
|
|
14
|
+
dev: {
|
|
15
|
+
fetches: {
|
|
16
|
+
'https://assets.example.com/archive.bin': {
|
|
17
|
+
opaque: true,
|
|
18
|
+
status: 206,
|
|
19
|
+
headers: [
|
|
20
|
+
['content-type', 'application/octet-stream'],
|
|
21
|
+
['x-part', 'one'],
|
|
22
|
+
['x-part', 'two'],
|
|
23
|
+
],
|
|
24
|
+
chunks: ['opaque-example'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
fastly: {
|
|
29
|
+
bindings: {
|
|
30
|
+
backends: {
|
|
31
|
+
'https://assets.example.com': 'assets_backend',
|
|
32
|
+
},
|
|
33
|
+
dynamicBackends: false,
|
|
34
|
+
},
|
|
35
|
+
build: { name: 'pulse-opaque-proxy-example' },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}))
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Opaque binary proxy
|
|
2
|
+
|
|
3
|
+
Returns an origin response directly. The binary or streaming body stays
|
|
4
|
+
host-owned and is never decoded or copied into user scope.
|
|
5
|
+
|
|
6
|
+
## Workflow
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pulse doctor
|
|
10
|
+
pulse inspect
|
|
11
|
+
pulse test
|
|
12
|
+
pulse dev
|
|
13
|
+
pulse build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The documented test result below is executed by the documentation gate.
|
|
17
|
+
|
|
18
|
+
<!-- pulse-doc-run {"project":"examples/07-opaque-proxy","args":["test","--json"]} -->
|
|
19
|
+
```bash
|
|
20
|
+
pulse test --json
|
|
21
|
+
```
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"status": "passed",
|
|
25
|
+
"provider": "fastly",
|
|
26
|
+
"summary": {
|
|
27
|
+
"total": 1,
|
|
28
|
+
"passed": 1,
|
|
29
|
+
"failed": 0
|
|
30
|
+
},
|
|
31
|
+
"cases": [
|
|
32
|
+
{
|
|
33
|
+
"name": "pass-through",
|
|
34
|
+
"status": "passed",
|
|
35
|
+
"response": {
|
|
36
|
+
"status": 206
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Fastly builds produce a verified `.pulse-docs-build/bin/main.wasm`. Configured
|
|
44
|
+
tests execute through the local-conformance runtime; compiled-target execution
|
|
45
|
+
remains in the explicit reality profile.
|
|
46
|
+
|
|
47
|
+
## Wasm size
|
|
48
|
+
|
|
49
|
+
| Artifact | Default build | `--experimental-native-size` | Reduction |
|
|
50
|
+
|---|---:|---:|---:|
|
|
51
|
+
| `canonical-native.wasm` | 2.1 KiB (2,200 bytes) | 2.1 KiB (2,101 bytes) | 4.5% |
|
|
52
|
+
| `bin/main.wasm` | 28.9 KiB (29,602 bytes) | 25.3 KiB (25,953 bytes) | 12.3% |
|
|
53
|
+
|
|
54
|
+
The executable documentation gate rebuilds and measures both variants on
|
|
55
|
+
`1.0.0-beta.1`. These are uncompressed on-disk sizes, not transfer sizes or
|
|
56
|
+
platform limits.
|
|
57
|
+
|
|
58
|
+
## Handler
|
|
59
|
+
|
|
60
|
+
<!-- pulse-doc-source: examples/07-opaque-proxy/src/index.ts -->
|
|
61
|
+
```ts
|
|
62
|
+
import { Pulse } from '@pulse-compute/pulse'
|
|
63
|
+
|
|
64
|
+
const app = new Pulse({ auto: true })
|
|
65
|
+
|
|
66
|
+
app.get('/archive', async (ctx) => {
|
|
67
|
+
return ctx.fetch('https://assets.example.com/archive.bin')
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
export default app
|
|
71
|
+
```
|
|
72
|
+
<!-- /pulse-doc-source -->
|
|
73
|
+
|
|
74
|
+
## Project config
|
|
75
|
+
|
|
76
|
+
<!-- pulse-doc-source: examples/07-opaque-proxy/.pulse/config.ts -->
|
|
77
|
+
```ts
|
|
78
|
+
import { defineConfig } from '@pulse-compute/pulse'
|
|
79
|
+
|
|
80
|
+
export default defineConfig((_scope) => ({
|
|
81
|
+
pulse: {
|
|
82
|
+
entry: 'src/index.ts',
|
|
83
|
+
tests: 'tests/pulse.harness.ts',
|
|
84
|
+
defaultProfile: 'local',
|
|
85
|
+
strict: true,
|
|
86
|
+
},
|
|
87
|
+
local: {
|
|
88
|
+
host: 'fastly',
|
|
89
|
+
target: 'native',
|
|
90
|
+
outDir: 'dist',
|
|
91
|
+
dev: {
|
|
92
|
+
fetches: {
|
|
93
|
+
'https://assets.example.com/archive.bin': {
|
|
94
|
+
opaque: true,
|
|
95
|
+
status: 206,
|
|
96
|
+
headers: [
|
|
97
|
+
['content-type', 'application/octet-stream'],
|
|
98
|
+
['x-part', 'one'],
|
|
99
|
+
['x-part', 'two'],
|
|
100
|
+
],
|
|
101
|
+
chunks: ['opaque-example'],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
fastly: {
|
|
106
|
+
bindings: {
|
|
107
|
+
backends: {
|
|
108
|
+
'https://assets.example.com': 'assets_backend',
|
|
109
|
+
},
|
|
110
|
+
dynamicBackends: false,
|
|
111
|
+
},
|
|
112
|
+
build: { name: 'pulse-opaque-proxy-example' },
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
}))
|
|
116
|
+
```
|
|
117
|
+
<!-- /pulse-doc-source -->
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
## Test harness
|
|
121
|
+
|
|
122
|
+
<!-- pulse-doc-source: examples/07-opaque-proxy/tests/pulse.harness.ts -->
|
|
123
|
+
```ts
|
|
124
|
+
export default {
|
|
125
|
+
cases: [
|
|
126
|
+
{
|
|
127
|
+
name: 'pass-through',
|
|
128
|
+
request: { path: '/archive' },
|
|
129
|
+
fetches: {
|
|
130
|
+
'https://assets.example.com/archive.bin': {
|
|
131
|
+
opaque: true,
|
|
132
|
+
status: 206,
|
|
133
|
+
headers: [
|
|
134
|
+
['content-type', 'application/octet-stream'],
|
|
135
|
+
['x-part', 'one'],
|
|
136
|
+
['x-part', 'two'],
|
|
137
|
+
],
|
|
138
|
+
chunks: ['opaque-example'],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
expect: {
|
|
142
|
+
status: 206,
|
|
143
|
+
bodyClass: 'opaque',
|
|
144
|
+
headers: { 'x-part': ['one', 'two'] },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
<!-- /pulse-doc-source -->
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pulse-examples/07-opaque-proxy",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"doctor": "pulse doctor",
|
|
8
|
+
"inspect": "pulse inspect",
|
|
9
|
+
"test": "pulse test",
|
|
10
|
+
"dev": "pulse dev",
|
|
11
|
+
"build": "pulse build"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@pulse-compute/pulse": "1.0.0-beta.1",
|
|
15
|
+
"@pulse-compute/provider-fastly": "1.0.0-beta.1"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@pulse-compute/cli": "1.0.0-beta.1",
|
|
19
|
+
"typescript": "5.9.3"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
cases: [
|
|
3
|
+
{
|
|
4
|
+
name: 'pass-through',
|
|
5
|
+
request: { path: '/archive' },
|
|
6
|
+
fetches: {
|
|
7
|
+
'https://assets.example.com/archive.bin': {
|
|
8
|
+
opaque: true,
|
|
9
|
+
status: 206,
|
|
10
|
+
headers: [
|
|
11
|
+
['content-type', 'application/octet-stream'],
|
|
12
|
+
['x-part', 'one'],
|
|
13
|
+
['x-part', 'two'],
|
|
14
|
+
],
|
|
15
|
+
chunks: ['opaque-example'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
expect: {
|
|
19
|
+
status: 206,
|
|
20
|
+
bodyClass: 'opaque',
|
|
21
|
+
headers: { 'x-part': ['one', 'two'] },
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from '@pulse-compute/pulse'
|
|
2
|
+
|
|
3
|
+
export default defineConfig((_scope) => ({
|
|
4
|
+
pulse: {
|
|
5
|
+
entry: 'src/index.ts',
|
|
6
|
+
tests: 'tests/pulse.harness.ts',
|
|
7
|
+
defaultProfile: 'local',
|
|
8
|
+
strict: true,
|
|
9
|
+
},
|
|
10
|
+
local: {
|
|
11
|
+
host: 'node',
|
|
12
|
+
target: 'native',
|
|
13
|
+
outDir: 'dist',
|
|
14
|
+
dev: {
|
|
15
|
+
fetches: {
|
|
16
|
+
'https://users.example.test/users/7': {
|
|
17
|
+
value: { id: 7, name: 'Ada' },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}))
|