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
5 changes: 5 additions & 0 deletions types/is-deflate/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
3 changes: 3 additions & 0 deletions types/is-deflate/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export = is_deflate;

declare function is_deflate(buf: Buffer | Uint8Array): boolean;
3 changes: 3 additions & 0 deletions types/is-deflate/is-deflate-tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="node" />
import isDeflate from "is-deflate";
isDeflate(Buffer.from("blah blah"));
18 changes: 18 additions & 0 deletions types/is-deflate/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"private": true,
"name": "@types/is-deflate",
"version": "1.0.9999",
"projects": [
"https://github.com/watson/is-deflate#readme"
],
"devDependencies": {
"@types/is-deflate": "workspace:.",
"@types/node": "*"
},
"owners": [
{
"name": "Matt Cowley",
"githubUsername": "MattIPv4"
}
]
}
19 changes: 19 additions & 0 deletions types/is-deflate/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "node16",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"is-deflate-tests.ts"
]
}
27 changes: 27 additions & 0 deletions types/node/node-tests/tls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,33 @@ import {
const r00ts: readonly string[] = rootCertificates;
}

// Certificate DN fields are optional and can be string or string[] (multi-valued)
{
const tlsSocket = connect({});
const peerCert = tlsSocket.getPeerCertificate();
const subject = peerCert.subject;

// Fields are optional and may be string or string[]
const cn: string | string[] | undefined = subject.CN;
const ou: string | string[] | undefined = subject.OU;
const o: string | string[] | undefined = subject.O;

// Type narrowing with Array.isArray
if (Array.isArray(subject.OU)) {
const ous: string[] = subject.OU;
} else {
const ou: string | undefined = subject.OU;
}

// Arbitrary DN attributes via index signature
const email: string | string[] | undefined = subject["emailAddress"];
const dc: string | string[] | undefined = subject["DC"];

// Issuer has the same shape
const issuer = peerCert.issuer;
const issuerCN: string | string[] | undefined = issuer.CN;
}

{
const _options: TlsOptions = {};
const _server = new Server(_options, (socket) => {});
Expand Down
14 changes: 7 additions & 7 deletions types/node/tls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ declare module "node:tls" {
import * as stream from "stream";
const CLIENT_RENEG_LIMIT: number;
const CLIENT_RENEG_WINDOW: number;
interface Certificate {
interface Certificate extends NodeJS.Dict<string | string[]> {
/**
* Country code.
*/
C: string;
C?: string | string[];
/**
* Street.
*/
ST: string;
ST?: string | string[];
/**
* Locality.
*/
L: string;
L?: string | string[];
/**
* Organization.
*/
O: string;
O?: string | string[];
/**
* Organizational unit.
*/
OU: string;
OU?: string | string[];
/**
* Common name.
*/
CN: string;
CN?: string | string[];
}
interface PeerCertificate {
/**
Expand Down
27 changes: 27 additions & 0 deletions types/node/v20/test/tls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,33 @@ import {
const r00ts: readonly string[] = rootCertificates;
}

// Certificate DN fields are optional and can be string or string[] (multi-valued)
{
const tlsSocket = connect({});
const peerCert = tlsSocket.getPeerCertificate();
const subject = peerCert.subject;

// Fields are optional and may be string or string[]
const cn: string | string[] | undefined = subject.CN;
const ou: string | string[] | undefined = subject.OU;
const o: string | string[] | undefined = subject.O;

// Type narrowing with Array.isArray
if (Array.isArray(subject.OU)) {
const ous: string[] = subject.OU;
} else {
const ou: string | undefined = subject.OU;
}

// Arbitrary DN attributes via index signature
const email: string | string[] | undefined = subject["emailAddress"];
const dc: string | string[] | undefined = subject["DC"];

// Issuer has the same shape
const issuer = peerCert.issuer;
const issuerCN: string | string[] | undefined = issuer.CN;
}

{
const _options: TlsOptions = {};
const _server = new Server(_options, (socket) => {});
Expand Down
14 changes: 7 additions & 7 deletions types/node/v20/tls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ declare module "tls" {
import * as stream from "stream";
const CLIENT_RENEG_LIMIT: number;
const CLIENT_RENEG_WINDOW: number;
interface Certificate {
interface Certificate extends NodeJS.Dict<string | string[]> {
/**
* Country code.
*/
C: string;
C?: string | string[];
/**
* Street.
*/
ST: string;
ST?: string | string[];
/**
* Locality.
*/
L: string;
L?: string | string[];
/**
* Organization.
*/
O: string;
O?: string | string[];
/**
* Organizational unit.
*/
OU: string;
OU?: string | string[];
/**
* Common name.
*/
CN: string;
CN?: string | string[];
}
interface PeerCertificate {
/**
Expand Down
27 changes: 27 additions & 0 deletions types/node/v22/test/tls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,33 @@ import {
const r00ts: readonly string[] = rootCertificates;
}

// Certificate DN fields are optional and can be string or string[] (multi-valued)
{
const tlsSocket = connect({});
const peerCert = tlsSocket.getPeerCertificate();
const subject = peerCert.subject;

// Fields are optional and may be string or string[]
const cn: string | string[] | undefined = subject.CN;
const ou: string | string[] | undefined = subject.OU;
const o: string | string[] | undefined = subject.O;

// Type narrowing with Array.isArray
if (Array.isArray(subject.OU)) {
const ous: string[] = subject.OU;
} else {
const ou: string | undefined = subject.OU;
}

// Arbitrary DN attributes via index signature
const email: string | string[] | undefined = subject["emailAddress"];
const dc: string | string[] | undefined = subject["DC"];

// Issuer has the same shape
const issuer = peerCert.issuer;
const issuerCN: string | string[] | undefined = issuer.CN;
}

{
const _options: TlsOptions = {};
const _server = new Server(_options, (socket) => {});
Expand Down
14 changes: 7 additions & 7 deletions types/node/v22/tls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ declare module "tls" {
import * as stream from "stream";
const CLIENT_RENEG_LIMIT: number;
const CLIENT_RENEG_WINDOW: number;
interface Certificate {
interface Certificate extends NodeJS.Dict<string | string[]> {
/**
* Country code.
*/
C: string;
C?: string | string[];
/**
* Street.
*/
ST: string;
ST?: string | string[];
/**
* Locality.
*/
L: string;
L?: string | string[];
/**
* Organization.
*/
O: string;
O?: string | string[];
/**
* Organizational unit.
*/
OU: string;
OU?: string | string[];
/**
* Common name.
*/
CN: string;
CN?: string | string[];
}
interface PeerCertificate {
/**
Expand Down
27 changes: 27 additions & 0 deletions types/node/v24/test/tls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,33 @@ import {
const r00ts: readonly string[] = rootCertificates;
}

// Certificate DN fields are optional and can be string or string[] (multi-valued)
{
const tlsSocket = connect({});
const peerCert = tlsSocket.getPeerCertificate();
const subject = peerCert.subject;

// Fields are optional and may be string or string[]
const cn: string | string[] | undefined = subject.CN;
const ou: string | string[] | undefined = subject.OU;
const o: string | string[] | undefined = subject.O;

// Type narrowing with Array.isArray
if (Array.isArray(subject.OU)) {
const ous: string[] = subject.OU;
} else {
const ou: string | undefined = subject.OU;
}

// Arbitrary DN attributes via index signature
const email: string | string[] | undefined = subject["emailAddress"];
const dc: string | string[] | undefined = subject["DC"];

// Issuer has the same shape
const issuer = peerCert.issuer;
const issuerCN: string | string[] | undefined = issuer.CN;
}

{
const _options: TlsOptions = {};
const _server = new Server(_options, (socket) => {});
Expand Down
14 changes: 7 additions & 7 deletions types/node/v24/tls.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ declare module "tls" {
import * as stream from "stream";
const CLIENT_RENEG_LIMIT: number;
const CLIENT_RENEG_WINDOW: number;
interface Certificate {
interface Certificate extends NodeJS.Dict<string | string[]> {
/**
* Country code.
*/
C: string;
C?: string | string[];
/**
* Street.
*/
ST: string;
ST?: string | string[];
/**
* Locality.
*/
L: string;
L?: string | string[];
/**
* Organization.
*/
O: string;
O?: string | string[];
/**
* Organizational unit.
*/
OU: string;
OU?: string | string[];
/**
* Common name.
*/
CN: string;
CN?: string | string[];
}
interface PeerCertificate {
/**
Expand Down