@cloudflare/types
Advanced tools
Comparing version 6.18.0 to 6.18.1
import { TypeFromCodec } from '@cloudflare/util-en-garde'; | ||
import { TypeFromEnumerable } from '../utils/enumerable'; | ||
export declare const PagesUploadFileResult: import("@cloudflare/util-en-garde").ObjectCodec<{ | ||
@@ -412,1 +413,3 @@ id: import("@cloudflare/util-en-garde").Codec<import("io-ts").StringC>; | ||
export declare type UploadFileGroupPayload = TypeFromCodec<typeof UploadFileGroupPayload>; | ||
export declare const FunctionsUsageModel: import("../utils/enumerable").Enumerable<"bundled" | "unbound">; | ||
export declare type FunctionsUsageModel = TypeFromEnumerable<typeof FunctionsUsageModel>; |
import * as React from 'react'; | ||
export * from './enumerable'; | ||
export declare type Omit<A, B> = Pick<A, Exclude<keyof A, B>>; | ||
@@ -3,0 +4,0 @@ /** |
import { eg } from '@cloudflare/util-en-garde'; | ||
import { enumerable } from '../utils/enumerable'; | ||
export const PagesUploadFileResult = eg.object({ | ||
@@ -157,2 +158,3 @@ id: eg.string | ||
base64: eg.boolean | ||
}); | ||
}); | ||
export const FunctionsUsageModel = enumerable(['bundled', 'unbound']); |
@@ -1,2 +0,2 @@ | ||
// (A - keys of B) | ||
export * from './enumerable'; // (A - keys of B) | ||
// In set theory, this would be the set complement A ∖ B (https://en.wikipedia.org/wiki/Complement_(set_theory)#Relative_complement) | ||
@@ -9,171 +9,2 @@ // Example: | ||
/** | ||
* Get PropTypes of a component. | ||
* @example | ||
* const OtherComponent: React.FC<{ foo: string }> = () => <div>{foo}</div> | ||
* type MyComponentProps = PropTypes<typeof OtherComponent> & { bar: string } // {foo: string, bar: string} | ||
*/ | ||
/** | ||
* ValueOf: similar to keyof, but picks a value. | ||
* | ||
* @example | ||
* type Person = { | ||
* name: string, | ||
* phone: number | null | ||
* } | ||
* | ||
* type PhoneType = ValueOf<Person>; // string | number | null | ||
*/ | ||
/** | ||
* Arguments<Fn>: Get type of arguments of a function. | ||
* @example | ||
* type Fn = (foo: string, bar: number) => void | ||
* type FnArguments = Arguments<Fn> // [string, number] | ||
*/ | ||
/** | ||
* Get type of array element | ||
* | ||
* @example | ||
* const Names = ["Robert", "Ollie", "John", "Cina", "Millie"] // typeof Names === string[] | ||
* type Name = ValueOfArray<typeof Names> // string | ||
* | ||
* @example | ||
* // typeof readonlyNames === readonly ["Robert", "Ollie", "John", "Cina", "Millie"] | ||
* const nameTuple = ["Robert", "Ollie", "John", "Cina", "Millie"] as const | ||
* // Name === "Robert" | "Ollie" | "John" | "Cina" | "Millie" | ||
* type Name = ValueOfReadonlyArray<typeof nameTuple> | ||
*/ | ||
/** | ||
* Overwrite certain keys with new types. | ||
* | ||
* @example | ||
* type A = {a: string, b?: string} | ||
* type result = Overwrite<A, {b: string}> = {a: string, b: string} | ||
* (Note that b is no longer optional) | ||
*/ | ||
/** | ||
* Converts union to intersection. | ||
* | ||
* @example | ||
* type A = "hello" | 5 | ||
* type IntersectionA = UnionToIntersection<A> = "hello" & 5 | ||
*/ | ||
/** | ||
* Doing keyof UnionOfObjects in TypeScript will give you intersection of keys. For example: | ||
* type UnionOfObjects = {a: string, b: number} | {a: string} | ||
* type Keys = keyof UnionOfObjects // "a"[] | ||
* | ||
* Sometimes, you might want all possible keys, in other words, you want union of keys. You can use this type for it. | ||
* | ||
* @example | ||
* type UnionOfObjects = {a: string, b: number } | {a: string} | ||
* type AllKeys = KeyOfUnion<UnionOfObjects> // "a" | "b" | ||
*/ | ||
/** | ||
* Converts readonly array to non-readonly array. | ||
* | ||
* @example | ||
* const ReadonlyArray = [5, 4] as const; | ||
* | ||
* type NonReadonlyArray = NonReadonly<typeof ReadonlyArray> | ||
*/ | ||
/** | ||
* Remove types from T that are assignable to U | ||
*/ | ||
/** | ||
* Remove types from T that are not assignable to U | ||
*/ | ||
/** | ||
* Represents Some value, or None | ||
*/ | ||
/** | ||
* Given a tuple, get the type of the head of the tuple | ||
*/ | ||
/** | ||
* Given a tuple, return a new tuple without the head | ||
*/ | ||
/** | ||
* Append T to R where R is a tuple | ||
*/ | ||
/** | ||
* Reverses the given tuple type. | ||
*/ | ||
/** | ||
* Force TS to load a type that has not been computed | ||
* (to resolve composed types that TS hasn't resolved). | ||
* https://pirix-gh.github.io/ts-toolbelt/modules/_any_compute_.html | ||
* | ||
* @example | ||
* // becomes {foo: string, baz: boolean} | ||
* type Foo = Compute<{bar: string} & {baz: boolean}> | ||
*/ | ||
/** | ||
* Same as Partial, but recursively. | ||
* | ||
* @example | ||
* type A = { | ||
* foo: { | ||
* bar: string | ||
* } | ||
* } | ||
* | ||
* type B = PartialDeep<A> | ||
* // Becomes { foo?: {bar?: string | undefined} | undefined } | ||
*/ | ||
/** | ||
* Selectively apply Partial to certain properties. | ||
* | ||
* @example | ||
* type T = { | ||
* foo: string; | ||
* bar: string; | ||
* baz?: string | undefined; | ||
* } | ||
* | ||
* type OptionalBar = PartialKeys<T, "bar"> // { foo: string; bar?: string | undefined; baz?: string | undefined; } | ||
*/ | ||
/** | ||
* Selectively apply Required to certain properties. | ||
* | ||
* @example | ||
* type T = { | ||
* foo: string; | ||
* bar?: string | undefined; | ||
* baz?: string | undefined; | ||
* } | ||
* | ||
* type RequiredBar = RequiredKeys<T, "bar"> // { foo: string; bar: string; baz?: string | undefined; } | ||
*/ | ||
/** | ||
* Selectively apply Readonly to certain properties. | ||
* | ||
* @example | ||
* type T = { | ||
* foo: string; | ||
* bar: string; | ||
* readonly baz: string; | ||
* } | ||
* | ||
* type ReadonlyBar = ReadonlyKeys<T, "bar"> // { foo: string; readonly bar: string; readonly baz: string; } | ||
*/ | ||
/** | ||
* Generates the typings for usage with Object.keys | ||
@@ -180,0 +11,0 @@ * |
@@ -6,6 +6,8 @@ "use strict"; | ||
}); | ||
exports.UploadFileGroupPayload = exports.DirectUploadsJWT = exports.DeploymentExistingLiveLogs = exports.DeploymentLiveLogsJWTPayload = exports.DeploymentLiveLogsJWT = exports.UnifiedDeploymentLogMessages = exports.LogMessage = exports.Project = exports.DeploymentConfigs = exports.DeploymentConfigEnv = exports.BucketBindingValue = exports.DatabaseBindingValue = exports.NamespaceBindingValue = exports.EnvironmentVariableBindingMap = exports.EnvironmentVariableBindingValue = exports.Deployment = exports.ProjectSource = exports.ProjectSourceConfig = exports.BuildConfig = exports.DeploymentStage = exports.Environment = exports.PagesUploadFileResult = void 0; | ||
exports.FunctionsUsageModel = exports.UploadFileGroupPayload = exports.DirectUploadsJWT = exports.DeploymentExistingLiveLogs = exports.DeploymentLiveLogsJWTPayload = exports.DeploymentLiveLogsJWT = exports.UnifiedDeploymentLogMessages = exports.LogMessage = exports.Project = exports.DeploymentConfigs = exports.DeploymentConfigEnv = exports.BucketBindingValue = exports.DatabaseBindingValue = exports.NamespaceBindingValue = exports.EnvironmentVariableBindingMap = exports.EnvironmentVariableBindingValue = exports.Deployment = exports.ProjectSource = exports.ProjectSourceConfig = exports.BuildConfig = exports.DeploymentStage = exports.Environment = exports.PagesUploadFileResult = void 0; | ||
var _utilEnGarde = require("@cloudflare/util-en-garde"); | ||
var _enumerable = require("../utils/enumerable"); | ||
var PagesUploadFileResult = _utilEnGarde.eg.object({ | ||
@@ -230,2 +232,4 @@ id: _utilEnGarde.eg.string | ||
exports.UploadFileGroupPayload = UploadFileGroupPayload; | ||
exports.UploadFileGroupPayload = UploadFileGroupPayload; | ||
var FunctionsUsageModel = (0, _enumerable.enumerable)(['bundled', 'unbound']); | ||
exports.FunctionsUsageModel = FunctionsUsageModel; |
@@ -6,182 +6,23 @@ "use strict"; | ||
}); | ||
var _exportNames = { | ||
objectKeys: true, | ||
assertNever: true | ||
}; | ||
exports.objectKeys = objectKeys; | ||
exports.assertNever = void 0; | ||
// (A - keys of B) | ||
// In set theory, this would be the set complement A ∖ B (https://en.wikipedia.org/wiki/Complement_(set_theory)#Relative_complement) | ||
// Example: | ||
// type A = {a: string, b: number, c: boolean} | ||
// type B = {b: number} | ||
// type result = Omit<A, keyof B> = {a: string, c: boolean} | ||
var _enumerable = require("./enumerable"); | ||
/** | ||
* Get PropTypes of a component. | ||
* @example | ||
* const OtherComponent: React.FC<{ foo: string }> = () => <div>{foo}</div> | ||
* type MyComponentProps = PropTypes<typeof OtherComponent> & { bar: string } // {foo: string, bar: string} | ||
*/ | ||
Object.keys(_enumerable).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _enumerable[key]; | ||
} | ||
}); | ||
}); | ||
/** | ||
* ValueOf: similar to keyof, but picks a value. | ||
* | ||
* @example | ||
* type Person = { | ||
* name: string, | ||
* phone: number | null | ||
* } | ||
* | ||
* type PhoneType = ValueOf<Person>; // string | number | null | ||
*/ | ||
/** | ||
* Arguments<Fn>: Get type of arguments of a function. | ||
* @example | ||
* type Fn = (foo: string, bar: number) => void | ||
* type FnArguments = Arguments<Fn> // [string, number] | ||
*/ | ||
/** | ||
* Get type of array element | ||
* | ||
* @example | ||
* const Names = ["Robert", "Ollie", "John", "Cina", "Millie"] // typeof Names === string[] | ||
* type Name = ValueOfArray<typeof Names> // string | ||
* | ||
* @example | ||
* // typeof readonlyNames === readonly ["Robert", "Ollie", "John", "Cina", "Millie"] | ||
* const nameTuple = ["Robert", "Ollie", "John", "Cina", "Millie"] as const | ||
* // Name === "Robert" | "Ollie" | "John" | "Cina" | "Millie" | ||
* type Name = ValueOfReadonlyArray<typeof nameTuple> | ||
*/ | ||
/** | ||
* Overwrite certain keys with new types. | ||
* | ||
* @example | ||
* type A = {a: string, b?: string} | ||
* type result = Overwrite<A, {b: string}> = {a: string, b: string} | ||
* (Note that b is no longer optional) | ||
*/ | ||
/** | ||
* Converts union to intersection. | ||
* | ||
* @example | ||
* type A = "hello" | 5 | ||
* type IntersectionA = UnionToIntersection<A> = "hello" & 5 | ||
*/ | ||
/** | ||
* Doing keyof UnionOfObjects in TypeScript will give you intersection of keys. For example: | ||
* type UnionOfObjects = {a: string, b: number} | {a: string} | ||
* type Keys = keyof UnionOfObjects // "a"[] | ||
* | ||
* Sometimes, you might want all possible keys, in other words, you want union of keys. You can use this type for it. | ||
* | ||
* @example | ||
* type UnionOfObjects = {a: string, b: number } | {a: string} | ||
* type AllKeys = KeyOfUnion<UnionOfObjects> // "a" | "b" | ||
*/ | ||
/** | ||
* Converts readonly array to non-readonly array. | ||
* | ||
* @example | ||
* const ReadonlyArray = [5, 4] as const; | ||
* | ||
* type NonReadonlyArray = NonReadonly<typeof ReadonlyArray> | ||
*/ | ||
/** | ||
* Remove types from T that are assignable to U | ||
*/ | ||
/** | ||
* Remove types from T that are not assignable to U | ||
*/ | ||
/** | ||
* Represents Some value, or None | ||
*/ | ||
/** | ||
* Given a tuple, get the type of the head of the tuple | ||
*/ | ||
/** | ||
* Given a tuple, return a new tuple without the head | ||
*/ | ||
/** | ||
* Append T to R where R is a tuple | ||
*/ | ||
/** | ||
* Reverses the given tuple type. | ||
*/ | ||
/** | ||
* Force TS to load a type that has not been computed | ||
* (to resolve composed types that TS hasn't resolved). | ||
* https://pirix-gh.github.io/ts-toolbelt/modules/_any_compute_.html | ||
* | ||
* @example | ||
* // becomes {foo: string, baz: boolean} | ||
* type Foo = Compute<{bar: string} & {baz: boolean}> | ||
*/ | ||
/** | ||
* Same as Partial, but recursively. | ||
* | ||
* @example | ||
* type A = { | ||
* foo: { | ||
* bar: string | ||
* } | ||
* } | ||
* | ||
* type B = PartialDeep<A> | ||
* // Becomes { foo?: {bar?: string | undefined} | undefined } | ||
*/ | ||
/** | ||
* Selectively apply Partial to certain properties. | ||
* | ||
* @example | ||
* type T = { | ||
* foo: string; | ||
* bar: string; | ||
* baz?: string | undefined; | ||
* } | ||
* | ||
* type OptionalBar = PartialKeys<T, "bar"> // { foo: string; bar?: string | undefined; baz?: string | undefined; } | ||
*/ | ||
/** | ||
* Selectively apply Required to certain properties. | ||
* | ||
* @example | ||
* type T = { | ||
* foo: string; | ||
* bar?: string | undefined; | ||
* baz?: string | undefined; | ||
* } | ||
* | ||
* type RequiredBar = RequiredKeys<T, "bar"> // { foo: string; bar: string; baz?: string | undefined; } | ||
*/ | ||
/** | ||
* Selectively apply Readonly to certain properties. | ||
* | ||
* @example | ||
* type T = { | ||
* foo: string; | ||
* bar: string; | ||
* readonly baz: string; | ||
* } | ||
* | ||
* type ReadonlyBar = ReadonlyKeys<T, "bar"> // { foo: string; readonly bar: string; readonly baz: string; } | ||
*/ | ||
/** | ||
* Generates the typings for usage with Object.keys | ||
@@ -188,0 +29,0 @@ * |
{ | ||
"name": "@cloudflare/types", | ||
"description": "Cloudflare API data types and various type helpers.", | ||
"version": "6.18.0", | ||
"version": "6.18.1", | ||
"types": "./dist/index.d.ts", | ||
@@ -36,3 +36,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "d82e02a48ffcbb84433cc4dcda9704c66e75cc86" | ||
"gitHead": "9bf41b571b69228b053066b4fef6a5250c816bed" | ||
} |
import { eg, TypeFromCodec } from '@cloudflare/util-en-garde'; | ||
import { enumerable, TypeFromEnumerable } from '../utils/enumerable'; | ||
@@ -244,1 +245,6 @@ export const PagesUploadFileResult = eg.object({ | ||
>; | ||
export const FunctionsUsageModel = enumerable(['bundled', 'unbound']); | ||
export type FunctionsUsageModel = TypeFromEnumerable< | ||
typeof FunctionsUsageModel | ||
>; |
import * as React from 'react'; | ||
export * from './enumerable'; | ||
// (A - keys of B) | ||
@@ -3,0 +5,0 @@ // In set theory, this would be the set complement A ∖ B (https://en.wikipedia.org/wiki/Complement_(set_theory)#Relative_complement) |
Sorry, the diff of this file is too big to display
159
1288846
15437