@wix/events_schedule-bookmarks
Advanced tools
Comparing version 1.0.32 to 1.0.33
@@ -18,1 +18,2 @@ "use strict"; | ||
__exportStar(require("./src/events-schedule-v1-schedule-item-schedule-bookmarks.context"), exports); | ||
//# sourceMappingURL=context.js.map |
@@ -18,1 +18,2 @@ "use strict"; | ||
__exportStar(require("./src/events-schedule-v1-schedule-item-schedule-bookmarks.context"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -18,1 +18,2 @@ "use strict"; | ||
__exportStar(require("./src/events-schedule-v1-schedule-item-schedule-bookmarks.universal"), exports); | ||
//# sourceMappingURL=index.typings.js.map |
@@ -18,1 +18,2 @@ "use strict"; | ||
__exportStar(require("./src/events-schedule-v1-schedule-item-schedule-bookmarks.meta"), exports); | ||
//# sourceMappingURL=meta.js.map |
import { listBookmarks as publicListBookmarks, createBookmark as publicCreateBookmark, deleteBookmark as publicDeleteBookmark } from './events-schedule-v1-schedule-item-schedule-bookmarks.public'; | ||
import { BuildRESTFunction } from '@wix/sdk-types'; | ||
export declare const listBookmarks: BuildRESTFunction<typeof publicListBookmarks> & typeof publicListBookmarks; | ||
export declare const createBookmark: BuildRESTFunction<typeof publicCreateBookmark> & typeof publicCreateBookmark; | ||
export declare const deleteBookmark: BuildRESTFunction<typeof publicDeleteBookmark> & typeof publicDeleteBookmark; | ||
import { BuildRESTFunction, MaybeContext } from '@wix/sdk-types'; | ||
export declare const listBookmarks: MaybeContext<BuildRESTFunction<typeof publicListBookmarks> & typeof publicListBookmarks>; | ||
export declare const createBookmark: MaybeContext<BuildRESTFunction<typeof publicCreateBookmark> & typeof publicCreateBookmark>; | ||
export declare const deleteBookmark: MaybeContext<BuildRESTFunction<typeof publicDeleteBookmark> & typeof publicDeleteBookmark>; | ||
export { ScheduleStatus, StateFilter, SortOrder, } from './events-schedule-v1-schedule-item-schedule-bookmarks.universal'; | ||
export { ScheduleItem, TimeInterval, ListScheduleItemsRequest, Paging, ListScheduleItemsResponse, FacetCounts, PagingMetadataV2, Cursors, QueryScheduleItemsRequest, QueryV2, QueryV2PagingMethodOneOf, Sorting, QueryScheduleItemsResponse, GetScheduleItemRequest, GetScheduleItemResponse, AddScheduleItemRequest, ScheduleItemData, AddScheduleItemResponse, UpdateScheduleItemRequest, UpdateScheduleItemResponse, DeleteScheduleItemRequest, DeleteScheduleItemResponse, DiscardDraftRequest, DiscardDraftResponse, PublishDraftRequest, PublishDraftResponse, RescheduleDraftRequest, RescheduleDraftResponse, ListBookmarksRequest, ListBookmarksResponse, CreateBookmarkRequest, CreateBookmarkResponse, DeleteBookmarkRequest, DeleteBookmarkResponse, ListScheduleItemsResponseNonNullableFields, QueryScheduleItemsResponseNonNullableFields, GetScheduleItemResponseNonNullableFields, AddScheduleItemResponseNonNullableFields, UpdateScheduleItemResponseNonNullableFields, ListBookmarksResponseNonNullableFields, } from './events-schedule-v1-schedule-item-schedule-bookmarks.universal'; |
@@ -13,1 +13,2 @@ "use strict"; | ||
Object.defineProperty(exports, "SortOrder", { enumerable: true, get: function () { return events_schedule_v1_schedule_item_schedule_bookmarks_universal_1.SortOrder; } }); | ||
//# sourceMappingURL=events-schedule-v1-schedule-item-schedule-bookmarks.context.js.map |
@@ -499,1 +499,2 @@ "use strict"; | ||
exports.deleteBookmark = deleteBookmark; | ||
//# sourceMappingURL=events-schedule-v1-schedule-item-schedule-bookmarks.http.js.map |
@@ -85,1 +85,2 @@ "use strict"; | ||
exports.deleteBookmark = deleteBookmark; | ||
//# sourceMappingURL=events-schedule-v1-schedule-item-schedule-bookmarks.meta.js.map |
@@ -28,1 +28,2 @@ "use strict"; | ||
Object.defineProperty(exports, "StateFilter", { enumerable: true, get: function () { return events_schedule_v1_schedule_item_schedule_bookmarks_universal_2.StateFilter; } }); | ||
//# sourceMappingURL=events-schedule-v1-schedule-item-schedule-bookmarks.public.js.map |
@@ -27,1 +27,2 @@ "use strict"; | ||
})(SortOrder || (exports.SortOrder = SortOrder = {})); | ||
//# sourceMappingURL=events-schedule-v1-schedule-item-schedule-bookmarks.types.js.map |
@@ -151,1 +151,2 @@ "use strict"; | ||
exports.deleteBookmark = deleteBookmark; | ||
//# sourceMappingURL=events-schedule-v1-schedule-item-schedule-bookmarks.universal.js.map |
import { listBookmarks as publicListBookmarks, createBookmark as publicCreateBookmark, deleteBookmark as publicDeleteBookmark } from './events-schedule-v1-schedule-item-schedule-bookmarks.public'; | ||
import { BuildRESTFunction } from '@wix/sdk-types'; | ||
export declare const listBookmarks: BuildRESTFunction<typeof publicListBookmarks> & typeof publicListBookmarks; | ||
export declare const createBookmark: BuildRESTFunction<typeof publicCreateBookmark> & typeof publicCreateBookmark; | ||
export declare const deleteBookmark: BuildRESTFunction<typeof publicDeleteBookmark> & typeof publicDeleteBookmark; | ||
import { BuildRESTFunction, MaybeContext } from '@wix/sdk-types'; | ||
export declare const listBookmarks: MaybeContext<BuildRESTFunction<typeof publicListBookmarks> & typeof publicListBookmarks>; | ||
export declare const createBookmark: MaybeContext<BuildRESTFunction<typeof publicCreateBookmark> & typeof publicCreateBookmark>; | ||
export declare const deleteBookmark: MaybeContext<BuildRESTFunction<typeof publicDeleteBookmark> & typeof publicDeleteBookmark>; | ||
export { ScheduleStatus, StateFilter, SortOrder, } from './events-schedule-v1-schedule-item-schedule-bookmarks.universal'; | ||
export { ScheduleItem, TimeInterval, ListScheduleItemsRequest, Paging, ListScheduleItemsResponse, FacetCounts, PagingMetadataV2, Cursors, QueryScheduleItemsRequest, QueryV2, QueryV2PagingMethodOneOf, Sorting, QueryScheduleItemsResponse, GetScheduleItemRequest, GetScheduleItemResponse, AddScheduleItemRequest, ScheduleItemData, AddScheduleItemResponse, UpdateScheduleItemRequest, UpdateScheduleItemResponse, DeleteScheduleItemRequest, DeleteScheduleItemResponse, DiscardDraftRequest, DiscardDraftResponse, PublishDraftRequest, PublishDraftResponse, RescheduleDraftRequest, RescheduleDraftResponse, ListBookmarksRequest, ListBookmarksResponse, CreateBookmarkRequest, CreateBookmarkResponse, DeleteBookmarkRequest, DeleteBookmarkResponse, ListScheduleItemsResponseNonNullableFields, QueryScheduleItemsResponseNonNullableFields, GetScheduleItemResponseNonNullableFields, AddScheduleItemResponseNonNullableFields, UpdateScheduleItemResponseNonNullableFields, ListBookmarksResponseNonNullableFields, } from './events-schedule-v1-schedule-item-schedule-bookmarks.universal'; |
{ | ||
"name": "@wix/events_schedule-bookmarks", | ||
"version": "1.0.32", | ||
"version": "1.0.33", | ||
"publishConfig": { | ||
@@ -24,3 +24,3 @@ "registry": "https://registry.npmjs.org/", | ||
"@wix/sdk-runtime": "^0.3.14", | ||
"@wix/sdk-types": "^1.9.2" | ||
"@wix/sdk-types": "^1.12.3" | ||
}, | ||
@@ -49,3 +49,3 @@ "devDependencies": { | ||
}, | ||
"falconPackageHash": "6cb4670c2f0cc56bf2ab08e82c872e3f35e0b08b40cd52d6cbfa080f" | ||
"falconPackageHash": "7d111e7bcc46ce54de7c3c0171095335b199f0695c4138bd43e0a333" | ||
} |
@@ -0,1 +1,39 @@ | ||
type HostModule<T, H extends Host> = { | ||
__type: 'host'; | ||
create(host: H): T; | ||
}; | ||
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never; | ||
type Host<Environment = unknown> = { | ||
channel: { | ||
observeState(callback: (props: unknown, environment: Environment) => unknown): { | ||
disconnect: () => void; | ||
} | Promise<{ | ||
disconnect: () => void; | ||
}>; | ||
}; | ||
environment?: Environment; | ||
/** | ||
* Optional bast url to use for API requests, for example `www.wixapis.com` | ||
*/ | ||
apiBaseUrl?: string; | ||
/** | ||
* Possible data to be provided by every host, for cross cutting concerns | ||
* like internationalization, billing, etc. | ||
*/ | ||
essentials?: { | ||
/** | ||
* The language of the currently viewed session | ||
*/ | ||
language?: string; | ||
/** | ||
* The locale of the currently viewed session | ||
*/ | ||
locale?: string; | ||
/** | ||
* Any headers that should be passed through to the API requests | ||
*/ | ||
passThroughHeaders?: Record<string, string>; | ||
}; | ||
}; | ||
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T; | ||
@@ -6,2 +44,3 @@ interface HttpClient { | ||
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>; | ||
getActiveToken?: () => string | undefined; | ||
} | ||
@@ -28,3 +67,62 @@ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>; | ||
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never; | ||
type EventDefinition<Payload = unknown, Type extends string = string> = { | ||
__type: 'event-definition'; | ||
type: Type; | ||
isDomainEvent?: boolean; | ||
transformations?: (envelope: unknown) => Payload; | ||
__payload: Payload; | ||
}; | ||
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>; | ||
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>; | ||
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void; | ||
type ServicePluginMethodInput = { | ||
request: any; | ||
metadata: any; | ||
}; | ||
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>; | ||
type ServicePluginMethodMetadata = { | ||
name: string; | ||
primaryHttpMappingPath: string; | ||
transformations: { | ||
fromREST: (...args: unknown[]) => ServicePluginMethodInput; | ||
toREST: (...args: unknown[]) => unknown; | ||
}; | ||
}; | ||
type ServicePluginDefinition<Contract extends ServicePluginContract> = { | ||
__type: 'service-plugin-definition'; | ||
componentType: string; | ||
methods: ServicePluginMethodMetadata[]; | ||
__contract: Contract; | ||
}; | ||
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>; | ||
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void; | ||
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error"; | ||
type RequestContext = { | ||
isSSR: boolean; | ||
host: string; | ||
protocol?: string; | ||
}; | ||
type ResponseTransformer = (data: any, headers?: any) => any; | ||
/** | ||
* Ambassador request options types are copied mostly from AxiosRequestConfig. | ||
* They are copied and not imported to reduce the amount of dependencies (to reduce install time). | ||
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315 | ||
*/ | ||
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'; | ||
type AmbassadorRequestOptions<T = any> = { | ||
_?: T; | ||
url?: string; | ||
method?: Method; | ||
params?: any; | ||
data?: any; | ||
transformResponse?: ResponseTransformer | ResponseTransformer[]; | ||
}; | ||
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & { | ||
__isAmbassador: boolean; | ||
}; | ||
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>; | ||
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never; | ||
declare global { | ||
@@ -37,2 +135,280 @@ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged. | ||
declare const emptyObjectSymbol: unique symbol; | ||
/** | ||
Represents a strictly empty plain object, the `{}` value. | ||
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)). | ||
@example | ||
``` | ||
import type {EmptyObject} from 'type-fest'; | ||
// The following illustrates the problem with `{}`. | ||
const foo1: {} = {}; // Pass | ||
const foo2: {} = []; // Pass | ||
const foo3: {} = 42; // Pass | ||
const foo4: {} = {a: 1}; // Pass | ||
// With `EmptyObject` only the first case is valid. | ||
const bar1: EmptyObject = {}; // Pass | ||
const bar2: EmptyObject = 42; // Fail | ||
const bar3: EmptyObject = []; // Fail | ||
const bar4: EmptyObject = {a: 1}; // Fail | ||
``` | ||
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}. | ||
@category Object | ||
*/ | ||
type EmptyObject = {[emptyObjectSymbol]?: never}; | ||
/** | ||
Returns a boolean for whether the two given types are equal. | ||
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 | ||
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 | ||
Use-cases: | ||
- If you want to make a conditional branch based on the result of a comparison of two types. | ||
@example | ||
``` | ||
import type {IsEqual} from 'type-fest'; | ||
// This type returns a boolean for whether the given array includes the given item. | ||
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. | ||
type Includes<Value extends readonly any[], Item> = | ||
Value extends readonly [Value[0], ...infer rest] | ||
? IsEqual<Value[0], Item> extends true | ||
? true | ||
: Includes<rest, Item> | ||
: false; | ||
``` | ||
@category Type Guard | ||
@category Utilities | ||
*/ | ||
type IsEqual<A, B> = | ||
(<G>() => G extends A ? 1 : 2) extends | ||
(<G>() => G extends B ? 1 : 2) | ||
? true | ||
: false; | ||
/** | ||
Filter out keys from an object. | ||
Returns `never` if `Exclude` is strictly equal to `Key`. | ||
Returns `never` if `Key` extends `Exclude`. | ||
Returns `Key` otherwise. | ||
@example | ||
``` | ||
type Filtered = Filter<'foo', 'foo'>; | ||
//=> never | ||
``` | ||
@example | ||
``` | ||
type Filtered = Filter<'bar', string>; | ||
//=> never | ||
``` | ||
@example | ||
``` | ||
type Filtered = Filter<'bar', 'foo'>; | ||
//=> 'bar' | ||
``` | ||
@see {Except} | ||
*/ | ||
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType); | ||
type ExceptOptions = { | ||
/** | ||
Disallow assigning non-specified properties. | ||
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`. | ||
@default false | ||
*/ | ||
requireExactProps?: boolean; | ||
}; | ||
/** | ||
Create a type from an object type without certain keys. | ||
We recommend setting the `requireExactProps` option to `true`. | ||
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. | ||
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). | ||
@example | ||
``` | ||
import type {Except} from 'type-fest'; | ||
type Foo = { | ||
a: number; | ||
b: string; | ||
}; | ||
type FooWithoutA = Except<Foo, 'a'>; | ||
//=> {b: string} | ||
const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; | ||
//=> errors: 'a' does not exist in type '{ b: string; }' | ||
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>; | ||
//=> {a: number} & Partial<Record<"b", never>> | ||
const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; | ||
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'. | ||
``` | ||
@category Object | ||
*/ | ||
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = { | ||
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType]; | ||
} & (Options['requireExactProps'] extends true | ||
? Partial<Record<KeysType, never>> | ||
: {}); | ||
/** | ||
Extract the keys from a type where the value type of the key extends the given `Condition`. | ||
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types. | ||
@example | ||
``` | ||
import type {ConditionalKeys} from 'type-fest'; | ||
interface Example { | ||
a: string; | ||
b: string | number; | ||
c?: string; | ||
d: {}; | ||
} | ||
type StringKeysOnly = ConditionalKeys<Example, string>; | ||
//=> 'a' | ||
``` | ||
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below. | ||
@example | ||
``` | ||
import type {ConditionalKeys} from 'type-fest'; | ||
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>; | ||
//=> 'a' | 'c' | ||
``` | ||
@category Object | ||
*/ | ||
type ConditionalKeys<Base, Condition> = NonNullable< | ||
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union. | ||
{ | ||
// Map through all the keys of the given base type. | ||
[Key in keyof Base]: | ||
// Pick only keys with types extending the given `Condition` type. | ||
Base[Key] extends Condition | ||
// Retain this key since the condition passes. | ||
? Key | ||
// Discard this key since the condition fails. | ||
: never; | ||
// Convert the produced object into a union type of the keys which passed the conditional test. | ||
}[keyof Base] | ||
>; | ||
/** | ||
Exclude keys from a shape that matches the given `Condition`. | ||
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties. | ||
@example | ||
``` | ||
import type {Primitive, ConditionalExcept} from 'type-fest'; | ||
class Awesome { | ||
name: string; | ||
successes: number; | ||
failures: bigint; | ||
run() {} | ||
} | ||
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>; | ||
//=> {run: () => void} | ||
``` | ||
@example | ||
``` | ||
import type {ConditionalExcept} from 'type-fest'; | ||
interface Example { | ||
a: string; | ||
b: string | number; | ||
c: () => void; | ||
d: {}; | ||
} | ||
type NonStringKeysOnly = ConditionalExcept<Example, string>; | ||
//=> {b: string | number; c: () => void; d: {}} | ||
``` | ||
@category Object | ||
*/ | ||
type ConditionalExcept<Base, Condition> = Except< | ||
Base, | ||
ConditionalKeys<Base, Condition> | ||
>; | ||
/** | ||
* Descriptors are objects that describe the API of a module, and the module | ||
* can either be a REST module or a host module. | ||
* This type is recursive, so it can describe nested modules. | ||
*/ | ||
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | { | ||
[key: string]: Descriptors | PublicMetadata | any; | ||
}; | ||
/** | ||
* This type takes in a descriptors object of a certain Host (including an `unknown` host) | ||
* and returns an object with the same structure, but with all descriptors replaced with their API. | ||
* Any non-descriptor properties are removed from the returned object, including descriptors that | ||
* do not match the given host (as they will not work with the given host). | ||
*/ | ||
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = { | ||
done: T; | ||
recurse: T extends { | ||
__type: typeof SERVICE_PLUGIN_ERROR_TYPE; | ||
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{ | ||
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [ | ||
-1, | ||
0, | ||
1, | ||
2, | ||
3, | ||
4, | ||
5 | ||
][Depth]> : never; | ||
}, EmptyObject>; | ||
}[Depth extends -1 ? 'done' : 'recurse']; | ||
type PublicMetadata = { | ||
PACKAGE_NAME?: string; | ||
}; | ||
declare global { | ||
interface ContextualClient { | ||
} | ||
} | ||
/** | ||
* A type used to create concerete types from SDK descriptors in | ||
* case a contextual client is available. | ||
*/ | ||
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends { | ||
host: Host; | ||
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T; | ||
/** Schedule item describes the schedule within an event. Each event may contain multiple schedule items. */ | ||
@@ -437,6 +813,6 @@ interface ScheduleItem { | ||
declare const listBookmarks: BuildRESTFunction<typeof listBookmarks$1> & typeof listBookmarks$1; | ||
declare const createBookmark: BuildRESTFunction<typeof createBookmark$1> & typeof createBookmark$1; | ||
declare const deleteBookmark: BuildRESTFunction<typeof deleteBookmark$1> & typeof deleteBookmark$1; | ||
declare const listBookmarks: MaybeContext<BuildRESTFunction<typeof listBookmarks$1> & typeof listBookmarks$1>; | ||
declare const createBookmark: MaybeContext<BuildRESTFunction<typeof createBookmark$1> & typeof createBookmark$1>; | ||
declare const deleteBookmark: MaybeContext<BuildRESTFunction<typeof deleteBookmark$1> & typeof deleteBookmark$1>; | ||
export { type AddScheduleItemRequest, type AddScheduleItemResponse, type AddScheduleItemResponseNonNullableFields, type CreateBookmarkRequest, type CreateBookmarkResponse, type Cursors, type DeleteBookmarkRequest, type DeleteBookmarkResponse, type DeleteScheduleItemRequest, type DeleteScheduleItemResponse, type DiscardDraftRequest, type DiscardDraftResponse, type FacetCounts, type GetScheduleItemRequest, type GetScheduleItemResponse, type GetScheduleItemResponseNonNullableFields, type ListBookmarksRequest, type ListBookmarksResponse, type ListBookmarksResponseNonNullableFields, type ListScheduleItemsRequest, type ListScheduleItemsResponse, type ListScheduleItemsResponseNonNullableFields, type Paging, type PagingMetadataV2, type PublishDraftRequest, type PublishDraftResponse, type QueryScheduleItemsRequest, type QueryScheduleItemsResponse, type QueryScheduleItemsResponseNonNullableFields, type QueryV2, type QueryV2PagingMethodOneOf, type RescheduleDraftRequest, type RescheduleDraftResponse, type ScheduleItem, type ScheduleItemData, ScheduleStatus, SortOrder, type Sorting, StateFilter, type TimeInterval, type UpdateScheduleItemRequest, type UpdateScheduleItemResponse, type UpdateScheduleItemResponseNonNullableFields, createBookmark, deleteBookmark, listBookmarks }; |
@@ -0,1 +1,39 @@ | ||
type HostModule<T, H extends Host> = { | ||
__type: 'host'; | ||
create(host: H): T; | ||
}; | ||
type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never; | ||
type Host<Environment = unknown> = { | ||
channel: { | ||
observeState(callback: (props: unknown, environment: Environment) => unknown): { | ||
disconnect: () => void; | ||
} | Promise<{ | ||
disconnect: () => void; | ||
}>; | ||
}; | ||
environment?: Environment; | ||
/** | ||
* Optional bast url to use for API requests, for example `www.wixapis.com` | ||
*/ | ||
apiBaseUrl?: string; | ||
/** | ||
* Possible data to be provided by every host, for cross cutting concerns | ||
* like internationalization, billing, etc. | ||
*/ | ||
essentials?: { | ||
/** | ||
* The language of the currently viewed session | ||
*/ | ||
language?: string; | ||
/** | ||
* The locale of the currently viewed session | ||
*/ | ||
locale?: string; | ||
/** | ||
* Any headers that should be passed through to the API requests | ||
*/ | ||
passThroughHeaders?: Record<string, string>; | ||
}; | ||
}; | ||
type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T; | ||
@@ -6,2 +44,3 @@ interface HttpClient { | ||
wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>; | ||
getActiveToken?: () => string | undefined; | ||
} | ||
@@ -28,3 +67,62 @@ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>; | ||
type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never; | ||
type EventDefinition<Payload = unknown, Type extends string = string> = { | ||
__type: 'event-definition'; | ||
type: Type; | ||
isDomainEvent?: boolean; | ||
transformations?: (envelope: unknown) => Payload; | ||
__payload: Payload; | ||
}; | ||
declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>; | ||
type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>; | ||
type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void; | ||
type ServicePluginMethodInput = { | ||
request: any; | ||
metadata: any; | ||
}; | ||
type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>; | ||
type ServicePluginMethodMetadata = { | ||
name: string; | ||
primaryHttpMappingPath: string; | ||
transformations: { | ||
fromREST: (...args: unknown[]) => ServicePluginMethodInput; | ||
toREST: (...args: unknown[]) => unknown; | ||
}; | ||
}; | ||
type ServicePluginDefinition<Contract extends ServicePluginContract> = { | ||
__type: 'service-plugin-definition'; | ||
componentType: string; | ||
methods: ServicePluginMethodMetadata[]; | ||
__contract: Contract; | ||
}; | ||
declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>; | ||
type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void; | ||
declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error"; | ||
type RequestContext = { | ||
isSSR: boolean; | ||
host: string; | ||
protocol?: string; | ||
}; | ||
type ResponseTransformer = (data: any, headers?: any) => any; | ||
/** | ||
* Ambassador request options types are copied mostly from AxiosRequestConfig. | ||
* They are copied and not imported to reduce the amount of dependencies (to reduce install time). | ||
* https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315 | ||
*/ | ||
type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK'; | ||
type AmbassadorRequestOptions<T = any> = { | ||
_?: T; | ||
url?: string; | ||
method?: Method; | ||
params?: any; | ||
data?: any; | ||
transformResponse?: ResponseTransformer | ResponseTransformer[]; | ||
}; | ||
type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & { | ||
__isAmbassador: boolean; | ||
}; | ||
type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>; | ||
type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never; | ||
declare global { | ||
@@ -37,2 +135,280 @@ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged. | ||
declare const emptyObjectSymbol: unique symbol; | ||
/** | ||
Represents a strictly empty plain object, the `{}` value. | ||
When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)). | ||
@example | ||
``` | ||
import type {EmptyObject} from 'type-fest'; | ||
// The following illustrates the problem with `{}`. | ||
const foo1: {} = {}; // Pass | ||
const foo2: {} = []; // Pass | ||
const foo3: {} = 42; // Pass | ||
const foo4: {} = {a: 1}; // Pass | ||
// With `EmptyObject` only the first case is valid. | ||
const bar1: EmptyObject = {}; // Pass | ||
const bar2: EmptyObject = 42; // Fail | ||
const bar3: EmptyObject = []; // Fail | ||
const bar4: EmptyObject = {a: 1}; // Fail | ||
``` | ||
Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}. | ||
@category Object | ||
*/ | ||
type EmptyObject = {[emptyObjectSymbol]?: never}; | ||
/** | ||
Returns a boolean for whether the two given types are equal. | ||
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 | ||
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 | ||
Use-cases: | ||
- If you want to make a conditional branch based on the result of a comparison of two types. | ||
@example | ||
``` | ||
import type {IsEqual} from 'type-fest'; | ||
// This type returns a boolean for whether the given array includes the given item. | ||
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. | ||
type Includes<Value extends readonly any[], Item> = | ||
Value extends readonly [Value[0], ...infer rest] | ||
? IsEqual<Value[0], Item> extends true | ||
? true | ||
: Includes<rest, Item> | ||
: false; | ||
``` | ||
@category Type Guard | ||
@category Utilities | ||
*/ | ||
type IsEqual<A, B> = | ||
(<G>() => G extends A ? 1 : 2) extends | ||
(<G>() => G extends B ? 1 : 2) | ||
? true | ||
: false; | ||
/** | ||
Filter out keys from an object. | ||
Returns `never` if `Exclude` is strictly equal to `Key`. | ||
Returns `never` if `Key` extends `Exclude`. | ||
Returns `Key` otherwise. | ||
@example | ||
``` | ||
type Filtered = Filter<'foo', 'foo'>; | ||
//=> never | ||
``` | ||
@example | ||
``` | ||
type Filtered = Filter<'bar', string>; | ||
//=> never | ||
``` | ||
@example | ||
``` | ||
type Filtered = Filter<'bar', 'foo'>; | ||
//=> 'bar' | ||
``` | ||
@see {Except} | ||
*/ | ||
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType); | ||
type ExceptOptions = { | ||
/** | ||
Disallow assigning non-specified properties. | ||
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`. | ||
@default false | ||
*/ | ||
requireExactProps?: boolean; | ||
}; | ||
/** | ||
Create a type from an object type without certain keys. | ||
We recommend setting the `requireExactProps` option to `true`. | ||
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. | ||
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). | ||
@example | ||
``` | ||
import type {Except} from 'type-fest'; | ||
type Foo = { | ||
a: number; | ||
b: string; | ||
}; | ||
type FooWithoutA = Except<Foo, 'a'>; | ||
//=> {b: string} | ||
const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; | ||
//=> errors: 'a' does not exist in type '{ b: string; }' | ||
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>; | ||
//=> {a: number} & Partial<Record<"b", never>> | ||
const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; | ||
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'. | ||
``` | ||
@category Object | ||
*/ | ||
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = { | ||
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType]; | ||
} & (Options['requireExactProps'] extends true | ||
? Partial<Record<KeysType, never>> | ||
: {}); | ||
/** | ||
Extract the keys from a type where the value type of the key extends the given `Condition`. | ||
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types. | ||
@example | ||
``` | ||
import type {ConditionalKeys} from 'type-fest'; | ||
interface Example { | ||
a: string; | ||
b: string | number; | ||
c?: string; | ||
d: {}; | ||
} | ||
type StringKeysOnly = ConditionalKeys<Example, string>; | ||
//=> 'a' | ||
``` | ||
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below. | ||
@example | ||
``` | ||
import type {ConditionalKeys} from 'type-fest'; | ||
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>; | ||
//=> 'a' | 'c' | ||
``` | ||
@category Object | ||
*/ | ||
type ConditionalKeys<Base, Condition> = NonNullable< | ||
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union. | ||
{ | ||
// Map through all the keys of the given base type. | ||
[Key in keyof Base]: | ||
// Pick only keys with types extending the given `Condition` type. | ||
Base[Key] extends Condition | ||
// Retain this key since the condition passes. | ||
? Key | ||
// Discard this key since the condition fails. | ||
: never; | ||
// Convert the produced object into a union type of the keys which passed the conditional test. | ||
}[keyof Base] | ||
>; | ||
/** | ||
Exclude keys from a shape that matches the given `Condition`. | ||
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties. | ||
@example | ||
``` | ||
import type {Primitive, ConditionalExcept} from 'type-fest'; | ||
class Awesome { | ||
name: string; | ||
successes: number; | ||
failures: bigint; | ||
run() {} | ||
} | ||
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>; | ||
//=> {run: () => void} | ||
``` | ||
@example | ||
``` | ||
import type {ConditionalExcept} from 'type-fest'; | ||
interface Example { | ||
a: string; | ||
b: string | number; | ||
c: () => void; | ||
d: {}; | ||
} | ||
type NonStringKeysOnly = ConditionalExcept<Example, string>; | ||
//=> {b: string | number; c: () => void; d: {}} | ||
``` | ||
@category Object | ||
*/ | ||
type ConditionalExcept<Base, Condition> = Except< | ||
Base, | ||
ConditionalKeys<Base, Condition> | ||
>; | ||
/** | ||
* Descriptors are objects that describe the API of a module, and the module | ||
* can either be a REST module or a host module. | ||
* This type is recursive, so it can describe nested modules. | ||
*/ | ||
type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | { | ||
[key: string]: Descriptors | PublicMetadata | any; | ||
}; | ||
/** | ||
* This type takes in a descriptors object of a certain Host (including an `unknown` host) | ||
* and returns an object with the same structure, but with all descriptors replaced with their API. | ||
* Any non-descriptor properties are removed from the returned object, including descriptors that | ||
* do not match the given host (as they will not work with the given host). | ||
*/ | ||
type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = { | ||
done: T; | ||
recurse: T extends { | ||
__type: typeof SERVICE_PLUGIN_ERROR_TYPE; | ||
} ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{ | ||
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [ | ||
-1, | ||
0, | ||
1, | ||
2, | ||
3, | ||
4, | ||
5 | ||
][Depth]> : never; | ||
}, EmptyObject>; | ||
}[Depth extends -1 ? 'done' : 'recurse']; | ||
type PublicMetadata = { | ||
PACKAGE_NAME?: string; | ||
}; | ||
declare global { | ||
interface ContextualClient { | ||
} | ||
} | ||
/** | ||
* A type used to create concerete types from SDK descriptors in | ||
* case a contextual client is available. | ||
*/ | ||
type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends { | ||
host: Host; | ||
} ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T; | ||
/** Schedule item describes the schedule within an event. Each event may contain multiple schedule items. */ | ||
@@ -437,6 +813,6 @@ interface ScheduleItem { | ||
declare const listBookmarks: BuildRESTFunction<typeof listBookmarks$1> & typeof listBookmarks$1; | ||
declare const createBookmark: BuildRESTFunction<typeof createBookmark$1> & typeof createBookmark$1; | ||
declare const deleteBookmark: BuildRESTFunction<typeof deleteBookmark$1> & typeof deleteBookmark$1; | ||
declare const listBookmarks: MaybeContext<BuildRESTFunction<typeof listBookmarks$1> & typeof listBookmarks$1>; | ||
declare const createBookmark: MaybeContext<BuildRESTFunction<typeof createBookmark$1> & typeof createBookmark$1>; | ||
declare const deleteBookmark: MaybeContext<BuildRESTFunction<typeof deleteBookmark$1> & typeof deleteBookmark$1>; | ||
export { type AddScheduleItemRequest, type AddScheduleItemResponse, type AddScheduleItemResponseNonNullableFields, type CreateBookmarkRequest, type CreateBookmarkResponse, type Cursors, type DeleteBookmarkRequest, type DeleteBookmarkResponse, type DeleteScheduleItemRequest, type DeleteScheduleItemResponse, type DiscardDraftRequest, type DiscardDraftResponse, type FacetCounts, type GetScheduleItemRequest, type GetScheduleItemResponse, type GetScheduleItemResponseNonNullableFields, type ListBookmarksRequest, type ListBookmarksResponse, type ListBookmarksResponseNonNullableFields, type ListScheduleItemsRequest, type ListScheduleItemsResponse, type ListScheduleItemsResponseNonNullableFields, type Paging, type PagingMetadataV2, type PublishDraftRequest, type PublishDraftResponse, type QueryScheduleItemsRequest, type QueryScheduleItemsResponse, type QueryScheduleItemsResponseNonNullableFields, type QueryV2, type QueryV2PagingMethodOneOf, type RescheduleDraftRequest, type RescheduleDraftResponse, type ScheduleItem, type ScheduleItemData, ScheduleStatus, SortOrder, type Sorting, StateFilter, type TimeInterval, type UpdateScheduleItemRequest, type UpdateScheduleItemResponse, type UpdateScheduleItemResponseNonNullableFields, createBookmark, deleteBookmark, listBookmarks }; |
Sorry, the diff of this file is not supported yet
246469
67
5475
+ Added@wix/filter-builder@1.0.91(transitive)
+ Added@wix/metro-runtime@1.1877.0(transitive)
- Removed@wix/filter-builder@1.0.92(transitive)
- Removed@wix/metro-runtime@1.1878.0(transitive)
Updated@wix/sdk-types@^1.12.3