cloudflare / workers-types

TypeScript type definitions for authoring Cloudflare Workers.
BSD 3-Clause "New" or "Revised" License
359 stars 89 forks source link

Add detailed changelogs #291

Closed penalosa closed 2 years ago

penalosa commented 2 years ago

Adds a GitHub workflow to generate detailed changelogs to add to the release notes. It uses a typescript script (prettydiff.ts), that shells out to git diff and modifies it to look slightly better.

changeset-bot[bot] commented 2 years ago

⚠️ No Changeset found

Latest commit: 3dd31bf009c6944444b670c7b91c5700e49582bf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

penalosa commented 2 years ago

For instance, this is the last changelog (ignore the links, they only work from the context of release notes):

Added definitions

D1Database

interface D1Database {
  prepare(query: string): D1PreparedStatement;
  dump(): Promise<ArrayBuffer>;
  batch<T = unknown>(statements: D1PreparedStatement[]): Promise<D1Result<T>[]>;
  exec<T = unknown>(query: string): Promise<D1Result<T>>;
}

D1PreparedStatement

interface D1PreparedStatement {
  bind(...values: any[]): D1PreparedStatement;
  first<T = unknown>(colName?: string): Promise<T>;
  run<T = unknown>(): Promise<D1Result<T>>;
  all<T = unknown>(): Promise<D1Result<T[]>>;
  raw<T = unknown>(): Promise<T[]>;
}

D1Result

declare type D1Result<T = unknown> = {
  results?: T[];
  lastRowId: number | null;
  changes: number;
  duration: number;
  error?: string;
};

EventTargetHandlerObject

interface EventTargetHandlerObject {
  handleEvent(arg1: Event): any | undefined;
}

TextDecoderStream

declare class TextDecoderStream extends TransformStream {
  constructor(label?: string, options?: TextDecoderStreamTextDecoderStreamInit);
}

TextDecoderStreamTextDecoderStreamInit

interface TextDecoderStreamTextDecoderStreamInit {
  fatal?: boolean;
}

TextEncoderStream

declare class TextEncoderStream extends TransformStream {
  constructor();
}

Updated definitions

DurableObjectState

 interface DurableObjectState {
   ...
-  readonly id: DurableObjectId | string;
+  id: DurableObjectId;
   ...
 }

DurableObjectTransaction

 interface DurableObjectTransaction {
-  get<T = unknown>(key: string, options?: DurableObjectGetOptions): Promise<T>;
+  get<T = unknown>(
+    key: string,
+    options?: DurableObjectGetOptions
+  ): Promise<T | undefined>;
   ...
 }

FormData

 declare class FormData {
   ...
-  values(): IterableIterator<File | string>;
+  values(): IterableIterator<string | File>;
   ...
 }

IncomingRequestCfProperties

 interface IncomingRequestCfProperties {
   ...
+  isEUCountry?: string;
   ...
 }

IncomingRequestCfPropertiesTLSClientAuth

 interface IncomingRequestCfPropertiesTLSClientAuth {
   ...
+  certIssuerDNRFC2253: string;
+  certIssuerSKI: string;
+  certIssuerSerial: string;
   ...
+  certSubjectDNRFC2253: string;
   ...
+  certRevoked: string;
+  certSKI: string;
 }

R2Conditional

 interface R2Conditional {
   ...
+  secondsGranularity?: boolean;
 }

R2GetOptions

 interface R2GetOptions {
   ...
-  range?: R2Range;
+  range?: R2Range | Headers;
 }

R2ListOptions

 interface R2ListOptions {
   ...
+  startAfter?: string;
   ...
 }

R2Object

 declare abstract class R2Object {
   ...
-  readonly httpMetadata: R2HTTPMetadata;
-  readonly customMetadata: Record<string, string>;
+  readonly httpMetadata?: R2HTTPMetadata;
+  readonly customMetadata?: Record<string, string>;
   ...
 }

SubtleCrypto

 declare abstract class SubtleCrypto {
   ...
+  timingSafeEqual(
+    a: ArrayBuffer | ArrayBufferView,
+    b: ArrayBuffer | ArrayBufferView
+  ): boolean;
 }