Skip to content

Commit 427f964

Browse files
Write initial bindings
0 parents  commit 427f964

20 files changed

+1215
-0
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/bower_components/
2+
/node_modules/
3+
/.pulp-cache/
4+
/output/
5+
/generated-docs/
6+
/.psc-package/
7+
/.psc*
8+
/.purs*
9+
/.psa*
10+
/.spago

packages.dhall

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let upstream =
2+
https://github.com/purescript/package-sets/releases/download/psc-0.15.8-20230609/packages.dhall
3+
sha256:cb9995a97812b86f41f6d8efe4be981b55cd924252002f256084cfe2836bdfd6
4+
5+
in upstream

spago.dhall

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{ name = "node-http2"
2+
, dependencies =
3+
[ "datetime"
4+
, "effect"
5+
, "either"
6+
, "exceptions"
7+
, "functions"
8+
, "maybe"
9+
, "node-buffer"
10+
, "node-fs"
11+
, "node-net"
12+
, "node-path"
13+
, "node-streams"
14+
, "nullable"
15+
, "partial"
16+
, "prelude"
17+
, "typelevel-prelude"
18+
]
19+
, packages = ./packages.dhall
20+
, sources = [ "src/**/*.purs" ]
21+
}

src/Node/Http2.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import http2 from "node:http2";
2+
3+
export const createSecureServerImpl = (opts) => http2.createSecureServer(opts);
4+
export const connectAuthImpl = (auth) => http2.connect(auth);
5+
export const connectAuthOptionsImpl = (auth) => http2.connect(auth, options);
6+
export const getDefaultSettings = () => http2.getDefaultSettings();
7+
export const getPackedSettingsImpl = (settings) => http2.getPackedSettings(settings);
8+
export const getUnpackedSettingsImpl = (buf) => http2.getUnpackedSettings(buf);
9+
10+
const undefined_ = undefined;
11+
export { undefined_ as undefined }

src/Node/Http2.purs

Lines changed: 365 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { constants } from "node:http2";
2+
3+
export const noError = constants.NGHTTP2_NO_ERROR;
4+
export const protocolError = constants.NGHTTP2_PROTOCOL_ERROR;
5+
export const internalError = constants.NGHTTP2_INTERNAL_ERROR;
6+
export const flowControlError = constants.NGHTTP2_FLOW_CONTROL_ERROR;
7+
export const settingsTimeout = constants.NGHTTP2_SETTINGS_TIMEOUT;
8+
export const streamClosed = constants.NGHTTP2_STREAM_CLOSED;
9+
export const frameSizeError = constants.NGHTTP2_FRAME_SIZE_ERROR;
10+
export const refusedStream = constants.NGHTTP2_REFUSED_STREAM;
11+
export const cancel = constants.NGHTTP2_CANCEL;
12+
export const compressionError = constants.NGHTTP2_COMPRESSION_ERROR;
13+
export const connectError = constants.NGHTTP2_CONNECT_ERROR;
14+
export const enhanceYourCalm = constants.NGHTTP2_ENHANCE_YOUR_CALM;
15+
export const inadequateSecurity = constants.NGHTTP2_INADEQUATE_SECURITY;
16+
export const http1_1Required = constants.NGHTTP2_HTTP_1_1_REQUIRED;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module Node.Http2.Constants where
2+
3+
foreign import noError :: Int
4+
foreign import protocolError :: Int
5+
foreign import internalError :: Int
6+
foreign import flowControlError :: Int
7+
foreign import settingsTimeout :: Int
8+
foreign import streamClosed :: Int
9+
foreign import frameSizeError :: Int
10+
foreign import refusedStream :: Int
11+
foreign import cancel :: Int
12+
foreign import compressionError :: Int
13+
foreign import connectError :: Int
14+
foreign import enhanceYourCalm :: Int
15+
foreign import inadequateSecurity :: Int
16+
foreign import http1_1Required :: Int
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const paddingStrategyNone = constants.PADDING_STRATEGY_NONE;
2+
export const paddingStrategyMax = constants.PADDING_STRATEGY_MAX;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- | Note: not all padding strategies are listed below.
2+
-- | I think some were added/removed in major Node versions.
3+
module Node.Http2.Constants.PaddingStrategy where
4+
5+
foreign import paddingStrategyNone :: Int
6+
foreign import paddingStrategyMax :: Int

src/Node/Http2/SensitiveHeaders.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { sensitiveHeaders } from "node:http2";

0 commit comments

Comments
 (0)