@dfinity/utils
Advanced tools
Comparing version 2.1.2 to 2.1.3-next-2024-03-25
@@ -7,3 +7,3 @@ import type { ActorConfig, ActorSubclass, Agent } from "@dfinity/agent"; | ||
export declare const createServices: <T>({ options: { canisterId, serviceOverride, certifiedServiceOverride, agent: agentOption, callTransform, queryTransform, }, idlFactory, certifiedIdlFactory, }: { | ||
options: Required<Pick<CanisterOptions<T>, "canisterId">> & Omit<CanisterOptions<T>, "canisterId"> & Pick<ActorConfig, "queryTransform" | "callTransform">; | ||
options: RequiredCanisterOptions<T> & Pick<ActorConfig, "queryTransform" | "callTransform">; | ||
idlFactory: IDL.InterfaceFactory; | ||
@@ -10,0 +10,0 @@ certifiedIdlFactory: IDL.InterfaceFactory; |
@@ -1,3 +0,3 @@ | ||
export declare const toNullable: <T>(value?: T | null | undefined) => [] | [T]; | ||
export declare const toNullable: <T>(value?: T | null) => [] | [T]; | ||
export declare const fromNullable: <T>(value: [] | [T]) => T | undefined; | ||
export declare const fromDefinedNullable: <T>(value: [] | [T]) => T; |
/** Is null or undefined */ | ||
export declare const isNullish: <T>(argument: T | null | undefined) => argument is null | undefined; | ||
export declare const isNullish: <T>(argument: T | undefined | null) => argument is null | undefined; | ||
/** Not null and not undefined */ | ||
export declare const nonNullish: <T>(argument: T | null | undefined) => argument is NonNullable<T>; | ||
export declare const nonNullish: <T>(argument: T | undefined | null) => argument is NonNullable<T>; | ||
/** Not null and not undefined and not empty */ | ||
export declare const notEmptyString: (value: string | undefined | null) => boolean; |
{ | ||
"name": "@dfinity/utils", | ||
"version": "2.1.2", | ||
"version": "2.1.3-next-2024-03-25", | ||
"description": "A collection of utilities and constants for NNS/SNS projects.", | ||
@@ -50,6 +50,6 @@ "license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@dfinity/agent": "^1.0.1", | ||
"@dfinity/candid": "^1.0.1", | ||
"@dfinity/principal": "^1.0.1" | ||
"@dfinity/agent": "*", | ||
"@dfinity/candid": "*", | ||
"@dfinity/principal": "*" | ||
} | ||
} | ||
} |
@@ -93,5 +93,5 @@ # utils-js | ||
| Function | Type | | ||
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `createAgent` | `({ identity, host, fetchRootKey, verifyQuerySignatures, }: { identity: Identity; host?: string; fetchRootKey?: boolean; verifyQuerySignatures?: boolean; }) => Promise<HttpAgent>` | | ||
| Function | Type | | ||
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `createAgent` | `({ identity, host, fetchRootKey, verifyQuerySignatures, }: { identity: Identity; host?: string or undefined; fetchRootKey?: boolean or undefined; verifyQuerySignatures?: boolean or undefined; }) => Promise<HttpAgent>` | | ||
@@ -109,5 +109,5 @@ Parameters: | ||
| Function | Type | | ||
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| `createServices` | `<T>({ options: { canisterId, serviceOverride, certifiedServiceOverride, agent: agentOption, callTransform, queryTransform, }, idlFactory, certifiedIdlFactory, }: { options: Required<Pick<CanisterOptions<T>, "canisterId">> and Omit<CanisterOptions<T>, "canisterId"> & Pick<...>; idlFactory: InterfaceFactory; certifiedId...` | | ||
| Function | Type | | ||
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `createServices` | `<T>({ options: { canisterId, serviceOverride, certifiedServiceOverride, agent: agentOption, callTransform, queryTransform, }, idlFactory, certifiedIdlFactory, }: { options: Required<Pick<CanisterOptions<T>, "canisterId">> and Omit<CanisterOptions<T>, "canisterId"> and Pick<...>; idlFactory: InterfaceFactory; certifiedId...` | | ||
@@ -118,5 +118,5 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/actor.utils.ts#L13) | ||
| Function | Type | | ||
| ------------------ | -------------------------------------------------------------------- | | ||
| `assertNonNullish` | `<T>(value: T, message?: string) => asserts value is NonNullable<T>` | | ||
| Function | Type | | ||
| ------------------ | --------------------------------------------------------------------------------- | | ||
| `assertNonNullish` | `<T>(value: T, message?: string or undefined) => asserts value is NonNullable<T>` | | ||
@@ -246,5 +246,5 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/asserts.utils.ts#L7) | ||
| Function | Type | | ||
| ------------------- | ------------------------------------------------------------------------------------ | | ||
| `secondsToDuration` | `({ seconds, i18n, }: { seconds: bigint; i18n?: I18nSecondsToDuration; }) => string` | | ||
| Function | Type | | ||
| ------------------- | ------------------------------------------------------------------------------------------------- | | ||
| `secondsToDuration` | `({ seconds, i18n, }: { seconds: bigint; i18n?: I18nSecondsToDuration or undefined; }) => string` | | ||
@@ -254,2 +254,4 @@ Parameters: | ||
- `options`: - The options object. | ||
- `options.seconds`: - The number of seconds to convert. | ||
- `options.i18n`: - The i18n object for customizing language and units. Defaults to English. | ||
@@ -260,5 +262,5 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/date.utils.ts#L43) | ||
| Function | Type | | ||
| ---------- | -------------------------------------------------------------------- | | ||
| `debounce` | `(func: Function, timeout?: number) => (...args: unknown[]) => void` | | ||
| Function | Type | | ||
| ---------- | --------------------------------------------------------------------------------- | | ||
| `debounce` | `(func: Function, timeout?: number or undefined) => (...args: unknown[]) => void` | | ||
@@ -271,5 +273,5 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/debounce.utils.ts#L2) | ||
| Function | Type | | ||
| ----------- | -------------------------------------- | | ||
| `isNullish` | `<T>(argument: T) => argument is null` | | ||
| Function | Type | | ||
| ----------- | ------------------------------------------------------------------------ | | ||
| `isNullish` | `<T>(argument: T or null or undefined) => argument is null or undefined` | | ||
@@ -282,5 +284,5 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/nullish.utils.ts#L2) | ||
| Function | Type | | ||
| ------------ | ------------------------------------------------ | | ||
| `nonNullish` | `<T>(argument: T) => argument is NonNullable<T>` | | ||
| Function | Type | | ||
| ------------ | --------------------------------------------------------------------- | | ||
| `nonNullish` | `<T>(argument: T or null or undefined) => argument is NonNullable<T>` | | ||
@@ -293,5 +295,5 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/nullish.utils.ts#L7) | ||
| Function | Type | | ||
| ---------------- | ---------------------------- | | ||
| `notEmptyString` | `(value: string) => boolean` | | ||
| Function | Type | | ||
| ---------------- | ------------------------------------------------- | | ||
| `notEmptyString` | `(value: string or null or undefined) => boolean` | | ||
@@ -302,5 +304,5 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/nullish.utils.ts#L12) | ||
| Function | Type | | ||
| ------------ | ----------------------------- | | ||
| `toNullable` | `<T>(value?: T) => [] or [T]` | | ||
| Function | Type | | ||
| ------------ | -------------------------------------------------- | | ||
| `toNullable` | `<T>(value?: T or null or undefined) => [] or [T]` | | ||
@@ -311,5 +313,5 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/did.utils.ts#L4) | ||
| Function | Type | | ||
| -------------- | ---------------------------- | | ||
| `fromNullable` | `<T>(value: [] or [T]) => T` | | ||
| Function | Type | | ||
| -------------- | ----------------------------------------- | | ||
| `fromNullable` | `<T>(value: [] or [T]) => T or undefined` | | ||
@@ -370,2 +372,7 @@ [:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/did.utils.ts#L8) | ||
Parameters: | ||
- `params.minVersion`: Ex: "1.0.0" | ||
- `params.currentVersion`: Ex: "2.0.0" | ||
[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/utils/src/utils/version.utils.ts#L28) | ||
@@ -372,0 +379,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
157579
557
3